app/assets/javascripts/highcharts/modules/drilldown.js in highcharts-rails-4.1.3 vs app/assets/javascripts/highcharts/modules/drilldown.js in highcharts-rails-4.1.4
- old
+ new
@@ -29,27 +29,35 @@
ddSeriesId = 1;
// Utilities
/*
* Return an intermediate color between two colors, according to pos where 0
- * is the from color and 1 is the to color
+ * is the from color and 1 is the to color. This method is copied from ColorAxis.js
+ * and should always be kept updated, until we get AMD support.
*/
function tweenColors(from, to, pos) {
// Check for has alpha, because rgba colors perform worse due to lack of
// support in WebKit.
- var hasAlpha;
+ var hasAlpha,
+ ret;
- from = from.rgba;
- to = to.rgba;
- hasAlpha = (to[3] !== 1 || from[3] !== 1);
- if (!to.length || !from.length) {
+ // Unsupported color, return to-color (#3920)
+ if (!to.rgba.length || !from.rgba.length) {
Highcharts.error(23);
+ ret = to.raw;
+
+ // 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 (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;
}
/**
* Handle animation of the color attributes directly
*/
each(['fill', 'stroke'], function (prop) {