/base/000_base/bower_components/highcharts/js/modules/heatmap.src.js |
@@ -1,5 +1,5 @@ |
/** |
* @license Highcharts JS v5.0.10 (2017-03-31) |
* @license Highcharts JS v5.0.12 (2017-05-24) |
* |
* (c) 2009-2017 Torstein Honsi |
* |
@@ -104,7 +104,7 @@ |
if (userOptions.dataClasses) { |
this.initDataClasses(userOptions); |
} |
this.initStops(userOptions); |
this.initStops(); |
|
// Override original axis properties |
this.horiz = horiz; |
@@ -114,39 +114,8 @@ |
this.defaultLegendLength = 200; |
}, |
|
/* |
* Return an intermediate color between two colors, according to pos where 0 |
* is the from color and 1 is the to color. |
* NOTE: Changes here should be copied |
* to the same function in drilldown.src.js and solid-gauge-src.js. |
*/ |
tweenColors: function(from, to, pos) { |
// Check for has alpha, because rgba colors perform worse due to lack of |
// support in WebKit. |
var hasAlpha, |
ret; |
|
// Unsupported color, return to-color (#3920) |
if (!to.rgba.length || !from.rgba.length) { |
ret = to.input || 'none'; |
|
// Interpolate |
} else { |
from = from.rgba; |
to = to.rgba; |
hasAlpha = (to[3] !== 1 || from[3] !== 1); |
ret = (hasAlpha ? 'rgba(' : 'rgb(') + |
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + |
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + |
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + |
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; |
} |
return ret; |
}, |
|
initDataClasses: function(userOptions) { |
var axis = this, |
chart = this.chart, |
var chart = this.chart, |
dataClasses, |
colorCounter = 0, |
colorCount = chart.options.chart.colorCount, |
@@ -171,8 +140,7 @@ |
colorCounter = 0; |
} |
} else { |
dataClass.color = axis.tweenColors( |
color(options.minColor), |
dataClass.color = color(options.minColor).tweenTo( |
color(options.maxColor), |
len < 2 ? 0.5 : i / (len - 1) // #3219 |
); |
@@ -181,8 +149,8 @@ |
}); |
}, |
|
initStops: function(userOptions) { |
this.stops = userOptions.stops || [ |
initStops: function() { |
this.stops = this.options.stops || [ |
[0, this.options.minColor], |
[1, this.options.maxColor] |
]; |
@@ -226,6 +194,13 @@ |
} |
}, |
|
normalizedValue: function(value) { |
if (this.isLog) { |
value = this.val2lin(value); |
} |
return 1 - ((this.max - value) / ((this.max - this.min) || 1)); |
}, |
|
/** |
* Translate from a value to a color |
*/ |
@@ -257,10 +232,7 @@ |
|
} else { |
|
if (this.isLog) { |
value = this.val2lin(value); |
} |
pos = 1 - ((this.max - value) / ((this.max - this.min) || 1)); |
pos = this.normalizedValue(value); |
i = stops.length; |
while (i--) { |
if (pos > stops[i][0]) { |
@@ -273,8 +245,7 @@ |
// The position within the gradient |
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); |
|
color = this.tweenColors( |
from.color, |
color = from.color.tweenTo( |
to.color, |
pos |
); |
@@ -316,7 +287,6 @@ |
setLegendColor: function() { |
var grad, |
horiz = this.horiz, |
options = this.options, |
reversed = this.reversed, |
one = reversed ? 1 : 0, |
zero = reversed ? 0 : 1; |
@@ -329,10 +299,7 @@ |
x2: grad[2], |
y2: grad[3] |
}, |
stops: options.stops || [ |
[0, options.minColor], |
[1, options.maxColor] |
] |
stops: this.stops |
}; |
}, |
|
@@ -430,7 +397,7 @@ |
// When updating data classes, destroy old items and make sure new ones are created (#3207) |
if (newOptions.dataClasses && legend.allItems) { |
each(legend.allItems, function(item) { |
if (item.isDataClass) { |
if (item.isDataClass && item.legendGroup) { |
item.legendGroup.destroy(); |
} |
}); |
@@ -449,6 +416,16 @@ |
}, |
|
/** |
* Extend basic axis remove by also removing the legend item. |
*/ |
remove: function() { |
if (this.legendItem) { |
this.chart.legend.destroyItem(this); |
} |
Axis.prototype.remove.call(this); |
}, |
|
/** |
* Get the legend item symbols for data classes |
*/ |
getDataClassLegendSymbols: function() { |
@@ -518,8 +495,7 @@ |
H.Fx.prototype[prop + 'Setter'] = function() { |
this.elem.attr( |
prop, |
ColorAxis.prototype.tweenColors( |
color(this.start), |
color(this.start).tweenTo( |
color(this.end), |
this.pos |
), |