corrade-nucleus-nucleons – Diff between revs 1 and 11
?pathlinks?
Rev 1 | Rev 11 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | /** |
1 | /** |
|
2 | * @license Highcharts JS v5.0.10 (2017-03-31) |
2 | * @license Highcharts JS v5.0.12 (2017-05-24) |
|
3 | * Highcharts Drilldown module |
3 | * Highcharts Drilldown module |
|
4 | * |
4 | * |
|
5 | * Author: Torstein Honsi |
5 | * Author: Torstein Honsi |
|
6 | * License: www.highcharts.com/license |
6 | * License: www.highcharts.com/license |
|
7 | * |
7 | * |
|
Line 28... | Line 28... | |||
28 | color = H.color, |
28 | color = H.color, |
|
29 | defaultOptions = H.defaultOptions, |
29 | defaultOptions = H.defaultOptions, |
|
30 | each = H.each, |
30 | each = H.each, |
|
31 | extend = H.extend, |
31 | extend = H.extend, |
|
32 | format = H.format, |
32 | format = H.format, |
|
- | 33 | objectEach = H.objectEach, |
||
33 | pick = H.pick, |
34 | pick = H.pick, |
|
34 | wrap = H.wrap, |
35 | wrap = H.wrap, |
|
35 | Chart = H.Chart, |
36 | Chart = H.Chart, |
|
36 | seriesTypes = H.seriesTypes, |
37 | seriesTypes = H.seriesTypes, |
|
37 | PieSeries = seriesTypes.pie, |
38 | PieSeries = seriesTypes.pie, |
|
Line 39... | Line 40... | |||
39 | Tick = H.Tick, |
40 | Tick = H.Tick, |
|
40 | fireEvent = H.fireEvent, |
41 | fireEvent = H.fireEvent, |
|
41 | inArray = H.inArray, |
42 | inArray = H.inArray, |
|
42 | ddSeriesId = 1; |
43 | ddSeriesId = 1; |
|
Line 43... | Line -... | |||
43 | |
- | ||
44 | // Utilities |
- | ||
45 | /* |
- | ||
46 | * Return an intermediate color between two colors, according to pos where 0 |
- | ||
47 | * is the from color and 1 is the to color. This method is copied from ColorAxis.js |
- | ||
48 | * and should always be kept updated, until we get AMD support. |
- | ||
49 | */ |
- | ||
50 | function tweenColors(from, to, pos) { |
- | ||
51 | // Check for has alpha, because rgba colors perform worse due to lack of |
- | ||
52 | // support in WebKit. |
- | ||
53 | var hasAlpha, |
- | ||
54 | ret; |
- | ||
55 | |
- | ||
56 | // Unsupported color, return to-color (#3920) |
- | ||
57 | if (!to.rgba.length || !from.rgba.length) { |
- | ||
58 | ret = to.input || 'none'; |
- | ||
59 | |
- | ||
60 | // Interpolate |
- | ||
61 | } else { |
- | ||
62 | from = from.rgba; |
- | ||
63 | to = to.rgba; |
- | ||
64 | hasAlpha = (to[3] !== 1 || from[3] !== 1); |
- | ||
65 | ret = (hasAlpha ? 'rgba(' : 'rgb(') + |
- | ||
66 | Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + |
- | ||
67 | Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + |
- | ||
68 | Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + |
- | ||
69 | (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; |
- | ||
70 | } |
- | ||
71 | return ret; |
- | ||
72 | } |
- | ||
73 | /** |
- | ||
74 | * Handle animation of the color attributes directly |
- | ||
75 | */ |
- | ||
76 | each(['fill', 'stroke'], function(prop) { |
- | ||
77 | H.Fx.prototype[prop + 'Setter'] = function() { |
- | ||
78 | this.elem.attr( |
- | ||
79 | prop, |
- | ||
80 | tweenColors(color(this.start), color(this.end), this.pos), |
- | ||
81 | null, |
- | ||
82 | true |
- | ||
83 | ); |
- | ||
84 | }; |
- | ||
85 | }); |
- | ||
86 | |
44 | |
|
87 | // Add language |
45 | // Add language |
|
88 | extend(defaultOptions.lang, { |
46 | extend(defaultOptions.lang, { |
|
89 | drillUpText: '◁ Back to {series.name}' |
47 | drillUpText: '◁ Back to {series.name}' |
|
90 | }); |
48 | }); |
|
Line 118... | Line 76... | |||
118 | }, animation || { |
76 | }, animation || { |
|
119 | duration: 250 |
77 | duration: 250 |
|
120 | }); |
78 | }); |
|
121 | }; |
79 | }; |
|
Line -... | Line 80... | |||
- | 80 | |
||
- | 81 | /** |
||
- | 82 | * Add a series to the chart as drilldown from a specific point in the parent |
||
- | 83 | * series. This method is used for async drilldown, when clicking a point in a |
||
- | 84 | * series should result in loading and displaying a more high-resolution series. |
||
- | 85 | * When not async, the setup is simpler using the {@link |
||
- | 86 | * https://api.highcharts.com/highcharts/drilldown.series|drilldown.series} |
||
- | 87 | * options structure. |
||
- | 88 | * |
||
- | 89 | * @memberOf Highcharts.Chart |
||
- | 90 | * @function #addSeriesAsDrilldown |
||
- | 91 | * |
||
- | 92 | * @param {Highcharts.Point} point |
||
- | 93 | * The point from which the drilldown will start. |
||
- | 94 | * @param {SeriesOptions} options |
||
- | 95 | * The series options for the new, detailed series. |
||
- | 96 | * |
||
- | 97 | * @sample highcharts/drilldown/async/ Async drilldown |
||
122 | |
98 | */ |
|
123 | Chart.prototype.addSeriesAsDrilldown = function(point, ddOptions) { |
99 | Chart.prototype.addSeriesAsDrilldown = function(point, options) { |
|
124 | this.addSingleSeriesAsDrilldown(point, ddOptions); |
100 | this.addSingleSeriesAsDrilldown(point, options); |
|
125 | this.applyDrilldown(); |
101 | this.applyDrilldown(); |
|
126 | }; |
102 | }; |
|
127 | Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) { |
103 | Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) { |
|
128 | var oldSeries = point.series, |
104 | var oldSeries = point.series, |
|
Line 199... | Line 175... | |||
199 | }, colorProp); |
175 | }, colorProp); |
|
Line 200... | Line 176... | |||
200 | |
176 | |
|
201 | // Push it to the lookup array |
177 | // Push it to the lookup array |
|
Line -... | Line 178... | |||
- | 178 | this.drilldownLevels.push(level); |
||
- | 179 | |
||
- | 180 | // Reset names to prevent extending (#6704) |
||
- | 181 | if (xAxis && xAxis.names) { |
||
- | 182 | xAxis.names.length = 0; |
||
202 | this.drilldownLevels.push(level); |
183 | } |
|
203 | |
184 | |
|
204 | newSeries = level.lowerSeries = this.addSeries(ddOptions, false); |
185 | newSeries = level.lowerSeries = this.addSeries(ddOptions, false); |
|
205 | newSeries.options._levelNumber = levelNumber + 1; |
186 | newSeries.options._levelNumber = levelNumber + 1; |
|
206 | if (xAxis) { |
187 | if (xAxis) { |
|
Line 284... | Line 265... | |||
284 | }) |
265 | }) |
|
285 | .align(); |
266 | .align(); |
|
286 | } |
267 | } |
|
287 | }; |
268 | }; |
|
Line -... | Line 269... | |||
- | 269 | |
||
- | 270 | /** |
||
- | 271 | * When the chart is drilled down to a child series, calling `chart.drillUp()` |
||
- | 272 | * will drill up to the parent series. |
||
- | 273 | * |
||
- | 274 | * @memberOf Highcharts.Chart |
||
- | 275 | * @name #drillUp |
||
288 | |
276 | */ |
|
289 | Chart.prototype.drillUp = function() { |
277 | Chart.prototype.drillUp = function() { |
|
290 | var chart = this, |
278 | var chart = this, |
|
291 | drilldownLevels = chart.drilldownLevels, |
279 | drilldownLevels = chart.drilldownLevels, |
|
292 | levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber, |
280 | levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber, |
|
Line 490... | Line 478... | |||
490 | * and animate them into the origin point in the upper series. |
478 | * and animate them into the origin point in the upper series. |
|
491 | */ |
479 | */ |
|
492 | ColumnSeries.prototype.animateDrillupFrom = function(level) { |
480 | ColumnSeries.prototype.animateDrillupFrom = function(level) { |
|
493 | var animationOptions = this.chart.options.drilldown.animation, |
481 | var animationOptions = this.chart.options.drilldown.animation, |
|
494 | group = this.group, |
482 | group = this.group, |
|
- | 483 | // For 3d column series all columns are added to one group |
||
- | 484 | // so we should not delete the whole group. #5297 |
||
- | 485 | removeGroup = group !== this.chart.seriesGroup, |
||
495 | series = this; |
486 | series = this; |
|
Line 496... | Line 487... | |||
496 | |
487 | |
|
497 | // Cancel mouse events on the series group (#2787) |
488 | // Cancel mouse events on the series group (#2787) |
|
498 | each(series.trackerGroups, function(key) { |
489 | each(series.trackerGroups, function(key) { |
|
499 | if (series[key]) { // we don't always have dataLabelsGroup |
490 | if (series[key]) { // we don't always have dataLabelsGroup |
|
500 | series[key].on('mouseover'); |
491 | series[key].on('mouseover'); |
|
501 | } |
492 | } |
|
Line -... | Line 493... | |||
- | 493 | }); |
||
- | 494 | |
||
- | 495 | if (removeGroup) { |
||
Line 502... | Line -... | |||
502 | }); |
- | ||
503 | |
496 | delete this.group; |
|
504 | |
497 | } |
|
505 | delete this.group; |
498 | |
|
506 | each(this.points, function(point) { |
499 | each(this.points, function(point) { |
|
507 | var graphic = point.graphic, |
500 | var graphic = point.graphic, |
|
508 | animateTo = level.shapeArgs, |
501 | animateTo = level.shapeArgs, |
|
509 | complete = function() { |
502 | complete = function() { |
|
510 | graphic.destroy(); |
503 | graphic.destroy(); |
|
511 | if (group) { |
504 | if (group && removeGroup) { |
|
Line 512... | Line 505... | |||
512 | group = group.destroy(); |
505 | group = group.destroy(); |
|
Line 614... | Line 607... | |||
614 | |
607 | |
|
615 | /** |
608 | /** |
|
616 | * Drill down to a given category. This is the same as clicking on an axis label. |
609 | * Drill down to a given category. This is the same as clicking on an axis label. |
|
617 | */ |
610 | */ |
|
618 | H.Axis.prototype.drilldownCategory = function(x, e) { |
- | ||
619 | var key, |
- | ||
620 | point, |
611 | H.Axis.prototype.drilldownCategory = function(x, e) { |
|
621 | ddPointsX = this.getDDPoints(x); |
- | ||
622 | for (key in ddPointsX) { |
- | ||
623 | point = ddPointsX[key]; |
612 | objectEach(this.getDDPoints(x), function(point) { |
|
624 | if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 |
613 | if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 |
|
625 | point.doDrilldown(true, x, e); |
614 | point.doDrilldown(true, x, e); |
|
626 | } |
615 | } |
|
627 | } |
616 | }); |
|
628 | this.chart.applyDrilldown(); |
617 | this.chart.applyDrilldown(); |
|
Line 629... | Line 618... | |||
629 | }; |
618 | }; |
|
630 | |
619 | |
|
Line 748... | Line 737... | |||
748 | < xData.length; i++) { }> |
737 | < xData.length; i++) { }> |
|
749 | < xData.length; i++) { }, this);> |
738 | < xData.length; i++) { }, this);> |
|
750 | < xData.length; i++) { });> |
739 | < xData.length; i++) { });> |
|
Line 751... | Line 740... | |||
751 | < xData.length; i++) {> |
740 | < xData.length; i++) {> |
|
752 | < xData.length; i++) { // Mark the trackers with a pointer > |
- | ||
753 | < xData.length; i++) { var type,> |
741 | < xData.length; i++) { // Mark the trackers with a pointer > |
|
754 | < xData.length; i++) { drawTrackerWrapper = function(proceed) {> |
742 | < xData.length; i++) { var drawTrackerWrapper = function(proceed) {> |
|
755 | < xData.length; i++) { proceed.call(this);> |
743 | < xData.length; i++) { proceed.call(this);> |
|
756 | < xData.length; i++) { each(this.points, function(point) {> |
744 | < xData.length; i++) { each(this.points, function(point) {> |
|
757 | < xData.length; i++) { if (point.drilldown && point.graphic) {> |
745 | < xData.length; i++) { if (point.drilldown && point.graphic) {> |
|
Line 758... | Line 746... | |||
758 | < xData.length; i++) { point.graphic.addClass('highcharts-drilldown-point');> |
746 | < xData.length; i++) { point.graphic.addClass('highcharts-drilldown-point');> |
|
759 | < xData.length; i++) {> |
747 | < xData.length; i++) {> |
|
760 | < xData.length; i++) {> |
748 | < xData.length; i++) {> |
|
- | 749 | < xData.length; i++) { }> |
||
761 | < xData.length; i++) { }> |
750 | < xData.length; i++) { });> |
|
762 | < xData.length; i++) { });> |
751 | < xData.length; i++) { };> |
|
763 | < xData.length; i++) { };> |
752 | < xData.length; i++) {> |
|
764 | < xData.length; i++) { for (type in seriesTypes) {> |
753 | < xData.length; i++) { objectEach(seriesTypes, function(seriesType) {> |
|
765 | < xData.length; i++) { if (seriesTypes[type].prototype.supportsDrilldown) {> |
754 | < xData.length; i++) { if (seriesType.prototype.supportsDrilldown) {> |
|
Line 766... | Line 755... | |||
766 | < xData.length; i++) { wrap(seriesTypes[type].prototype, 'drawTracker', drawTrackerWrapper);> |
755 | < xData.length; i++) { wrap(seriesType.prototype, 'drawTracker', drawTrackerWrapper);> |
|
767 | < xData.length; i++) { }> |
756 | < xData.length; i++) { }> |