corrade-nucleus-nucleons – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | /** |
2 | * @license Highcharts JS v5.0.12 (2017-05-24) |
||
3 | * Highcharts Drilldown module |
||
4 | * |
||
5 | * Author: Torstein Honsi |
||
6 | * License: www.highcharts.com/license |
||
7 | * |
||
8 | */ |
||
9 | 'use strict'; |
||
10 | (function(factory) { |
||
11 | if (typeof module === 'object' && module.exports) { |
||
12 | module.exports = factory; |
||
13 | } else { |
||
14 | factory(Highcharts); |
||
15 | } |
||
16 | }(function(Highcharts) { |
||
17 | (function(H) { |
||
18 | /** |
||
19 | * Highcharts Drilldown module |
||
20 | * |
||
21 | * Author: Torstein Honsi |
||
22 | * License: www.highcharts.com/license |
||
23 | * |
||
24 | */ |
||
25 | |||
26 | |||
27 | var noop = H.noop, |
||
28 | color = H.color, |
||
29 | defaultOptions = H.defaultOptions, |
||
30 | each = H.each, |
||
31 | extend = H.extend, |
||
32 | format = H.format, |
||
33 | objectEach = H.objectEach, |
||
34 | pick = H.pick, |
||
35 | wrap = H.wrap, |
||
36 | Chart = H.Chart, |
||
37 | seriesTypes = H.seriesTypes, |
||
38 | PieSeries = seriesTypes.pie, |
||
39 | ColumnSeries = seriesTypes.column, |
||
40 | Tick = H.Tick, |
||
41 | fireEvent = H.fireEvent, |
||
42 | inArray = H.inArray, |
||
43 | ddSeriesId = 1; |
||
44 | |||
45 | // Add language |
||
46 | extend(defaultOptions.lang, { |
||
47 | drillUpText: '◁ Back to {series.name}' |
||
48 | }); |
||
49 | defaultOptions.drilldown = { |
||
50 | |||
51 | animation: { |
||
52 | duration: 500 |
||
53 | }, |
||
54 | drillUpButton: { |
||
55 | position: { |
||
56 | align: 'right', |
||
57 | x: -10, |
||
58 | y: 10 |
||
59 | } |
||
60 | // relativeTo: 'plotBox' |
||
61 | // theme |
||
62 | } |
||
63 | }; |
||
64 | |||
65 | /** |
||
66 | * A general fadeIn method |
||
67 | */ |
||
68 | H.SVGRenderer.prototype.Element.prototype.fadeIn = function(animation) { |
||
69 | this |
||
70 | .attr({ |
||
71 | opacity: 0.1, |
||
72 | visibility: 'inherit' |
||
73 | }) |
||
74 | .animate({ |
||
75 | opacity: pick(this.newOpacity, 1) // newOpacity used in maps |
||
76 | }, animation || { |
||
77 | duration: 250 |
||
78 | }); |
||
79 | }; |
||
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 |
||
98 | */ |
||
99 | Chart.prototype.addSeriesAsDrilldown = function(point, options) { |
||
100 | this.addSingleSeriesAsDrilldown(point, options); |
||
101 | this.applyDrilldown(); |
||
102 | }; |
||
103 | Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) { |
||
104 | var oldSeries = point.series, |
||
105 | xAxis = oldSeries.xAxis, |
||
106 | yAxis = oldSeries.yAxis, |
||
107 | newSeries, |
||
108 | pointIndex, |
||
109 | levelSeries = [], |
||
110 | levelSeriesOptions = [], |
||
111 | level, |
||
112 | levelNumber, |
||
113 | last, |
||
114 | colorProp; |
||
115 | |||
116 | |||
117 | |||
118 | colorProp = { |
||
119 | colorIndex: pick(point.colorIndex, oldSeries.colorIndex) |
||
120 | }; |
||
121 | |||
122 | |||
123 | if (!this.drilldownLevels) { |
||
124 | this.drilldownLevels = []; |
||
125 | } |
||
126 | |||
127 | levelNumber = oldSeries.options._levelNumber || 0; |
||
128 | |||
129 | // See if we can reuse the registered series from last run |
||
130 | last = this.drilldownLevels[this.drilldownLevels.length - 1]; |
||
131 | if (last && last.levelNumber !== levelNumber) { |
||
132 | last = undefined; |
||
133 | } |
||
134 | |||
135 | ddOptions = extend(extend({ |
||
136 | _ddSeriesId: ddSeriesId++ |
||
137 | }, colorProp), ddOptions); |
||
138 | pointIndex = inArray(point, oldSeries.points); |
||
139 | |||
140 | // Record options for all current series |
||
141 | each(oldSeries.chart.series, function(series) { |
||
142 | if (series.xAxis === xAxis && !series.isDrilling) { |
||
143 | series.options._ddSeriesId = series.options._ddSeriesId || ddSeriesId++; |
||
144 | series.options._colorIndex = series.userOptions._colorIndex; |
||
145 | series.options._levelNumber = series.options._levelNumber || levelNumber; // #3182 |
||
146 | |||
147 | if (last) { |
||
148 | levelSeries = last.levelSeries; |
||
149 | levelSeriesOptions = last.levelSeriesOptions; |
||
150 | } else { |
||
151 | levelSeries.push(series); |
||
152 | levelSeriesOptions.push(series.options); |
||
153 | } |
||
154 | } |
||
155 | }); |
||
156 | |||
157 | // Add a record of properties for each drilldown level |
||
158 | level = extend({ |
||
159 | levelNumber: levelNumber, |
||
160 | seriesOptions: oldSeries.options, |
||
161 | levelSeriesOptions: levelSeriesOptions, |
||
162 | levelSeries: levelSeries, |
||
163 | shapeArgs: point.shapeArgs, |
||
164 | bBox: point.graphic ? point.graphic.getBBox() : {}, // no graphic in line series with markers disabled |
||
165 | color: point.isNull ? new H.Color(color).setOpacity(0).get() : color, |
||
166 | lowerSeriesOptions: ddOptions, |
||
167 | pointOptions: oldSeries.options.data[pointIndex], |
||
168 | pointIndex: pointIndex, |
||
169 | oldExtremes: { |
||
170 | xMin: xAxis && xAxis.userMin, |
||
171 | xMax: xAxis && xAxis.userMax, |
||
172 | yMin: yAxis && yAxis.userMin, |
||
173 | yMax: yAxis && yAxis.userMax |
||
174 | } |
||
175 | }, colorProp); |
||
176 | |||
177 | // Push it to the lookup array |
||
178 | this.drilldownLevels.push(level); |
||
179 | |||
180 | // Reset names to prevent extending (#6704) |
||
181 | if (xAxis && xAxis.names) { |
||
182 | xAxis.names.length = 0; |
||
183 | } |
||
184 | |||
185 | newSeries = level.lowerSeries = this.addSeries(ddOptions, false); |
||
186 | newSeries.options._levelNumber = levelNumber + 1; |
||
187 | if (xAxis) { |
||
188 | xAxis.oldPos = xAxis.pos; |
||
189 | xAxis.userMin = xAxis.userMax = null; |
||
190 | yAxis.userMin = yAxis.userMax = null; |
||
191 | } |
||
192 | |||
193 | // Run fancy cross-animation on supported and equal types |
||
194 | if (oldSeries.type === newSeries.type) { |
||
195 | newSeries.animate = newSeries.animateDrilldown || noop; |
||
196 | newSeries.options.animation = true; |
||
197 | } |
||
198 | }; |
||
199 | |||
200 | Chart.prototype.applyDrilldown = function() { |
||
201 | var drilldownLevels = this.drilldownLevels, |
||
202 | levelToRemove; |
||
203 | |||
204 | if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading |
||
205 | levelToRemove = drilldownLevels[drilldownLevels.length - 1].levelNumber; |
||
206 | each(this.drilldownLevels, function(level) { |
||
207 | if (level.levelNumber === levelToRemove) { |
||
208 | each(level.levelSeries, function(series) { |
||
209 | if (series.options && series.options._levelNumber === levelToRemove) { // Not removed, not added as part of a multi-series drilldown |
||
210 | series.remove(false); |
||
211 | } |
||
212 | }); |
||
213 | } |
||
214 | }); |
||
215 | } |
||
216 | |||
217 | this.redraw(); |
||
218 | this.showDrillUpButton(); |
||
219 | }; |
||
220 | |||
221 | Chart.prototype.getDrilldownBackText = function() { |
||
222 | var drilldownLevels = this.drilldownLevels, |
||
223 | lastLevel; |
||
224 | if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading |
||
225 | lastLevel = drilldownLevels[drilldownLevels.length - 1]; |
||
226 | lastLevel.series = lastLevel.seriesOptions; |
||
227 | return format(this.options.lang.drillUpText, lastLevel); |
||
228 | } |
||
229 | |||
230 | }; |
||
231 | |||
232 | Chart.prototype.showDrillUpButton = function() { |
||
233 | var chart = this, |
||
234 | backText = this.getDrilldownBackText(), |
||
235 | buttonOptions = chart.options.drilldown.drillUpButton, |
||
236 | attr, |
||
237 | states; |
||
238 | |||
239 | |||
240 | if (!this.drillUpButton) { |
||
241 | attr = buttonOptions.theme; |
||
242 | states = attr && attr.states; |
||
243 | |||
244 | this.drillUpButton = this.renderer.button( |
||
245 | backText, |
||
246 | null, |
||
247 | null, |
||
248 | function() { |
||
249 | chart.drillUp(); |
||
250 | }, |
||
251 | attr, |
||
252 | states && states.hover, |
||
253 | states && states.select |
||
254 | ) |
||
255 | .addClass('highcharts-drillup-button') |
||
256 | .attr({ |
||
257 | align: buttonOptions.position.align, |
||
258 | zIndex: 7 |
||
259 | }) |
||
260 | .add() |
||
261 | .align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox'); |
||
262 | } else { |
||
263 | this.drillUpButton.attr({ |
||
264 | text: backText |
||
265 | }) |
||
266 | .align(); |
||
267 | } |
||
268 | }; |
||
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 |
||
276 | */ |
||
277 | Chart.prototype.drillUp = function() { |
||
278 | var chart = this, |
||
279 | drilldownLevels = chart.drilldownLevels, |
||
280 | levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber, |
||
281 | i = drilldownLevels.length, |
||
282 | chartSeries = chart.series, |
||
283 | seriesI, |
||
284 | level, |
||
285 | oldSeries, |
||
286 | newSeries, |
||
287 | oldExtremes, |
||
288 | addSeries = function(seriesOptions) { |
||
289 | var addedSeries; |
||
290 | each(chartSeries, function(series) { |
||
291 | if (series.options._ddSeriesId === seriesOptions._ddSeriesId) { |
||
292 | addedSeries = series; |
||
293 | } |
||
294 | }); |
||
295 | |||
296 | addedSeries = addedSeries || chart.addSeries(seriesOptions, false); |
||
297 | if (addedSeries.type === oldSeries.type && addedSeries.animateDrillupTo) { |
||
298 | addedSeries.animate = addedSeries.animateDrillupTo; |
||
299 | } |
||
300 | if (seriesOptions === level.seriesOptions) { |
||
301 | newSeries = addedSeries; |
||
302 | } |
||
303 | }; |
||
304 | |||
305 | while (i--) { |
||
306 | |||
307 | level = drilldownLevels[i]; |
||
308 | if (level.levelNumber === levelNumber) { |
||
309 | drilldownLevels.pop(); |
||
310 | |||
311 | // Get the lower series by reference or id |
||
312 | oldSeries = level.lowerSeries; |
||
313 | if (!oldSeries.chart) { // #2786 |
||
314 | seriesI = chartSeries.length; // #2919 |
||
315 | while (seriesI--) { |
||
316 | if (chartSeries[seriesI].options.id === level.lowerSeriesOptions.id && |
||
317 | chartSeries[seriesI].options._levelNumber === levelNumber + 1) { // #3867 |
||
318 | oldSeries = chartSeries[seriesI]; |
||
319 | break; |
||
320 | } |
||
321 | } |
||
322 | } |
||
323 | oldSeries.xData = []; // Overcome problems with minRange (#2898) |
||
324 | |||
325 | each(level.levelSeriesOptions, addSeries); |
||
326 | |||
327 | fireEvent(chart, 'drillup', { |
||
328 | seriesOptions: level.seriesOptions |
||
329 | }); |
||
330 | |||
331 | if (newSeries.type === oldSeries.type) { |
||
332 | newSeries.drilldownLevel = level; |
||
333 | newSeries.options.animation = chart.options.drilldown.animation; |
||
334 | |||
335 | if (oldSeries.animateDrillupFrom && oldSeries.chart) { // #2919 |
||
336 | oldSeries.animateDrillupFrom(level); |
||
337 | } |
||
338 | } |
||
339 | newSeries.options._levelNumber = levelNumber; |
||
340 | |||
341 | oldSeries.remove(false); |
||
342 | |||
343 | // Reset the zoom level of the upper series |
||
344 | if (newSeries.xAxis) { |
||
345 | oldExtremes = level.oldExtremes; |
||
346 | newSeries.xAxis.setExtremes(oldExtremes.xMin, oldExtremes.xMax, false); |
||
347 | newSeries.yAxis.setExtremes(oldExtremes.yMin, oldExtremes.yMax, false); |
||
348 | } |
||
349 | } |
||
350 | } |
||
351 | |||
352 | // Fire a once-off event after all series have been drilled up (#5158) |
||
353 | fireEvent(chart, 'drillupall'); |
||
354 | |||
355 | this.redraw(); |
||
356 | |||
357 | if (this.drilldownLevels.length === 0) { |
||
358 | this.drillUpButton = this.drillUpButton.destroy(); |
||
359 | } else { |
||
360 | this.drillUpButton.attr({ |
||
361 | text: this.getDrilldownBackText() |
||
362 | }) |
||
363 | .align(); |
||
364 | } |
||
365 | |||
366 | this.ddDupes.length = []; // #3315 |
||
367 | }; |
||
368 | |||
369 | |||
370 | ColumnSeries.prototype.supportsDrilldown = true; |
||
371 | |||
372 | /** |
||
373 | * When drilling up, keep the upper series invisible until the lower series has |
||
374 | * moved into place |
||
375 | */ |
||
376 | ColumnSeries.prototype.animateDrillupTo = function(init) { |
||
377 | if (!init) { |
||
378 | var newSeries = this, |
||
379 | level = newSeries.drilldownLevel; |
||
380 | |||
381 | // First hide all items before animating in again |
||
382 | each(this.points, function(point) { |
||
383 | var dataLabel = point.dataLabel; |
||
384 | |||
385 | if (point.graphic) { // #3407 |
||
386 | point.graphic.hide(); |
||
387 | } |
||
388 | |||
389 | if (dataLabel) { |
||
390 | // The data label is initially hidden, make sure it is not faded |
||
391 | // in (#6127) |
||
392 | dataLabel.hidden = dataLabel.attr('visibility') === 'hidden'; |
||
393 | |||
394 | if (!dataLabel.hidden) { |
||
395 | dataLabel.hide(); |
||
396 | if (point.connector) { |
||
397 | point.connector.hide(); |
||
398 | } |
||
399 | } |
||
400 | } |
||
401 | }); |
||
402 | |||
403 | |||
404 | // Do dummy animation on first point to get to complete |
||
405 | setTimeout(function() { |
||
406 | if (newSeries.points) { // May be destroyed in the meantime, #3389 |
||
407 | each(newSeries.points, function(point, i) { |
||
408 | // Fade in other points |
||
409 | var verb = |
||
410 | i === (level && level.pointIndex) ? 'show' : 'fadeIn', |
||
411 | inherit = verb === 'show' ? true : undefined, |
||
412 | dataLabel = point.dataLabel; |
||
413 | |||
414 | |||
415 | if (point.graphic) { // #3407 |
||
416 | point.graphic[verb](inherit); |
||
417 | } |
||
418 | |||
419 | if (dataLabel && !dataLabel.hidden) { // #6127 |
||
420 | dataLabel[verb](inherit); |
||
421 | if (point.connector) { |
||
422 | point.connector[verb](inherit); |
||
423 | } |
||
424 | } |
||
425 | }); |
||
426 | } |
||
427 | }, Math.max(this.chart.options.drilldown.animation.duration - 50, 0)); |
||
428 | |||
429 | // Reset |
||
430 | this.animate = noop; |
||
431 | } |
||
432 | |||
433 | }; |
||
434 | |||
435 | ColumnSeries.prototype.animateDrilldown = function(init) { |
||
436 | var series = this, |
||
437 | drilldownLevels = this.chart.drilldownLevels, |
||
438 | animateFrom, |
||
439 | animationOptions = this.chart.options.drilldown.animation, |
||
440 | xAxis = this.xAxis; |
||
441 | |||
442 | if (!init) { |
||
443 | each(drilldownLevels, function(level) { |
||
444 | if (series.options._ddSeriesId === level.lowerSeriesOptions._ddSeriesId) { |
||
445 | animateFrom = level.shapeArgs; |
||
446 | |||
447 | } |
||
448 | }); |
||
449 | |||
450 | animateFrom.x += (pick(xAxis.oldPos, xAxis.pos) - xAxis.pos); |
||
451 | |||
452 | each(this.points, function(point) { |
||
453 | var animateTo = point.shapeArgs; |
||
454 | |||
455 | |||
456 | |||
457 | if (point.graphic) { |
||
458 | point.graphic |
||
459 | .attr(animateFrom) |
||
460 | .animate( |
||
461 | extend(point.shapeArgs, { |
||
462 | fill: point.color || series.color |
||
463 | }), |
||
464 | animationOptions |
||
465 | ); |
||
466 | } |
||
467 | if (point.dataLabel) { |
||
468 | point.dataLabel.fadeIn(animationOptions); |
||
469 | } |
||
470 | }); |
||
471 | this.animate = null; |
||
472 | } |
||
473 | |||
474 | }; |
||
475 | |||
476 | /** |
||
477 | * When drilling up, pull out the individual point graphics from the lower series |
||
478 | * and animate them into the origin point in the upper series. |
||
479 | */ |
||
480 | ColumnSeries.prototype.animateDrillupFrom = function(level) { |
||
481 | var animationOptions = this.chart.options.drilldown.animation, |
||
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, |
||
486 | series = this; |
||
487 | |||
488 | // Cancel mouse events on the series group (#2787) |
||
489 | each(series.trackerGroups, function(key) { |
||
490 | if (series[key]) { // we don't always have dataLabelsGroup |
||
491 | series[key].on('mouseover'); |
||
492 | } |
||
493 | }); |
||
494 | |||
495 | if (removeGroup) { |
||
496 | delete this.group; |
||
497 | } |
||
498 | |||
499 | each(this.points, function(point) { |
||
500 | var graphic = point.graphic, |
||
501 | animateTo = level.shapeArgs, |
||
502 | complete = function() { |
||
503 | graphic.destroy(); |
||
504 | if (group && removeGroup) { |
||
505 | group = group.destroy(); |
||
506 | } |
||
507 | }; |
||
508 | |||
509 | if (graphic) { |
||
510 | |||
511 | delete point.graphic; |
||
512 | |||
513 | |||
514 | |||
515 | if (animationOptions) { |
||
516 | graphic.animate( |
||
517 | animateTo, |
||
518 | H.merge(animationOptions, { |
||
519 | complete: complete |
||
520 | }) |
||
521 | ); |
||
522 | } else { |
||
523 | graphic.attr(animateTo); |
||
524 | complete(); |
||
525 | } |
||
526 | } |
||
527 | }); |
||
528 | }; |
||
529 | |||
530 | if (PieSeries) { |
||
531 | extend(PieSeries.prototype, { |
||
532 | supportsDrilldown: true, |
||
533 | animateDrillupTo: ColumnSeries.prototype.animateDrillupTo, |
||
534 | animateDrillupFrom: ColumnSeries.prototype.animateDrillupFrom, |
||
535 | |||
536 | animateDrilldown: function(init) { |
||
537 | var level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1], |
||
538 | animationOptions = this.chart.options.drilldown.animation, |
||
539 | animateFrom = level.shapeArgs, |
||
540 | start = animateFrom.start, |
||
541 | angle = animateFrom.end - start, |
||
542 | startAngle = angle / this.points.length; |
||
543 | |||
544 | if (!init) { |
||
545 | each(this.points, function(point, i) { |
||
546 | var animateTo = point.shapeArgs; |
||
547 | |||
548 | |||
549 | |||
550 | if (point.graphic) { |
||
551 | point.graphic |
||
552 | .attr(H.merge(animateFrom, { |
||
553 | start: start + i * startAngle, |
||
554 | end: start + (i + 1) * startAngle |
||
555 | }))[animationOptions ? 'animate' : 'attr']( |
||
556 | animateTo, |
||
557 | animationOptions |
||
558 | ); |
||
559 | } |
||
560 | }); |
||
561 | this.animate = null; |
||
562 | } |
||
563 | } |
||
564 | }); |
||
565 | } |
||
566 | |||
567 | H.Point.prototype.doDrilldown = function(_holdRedraw, category, originalEvent) { |
||
568 | var series = this.series, |
||
569 | chart = series.chart, |
||
570 | drilldown = chart.options.drilldown, |
||
571 | i = (drilldown.series || []).length, |
||
572 | seriesOptions; |
||
573 | |||
574 | if (!chart.ddDupes) { |
||
575 | chart.ddDupes = []; |
||
576 | } |
||
577 | |||
578 | while (i-- && !seriesOptions) { |
||
579 | if (drilldown.series[i].id === this.drilldown && inArray(this.drilldown, chart.ddDupes) === -1) { |
||
580 | seriesOptions = drilldown.series[i]; |
||
581 | chart.ddDupes.push(this.drilldown); |
||
582 | } |
||
583 | } |
||
584 | |||
585 | // Fire the event. If seriesOptions is undefined, the implementer can check for |
||
586 | // seriesOptions, and call addSeriesAsDrilldown async if necessary. |
||
587 | fireEvent(chart, 'drilldown', { |
||
588 | point: this, |
||
589 | seriesOptions: seriesOptions, |
||
590 | category: category, |
||
591 | originalEvent: originalEvent, |
||
592 | points: category !== undefined && this.series.xAxis.getDDPoints(category).slice(0) |
||
593 | }, function(e) { |
||
594 | var chart = e.point.series && e.point.series.chart, |
||
595 | seriesOptions = e.seriesOptions; |
||
596 | if (chart && seriesOptions) { |
||
597 | if (_holdRedraw) { |
||
598 | chart.addSingleSeriesAsDrilldown(e.point, seriesOptions); |
||
599 | } else { |
||
600 | chart.addSeriesAsDrilldown(e.point, seriesOptions); |
||
601 | } |
||
602 | } |
||
603 | }); |
||
604 | |||
605 | |||
606 | }; |
||
607 | |||
608 | /** |
||
609 | * Drill down to a given category. This is the same as clicking on an axis label. |
||
610 | */ |
||
611 | H.Axis.prototype.drilldownCategory = function(x, e) { |
||
612 | objectEach(this.getDDPoints(x), function(point) { |
||
613 | if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 |
||
614 | point.doDrilldown(true, x, e); |
||
615 | } |
||
616 | }); |
||
617 | this.chart.applyDrilldown(); |
||
618 | }; |
||
619 | |||
620 | /** |
||
621 | * Return drillable points for this specific X value |
||
622 | */ |
||
623 | H.Axis.prototype.getDDPoints = function(x) { |
||
624 | var ret = []; |
||
625 | each(this.series, function(series) { |
||
626 | var i, |
||
627 | xData = series.xData, |
||
628 | points = series.points; |
||
629 | |||
630 | for (i = 0; i < xData.length; i++) {> |
||
631 | < xData.length; i++) { if (xData[i] === x && series.options.data[i] && series.options.data[i].drilldown) {> |
||
632 | < xData.length; i++) { ret.push(points ? points[i] : true);> |
||
633 | < xData.length; i++) { break;> |
||
634 | < xData.length; i++) { }> |
||
635 | < xData.length; i++) { }> |
||
636 | < xData.length; i++) { });> |
||
637 | < xData.length; i++) { return ret;> |
||
638 | < xData.length; i++) { };> |
||
639 | |||
640 | |||
641 | < xData.length; i++) { /**> |
||
642 | < xData.length; i++) { * Make a tick label drillable, or remove drilling on update> |
||
643 | < xData.length; i++) { */> |
||
644 | < xData.length; i++) { Tick.prototype.drillable = function() {> |
||
645 | < xData.length; i++) { var pos = this.pos,> |
||
646 | < xData.length; i++) { label = this.label,> |
||
647 | < xData.length; i++) { axis = this.axis,> |
||
648 | < xData.length; i++) { isDrillable = axis.coll === 'xAxis' && axis.getDDPoints,> |
||
649 | < xData.length; i++) { ddPointsX = isDrillable && axis.getDDPoints(pos);> |
||
650 | |||
651 | < xData.length; i++) { if (isDrillable) {> |
||
652 | < xData.length; i++) { if (label && ddPointsX.length) {> |
||
653 | < xData.length; i++) { label.drillable = true;> |
||
654 | |||
655 | |||
656 | |||
657 | < xData.length; i++) { label> |
||
658 | < xData.length; i++) { .addClass('highcharts-drilldown-axis-label')> |
||
659 | |||
660 | < xData.length; i++) { .on('click', function(e) {> |
||
661 | < xData.length; i++) { axis.drilldownCategory(pos, e);> |
||
662 | < xData.length; i++) { });> |
||
663 | |||
664 | < xData.length; i++) { } else if (label && label.drillable) {> |
||
665 | |||
666 | |||
667 | |||
668 | < xData.length; i++) { label.on('click', null); // #3806 > |
||
669 | < xData.length; i++) { label.removeClass('highcharts-drilldown-axis-label');> |
||
670 | < xData.length; i++) { }> |
||
671 | < xData.length; i++) { }> |
||
672 | < xData.length; i++) { };> |
||
673 | |||
674 | < xData.length; i++) { /**> |
||
675 | < xData.length; i++) { * Always keep the drillability updated (#3951)> |
||
676 | < xData.length; i++) { */> |
||
677 | < xData.length; i++) { wrap(Tick.prototype, 'addLabel', function(proceed) {> |
||
678 | < xData.length; i++) { proceed.call(this);> |
||
679 | < xData.length; i++) { this.drillable();> |
||
680 | < xData.length; i++) { });> |
||
681 | |||
682 | |||
683 | < xData.length; i++) { /**> |
||
684 | < xData.length; i++) { * On initialization of each point, identify its label and make it clickable. Also, provide a> |
||
685 | < xData.length; i++) { * list of points associated to that label.> |
||
686 | < xData.length; i++) { */> |
||
687 | < xData.length; i++) { wrap(H.Point.prototype, 'init', function(proceed, series, options, x) {> |
||
688 | < xData.length; i++) { var point = proceed.call(this, series, options, x),> |
||
689 | < xData.length; i++) { xAxis = series.xAxis,> |
||
690 | < xData.length; i++) { tick = xAxis && xAxis.ticks[x];> |
||
691 | |||
692 | < xData.length; i++) { if (point.drilldown) {> |
||
693 | |||
694 | < xData.length; i++) { // Add the click event to the point > |
||
695 | < xData.length; i++) { H.addEvent(point, 'click', function(e) {> |
||
696 | < xData.length; i++) { if (series.xAxis && series.chart.options.drilldown.allowPointDrilldown === false) {> |
||
697 | < xData.length; i++) { series.xAxis.drilldownCategory(point.x, e); // #5822, x changed> |
||
698 | < xData.length; i++) { } else {> |
||
699 | < xData.length; i++) { point.doDrilldown(undefined, undefined, e);> |
||
700 | < xData.length; i++) { }> |
||
701 | < xData.length; i++) { });> |
||
702 | < xData.length; i++) { /*wrap(point, 'importEvents', function (proceed) { // wrapping importEvents makes point.click event work> |
||
703 | < xData.length; i++) { if (!this.hasImportedEvents) {> |
||
704 | < xData.length; i++) { proceed.call(this);> |
||
705 | < xData.length; i++) { H.addEvent(this, 'click', function () {> |
||
706 | < xData.length; i++) { this.doDrilldown();> |
||
707 | < xData.length; i++) { });> |
||
708 | < xData.length; i++) { }> |
||
709 | < xData.length; i++) { });*/> |
||
710 | |||
711 | < xData.length; i++) { }> |
||
712 | |||
713 | < xData.length; i++) { // Add or remove click handler and style on the tick label> |
||
714 | < xData.length; i++) { if (tick) {> |
||
715 | < xData.length; i++) { tick.drillable();> |
||
716 | < xData.length; i++) { }> |
||
717 | |||
718 | < xData.length; i++) { return point;> |
||
719 | < xData.length; i++) { });> |
||
720 | |||
721 | < xData.length; i++) { wrap(H.Series.prototype, 'drawDataLabels', function(proceed) {> |
||
722 | < xData.length; i++) { var css = this.chart.options.drilldown.activeDataLabelStyle,> |
||
723 | < xData.length; i++) { renderer = this.chart.renderer;> |
||
724 | |||
725 | < xData.length; i++) { proceed.call(this);> |
||
726 | |||
727 | < xData.length; i++) { each(this.points, function(point) {> |
||
728 | < xData.length; i++) { var pointCSS = {};> |
||
729 | < xData.length; i++) { if (point.drilldown && point.dataLabel) {> |
||
730 | < xData.length; i++) { if (css.color === 'contrast') {> |
||
731 | < xData.length; i++) { pointCSS.color = renderer.getContrast(point.color || this.color);> |
||
732 | < xData.length; i++) { }> |
||
733 | < xData.length; i++) { point.dataLabel> |
||
734 | < xData.length; i++) { .addClass('highcharts-drilldown-data-label');> |
||
735 | |||
736 | |||
737 | < xData.length; i++) { }> |
||
738 | < xData.length; i++) { }, this);> |
||
739 | < xData.length; i++) { });> |
||
740 | |||
741 | < xData.length; i++) { // Mark the trackers with a pointer > |
||
742 | < xData.length; i++) { var drawTrackerWrapper = function(proceed) {> |
||
743 | < xData.length; i++) { proceed.call(this);> |
||
744 | < xData.length; i++) { each(this.points, function(point) {> |
||
745 | < xData.length; i++) { if (point.drilldown && point.graphic) {> |
||
746 | < xData.length; i++) { point.graphic.addClass('highcharts-drilldown-point');> |
||
747 | |||
748 | |||
749 | < xData.length; i++) { }> |
||
750 | < xData.length; i++) { });> |
||
751 | < xData.length; i++) { };> |
||
752 | |||
753 | < xData.length; i++) { objectEach(seriesTypes, function(seriesType) {> |
||
754 | < xData.length; i++) { if (seriesType.prototype.supportsDrilldown) {> |
||
755 | < xData.length; i++) { wrap(seriesType.prototype, 'drawTracker', drawTrackerWrapper);> |
||
756 | < xData.length; i++) { }> |
||
757 | < xData.length; i++) { });> |
||
758 | |||
759 | < xData.length; i++) { }(Highcharts));> |
||
760 | < xData.length; i++) {}));> |