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 131... | Line 89... | |||
131 | }, animation || { |
89 | }, animation || { |
|
132 | duration: 250 |
90 | duration: 250 |
|
133 | }); |
91 | }); |
|
134 | }; |
92 | }; |
|
Line -... | Line 93... | |||
- | 93 | |
||
- | 94 | /** |
||
- | 95 | * Add a series to the chart as drilldown from a specific point in the parent |
||
- | 96 | * series. This method is used for async drilldown, when clicking a point in a |
||
- | 97 | * series should result in loading and displaying a more high-resolution series. |
||
- | 98 | * When not async, the setup is simpler using the {@link |
||
- | 99 | * https://api.highcharts.com/highcharts/drilldown.series|drilldown.series} |
||
- | 100 | * options structure. |
||
- | 101 | * |
||
- | 102 | * @memberOf Highcharts.Chart |
||
- | 103 | * @function #addSeriesAsDrilldown |
||
- | 104 | * |
||
- | 105 | * @param {Highcharts.Point} point |
||
- | 106 | * The point from which the drilldown will start. |
||
- | 107 | * @param {SeriesOptions} options |
||
- | 108 | * The series options for the new, detailed series. |
||
- | 109 | * |
||
- | 110 | * @sample highcharts/drilldown/async/ Async drilldown |
||
135 | |
111 | */ |
|
136 | Chart.prototype.addSeriesAsDrilldown = function(point, ddOptions) { |
112 | Chart.prototype.addSeriesAsDrilldown = function(point, options) { |
|
137 | this.addSingleSeriesAsDrilldown(point, ddOptions); |
113 | this.addSingleSeriesAsDrilldown(point, options); |
|
138 | this.applyDrilldown(); |
114 | this.applyDrilldown(); |
|
139 | }; |
115 | }; |
|
140 | Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) { |
116 | Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) { |
|
141 | var oldSeries = point.series, |
117 | var oldSeries = point.series, |
|
Line 212... | Line 188... | |||
212 | }, colorProp); |
188 | }, colorProp); |
|
Line 213... | Line 189... | |||
213 | |
189 | |
|
214 | // Push it to the lookup array |
190 | // Push it to the lookup array |
|
Line -... | Line 191... | |||
- | 191 | this.drilldownLevels.push(level); |
||
- | 192 | |
||
- | 193 | // Reset names to prevent extending (#6704) |
||
- | 194 | if (xAxis && xAxis.names) { |
||
- | 195 | xAxis.names.length = 0; |
||
215 | this.drilldownLevels.push(level); |
196 | } |
|
216 | |
197 | |
|
217 | newSeries = level.lowerSeries = this.addSeries(ddOptions, false); |
198 | newSeries = level.lowerSeries = this.addSeries(ddOptions, false); |
|
218 | newSeries.options._levelNumber = levelNumber + 1; |
199 | newSeries.options._levelNumber = levelNumber + 1; |
|
219 | if (xAxis) { |
200 | if (xAxis) { |
|
Line 297... | Line 278... | |||
297 | }) |
278 | }) |
|
298 | .align(); |
279 | .align(); |
|
299 | } |
280 | } |
|
300 | }; |
281 | }; |
|
Line -... | Line 282... | |||
- | 282 | |
||
- | 283 | /** |
||
- | 284 | * When the chart is drilled down to a child series, calling `chart.drillUp()` |
||
- | 285 | * will drill up to the parent series. |
||
- | 286 | * |
||
- | 287 | * @memberOf Highcharts.Chart |
||
- | 288 | * @name #drillUp |
||
301 | |
289 | */ |
|
302 | Chart.prototype.drillUp = function() { |
290 | Chart.prototype.drillUp = function() { |
|
303 | var chart = this, |
291 | var chart = this, |
|
304 | drilldownLevels = chart.drilldownLevels, |
292 | drilldownLevels = chart.drilldownLevels, |
|
305 | levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber, |
293 | levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber, |
|
Line 509... | Line 497... | |||
509 | * and animate them into the origin point in the upper series. |
497 | * and animate them into the origin point in the upper series. |
|
510 | */ |
498 | */ |
|
511 | ColumnSeries.prototype.animateDrillupFrom = function(level) { |
499 | ColumnSeries.prototype.animateDrillupFrom = function(level) { |
|
512 | var animationOptions = this.chart.options.drilldown.animation, |
500 | var animationOptions = this.chart.options.drilldown.animation, |
|
513 | group = this.group, |
501 | group = this.group, |
|
- | 502 | // For 3d column series all columns are added to one group |
||
- | 503 | // so we should not delete the whole group. #5297 |
||
- | 504 | removeGroup = group !== this.chart.seriesGroup, |
||
514 | series = this; |
505 | series = this; |
|
Line 515... | Line 506... | |||
515 | |
506 | |
|
516 | // Cancel mouse events on the series group (#2787) |
507 | // Cancel mouse events on the series group (#2787) |
|
517 | each(series.trackerGroups, function(key) { |
508 | each(series.trackerGroups, function(key) { |
|
518 | if (series[key]) { // we don't always have dataLabelsGroup |
509 | if (series[key]) { // we don't always have dataLabelsGroup |
|
519 | series[key].on('mouseover'); |
510 | series[key].on('mouseover'); |
|
520 | } |
511 | } |
|
Line -... | Line 512... | |||
- | 512 | }); |
||
- | 513 | |
||
- | 514 | if (removeGroup) { |
||
Line 521... | Line -... | |||
521 | }); |
- | ||
522 | |
515 | delete this.group; |
|
523 | |
516 | } |
|
524 | delete this.group; |
517 | |
|
525 | each(this.points, function(point) { |
518 | each(this.points, function(point) { |
|
526 | var graphic = point.graphic, |
519 | var graphic = point.graphic, |
|
527 | animateTo = level.shapeArgs, |
520 | animateTo = level.shapeArgs, |
|
528 | complete = function() { |
521 | complete = function() { |
|
529 | graphic.destroy(); |
522 | graphic.destroy(); |
|
530 | if (group) { |
523 | if (group && removeGroup) { |
|
Line 531... | Line 524... | |||
531 | group = group.destroy(); |
524 | group = group.destroy(); |
|
Line 638... | Line 631... | |||
638 | |
631 | |
|
639 | /** |
632 | /** |
|
640 | * Drill down to a given category. This is the same as clicking on an axis label. |
633 | * Drill down to a given category. This is the same as clicking on an axis label. |
|
641 | */ |
634 | */ |
|
642 | H.Axis.prototype.drilldownCategory = function(x, e) { |
- | ||
643 | var key, |
- | ||
644 | point, |
635 | H.Axis.prototype.drilldownCategory = function(x, e) { |
|
645 | ddPointsX = this.getDDPoints(x); |
- | ||
646 | for (key in ddPointsX) { |
- | ||
647 | point = ddPointsX[key]; |
636 | objectEach(this.getDDPoints(x), function(point) { |
|
648 | if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 |
637 | if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 |
|
649 | point.doDrilldown(true, x, e); |
638 | point.doDrilldown(true, x, e); |
|
650 | } |
639 | } |
|
651 | } |
640 | }); |
|
652 | this.chart.applyDrilldown(); |
641 | this.chart.applyDrilldown(); |
|
Line 653... | Line 642... | |||
653 | }; |
642 | }; |
|
654 | |
643 | |
|
Line 785... | Line 774... | |||
785 | < xData.length; i++) { }> |
774 | < xData.length; i++) { }> |
|
786 | < xData.length; i++) { }, this);> |
775 | < xData.length; i++) { }, this);> |
|
787 | < xData.length; i++) { });> |
776 | < xData.length; i++) { });> |
|
Line 788... | Line 777... | |||
788 | < xData.length; i++) {> |
777 | < xData.length; i++) {> |
|
789 | < xData.length; i++) { // Mark the trackers with a pointer > |
- | ||
790 | < xData.length; i++) { var type,> |
778 | < xData.length; i++) { // Mark the trackers with a pointer > |
|
791 | < xData.length; i++) { drawTrackerWrapper = function(proceed) {> |
779 | < xData.length; i++) { var drawTrackerWrapper = function(proceed) {> |
|
792 | < xData.length; i++) { proceed.call(this);> |
780 | < xData.length; i++) { proceed.call(this);> |
|
793 | < xData.length; i++) { each(this.points, function(point) {> |
781 | < xData.length; i++) { each(this.points, function(point) {> |
|
794 | < xData.length; i++) { if (point.drilldown && point.graphic) {> |
782 | < xData.length; i++) { if (point.drilldown && point.graphic) {> |
|
Line 795... | Line 783... | |||
795 | < xData.length; i++) { point.graphic.addClass('highcharts-drilldown-point');> |
783 | < xData.length; i++) { point.graphic.addClass('highcharts-drilldown-point');> |
|
796 | < xData.length; i++) {> |
784 | < xData.length; i++) {> |
|
797 | < xData.length; i++) {> |
785 | < xData.length; i++) {> |
|
Line 798... | Line 786... | |||
798 | < xData.length; i++) { point.graphic.css({> |
786 | < xData.length; i++) { point.graphic.css({> |
|
799 | < xData.length; i++) { cursor: 'pointer'> |
787 | < xData.length; i++) { cursor: 'pointer'> |
|
800 | < xData.length; i++) { });> |
788 | < xData.length; i++) { });> |
|
- | 789 | < xData.length; i++) {> |
||
801 | < xData.length; i++) {> |
790 | < xData.length; i++) { }> |
|
802 | < xData.length; i++) { }> |
791 | < xData.length; i++) { });> |
|
803 | < xData.length; i++) { });> |
792 | < xData.length; i++) { };> |
|
804 | < xData.length; i++) { };> |
793 | < xData.length; i++) {> |
|
805 | < xData.length; i++) { for (type in seriesTypes) {> |
794 | < xData.length; i++) { objectEach(seriesTypes, function(seriesType) {> |
|
Line 806... | Line 795... | |||
806 | < xData.length; i++) { if (seriesTypes[type].prototype.supportsDrilldown) {> |
795 | < xData.length; i++) { if (seriesType.prototype.supportsDrilldown) {> |
|
807 | < xData.length; i++) { wrap(seriesTypes[type].prototype, 'drawTracker', drawTrackerWrapper);> |
796 | < xData.length; i++) { wrap(seriesType.prototype, 'drawTracker', drawTrackerWrapper);> |