drilldown.src.js 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227
  1. /**
  2. * @license Highcharts JS v9.0.1 (2021-02-16)
  3. *
  4. * Highcharts Drilldown module
  5. *
  6. * Author: Torstein Honsi
  7. * License: www.highcharts.com/license
  8. *
  9. */
  10. 'use strict';
  11. (function (factory) {
  12. if (typeof module === 'object' && module.exports) {
  13. factory['default'] = factory;
  14. module.exports = factory;
  15. } else if (typeof define === 'function' && define.amd) {
  16. define('highcharts/modules/drilldown', ['highcharts'], function (Highcharts) {
  17. factory(Highcharts);
  18. factory.Highcharts = Highcharts;
  19. return factory;
  20. });
  21. } else {
  22. factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
  23. }
  24. }(function (Highcharts) {
  25. var _modules = Highcharts ? Highcharts._modules : {};
  26. function _registerModule(obj, path, args, fn) {
  27. if (!obj.hasOwnProperty(path)) {
  28. obj[path] = fn.apply(null, args);
  29. }
  30. }
  31. _registerModule(_modules, 'Extensions/Drilldown.js', [_modules['Core/Animation/AnimationUtilities.js'], _modules['Core/Axis/Axis.js'], _modules['Core/Chart/Chart.js'], _modules['Core/Color/Color.js'], _modules['Series/Column/ColumnSeries.js'], _modules['Core/Globals.js'], _modules['Core/Options.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/Point.js'], _modules['Core/Series/Series.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Axis/Tick.js'], _modules['Core/Utilities.js']], function (A, Axis, Chart, Color, ColumnSeries, H, O, palette, Point, Series, SeriesRegistry, SVGRenderer, Tick, U) {
  32. /* *
  33. *
  34. * Highcharts Drilldown module
  35. *
  36. * Author: Torstein Honsi
  37. *
  38. * License: www.highcharts.com/license
  39. *
  40. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  41. *
  42. * */
  43. var animObject = A.animObject;
  44. var noop = H.noop;
  45. var defaultOptions = O.defaultOptions;
  46. var seriesTypes = SeriesRegistry.seriesTypes;
  47. var addEvent = U.addEvent,
  48. removeEvent = U.removeEvent,
  49. extend = U.extend,
  50. fireEvent = U.fireEvent,
  51. format = U.format,
  52. merge = U.merge,
  53. objectEach = U.objectEach,
  54. pick = U.pick,
  55. syncTimeout = U.syncTimeout;
  56. /**
  57. * Gets fired when a drilldown point is clicked, before the new series is added.
  58. * Note that when clicking a category label to trigger multiple series
  59. * drilldown, one `drilldown` event is triggered per point in the category.
  60. *
  61. * @callback Highcharts.DrilldownCallbackFunction
  62. *
  63. * @param {Highcharts.Chart} this
  64. * The chart where the event occurs.
  65. *
  66. * @param {Highcharts.DrilldownEventObject} e
  67. * The drilldown event.
  68. */
  69. /**
  70. * The event arguments when a drilldown point is clicked.
  71. *
  72. * @interface Highcharts.DrilldownEventObject
  73. */ /**
  74. * If a category label was clicked, which index.
  75. * @name Highcharts.DrilldownEventObject#category
  76. * @type {number|undefined}
  77. */ /**
  78. * The original browser event (usually click) that triggered the drilldown.
  79. * @name Highcharts.DrilldownEventObject#originalEvent
  80. * @type {global.Event|undefined}
  81. */ /**
  82. * Prevents the default behaviour of the event.
  83. * @name Highcharts.DrilldownEventObject#preventDefault
  84. * @type {Function}
  85. */ /**
  86. * The originating point.
  87. * @name Highcharts.DrilldownEventObject#point
  88. * @type {Highcharts.Point}
  89. */ /**
  90. * If a category label was clicked, this array holds all points corresponding to
  91. * the category. Otherwise it is set to false.
  92. * @name Highcharts.DrilldownEventObject#points
  93. * @type {boolean|Array<Highcharts.Point>|undefined}
  94. */ /**
  95. * Options for the new series. If the event is utilized for async drilldown, the
  96. * seriesOptions are not added, but rather loaded async.
  97. * @name Highcharts.DrilldownEventObject#seriesOptions
  98. * @type {Highcharts.SeriesOptionsType|undefined}
  99. */ /**
  100. * The event target.
  101. * @name Highcharts.DrilldownEventObject#target
  102. * @type {Highcharts.Chart}
  103. */ /**
  104. * The event type.
  105. * @name Highcharts.DrilldownEventObject#type
  106. * @type {"drilldown"}
  107. */
  108. /**
  109. * This gets fired after all the series have been drilled up. This is especially
  110. * usefull in a chart with multiple drilldown series.
  111. *
  112. * @callback Highcharts.DrillupAllCallbackFunction
  113. *
  114. * @param {Highcharts.Chart} this
  115. * The chart where the event occurs.
  116. *
  117. * @param {Highcharts.DrillupAllEventObject} e
  118. * The final drillup event.
  119. */
  120. /**
  121. * The event arguments when all the series have been drilled up.
  122. *
  123. * @interface Highcharts.DrillupAllEventObject
  124. */ /**
  125. * Prevents the default behaviour of the event.
  126. * @name Highcharts.DrillupAllEventObject#preventDefault
  127. * @type {Function}
  128. */ /**
  129. * The event target.
  130. * @name Highcharts.DrillupAllEventObject#target
  131. * @type {Highcharts.Chart}
  132. */ /**
  133. * The event type.
  134. * @name Highcharts.DrillupAllEventObject#type
  135. * @type {"drillupall"}
  136. */
  137. /**
  138. * Gets fired when drilling up from a drilldown series.
  139. *
  140. * @callback Highcharts.DrillupCallbackFunction
  141. *
  142. * @param {Highcharts.Chart} this
  143. * The chart where the event occurs.
  144. *
  145. * @param {Highcharts.DrillupEventObject} e
  146. * The drillup event.
  147. */
  148. /**
  149. * The event arguments when drilling up from a drilldown series.
  150. *
  151. * @interface Highcharts.DrillupEventObject
  152. */ /**
  153. * Prevents the default behaviour of the event.
  154. * @name Highcharts.DrillupEventObject#preventDefault
  155. * @type {Function}
  156. */ /**
  157. * Options for the new series.
  158. * @name Highcharts.DrillupEventObject#seriesOptions
  159. * @type {Highcharts.SeriesOptionsType|undefined}
  160. */ /**
  161. * The event target.
  162. * @name Highcharts.DrillupEventObject#target
  163. * @type {Highcharts.Chart}
  164. */ /**
  165. * The event type.
  166. * @name Highcharts.DrillupEventObject#type
  167. * @type {"drillup"}
  168. */
  169. var PieSeries = seriesTypes.pie,
  170. ddSeriesId = 1;
  171. // Add language
  172. extend(defaultOptions.lang,
  173. /**
  174. * @optionparent lang
  175. */
  176. {
  177. /**
  178. * The text for the button that appears when drilling down, linking back
  179. * to the parent series. The parent series' name is inserted for
  180. * `{series.name}`.
  181. *
  182. * @since 3.0.8
  183. * @product highcharts highmaps
  184. * @requires modules/drilldown
  185. *
  186. * @private
  187. */
  188. drillUpText: '◁ Back to {series.name}'
  189. });
  190. /**
  191. * Options for drill down, the concept of inspecting increasingly high
  192. * resolution data through clicking on chart items like columns or pie slices.
  193. *
  194. * The drilldown feature requires the drilldown.js file to be loaded,
  195. * found in the modules directory of the download package, or online at
  196. * [code.highcharts.com/modules/drilldown.js
  197. * ](https://code.highcharts.com/modules/drilldown.js).
  198. *
  199. * @product highcharts highmaps
  200. * @requires modules/drilldown
  201. * @optionparent drilldown
  202. * @sample {highcharts} highcharts/series-organization/drilldown
  203. * Organization chart drilldown
  204. */
  205. defaultOptions.drilldown = {
  206. /**
  207. * When this option is false, clicking a single point will drill down
  208. * all points in the same category, equivalent to clicking the X axis
  209. * label.
  210. *
  211. * @sample {highcharts} highcharts/drilldown/allowpointdrilldown-false/
  212. * Don't allow point drilldown
  213. *
  214. * @type {boolean}
  215. * @default true
  216. * @since 4.1.7
  217. * @product highcharts
  218. * @apioption drilldown.allowPointDrilldown
  219. */
  220. /**
  221. * An array of series configurations for the drill down. Each series
  222. * configuration uses the same syntax as the [series](#series) option set.
  223. * These drilldown series are hidden by default. The drilldown series is
  224. * linked to the parent series' point by its `id`.
  225. *
  226. * @type {Array<Highcharts.SeriesOptionsType>}
  227. * @since 3.0.8
  228. * @product highcharts highmaps
  229. * @apioption drilldown.series
  230. */
  231. /**
  232. * Additional styles to apply to the X axis label for a point that
  233. * has drilldown data. By default it is underlined and blue to invite
  234. * to interaction.
  235. *
  236. * In styled mode, active label styles can be set with the
  237. * `.highcharts-drilldown-axis-label` class.
  238. *
  239. * @sample {highcharts} highcharts/drilldown/labels/
  240. * Label styles
  241. *
  242. * @type {Highcharts.CSSObject}
  243. * @default { "cursor": "pointer", "color": "#003399", "fontWeight": "bold", "textDecoration": "underline" }
  244. * @since 3.0.8
  245. * @product highcharts highmaps
  246. */
  247. activeAxisLabelStyle: {
  248. /** @ignore-option */
  249. cursor: 'pointer',
  250. /** @ignore-option */
  251. color: palette.highlightColor100,
  252. /** @ignore-option */
  253. fontWeight: 'bold',
  254. /** @ignore-option */
  255. textDecoration: 'underline'
  256. },
  257. /**
  258. * Additional styles to apply to the data label of a point that has
  259. * drilldown data. By default it is underlined and blue to invite to
  260. * interaction.
  261. *
  262. * In styled mode, active data label styles can be applied with the
  263. * `.highcharts-drilldown-data-label` class.
  264. *
  265. * @sample {highcharts} highcharts/drilldown/labels/
  266. * Label styles
  267. *
  268. * @type {Highcharts.CSSObject}
  269. * @default { "cursor": "pointer", "color": "#003399", "fontWeight": "bold", "textDecoration": "underline" }
  270. * @since 3.0.8
  271. * @product highcharts highmaps
  272. */
  273. activeDataLabelStyle: {
  274. cursor: 'pointer',
  275. color: palette.highlightColor100,
  276. fontWeight: 'bold',
  277. textDecoration: 'underline'
  278. },
  279. /**
  280. * Set the animation for all drilldown animations. Animation of a drilldown
  281. * occurs when drilling between a column point and a column series,
  282. * or a pie slice and a full pie series. Drilldown can still be used
  283. * between series and points of different types, but animation will
  284. * not occur.
  285. *
  286. * The animation can either be set as a boolean or a configuration
  287. * object. If `true`, it will use the 'swing' jQuery easing and a duration
  288. * of 500 ms. If used as a configuration object, the following properties
  289. * are supported:
  290. *
  291. * - `duration`: The duration of the animation in milliseconds.
  292. *
  293. * - `easing`: A string reference to an easing function set on the `Math`
  294. * object. See
  295. * [the easing demo](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-animation-easing/).
  296. *
  297. * @type {boolean|Partial<Highcharts.AnimationOptionsObject>}
  298. * @since 3.0.8
  299. * @product highcharts highmaps
  300. */
  301. animation: {
  302. /** @internal */
  303. duration: 500
  304. },
  305. /**
  306. * Options for the drill up button that appears when drilling down on a
  307. * series. The text for the button is defined in
  308. * [lang.drillUpText](#lang.drillUpText).
  309. *
  310. * @sample {highcharts} highcharts/drilldown/drillupbutton/
  311. * Drill up button
  312. * @sample {highmaps} highcharts/drilldown/drillupbutton/
  313. * Drill up button
  314. *
  315. * @since 3.0.8
  316. * @product highcharts highmaps
  317. */
  318. drillUpButton: {
  319. /**
  320. * What box to align the button to. Can be either `plotBox` or
  321. * `spacingBox`.
  322. *
  323. * @type {Highcharts.ButtonRelativeToValue}
  324. * @default plotBox
  325. * @since 3.0.8
  326. * @product highcharts highmaps
  327. * @apioption drilldown.drillUpButton.relativeTo
  328. */
  329. /**
  330. * A collection of attributes for the button. The object takes SVG
  331. * attributes like `fill`, `stroke`, `stroke-width` or `r`, the border
  332. * radius. The theme also supports `style`, a collection of CSS
  333. * properties for the text. Equivalent attributes for the hover state
  334. * are given in `theme.states.hover`.
  335. *
  336. * In styled mode, drill-up button styles can be applied with the
  337. * `.highcharts-drillup-button` class.
  338. *
  339. * @sample {highcharts} highcharts/drilldown/drillupbutton/
  340. * Button theming
  341. * @sample {highmaps} highcharts/drilldown/drillupbutton/
  342. * Button theming
  343. *
  344. * @type {object}
  345. * @since 3.0.8
  346. * @product highcharts highmaps
  347. * @apioption drilldown.drillUpButton.theme
  348. */
  349. /**
  350. * Positioning options for the button within the `relativeTo` box.
  351. * Available properties are `x`, `y`, `align` and `verticalAlign`.
  352. *
  353. * @type {Highcharts.AlignObject}
  354. * @since 3.0.8
  355. * @product highcharts highmaps
  356. */
  357. position: {
  358. /**
  359. * Vertical alignment of the button.
  360. *
  361. * @type {Highcharts.VerticalAlignValue}
  362. * @default top
  363. * @product highcharts highmaps
  364. * @apioption drilldown.drillUpButton.position.verticalAlign
  365. */
  366. /**
  367. * Horizontal alignment.
  368. *
  369. * @type {Highcharts.AlignValue}
  370. */
  371. align: 'right',
  372. /**
  373. * The X offset of the button.
  374. */
  375. x: -10,
  376. /**
  377. * The Y offset of the button.
  378. */
  379. y: 10
  380. }
  381. }
  382. };
  383. /**
  384. * Fires when a drilldown point is clicked, before the new series is added. This
  385. * event is also utilized for async drilldown, where the seriesOptions are not
  386. * added by option, but rather loaded async. Note that when clicking a category
  387. * label to trigger multiple series drilldown, one `drilldown` event is
  388. * triggered per point in the category.
  389. *
  390. * Event arguments:
  391. *
  392. * - `category`: If a category label was clicked, which index.
  393. *
  394. * - `originalEvent`: The original browser event (usually click) that triggered
  395. * the drilldown.
  396. *
  397. * - `point`: The originating point.
  398. *
  399. * - `points`: If a category label was clicked, this array holds all points
  400. * corresponding to the category.
  401. *
  402. * - `seriesOptions`: Options for the new series.
  403. *
  404. * @sample {highcharts} highcharts/drilldown/async/
  405. * Async drilldown
  406. *
  407. * @type {Highcharts.DrilldownCallbackFunction}
  408. * @since 3.0.8
  409. * @product highcharts highmaps
  410. * @context Highcharts.Chart
  411. * @requires modules/drilldown
  412. * @apioption chart.events.drilldown
  413. */
  414. /**
  415. * Fires when drilling up from a drilldown series.
  416. *
  417. * @type {Highcharts.DrillupCallbackFunction}
  418. * @since 3.0.8
  419. * @product highcharts highmaps
  420. * @context Highcharts.Chart
  421. * @requires modules/drilldown
  422. * @apioption chart.events.drillup
  423. */
  424. /**
  425. * In a chart with multiple drilldown series, this event fires after all the
  426. * series have been drilled up.
  427. *
  428. * @type {Highcharts.DrillupAllCallbackFunction}
  429. * @since 4.2.4
  430. * @product highcharts highmaps
  431. * @context Highcharts.Chart
  432. * @requires modules/drilldown
  433. * @apioption chart.events.drillupall
  434. */
  435. /**
  436. * The `id` of a series in the [drilldown.series](#drilldown.series) array to
  437. * use for a drilldown for this point.
  438. *
  439. * @sample {highcharts} highcharts/drilldown/basic/
  440. * Basic drilldown
  441. *
  442. * @type {string}
  443. * @since 3.0.8
  444. * @product highcharts
  445. * @requires modules/drilldown
  446. * @apioption series.line.data.drilldown
  447. */
  448. /**
  449. * A general fadeIn method.
  450. *
  451. * @requires module:modules/drilldown
  452. *
  453. * @function Highcharts.SVGElement#fadeIn
  454. *
  455. * @param {boolean|Partial<Highcharts.AnimationOptionsObject>} [animation]
  456. * The animation options for the element fade.
  457. */
  458. SVGRenderer.prototype.Element.prototype.fadeIn = function (animation) {
  459. this
  460. .attr({
  461. opacity: 0.1,
  462. visibility: 'inherit'
  463. })
  464. .animate({
  465. opacity: pick(this.newOpacity, 1) // newOpacity used in maps
  466. }, animation || {
  467. duration: 250
  468. });
  469. };
  470. /**
  471. * Add a series to the chart as drilldown from a specific point in the parent
  472. * series. This method is used for async drilldown, when clicking a point in a
  473. * series should result in loading and displaying a more high-resolution series.
  474. * When not async, the setup is simpler using the
  475. * [drilldown.series](https://api.highcharts.com/highcharts/drilldown.series)
  476. * options structure.
  477. *
  478. * @sample highcharts/drilldown/async/
  479. * Async drilldown
  480. *
  481. * @function Highcharts.Chart#addSeriesAsDrilldown
  482. *
  483. * @param {Highcharts.Point} point
  484. * The point from which the drilldown will start.
  485. *
  486. * @param {Highcharts.SeriesOptionsType} options
  487. * The series options for the new, detailed series.
  488. */
  489. Chart.prototype.addSeriesAsDrilldown = function (point, options) {
  490. this.addSingleSeriesAsDrilldown(point, options);
  491. this.applyDrilldown();
  492. };
  493. Chart.prototype.addSingleSeriesAsDrilldown = function (point, ddOptions) {
  494. var oldSeries = point.series,
  495. xAxis = oldSeries.xAxis,
  496. yAxis = oldSeries.yAxis,
  497. newSeries,
  498. pointIndex,
  499. levelSeries = [],
  500. levelSeriesOptions = [],
  501. level,
  502. levelNumber,
  503. last,
  504. colorProp;
  505. colorProp = this.styledMode ?
  506. { colorIndex: pick(point.colorIndex, oldSeries.colorIndex) } :
  507. { color: point.color || oldSeries.color };
  508. if (!this.drilldownLevels) {
  509. this.drilldownLevels = [];
  510. }
  511. levelNumber = oldSeries.options._levelNumber || 0;
  512. // See if we can reuse the registered series from last run
  513. last = this.drilldownLevels[this.drilldownLevels.length - 1];
  514. if (last && last.levelNumber !== levelNumber) {
  515. last = void 0;
  516. }
  517. ddOptions = extend(extend({
  518. _ddSeriesId: ddSeriesId++
  519. }, colorProp), ddOptions);
  520. pointIndex = oldSeries.points.indexOf(point);
  521. // Record options for all current series
  522. oldSeries.chart.series.forEach(function (series) {
  523. if (series.xAxis === xAxis && !series.isDrilling) {
  524. series.options._ddSeriesId =
  525. series.options._ddSeriesId || ddSeriesId++;
  526. series.options._colorIndex = series.userOptions._colorIndex;
  527. series.options._levelNumber =
  528. series.options._levelNumber || levelNumber; // #3182
  529. if (last) {
  530. levelSeries = last.levelSeries;
  531. levelSeriesOptions = last.levelSeriesOptions;
  532. }
  533. else {
  534. levelSeries.push(series);
  535. // (#10597)
  536. series.purgedOptions = merge({
  537. _ddSeriesId: series.options._ddSeriesId,
  538. _levelNumber: series.options._levelNumber,
  539. selected: series.options.selected
  540. }, series.userOptions);
  541. levelSeriesOptions.push(series.purgedOptions);
  542. }
  543. }
  544. });
  545. // Add a record of properties for each drilldown level
  546. level = extend({
  547. levelNumber: levelNumber,
  548. seriesOptions: oldSeries.options,
  549. seriesPurgedOptions: oldSeries.purgedOptions,
  550. levelSeriesOptions: levelSeriesOptions,
  551. levelSeries: levelSeries,
  552. shapeArgs: point.shapeArgs,
  553. // no graphic in line series with markers disabled
  554. bBox: point.graphic ? point.graphic.getBBox() : {},
  555. color: point.isNull ?
  556. new Color(colorProp.color).setOpacity(0).get() :
  557. colorProp.color,
  558. lowerSeriesOptions: ddOptions,
  559. pointOptions: oldSeries.options.data[pointIndex],
  560. pointIndex: pointIndex,
  561. oldExtremes: {
  562. xMin: xAxis && xAxis.userMin,
  563. xMax: xAxis && xAxis.userMax,
  564. yMin: yAxis && yAxis.userMin,
  565. yMax: yAxis && yAxis.userMax
  566. },
  567. resetZoomButton: this.resetZoomButton
  568. }, colorProp);
  569. // Push it to the lookup array
  570. this.drilldownLevels.push(level);
  571. // Reset names to prevent extending (#6704)
  572. if (xAxis && xAxis.names) {
  573. xAxis.names.length = 0;
  574. }
  575. newSeries = level.lowerSeries = this.addSeries(ddOptions, false);
  576. newSeries.options._levelNumber = levelNumber + 1;
  577. if (xAxis) {
  578. xAxis.oldPos = xAxis.pos;
  579. xAxis.userMin = xAxis.userMax = null;
  580. yAxis.userMin = yAxis.userMax = null;
  581. }
  582. // Run fancy cross-animation on supported and equal types
  583. if (oldSeries.type === newSeries.type) {
  584. newSeries.animate = newSeries.animateDrilldown || noop;
  585. newSeries.options.animation = true;
  586. }
  587. };
  588. Chart.prototype.applyDrilldown = function () {
  589. var drilldownLevels = this.drilldownLevels,
  590. levelToRemove;
  591. if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading
  592. levelToRemove = drilldownLevels[drilldownLevels.length - 1].levelNumber;
  593. this.drilldownLevels.forEach(function (level) {
  594. if (level.levelNumber === levelToRemove) {
  595. level.levelSeries.forEach(function (series) {
  596. // Not removed, not added as part of a multi-series
  597. // drilldown
  598. if (series.options &&
  599. series.options._levelNumber === levelToRemove) {
  600. series.remove(false);
  601. }
  602. });
  603. }
  604. });
  605. }
  606. // We have a reset zoom button. Hide it and detatch it from the chart. It
  607. // is preserved to the layer config above.
  608. if (this.resetZoomButton) {
  609. this.resetZoomButton.hide();
  610. delete this.resetZoomButton;
  611. }
  612. this.pointer.reset();
  613. this.redraw();
  614. this.showDrillUpButton();
  615. fireEvent(this, 'afterDrilldown');
  616. };
  617. Chart.prototype.getDrilldownBackText = function () {
  618. var drilldownLevels = this.drilldownLevels,
  619. lastLevel;
  620. if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading
  621. lastLevel = drilldownLevels[drilldownLevels.length - 1];
  622. lastLevel.series = lastLevel.seriesOptions;
  623. return format(this.options.lang.drillUpText, lastLevel);
  624. }
  625. };
  626. Chart.prototype.showDrillUpButton = function () {
  627. var chart = this,
  628. backText = this.getDrilldownBackText(),
  629. buttonOptions = chart.options.drilldown.drillUpButton,
  630. attr,
  631. states;
  632. if (!this.drillUpButton) {
  633. attr = buttonOptions.theme;
  634. states = attr && attr.states;
  635. this.drillUpButton = this.renderer.button(backText, null, null, function () {
  636. chart.drillUp();
  637. }, attr, states && states.hover, states && states.select)
  638. .addClass('highcharts-drillup-button')
  639. .attr({
  640. align: buttonOptions.position.align,
  641. zIndex: 7
  642. })
  643. .add()
  644. .align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox');
  645. }
  646. else {
  647. this.drillUpButton.attr({
  648. text: backText
  649. })
  650. .align();
  651. }
  652. };
  653. /**
  654. * When the chart is drilled down to a child series, calling `chart.drillUp()`
  655. * will drill up to the parent series.
  656. *
  657. * @requires modules/drilldown
  658. *
  659. * @function Highcharts.Chart#drillUp
  660. */
  661. Chart.prototype.drillUp = function () {
  662. if (!this.drilldownLevels || this.drilldownLevels.length === 0) {
  663. return;
  664. }
  665. var chart = this,
  666. drilldownLevels = chart.drilldownLevels,
  667. levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber,
  668. i = drilldownLevels.length,
  669. chartSeries = chart.series,
  670. seriesI,
  671. level,
  672. oldSeries,
  673. newSeries,
  674. oldExtremes,
  675. addSeries = function (seriesOptions) {
  676. var addedSeries;
  677. chartSeries.forEach(function (series) {
  678. if (series.options._ddSeriesId === seriesOptions._ddSeriesId) {
  679. addedSeries = series;
  680. }
  681. });
  682. addedSeries = addedSeries || chart.addSeries(seriesOptions, false);
  683. if (addedSeries.type === oldSeries.type &&
  684. addedSeries.animateDrillupTo) {
  685. addedSeries.animate = addedSeries.animateDrillupTo;
  686. }
  687. if (seriesOptions === level.seriesPurgedOptions) {
  688. newSeries = addedSeries;
  689. }
  690. };
  691. while (i--) {
  692. level = drilldownLevels[i];
  693. if (level.levelNumber === levelNumber) {
  694. drilldownLevels.pop();
  695. // Get the lower series by reference or id
  696. oldSeries = level.lowerSeries;
  697. if (!oldSeries.chart) { // #2786
  698. seriesI = chartSeries.length; // #2919
  699. while (seriesI--) {
  700. if (chartSeries[seriesI].options.id ===
  701. level.lowerSeriesOptions.id &&
  702. chartSeries[seriesI].options._levelNumber ===
  703. levelNumber + 1) { // #3867
  704. oldSeries = chartSeries[seriesI];
  705. break;
  706. }
  707. }
  708. }
  709. oldSeries.xData = []; // Overcome problems with minRange (#2898)
  710. level.levelSeriesOptions.forEach(addSeries);
  711. fireEvent(chart, 'drillup', {
  712. seriesOptions: level.seriesPurgedOptions ||
  713. level.seriesOptions
  714. });
  715. this.resetZoomButton && this.resetZoomButton.destroy(); // #8095
  716. if (newSeries.type === oldSeries.type) {
  717. newSeries.drilldownLevel = level;
  718. newSeries.options.animation =
  719. chart.options.drilldown.animation;
  720. if (oldSeries.animateDrillupFrom && oldSeries.chart) { // #2919
  721. oldSeries.animateDrillupFrom(level);
  722. }
  723. }
  724. newSeries.options._levelNumber = levelNumber;
  725. oldSeries.remove(false);
  726. // Reset the zoom level of the upper series
  727. if (newSeries.xAxis) {
  728. oldExtremes = level.oldExtremes;
  729. newSeries.xAxis.setExtremes(oldExtremes.xMin, oldExtremes.xMax, false);
  730. newSeries.yAxis.setExtremes(oldExtremes.yMin, oldExtremes.yMax, false);
  731. }
  732. // We have a resetZoomButton tucked away for this level. Attatch
  733. // it to the chart and show it.
  734. if (level.resetZoomButton) {
  735. chart.resetZoomButton = level.resetZoomButton;
  736. chart.resetZoomButton.show();
  737. }
  738. }
  739. }
  740. this.redraw();
  741. if (this.drilldownLevels.length === 0) {
  742. this.drillUpButton = this.drillUpButton.destroy();
  743. }
  744. else {
  745. this.drillUpButton.attr({
  746. text: this.getDrilldownBackText()
  747. })
  748. .align();
  749. }
  750. this.ddDupes.length = []; // #3315
  751. // Fire a once-off event after all series have been drilled up (#5158)
  752. fireEvent(chart, 'drillupall');
  753. };
  754. /* eslint-disable no-invalid-this */
  755. // Add update function to be called internally from Chart.update
  756. // (#7600, #12855)
  757. addEvent(Chart, 'afterInit', function () {
  758. var chart = this;
  759. chart.drilldown = {
  760. update: function (options, redraw) {
  761. merge(true, chart.options.drilldown, options);
  762. if (pick(redraw, true)) {
  763. chart.redraw();
  764. }
  765. }
  766. };
  767. });
  768. // Shift the drillUpButton to make the space for resetZoomButton, #8095.
  769. addEvent(Chart, 'afterShowResetZoom', function () {
  770. var chart = this,
  771. bbox = chart.resetZoomButton && chart.resetZoomButton.getBBox(),
  772. buttonOptions = chart.options.drilldown && chart.options.drilldown.drillUpButton;
  773. if (this.drillUpButton && bbox && buttonOptions && buttonOptions.position && buttonOptions.position.x) {
  774. this.drillUpButton.align({
  775. x: buttonOptions.position.x - bbox.width - 10,
  776. y: buttonOptions.position.y,
  777. align: buttonOptions.position.align
  778. }, false, buttonOptions.relativeTo || 'plotBox');
  779. }
  780. });
  781. addEvent(Chart, 'render', function () {
  782. (this.xAxis || []).forEach(function (axis) {
  783. axis.ddPoints = {};
  784. axis.series.forEach(function (series) {
  785. var i,
  786. xData = series.xData || [],
  787. points = series.points,
  788. p;
  789. for (i = 0; i < xData.length; i++) {
  790. p = series.options.data[i];
  791. // The `drilldown` property can only be set on an array or an
  792. // object
  793. if (typeof p !== 'number') {
  794. // Convert array to object (#8008)
  795. p = series.pointClass.prototype.optionsToObject
  796. .call({ series: series }, p);
  797. if (p.drilldown) {
  798. if (!axis.ddPoints[xData[i]]) {
  799. axis.ddPoints[xData[i]] = [];
  800. }
  801. axis.ddPoints[xData[i]].push(points ? points[i] : true);
  802. }
  803. }
  804. }
  805. });
  806. // Add drillability to ticks, and always keep it drillability updated
  807. // (#3951)
  808. objectEach(axis.ticks, Tick.prototype.drillable);
  809. });
  810. });
  811. /**
  812. * When drilling up, keep the upper series invisible until the lower series has
  813. * moved into place.
  814. *
  815. * @private
  816. * @function Highcharts.ColumnSeries#animateDrillupTo
  817. * @param {boolean} [init=false]
  818. * Whether to initialize animation
  819. */
  820. ColumnSeries.prototype.animateDrillupTo = function (init) {
  821. if (!init) {
  822. var newSeries = this,
  823. level = newSeries.drilldownLevel;
  824. // First hide all items before animating in again
  825. this.points.forEach(function (point) {
  826. var dataLabel = point.dataLabel;
  827. if (point.graphic) { // #3407
  828. point.graphic.hide();
  829. }
  830. if (dataLabel) {
  831. // The data label is initially hidden, make sure it is not faded
  832. // in (#6127)
  833. dataLabel.hidden = dataLabel.attr('visibility') === 'hidden';
  834. if (!dataLabel.hidden) {
  835. dataLabel.hide();
  836. if (point.connector) {
  837. point.connector.hide();
  838. }
  839. }
  840. }
  841. });
  842. // Do dummy animation on first point to get to complete
  843. syncTimeout(function () {
  844. if (newSeries.points) { // May be destroyed in the meantime, #3389
  845. // Unable to drillup with nodes, #13711
  846. var pointsWithNodes = [];
  847. newSeries.data.forEach(function (el) {
  848. pointsWithNodes.push(el);
  849. });
  850. if (newSeries.nodes) {
  851. pointsWithNodes = pointsWithNodes.concat(newSeries.nodes);
  852. }
  853. pointsWithNodes.forEach(function (point, i) {
  854. // Fade in other points
  855. var verb = i === (level && level.pointIndex) ? 'show' : 'fadeIn', inherit = verb === 'show' ? true : void 0, dataLabel = point.dataLabel;
  856. if (point.graphic) { // #3407
  857. point.graphic[verb](inherit);
  858. }
  859. if (dataLabel && !dataLabel.hidden) { // #6127
  860. dataLabel.fadeIn(); // #7384
  861. if (point.connector) {
  862. point.connector.fadeIn();
  863. }
  864. }
  865. });
  866. }
  867. }, Math.max(this.chart.options.drilldown.animation.duration - 50, 0));
  868. // Reset to prototype
  869. delete this.animate;
  870. }
  871. };
  872. ColumnSeries.prototype.animateDrilldown = function (init) {
  873. var series = this,
  874. chart = this.chart,
  875. drilldownLevels = chart.drilldownLevels,
  876. animateFrom,
  877. animationOptions = animObject(chart.options.drilldown.animation),
  878. xAxis = this.xAxis,
  879. styledMode = chart.styledMode;
  880. if (!init) {
  881. drilldownLevels.forEach(function (level) {
  882. if (series.options._ddSeriesId ===
  883. level.lowerSeriesOptions._ddSeriesId) {
  884. animateFrom = level.shapeArgs;
  885. if (!styledMode) {
  886. // Add the point colors to animate from
  887. animateFrom.fill = level.color;
  888. }
  889. }
  890. });
  891. animateFrom.x += pick(xAxis.oldPos, xAxis.pos) - xAxis.pos;
  892. this.points.forEach(function (point) {
  893. var animateTo = point.shapeArgs;
  894. if (!styledMode) {
  895. // Add the point colors to animate to
  896. animateTo.fill = point.color;
  897. }
  898. if (point.graphic) {
  899. point.graphic
  900. .attr(animateFrom)
  901. .animate(extend(point.shapeArgs, { fill: point.color || series.color }), animationOptions);
  902. }
  903. if (point.dataLabel) {
  904. point.dataLabel.fadeIn(animationOptions);
  905. }
  906. });
  907. // Reset to prototype
  908. delete this.animate;
  909. }
  910. };
  911. /**
  912. * When drilling up, pull out the individual point graphics from the lower
  913. * series and animate them into the origin point in the upper series.
  914. *
  915. * @private
  916. * @function Highcharts.ColumnSeries#animateDrillupFrom
  917. * @param {Highcharts.DrilldownLevelObject} level
  918. * Level container
  919. * @return {void}
  920. */
  921. ColumnSeries.prototype.animateDrillupFrom = function (level) {
  922. var animationOptions = animObject(this.chart.options.drilldown.animation),
  923. group = this.group,
  924. // For 3d column series all columns are added to one group
  925. // so we should not delete the whole group. #5297
  926. removeGroup = group !== this.chart.columnGroup,
  927. series = this;
  928. // Cancel mouse events on the series group (#2787)
  929. series.trackerGroups.forEach(function (key) {
  930. if (series[key]) { // we don't always have dataLabelsGroup
  931. series[key].on('mouseover');
  932. }
  933. });
  934. if (removeGroup) {
  935. delete this.group;
  936. }
  937. this.points.forEach(function (point) {
  938. var graphic = point.graphic,
  939. animateTo = level.shapeArgs,
  940. complete = function () {
  941. graphic.destroy();
  942. if (group && removeGroup) {
  943. group = group.destroy();
  944. }
  945. };
  946. if (graphic && animateTo) {
  947. delete point.graphic;
  948. if (!series.chart.styledMode) {
  949. animateTo.fill = level.color;
  950. }
  951. if (animationOptions.duration) {
  952. graphic.animate(animateTo, merge(animationOptions, { complete: complete }));
  953. }
  954. else {
  955. graphic.attr(animateTo);
  956. complete();
  957. }
  958. }
  959. });
  960. };
  961. if (PieSeries) {
  962. extend(PieSeries.prototype, {
  963. animateDrillupTo: ColumnSeries.prototype.animateDrillupTo,
  964. animateDrillupFrom: ColumnSeries.prototype.animateDrillupFrom,
  965. animateDrilldown: function (init) {
  966. var level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
  967. animationOptions = this.chart.options.drilldown.animation;
  968. if (this.is('item')) {
  969. animationOptions.duration = 0;
  970. }
  971. // Unable to drill down in the horizontal item series #13372
  972. if (this.center) {
  973. var animateFrom = level.shapeArgs,
  974. start = animateFrom.start,
  975. angle = animateFrom.end - start,
  976. startAngle = angle / this.points.length,
  977. styledMode = this.chart.styledMode;
  978. if (!init) {
  979. this.points.forEach(function (point, i) {
  980. var animateTo = point.shapeArgs;
  981. if (!styledMode) {
  982. animateFrom.fill = level.color;
  983. animateTo.fill = point.color;
  984. }
  985. if (point.graphic) {
  986. point.graphic
  987. .attr(merge(animateFrom, {
  988. start: start + i * startAngle,
  989. end: start + (i + 1) * startAngle
  990. }))[animationOptions ? 'animate' : 'attr'](animateTo, animationOptions);
  991. }
  992. });
  993. // Reset to prototype
  994. delete this.animate;
  995. }
  996. }
  997. }
  998. });
  999. }
  1000. Point.prototype.doDrilldown = function (_holdRedraw, category, originalEvent) {
  1001. var series = this.series,
  1002. chart = series.chart,
  1003. drilldown = chart.options.drilldown,
  1004. i = (drilldown.series || []).length,
  1005. seriesOptions;
  1006. if (!chart.ddDupes) {
  1007. chart.ddDupes = [];
  1008. }
  1009. while (i-- && !seriesOptions) {
  1010. if (drilldown.series[i].id === this.drilldown &&
  1011. chart.ddDupes.indexOf(this.drilldown) === -1) {
  1012. seriesOptions = drilldown.series[i];
  1013. chart.ddDupes.push(this.drilldown);
  1014. }
  1015. }
  1016. // Fire the event. If seriesOptions is undefined, the implementer can check
  1017. // for seriesOptions, and call addSeriesAsDrilldown async if necessary.
  1018. fireEvent(chart, 'drilldown', {
  1019. point: this,
  1020. seriesOptions: seriesOptions,
  1021. category: category,
  1022. originalEvent: originalEvent,
  1023. points: (typeof category !== 'undefined' &&
  1024. this.series.xAxis.getDDPoints(category).slice(0))
  1025. }, function (e) {
  1026. var chart = e.point.series && e.point.series.chart,
  1027. seriesOptions = e.seriesOptions;
  1028. if (chart && seriesOptions) {
  1029. if (_holdRedraw) {
  1030. chart.addSingleSeriesAsDrilldown(e.point, seriesOptions);
  1031. }
  1032. else {
  1033. chart.addSeriesAsDrilldown(e.point, seriesOptions);
  1034. }
  1035. }
  1036. });
  1037. };
  1038. /**
  1039. * Drill down to a given category. This is the same as clicking on an axis
  1040. * label.
  1041. *
  1042. * @private
  1043. * @function Highcharts.Axis#drilldownCategory
  1044. * @param {number} x
  1045. * Tick position
  1046. * @param {global.MouseEvent} e
  1047. * Click event
  1048. */
  1049. Axis.prototype.drilldownCategory = function (x, e) {
  1050. this.getDDPoints(x).forEach(function (point) {
  1051. if (point &&
  1052. point.series &&
  1053. point.series.visible &&
  1054. point.doDrilldown) { // #3197
  1055. point.doDrilldown(true, x, e);
  1056. }
  1057. });
  1058. this.chart.applyDrilldown();
  1059. };
  1060. /**
  1061. * Return drillable points for this specific X value.
  1062. *
  1063. * @private
  1064. * @function Highcharts.Axis#getDDPoints
  1065. * @param {number} x
  1066. * Tick position
  1067. * @return {Array<(false|Highcharts.Point)>}
  1068. * Drillable points
  1069. */
  1070. Axis.prototype.getDDPoints = function (x) {
  1071. return (this.ddPoints && this.ddPoints[x] || []);
  1072. };
  1073. /**
  1074. * Make a tick label drillable, or remove drilling on update.
  1075. *
  1076. * @private
  1077. * @function Highcharts.Axis#drillable
  1078. */
  1079. Tick.prototype.drillable = function () {
  1080. var pos = this.pos,
  1081. label = this.label,
  1082. axis = this.axis,
  1083. isDrillable = axis.coll === 'xAxis' && axis.getDDPoints,
  1084. ddPointsX = isDrillable && axis.getDDPoints(pos),
  1085. styledMode = axis.chart.styledMode;
  1086. if (isDrillable) {
  1087. if (label && ddPointsX && ddPointsX.length) {
  1088. label.drillable = true;
  1089. if (!label.basicStyles && !styledMode) {
  1090. label.basicStyles = merge(label.styles);
  1091. }
  1092. label.addClass('highcharts-drilldown-axis-label');
  1093. // #12656 - avoid duplicate of attach event
  1094. if (label.removeOnDrillableClick) {
  1095. removeEvent(label.element, 'click');
  1096. }
  1097. label.removeOnDrillableClick = addEvent(label.element, 'click', function (e) {
  1098. e.preventDefault();
  1099. axis.drilldownCategory(pos, e);
  1100. });
  1101. if (!styledMode) {
  1102. label.css(axis.chart.options.drilldown.activeAxisLabelStyle);
  1103. }
  1104. }
  1105. else if (label && label.drillable && label.removeOnDrillableClick) {
  1106. if (!styledMode) {
  1107. label.styles = {}; // reset for full overwrite of styles
  1108. label.css(label.basicStyles);
  1109. }
  1110. label.removeOnDrillableClick(); // #3806
  1111. label.removeClass('highcharts-drilldown-axis-label');
  1112. }
  1113. }
  1114. };
  1115. // On initialization of each point, identify its label and make it clickable.
  1116. // Also, provide a list of points associated to that label.
  1117. addEvent(Point, 'afterInit', function () {
  1118. var point = this;
  1119. if (point.drilldown && !point.unbindDrilldownClick) {
  1120. // Add the click event to the point
  1121. point.unbindDrilldownClick = addEvent(point, 'click', handlePointClick);
  1122. }
  1123. return point;
  1124. });
  1125. addEvent(Point, 'update', function (e) {
  1126. var point = this,
  1127. options = e.options || {};
  1128. if (options.drilldown && !point.unbindDrilldownClick) {
  1129. // Add the click event to the point
  1130. point.unbindDrilldownClick = addEvent(point, 'click', handlePointClick);
  1131. }
  1132. else if (!options.drilldown &&
  1133. options.drilldown !== void 0 &&
  1134. point.unbindDrilldownClick) {
  1135. point.unbindDrilldownClick = point.unbindDrilldownClick();
  1136. }
  1137. });
  1138. var handlePointClick = function (e) {
  1139. var point = this,
  1140. series = point.series;
  1141. if (series.xAxis &&
  1142. series.chart.options.drilldown.allowPointDrilldown ===
  1143. false) {
  1144. // #5822, x changed
  1145. series.xAxis.drilldownCategory(point.x, e);
  1146. }
  1147. else {
  1148. point.doDrilldown(void 0, void 0, e);
  1149. }
  1150. };
  1151. addEvent(Series, 'afterDrawDataLabels', function () {
  1152. var css = this.chart.options.drilldown.activeDataLabelStyle,
  1153. renderer = this.chart.renderer,
  1154. styledMode = this.chart.styledMode;
  1155. this.points.forEach(function (point) {
  1156. var dataLabelsOptions = point.options.dataLabels,
  1157. pointCSS = pick(point.dlOptions,
  1158. dataLabelsOptions && dataLabelsOptions.style, {});
  1159. if (point.drilldown && point.dataLabel) {
  1160. if (css.color === 'contrast' && !styledMode) {
  1161. pointCSS.color = renderer.getContrast(point.color || this.color);
  1162. }
  1163. if (dataLabelsOptions && dataLabelsOptions.color) {
  1164. pointCSS.color = dataLabelsOptions.color;
  1165. }
  1166. point.dataLabel
  1167. .addClass('highcharts-drilldown-data-label');
  1168. if (!styledMode) {
  1169. point.dataLabel
  1170. .css(css)
  1171. .css(pointCSS);
  1172. }
  1173. }
  1174. }, this);
  1175. });
  1176. var applyCursorCSS = function (element,
  1177. cursor,
  1178. addClass,
  1179. styledMode) {
  1180. element[addClass ? 'addClass' : 'removeClass']('highcharts-drilldown-point');
  1181. if (!styledMode) {
  1182. element.css({ cursor: cursor });
  1183. }
  1184. };
  1185. // Mark the trackers with a pointer
  1186. addEvent(Series, 'afterDrawTracker', function () {
  1187. var styledMode = this.chart.styledMode;
  1188. this.points.forEach(function (point) {
  1189. if (point.drilldown && point.graphic) {
  1190. applyCursorCSS(point.graphic, 'pointer', true, styledMode);
  1191. }
  1192. });
  1193. });
  1194. addEvent(Point, 'afterSetState', function () {
  1195. var styledMode = this.series.chart.styledMode;
  1196. if (this.drilldown && this.series.halo && this.state === 'hover') {
  1197. applyCursorCSS(this.series.halo, 'pointer', true, styledMode);
  1198. }
  1199. else if (this.series.halo) {
  1200. applyCursorCSS(this.series.halo, 'auto', false, styledMode);
  1201. }
  1202. });
  1203. // After zooming out, shift the drillUpButton to the previous position, #8095.
  1204. addEvent(H.Chart, 'selection', function (event) {
  1205. if (event.resetSelection === true && this.drillUpButton) {
  1206. var buttonOptions = this.options.drilldown && this.options.drilldown.drillUpButton;
  1207. if (buttonOptions && buttonOptions.position) {
  1208. this.drillUpButton.align({
  1209. x: buttonOptions.position.x,
  1210. y: buttonOptions.position.y,
  1211. align: buttonOptions.position.align
  1212. }, false, buttonOptions.relativeTo || 'plotBox');
  1213. }
  1214. }
  1215. });
  1216. addEvent(H.Chart, 'drillup', function () {
  1217. if (this.resetZoomButton) {
  1218. this.resetZoomButton = this.resetZoomButton.destroy();
  1219. }
  1220. });
  1221. });
  1222. _registerModule(_modules, 'masters/modules/drilldown.src.js', [], function () {
  1223. });
  1224. }));