/base/000_base/bower_components/highcharts/modules/drilldown.src.js |
@@ -1,5 +1,5 @@ |
/** |
* @license Highcharts JS v5.0.10 (2017-03-31) |
* @license Highcharts JS v5.0.12 (2017-05-24) |
* Highcharts Drilldown module |
* |
* Author: Torstein Honsi |
@@ -30,6 +30,7 @@ |
each = H.each, |
extend = H.extend, |
format = H.format, |
objectEach = H.objectEach, |
pick = H.pick, |
wrap = H.wrap, |
Chart = H.Chart, |
@@ -41,49 +42,6 @@ |
inArray = H.inArray, |
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. 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, |
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; |
} |
/** |
* Handle animation of the color attributes directly |
*/ |
each(['fill', 'stroke'], function(prop) { |
H.Fx.prototype[prop + 'Setter'] = function() { |
this.elem.attr( |
prop, |
tweenColors(color(this.start), color(this.end), this.pos), |
null, |
true |
); |
}; |
}); |
|
// Add language |
extend(defaultOptions.lang, { |
drillUpText: '◁ Back to {series.name}' |
@@ -133,8 +91,26 @@ |
}); |
}; |
|
Chart.prototype.addSeriesAsDrilldown = function(point, ddOptions) { |
this.addSingleSeriesAsDrilldown(point, ddOptions); |
/** |
* Add a series to the chart as drilldown from a specific point in the parent |
* series. This method is used for async drilldown, when clicking a point in a |
* series should result in loading and displaying a more high-resolution series. |
* When not async, the setup is simpler using the {@link |
* https://api.highcharts.com/highcharts/drilldown.series|drilldown.series} |
* options structure. |
* |
* @memberOf Highcharts.Chart |
* @function #addSeriesAsDrilldown |
* |
* @param {Highcharts.Point} point |
* The point from which the drilldown will start. |
* @param {SeriesOptions} options |
* The series options for the new, detailed series. |
* |
* @sample highcharts/drilldown/async/ Async drilldown |
*/ |
Chart.prototype.addSeriesAsDrilldown = function(point, options) { |
this.addSingleSeriesAsDrilldown(point, options); |
this.applyDrilldown(); |
}; |
Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) { |
@@ -214,6 +190,11 @@ |
// Push it to the lookup array |
this.drilldownLevels.push(level); |
|
// Reset names to prevent extending (#6704) |
if (xAxis && xAxis.names) { |
xAxis.names.length = 0; |
} |
|
newSeries = level.lowerSeries = this.addSeries(ddOptions, false); |
newSeries.options._levelNumber = levelNumber + 1; |
if (xAxis) { |
@@ -299,6 +280,13 @@ |
} |
}; |
|
/** |
* When the chart is drilled down to a child series, calling `chart.drillUp()` |
* will drill up to the parent series. |
* |
* @memberOf Highcharts.Chart |
* @name #drillUp |
*/ |
Chart.prototype.drillUp = function() { |
var chart = this, |
drilldownLevels = chart.drilldownLevels, |
@@ -511,6 +499,9 @@ |
ColumnSeries.prototype.animateDrillupFrom = function(level) { |
var animationOptions = this.chart.options.drilldown.animation, |
group = this.group, |
// For 3d column series all columns are added to one group |
// so we should not delete the whole group. #5297 |
removeGroup = group !== this.chart.seriesGroup, |
series = this; |
|
// Cancel mouse events on the series group (#2787) |
@@ -520,14 +511,16 @@ |
} |
}); |
|
if (removeGroup) { |
delete this.group; |
} |
|
delete this.group; |
each(this.points, function(point) { |
var graphic = point.graphic, |
animateTo = level.shapeArgs, |
complete = function() { |
graphic.destroy(); |
if (group) { |
if (group && removeGroup) { |
group = group.destroy(); |
} |
}; |
@@ -640,15 +633,11 @@ |
* Drill down to a given category. This is the same as clicking on an axis label. |
*/ |
H.Axis.prototype.drilldownCategory = function(x, e) { |
var key, |
point, |
ddPointsX = this.getDDPoints(x); |
for (key in ddPointsX) { |
point = ddPointsX[key]; |
objectEach(this.getDDPoints(x), function(point) { |
if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 |
point.doDrilldown(true, x, e); |
} |
} |
}); |
this.chart.applyDrilldown(); |
}; |
|
@@ -787,26 +776,26 @@ |
}); |
|
// Mark the trackers with a pointer |
var type, |
drawTrackerWrapper = function(proceed) { |
proceed.call(this); |
each(this.points, function(point) { |
if (point.drilldown && point.graphic) { |
point.graphic.addClass('highcharts-drilldown-point'); |
var drawTrackerWrapper = function(proceed) { |
proceed.call(this); |
each(this.points, function(point) { |
if (point.drilldown && point.graphic) { |
point.graphic.addClass('highcharts-drilldown-point'); |
|
|
point.graphic.css({ |
cursor: 'pointer' |
}); |
point.graphic.css({ |
cursor: 'pointer' |
}); |
|
} |
}); |
}; |
for (type in seriesTypes) { |
if (seriesTypes[type].prototype.supportsDrilldown) { |
wrap(seriesTypes[type].prototype, 'drawTracker', drawTrackerWrapper); |
} |
}); |
}; |
|
objectEach(seriesTypes, function(seriesType) { |
if (seriesType.prototype.supportsDrilldown) { |
wrap(seriesType.prototype, 'drawTracker', drawTrackerWrapper); |
} |
} |
}); |
|
}(Highcharts)); |
})); |