highcharts 6.1.4 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (695) hide show
  1. package/bower.json +1 -1
  2. package/css/highcharts.css +17 -0
  3. package/css/highcharts.scss +14 -0
  4. package/css/themes/dark-unica.css +17 -0
  5. package/css/themes/grid-light.css +17 -0
  6. package/css/themes/sand-signika.css +17 -0
  7. package/es-modules/indicators/momentum.src.js +1 -1
  8. package/es-modules/indicators/pivot-points.src.js +6 -1
  9. package/es-modules/masters/highcharts-gantt.src.js +11 -0
  10. package/es-modules/masters/modules/annotations.src.js +1 -1
  11. package/es-modules/masters/modules/arrow-symbols.src.js +12 -0
  12. package/es-modules/masters/modules/broken-axis.src.js +1 -1
  13. package/es-modules/masters/modules/current-date-indicator.src.js +12 -0
  14. package/es-modules/masters/modules/data.src.js +1 -1
  15. package/es-modules/masters/modules/draggable-points.src.js +9 -0
  16. package/es-modules/masters/modules/export-data.src.js +1 -1
  17. package/es-modules/masters/modules/exporting.src.js +1 -1
  18. package/es-modules/masters/modules/funnel.src.js +1 -1
  19. package/es-modules/masters/modules/gantt.src.js +2 -1
  20. package/es-modules/masters/modules/grid-axis.src.js +1 -1
  21. package/es-modules/masters/modules/heatmap.src.js +1 -1
  22. package/es-modules/masters/modules/item-series.src.js +1 -1
  23. package/es-modules/masters/modules/map.src.js +1 -1
  24. package/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
  25. package/es-modules/masters/modules/pathfinder.src.js +12 -0
  26. package/es-modules/masters/modules/sankey.src.js +1 -1
  27. package/es-modules/masters/modules/series-label.src.js +1 -1
  28. package/es-modules/masters/modules/solid-gauge.src.js +1 -1
  29. package/es-modules/masters/modules/stock.src.js +1 -1
  30. package/es-modules/masters/modules/streamgraph.src.js +1 -1
  31. package/es-modules/masters/modules/treegrid.src.js +12 -0
  32. package/es-modules/masters/modules/variwide.src.js +1 -1
  33. package/es-modules/masters/modules/vector.src.js +1 -1
  34. package/es-modules/masters/modules/windbarb.src.js +1 -1
  35. package/es-modules/masters/modules/xrange.src.js +1 -1
  36. package/es-modules/masters/themes/dark-blue.src.js +1 -1
  37. package/es-modules/masters/themes/dark-green.src.js +1 -1
  38. package/es-modules/masters/themes/dark-unica.src.js +1 -1
  39. package/es-modules/masters/themes/gray.src.js +1 -1
  40. package/es-modules/masters/themes/grid-light.src.js +1 -1
  41. package/es-modules/masters/themes/grid.src.js +1 -1
  42. package/es-modules/masters/themes/sand-signika.src.js +1 -1
  43. package/es-modules/masters/themes/skies.src.js +1 -1
  44. package/es-modules/mixins/centered-series.js +1 -1
  45. package/es-modules/mixins/on-series.js +1 -1
  46. package/es-modules/modules/boost.src.js +22 -14
  47. package/es-modules/modules/broken-axis.src.js +169 -134
  48. package/es-modules/modules/data.src.js +2 -2
  49. package/es-modules/modules/draggable-points.src.js +2257 -0
  50. package/es-modules/modules/drilldown.src.js +1 -0
  51. package/es-modules/modules/export-data.src.js +1 -1
  52. package/es-modules/modules/exporting.src.js +1 -1
  53. package/es-modules/modules/funnel.src.js +1 -1
  54. package/es-modules/modules/item-series.src.js +1 -1
  55. package/es-modules/modules/no-data-to-display.src.js +5 -5
  56. package/es-modules/modules/oldie.src.js +1 -1
  57. package/es-modules/modules/overlapping-datalabels.src.js +38 -22
  58. package/es-modules/modules/parallel-coordinates.src.js +3 -2
  59. package/es-modules/modules/sankey.src.js +1 -1
  60. package/es-modules/modules/series-label.src.js +2 -2
  61. package/es-modules/modules/solid-gauge.src.js +1 -1
  62. package/es-modules/modules/static-scale.src.js +67 -28
  63. package/es-modules/modules/streamgraph.src.js +1 -1
  64. package/es-modules/modules/tilemap.src.js +231 -134
  65. package/es-modules/modules/variwide.src.js +1 -1
  66. package/es-modules/modules/vector.src.js +92 -22
  67. package/es-modules/modules/windbarb.src.js +1 -1
  68. package/es-modules/modules/xrange.src.js +257 -77
  69. package/es-modules/parts/AreaSeries.js +77 -77
  70. package/es-modules/parts/AreaSplineSeries.js +64 -27
  71. package/es-modules/parts/Axis.js +160 -67
  72. package/es-modules/parts/BarSeries.js +68 -51
  73. package/es-modules/parts/CandlestickSeries.js +1 -1
  74. package/es-modules/parts/Chart.js +31 -55
  75. package/es-modules/parts/Color.js +29 -18
  76. package/es-modules/parts/ColumnSeries.js +264 -142
  77. package/es-modules/parts/DataGrouping.js +9 -6
  78. package/es-modules/parts/DataLabels.js +261 -210
  79. package/es-modules/parts/DateTimeAxis.js +26 -7
  80. package/es-modules/parts/Dynamics.js +5 -2
  81. package/es-modules/parts/FlagsSeries.js +1 -1
  82. package/es-modules/parts/Globals.js +1 -1
  83. package/es-modules/parts/Html.js +64 -12
  84. package/es-modules/parts/Interaction.js +187 -63
  85. package/es-modules/parts/Legend.js +7 -3
  86. package/es-modules/parts/LogarithmicAxis.js +35 -4
  87. package/es-modules/parts/MSPointer.js +1 -1
  88. package/es-modules/parts/Navigator.js +27 -5
  89. package/es-modules/parts/OHLCSeries.js +1 -1
  90. package/es-modules/parts/Options.js +15 -13
  91. package/es-modules/parts/OrdinalAxis.js +1 -1
  92. package/es-modules/parts/PieSeries.js +256 -140
  93. package/es-modules/parts/PlotBandSeries.experimental.js +1 -1
  94. package/es-modules/parts/PlotLineOrBand.js +7 -40
  95. package/es-modules/parts/Point.js +28 -4
  96. package/es-modules/parts/Pointer.js +8 -6
  97. package/es-modules/parts/RangeSelector.js +1 -1
  98. package/es-modules/parts/Responsive.js +82 -36
  99. package/es-modules/parts/ScatterSeries.js +57 -25
  100. package/es-modules/parts/ScrollablePlotArea.js +17 -7
  101. package/es-modules/parts/Scrollbar.js +9 -2
  102. package/es-modules/parts/Series.js +22 -9
  103. package/es-modules/parts/SplineSeries.js +51 -29
  104. package/es-modules/parts/Stacking.js +100 -6
  105. package/es-modules/parts/StockChart.js +9 -3
  106. package/es-modules/parts/SvgRenderer.js +15 -10
  107. package/es-modules/parts/Tick.js +150 -30
  108. package/es-modules/parts/Time.js +23 -5
  109. package/es-modules/parts/Tooltip.js +2 -2
  110. package/es-modules/parts/TouchPointer.js +1 -1
  111. package/es-modules/parts/Utilities.js +16 -1
  112. package/es-modules/parts-3d/Axis.js +1 -1
  113. package/es-modules/parts-3d/Chart.js +1 -1
  114. package/es-modules/parts-3d/Column.js +1 -1
  115. package/es-modules/parts-3d/Math.js +1 -1
  116. package/es-modules/parts-3d/Pie.js +1 -1
  117. package/es-modules/parts-3d/SVGRenderer.js +1 -1
  118. package/es-modules/parts-3d/Scatter.js +1 -1
  119. package/es-modules/parts-3d/Series.js +1 -1
  120. package/es-modules/parts-3d/VMLRenderer.js +1 -1
  121. package/es-modules/parts-gantt/ArrowSymbols.js +110 -0
  122. package/es-modules/parts-gantt/CurrentDateIndicator.js +92 -0
  123. package/es-modules/parts-gantt/GanttChart.js +111 -0
  124. package/es-modules/parts-gantt/GanttSeries.js +376 -0
  125. package/es-modules/parts-gantt/GridAxis.js +965 -0
  126. package/es-modules/parts-gantt/Pathfinder.js +1247 -0
  127. package/es-modules/parts-gantt/PathfinderAlgorithms.js +746 -0
  128. package/es-modules/parts-gantt/Tree.js +146 -0
  129. package/es-modules/parts-gantt/TreeGrid.js +917 -0
  130. package/es-modules/parts-map/ColorAxis.js +1 -1
  131. package/es-modules/parts-map/ColorSeriesMixin.js +1 -1
  132. package/es-modules/parts-map/GeoJSON.js +1 -1
  133. package/es-modules/parts-map/HeatmapSeries.js +124 -53
  134. package/es-modules/parts-map/Map.js +1 -1
  135. package/es-modules/parts-map/MapAxis.js +1 -1
  136. package/es-modules/parts-map/MapBubbleSeries.js +1 -1
  137. package/es-modules/parts-map/MapLineSeries.js +1 -1
  138. package/es-modules/parts-map/MapNavigation.js +1 -1
  139. package/es-modules/parts-map/MapPointSeries.js +1 -1
  140. package/es-modules/parts-map/MapPointer.js +1 -1
  141. package/es-modules/parts-map/MapSeries.js +2 -2
  142. package/es-modules/parts-more/AreaRangeSeries.js +80 -38
  143. package/es-modules/parts-more/AreaSplineRangeSeries.js +1 -1
  144. package/es-modules/parts-more/BoxPlotSeries.js +1 -1
  145. package/es-modules/parts-more/BubbleSeries.js +1 -1
  146. package/es-modules/parts-more/ColumnRangeSeries.js +1 -1
  147. package/es-modules/parts-more/ErrorBarSeries.js +1 -1
  148. package/es-modules/parts-more/GaugeSeries.js +1 -1
  149. package/es-modules/parts-more/Pane.js +2 -1
  150. package/es-modules/parts-more/Polar.js +1 -1
  151. package/es-modules/parts-more/PolygonSeries.js +1 -1
  152. package/es-modules/parts-more/RadialAxis.js +5 -4
  153. package/es-modules/parts-more/WaterfallSeries.js +1 -1
  154. package/es-modules/supplemental.docs.js +0 -1955
  155. package/es-modules/themes/dark-blue.js +1 -1
  156. package/es-modules/themes/dark-green.js +1 -1
  157. package/es-modules/themes/dark-unica.js +1 -1
  158. package/es-modules/themes/gray.js +1 -1
  159. package/es-modules/themes/grid-light.js +1 -1
  160. package/es-modules/themes/grid.js +1 -1
  161. package/es-modules/themes/sand-signika.js +1 -1
  162. package/es-modules/themes/skies.js +1 -1
  163. package/highcharts-3d.js +1 -1
  164. package/highcharts-3d.src.js +10 -10
  165. package/highcharts-gantt.js +503 -0
  166. package/highcharts-gantt.js.map +1 -0
  167. package/highcharts-gantt.src.js +49289 -0
  168. package/highcharts-more.js +65 -64
  169. package/highcharts-more.js.map +1 -1
  170. package/highcharts-more.src.js +97 -53
  171. package/highcharts.js +415 -410
  172. package/highcharts.js.map +1 -1
  173. package/highcharts.src.js +2170 -1128
  174. package/highmaps.js +443 -438
  175. package/highmaps.js.map +1 -1
  176. package/highmaps.src.js +1647 -849
  177. package/highstock.js +553 -548
  178. package/highstock.js.map +1 -1
  179. package/highstock.src.js +2398 -1283
  180. package/indicators/accumulation-distribution.js +1 -1
  181. package/indicators/accumulation-distribution.src.js +1 -1
  182. package/indicators/atr.js +1 -1
  183. package/indicators/atr.src.js +1 -1
  184. package/indicators/bollinger-bands.js +1 -1
  185. package/indicators/bollinger-bands.src.js +1 -1
  186. package/indicators/cci.js +1 -1
  187. package/indicators/cci.src.js +1 -1
  188. package/indicators/cmf.js +1 -1
  189. package/indicators/cmf.src.js +1 -1
  190. package/indicators/ema.js +1 -1
  191. package/indicators/ema.src.js +1 -1
  192. package/indicators/ichimoku-kinko-hyo.js +1 -1
  193. package/indicators/ichimoku-kinko-hyo.src.js +1 -1
  194. package/indicators/indicators.js +1 -1
  195. package/indicators/indicators.src.js +1 -1
  196. package/indicators/macd.js +1 -1
  197. package/indicators/macd.src.js +1 -1
  198. package/indicators/mfi.js +1 -1
  199. package/indicators/mfi.src.js +1 -1
  200. package/indicators/momentum.js +1 -1
  201. package/indicators/momentum.src.js +2 -2
  202. package/indicators/pivot-points.js +4 -4
  203. package/indicators/pivot-points.js.map +1 -1
  204. package/indicators/pivot-points.src.js +7 -2
  205. package/indicators/price-envelopes.js +1 -1
  206. package/indicators/price-envelopes.src.js +1 -1
  207. package/indicators/psar.js +1 -1
  208. package/indicators/psar.src.js +1 -1
  209. package/indicators/roc.js +1 -1
  210. package/indicators/roc.src.js +1 -1
  211. package/indicators/rsi.js +1 -1
  212. package/indicators/rsi.src.js +1 -1
  213. package/indicators/stochastic.js +1 -1
  214. package/indicators/stochastic.src.js +1 -1
  215. package/indicators/volume-by-price.js +1 -1
  216. package/indicators/volume-by-price.src.js +1 -1
  217. package/indicators/vwap.js +1 -1
  218. package/indicators/vwap.src.js +1 -1
  219. package/indicators/wma.js +1 -1
  220. package/indicators/wma.src.js +1 -1
  221. package/indicators/zigzag.js +1 -1
  222. package/indicators/zigzag.src.js +1 -1
  223. package/js/es-modules/indicators/momentum.src.js +1 -1
  224. package/js/es-modules/indicators/pivot-points.src.js +6 -1
  225. package/js/es-modules/masters/highcharts-gantt.src.js +11 -0
  226. package/js/es-modules/masters/modules/annotations.src.js +1 -1
  227. package/js/es-modules/masters/modules/arrow-symbols.src.js +12 -0
  228. package/js/es-modules/masters/modules/broken-axis.src.js +1 -1
  229. package/js/es-modules/masters/modules/current-date-indicator.src.js +12 -0
  230. package/js/es-modules/masters/modules/data.src.js +1 -1
  231. package/js/es-modules/masters/modules/draggable-points.src.js +9 -0
  232. package/js/es-modules/masters/modules/export-data.src.js +1 -1
  233. package/js/es-modules/masters/modules/exporting.src.js +1 -1
  234. package/js/es-modules/masters/modules/funnel.src.js +1 -1
  235. package/js/es-modules/masters/modules/gantt.src.js +2 -1
  236. package/js/es-modules/masters/modules/grid-axis.src.js +1 -1
  237. package/js/es-modules/masters/modules/heatmap.src.js +1 -1
  238. package/js/es-modules/masters/modules/item-series.src.js +1 -1
  239. package/js/es-modules/masters/modules/map.src.js +1 -1
  240. package/js/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
  241. package/js/es-modules/masters/modules/pathfinder.src.js +12 -0
  242. package/js/es-modules/masters/modules/sankey.src.js +1 -1
  243. package/js/es-modules/masters/modules/series-label.src.js +1 -1
  244. package/js/es-modules/masters/modules/solid-gauge.src.js +1 -1
  245. package/js/es-modules/masters/modules/stock.src.js +1 -1
  246. package/js/es-modules/masters/modules/streamgraph.src.js +1 -1
  247. package/js/es-modules/masters/modules/treegrid.src.js +12 -0
  248. package/js/es-modules/masters/modules/variwide.src.js +1 -1
  249. package/js/es-modules/masters/modules/vector.src.js +1 -1
  250. package/js/es-modules/masters/modules/windbarb.src.js +1 -1
  251. package/js/es-modules/masters/modules/xrange.src.js +1 -1
  252. package/js/es-modules/masters/themes/dark-blue.src.js +1 -1
  253. package/js/es-modules/masters/themes/dark-green.src.js +1 -1
  254. package/js/es-modules/masters/themes/dark-unica.src.js +1 -1
  255. package/js/es-modules/masters/themes/gray.src.js +1 -1
  256. package/js/es-modules/masters/themes/grid-light.src.js +1 -1
  257. package/js/es-modules/masters/themes/grid.src.js +1 -1
  258. package/js/es-modules/masters/themes/sand-signika.src.js +1 -1
  259. package/js/es-modules/masters/themes/skies.src.js +1 -1
  260. package/js/es-modules/mixins/centered-series.js +1 -1
  261. package/js/es-modules/mixins/on-series.js +1 -1
  262. package/js/es-modules/modules/boost.src.js +22 -14
  263. package/js/es-modules/modules/broken-axis.src.js +169 -134
  264. package/js/es-modules/modules/data.src.js +2 -2
  265. package/js/es-modules/modules/draggable-points.src.js +2257 -0
  266. package/js/es-modules/modules/drilldown.src.js +1 -0
  267. package/js/es-modules/modules/export-data.src.js +1 -1
  268. package/js/es-modules/modules/exporting.src.js +1 -1
  269. package/js/es-modules/modules/funnel.src.js +1 -1
  270. package/js/es-modules/modules/item-series.src.js +1 -1
  271. package/js/es-modules/modules/no-data-to-display.src.js +5 -5
  272. package/js/es-modules/modules/oldie.src.js +1 -1
  273. package/js/es-modules/modules/overlapping-datalabels.src.js +38 -22
  274. package/js/es-modules/modules/parallel-coordinates.src.js +3 -2
  275. package/js/es-modules/modules/sankey.src.js +1 -1
  276. package/js/es-modules/modules/series-label.src.js +2 -2
  277. package/js/es-modules/modules/solid-gauge.src.js +1 -1
  278. package/js/es-modules/modules/static-scale.src.js +67 -28
  279. package/js/es-modules/modules/streamgraph.src.js +1 -1
  280. package/js/es-modules/modules/tilemap.src.js +231 -134
  281. package/js/es-modules/modules/variwide.src.js +1 -1
  282. package/js/es-modules/modules/vector.src.js +92 -22
  283. package/js/es-modules/modules/windbarb.src.js +1 -1
  284. package/js/es-modules/modules/xrange.src.js +255 -68
  285. package/js/es-modules/parts/AreaSeries.js +77 -77
  286. package/js/es-modules/parts/AreaSplineSeries.js +64 -27
  287. package/js/es-modules/parts/Axis.js +160 -67
  288. package/js/es-modules/parts/BarSeries.js +68 -51
  289. package/js/es-modules/parts/CandlestickSeries.js +1 -1
  290. package/js/es-modules/parts/Chart.js +31 -55
  291. package/js/es-modules/parts/Color.js +29 -18
  292. package/js/es-modules/parts/ColumnSeries.js +231 -123
  293. package/js/es-modules/parts/DataGrouping.js +9 -6
  294. package/js/es-modules/parts/DataLabels.js +230 -182
  295. package/js/es-modules/parts/DateTimeAxis.js +26 -7
  296. package/js/es-modules/parts/Dynamics.js +5 -2
  297. package/js/es-modules/parts/FlagsSeries.js +1 -1
  298. package/js/es-modules/parts/Globals.js +1 -1
  299. package/js/es-modules/parts/Html.js +64 -12
  300. package/js/es-modules/parts/Interaction.js +178 -61
  301. package/js/es-modules/parts/Legend.js +7 -3
  302. package/js/es-modules/parts/LogarithmicAxis.js +35 -4
  303. package/js/es-modules/parts/MSPointer.js +1 -1
  304. package/js/es-modules/parts/Navigator.js +27 -5
  305. package/js/es-modules/parts/OHLCSeries.js +1 -1
  306. package/js/es-modules/parts/Options.js +13 -12
  307. package/js/es-modules/parts/OrdinalAxis.js +1 -1
  308. package/js/es-modules/parts/PieSeries.js +245 -132
  309. package/js/es-modules/parts/PlotBandSeries.experimental.js +1 -1
  310. package/js/es-modules/parts/PlotLineOrBand.js +7 -40
  311. package/js/es-modules/parts/Point.js +28 -4
  312. package/js/es-modules/parts/Pointer.js +8 -6
  313. package/js/es-modules/parts/RangeSelector.js +1 -1
  314. package/js/es-modules/parts/Responsive.js +82 -36
  315. package/js/es-modules/parts/ScatterSeries.js +56 -25
  316. package/js/es-modules/parts/ScrollablePlotArea.js +17 -7
  317. package/js/es-modules/parts/Scrollbar.js +9 -2
  318. package/js/es-modules/parts/Series.js +22 -9
  319. package/js/es-modules/parts/SplineSeries.js +51 -29
  320. package/js/es-modules/parts/Stacking.js +100 -6
  321. package/js/es-modules/parts/StockChart.js +9 -3
  322. package/js/es-modules/parts/SvgRenderer.js +15 -10
  323. package/js/es-modules/parts/Tick.js +150 -30
  324. package/js/es-modules/parts/Time.js +23 -5
  325. package/js/es-modules/parts/Tooltip.js +2 -2
  326. package/js/es-modules/parts/TouchPointer.js +1 -1
  327. package/js/es-modules/parts/Utilities.js +16 -1
  328. package/js/es-modules/parts-3d/Axis.js +1 -1
  329. package/js/es-modules/parts-3d/Chart.js +1 -1
  330. package/js/es-modules/parts-3d/Column.js +1 -1
  331. package/js/es-modules/parts-3d/Math.js +1 -1
  332. package/js/es-modules/parts-3d/Pie.js +1 -1
  333. package/js/es-modules/parts-3d/SVGRenderer.js +1 -1
  334. package/js/es-modules/parts-3d/Scatter.js +1 -1
  335. package/js/es-modules/parts-3d/Series.js +1 -1
  336. package/js/es-modules/parts-3d/VMLRenderer.js +1 -1
  337. package/js/es-modules/parts-gantt/ArrowSymbols.js +110 -0
  338. package/js/es-modules/parts-gantt/CurrentDateIndicator.js +92 -0
  339. package/js/es-modules/parts-gantt/GanttChart.js +111 -0
  340. package/js/es-modules/parts-gantt/GanttSeries.js +371 -0
  341. package/js/es-modules/parts-gantt/GridAxis.js +962 -0
  342. package/js/es-modules/parts-gantt/Pathfinder.js +1225 -0
  343. package/js/es-modules/parts-gantt/PathfinderAlgorithms.js +746 -0
  344. package/js/es-modules/parts-gantt/Tree.js +146 -0
  345. package/js/es-modules/parts-gantt/TreeGrid.js +891 -0
  346. package/js/es-modules/parts-map/ColorAxis.js +1 -1
  347. package/js/es-modules/parts-map/ColorSeriesMixin.js +1 -1
  348. package/js/es-modules/parts-map/GeoJSON.js +1 -1
  349. package/js/es-modules/parts-map/HeatmapSeries.js +122 -52
  350. package/js/es-modules/parts-map/Map.js +1 -1
  351. package/js/es-modules/parts-map/MapAxis.js +1 -1
  352. package/js/es-modules/parts-map/MapBubbleSeries.js +1 -1
  353. package/js/es-modules/parts-map/MapLineSeries.js +1 -1
  354. package/js/es-modules/parts-map/MapNavigation.js +1 -1
  355. package/js/es-modules/parts-map/MapPointSeries.js +1 -1
  356. package/js/es-modules/parts-map/MapPointer.js +1 -1
  357. package/js/es-modules/parts-map/MapSeries.js +2 -2
  358. package/js/es-modules/parts-more/AreaRangeSeries.js +80 -38
  359. package/js/es-modules/parts-more/AreaSplineRangeSeries.js +1 -1
  360. package/js/es-modules/parts-more/BoxPlotSeries.js +1 -1
  361. package/js/es-modules/parts-more/BubbleSeries.js +1 -1
  362. package/js/es-modules/parts-more/ColumnRangeSeries.js +1 -1
  363. package/js/es-modules/parts-more/ErrorBarSeries.js +1 -1
  364. package/js/es-modules/parts-more/GaugeSeries.js +1 -1
  365. package/js/es-modules/parts-more/Pane.js +2 -1
  366. package/js/es-modules/parts-more/Polar.js +1 -1
  367. package/js/es-modules/parts-more/PolygonSeries.js +1 -1
  368. package/js/es-modules/parts-more/RadialAxis.js +5 -4
  369. package/js/es-modules/parts-more/WaterfallSeries.js +1 -1
  370. package/js/es-modules/supplemental.docs.js +0 -1955
  371. package/js/es-modules/themes/dark-blue.js +1 -1
  372. package/js/es-modules/themes/dark-green.js +1 -1
  373. package/js/es-modules/themes/dark-unica.js +1 -1
  374. package/js/es-modules/themes/gray.js +1 -1
  375. package/js/es-modules/themes/grid-light.js +1 -1
  376. package/js/es-modules/themes/grid.js +1 -1
  377. package/js/es-modules/themes/sand-signika.js +1 -1
  378. package/js/es-modules/themes/skies.js +1 -1
  379. package/js/highcharts-3d.js +1 -1
  380. package/js/highcharts-3d.src.js +10 -10
  381. package/js/highcharts-gantt.js +480 -0
  382. package/js/highcharts-gantt.js.map +1 -0
  383. package/js/highcharts-gantt.src.js +47011 -0
  384. package/js/highcharts-more.js +62 -61
  385. package/js/highcharts-more.js.map +1 -1
  386. package/js/highcharts-more.src.js +97 -53
  387. package/js/highcharts.js +394 -390
  388. package/js/highcharts.js.map +1 -1
  389. package/js/highcharts.src.js +2083 -1070
  390. package/js/highmaps.js +420 -416
  391. package/js/highmaps.js.map +1 -1
  392. package/js/highmaps.src.js +1569 -798
  393. package/js/highstock.js +526 -520
  394. package/js/highstock.js.map +1 -1
  395. package/js/highstock.src.js +2311 -1225
  396. package/js/indicators/accumulation-distribution.js +1 -1
  397. package/js/indicators/accumulation-distribution.src.js +1 -1
  398. package/js/indicators/atr.js +1 -1
  399. package/js/indicators/atr.src.js +1 -1
  400. package/js/indicators/bollinger-bands.js +1 -1
  401. package/js/indicators/bollinger-bands.src.js +1 -1
  402. package/js/indicators/cci.js +1 -1
  403. package/js/indicators/cci.src.js +1 -1
  404. package/js/indicators/cmf.js +1 -1
  405. package/js/indicators/cmf.src.js +1 -1
  406. package/js/indicators/ema.js +1 -1
  407. package/js/indicators/ema.src.js +1 -1
  408. package/js/indicators/ichimoku-kinko-hyo.js +1 -1
  409. package/js/indicators/ichimoku-kinko-hyo.src.js +1 -1
  410. package/js/indicators/indicators.js +1 -1
  411. package/js/indicators/indicators.src.js +1 -1
  412. package/js/indicators/macd.js +1 -1
  413. package/js/indicators/macd.src.js +1 -1
  414. package/js/indicators/mfi.js +1 -1
  415. package/js/indicators/mfi.src.js +1 -1
  416. package/js/indicators/momentum.js +1 -1
  417. package/js/indicators/momentum.src.js +2 -2
  418. package/js/indicators/pivot-points.js +4 -4
  419. package/js/indicators/pivot-points.js.map +1 -1
  420. package/js/indicators/pivot-points.src.js +7 -2
  421. package/js/indicators/price-envelopes.js +1 -1
  422. package/js/indicators/price-envelopes.src.js +1 -1
  423. package/js/indicators/psar.js +1 -1
  424. package/js/indicators/psar.src.js +1 -1
  425. package/js/indicators/roc.js +1 -1
  426. package/js/indicators/roc.src.js +1 -1
  427. package/js/indicators/rsi.js +1 -1
  428. package/js/indicators/rsi.src.js +1 -1
  429. package/js/indicators/stochastic.js +1 -1
  430. package/js/indicators/stochastic.src.js +1 -1
  431. package/js/indicators/volume-by-price.js +1 -1
  432. package/js/indicators/volume-by-price.src.js +1 -1
  433. package/js/indicators/vwap.js +1 -1
  434. package/js/indicators/vwap.src.js +1 -1
  435. package/js/indicators/wma.js +1 -1
  436. package/js/indicators/wma.src.js +1 -1
  437. package/js/indicators/zigzag.js +1 -1
  438. package/js/indicators/zigzag.src.js +1 -1
  439. package/js/modules/accessibility.js +1 -1
  440. package/js/modules/accessibility.src.js +1 -1
  441. package/js/modules/annotations.js +2 -2
  442. package/js/modules/annotations.src.js +2 -2
  443. package/js/modules/arrow-symbols.js +13 -0
  444. package/js/modules/arrow-symbols.js.map +1 -0
  445. package/js/modules/arrow-symbols.src.js +138 -0
  446. package/js/modules/boost-canvas.js +1 -1
  447. package/js/modules/boost-canvas.src.js +1 -1
  448. package/js/modules/boost.js +43 -43
  449. package/js/modules/boost.js.map +1 -1
  450. package/js/modules/boost.src.js +23 -15
  451. package/js/modules/broken-axis.js +11 -10
  452. package/js/modules/broken-axis.js.map +1 -1
  453. package/js/modules/broken-axis.src.js +171 -136
  454. package/js/modules/bullet.js +1 -1
  455. package/js/modules/bullet.src.js +1 -1
  456. package/js/modules/current-date-indicator.js +13 -0
  457. package/js/modules/current-date-indicator.js.map +1 -0
  458. package/js/modules/current-date-indicator.src.js +120 -0
  459. package/js/modules/data.js +2 -2
  460. package/js/modules/data.src.js +4 -4
  461. package/js/modules/drag-panes.js +1 -1
  462. package/js/modules/drag-panes.src.js +1 -1
  463. package/js/modules/draggable-points.js +38 -0
  464. package/js/modules/draggable-points.js.map +1 -0
  465. package/js/modules/draggable-points.src.js +2281 -0
  466. package/js/modules/drilldown.js +1 -1
  467. package/js/modules/drilldown.js.map +1 -1
  468. package/js/modules/drilldown.src.js +2 -1
  469. package/js/modules/export-data.js +2 -2
  470. package/js/modules/export-data.src.js +3 -3
  471. package/js/modules/exporting.js +2 -2
  472. package/js/modules/exporting.src.js +3 -3
  473. package/js/modules/funnel.js +2 -2
  474. package/js/modules/funnel.src.js +3 -3
  475. package/js/modules/gantt.js +80 -18
  476. package/js/modules/gantt.js.map +1 -1
  477. package/js/modules/gantt.src.js +5490 -372
  478. package/js/modules/grid-axis.js +15 -11
  479. package/js/modules/grid-axis.js.map +1 -1
  480. package/js/modules/grid-axis.src.js +731 -293
  481. package/js/modules/heatmap.js +2 -2
  482. package/js/modules/heatmap.js.map +1 -1
  483. package/js/modules/heatmap.src.js +126 -56
  484. package/js/modules/histogram-bellcurve.js +1 -1
  485. package/js/modules/histogram-bellcurve.src.js +1 -1
  486. package/js/modules/item-series.js +2 -2
  487. package/js/modules/item-series.src.js +3 -3
  488. package/js/modules/map.js +2 -2
  489. package/js/modules/map.js.map +1 -1
  490. package/js/modules/map.src.js +137 -67
  491. package/js/modules/no-data-to-display.js +1 -1
  492. package/js/modules/no-data-to-display.src.js +6 -6
  493. package/js/modules/offline-exporting.js +2 -2
  494. package/js/modules/offline-exporting.src.js +2 -2
  495. package/js/modules/oldie.js +2 -2
  496. package/js/modules/oldie.src.js +3 -3
  497. package/js/modules/overlapping-datalabels.js +2 -2
  498. package/js/modules/overlapping-datalabels.src.js +2 -2
  499. package/js/modules/parallel-coordinates.js +9 -9
  500. package/js/modules/parallel-coordinates.js.map +1 -1
  501. package/js/modules/parallel-coordinates.src.js +4 -3
  502. package/js/modules/pareto.js +1 -1
  503. package/js/modules/pareto.src.js +1 -1
  504. package/js/modules/pathfinder.js +34 -0
  505. package/js/modules/pathfinder.js.map +1 -0
  506. package/js/modules/pathfinder.src.js +2106 -0
  507. package/js/modules/pattern-fill.js +1 -1
  508. package/js/modules/pattern-fill.src.js +1 -1
  509. package/js/modules/sankey.js +2 -2
  510. package/js/modules/sankey.src.js +3 -3
  511. package/js/modules/series-label.js +2 -2
  512. package/js/modules/series-label.src.js +4 -4
  513. package/js/modules/solid-gauge.js +2 -2
  514. package/js/modules/solid-gauge.src.js +3 -3
  515. package/js/modules/static-scale.js +3 -3
  516. package/js/modules/static-scale.js.map +1 -1
  517. package/js/modules/static-scale.src.js +65 -26
  518. package/js/modules/stock.js +135 -134
  519. package/js/modules/stock.js.map +1 -1
  520. package/js/modules/stock.src.js +230 -157
  521. package/js/modules/streamgraph.js +2 -2
  522. package/js/modules/streamgraph.src.js +3 -3
  523. package/js/modules/sunburst.js +1 -1
  524. package/js/modules/sunburst.src.js +1 -1
  525. package/js/modules/tilemap.js +1 -1
  526. package/js/modules/tilemap.js.map +1 -1
  527. package/js/modules/tilemap.src.js +355 -188
  528. package/js/modules/treegrid.js +51 -0
  529. package/js/modules/treegrid.js.map +1 -0
  530. package/js/modules/treegrid.src.js +2759 -0
  531. package/js/modules/treemap.js +1 -1
  532. package/js/modules/treemap.src.js +1 -1
  533. package/js/modules/variable-pie.js +1 -1
  534. package/js/modules/variable-pie.src.js +1 -1
  535. package/js/modules/variwide.js +2 -2
  536. package/js/modules/variwide.src.js +3 -3
  537. package/js/modules/vector.js +2 -2
  538. package/js/modules/vector.js.map +1 -1
  539. package/js/modules/vector.src.js +94 -24
  540. package/js/modules/windbarb.js +2 -2
  541. package/js/modules/windbarb.src.js +4 -4
  542. package/js/modules/wordcloud.js +1 -1
  543. package/js/modules/wordcloud.src.js +1 -1
  544. package/js/modules/xrange.js +11 -10
  545. package/js/modules/xrange.js.map +1 -1
  546. package/js/modules/xrange.src.js +257 -70
  547. package/js/themes/avocado.js +1 -1
  548. package/js/themes/avocado.src.js +1 -1
  549. package/js/themes/dark-blue.js +2 -2
  550. package/js/themes/dark-blue.src.js +3 -3
  551. package/js/themes/dark-green.js +2 -2
  552. package/js/themes/dark-green.src.js +3 -3
  553. package/js/themes/dark-unica.js +2 -2
  554. package/js/themes/dark-unica.src.js +3 -3
  555. package/js/themes/gray.js +2 -2
  556. package/js/themes/gray.src.js +3 -3
  557. package/js/themes/grid-light.js +2 -2
  558. package/js/themes/grid-light.src.js +3 -3
  559. package/js/themes/grid.js +2 -2
  560. package/js/themes/grid.src.js +3 -3
  561. package/js/themes/sand-signika.js +2 -2
  562. package/js/themes/sand-signika.src.js +3 -3
  563. package/js/themes/skies.js +2 -2
  564. package/js/themes/skies.src.js +3 -3
  565. package/js/themes/sunset.js +1 -1
  566. package/js/themes/sunset.src.js +1 -1
  567. package/modules/accessibility.js +1 -1
  568. package/modules/accessibility.src.js +1 -1
  569. package/modules/annotations.js +2 -2
  570. package/modules/annotations.src.js +2 -2
  571. package/modules/arrow-symbols.js +13 -0
  572. package/modules/arrow-symbols.js.map +1 -0
  573. package/modules/arrow-symbols.src.js +138 -0
  574. package/modules/boost-canvas.js +1 -1
  575. package/modules/boost-canvas.src.js +1 -1
  576. package/modules/boost.js +36 -36
  577. package/modules/boost.js.map +1 -1
  578. package/modules/boost.src.js +23 -15
  579. package/modules/broken-axis.js +11 -10
  580. package/modules/broken-axis.js.map +1 -1
  581. package/modules/broken-axis.src.js +171 -136
  582. package/modules/bullet.js +1 -1
  583. package/modules/bullet.src.js +1 -1
  584. package/modules/current-date-indicator.js +13 -0
  585. package/modules/current-date-indicator.js.map +1 -0
  586. package/modules/current-date-indicator.src.js +120 -0
  587. package/modules/data.js +2 -2
  588. package/modules/data.src.js +4 -4
  589. package/modules/drag-panes.js +1 -1
  590. package/modules/drag-panes.src.js +1 -1
  591. package/modules/draggable-points.js +38 -0
  592. package/modules/draggable-points.js.map +1 -0
  593. package/modules/draggable-points.src.js +2281 -0
  594. package/modules/drilldown.js +1 -1
  595. package/modules/drilldown.js.map +1 -1
  596. package/modules/drilldown.src.js +2 -1
  597. package/modules/export-data.js +2 -2
  598. package/modules/export-data.src.js +3 -3
  599. package/modules/exporting.js +2 -2
  600. package/modules/exporting.src.js +3 -3
  601. package/modules/funnel.js +2 -2
  602. package/modules/funnel.src.js +3 -3
  603. package/modules/gantt.js +83 -19
  604. package/modules/gantt.js.map +1 -1
  605. package/modules/gantt.src.js +5553 -379
  606. package/modules/grid-axis.js +16 -11
  607. package/modules/grid-axis.js.map +1 -1
  608. package/modules/grid-axis.src.js +732 -293
  609. package/modules/heatmap.js +2 -2
  610. package/modules/heatmap.js.map +1 -1
  611. package/modules/heatmap.src.js +128 -57
  612. package/modules/histogram-bellcurve.js +1 -1
  613. package/modules/histogram-bellcurve.src.js +1 -1
  614. package/modules/item-series.js +2 -2
  615. package/modules/item-series.src.js +3 -3
  616. package/modules/map.js +2 -2
  617. package/modules/map.js.map +1 -1
  618. package/modules/map.src.js +139 -68
  619. package/modules/no-data-to-display.js +1 -1
  620. package/modules/no-data-to-display.src.js +6 -6
  621. package/modules/offline-exporting.js +2 -2
  622. package/modules/offline-exporting.src.js +2 -2
  623. package/modules/oldie.js +2 -2
  624. package/modules/oldie.src.js +3 -3
  625. package/modules/overlapping-datalabels.js +2 -2
  626. package/modules/overlapping-datalabels.src.js +2 -2
  627. package/modules/parallel-coordinates.js +8 -8
  628. package/modules/parallel-coordinates.js.map +1 -1
  629. package/modules/parallel-coordinates.src.js +4 -3
  630. package/modules/pareto.js +1 -1
  631. package/modules/pareto.src.js +1 -1
  632. package/modules/pathfinder.js +35 -0
  633. package/modules/pathfinder.js.map +1 -0
  634. package/modules/pathfinder.src.js +2128 -0
  635. package/modules/pattern-fill.js +1 -1
  636. package/modules/pattern-fill.src.js +1 -1
  637. package/modules/sankey.js +2 -2
  638. package/modules/sankey.src.js +3 -3
  639. package/modules/series-label.js +2 -2
  640. package/modules/series-label.src.js +4 -4
  641. package/modules/solid-gauge.js +2 -2
  642. package/modules/solid-gauge.src.js +3 -3
  643. package/modules/static-scale.js +3 -3
  644. package/modules/static-scale.js.map +1 -1
  645. package/modules/static-scale.src.js +65 -26
  646. package/modules/stock.js +142 -142
  647. package/modules/stock.js.map +1 -1
  648. package/modules/stock.src.js +230 -157
  649. package/modules/streamgraph.js +2 -2
  650. package/modules/streamgraph.src.js +3 -3
  651. package/modules/sunburst.js +1 -1
  652. package/modules/sunburst.src.js +1 -1
  653. package/modules/tilemap.js +1 -1
  654. package/modules/tilemap.js.map +1 -1
  655. package/modules/tilemap.src.js +357 -189
  656. package/modules/treegrid.js +52 -0
  657. package/modules/treegrid.js.map +1 -0
  658. package/modules/treegrid.src.js +2797 -0
  659. package/modules/treemap.js +1 -1
  660. package/modules/treemap.src.js +1 -1
  661. package/modules/variable-pie.js +1 -1
  662. package/modules/variable-pie.src.js +1 -1
  663. package/modules/variwide.js +2 -2
  664. package/modules/variwide.src.js +3 -3
  665. package/modules/vector.js +2 -2
  666. package/modules/vector.js.map +1 -1
  667. package/modules/vector.src.js +94 -24
  668. package/modules/windbarb.js +2 -2
  669. package/modules/windbarb.src.js +4 -4
  670. package/modules/wordcloud.js +1 -1
  671. package/modules/wordcloud.src.js +1 -1
  672. package/modules/xrange.js +12 -11
  673. package/modules/xrange.js.map +1 -1
  674. package/modules/xrange.src.js +259 -79
  675. package/package.json +1 -1
  676. package/themes/avocado.js +1 -1
  677. package/themes/avocado.src.js +1 -1
  678. package/themes/dark-blue.js +2 -2
  679. package/themes/dark-blue.src.js +3 -3
  680. package/themes/dark-green.js +2 -2
  681. package/themes/dark-green.src.js +3 -3
  682. package/themes/dark-unica.js +2 -2
  683. package/themes/dark-unica.src.js +3 -3
  684. package/themes/gray.js +2 -2
  685. package/themes/gray.src.js +3 -3
  686. package/themes/grid-light.js +2 -2
  687. package/themes/grid-light.src.js +3 -3
  688. package/themes/grid.js +2 -2
  689. package/themes/grid.src.js +3 -3
  690. package/themes/sand-signika.js +2 -2
  691. package/themes/sand-signika.src.js +3 -3
  692. package/themes/skies.js +2 -2
  693. package/themes/skies.src.js +3 -3
  694. package/themes/sunset.js +1 -1
  695. package/themes/sunset.src.js +1 -1
@@ -0,0 +1,2759 @@
1
+ /**
2
+ * @license Highcharts JS v6.2.0 (2018-10-17)
3
+ * Tree Grid
4
+ *
5
+ * (c) 2016 Jon Arild Nygard
6
+ *
7
+ * --- WORK IN PROGRESS ---
8
+ *
9
+ * License: www.highcharts.com/license
10
+ */
11
+ 'use strict';
12
+ (function (factory) {
13
+ if (typeof module === 'object' && module.exports) {
14
+ module.exports = factory;
15
+ } else if (typeof define === 'function' && define.amd) {
16
+ define(function () {
17
+ return factory;
18
+ });
19
+ } else {
20
+ factory(Highcharts);
21
+ }
22
+ }(function (Highcharts) {
23
+ (function (H) {
24
+ /**
25
+ * (c) 2016 Highsoft AS
26
+ * Authors: Lars A. V. Cabrera
27
+ *
28
+ * License: www.highcharts.com/license
29
+ */
30
+
31
+ var argsToArray = function (args) {
32
+ return Array.prototype.slice.call(args, 1);
33
+ },
34
+ dateFormat = H.dateFormat,
35
+ defined = H.defined,
36
+ each = H.each,
37
+ isArray = H.isArray,
38
+ isNumber = H.isNumber,
39
+ isObject = function (x) {
40
+ // Always use strict mode
41
+ return H.isObject(x, true);
42
+ },
43
+ merge = H.merge,
44
+ pick = H.pick,
45
+ wrap = H.wrap,
46
+ Axis = H.Axis,
47
+ Tick = H.Tick;
48
+
49
+ /**
50
+ * Set grid options for the axis labels. Requires Highcharts Gantt.
51
+ *
52
+ * @type {object}
53
+ * @since 6.2.0
54
+ * @product gantt
55
+ * @apioption xAxis.grid
56
+ */
57
+
58
+ /**
59
+ * Enable grid on the axis labels. Defaults to true for Gantt charts.
60
+ *
61
+ * @type {boolean}
62
+ * @since 6.2.0
63
+ * @default true
64
+ * @product gantt
65
+ * @apioption xAxis.grid.enabled
66
+ */
67
+
68
+ /**
69
+ * Set specific options for each column (or row for horizontal axes) in the
70
+ * grid. Each extra column/row is its own axis, and the axis options can be set
71
+ * here.
72
+ *
73
+ * @type {Array<object>}
74
+ * @sample gantt/demo/left-axis-table
75
+ * Left axis as a table
76
+ * @apioption xAxis.grid.columns
77
+ */
78
+
79
+ /**
80
+ * Set border color for the label grid lines.
81
+ *
82
+ * @type {Highcharts.ColorString}
83
+ * @apioption xAxis.grid.borderColor
84
+ */
85
+
86
+ /**
87
+ * Set border width of the label grid lines.
88
+ *
89
+ * @type {number}
90
+ * @default 1
91
+ * @apioption xAxis.grid.borderWidth
92
+ */
93
+
94
+ /**
95
+ * Set cell height for grid axis labels. By default this is calculated from font
96
+ * size.
97
+ *
98
+ * @type {number}
99
+ * @default null
100
+ * @apioption xAxis.grid.cellHeight
101
+ */
102
+
103
+
104
+ // Enum for which side the axis is on.
105
+ // Maps to axis.side
106
+ var axisSide = {
107
+ top: 0,
108
+ right: 1,
109
+ bottom: 2,
110
+ left: 3,
111
+ 0: 'top',
112
+ 1: 'right',
113
+ 2: 'bottom',
114
+ 3: 'left'
115
+ };
116
+
117
+ /**
118
+ * Checks if an axis is a navigator axis.
119
+ * @return {Boolean} true if axis is found in axis.chart.navigator
120
+ */
121
+ Axis.prototype.isNavigatorAxis = function () {
122
+ return /highcharts-navigator-[xy]axis/.test(this.options.className);
123
+ };
124
+
125
+ /**
126
+ * Checks if an axis is the outer axis in its dimension. Since
127
+ * axes are placed outwards in order, the axis with the highest
128
+ * index is the outermost axis.
129
+ *
130
+ * Example: If there are multiple x-axes at the top of the chart,
131
+ * this function returns true if the axis supplied is the last
132
+ * of the x-axes.
133
+ *
134
+ * @return true if the axis is the outermost axis in its dimension;
135
+ * false if not
136
+ */
137
+ Axis.prototype.isOuterAxis = function () {
138
+ var axis = this,
139
+ chart = axis.chart,
140
+ thisIndex = -1,
141
+ isOuter = true;
142
+
143
+ each(chart.axes, function (otherAxis, index) {
144
+ if (otherAxis.side === axis.side && !otherAxis.isNavigatorAxis()) {
145
+ if (otherAxis === axis) {
146
+ // Get the index of the axis in question
147
+ thisIndex = index;
148
+
149
+ // Check thisIndex >= 0 in case thisIndex has
150
+ // not been found yet
151
+ } else if (thisIndex >= 0 && index > thisIndex) {
152
+ // There was an axis on the same side with a
153
+ // higher index.
154
+ isOuter = false;
155
+ }
156
+ }
157
+ });
158
+ // There were either no other axes on the same side,
159
+ // or the other axes were not farther from the chart
160
+ return isOuter;
161
+ };
162
+
163
+ /**
164
+ * Get the largest label width and height.
165
+ * @param {object} ticks All the ticks on one axis.
166
+ * @param {array} tickPositions All the tick positions on one axis.
167
+ * @return {object} object containing the properties height and width.
168
+ */
169
+ Axis.prototype.getMaxLabelDimensions = function (ticks, tickPositions) {
170
+ var dimensions = {
171
+ width: 0,
172
+ height: 0
173
+ };
174
+
175
+ each(tickPositions, function (pos) {
176
+ var tick = ticks[pos],
177
+ tickHeight = 0,
178
+ tickWidth = 0,
179
+ label;
180
+
181
+ if (isObject(tick)) {
182
+ label = isObject(tick.label) ? tick.label : {};
183
+
184
+ // Find width and height of tick
185
+ tickHeight = label.getBBox ? label.getBBox().height : 0;
186
+ tickWidth = isNumber(label.textPxLength) ? label.textPxLength : 0;
187
+
188
+ // Update the result if width and/or height are larger
189
+ dimensions.height = Math.max(tickHeight, dimensions.height);
190
+ dimensions.width = Math.max(tickWidth, dimensions.width);
191
+ }
192
+ });
193
+
194
+ return dimensions;
195
+ };
196
+
197
+ /**
198
+ * Add custom date formats
199
+ */
200
+ H.dateFormats = {
201
+ // Week number
202
+ W: function (timestamp) {
203
+ var d = new Date(timestamp),
204
+ yearStart,
205
+ weekNo;
206
+ d.setHours(0, 0, 0, 0);
207
+ d.setDate(d.getDate() - (d.getDay() || 7));
208
+ yearStart = new Date(d.getFullYear(), 0, 1);
209
+ weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
210
+ return weekNo;
211
+ },
212
+ // First letter of the day of the week, e.g. 'M' for 'Monday'.
213
+ E: function (timestamp) {
214
+ return dateFormat('%a', timestamp, true).charAt(0);
215
+ }
216
+ };
217
+
218
+ /**
219
+ * If chart is stockChart, always return 'left' to avoid labels being placed
220
+ * inside chart. Stock charts place yAxis labels inside by default.
221
+ * @param {function} proceed - the original function
222
+ * @return {string} 'left' if stockChart, or auto calculated alignment
223
+ */
224
+ wrap(Axis.prototype, 'autoLabelAlign', function (proceed) {
225
+ var axis = this,
226
+ retVal;
227
+ if (axis.chart.isStock) {
228
+ retVal = 'left';
229
+ } else {
230
+ retVal = proceed.apply(axis, argsToArray(arguments));
231
+ }
232
+ return retVal;
233
+ });
234
+
235
+ /**
236
+ * Center tick labels in cells.
237
+ *
238
+ * @param {function} proceed - the original function
239
+ *
240
+ * @return {object} object - an object containing x and y positions
241
+ * for the tick
242
+ */
243
+ wrap(Tick.prototype, 'getLabelPosition', function (proceed, x, y, label, horiz,
244
+ labelOpts, tickmarkOffset, index) {
245
+ var tick = this,
246
+ axis = tick.axis,
247
+ reversed = axis.reversed,
248
+ chart = axis.chart,
249
+ options = axis.options,
250
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {},
251
+ align = labelOpts.align,
252
+ // verticalAlign is currently not supported for axis.labels.
253
+ verticalAlign = 'middle', // labelOpts.verticalAlign,
254
+ side = axisSide[axis.side],
255
+ tickPositions = axis.tickPositions,
256
+ tickPos = tick.pos - tickmarkOffset,
257
+ nextTickPos = (
258
+ isNumber(tickPositions[index + 1]) ?
259
+ tickPositions[index + 1] - tickmarkOffset :
260
+ axis.max + tickmarkOffset
261
+ ),
262
+ tickSize = axis.tickSize('tick', true),
263
+ tickWidth = isArray(tickSize) ? tickSize[0] : 0,
264
+ crispCorr = tickSize && tickSize[1] / 2,
265
+ labelHeight,
266
+ lblMetrics,
267
+ lines,
268
+ result,
269
+ bottom,
270
+ top,
271
+ left,
272
+ right;
273
+
274
+ // Only center tick labels in grid axes
275
+ if (gridOptions.enabled === true) {
276
+ /**
277
+ * Calculate top and bottom positions of the cell.
278
+ */
279
+ if (side === 'top') {
280
+ bottom = axis.top + axis.offset;
281
+ top = bottom - tickWidth;
282
+ } else if (side === 'bottom') {
283
+ top = chart.chartHeight - axis.bottom + axis.offset;
284
+ bottom = top + tickWidth;
285
+ } else {
286
+ bottom = axis.top + axis.len - axis.translate(
287
+ reversed ? nextTickPos : tickPos
288
+ );
289
+ top = axis.top + axis.len - axis.translate(
290
+ reversed ? tickPos : nextTickPos
291
+ );
292
+ }
293
+
294
+ /**
295
+ * Calculate left and right positions of the cell.
296
+ */
297
+ if (side === 'right') {
298
+ left = chart.chartWidth - axis.right + axis.offset;
299
+ right = left + tickWidth;
300
+ } else if (side === 'left') {
301
+ right = axis.left + axis.offset;
302
+ left = right - tickWidth;
303
+ } else {
304
+ left = Math.round(axis.left + axis.translate(
305
+ reversed ? nextTickPos : tickPos
306
+ )) - crispCorr;
307
+ right = Math.round(axis.left + axis.translate(
308
+ reversed ? tickPos : nextTickPos
309
+ )) - crispCorr;
310
+ }
311
+
312
+ tick.slotWidth = right - left;
313
+
314
+ /**
315
+ * Calculate the positioning of the label based on alignment.
316
+ */
317
+ result = {
318
+ x: (
319
+ align === 'left' ?
320
+ left :
321
+ align === 'right' ?
322
+ right :
323
+ left + ((right - left) / 2) // default to center
324
+ ),
325
+ y: (
326
+ verticalAlign === 'top' ?
327
+ top :
328
+ verticalAlign === 'bottom' ?
329
+ bottom :
330
+ top + ((bottom - top) / 2) // default to middle
331
+ )
332
+ };
333
+
334
+ lblMetrics = chart.renderer.fontMetrics(
335
+ labelOpts.style.fontSize,
336
+ label.element
337
+ );
338
+ labelHeight = label.getBBox().height;
339
+
340
+ // Adjustment to y position to align the label correctly.
341
+ // Would be better to have a setter or similar for this.
342
+ if (!labelOpts.useHTML) {
343
+ lines = Math.round(labelHeight / lblMetrics.h);
344
+ result.y += (
345
+ // Center the label
346
+ // TODO: why does this actually center the label?
347
+ ((lblMetrics.b - (lblMetrics.h - lblMetrics.f)) / 2) +
348
+ // Adjust for height of additional lines.
349
+ -(((lines - 1) * lblMetrics.h) / 2)
350
+ );
351
+ } else {
352
+ result.y += (
353
+ // Readjust yCorr in htmlUpdateTransform
354
+ lblMetrics.b +
355
+ // Adjust for height of html label
356
+ -(labelHeight / 2)
357
+ );
358
+ }
359
+
360
+ result.x += (axis.horiz && labelOpts.x || 0);
361
+ } else {
362
+ result = proceed.apply(tick, argsToArray(arguments));
363
+ }
364
+ return result;
365
+ });
366
+
367
+ /**
368
+ * Draw vertical axis ticks extra long to create cell floors and roofs.
369
+ * Overrides the tickLength for vertical axes.
370
+ *
371
+ * @param {function} proceed - the original function
372
+ * @returns {array} retVal -
373
+ */
374
+ wrap(Axis.prototype, 'tickSize', function (proceed) {
375
+ var axis = this,
376
+ dimensions = axis.maxLabelDimensions,
377
+ options = axis.options,
378
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {},
379
+ retVal = proceed.apply(axis, argsToArray(arguments)),
380
+ labelPadding,
381
+ distance;
382
+
383
+ if (gridOptions.enabled === true) {
384
+ labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
385
+ distance = labelPadding +
386
+ (axis.horiz ? dimensions.height : dimensions.width);
387
+
388
+ if (isArray(retVal)) {
389
+ retVal[0] = distance;
390
+ } else {
391
+ retVal = [distance];
392
+ }
393
+ }
394
+ return retVal;
395
+ });
396
+
397
+ wrap(Axis.prototype, 'getTitlePosition', function (proceed) {
398
+ var axis = this,
399
+ options = axis.options,
400
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {};
401
+
402
+ if (gridOptions.enabled === true) {
403
+ // compute anchor points for each of the title align options
404
+ var title = axis.axisTitle,
405
+ titleWidth = title && title.getBBox().width,
406
+ horiz = axis.horiz,
407
+ axisLeft = axis.left,
408
+ axisTop = axis.top,
409
+ axisWidth = axis.width,
410
+ axisHeight = axis.height,
411
+ axisTitleOptions = options.title,
412
+ opposite = axis.opposite,
413
+ offset = axis.offset,
414
+ tickSize = axis.tickSize() || [0],
415
+ xOption = axisTitleOptions.x || 0,
416
+ yOption = axisTitleOptions.y || 0,
417
+ titleMargin = pick(axisTitleOptions.margin, horiz ? 5 : 10),
418
+ titleFontSize = axis.chart.renderer.fontMetrics(
419
+ axisTitleOptions.style && axisTitleOptions.style.fontSize,
420
+ title
421
+ ).f,
422
+ // TODO account for alignment
423
+ // the position in the perpendicular direction of the axis
424
+ offAxis = (horiz ? axisTop + axisHeight : axisLeft) +
425
+ (horiz ? 1 : -1) * // horizontal axis reverses the margin
426
+ (opposite ? -1 : 1) * // so does opposite axes
427
+ (tickSize[0] / 2) +
428
+ (axis.side === axisSide.bottom ? titleFontSize : 0);
429
+
430
+ return {
431
+ x: horiz ?
432
+ axisLeft - titleWidth / 2 - titleMargin + xOption :
433
+ offAxis + (opposite ? axisWidth : 0) + offset + xOption,
434
+ y: horiz ?
435
+ (
436
+ offAxis -
437
+ (opposite ? axisHeight : 0) +
438
+ (opposite ? titleFontSize : -titleFontSize) / 2 +
439
+ offset +
440
+ yOption
441
+ ) :
442
+ axisTop - titleMargin + yOption
443
+ };
444
+ }
445
+
446
+ return proceed.apply(this, argsToArray(arguments));
447
+ });
448
+
449
+ /**
450
+ * Avoid altering tickInterval when reserving space.
451
+ */
452
+ wrap(Axis.prototype, 'unsquish', function (proceed) {
453
+ var axis = this,
454
+ options = axis.options,
455
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {};
456
+
457
+ if (gridOptions.enabled === true && this.categories) {
458
+ return this.tickInterval;
459
+ }
460
+
461
+ return proceed.apply(this, argsToArray(arguments));
462
+ });
463
+
464
+ /**
465
+ * Creates a left and right wall on horizontal axes:
466
+ * - Places leftmost tick at the start of the axis, to create a left wall
467
+ * - Ensures that the rightmost tick is at the end of the axis, to create a
468
+ * right wall.
469
+ *
470
+ * @param {function} proceed - the original function
471
+ * @param {object} options - the pure axis options as input by the user
472
+ */
473
+ H.addEvent(Axis, 'afterSetOptions', function (e) {
474
+ var options = this.options,
475
+ userOptions = e.userOptions,
476
+ gridAxisOptions,
477
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {};
478
+
479
+ if (gridOptions.enabled === true) {
480
+
481
+ // Merge the user options into default grid axis options so that when a
482
+ // user option is set, it takes presedence.
483
+ gridAxisOptions = merge(true, {
484
+
485
+ className: 'highcharts-grid-axis ' + (userOptions.className || ''),
486
+
487
+ dateTimeLabelFormats: {
488
+ hour: {
489
+ list: ['%H:%M', '%H']
490
+ },
491
+ day: {
492
+ list: ['%A, %e. %B', '%a, %e. %b', '%E']
493
+ },
494
+ week: {
495
+ list: ['Week %W', 'W%W']
496
+ },
497
+ month: {
498
+ list: ['%B', '%b', '%o']
499
+ }
500
+ },
501
+
502
+ grid: {
503
+ borderWidth: 1
504
+ },
505
+
506
+ labels: {
507
+ padding: 2,
508
+ style: {
509
+ fontSize: '13px'
510
+ }
511
+ },
512
+
513
+ title: {
514
+ text: null,
515
+ reserveSpace: false,
516
+ rotation: 0
517
+ },
518
+
519
+ // In a grid axis, only allow one unit of certain types, for example
520
+ // we shouln't have one grid cell spanning two days.
521
+ units: [[
522
+ 'millisecond', // unit name
523
+ [1, 10, 100]
524
+ ], [
525
+ 'second',
526
+ [1, 10]
527
+ ], [
528
+ 'minute',
529
+ [1, 5, 15]
530
+ ], [
531
+ 'hour',
532
+ [1, 6]
533
+ ], [
534
+ 'day',
535
+ [1]
536
+ ], [
537
+ 'week',
538
+ [1]
539
+ ], [
540
+ 'month',
541
+ [1]
542
+ ], [
543
+ 'year',
544
+ null
545
+ ]]
546
+ }, userOptions);
547
+
548
+ // X-axis specific options
549
+ if (this.coll === 'xAxis') {
550
+
551
+ // For linked axes, tickPixelInterval is used only if the
552
+ // tickPositioner below doesn't run or returns undefined (like
553
+ // multiple years)
554
+ if (
555
+ defined(userOptions.linkedTo) &&
556
+ !defined(userOptions.tickPixelInterval)
557
+ ) {
558
+ gridAxisOptions.tickPixelInterval = 350;
559
+ }
560
+
561
+ // For the secondary grid axis, use the primary axis' tick intervals
562
+ // and return ticks one level higher.
563
+ if (
564
+ // Check for tick pixel interval in options
565
+ !defined(userOptions.tickPixelInterval) &&
566
+
567
+ // Only for linked axes
568
+ defined(userOptions.linkedTo) &&
569
+
570
+ !defined(userOptions.tickPositioner) &&
571
+ !defined(userOptions.tickInterval)
572
+ ) {
573
+ gridAxisOptions.tickPositioner = function (min, max) {
574
+
575
+ var parentInfo = (
576
+ this.linkedParent &&
577
+ this.linkedParent.tickPositions &&
578
+ this.linkedParent.tickPositions.info
579
+ );
580
+
581
+ if (parentInfo) {
582
+
583
+ var unitIdx,
584
+ count,
585
+ unitName,
586
+ i,
587
+ units = gridAxisOptions.units,
588
+ unitRange;
589
+
590
+ for (i = 0; i < units.length; i++) {
591
+ if (units[i][0] === parentInfo.unitName) {
592
+ unitIdx = i;
593
+ break;
594
+ }
595
+ }
596
+
597
+ // Spanning multiple years, go default
598
+ if (!units[unitIdx][1]) {
599
+ return;
600
+ }
601
+
602
+ // Get the first allowed count on the next unit.
603
+ if (units[unitIdx + 1]) {
604
+ unitName = units[unitIdx + 1][0];
605
+ count = (units[unitIdx + 1][1] || [1])[0];
606
+ }
607
+
608
+ unitRange = H.timeUnits[unitName];
609
+ this.tickInterval = unitRange * count;
610
+ return this.getTimeTicks(
611
+ {
612
+ unitRange: unitRange,
613
+ count: count,
614
+ unitName: unitName
615
+ },
616
+ min,
617
+ max,
618
+ this.options.startOfWeek
619
+ );
620
+ }
621
+ };
622
+ }
623
+
624
+ }
625
+
626
+ // Now merge the combined options into the axis options
627
+ merge(true, this.options, gridAxisOptions);
628
+
629
+ if (this.horiz) {
630
+ /** _________________________
631
+ * Make this: ___|_____|_____|_____|__|
632
+ * ^ ^
633
+ * _________________________
634
+ * Into this: |_____|_____|_____|_____|
635
+ * ^ ^
636
+ */
637
+ options.minPadding = pick(userOptions.minPadding, 0);
638
+ options.maxPadding = pick(userOptions.maxPadding, 0);
639
+ }
640
+
641
+ // If borderWidth is set, then use its value for tick and line width.
642
+ if (isNumber(options.grid.borderWidth)) {
643
+ options.tickWidth = options.lineWidth = gridOptions.borderWidth;
644
+ }
645
+
646
+ }
647
+ });
648
+
649
+ /**
650
+ * Ensures a left wall on horizontal axes with series inheriting from column.
651
+ * ColumnSeries normally sets pointRange to null, resulting in Axis to select
652
+ * other values for point ranges. This enforces the above Axis.setOptions()
653
+ * override.
654
+ * _________________________
655
+ * Enforce this: ___|_____|_____|_____|__|
656
+ * ^
657
+ * _________________________
658
+ * To be this: |_____|_____|_____|_____|
659
+ * ^
660
+ *
661
+ * @param {function} proceed - the original function
662
+ * @param {object} options - the pure axis options as input by the user
663
+ */
664
+ wrap(Axis.prototype, 'setAxisTranslation', function (proceed) {
665
+ var axis = this,
666
+ options = axis.options,
667
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {},
668
+ tickInfo = this.tickPositions && this.tickPositions.info,
669
+ userLabels = this.userOptions.labels || {};
670
+
671
+ if (this.horiz) {
672
+ if (gridOptions.enabled === true) {
673
+ each(axis.series, function (series) {
674
+ series.options.pointRange = 0;
675
+ });
676
+ }
677
+
678
+ // Lower level time ticks, like hours or minutes, represent points in
679
+ // time and not ranges. These should be aligned left in the grid cell
680
+ // by default. The same applies to years of higher order.
681
+ if (
682
+ tickInfo &&
683
+ (
684
+ options.dateTimeLabelFormats[tickInfo.unitName]
685
+ .range === false ||
686
+ tickInfo.count > 1 // years
687
+ ) &&
688
+ !defined(userLabels.align)
689
+ ) {
690
+ options.labels.align = 'left';
691
+
692
+ if (!defined(userLabels.x)) {
693
+ options.labels.x = 3;
694
+ }
695
+ }
696
+ }
697
+
698
+ proceed.apply(axis, argsToArray(arguments));
699
+ });
700
+
701
+ // TODO: Does this function do what the drawing says? Seems to affect ticks and
702
+ // not the labels directly?
703
+ /**
704
+ * Makes tick labels which are usually ignored in a linked axis displayed if
705
+ * they are within range of linkedParent.min.
706
+ * _____________________________
707
+ * | | | | |
708
+ * Make this: | | 2 | 3 | 4 |
709
+ * |___|_______|_______|_______|
710
+ * ^
711
+ * _____________________________
712
+ * | | | | |
713
+ * Into this: | 1 | 2 | 3 | 4 |
714
+ * |___|_______|_______|_______|
715
+ * ^
716
+ * @param {function} proceed - the original function
717
+ */
718
+ wrap(Axis.prototype, 'trimTicks', function (proceed) {
719
+ var axis = this,
720
+ options = axis.options,
721
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {},
722
+ categoryAxis = axis.categories,
723
+ tickPositions = axis.tickPositions,
724
+ firstPos = tickPositions[0],
725
+ lastPos = tickPositions[tickPositions.length - 1],
726
+ linkedMin = axis.linkedParent && axis.linkedParent.min,
727
+ linkedMax = axis.linkedParent && axis.linkedParent.max,
728
+ min = linkedMin || axis.min,
729
+ max = linkedMax || axis.max,
730
+ tickInterval = axis.tickInterval,
731
+ moreThanMin = firstPos > min,
732
+ lessThanMax = lastPos < max,
733
+ endMoreThanMin = firstPos < min && firstPos + tickInterval > min,
734
+ startLessThanMax = lastPos > max && lastPos - tickInterval < max;
735
+
736
+ if (
737
+ gridOptions.enabled === true &&
738
+ !categoryAxis &&
739
+ (axis.horiz || axis.isLinked)
740
+ ) {
741
+ if ((moreThanMin || endMoreThanMin) && !options.startOnTick) {
742
+ tickPositions[0] = min;
743
+ }
744
+
745
+ if ((lessThanMax || startLessThanMax) && !options.endOnTick) {
746
+ tickPositions[tickPositions.length - 1] = max;
747
+ }
748
+ }
749
+
750
+ proceed.apply(axis, argsToArray(arguments));
751
+ });
752
+
753
+ /**
754
+ * Draw an extra line on the far side of the outermost axis,
755
+ * creating floor/roof/wall of a grid. And some padding.
756
+ *
757
+ * Make this:
758
+ * (axis.min) __________________________ (axis.max)
759
+ * | | | | |
760
+ * Into this:
761
+ * (axis.min) __________________________ (axis.max)
762
+ * ___|____|____|____|____|__
763
+ *
764
+ * @param {function} proceed - the original function
765
+ */
766
+ wrap(Axis.prototype, 'render', function (proceed) {
767
+ var axis = this,
768
+ options = axis.options,
769
+ gridOptions = (options && isObject(options.grid)) ? options.grid : {},
770
+ labelPadding,
771
+ distance,
772
+ lineWidth,
773
+ linePath,
774
+ yStartIndex,
775
+ yEndIndex,
776
+ xStartIndex,
777
+ xEndIndex,
778
+ renderer = axis.chart.renderer,
779
+ horiz = axis.horiz,
780
+ axisGroupBox;
781
+
782
+ if (gridOptions.enabled === true) {
783
+ // TODO acutual label padding (top, bottom, left, right)
784
+ // Label padding is needed to figure out where to draw the outer line.
785
+ labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
786
+ axis.maxLabelDimensions = axis.getMaxLabelDimensions(
787
+ axis.ticks,
788
+ axis.tickPositions
789
+ );
790
+ distance = axis.maxLabelDimensions.width + labelPadding;
791
+ lineWidth = options.lineWidth;
792
+
793
+ // Remove right wall before rendering if updating
794
+ if (axis.rightWall) {
795
+ axis.rightWall.destroy();
796
+ }
797
+
798
+ // Call original Axis.render() to obtain axis.axisLine and
799
+ // axis.axisGroup
800
+ proceed.apply(axis);
801
+
802
+ axisGroupBox = axis.axisGroup.getBBox();
803
+
804
+ /*
805
+ * Draw an extra axis line on outer axes
806
+ * >
807
+ * Make this: |______|______|______|___
808
+ *
809
+ * > _________________________
810
+ * Into this: |______|______|______|__|
811
+ *
812
+ */
813
+ if (axis.isOuterAxis() && axis.axisLine) {
814
+ if (horiz) {
815
+ // -1 to avoid adding distance each time the chart updates
816
+ distance = axisGroupBox.height - 1;
817
+ }
818
+
819
+ if (lineWidth) {
820
+ linePath = axis.getLinePath(lineWidth);
821
+ xStartIndex = linePath.indexOf('M') + 1;
822
+ xEndIndex = linePath.indexOf('L') + 1;
823
+ yStartIndex = linePath.indexOf('M') + 2;
824
+ yEndIndex = linePath.indexOf('L') + 2;
825
+
826
+ // Negate distance if top or left axis
827
+ if (axis.side === axisSide.top || axis.side === axisSide.left) {
828
+ distance = -distance;
829
+ }
830
+
831
+ // If axis is horizontal, reposition line path vertically
832
+ if (horiz) {
833
+ linePath[yStartIndex] = linePath[yStartIndex] + distance;
834
+ linePath[yEndIndex] = linePath[yEndIndex] + distance;
835
+ } else {
836
+ // If axis is vertical, reposition line path horizontally
837
+ linePath[xStartIndex] = linePath[xStartIndex] + distance;
838
+ linePath[xEndIndex] = linePath[xEndIndex] + distance;
839
+ }
840
+
841
+ if (!axis.axisLineExtra) {
842
+ axis.axisLineExtra = renderer.path(linePath)
843
+ .attr({
844
+
845
+ zIndex: 7
846
+ })
847
+ .addClass('highcharts-axis-line')
848
+ .add(axis.axisGroup);
849
+ } else {
850
+ axis.axisLineExtra.animate({
851
+ d: linePath
852
+ });
853
+ }
854
+
855
+ // show or hide the line depending on options.showEmpty
856
+ axis.axisLine[axis.showAxis ? 'show' : 'hide'](true);
857
+ }
858
+ }
859
+
860
+ } else {
861
+ proceed.apply(axis);
862
+ }
863
+ });
864
+
865
+ /**
866
+ * Wraps axis init to draw cell walls on vertical axes.
867
+ *
868
+ * @param {function} proceed - the original function
869
+ */
870
+ wrap(Axis.prototype, 'init', function (proceed, chart, userOptions) {
871
+ var axis = this,
872
+ gridOptions = (
873
+ (userOptions && isObject(userOptions.grid)) ?
874
+ userOptions.grid :
875
+ {}
876
+ ),
877
+ columnOptions,
878
+ column,
879
+ columnIndex,
880
+ i;
881
+ function applyGridOptions(axis) {
882
+ var options = axis.options,
883
+ // TODO: Consider using cell margins defined in % of font size?
884
+ // 25 is optimal height for default fontSize (11px)
885
+ // 25 / 11 ≈ 2.28
886
+ fontSizeToCellHeightRatio = 25 / 11,
887
+ fontSize = options.labels.style.fontSize,
888
+ fontMetrics = axis.chart.renderer.fontMetrics(fontSize);
889
+
890
+ // Center-align by default
891
+ if (!options.labels) {
892
+ options.labels = {};
893
+ }
894
+ options.labels.align = pick(options.labels.align, 'center');
895
+
896
+ // TODO: Check against tickLabelPlacement between/on etc
897
+ /**
898
+ * Prevents adding the last tick label if the axis is not a category
899
+ * axis.
900
+ *
901
+ * Since numeric labels are normally placed at starts and ends of a
902
+ * range of value, and this module makes the label point at the value,
903
+ * an "extra" label would appear.
904
+ */
905
+ if (!axis.categories) {
906
+ options.showLastLabel = false;
907
+ }
908
+
909
+ /**
910
+ * Make tick marks taller, creating cell walls of a grid.
911
+ * Use cellHeight axis option if set
912
+ */
913
+ if (axis.horiz) {
914
+ options.tickLength = gridOptions.cellHeight ||
915
+ fontMetrics.h * fontSizeToCellHeightRatio;
916
+ }
917
+
918
+ /**
919
+ * Prevents rotation of labels when squished, as rotating them would not
920
+ * help.
921
+ */
922
+ axis.labelRotation = 0;
923
+ options.labels.rotation = 0;
924
+ }
925
+
926
+ if (gridOptions.enabled) {
927
+ if (defined(gridOptions.borderColor)) {
928
+ userOptions.tickColor =
929
+ userOptions.lineColor = gridOptions.borderColor;
930
+ }
931
+
932
+ // Handle columns, each column is a grid axis
933
+ if (isArray(gridOptions.columns)) {
934
+ columnIndex = 0;
935
+ i = gridOptions.columns.length;
936
+ while (i--) {
937
+ columnOptions = merge(
938
+ userOptions,
939
+ gridOptions.columns[i],
940
+ {
941
+ // Force to behave like category axis
942
+ type: 'category'
943
+ }
944
+ );
945
+
946
+ delete columnOptions.grid.columns; // Prevent recursion
947
+
948
+ column = new Axis(chart, columnOptions);
949
+ column.isColumn = true;
950
+ column.columnIndex = columnIndex;
951
+
952
+ wrap(column, 'labelFormatter', function (proceed) {
953
+ var axis = this.axis,
954
+ tickPos = axis.tickPositions,
955
+ value = this.value,
956
+ series = axis.series[0],
957
+ isFirst = value === tickPos[0],
958
+ isLast = value === tickPos[tickPos.length - 1],
959
+ point = H.find(series.options.data, function (p) {
960
+ return p[axis.isXAxis ? 'x' : 'y'] === value;
961
+ });
962
+
963
+ // Make additional properties available for the formatter
964
+ this.isFirst = isFirst;
965
+ this.isLast = isLast;
966
+ this.point = point;
967
+
968
+ // Call original labelFormatter
969
+ return proceed.call(this);
970
+ });
971
+
972
+ columnIndex++;
973
+ }
974
+ } else {
975
+ // Call original Axis.init()
976
+ proceed.apply(axis, argsToArray(arguments));
977
+ applyGridOptions(axis);
978
+ }
979
+ } else {
980
+ // Call original Axis.init()
981
+ proceed.apply(axis, argsToArray(arguments));
982
+ }
983
+ });
984
+
985
+ }(Highcharts));
986
+ var Tree = (function (H) {
987
+ /**
988
+ * (c) 2016 Highsoft AS
989
+ * Authors: Jon Arild Nygard
990
+ *
991
+ * License: www.highcharts.com/license
992
+ */
993
+ /* eslint no-console: 0 */
994
+ var each = H.each,
995
+ extend = H.extend,
996
+ isNumber = H.isNumber,
997
+ keys = H.keys,
998
+ map = H.map,
999
+ pick = H.pick,
1000
+ reduce = H.reduce,
1001
+ isFunction = function (x) {
1002
+ return typeof x === 'function';
1003
+ };
1004
+
1005
+ /**
1006
+ * Creates an object map from parent id to childrens index.
1007
+ * @param {Array} data List of points set in options.
1008
+ * @param {string} data[].parent Parent id of point.
1009
+ * @param {Array} ids List of all point ids.
1010
+ * @returns {Object} Map from parent id to children index in data
1011
+ */
1012
+ var getListOfParents = function (data, ids) {
1013
+ var listOfParents = reduce(data, function (prev, curr) {
1014
+ var parent = pick(curr.parent, '');
1015
+ if (prev[parent] === undefined) {
1016
+ prev[parent] = [];
1017
+ }
1018
+ prev[parent].push(curr);
1019
+ return prev;
1020
+ }, {}),
1021
+ parents = keys(listOfParents);
1022
+
1023
+ // If parent does not exist, hoist parent to root of tree.
1024
+ each(parents, function (parent, list) {
1025
+ var children = listOfParents[parent];
1026
+ if ((parent !== '') && (H.inArray(parent, ids) === -1)) {
1027
+ each(children, function (child) {
1028
+ list[''].push(child);
1029
+ });
1030
+ delete list[parent];
1031
+ }
1032
+ });
1033
+ return listOfParents;
1034
+ };
1035
+ var getNode = function (id, parent, level, data, mapOfIdToChildren, options) {
1036
+ var descendants = 0,
1037
+ height = 0,
1038
+ after = options && options.after,
1039
+ before = options && options.before,
1040
+ node = {
1041
+ data: data,
1042
+ depth: level - 1,
1043
+ id: id,
1044
+ level: level,
1045
+ parent: parent
1046
+ },
1047
+ start,
1048
+ end,
1049
+ children;
1050
+
1051
+ // Allow custom logic before the children has been created.
1052
+ if (isFunction(before)) {
1053
+ before(node, options);
1054
+ }
1055
+
1056
+ /**
1057
+ * Call getNode recursively on the children. Calulate the height of the
1058
+ * node, and the number of descendants.
1059
+ */
1060
+ children = map((mapOfIdToChildren[id] || []), function (child) {
1061
+ var node = getNode(
1062
+ child.id,
1063
+ id,
1064
+ (level + 1),
1065
+ child,
1066
+ mapOfIdToChildren,
1067
+ options
1068
+ ),
1069
+ childStart = child.start,
1070
+ childEnd = (
1071
+ child.milestone === true ?
1072
+ childStart :
1073
+ child.end
1074
+ );
1075
+
1076
+ // Start should be the lowest child.start.
1077
+ start = (
1078
+ (!isNumber(start) || childStart < start) ?
1079
+ childStart :
1080
+ start
1081
+ );
1082
+
1083
+ // End should be the largest child.end.
1084
+ // If child is milestone, then use start as end.
1085
+ end = (
1086
+ (!isNumber(end) || childEnd > end) ?
1087
+ childEnd :
1088
+ end
1089
+ );
1090
+
1091
+ descendants = descendants + 1 + node.descendants;
1092
+ height = Math.max(node.height + 1, height);
1093
+ return node;
1094
+ });
1095
+
1096
+ // Calculate start and end for point if it is not already explicitly set.
1097
+ if (data) {
1098
+ data.start = pick(data.start, start);
1099
+ data.end = pick(data.end, end);
1100
+ }
1101
+
1102
+ extend(node, {
1103
+ children: children,
1104
+ descendants: descendants,
1105
+ height: height
1106
+ });
1107
+
1108
+ // Allow custom logic after the children has been created.
1109
+ if (isFunction(after)) {
1110
+ after(node, options);
1111
+ }
1112
+
1113
+ return node;
1114
+ };
1115
+ var getTree = function (data, options) {
1116
+ var ids = map(data, function (d) {
1117
+ return d.id;
1118
+ }),
1119
+ mapOfIdToChildren = getListOfParents(data, ids);
1120
+ return getNode('', null, 1, null, mapOfIdToChildren, options);
1121
+ };
1122
+
1123
+ var Tree = {
1124
+ getListOfParents: getListOfParents,
1125
+ getNode: getNode,
1126
+ getTree: getTree
1127
+ };
1128
+
1129
+
1130
+ return Tree;
1131
+ }(Highcharts));
1132
+ var result = (function (H) {
1133
+ var each = H.each,
1134
+ extend = H.extend,
1135
+ isArray = H.isArray,
1136
+ isBoolean = function (x) {
1137
+ return typeof x === 'boolean';
1138
+ },
1139
+ isFn = function (x) {
1140
+ return typeof x === 'function';
1141
+ },
1142
+ isObject = H.isObject,
1143
+ isNumber = H.isNumber,
1144
+ merge = H.merge,
1145
+ pick = H.pick,
1146
+ reduce = H.reduce;
1147
+ // TODO Combine buildTree and buildNode with setTreeValues
1148
+ // TODO Remove logic from Treemap and make it utilize this mixin.
1149
+ var setTreeValues = function setTreeValues(tree, options) {
1150
+ var before = options.before,
1151
+ idRoot = options.idRoot,
1152
+ mapIdToNode = options.mapIdToNode,
1153
+ nodeRoot = mapIdToNode[idRoot],
1154
+ levelIsConstant = (
1155
+ isBoolean(options.levelIsConstant) ?
1156
+ options.levelIsConstant :
1157
+ true
1158
+ ),
1159
+ points = options.points,
1160
+ point = points[tree.i],
1161
+ optionsPoint = point && point.options || {},
1162
+ childrenTotal = 0,
1163
+ children = [],
1164
+ value;
1165
+ extend(tree, {
1166
+ levelDynamic: tree.level - (levelIsConstant ? 0 : nodeRoot.level),
1167
+ name: pick(point && point.name, ''),
1168
+ visible: (
1169
+ idRoot === tree.id ||
1170
+ (isBoolean(options.visible) ? options.visible : false)
1171
+ )
1172
+ });
1173
+ if (isFn(before)) {
1174
+ tree = before(tree, options);
1175
+ }
1176
+ // First give the children some values
1177
+ each(tree.children, function (child, i) {
1178
+ var newOptions = extend({}, options);
1179
+ extend(newOptions, {
1180
+ index: i,
1181
+ siblings: tree.children.length,
1182
+ visible: tree.visible
1183
+ });
1184
+ child = setTreeValues(child, newOptions);
1185
+ children.push(child);
1186
+ if (child.visible) {
1187
+ childrenTotal += child.val;
1188
+ }
1189
+ });
1190
+ tree.visible = childrenTotal > 0 || tree.visible;
1191
+ // Set the values
1192
+ value = pick(optionsPoint.value, childrenTotal);
1193
+ extend(tree, {
1194
+ children: children,
1195
+ childrenTotal: childrenTotal,
1196
+ isLeaf: tree.visible && !childrenTotal,
1197
+ val: value
1198
+ });
1199
+ return tree;
1200
+ };
1201
+
1202
+ var getColor = function getColor(node, options) {
1203
+ var index = options.index,
1204
+ mapOptionsToLevel = options.mapOptionsToLevel,
1205
+ parentColor = options.parentColor,
1206
+ parentColorIndex = options.parentColorIndex,
1207
+ series = options.series,
1208
+ colors = options.colors,
1209
+ siblings = options.siblings,
1210
+ points = series.points,
1211
+ getColorByPoint,
1212
+ point,
1213
+ level,
1214
+ colorByPoint,
1215
+ colorIndexByPoint,
1216
+ color,
1217
+ colorIndex;
1218
+ function variation(color) {
1219
+ var colorVariation = level && level.colorVariation;
1220
+ if (colorVariation) {
1221
+ if (colorVariation.key === 'brightness') {
1222
+ return H.color(color).brighten(
1223
+ colorVariation.to * (index / siblings)
1224
+ ).get();
1225
+ }
1226
+ }
1227
+
1228
+ return color;
1229
+ }
1230
+
1231
+ if (node) {
1232
+ point = points[node.i];
1233
+ level = mapOptionsToLevel[node.level] || {};
1234
+ getColorByPoint = point && level.colorByPoint;
1235
+
1236
+ if (getColorByPoint) {
1237
+ colorIndexByPoint = point.index % (colors ?
1238
+ colors.length :
1239
+ series.chart.options.chart.colorCount
1240
+ );
1241
+ colorByPoint = colors && colors[colorIndexByPoint];
1242
+ }
1243
+
1244
+
1245
+ colorIndex = pick(
1246
+ point && point.options.colorIndex,
1247
+ level && level.colorIndex,
1248
+ colorIndexByPoint,
1249
+ parentColorIndex,
1250
+ options.colorIndex
1251
+ );
1252
+ }
1253
+ return {
1254
+ color: color,
1255
+ colorIndex: colorIndex
1256
+ };
1257
+ };
1258
+
1259
+ /**
1260
+ * getLevelOptions - Creates a map from level number to its given options.
1261
+ * @param {Object} params Object containing parameters.
1262
+ * @param {Object} params.defaults Object containing default options. The
1263
+ * default options are merged with the userOptions to get the final options for
1264
+ * a specific level.
1265
+ * @param {Number} params.from The lowest level number.
1266
+ * @param {Array} params.levels User options from series.levels.
1267
+ * @param {Number} params.to The highest level number.
1268
+ * @return {null|Object} Returns a map from level number to its given options.
1269
+ * Returns null if invalid input parameters.
1270
+ */
1271
+ var getLevelOptions = function getLevelOptions(params) {
1272
+ var result = null,
1273
+ defaults,
1274
+ converted,
1275
+ i,
1276
+ from,
1277
+ to,
1278
+ levels;
1279
+ if (isObject(params)) {
1280
+ result = {};
1281
+ from = isNumber(params.from) ? params.from : 1;
1282
+ levels = params.levels;
1283
+ converted = {};
1284
+ defaults = isObject(params.defaults) ? params.defaults : {};
1285
+ if (isArray(levels)) {
1286
+ converted = reduce(levels, function (obj, item) {
1287
+ var level,
1288
+ levelIsConstant,
1289
+ options;
1290
+ if (isObject(item) && isNumber(item.level)) {
1291
+ options = merge({}, item);
1292
+ levelIsConstant = (
1293
+ isBoolean(options.levelIsConstant) ?
1294
+ options.levelIsConstant :
1295
+ defaults.levelIsConstant
1296
+ );
1297
+ // Delete redundant properties.
1298
+ delete options.levelIsConstant;
1299
+ delete options.level;
1300
+ // Calculate which level these options apply to.
1301
+ level = item.level + (levelIsConstant ? 0 : from - 1);
1302
+ if (isObject(obj[level])) {
1303
+ extend(obj[level], options);
1304
+ } else {
1305
+ obj[level] = options;
1306
+ }
1307
+ }
1308
+ return obj;
1309
+ }, {});
1310
+ }
1311
+ to = isNumber(params.to) ? params.to : 1;
1312
+ for (i = 0; i <= to; i++) {
1313
+ result[i] = merge(
1314
+ {},
1315
+ defaults,
1316
+ isObject(converted[i]) ? converted[i] : {}
1317
+ );
1318
+ }
1319
+ }
1320
+ return result;
1321
+ };
1322
+
1323
+ /**
1324
+ * Update the rootId property on the series. Also makes sure that it is
1325
+ * accessible to exporting.
1326
+ * @param {object} series The series to operate on.
1327
+ * @returns Returns the resulting rootId after update.
1328
+ */
1329
+ var updateRootId = function (series) {
1330
+ var rootId,
1331
+ options;
1332
+ if (isObject(series)) {
1333
+ // Get the series options.
1334
+ options = isObject(series.options) ? series.options : {};
1335
+
1336
+ // Calculate the rootId.
1337
+ rootId = pick(series.rootNode, options.rootId, '');
1338
+
1339
+ // Set rootId on series.userOptions to pick it up in exporting.
1340
+ if (isObject(series.userOptions)) {
1341
+ series.userOptions.rootId = rootId;
1342
+ }
1343
+ // Set rootId on series to pick it up on next update.
1344
+ series.rootNode = rootId;
1345
+ }
1346
+ return rootId;
1347
+ };
1348
+
1349
+ var result = {
1350
+ getColor: getColor,
1351
+ getLevelOptions: getLevelOptions,
1352
+ setTreeValues: setTreeValues,
1353
+ updateRootId: updateRootId
1354
+ };
1355
+
1356
+ return result;
1357
+ }(Highcharts));
1358
+ (function (H) {
1359
+ /**
1360
+ * (c) 2009-2018 Torstein Honsi
1361
+ *
1362
+ * License: www.highcharts.com/license
1363
+ */
1364
+
1365
+ var addEvent = H.addEvent,
1366
+ pick = H.pick,
1367
+ wrap = H.wrap,
1368
+ each = H.each,
1369
+ extend = H.extend,
1370
+ isArray = H.isArray,
1371
+ fireEvent = H.fireEvent,
1372
+ Axis = H.Axis,
1373
+ Series = H.Series;
1374
+
1375
+ function stripArguments() {
1376
+ return Array.prototype.slice.call(arguments, 1);
1377
+ }
1378
+
1379
+ extend(Axis.prototype, {
1380
+ isInBreak: function (brk, val) {
1381
+ var ret,
1382
+ repeat = brk.repeat || Infinity,
1383
+ from = brk.from,
1384
+ length = brk.to - brk.from,
1385
+ test = (
1386
+ val >= from ?
1387
+ (val - from) % repeat :
1388
+ repeat - ((from - val) % repeat)
1389
+ );
1390
+
1391
+ if (!brk.inclusive) {
1392
+ ret = test < length && test !== 0;
1393
+ } else {
1394
+ ret = test <= length;
1395
+ }
1396
+ return ret;
1397
+ },
1398
+
1399
+ isInAnyBreak: function (val, testKeep) {
1400
+
1401
+ var breaks = this.options.breaks,
1402
+ i = breaks && breaks.length,
1403
+ inbrk,
1404
+ keep,
1405
+ ret;
1406
+
1407
+
1408
+ if (i) {
1409
+
1410
+ while (i--) {
1411
+ if (this.isInBreak(breaks[i], val)) {
1412
+ inbrk = true;
1413
+ if (!keep) {
1414
+ keep = pick(
1415
+ breaks[i].showPoints,
1416
+ this.isXAxis ? false : true
1417
+ );
1418
+ }
1419
+ }
1420
+ }
1421
+
1422
+ if (inbrk && testKeep) {
1423
+ ret = inbrk && !keep;
1424
+ } else {
1425
+ ret = inbrk;
1426
+ }
1427
+ }
1428
+ return ret;
1429
+ }
1430
+ });
1431
+
1432
+ addEvent(Axis, 'afterInit', function () {
1433
+ if (typeof this.setBreaks === 'function') {
1434
+ this.setBreaks(this.options.breaks, false);
1435
+ }
1436
+ });
1437
+
1438
+ addEvent(Axis, 'afterSetTickPositions', function () {
1439
+ if (this.isBroken) {
1440
+ var axis = this,
1441
+ tickPositions = this.tickPositions,
1442
+ info = this.tickPositions.info,
1443
+ newPositions = [],
1444
+ i;
1445
+
1446
+ for (i = 0; i < tickPositions.length; i++) {
1447
+ if (!axis.isInAnyBreak(tickPositions[i])) {
1448
+ newPositions.push(tickPositions[i]);
1449
+ }
1450
+ }
1451
+
1452
+ this.tickPositions = newPositions;
1453
+ this.tickPositions.info = info;
1454
+ }
1455
+ });
1456
+
1457
+ // Force Axis to be not-ordinal when breaks are defined
1458
+ addEvent(Axis, 'afterSetOptions', function () {
1459
+ if (this.isBroken) {
1460
+ this.options.ordinal = false;
1461
+ }
1462
+ });
1463
+
1464
+ /**
1465
+ * Dynamically set or unset breaks in an axis. This function in lighter than
1466
+ * usin Axis.update, and it also preserves animation.
1467
+ * @param {Array} [breaks]
1468
+ * The breaks to add. When `undefined` it removes existing breaks.
1469
+ * @param {Boolean} [redraw=true]
1470
+ * Whether to redraw the chart immediately.
1471
+ */
1472
+ Axis.prototype.setBreaks = function (breaks, redraw) {
1473
+ var axis = this,
1474
+ isBroken = (isArray(breaks) && !!breaks.length);
1475
+
1476
+ function breakVal2Lin(val) {
1477
+ var nval = val,
1478
+ brk,
1479
+ i;
1480
+
1481
+ for (i = 0; i < axis.breakArray.length; i++) {
1482
+ brk = axis.breakArray[i];
1483
+ if (brk.to <= val) {
1484
+ nval -= brk.len;
1485
+ } else if (brk.from >= val) {
1486
+ break;
1487
+ } else if (axis.isInBreak(brk, val)) {
1488
+ nval -= (val - brk.from);
1489
+ break;
1490
+ }
1491
+ }
1492
+
1493
+ return nval;
1494
+ }
1495
+
1496
+ function breakLin2Val(val) {
1497
+ var nval = val,
1498
+ brk,
1499
+ i;
1500
+
1501
+ for (i = 0; i < axis.breakArray.length; i++) {
1502
+ brk = axis.breakArray[i];
1503
+ if (brk.from >= nval) {
1504
+ break;
1505
+ } else if (brk.to < nval) {
1506
+ nval += brk.len;
1507
+ } else if (axis.isInBreak(brk, nval)) {
1508
+ nval += brk.len;
1509
+ }
1510
+ }
1511
+ return nval;
1512
+ }
1513
+
1514
+
1515
+ axis.isDirty = axis.isBroken !== isBroken;
1516
+ axis.isBroken = isBroken;
1517
+ axis.options.breaks = axis.userOptions.breaks = breaks;
1518
+ axis.forceRedraw = true; // Force recalculation in setScale
1519
+
1520
+ if (!isBroken && axis.val2lin === breakVal2Lin) {
1521
+ // Revert to prototype functions
1522
+ delete axis.val2lin;
1523
+ delete axis.lin2val;
1524
+ }
1525
+
1526
+ if (isBroken) {
1527
+ axis.userOptions.ordinal = false;
1528
+ axis.val2lin = breakVal2Lin;
1529
+ axis.lin2val = breakLin2Val;
1530
+
1531
+ axis.setExtremes = function (
1532
+ newMin,
1533
+ newMax,
1534
+ redraw,
1535
+ animation,
1536
+ eventArguments
1537
+ ) {
1538
+ // If trying to set extremes inside a break, extend it to before and
1539
+ // after the break ( #3857 )
1540
+ if (this.isBroken) {
1541
+ while (this.isInAnyBreak(newMin)) {
1542
+ newMin -= this.closestPointRange;
1543
+ }
1544
+ while (this.isInAnyBreak(newMax)) {
1545
+ newMax -= this.closestPointRange;
1546
+ }
1547
+ }
1548
+ Axis.prototype.setExtremes.call(
1549
+ this,
1550
+ newMin,
1551
+ newMax,
1552
+ redraw,
1553
+ animation,
1554
+ eventArguments
1555
+ );
1556
+ };
1557
+
1558
+ axis.setAxisTranslation = function (saveOld) {
1559
+ Axis.prototype.setAxisTranslation.call(this, saveOld);
1560
+
1561
+ this.unitLength = null;
1562
+ if (this.isBroken) {
1563
+ var breaks = axis.options.breaks,
1564
+ breakArrayT = [], // Temporary one
1565
+ breakArray = [],
1566
+ length = 0,
1567
+ inBrk,
1568
+ repeat,
1569
+ min = axis.userMin || axis.min,
1570
+ max = axis.userMax || axis.max,
1571
+ pointRangePadding = pick(axis.pointRangePadding, 0),
1572
+ start,
1573
+ i;
1574
+
1575
+ // Min & max check (#4247)
1576
+ each(breaks, function (brk) {
1577
+ repeat = brk.repeat || Infinity;
1578
+ if (axis.isInBreak(brk, min)) {
1579
+ min += (brk.to % repeat) - (min % repeat);
1580
+ }
1581
+ if (axis.isInBreak(brk, max)) {
1582
+ max -= (max % repeat) - (brk.from % repeat);
1583
+ }
1584
+ });
1585
+
1586
+ // Construct an array holding all breaks in the axis
1587
+ each(breaks, function (brk) {
1588
+ start = brk.from;
1589
+ repeat = brk.repeat || Infinity;
1590
+
1591
+ while (start - repeat > min) {
1592
+ start -= repeat;
1593
+ }
1594
+ while (start < min) {
1595
+ start += repeat;
1596
+ }
1597
+
1598
+ for (i = start; i < max; i += repeat) {
1599
+ breakArrayT.push({
1600
+ value: i,
1601
+ move: 'in'
1602
+ });
1603
+ breakArrayT.push({
1604
+ value: i + (brk.to - brk.from),
1605
+ move: 'out',
1606
+ size: brk.breakSize
1607
+ });
1608
+ }
1609
+ });
1610
+
1611
+ breakArrayT.sort(function (a, b) {
1612
+ return (
1613
+ (a.value === b.value) ?
1614
+ (a.move === 'in' ? 0 : 1) - (b.move === 'in' ? 0 : 1) :
1615
+ a.value - b.value
1616
+ );
1617
+ });
1618
+
1619
+ // Simplify the breaks
1620
+ inBrk = 0;
1621
+ start = min;
1622
+
1623
+ each(breakArrayT, function (brk) {
1624
+ inBrk += (brk.move === 'in' ? 1 : -1);
1625
+
1626
+ if (inBrk === 1 && brk.move === 'in') {
1627
+ start = brk.value;
1628
+ }
1629
+ if (inBrk === 0) {
1630
+ breakArray.push({
1631
+ from: start,
1632
+ to: brk.value,
1633
+ len: brk.value - start - (brk.size || 0)
1634
+ });
1635
+ length += brk.value - start - (brk.size || 0);
1636
+ }
1637
+ });
1638
+
1639
+ axis.breakArray = breakArray;
1640
+
1641
+ // Used with staticScale, and below, the actual axis length when
1642
+ // breaks are substracted.
1643
+ axis.unitLength = max - min - length + pointRangePadding;
1644
+
1645
+ fireEvent(axis, 'afterBreaks');
1646
+
1647
+ if (axis.staticScale) {
1648
+ axis.transA = axis.staticScale;
1649
+ } else if (axis.unitLength) {
1650
+ axis.transA *= (max - axis.min + pointRangePadding) /
1651
+ axis.unitLength;
1652
+ }
1653
+
1654
+ if (pointRangePadding) {
1655
+ axis.minPixelPadding = axis.transA * axis.minPointOffset;
1656
+ }
1657
+
1658
+ axis.min = min;
1659
+ axis.max = max;
1660
+ }
1661
+ };
1662
+ }
1663
+
1664
+ if (pick(redraw, true)) {
1665
+ this.chart.redraw();
1666
+ }
1667
+ };
1668
+
1669
+ wrap(Series.prototype, 'generatePoints', function (proceed) {
1670
+
1671
+ proceed.apply(this, stripArguments(arguments));
1672
+
1673
+ var series = this,
1674
+ xAxis = series.xAxis,
1675
+ yAxis = series.yAxis,
1676
+ points = series.points,
1677
+ point,
1678
+ i = points.length,
1679
+ connectNulls = series.options.connectNulls,
1680
+ nullGap;
1681
+
1682
+
1683
+ if (xAxis && yAxis && (xAxis.options.breaks || yAxis.options.breaks)) {
1684
+ while (i--) {
1685
+ point = points[i];
1686
+
1687
+ // Respect nulls inside the break (#4275)
1688
+ nullGap = point.y === null && connectNulls === false;
1689
+ if (
1690
+ !nullGap &&
1691
+ (
1692
+ xAxis.isInAnyBreak(point.x, true) ||
1693
+ yAxis.isInAnyBreak(point.y, true)
1694
+ )
1695
+ ) {
1696
+ points.splice(i, 1);
1697
+ if (this.data[i]) {
1698
+ // Removes the graphics for this point if they exist
1699
+ this.data[i].destroyElements();
1700
+ }
1701
+ }
1702
+ }
1703
+ }
1704
+
1705
+ });
1706
+
1707
+ function drawPointsWrapped(proceed) {
1708
+ proceed.apply(this);
1709
+ this.drawBreaks(this.xAxis, ['x']);
1710
+ this.drawBreaks(this.yAxis, pick(this.pointArrayMap, ['y']));
1711
+ }
1712
+
1713
+ H.Series.prototype.drawBreaks = function (axis, keys) {
1714
+ var series = this,
1715
+ points = series.points,
1716
+ breaks,
1717
+ threshold,
1718
+ eventName,
1719
+ y;
1720
+
1721
+ if (!axis) {
1722
+ return; // #5950
1723
+ }
1724
+
1725
+ each(keys, function (key) {
1726
+ breaks = axis.breakArray || [];
1727
+ threshold = axis.isXAxis ?
1728
+ axis.min :
1729
+ pick(series.options.threshold, axis.min);
1730
+ each(points, function (point) {
1731
+ y = pick(point['stack' + key.toUpperCase()], point[key]);
1732
+ each(breaks, function (brk) {
1733
+ eventName = false;
1734
+
1735
+ if (
1736
+ (threshold < brk.from && y > brk.to) ||
1737
+ (threshold > brk.from && y < brk.from)
1738
+ ) {
1739
+ eventName = 'pointBreak';
1740
+
1741
+ } else if (
1742
+ (threshold < brk.from && y > brk.from && y < brk.to) ||
1743
+ (threshold > brk.from && y > brk.to && y < brk.from)
1744
+ ) {
1745
+ eventName = 'pointInBreak';
1746
+ }
1747
+ if (eventName) {
1748
+ fireEvent(axis, eventName, { point: point, brk: brk });
1749
+ }
1750
+ });
1751
+ });
1752
+ });
1753
+ };
1754
+
1755
+
1756
+ /**
1757
+ * Extend getGraphPath by identifying gaps in the data so that we can draw a gap
1758
+ * in the line or area. This was moved from ordinal axis module to broken axis
1759
+ * module as of #5045.
1760
+ */
1761
+ H.Series.prototype.gappedPath = function () {
1762
+ var currentDataGrouping = this.currentDataGrouping,
1763
+ groupingSize = currentDataGrouping && currentDataGrouping.totalRange,
1764
+ gapSize = this.options.gapSize,
1765
+ points = this.points.slice(),
1766
+ i = points.length - 1,
1767
+ yAxis = this.yAxis,
1768
+ xRange,
1769
+ stack;
1770
+
1771
+ /**
1772
+ * Defines when to display a gap in the graph, together with the
1773
+ * [gapUnit](plotOptions.series.gapUnit) option.
1774
+ *
1775
+ * In case when `dataGrouping` is enabled, points can be grouped into a
1776
+ * larger time span. This can make the grouped points to have a greater
1777
+ * distance than the absolute value of `gapSize` property, which will result
1778
+ * in disappearing graph completely. To prevent this situation the mentioned
1779
+ * distance between grouped points is used instead of previously defined
1780
+ * `gapSize`.
1781
+ *
1782
+ * In practice, this option is most often used to visualize gaps in
1783
+ * time series. In a stock chart, intraday data is available for daytime
1784
+ * hours, while gaps will appear in nights and weekends.
1785
+ *
1786
+ * @type {Number}
1787
+ * @see [gapUnit](plotOptions.series.gapUnit) and
1788
+ * [xAxis.breaks](#xAxis.breaks)
1789
+ * @sample {highstock} stock/plotoptions/series-gapsize/
1790
+ * Setting the gap size to 2 introduces gaps for weekends in daily
1791
+ * datasets.
1792
+ * @default 0
1793
+ * @product highstock
1794
+ * @apioption plotOptions.series.gapSize
1795
+ */
1796
+
1797
+ /**
1798
+ * Together with [gapSize](plotOptions.series.gapSize), this option defines
1799
+ * where to draw gaps in the graph.
1800
+ *
1801
+ * When the `gapUnit` is `relative` (default), a gap size of 5 means
1802
+ * that if the distance between two points is greater than five times
1803
+ * that of the two closest points, the graph will be broken.
1804
+ *
1805
+ * When the `gapUnit` is `value`, the gap is based on absolute axis values,
1806
+ * which on a datetime axis is milliseconds. This also applies to the
1807
+ * navigator series that inherits gap options from the base series.
1808
+ *
1809
+ * @type {String}
1810
+ * @see [gapSize](plotOptions.series.gapSize)
1811
+ * @default relative
1812
+ * @validvalue ["relative", "value"]
1813
+ * @since 5.0.13
1814
+ * @product highstock
1815
+ * @apioption plotOptions.series.gapUnit
1816
+ */
1817
+
1818
+ if (gapSize && i > 0) { // #5008
1819
+
1820
+ // Gap unit is relative
1821
+ if (this.options.gapUnit !== 'value') {
1822
+ gapSize *= this.closestPointRange;
1823
+ }
1824
+
1825
+ // Setting a new gapSize in case dataGrouping is enabled (#7686)
1826
+ if (groupingSize && groupingSize > gapSize) {
1827
+ gapSize = groupingSize;
1828
+ }
1829
+
1830
+ // extension for ordinal breaks
1831
+ while (i--) {
1832
+ if (points[i + 1].x - points[i].x > gapSize) {
1833
+ xRange = (points[i].x + points[i + 1].x) / 2;
1834
+
1835
+ points.splice( // insert after this one
1836
+ i + 1,
1837
+ 0,
1838
+ {
1839
+ isNull: true,
1840
+ x: xRange
1841
+ }
1842
+ );
1843
+
1844
+ // For stacked chart generate empty stack items, #6546
1845
+ if (this.options.stacking) {
1846
+ stack = yAxis.stacks[this.stackKey][xRange] =
1847
+ new H.StackItem(
1848
+ yAxis,
1849
+ yAxis.options.stackLabels,
1850
+ false,
1851
+ xRange,
1852
+ this.stack
1853
+ );
1854
+ stack.total = 0;
1855
+ }
1856
+ }
1857
+ }
1858
+ }
1859
+
1860
+ // Call base method
1861
+ return this.getGraphPath(points);
1862
+ };
1863
+
1864
+ wrap(H.seriesTypes.column.prototype, 'drawPoints', drawPointsWrapped);
1865
+ wrap(H.Series.prototype, 'drawPoints', drawPointsWrapped);
1866
+
1867
+ }(Highcharts));
1868
+ (function (H, Tree, mixinTreeSeries) {
1869
+ /**
1870
+ * (c) 2016 Highsoft AS
1871
+ * Authors: Jon Arild Nygard
1872
+ *
1873
+ * License: www.highcharts.com/license
1874
+ */
1875
+ /* eslint no-console: 0 */
1876
+ var argsToArray = function (args) {
1877
+ return Array.prototype.slice.call(args, 1);
1878
+ },
1879
+ defined = H.defined,
1880
+ each = H.each,
1881
+ extend = H.extend,
1882
+ find = H.find,
1883
+ fireEvent = H.fireEvent,
1884
+ getLevelOptions = mixinTreeSeries.getLevelOptions,
1885
+ map = H.map,
1886
+ merge = H.merge,
1887
+ inArray = H.inArray,
1888
+ isBoolean = function (x) {
1889
+ return typeof x === 'boolean';
1890
+ },
1891
+ isNumber = H.isNumber,
1892
+ isObject = function (x) {
1893
+ // Always use strict mode.
1894
+ return H.isObject(x, true);
1895
+ },
1896
+ isString = H.isString,
1897
+ keys = H.keys,
1898
+ pick = H.pick,
1899
+ reduce = H.reduce,
1900
+ wrap = H.wrap,
1901
+ GridAxis = H.Axis,
1902
+ GridAxisTick = H.Tick;
1903
+
1904
+ /**
1905
+ * some - Equivalent of Array.prototype.some
1906
+ *
1907
+ * @param {Array} arr Array to look for matching elements in.
1908
+ * @param {function} condition The condition to check against.
1909
+ * @return {boolean} Whether some elements pass the condition.
1910
+ */
1911
+ var some = function (arr, condition) {
1912
+ var result = false;
1913
+ each(arr, function (element, index, array) {
1914
+ if (!result) {
1915
+ result = condition(element, index, array);
1916
+ }
1917
+ });
1918
+ return result;
1919
+ };
1920
+
1921
+ var override = function (obj, methods) {
1922
+ var method,
1923
+ func;
1924
+ for (method in methods) {
1925
+ if (methods.hasOwnProperty(method)) {
1926
+ func = methods[method];
1927
+ wrap(obj, method, func);
1928
+ }
1929
+ }
1930
+ };
1931
+
1932
+ /**
1933
+ * getCategoriesFromTree - getCategories based on a tree
1934
+ *
1935
+ * @param {object} tree Root of tree to collect categories from
1936
+ * @return {Array} Array of categories
1937
+ */
1938
+ var getCategoriesFromTree = function (tree) {
1939
+ var categories = [];
1940
+ if (tree.data) {
1941
+ categories.push(tree.data.name);
1942
+ }
1943
+ each(tree.children, function (child) {
1944
+ categories = categories.concat(getCategoriesFromTree(child));
1945
+ });
1946
+ return categories;
1947
+ };
1948
+
1949
+ var mapTickPosToNode = function (node, categories) {
1950
+ var map = {},
1951
+ name = node.data && node.data.name,
1952
+ pos = inArray(name, categories);
1953
+ map[pos] = node;
1954
+ each(node.children, function (child) {
1955
+ extend(map, mapTickPosToNode(child, categories));
1956
+ });
1957
+ return map;
1958
+ };
1959
+
1960
+ var getBreakFromNode = function (node, max) {
1961
+ var from = node.collapseStart,
1962
+ to = node.collapseEnd;
1963
+
1964
+ // In broken-axis, the axis.max is minimized until it is not within a break.
1965
+ // Therefore, if break.to is larger than axis.max, the axis.to should not
1966
+ // add the 0.5 axis.tickMarkOffset, to avoid adding a break larger than
1967
+ // axis.max
1968
+ // TODO consider simplifying broken-axis and this might solve itself
1969
+ if (to >= max) {
1970
+ from -= 0.5;
1971
+ }
1972
+
1973
+ return {
1974
+ from: from,
1975
+ to: to,
1976
+ showPoints: false
1977
+ };
1978
+ };
1979
+
1980
+ /**
1981
+ * Creates a list of positions for the ticks on the axis. Filters out positions
1982
+ * that are outside min and max, or is inside an axis break.
1983
+ *
1984
+ * @param {Object} axis The Axis to get the tick positions from.
1985
+ * @param {number} axis.min The minimum value of the axis.
1986
+ * @param {number} axis.max The maximum value of the axis.
1987
+ * @param {function} axis.isInAnyBreak Function to determine if a position is
1988
+ * inside any breaks on the axis.
1989
+ * @returns {number[]} List of positions.
1990
+ */
1991
+ var getTickPositions = function (axis) {
1992
+ return reduce(
1993
+ keys(axis.mapOfPosToGridNode),
1994
+ function (arr, key) {
1995
+ var pos = +key;
1996
+ if (
1997
+ axis.min <= pos &&
1998
+ axis.max >= pos &&
1999
+ !axis.isInAnyBreak(pos)
2000
+ ) {
2001
+ arr.push(pos);
2002
+ }
2003
+ return arr;
2004
+ },
2005
+ []
2006
+ );
2007
+ };
2008
+ /**
2009
+ * Check if a node is collapsed.
2010
+ * @param {object} axis The axis to check against.
2011
+ * @param {object} node The node to check if is collapsed.
2012
+ * @param {number} pos The tick position to collapse.
2013
+ * @returns {boolean} Returns true if collapsed, false if expanded.
2014
+ */
2015
+ var isCollapsed = function (axis, node) {
2016
+ var breaks = (axis.options.breaks || []),
2017
+ obj = getBreakFromNode(node, axis.max);
2018
+ return some(breaks, function (b) {
2019
+ return b.from === obj.from && b.to === obj.to;
2020
+ });
2021
+ };
2022
+
2023
+ /**
2024
+ * Calculates the new axis breaks to collapse a node.
2025
+ * @param {object} axis The axis to check against.
2026
+ * @param {object} node The node to collapse.
2027
+ * @param {number} pos The tick position to collapse.
2028
+ * @returns {array} Returns an array of the new breaks for the axis.
2029
+ */
2030
+ var collapse = function (axis, node) {
2031
+ var breaks = (axis.options.breaks || []),
2032
+ obj = getBreakFromNode(node, axis.max);
2033
+ breaks.push(obj);
2034
+ return breaks;
2035
+ };
2036
+
2037
+ /**
2038
+ * Calculates the new axis breaks to expand a node.
2039
+ * @param {object} axis The axis to check against.
2040
+ * @param {object} node The node to expand.
2041
+ * @param {number} pos The tick position to expand.
2042
+ * @returns {array} Returns an array of the new breaks for the axis.
2043
+ */
2044
+ var expand = function (axis, node) {
2045
+ var breaks = (axis.options.breaks || []),
2046
+ obj = getBreakFromNode(node, axis.max);
2047
+ // Remove the break from the axis breaks array.
2048
+ return reduce(breaks, function (arr, b) {
2049
+ if (b.to !== obj.to || b.from !== obj.from) {
2050
+ arr.push(b);
2051
+ }
2052
+ return arr;
2053
+ }, []);
2054
+ };
2055
+
2056
+ /**
2057
+ * Calculates the new axis breaks after toggling the collapse/expand state of a
2058
+ * node. If it is collapsed it will be expanded, and if it is exapended it will
2059
+ * be collapsed.
2060
+ * @param {object} axis The axis to check against.
2061
+ * @param {object} node The node to toggle.
2062
+ * @param {number} pos The tick position to toggle.
2063
+ * @returns {array} Returns an array of the new breaks for the axis.
2064
+ */
2065
+ var toggleCollapse = function (axis, node) {
2066
+ return (
2067
+ isCollapsed(axis, node) ?
2068
+ expand(axis, node) :
2069
+ collapse(axis, node)
2070
+ );
2071
+ };
2072
+ var renderLabelIcon = function (tick, params) {
2073
+ var icon = tick.labelIcon,
2074
+ isNew = !icon,
2075
+ renderer = params.renderer,
2076
+ labelBox = params.xy,
2077
+ options = params.options,
2078
+ width = options.width,
2079
+ height = options.height,
2080
+ iconCenter = {
2081
+ x: labelBox.x - (width / 2) - options.padding,
2082
+ y: labelBox.y - (height / 2)
2083
+ },
2084
+ rotation = params.collapsed ? 90 : 180,
2085
+ shouldRender = params.show && H.isNumber(iconCenter.y);
2086
+
2087
+ if (isNew) {
2088
+ tick.labelIcon = icon = renderer.path(renderer.symbols[options.type](
2089
+ options.x,
2090
+ options.y,
2091
+ width,
2092
+ height
2093
+ ))
2094
+ .addClass('highcharts-label-icon')
2095
+ .add(params.group);
2096
+ }
2097
+
2098
+ // Set the new position, and show or hide
2099
+ if (!shouldRender) {
2100
+ icon.attr({ y: -9999 }); // #1338
2101
+ }
2102
+
2103
+
2104
+
2105
+ // Update the icon positions
2106
+ icon[isNew ? 'attr' : 'animate']({
2107
+ translateX: iconCenter.x,
2108
+ translateY: iconCenter.y,
2109
+ rotation: rotation
2110
+ });
2111
+
2112
+ };
2113
+ var onTickHover = function (label) {
2114
+ label.addClass('highcharts-treegrid-node-active');
2115
+
2116
+ };
2117
+ var onTickHoverExit = function (label, options) {
2118
+ var css = defined(options.style) ? options.style : {};
2119
+ label.removeClass('highcharts-treegrid-node-active');
2120
+
2121
+ };
2122
+
2123
+ /**
2124
+ * Creates a tree structure of the data, and the treegrid. Calculates
2125
+ * categories, and y-values of points based on the tree.
2126
+ * @param {Array} data All the data points to display in the axis.
2127
+ * @param {boolean} uniqueNames Wether or not the data node with the same name
2128
+ * should share grid cell. If true they do share cell. False by default.
2129
+ * @returns {object} Returns an object containing categories, mapOfIdToNode,
2130
+ * mapOfPosToGridNode, and tree.
2131
+ * @todo There should be only one point per line.
2132
+ * @todo It should be optional to have one category per point, or merge cells
2133
+ * @todo Add unit-tests.
2134
+ */
2135
+ var getTreeGridFromData = function (data, uniqueNames, numberOfSeries) {
2136
+ var categories = [],
2137
+ collapsedNodes = [],
2138
+ mapOfIdToNode = {},
2139
+ mapOfPosToGridNode = {},
2140
+ posIterator = -1,
2141
+ uniqueNamesEnabled = isBoolean(uniqueNames) ? uniqueNames : false,
2142
+ tree,
2143
+ treeParams,
2144
+ updateYValuesAndTickPos;
2145
+
2146
+ // Build the tree from the series data.
2147
+ treeParams = {
2148
+ // After the children has been created.
2149
+ after: function (node) {
2150
+ var gridNode = mapOfPosToGridNode[node.pos],
2151
+ height = 0,
2152
+ descendants = 0;
2153
+ each(gridNode.children, function (child) {
2154
+ descendants += child.descendants + 1;
2155
+ height = Math.max(child.height + 1, height);
2156
+ });
2157
+ gridNode.descendants = descendants;
2158
+ gridNode.height = height;
2159
+ if (gridNode.collapsed) {
2160
+ collapsedNodes.push(gridNode);
2161
+ }
2162
+ },
2163
+ // Before the children has been created.
2164
+ before: function (node) {
2165
+ var data = isObject(node.data) ? node.data : {},
2166
+ name = isString(data.name) ? data.name : '',
2167
+ parentNode = mapOfIdToNode[node.parent],
2168
+ parentGridNode = (
2169
+ isObject(parentNode) ?
2170
+ mapOfPosToGridNode[parentNode.pos] :
2171
+ null
2172
+ ),
2173
+ hasSameName = function (x) {
2174
+ return x.name === name;
2175
+ },
2176
+ gridNode,
2177
+ pos;
2178
+
2179
+ // If not unique names, look for a sibling node with the same name.
2180
+ if (
2181
+ uniqueNamesEnabled &&
2182
+ isObject(parentGridNode) &&
2183
+ !!(gridNode = find(parentGridNode.children, hasSameName))
2184
+ ) {
2185
+ // If if there is a gridNode with the same name, reuse position.
2186
+ pos = gridNode.pos;
2187
+ // Add data node to list of nodes in the grid node.
2188
+ gridNode.nodes.push(node);
2189
+ } else {
2190
+ // If it is a new grid node, increment position.
2191
+ pos = posIterator++;
2192
+ }
2193
+
2194
+ // Add new grid node to map.
2195
+ if (!mapOfPosToGridNode[pos]) {
2196
+ mapOfPosToGridNode[pos] = gridNode = {
2197
+ depth: parentGridNode ? parentGridNode.depth + 1 : 0,
2198
+ name: name,
2199
+ nodes: [node],
2200
+ children: [],
2201
+ pos: pos
2202
+ };
2203
+
2204
+ // If not root, then add name to categories.
2205
+ if (pos !== -1) {
2206
+ categories.push(name);
2207
+ }
2208
+
2209
+ // Add name to list of children.
2210
+ if (isObject(parentGridNode)) {
2211
+ parentGridNode.children.push(gridNode);
2212
+ }
2213
+ }
2214
+
2215
+ // Add data node to map
2216
+ if (isString(node.id)) {
2217
+ mapOfIdToNode[node.id] = node;
2218
+ }
2219
+
2220
+ // If one of the points are collapsed, then start the grid node in
2221
+ // collapsed state.
2222
+ if (data.collapsed === true) {
2223
+ gridNode.collapsed = true;
2224
+ }
2225
+
2226
+ // Assign pos to data node
2227
+ node.pos = pos;
2228
+ }
2229
+ };
2230
+
2231
+ updateYValuesAndTickPos = function (map, numberOfSeries) {
2232
+ var setValues = function (gridNode, start, result) {
2233
+ var nodes = gridNode.nodes,
2234
+ end = start + (start === -1 ? 0 : numberOfSeries - 1),
2235
+ diff = (end - start) / 2,
2236
+ padding = 0.5,
2237
+ pos = start + diff;
2238
+
2239
+ each(nodes, function (node) {
2240
+ var data = node.data;
2241
+ if (isObject(data)) {
2242
+ // Update point
2243
+ data.y = start + data.seriesIndex;
2244
+ // Remove the property once used
2245
+ delete data.seriesIndex;
2246
+ }
2247
+ node.pos = pos;
2248
+ });
2249
+
2250
+ result[pos] = gridNode;
2251
+
2252
+ gridNode.pos = pos;
2253
+ gridNode.tickmarkOffset = diff + padding;
2254
+ gridNode.collapseStart = end + padding;
2255
+
2256
+
2257
+ each(gridNode.children, function (child) {
2258
+ setValues(child, end + 1, result);
2259
+ end = child.collapseEnd - padding;
2260
+ });
2261
+ // Set collapseEnd to the end of the last child node.
2262
+ gridNode.collapseEnd = end + padding;
2263
+
2264
+ return result;
2265
+ };
2266
+
2267
+ return setValues(map['-1'], -1, {});
2268
+ };
2269
+
2270
+ // Create tree from data
2271
+ tree = Tree.getTree(data, treeParams);
2272
+
2273
+ // Update y values of data, and set calculate tick positions.
2274
+ mapOfPosToGridNode = updateYValuesAndTickPos(
2275
+ mapOfPosToGridNode,
2276
+ numberOfSeries
2277
+ );
2278
+
2279
+ // Return the resulting data.
2280
+ return {
2281
+ categories: categories,
2282
+ mapOfIdToNode: mapOfIdToNode,
2283
+ mapOfPosToGridNode: mapOfPosToGridNode,
2284
+ collapsedNodes: collapsedNodes,
2285
+ tree: tree
2286
+ };
2287
+ };
2288
+
2289
+ override(GridAxis.prototype, {
2290
+ init: function (proceed, chart, userOptions) {
2291
+ var axis = this,
2292
+ removeFoundExtremesEvent,
2293
+ isTreeGrid = userOptions.type === 'treegrid';
2294
+ // Set default and forced options for TreeGrid
2295
+ if (isTreeGrid) {
2296
+ userOptions = merge({
2297
+ // Default options
2298
+ grid: {
2299
+ enabled: true
2300
+ },
2301
+ // TODO: add support for align in treegrid.
2302
+ labels: {
2303
+ align: 'left',
2304
+
2305
+ /**
2306
+ * Set options on specific levels in a tree grid axis. Takes
2307
+ * precedence over labels options.
2308
+ *
2309
+ * @product gantt
2310
+ * @sample {gantt} gantt/treegrid-axis/labels-levels
2311
+ * Levels on TreeGrid Labels
2312
+ * @type {Array<Object>}
2313
+ * @apioption yAxis.labels.levels
2314
+ */
2315
+ levels: [{
2316
+ /**
2317
+ * Specify the level which the options within this object
2318
+ * applies to.
2319
+ *
2320
+ * @sample {gantt} gantt/treegrid-axis/labels-levels
2321
+ */
2322
+ level: undefined
2323
+ }, {
2324
+ level: 1,
2325
+ style: {
2326
+ fontWeight: 'bold'
2327
+ }
2328
+ }],
2329
+
2330
+ /**
2331
+ * The symbol for the collapse and expand icon in a
2332
+ * treegrid.
2333
+ *
2334
+ * @product gantt
2335
+ * @optionparent yAxis.labels.symbol
2336
+ */
2337
+ symbol: {
2338
+ /**
2339
+ * The symbol type. Points to a definition function in
2340
+ * the `Highcharts.Renderer.symbols` collection.
2341
+ *
2342
+ * @validvalue ['arc', 'circle', 'diamond', 'square', 'triangle', 'triangle-down']
2343
+ */
2344
+ type: 'triangle',
2345
+ x: -5,
2346
+ y: -5,
2347
+ height: 10,
2348
+ width: 10,
2349
+ padding: 5
2350
+ }
2351
+ },
2352
+ uniqueNames: false
2353
+
2354
+ }, userOptions, { // User options
2355
+ // Forced options
2356
+ reversed: true,
2357
+ // grid.columns is not supported in treegrid
2358
+ grid: {
2359
+ columns: undefined
2360
+ }
2361
+ });
2362
+ }
2363
+
2364
+ // Now apply the original function with the original arguments,
2365
+ // which are sliced off this function's arguments
2366
+ proceed.apply(axis, [chart, userOptions]);
2367
+ if (isTreeGrid) {
2368
+ H.addEvent(axis.chart, 'beforeRender', function () {
2369
+ var labelOptions = axis.options && axis.options.labels;
2370
+
2371
+ // beforeRender is fired after all the series is initialized,
2372
+ // which is an ideal time to update the axis.categories.
2373
+ axis.updateYNames();
2374
+
2375
+ // Update yData now that we have calculated the y values
2376
+ // TODO: it would be better to be able to calculate y values
2377
+ // before Series.setData
2378
+ each(axis.series, function (series) {
2379
+ series.yData = map(series.options.data, function (data) {
2380
+ return data.y;
2381
+ });
2382
+ });
2383
+
2384
+ // Calculate the label options for each level in the tree.
2385
+ axis.mapOptionsToLevel = getLevelOptions({
2386
+ defaults: labelOptions,
2387
+ from: 1,
2388
+ levels: labelOptions.levels,
2389
+ to: axis.tree.height
2390
+ });
2391
+
2392
+ // Collapse all the nodes belonging to a point where collapsed
2393
+ // equals true.
2394
+ // Can be called from beforeRender, if getBreakFromNode removes
2395
+ // its dependency on axis.max.
2396
+ removeFoundExtremesEvent =
2397
+ H.addEvent(axis, 'foundExtremes', function () {
2398
+ each(axis.collapsedNodes, function (node) {
2399
+ var breaks = collapse(axis, node);
2400
+ axis.setBreaks(breaks, false);
2401
+ });
2402
+ removeFoundExtremesEvent();
2403
+ });
2404
+ });
2405
+ axis.hasNames = true;
2406
+ axis.options.showLastLabel = true;
2407
+ }
2408
+ },
2409
+ /**
2410
+ * Override to add indentation to axis.maxLabelDimensions.
2411
+ * @param {Function} proceed the original function
2412
+ * @returns {undefined}
2413
+ */
2414
+ getMaxLabelDimensions: function (proceed) {
2415
+ var axis = this,
2416
+ options = axis.options,
2417
+ labelOptions = options && options.labels,
2418
+ indentation = (
2419
+ labelOptions && isNumber(labelOptions.indentation) ?
2420
+ options.labels.indentation :
2421
+ 0
2422
+ ),
2423
+ retVal = proceed.apply(axis, argsToArray(arguments)),
2424
+ isTreeGrid = axis.options.type === 'treegrid',
2425
+ treeDepth;
2426
+
2427
+ if (isTreeGrid) {
2428
+ treeDepth = axis.mapOfPosToGridNode[-1].height;
2429
+ retVal.width += indentation * (treeDepth - 1);
2430
+ }
2431
+
2432
+ return retVal;
2433
+ },
2434
+ /**
2435
+ * Generates a tick for initial positioning.
2436
+ *
2437
+ * @private
2438
+ * @param {function} proceed The original generateTick function.
2439
+ * @param {number} pos The tick position in axis values.
2440
+ */
2441
+ generateTick: function (proceed, pos) {
2442
+ var axis = this,
2443
+ mapOptionsToLevel = (
2444
+ isObject(axis.mapOptionsToLevel) ? axis.mapOptionsToLevel : {}
2445
+ ),
2446
+ isTreeGrid = axis.options.type === 'treegrid',
2447
+ ticks = axis.ticks,
2448
+ tick = ticks[pos],
2449
+ levelOptions,
2450
+ options,
2451
+ gridNode;
2452
+
2453
+ if (isTreeGrid) {
2454
+ gridNode = axis.mapOfPosToGridNode[pos];
2455
+ levelOptions = mapOptionsToLevel[gridNode.depth];
2456
+
2457
+ if (levelOptions) {
2458
+ options = {
2459
+ labels: levelOptions
2460
+ };
2461
+ }
2462
+
2463
+ if (!tick) {
2464
+ ticks[pos] = tick =
2465
+ new GridAxisTick(axis, pos, null, undefined, {
2466
+ category: gridNode.name,
2467
+ tickmarkOffset: gridNode.tickmarkOffset,
2468
+ options: options
2469
+ });
2470
+ } else {
2471
+ // update labels depending on tick interval
2472
+ tick.parameters.category = gridNode.name;
2473
+ tick.options = options;
2474
+ tick.addLabel();
2475
+ }
2476
+ } else {
2477
+ proceed.apply(axis, argsToArray(arguments));
2478
+ }
2479
+ },
2480
+ /**
2481
+ * Set the tick positions, tickInterval, axis min and max.
2482
+ *
2483
+ * @private
2484
+ */
2485
+ setTickInterval: function (proceed) {
2486
+ var axis = this,
2487
+ options = axis.options,
2488
+ isTreeGrid = options.type === 'treegrid';
2489
+
2490
+ if (isTreeGrid) {
2491
+ axis.min = pick(axis.userMin, options.min, axis.dataMin);
2492
+ axis.max = pick(axis.userMax, options.max, axis.dataMax);
2493
+
2494
+ fireEvent(axis, 'foundExtremes');
2495
+
2496
+ // setAxisTranslation modifies the min and max according to
2497
+ // axis breaks.
2498
+ axis.setAxisTranslation(true);
2499
+
2500
+ axis.tickmarkOffset = 0.5;
2501
+ axis.tickInterval = 1;
2502
+ axis.tickPositions = getTickPositions(axis);
2503
+ } else {
2504
+ proceed.apply(axis, argsToArray(arguments));
2505
+ }
2506
+ }
2507
+ });
2508
+ override(GridAxisTick.prototype, {
2509
+ getLabelPosition: function (
2510
+ proceed,
2511
+ x,
2512
+ y,
2513
+ label,
2514
+ horiz,
2515
+ labelOptions,
2516
+ tickmarkOffset,
2517
+ index,
2518
+ step
2519
+ ) {
2520
+ var tick = this,
2521
+ lbOptions = pick(
2522
+ tick.options && tick.options.labels,
2523
+ labelOptions
2524
+ ),
2525
+ pos = tick.pos,
2526
+ axis = tick.axis,
2527
+ options = axis.options,
2528
+ isTreeGrid = options.type === 'treegrid',
2529
+ result = proceed.apply(
2530
+ tick,
2531
+ [x, y, label, horiz, lbOptions, tickmarkOffset, index, step]
2532
+ ),
2533
+ symbolOptions,
2534
+ indentation,
2535
+ mapOfPosToGridNode,
2536
+ node,
2537
+ level;
2538
+
2539
+ if (isTreeGrid) {
2540
+ symbolOptions = (
2541
+ lbOptions && isObject(lbOptions.symbol) ?
2542
+ lbOptions.symbol :
2543
+ {}
2544
+ );
2545
+ indentation = (
2546
+ lbOptions && isNumber(lbOptions.indentation) ?
2547
+ lbOptions.indentation :
2548
+ 0
2549
+ );
2550
+ mapOfPosToGridNode = axis.mapOfPosToGridNode;
2551
+ node = mapOfPosToGridNode && mapOfPosToGridNode[pos];
2552
+ level = (node && node.depth) || 1;
2553
+ result.x += (
2554
+ // Add space for symbols
2555
+ ((symbolOptions.width) + (symbolOptions.padding * 2)) +
2556
+ // Apply indentation
2557
+ ((level - 1) * indentation)
2558
+ );
2559
+ }
2560
+
2561
+ return result;
2562
+ },
2563
+ renderLabel: function (proceed) {
2564
+ var tick = this,
2565
+ pos = tick.pos,
2566
+ axis = tick.axis,
2567
+ label = tick.label,
2568
+ mapOfPosToGridNode = axis.mapOfPosToGridNode,
2569
+ options = axis.options,
2570
+ labelOptions = pick(
2571
+ tick.options && tick.options.labels,
2572
+ options && options.labels
2573
+ ),
2574
+ symbolOptions = (
2575
+ labelOptions && isObject(labelOptions.symbol) ?
2576
+ labelOptions.symbol :
2577
+ {}
2578
+ ),
2579
+ node = mapOfPosToGridNode && mapOfPosToGridNode[pos],
2580
+ level = node && node.depth,
2581
+ isTreeGrid = options.type === 'treegrid',
2582
+ hasLabel = !!(label && label.element),
2583
+ shouldRender = inArray(pos, axis.tickPositions) > -1,
2584
+ prefixClassName = 'highcharts-treegrid-node-',
2585
+ collapsed,
2586
+ addClassName,
2587
+ removeClassName;
2588
+
2589
+ if (isTreeGrid && node) {
2590
+ // Add class name for hierarchical styling.
2591
+ if (hasLabel) {
2592
+ label.addClass(prefixClassName + 'level-' + level);
2593
+ }
2594
+ }
2595
+
2596
+ proceed.apply(tick, argsToArray(arguments));
2597
+
2598
+ if (isTreeGrid && node && hasLabel && node.descendants > 0) {
2599
+ collapsed = isCollapsed(axis, node);
2600
+
2601
+ renderLabelIcon(
2602
+ tick,
2603
+ {
2604
+
2605
+ collapsed: collapsed,
2606
+ group: label.parentGroup,
2607
+ options: symbolOptions,
2608
+ renderer: label.renderer,
2609
+ show: shouldRender,
2610
+ xy: label.xy
2611
+ }
2612
+ );
2613
+
2614
+ // Add class name for the node.
2615
+ addClassName = prefixClassName +
2616
+ (collapsed ? 'collapsed' : 'expanded');
2617
+ removeClassName = prefixClassName +
2618
+ (collapsed ? 'expanded' : 'collapsed');
2619
+
2620
+ label
2621
+ .addClass(addClassName)
2622
+ .removeClass(removeClassName);
2623
+
2624
+
2625
+
2626
+ // Add events to both label text and icon
2627
+ each([label, tick.labelIcon], function (object) {
2628
+ if (!object.attachedTreeGridEvents) {
2629
+ // On hover
2630
+ H.addEvent(object.element, 'mouseover', function () {
2631
+ onTickHover(label);
2632
+ });
2633
+
2634
+ // On hover out
2635
+ H.addEvent(object.element, 'mouseout', function () {
2636
+ onTickHoverExit(label, labelOptions);
2637
+ });
2638
+
2639
+ H.addEvent(object.element, 'click', function () {
2640
+ tick.toggleCollapse();
2641
+ });
2642
+ object.attachedTreeGridEvents = true;
2643
+ }
2644
+ });
2645
+ }
2646
+ }
2647
+ });
2648
+
2649
+ extend(GridAxisTick.prototype, /** @lends Highcharts.Tick.prototype */{
2650
+ /**
2651
+ * Collapse the grid cell. Used when axis is of type treegrid.
2652
+ * @param {boolean} [redraw=true] Whether to redraw the chart or wait for
2653
+ * an explicit call to {@link Highcharts.Chart#redraw}
2654
+ * @sample {gantt} gantt/treegrid-axis/collapsed-dynamically/demo.js
2655
+ * Dynamically collapse
2656
+ */
2657
+ collapse: function (redraw) {
2658
+ var tick = this,
2659
+ axis = tick.axis,
2660
+ pos = tick.pos,
2661
+ node = axis.mapOfPosToGridNode[pos],
2662
+ breaks = collapse(axis, node);
2663
+ axis.setBreaks(breaks, pick(redraw, true));
2664
+ },
2665
+ /**
2666
+ * Expand the grid cell. Used when axis is of type treegrid.
2667
+ *
2668
+ * @param {boolean} [redraw=true] Whether to redraw the chart or wait for
2669
+ * an explicit call to {@link Highcharts.Chart#redraw}
2670
+ * @sample {gantt} gantt/treegrid-axis/collapsed-dynamically/demo.js
2671
+ * Dynamically collapse
2672
+ */
2673
+ expand: function (redraw) {
2674
+ var tick = this,
2675
+ axis = tick.axis,
2676
+ pos = tick.pos,
2677
+ node = axis.mapOfPosToGridNode[pos],
2678
+ breaks = expand(axis, node);
2679
+ axis.setBreaks(breaks, pick(redraw, true));
2680
+ },
2681
+ /**
2682
+ * Toggle the collapse/expand state of the grid cell. Used when axis is of
2683
+ * type treegrid.
2684
+ *
2685
+ * @param {boolean} [redraw=true] Whether to redraw the chart or wait for
2686
+ * an explicit call to {@link Highcharts.Chart#redraw}
2687
+ * @sample {gantt} gantt/treegrid-axis/collapsed-dynamically/demo.js
2688
+ * Dynamically collapse
2689
+ */
2690
+ toggleCollapse: function (redraw) {
2691
+ var tick = this,
2692
+ axis = tick.axis,
2693
+ pos = tick.pos,
2694
+ node = axis.mapOfPosToGridNode[pos],
2695
+ breaks = toggleCollapse(axis, node);
2696
+ axis.setBreaks(breaks, pick(redraw, true));
2697
+ }
2698
+ });
2699
+
2700
+ GridAxis.prototype.updateYNames = function () {
2701
+ var axis = this,
2702
+ options = axis.options,
2703
+ isTreeGrid = options.type === 'treegrid',
2704
+ uniqueNames = options.uniqueNames,
2705
+ isYAxis = !axis.isXAxis,
2706
+ series = axis.series,
2707
+ numberOfSeries = 0,
2708
+ treeGrid,
2709
+ data;
2710
+
2711
+ if (isTreeGrid && isYAxis) {
2712
+ // Concatenate data from all series assigned to this axis.
2713
+ data = reduce(series, function (arr, s) {
2714
+ if (s.visible) {
2715
+ // Push all data to array
2716
+ each(s.options.data, function (data) {
2717
+ if (isObject(data)) {
2718
+ // Set series index on data. Removed again after use.
2719
+ data.seriesIndex = numberOfSeries;
2720
+ arr.push(data);
2721
+ }
2722
+ });
2723
+
2724
+ // Increment series index
2725
+ if (uniqueNames === true) {
2726
+ numberOfSeries++;
2727
+ }
2728
+ }
2729
+ return arr;
2730
+ }, []);
2731
+
2732
+ // Calculate categories and the hierarchy for the grid.
2733
+ treeGrid = getTreeGridFromData(
2734
+ data,
2735
+ uniqueNames,
2736
+ (uniqueNames === true) ? numberOfSeries : 1
2737
+ );
2738
+
2739
+ // Assign values to the axis.
2740
+ axis.categories = treeGrid.categories;
2741
+ axis.mapOfPosToGridNode = treeGrid.mapOfPosToGridNode;
2742
+ // Used on init to start a node as collapsed
2743
+ axis.collapsedNodes = treeGrid.collapsedNodes;
2744
+ axis.hasNames = true;
2745
+ axis.tree = treeGrid.tree;
2746
+ }
2747
+ };
2748
+
2749
+ // Make utility functions available for testing.
2750
+ GridAxis.prototype.utils = {
2751
+ getNode: Tree.getNode
2752
+ };
2753
+
2754
+ }(Highcharts, Tree, result));
2755
+ return (function () {
2756
+
2757
+
2758
+ }());
2759
+ }));