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,2257 @@
1
+ /**
2
+ * (c) 2009-2018 Highsoft AS
3
+ * Authors: Øystein Moseng, Torstein Hønsi, Jon A. Nygård
4
+ *
5
+ * License: www.highcharts.com/license
6
+ */
7
+ 'use strict';
8
+ import H from '../parts/Globals.js';
9
+ import '../parts/Utilities.js';
10
+
11
+ var addEvent = H.addEvent,
12
+ each = H.each,
13
+ objectEach = H.objectEach,
14
+ pick = H.pick,
15
+ filter = H.grep,
16
+ merge = H.merge,
17
+ seriesTypes = H.seriesTypes;
18
+
19
+
20
+ /*
21
+ Add drag/drop support to specific data props for different series types.
22
+
23
+ The dragDrop.draggableX/Y user options on series enable/disable all of these
24
+ per direction unless they are specifically set in options using
25
+ dragDrop.{optionName}. If the prop does not specify an optionName here, it
26
+ can only be enabled/disabled by the user with draggableX/Y.
27
+
28
+ Supported options for each prop:
29
+ optionName: User option in series.dragDrop that enables/disables
30
+ dragging this prop.
31
+ axis: Can be 'x' or 'y'. Whether this prop is linked to x or y axis.
32
+ move: Whether or not this prop should be updated when moving points.
33
+ resize: Whether or not to draw a drag handle and allow user to drag and
34
+ update this prop by itself.
35
+ beforeResize: Hook to perform tasks before a resize is made. Gets
36
+ the guide box, the new points values, and the point as args.
37
+ resizeSide: Which side of the guide box to resize when dragging the
38
+ handle. Can be "left", "right", "top", "bottom". Chart.inverted is
39
+ handled automatically. Can also be a function, taking the new point
40
+ values as parameter, as well as the point, and returning a string
41
+ with the side.
42
+ propValidate: Function that takes the prop value and the point as
43
+ arguments, and returns true if the prop value is valid, false if
44
+ not. It is used to prevent e.g. resizing "low" above "high".
45
+ handlePositioner: For resizeable props, return 0,0 in SVG plot coords of
46
+ where to place the dragHandle. Gets point as argument. Should return
47
+ object with x and y properties.
48
+ handleFormatter: For resizeable props, return the path of the drag
49
+ handle as an SVG path array. Gets the point as argument. The handle
50
+ is translated according to handlePositioner.
51
+ handleOptions: Options to merge with the default handle options.
52
+
53
+ TODO:
54
+ - It makes sense to have support for resizing the size of bubbles and
55
+ e.g variwide columns. This requires us to support dragging along a
56
+ z-axis, somehow computing a relative value from old to new pixel
57
+ size.
58
+ - Moving maps could be useful, although we would have to compute new
59
+ point.path values in order to do it properly (using SVG translate
60
+ is easier, but won't update the data).
61
+ */
62
+
63
+ // 90deg rotated column handle path, used in multiple series types
64
+ var horizHandleFormatter = function (point) {
65
+ var shapeArgs = point.shapeArgs || point.graphic.getBBox(),
66
+ top = shapeArgs.r || 0, // Rounding of bar corners
67
+ bottom = shapeArgs.height - top,
68
+ centerY = shapeArgs.height / 2;
69
+ return [
70
+ // Top wick
71
+ 'M', 0, top,
72
+ 'L', 0, centerY - 5,
73
+ // Circle
74
+ 'A', 1, 1, 0, 0, 0, 0, centerY + 5,
75
+ 'A', 1, 1, 0, 0, 0, 0, centerY - 5,
76
+ // Bottom wick
77
+ 'M', 0, centerY + 5,
78
+ 'L', 0, bottom
79
+ ];
80
+ };
81
+
82
+ // Line series - only draggableX/Y, no drag handles
83
+ var lineDragDropProps = seriesTypes.line.prototype.dragDropProps = {
84
+ x: {
85
+ axis: 'x',
86
+ move: true
87
+ },
88
+ y: {
89
+ axis: 'y',
90
+ move: true
91
+ }
92
+ };
93
+
94
+ // Flag series - same as line/scatter
95
+ if (seriesTypes.flags) {
96
+ seriesTypes.flags.prototype.dragDropProps = lineDragDropProps;
97
+ }
98
+
99
+ // Column series - x can be moved, y can only be resized. Note extra
100
+ // functionality for handling upside down columns (below threshold).
101
+ var columnDragDropProps = seriesTypes.column.prototype.dragDropProps = {
102
+ x: {
103
+ axis: 'x',
104
+ move: true
105
+ },
106
+ y: {
107
+ axis: 'y',
108
+ move: false,
109
+ resize: true,
110
+ // Force guideBox start coordinates
111
+ beforeResize: function (guideBox, pointVals, point) {
112
+ // We need to ensure that guideBox always starts at threshold.
113
+ // We flip whether or not we update the top or bottom of the guide
114
+ // box at threshold, but if we drag the mouse fast, the top has not
115
+ // reached threshold before we cross over and update the bottom.
116
+ var threshold = point.series.translatedThreshold,
117
+ y = guideBox.attr('y'),
118
+ height,
119
+ diff;
120
+ if (pointVals.y >= point.series.options.threshold || 0) {
121
+ // Above threshold - always set height to hit the threshold
122
+ height = guideBox.attr('height');
123
+ diff = threshold ? threshold - (y + height) : 0;
124
+ guideBox.attr({
125
+ height: Math.max(0, Math.round(height + diff))
126
+ });
127
+ } else {
128
+ // Below - always set y to start at threshold
129
+ guideBox.attr({
130
+ y: Math.round(y + (threshold ? threshold - y : 0))
131
+ });
132
+ }
133
+ },
134
+ // Flip the side of the resize handle if column is below threshold
135
+ resizeSide: function (pointVals, point) {
136
+ return pointVals.y >= (point.series.options.threshold || 0) ?
137
+ 'top' : 'bottom';
138
+ },
139
+ // Position handle at bottom if column is below threshold
140
+ handlePositioner: function (point) {
141
+ var bBox = point.shapeArgs || point.graphic.getBBox();
142
+ return {
143
+ x: bBox.x,
144
+ y: point.y >= (point.series.options.threshold || 0) ?
145
+ bBox.y : bBox.y + bBox.height
146
+ };
147
+ },
148
+ // Horizontal handle
149
+ handleFormatter: function (point) {
150
+ var shapeArgs = point.shapeArgs,
151
+ radius = shapeArgs.r || 0, // Rounding of bar corners
152
+ centerX = shapeArgs.width / 2;
153
+ return [
154
+ // Left wick
155
+ 'M', radius, 0,
156
+ 'L', centerX - 5, 0,
157
+ // Circle
158
+ 'A', 1, 1, 0, 0, 0, centerX + 5, 0,
159
+ 'A', 1, 1, 0, 0, 0, centerX - 5, 0,
160
+ // Right wick
161
+ 'M', centerX + 5, 0,
162
+ 'L', shapeArgs.width - radius, 0
163
+ ];
164
+ }
165
+ }
166
+ };
167
+
168
+ // Bullet graph, x/y same as column, but also allow target to be dragged.
169
+ if (seriesTypes.bullet) {
170
+ seriesTypes.bullet.prototype.dragDropProps = {
171
+ x: columnDragDropProps.x,
172
+ y: columnDragDropProps.y,
173
+ target: {
174
+ /**
175
+ * Allow target value to be dragged individually. Requires
176
+ * `draggable-points` module.
177
+ *
178
+ * @type {boolean}
179
+ * @default true
180
+ * @apioption plotOptions.bullet.dragDrop.draggableTarget
181
+ */
182
+ optionName: 'draggableTarget',
183
+ axis: 'y',
184
+ move: true,
185
+ resize: true,
186
+ resizeSide: 'top',
187
+ handlePositioner: function (point) {
188
+ var bBox = point.targetGraphic.getBBox();
189
+ return {
190
+ x: point.barX,
191
+ y: bBox.y + bBox.height / 2
192
+ };
193
+ },
194
+ handleFormatter: columnDragDropProps.y.handleFormatter
195
+ }
196
+ };
197
+ }
198
+
199
+ // Columnrange series - move x, resize or move low/high
200
+ if (seriesTypes.columnrange) {
201
+ seriesTypes.columnrange.prototype.dragDropProps = {
202
+ x: {
203
+ axis: 'x',
204
+ move: true
205
+ },
206
+ low: {
207
+ /**
208
+ * Allow low value to be dragged individually. Requires
209
+ * `draggable-points` module.
210
+ *
211
+ * @type {boolean}
212
+ * @default true
213
+ * @apioption plotOptions.columnrange.dragDrop.draggableLow
214
+ */
215
+ optionName: 'draggableLow',
216
+ axis: 'y',
217
+ move: true,
218
+ resize: true,
219
+ resizeSide: 'bottom',
220
+ handlePositioner: function (point) {
221
+ var bBox = point.shapeArgs || point.graphic.getBBox();
222
+ return {
223
+ x: bBox.x,
224
+ y: bBox.y + bBox.height
225
+ };
226
+ },
227
+ handleFormatter: columnDragDropProps.y.handleFormatter,
228
+ propValidate: function (val, point) {
229
+ return val <= point.high;
230
+ }
231
+ },
232
+ high: {
233
+ /**
234
+ * Allow high value to be dragged individually. Requires
235
+ * `draggable-points` module.
236
+ *
237
+ * @type {boolean}
238
+ * @default true
239
+ * @apioption plotOptions.columnrange.dragDrop.draggableHigh
240
+ */
241
+ optionName: 'draggableHigh',
242
+ axis: 'y',
243
+ move: true,
244
+ resize: true,
245
+ resizeSide: 'top',
246
+ handlePositioner: function (point) {
247
+ var bBox = point.shapeArgs || point.graphic.getBBox();
248
+ return {
249
+ x: bBox.x,
250
+ y: bBox.y
251
+ };
252
+ },
253
+ handleFormatter: columnDragDropProps.y.handleFormatter,
254
+ propValidate: function (val, point) {
255
+ return val >= point.low;
256
+ }
257
+ }
258
+ };
259
+ }
260
+
261
+ // Boxplot series - move x, resize or move low/q1/q3/high
262
+ if (seriesTypes.boxplot) {
263
+ seriesTypes.boxplot.prototype.dragDropProps = {
264
+ x: columnDragDropProps.x,
265
+ low: {
266
+ /**
267
+ * Allow low value to be dragged individually. Requires
268
+ * `draggable-points` module.
269
+ *
270
+ * @type {boolean}
271
+ * @default true
272
+ * @apioption plotOptions.boxplot.dragDrop.draggableLow
273
+ */
274
+ optionName: 'draggableLow',
275
+ axis: 'y',
276
+ move: true,
277
+ resize: true,
278
+ resizeSide: 'bottom',
279
+ handlePositioner: function (point) {
280
+ return {
281
+ x: point.shapeArgs.x,
282
+ y: point.lowPlot
283
+ };
284
+ },
285
+ handleFormatter: columnDragDropProps.y.handleFormatter,
286
+ propValidate: function (val, point) {
287
+ return val <= point.q1;
288
+ }
289
+ },
290
+ q1: {
291
+ /**
292
+ * Allow Q1 value to be dragged individually. Requires
293
+ * `draggable-points` module.
294
+ *
295
+ * @type {boolean}
296
+ * @default true
297
+ * @apioption plotOptions.boxplot.dragDrop.draggableQ1
298
+ */
299
+ optionName: 'draggableQ1',
300
+ axis: 'y',
301
+ move: true,
302
+ resize: true,
303
+ resizeSide: 'bottom',
304
+ handlePositioner: function (point) {
305
+ return {
306
+ x: point.shapeArgs.x,
307
+ y: point.q1Plot
308
+ };
309
+ },
310
+ handleFormatter: columnDragDropProps.y.handleFormatter,
311
+ propValidate: function (val, point) {
312
+ return val <= point.median && val >= point.low;
313
+ }
314
+ },
315
+ median: {
316
+ // Median can not be dragged individually, just move the whole
317
+ // point for this.
318
+ axis: 'y',
319
+ move: true
320
+ },
321
+ q3: {
322
+ /**
323
+ * Allow Q3 value to be dragged individually. Requires
324
+ * `draggable-points` module.
325
+ *
326
+ * @type {boolean}
327
+ * @default true
328
+ * @apioption plotOptions.boxplot.dragDrop.draggableQ3
329
+ */
330
+ optionName: 'draggableQ3',
331
+ axis: 'y',
332
+ move: true,
333
+ resize: true,
334
+ resizeSide: 'top',
335
+ handlePositioner: function (point) {
336
+ return {
337
+ x: point.shapeArgs.x,
338
+ y: point.q3Plot
339
+ };
340
+ },
341
+ handleFormatter: columnDragDropProps.y.handleFormatter,
342
+ propValidate: function (val, point) {
343
+ return val <= point.high && val >= point.median;
344
+ }
345
+ },
346
+ /**
347
+ * Allow high value to be dragged individually. Requires
348
+ * `draggable-points` module.
349
+ *
350
+ * @type {boolean}
351
+ * @default true
352
+ * @apioption plotOptions.boxplot.dragDrop.draggableHigh
353
+ */
354
+ high: {
355
+ optionName: 'draggableHigh',
356
+ axis: 'y',
357
+ move: true,
358
+ resize: true,
359
+ resizeSide: 'top',
360
+ handlePositioner: function (point) {
361
+ return {
362
+ x: point.shapeArgs.x,
363
+ y: point.highPlot
364
+ };
365
+ },
366
+ handleFormatter: columnDragDropProps.y.handleFormatter,
367
+ propValidate: function (val, point) {
368
+ return val >= point.q3;
369
+ }
370
+ }
371
+ };
372
+ }
373
+
374
+
375
+ // OHLC series - move x, resize or move open/high/low/close
376
+ if (seriesTypes.ohlc) {
377
+ seriesTypes.ohlc.prototype.dragDropProps = {
378
+ x: columnDragDropProps.x,
379
+ low: {
380
+ /**
381
+ * Allow low value to be dragged individually. Requires
382
+ * `draggable-points` module.
383
+ *
384
+ * @type {boolean}
385
+ * @default true
386
+ * @apioption plotOptions.ohlc.dragDrop.draggableLow
387
+ */
388
+ optionName: 'draggableLow',
389
+ axis: 'y',
390
+ move: true,
391
+ resize: true,
392
+ resizeSide: 'bottom',
393
+ handlePositioner: function (point) {
394
+ return {
395
+ x: point.shapeArgs.x,
396
+ y: point.plotLow
397
+ };
398
+ },
399
+ handleFormatter: columnDragDropProps.y.handleFormatter,
400
+ propValidate: function (val, point) {
401
+ return val <= point.open && val <= point.close;
402
+ }
403
+ },
404
+ high: {
405
+ /**
406
+ * Allow high value to be dragged individually. Requires
407
+ * `draggable-points` module.
408
+ *
409
+ * @type {boolean}
410
+ * @default true
411
+ * @apioption plotOptions.ohlc.dragDrop.draggableHigh
412
+ */
413
+ optionName: 'draggableHigh',
414
+ axis: 'y',
415
+ move: true,
416
+ resize: true,
417
+ resizeSide: 'top',
418
+ handlePositioner: function (point) {
419
+ return {
420
+ x: point.shapeArgs.x,
421
+ y: point.plotHigh
422
+ };
423
+ },
424
+ handleFormatter: columnDragDropProps.y.handleFormatter,
425
+ propValidate: function (val, point) {
426
+ return val >= point.open && val >= point.close;
427
+ }
428
+ },
429
+ open: {
430
+ /**
431
+ * Allow open value to be dragged individually. Requires
432
+ * `draggable-points` module.
433
+ *
434
+ * @type {boolean}
435
+ * @default true
436
+ * @apioption plotOptions.ohlc.dragDrop.draggableOpen
437
+ */
438
+ optionName: 'draggableOpen',
439
+ axis: 'y',
440
+ move: true,
441
+ resize: true,
442
+ resizeSide: function (point) {
443
+ return point.open >= point.close ? 'top' : 'bottom';
444
+ },
445
+ handlePositioner: function (point) {
446
+ return {
447
+ x: point.shapeArgs.x,
448
+ y: point.plotOpen
449
+ };
450
+ },
451
+ handleFormatter: columnDragDropProps.y.handleFormatter,
452
+ propValidate: function (val, point) {
453
+ return val <= point.high && val >= point.low;
454
+ }
455
+ },
456
+ close: {
457
+ /**
458
+ * Allow close value to be dragged individually. Requires
459
+ * `draggable-points` module.
460
+ *
461
+ * @type {boolean}
462
+ * @default true
463
+ * @apioption plotOptions.ohlc.dragDrop.draggableClose
464
+ */
465
+ optionName: 'draggableClose',
466
+ axis: 'y',
467
+ move: true,
468
+ resize: true,
469
+ resizeSide: function (point) {
470
+ return point.open >= point.close ? 'bottom' : 'top';
471
+ },
472
+ handlePositioner: function (point) {
473
+ return {
474
+ x: point.shapeArgs.x,
475
+ y: point.plotClose
476
+ };
477
+ },
478
+ handleFormatter: columnDragDropProps.y.handleFormatter,
479
+ propValidate: function (val, point) {
480
+ return val <= point.high && val >= point.low;
481
+ }
482
+ }
483
+ };
484
+ }
485
+
486
+ // Arearange series - move x, resize or move low/high
487
+ if (seriesTypes.arearange) {
488
+ var columnrangeDragDropProps = seriesTypes.columnrange
489
+ .prototype.dragDropProps,
490
+ // Use a circle covering the marker as drag handle
491
+ arearangeHandleFormatter = function (point) {
492
+ var radius = point.graphic ?
493
+ point.graphic.getBBox().width / 2 + 1 :
494
+ 4;
495
+ return [
496
+ 'M', 0 - radius, 0,
497
+ 'a', radius, radius, 0, 1, 0, radius * 2, 0,
498
+ 'a', radius, radius, 0, 1, 0, radius * -2, 0
499
+ ];
500
+ };
501
+ seriesTypes.arearange.prototype.dragDropProps = {
502
+ x: columnrangeDragDropProps.x,
503
+ low: {
504
+ /**
505
+ * Allow low value to be dragged individually. Requires
506
+ * `draggable-points` module.
507
+ *
508
+ * @type {boolean}
509
+ * @default true
510
+ * @apioption plotOptions.arearange.dragDrop.draggableLow
511
+ */
512
+ optionName: 'draggableLow',
513
+ axis: 'y',
514
+ move: true,
515
+ resize: true,
516
+ resizeSide: 'bottom',
517
+ handlePositioner: function (point) {
518
+ var bBox = point.lowerGraphic && point.lowerGraphic.getBBox();
519
+ return bBox ? {
520
+ x: bBox.x + bBox.width / 2,
521
+ y: bBox.y + bBox.height / 2
522
+ } : { x: -999, y: -999 };
523
+ },
524
+ handleFormatter: arearangeHandleFormatter,
525
+ propValidate: columnrangeDragDropProps.low.propValidate
526
+ },
527
+ high: {
528
+ /**
529
+ * Allow high value to be dragged individually. Requires
530
+ * `draggable-points` module.
531
+ *
532
+ * @type {boolean}
533
+ * @default true
534
+ * @apioption plotOptions.arearange.dragDrop.draggableHigh
535
+ */
536
+ optionName: 'draggableHigh',
537
+ axis: 'y',
538
+ move: true,
539
+ resize: true,
540
+ resizeSide: 'top',
541
+ handlePositioner: function (point) {
542
+ var bBox = point.upperGraphic && point.upperGraphic.getBBox();
543
+ return bBox ? {
544
+ x: bBox.x + bBox.width / 2,
545
+ y: bBox.y + bBox.height / 2
546
+ } : { x: -999, y: -999 };
547
+ },
548
+ handleFormatter: arearangeHandleFormatter,
549
+ propValidate: columnrangeDragDropProps.high.propValidate
550
+ }
551
+ };
552
+ }
553
+
554
+ // Waterfall - mostly as column, but don't show drag handles for sum points
555
+ if (seriesTypes.waterfall) {
556
+ seriesTypes.waterfall.prototype.dragDropProps = {
557
+ x: columnDragDropProps.x,
558
+ y: merge(columnDragDropProps.y, {
559
+ handleFormatter: function (point) {
560
+ return point.isSum || point.isIntermediateSum ? null :
561
+ columnDragDropProps.y.handleFormatter(point);
562
+ }
563
+ })
564
+ };
565
+ }
566
+
567
+ // Xrange - resize/move x/x2, and move y
568
+ if (seriesTypes.xrange) {
569
+ // Handle positioner logic is the same for x and x2 apart from the
570
+ // x value. shapeArgs does not take yAxis reversed etc into account, so we
571
+ // use axis.toPixels to handle positioning.
572
+ var xrangeHandlePositioner = function (point, xProp) {
573
+ var series = point.series,
574
+ xAxis = series.xAxis,
575
+ yAxis = series.yAxis,
576
+ inverted = series.chart.inverted,
577
+ // Using toPixels handles axis.reversed, but doesn't take
578
+ // chart.inverted into account.
579
+ newX = xAxis.toPixels(point[xProp], true),
580
+ newY = yAxis.toPixels(point.y, true);
581
+
582
+ // Handle chart inverted
583
+ if (inverted) {
584
+ newX = xAxis.len - newX;
585
+ newY = yAxis.len - newY -
586
+ point.shapeArgs.height / 2;
587
+ } else {
588
+ newY -= point.shapeArgs.height / 2;
589
+ }
590
+
591
+ return {
592
+ x: Math.round(newX),
593
+ y: Math.round(newY)
594
+ };
595
+ },
596
+ xrangeDragDropProps = seriesTypes.xrange.prototype.dragDropProps = {
597
+ y: {
598
+ axis: 'y',
599
+ move: true
600
+ },
601
+ x: {
602
+ /**
603
+ * Allow x value to be dragged individually. Requires
604
+ * `draggable-points` module.
605
+ *
606
+ * @type {boolean}
607
+ * @default true
608
+ * @apioption plotOptions.xrange.dragDrop.draggableX1
609
+ */
610
+ optionName: 'draggableX1',
611
+ axis: 'x',
612
+ move: true,
613
+ resize: true,
614
+ resizeSide: 'left',
615
+ handlePositioner: function (point) {
616
+ return xrangeHandlePositioner(point, 'x');
617
+ },
618
+ handleFormatter: horizHandleFormatter,
619
+ propValidate: function (val, point) {
620
+ return val <= point.x2;
621
+ }
622
+ },
623
+ x2: {
624
+ /**
625
+ * Allow x2 value to be dragged individually. Requires
626
+ * `draggable-points` module.
627
+ *
628
+ * @type {boolean}
629
+ * @default true
630
+ * @apioption plotOptions.xrange.dragDrop.draggableX2
631
+ */
632
+ optionName: 'draggableX2',
633
+ axis: 'x',
634
+ move: true,
635
+ resize: true,
636
+ resizeSide: 'right',
637
+ handlePositioner: function (point) {
638
+ return xrangeHandlePositioner(point, 'x2');
639
+ },
640
+ handleFormatter: horizHandleFormatter,
641
+ propValidate: function (val, point) {
642
+ return val >= point.x;
643
+ }
644
+ }
645
+ };
646
+ }
647
+
648
+ // Gantt - same as xrange, but with aliases
649
+ if (seriesTypes.gantt) {
650
+ seriesTypes.gantt.prototype.dragDropProps = {
651
+ y: xrangeDragDropProps.y,
652
+ start: merge(xrangeDragDropProps.x, {
653
+ /**
654
+ * Allow start value to be dragged individually. Requires
655
+ * `draggable-points` module.
656
+ *
657
+ * @type {boolean}
658
+ * @default true
659
+ * @apioption plotOptions.gantt.dragDrop.draggableStart
660
+ */
661
+ optionName: 'draggableStart',
662
+
663
+ // Do not allow individual drag handles for milestones
664
+ validateIndividualDrag: function (point) {
665
+ return !point.milestone;
666
+ }
667
+ }),
668
+ end: merge(xrangeDragDropProps.x2, {
669
+ /**
670
+ * Allow end value to be dragged individually. Requires
671
+ * `draggable-points` module.
672
+ *
673
+ * @type {boolean}
674
+ * @default true
675
+ * @apioption plotOptions.gantt.dragDrop.draggableEnd
676
+ */
677
+ optionName: 'draggableEnd',
678
+
679
+ // Do not allow individual drag handles for milestones
680
+ validateIndividualDrag: function (point) {
681
+ return !point.milestone;
682
+ }
683
+ })
684
+ };
685
+ }
686
+
687
+ // Don't support certain series types
688
+ each(
689
+ ['gauge', 'pie', 'sunburst', 'wordcloud', 'sankey', 'histogram', 'pareto',
690
+ 'vector', 'windbarb', 'treemap', 'bellcurve', 'sma', 'map', 'mapline'],
691
+ function (type) {
692
+ if (seriesTypes[type]) {
693
+ seriesTypes[type].prototype.dragDropProps = null;
694
+ }
695
+ }
696
+ );
697
+
698
+ /**
699
+ * The draggable-points module allows points to be moved around or modified
700
+ * in the chart. In addition to the options mentioned under the `dragDrop`
701
+ * API structure, the module fires three events,
702
+ * [point.dragStart](series.line.point.events.dragStart),
703
+ * [point.drag](series.line.point.events.drag) and
704
+ * [point.drop](series.line.point.events.drop).
705
+ *
706
+ * It requires the `modules/draggable-points.js` file to be loaded.
707
+ *
708
+ * @type {object}
709
+ * @since 6.2.0
710
+ *
711
+ * @sample highcharts/dragdrop/resize-column Draggable column and line series
712
+ *
713
+ * @sample highcharts/dragdrop/drag-bubble Draggable bubbles
714
+ *
715
+ * @sample highcharts/dragdrop/drag-xrang Draggable X range series
716
+ *
717
+ * @apioption plotOptions.series.dragDrop
718
+ */
719
+
720
+ /**
721
+ * The amount of pixels to drag the pointer before it counts as a drag
722
+ * operation. This prevents drag/drop to fire when just clicking or selecting
723
+ * points.
724
+ *
725
+ * @type {number}
726
+ * @default 2
727
+ * @since 6.2.0
728
+ * @apioption plotOptions.series.dragDrop.dragSensitivity
729
+ */
730
+ var defaultDragSensitivity = 2;
731
+
732
+ /**
733
+ * Style options for the guide box. The guide box has one state by default,
734
+ * the "default" state.
735
+ *
736
+ * @type {object}
737
+ * @since 6.2.0
738
+ * @apioption plotOptions.series.dragDrop.guideBox
739
+ */
740
+ var defaultGuideBoxOptions = {
741
+ /**
742
+ * Style options for the guide box default state.
743
+ *
744
+ * @type {object}
745
+ * @since 6.2.0
746
+ * @apioption plotOptions.series.dragDrop.guideBox.default
747
+ */
748
+ default: {
749
+ /**
750
+ * CSS class name of the guide box in this state. Defaults to
751
+ * `highcharts-drag-box-default`.
752
+ *
753
+ * @type {String}
754
+ * @since 6.2.0
755
+ * @apioption plotOptions.series.dragDrop.guideBox.default.className
756
+ */
757
+ className: 'highcharts-drag-box-default',
758
+
759
+ /**
760
+ * Width of the line around the guide box.
761
+ *
762
+ * @type {number}
763
+ * @default 1
764
+ * @since 6.2.0
765
+ * @apioption plotOptions.series.dragDrop.guideBox.default.lineWidth
766
+ */
767
+ lineWidth: 1,
768
+
769
+ /**
770
+ * Color of the border around the guide box.
771
+ *
772
+ * @type {Color}
773
+ * @since 6.2.0
774
+ * @default #888
775
+ * @apioption plotOptions.series.dragDrop.guideBox.default.lineColor
776
+ */
777
+ lineColor: '#888',
778
+
779
+ /**
780
+ * Guide box fill color.
781
+ *
782
+ * @type {Color}
783
+ * @since 6.2.0
784
+ * @default rgba(0, 0, 0, 0.1)
785
+ * @apioption plotOptions.series.dragDrop.guideBox.default.color
786
+ */
787
+ color: 'rgba(0, 0, 0, 0.1)',
788
+
789
+ /**
790
+ * Guide box cursor.
791
+ *
792
+ * @type {string}
793
+ * @default move
794
+ * @since 6.2.0
795
+ * @apioption plotOptions.series.dragDrop.guideBox.default.cursor
796
+ */
797
+ cursor: 'move',
798
+
799
+ /**
800
+ * Guide box zIndex.
801
+ *
802
+ * @type {number}
803
+ * @since 6.2.0
804
+ * @default 900
805
+ * @apioption plotOptions.series.dragDrop.guideBox.default.zIndex
806
+ */
807
+ zIndex: 900
808
+ }
809
+ };
810
+
811
+
812
+ /**
813
+ * Options for the drag handles.
814
+ *
815
+ * @type {Object}
816
+ * @since 6.2.0
817
+ * @apioption plotOptions.series.dragDrop.dragHandle
818
+ */
819
+ var defaultDragHandleOptions = {
820
+
821
+ /**
822
+ * Function to define the SVG path to use for the drag handles. Takes
823
+ * the point as argument. Should return an SVG path in array format. The
824
+ * SVG path is automatically positioned on the point.
825
+ *
826
+ * @type {Function}
827
+ * @since 6.2.0
828
+ * @apioption plotOptions.series.dragDrop.dragHandle.pathFormatter
829
+ */
830
+ // pathFormatter: null,
831
+
832
+ /**
833
+ * The mouse cursor to use for the drag handles. By default this is
834
+ * intelligently switching between `ew-resize` and `ns-resize` depending
835
+ * on the direction the point is being dragged.
836
+ *
837
+ * @type {String}
838
+ * @since 6.2.0
839
+ * @apioption plotOptions.series.dragDrop.dragHandle.cursor
840
+ */
841
+ // cursor: null,
842
+
843
+ /**
844
+ * The class name of the drag handles. Defaults to `highcharts-drag-handle`.
845
+ *
846
+ * @type {String}
847
+ * @since 6.2.0
848
+ * @apioption plotOptions.series.dragDrop.dragHandle.className
849
+ */
850
+ className: 'highcharts-drag-handle',
851
+
852
+ /**
853
+ * The fill color of the drag handles.
854
+ *
855
+ * @type {Color}
856
+ * @since 6.2.0
857
+ * @default #fff
858
+ * @apioption plotOptions.series.dragDrop.dragHandle.color
859
+ */
860
+ color: '#fff',
861
+
862
+ /**
863
+ * The line color of the drag handles.
864
+ *
865
+ * @type {Color}
866
+ * @since 6.2.0
867
+ * @default rgba(0, 0, 0, 0.6)
868
+ * @apioption plotOptions.series.dragDrop.dragHandle.lineColor
869
+ */
870
+ lineColor: 'rgba(0, 0, 0, 0.6)',
871
+
872
+ /**
873
+ * The line width for the drag handles.
874
+ *
875
+ * @type {number}
876
+ * @default 2
877
+ * @since 6.2.0
878
+ * @apioption plotOptions.series.dragDrop.dragHandle.lineWidth
879
+ */
880
+ lineWidth: 1,
881
+
882
+ /**
883
+ * The z index for the drag handles.
884
+ *
885
+ * @type {number}
886
+ * @since 6.2.0
887
+ * @default 901
888
+ * @apioption plotOptions.series.dragDrop.dragHandle.zIndex
889
+ */
890
+ zIndex: 901
891
+ };
892
+
893
+ /**
894
+ * Set the minimum X value the points can be moved to.
895
+ *
896
+ * @type {number}
897
+ * @since 6.2.0
898
+ * @apioption plotOptions.series.dragDrop.dragMinX
899
+ */
900
+
901
+ /**
902
+ * Set the maximum X value the points can be moved to.
903
+ *
904
+ * @type {number}
905
+ * @since 6.2.0
906
+ * @apioption plotOptions.series.dragDrop.dragMaxX
907
+ */
908
+
909
+ /**
910
+ * Set the minimum Y value the points can be moved to.
911
+ *
912
+ * @type {number}
913
+ * @since 6.2.0
914
+ * @apioption plotOptions.series.dragDrop.dragMinY
915
+ */
916
+
917
+ /**
918
+ * Set the maximum Y value the points can be moved to.
919
+ *
920
+ * @type {number}
921
+ * @since 6.2.0
922
+ * @apioption plotOptions.series.dragDrop.dragMaxY
923
+ */
924
+
925
+ /**
926
+ * The X precision value to drag to for this series. Set to 0 to disable. By
927
+ * default this is disabled, except for category axes, where the default is 1.
928
+ *
929
+ * @type {number}
930
+ * @default 0
931
+ * @since 6.2.0
932
+ * @apioption plotOptions.series.dragDrop.dragPrecisionX
933
+ */
934
+
935
+ /**
936
+ * The Y precision value to drag to for this series. Set to 0 to disable. By
937
+ * default this is disabled, except for category axes, where the default is 1.
938
+ *
939
+ * @type {number}
940
+ * @default 0
941
+ * @since 6.2.0
942
+ * @apioption plotOptions.series.dragDrop.dragPrecisionY
943
+ */
944
+
945
+ /**
946
+ * Enable dragging in the X dimension.
947
+ *
948
+ * @type {boolean}
949
+ * @since 6.2.0
950
+ * @apioption plotOptions.series.dragDrop.draggableX
951
+ */
952
+
953
+ /**
954
+ * Enable dragging in the Y dimension. Note that this is not supported for
955
+ * TreeGrid axes (the default axis type in Gantt charts).
956
+ *
957
+ * @type {boolean}
958
+ * @since 6.2.0
959
+ * @apioption plotOptions.series.dragDrop.draggableY
960
+ */
961
+
962
+ /**
963
+ * Group the points by a property. Points with the same property value will be
964
+ * grouped together when moving.
965
+ *
966
+ * @type {String}
967
+ * @since 6.2.0
968
+ * @apioption plotOptions.series.dragDrop.groupBy
969
+ */
970
+
971
+ /**
972
+ * Update points as they are dragged. If false, a guide box is drawn to
973
+ * illustrate the new point size.
974
+ *
975
+ * @type {boolean}
976
+ * @default true
977
+ * @since 6.2.0
978
+ * @apioption plotOptions.series.dragDrop.liveRedraw
979
+ */
980
+
981
+ /**
982
+ * Set a key to hold when dragging to zoom the chart. Requires the
983
+ * draggable-points module. This is useful to avoid zooming while moving points.
984
+ * Should be set different than [chart.panKey](#chart.panKey).
985
+ *
986
+ * @type {String}
987
+ * @validvalue ["alt", "ctrl", "meta", "shift"]
988
+ * @since 6.2.0
989
+ * @apioption chart.zoomKey
990
+ */
991
+
992
+ /**
993
+ * Callback that fires when starting to drag a point. The mouse event object is
994
+ * passed in as an argument. See [drag and drop options](series.line.dragDrop).
995
+ *
996
+ * Requires the draggable-points module.
997
+ *
998
+ * @type {Function}
999
+ * @since 6.2.0
1000
+ * @apioption plotOptions.series.point.events.dragStart
1001
+ */
1002
+
1003
+ /**
1004
+ * Callback that fires while dragging a point. The mouse event is passed in as
1005
+ * parameter. The original data can be accessed from `e.origin`, and the new
1006
+ * point values can be accessed from `e.newPoints`. If there is only a single
1007
+ * point being updated, it can be accessed from `e.newPoint` for simplicity. To
1008
+ * stop the default drag action, return `false`. See
1009
+ * [drag and drop options](series.line.dragDrop).
1010
+ *
1011
+ * Requires the draggable-points module.
1012
+ *
1013
+ * @type {Function}
1014
+ * @since 6.2.0
1015
+ * @apioption plotOptions.series.point.events.drag
1016
+ */
1017
+
1018
+ /**
1019
+ * Callback that fires when the point is dropped. The mouse event is passed in
1020
+ * as parameter. The original data can be accessed from `e.origin`, and the new
1021
+ * point values can be accessed from `e.newPoints`. If there is only a single
1022
+ * point being updated, it can be accessed from `e.newPoint` for simplicity. To
1023
+ * stop the default drop action, return `false`. See
1024
+ * [drag and drop options](series.line.dragDrop).
1025
+ *
1026
+ * Requires the draggable-points module.
1027
+ *
1028
+ * @type {Function}
1029
+ * @since 6.2.0
1030
+ * @apioption plotOptions.series.point.events.drop
1031
+ */
1032
+
1033
+ /**
1034
+ * Point specific options for the draggable-points module. Overrides options on
1035
+ * `series.dragDrop`.
1036
+ *
1037
+ * Requires the draggable-points module.
1038
+ *
1039
+ * @extends plotOptions.series.dragDrop
1040
+ * @since 6.2.0
1041
+ * @apioption series.line.data.dragDrop
1042
+ */
1043
+
1044
+
1045
+ /**
1046
+ * Utility function to test if a series is using drag/drop, looking at its
1047
+ * options.
1048
+ *
1049
+ * @private
1050
+ * @param {Highcharts.Series} series
1051
+ * The series to test.
1052
+ *
1053
+ * @return {boolean}
1054
+ * True if the series is using drag/drop.
1055
+ */
1056
+ function isSeriesDraggable(series) {
1057
+ var props = ['draggableX', 'draggableY'],
1058
+ i;
1059
+
1060
+ // Add optionNames from dragDropProps to the array of props to check for
1061
+ objectEach(series.dragDropProps, function (val) {
1062
+ if (val.optionName) {
1063
+ props.push(val.optionName);
1064
+ }
1065
+ });
1066
+
1067
+ // Loop over all options we have that could enable dragDrop for this
1068
+ // series. If any of them are truthy, this series is draggable.
1069
+ i = props.length;
1070
+ while (i--) {
1071
+ if (series.options.dragDrop[props[i]]) {
1072
+ return true;
1073
+ }
1074
+ }
1075
+ }
1076
+
1077
+
1078
+ /**
1079
+ * Utility function to test if a chart should have drag/drop enabled, looking
1080
+ * at its options.
1081
+ *
1082
+ * @private
1083
+ * @param {Highcharts.Chart} chart
1084
+ * The chart to test.
1085
+ *
1086
+ * @return {boolean}
1087
+ * True if the chart is drag/droppable.
1088
+ */
1089
+ function isChartDraggable(chart) {
1090
+ var i = chart.series.length;
1091
+ if (chart.hasCartesianSeries && !chart.polar) {
1092
+ while (i--) {
1093
+ if (
1094
+ chart.series[i].options.dragDrop &&
1095
+ isSeriesDraggable(chart.series[i])
1096
+ ) {
1097
+ return true;
1098
+ }
1099
+ }
1100
+ }
1101
+ }
1102
+
1103
+
1104
+ /**
1105
+ * Utility function to test if a point is movable (any of its props can be
1106
+ * dragged by a move, not just individually).
1107
+ *
1108
+ * @private
1109
+ * @param {Highcharts.Point} point
1110
+ * The point to test.
1111
+ *
1112
+ * @return {boolean}
1113
+ * True if the point is movable.
1114
+ */
1115
+ function isPointMovable(point) {
1116
+ var series = point.series,
1117
+ seriesDragDropOptions = series.options.dragDrop,
1118
+ pointDragDropOptions = point.options && point.options.dragDrop,
1119
+ updateProps = series.dragDropProps,
1120
+ hasMovableX,
1121
+ hasMovableY;
1122
+
1123
+ objectEach(updateProps, function (p) {
1124
+ if (p.axis === 'x' && p.move) {
1125
+ hasMovableX = true;
1126
+ } else if (p.axis === 'y' && p.move) {
1127
+ hasMovableY = true;
1128
+ }
1129
+ });
1130
+
1131
+ // We can only move the point if draggableX/Y is set, even if all the
1132
+ // individual prop options are set.
1133
+ return (
1134
+ seriesDragDropOptions.draggableX && hasMovableX ||
1135
+ seriesDragDropOptions.draggableY && hasMovableY
1136
+ ) &&
1137
+ !(
1138
+ pointDragDropOptions &&
1139
+ pointDragDropOptions.draggableX === false &&
1140
+ pointDragDropOptions.draggableY === false
1141
+ ) &&
1142
+ series.yAxis &&
1143
+ series.xAxis;
1144
+ }
1145
+
1146
+
1147
+ /**
1148
+ * In mousemove events, check that we have dragged mouse further than the
1149
+ * dragSensitivity before we call mouseMove handler.
1150
+ *
1151
+ * @private
1152
+ * @param {global.Event} e
1153
+ * Mouse move event to test.
1154
+ *
1155
+ * @param {Highcharts.Chart} chart
1156
+ * Chart that has started dragging.
1157
+ *
1158
+ * @param {number} sensitivity
1159
+ * Pixel sensitivity to test against.
1160
+ *
1161
+ * @return {boolean}
1162
+ * True if the event is moved past sensitivity relative to the chart's
1163
+ * drag origin.
1164
+ */
1165
+ function hasDraggedPastSensitivity(e, chart, sensitivity) {
1166
+ var orig = chart.dragDropData.origin,
1167
+ oldX = orig.pageX,
1168
+ oldY = orig.pageY,
1169
+ newX = e.pageX,
1170
+ newY = e.pageY,
1171
+ distance = Math.sqrt(
1172
+ (newX - oldX) * (newX - oldX) +
1173
+ (newY - oldY) * (newY - oldY)
1174
+ );
1175
+ return distance > sensitivity;
1176
+ }
1177
+
1178
+
1179
+ /**
1180
+ * Get a snapshot of points, mouse position, and guide box dimensions
1181
+ *
1182
+ * @private
1183
+ * @param {global.Event} e
1184
+ * Mouse event with mouse position to snapshot.
1185
+ *
1186
+ * @param {Array<Highcharts.Point>} points
1187
+ * Points to take snapshot of. We store the value of the data properties
1188
+ * defined in each series' dragDropProps.
1189
+ *
1190
+ * @param {Highcharts.SVGElement} [guideBox]
1191
+ * The guide box to take snapshot of.
1192
+ *
1193
+ * @return {object}
1194
+ * Snapshot object. Point properties are placed in a hashmap with IDs as
1195
+ * keys.
1196
+ */
1197
+ function getPositionSnapshot(e, points, guideBox) {
1198
+ var res = {
1199
+ pageX: e.pageX,
1200
+ pageY: e.pageY,
1201
+ guideBox: guideBox && {
1202
+ x: guideBox.attr('x'),
1203
+ y: guideBox.attr('y'),
1204
+ width: guideBox.attr('width'),
1205
+ height: guideBox.attr('height')
1206
+ },
1207
+ points: {}
1208
+ };
1209
+
1210
+ // Loop over the points and add their props
1211
+ each(points, function (point) {
1212
+ var pointProps = {};
1213
+ // Add all of the props defined in the series' dragDropProps to the
1214
+ // snapshot
1215
+ objectEach(point.series.dragDropProps, function (val, key) {
1216
+ pointProps[key] = point[key];
1217
+ });
1218
+ pointProps.point = point; // Store reference to point
1219
+ res.points[point.id] = pointProps;
1220
+ });
1221
+
1222
+ return res;
1223
+ }
1224
+
1225
+
1226
+ /**
1227
+ * Get a list of points that are grouped with this point. If only one point is
1228
+ * in the group, that point is returned by itself in an array.
1229
+ *
1230
+ * @private
1231
+ * @param {Highcharts.Point} point
1232
+ * Point to find group from.
1233
+ *
1234
+ * @return {Array<Highcharts.Point>}
1235
+ * Array of points in this group.
1236
+ */
1237
+ function getGroupedPoints(point) {
1238
+ var series = point.series,
1239
+ groupKey = series.options.dragDrop.groupBy;
1240
+ return point.options[groupKey] ?
1241
+ // If we have a grouping option, filter the points by that
1242
+ filter(series.points, function (comparePoint) {
1243
+ return comparePoint.options[groupKey] === point.options[groupKey];
1244
+ }) :
1245
+ // Otherwise return the point by itself only
1246
+ [point];
1247
+ }
1248
+
1249
+
1250
+ /**
1251
+ * Resize a rect element on one side. The element is modified.
1252
+ *
1253
+ * @private
1254
+ * @param {Highcharts.SVGElement} rect
1255
+ * Rect element to resize.
1256
+ *
1257
+ * @param {string} updateSide
1258
+ * Which side of the rect to update. Can be `left`, `right`, `top` or
1259
+ * `bottom`.
1260
+ *
1261
+ * @param {object} update
1262
+ * Object with x and y properties, detailing how much to resize each
1263
+ * dimension.
1264
+ *
1265
+ * @return {Highcharts.SVGElement}
1266
+ * The modified rect.
1267
+ */
1268
+ function resizeRect(rect, updateSide, update) {
1269
+ var resizeAttrs;
1270
+ switch (updateSide) {
1271
+ case 'left':
1272
+ resizeAttrs = {
1273
+ x: rect.attr('x') + update.x,
1274
+ width: Math.max(1, rect.attr('width') - update.x)
1275
+ };
1276
+ break;
1277
+ case 'right':
1278
+ resizeAttrs = {
1279
+ width: Math.max(1, rect.attr('width') + update.x)
1280
+ };
1281
+ break;
1282
+ case 'top':
1283
+ resizeAttrs = {
1284
+ y: rect.attr('y') + update.y,
1285
+ height: Math.max(1, rect.attr('height') - update.y)
1286
+ };
1287
+ break;
1288
+ case 'bottom':
1289
+ resizeAttrs = {
1290
+ height: Math.max(1, rect.attr('height') + update.y)
1291
+ };
1292
+ break;
1293
+ default:
1294
+ }
1295
+ rect.attr(resizeAttrs);
1296
+ }
1297
+
1298
+
1299
+ /**
1300
+ * Flip a side property, used with resizeRect. If input side is "left", return
1301
+ * "right" etc.
1302
+ *
1303
+ * @private
1304
+ * @param {string} side
1305
+ * Side prop to flip. Can be `left`, `right`, `top` or `bottom`.
1306
+ *
1307
+ * @return {string}
1308
+ * The flipped side.
1309
+ */
1310
+ function flipResizeSide(side) {
1311
+ return {
1312
+ left: 'right',
1313
+ right: 'left',
1314
+ top: 'bottom',
1315
+ bottom: 'top'
1316
+ }[side];
1317
+ }
1318
+
1319
+
1320
+ /**
1321
+ * Prepare chart.dragDropData with origin info, and show the guide box.
1322
+ *
1323
+ * @private
1324
+ * @param {global.Event} e
1325
+ * Mouse event with original mouse position.
1326
+ *
1327
+ * @param {Highcharts.Point} point
1328
+ * The point the dragging started on.
1329
+ */
1330
+ function initDragDrop(e, point) {
1331
+ var groupedPoints = getGroupedPoints(point),
1332
+ series = point.series,
1333
+ chart = series.chart,
1334
+ guideBox;
1335
+
1336
+ // If liveRedraw is disabled, show the guide box with the default state
1337
+ if (!pick(
1338
+ series.options.dragDrop && series.options.dragDrop.liveRedraw,
1339
+ true
1340
+ )) {
1341
+ chart.dragGuideBox = guideBox = series.getGuideBox(groupedPoints);
1342
+ chart.setGuideBoxState('default', series.options.dragDrop.guideBox)
1343
+ .add(series.group);
1344
+ }
1345
+
1346
+ // Store some data on the chart to pick up later
1347
+ chart.dragDropData = {
1348
+ origin: getPositionSnapshot(e, groupedPoints, guideBox),
1349
+ point: point,
1350
+ groupedPoints: groupedPoints
1351
+ };
1352
+
1353
+ // Set drag state
1354
+ chart.isDragging = true;
1355
+ }
1356
+
1357
+
1358
+ /**
1359
+ * Calculate new point options from points being dragged.
1360
+ *
1361
+ * @private
1362
+ * @param {object} dragDropData
1363
+ * A chart's dragDropData with drag/drop origin information, and info on
1364
+ * which points are being dragged.
1365
+ *
1366
+ * @param {global.Event} newPos
1367
+ * Event with the new position of the mouse (pageX/Y properties).
1368
+ *
1369
+ * @return {Array<object>}
1370
+ * Hashmap with point.id mapped to an object with the original point
1371
+ * reference, as well as the new data values.
1372
+ */
1373
+ function getNewPoints(dragDropData, newPos) {
1374
+ var point = dragDropData.point,
1375
+ series = point.series,
1376
+ options = merge(series.options.dragDrop, point.options.dragDrop),
1377
+ updateProps = {},
1378
+ resizeProp = dragDropData.updateProp,
1379
+ hashmap = {};
1380
+
1381
+ // Go through the data props that can be updated on this series and find out
1382
+ // which ones we want to update.
1383
+ objectEach(point.series.dragDropProps, function (val, key) {
1384
+ // If we are resizing, skip if this key is not the correct one or it
1385
+ // is not resizable.
1386
+ if (
1387
+ resizeProp && (
1388
+ resizeProp !== key ||
1389
+ !val.resize ||
1390
+ val.optionName && options[val.optionName] === false
1391
+ )
1392
+ ) {
1393
+ return;
1394
+ }
1395
+
1396
+ // If we are resizing, we now know it is good. If we are moving, check
1397
+ // that moving along this axis is enabled, and the prop is movable.
1398
+ // If this prop is enabled, add it to be updated.
1399
+ if (
1400
+ resizeProp || (
1401
+ val.move &&
1402
+ (
1403
+ val.axis === 'x' && options.draggableX ||
1404
+ val.axis === 'y' && options.draggableY
1405
+ )
1406
+ )
1407
+ ) {
1408
+ updateProps[key] = val;
1409
+ }
1410
+ });
1411
+
1412
+ // Go through the points to be updated and get new options for each of them
1413
+ each(
1414
+ resizeProp ? // If resizing, only update the point we are resizing
1415
+ [point] :
1416
+ dragDropData.groupedPoints,
1417
+ function (p) {
1418
+ hashmap[p.id] = {
1419
+ point: p,
1420
+ newValues: p.getDropValues(dragDropData.origin, newPos, updateProps)
1421
+ };
1422
+ });
1423
+ return hashmap;
1424
+ }
1425
+
1426
+
1427
+ /**
1428
+ * Update the points in a chart from dragDropData.newPoints.
1429
+ *
1430
+ * @private
1431
+ * @param {Highcharts.Chart} chart
1432
+ * A chart with dragDropData.newPoints.
1433
+ *
1434
+ * @param {boolean} [animate=true]
1435
+ * Animate updating points?
1436
+ */
1437
+ function updatePoints(chart, animate) {
1438
+ var newPoints = chart.dragDropData.newPoints,
1439
+ animOptions = animate === false ? false : merge({
1440
+ duration: 400 // 400 is the default in H.animate
1441
+ }, chart.options.animation);
1442
+
1443
+ chart.isDragDropAnimating = true;
1444
+
1445
+ // Update the points
1446
+ objectEach(newPoints, function (newPoint) {
1447
+ newPoint.point.update(newPoint.newValues, false);
1448
+ });
1449
+
1450
+ chart.redraw(animOptions);
1451
+
1452
+ // Clear the isAnimating flag after animation duration is complete.
1453
+ // The complete handler for animation seems to have bugs at this time, so
1454
+ // we have to use a timeout instead.
1455
+ setTimeout(function () {
1456
+ delete chart.isDragDropAnimating;
1457
+ if (chart.hoverPoint && !chart.dragHandles) {
1458
+ chart.hoverPoint.showDragHandles();
1459
+ }
1460
+ }, animOptions.duration);
1461
+ }
1462
+
1463
+
1464
+ /**
1465
+ * Resize the guide box according to point options and a difference in mouse
1466
+ * positions. Handles reversed axes.
1467
+ *
1468
+ * @private
1469
+ * @param {Highcharts.Point} point
1470
+ * The point that is being resized.
1471
+ *
1472
+ * @param {number} dX
1473
+ * Difference in X position.
1474
+ *
1475
+ * @param {number} dY
1476
+ * Difference in Y position.
1477
+ */
1478
+ function resizeGuideBox(point, dX, dY) {
1479
+ var series = point.series,
1480
+ chart = series.chart,
1481
+ dragDropData = chart.dragDropData,
1482
+ resizeSide,
1483
+ newPoint,
1484
+ resizeProp = series.dragDropProps[dragDropData.updateProp];
1485
+
1486
+ // dragDropProp.resizeSide holds info on which side to resize.
1487
+ newPoint = dragDropData.newPoints[point.id].newValues;
1488
+ resizeSide = typeof resizeProp.resizeSide === 'function' ?
1489
+ resizeProp.resizeSide(newPoint, point) : resizeProp.resizeSide;
1490
+
1491
+ // Call resize hook if it is defined
1492
+ if (resizeProp.beforeResize) {
1493
+ resizeProp.beforeResize(chart.dragGuideBox, newPoint, point);
1494
+ }
1495
+
1496
+ // Do the resize
1497
+ resizeRect(
1498
+ chart.dragGuideBox,
1499
+ resizeProp.axis === 'x' && series.xAxis.reversed ||
1500
+ resizeProp.axis === 'y' && series.yAxis.reversed ?
1501
+ flipResizeSide(resizeSide) : resizeSide,
1502
+ {
1503
+ x: resizeProp.axis === 'x' ?
1504
+ dX - (dragDropData.origin.prevdX || 0) : 0,
1505
+ y: resizeProp.axis === 'y' ?
1506
+ dY - (dragDropData.origin.prevdY || 0) : 0
1507
+ }
1508
+ );
1509
+ }
1510
+
1511
+
1512
+ /**
1513
+ * Default mouse move handler while dragging. Handles updating points or guide
1514
+ * box.
1515
+ *
1516
+ * @private
1517
+ * @param {global.Event} e
1518
+ * The mouse move event.
1519
+ *
1520
+ * @param {Highcharts.Point} point
1521
+ * The point that is dragged.
1522
+ */
1523
+ function dragMove(e, point) {
1524
+ var series = point.series,
1525
+ chart = series.chart,
1526
+ data = chart.dragDropData,
1527
+ options = merge(series.options.dragDrop, point.options.dragDrop),
1528
+ draggableX = options.draggableX,
1529
+ draggableY = options.draggableY,
1530
+ origin = data.origin,
1531
+ dX = e.pageX - origin.pageX,
1532
+ dY = e.pageY - origin.pageY,
1533
+ oldDx = dX,
1534
+ updateProp = data.updateProp;
1535
+
1536
+ // Handle inverted
1537
+ if (chart.inverted) {
1538
+ dX = -dY;
1539
+ dY = -oldDx;
1540
+ }
1541
+
1542
+ // If we have liveRedraw enabled, update the points immediately. Otherwise
1543
+ // update the guideBox.
1544
+ if (pick(options.liveRedraw, true)) {
1545
+ updatePoints(chart, false);
1546
+
1547
+ // Update drag handles
1548
+ if (chart.dragHandles) {
1549
+ chart.hideDragHandles();
1550
+ }
1551
+ point.showDragHandles();
1552
+
1553
+ } else {
1554
+ // No live redraw, update guide box
1555
+ if (updateProp) {
1556
+ // We are resizing, so resize the guide box
1557
+ resizeGuideBox(point, dX, dY);
1558
+ } else {
1559
+ // We are moving, so move the guide box
1560
+ chart.dragGuideBox.translate(
1561
+ draggableX ? dX : 0, draggableY ? dY : 0
1562
+ );
1563
+ }
1564
+ }
1565
+
1566
+ // Update stored previous dX/Y
1567
+ origin.prevdX = dX;
1568
+ origin.prevdY = dY;
1569
+ }
1570
+
1571
+
1572
+ /**
1573
+ * Set the state of the guide box.
1574
+ *
1575
+ * @private
1576
+ * @param {string} state
1577
+ * The state to set the guide box to.
1578
+ *
1579
+ * @param {object} options
1580
+ * Additional overall guideBox options to consider.
1581
+ *
1582
+ * @return {Highcharts.SVGElement}
1583
+ * The modified guide box.
1584
+ */
1585
+ H.Chart.prototype.setGuideBoxState = function (state, options) {
1586
+ var guideBox = this.dragGuideBox,
1587
+ guideBoxOptions = merge(defaultGuideBoxOptions, options),
1588
+ stateOptions = merge(guideBoxOptions.default, guideBoxOptions[state]);
1589
+ return guideBox.attr({
1590
+ className: stateOptions.className,
1591
+ stroke: stateOptions.lineColor,
1592
+ strokeWidth: stateOptions.lineWidth,
1593
+ fill: stateOptions.color,
1594
+ cursor: stateOptions.cursor,
1595
+ zIndex: stateOptions.zIndex
1596
+ });
1597
+ };
1598
+
1599
+
1600
+ /**
1601
+ * Get updated point values when dragging a point.
1602
+ *
1603
+ * @private
1604
+ * @param {object} origin Mouse position (pageX/Y) and point props at current
1605
+ * data values. Point props should be organized per point.id in a hashmap.
1606
+ *
1607
+ * @param {global.Event} newPos New mouse position (pageX/Y).
1608
+ *
1609
+ * @param {object} updateProps Point props to modify. Map of prop objects where
1610
+ * each key refers to the prop, and the value is an object with an axis
1611
+ * property. Example:
1612
+ * {
1613
+ * x: {
1614
+ * axis: 'x'
1615
+ * },
1616
+ * x2: {
1617
+ * axis: 'x'
1618
+ * }
1619
+ * }
1620
+ *
1621
+ * @returns {object}
1622
+ * An object with updated data values.
1623
+ */
1624
+ H.Point.prototype.getDropValues = function (origin, newPos, updateProps) {
1625
+ var point = this,
1626
+ series = point.series,
1627
+ options = merge(series.options.dragDrop, point.options.dragDrop),
1628
+ yAxis = series.yAxis,
1629
+ xAxis = series.xAxis,
1630
+ dX = newPos.pageX - origin.pageX,
1631
+ dY = newPos.pageY - origin.pageY,
1632
+ oldX = pick(origin.x, point.x),
1633
+ oldY = pick(origin.y, point.y),
1634
+ dXValue = xAxis.toValue(
1635
+ xAxis.toPixels(oldX, true) +
1636
+ (xAxis.horiz ? dX : dY),
1637
+ true
1638
+ ) - oldX,
1639
+ dYValue = yAxis.toValue(
1640
+ yAxis.toPixels(oldY, true) +
1641
+ (yAxis.horiz ? dX : dY),
1642
+ true
1643
+ ) - oldY,
1644
+ result = {},
1645
+ updateSingleProp,
1646
+ pointOrigin = origin.points[point.id];
1647
+
1648
+ // Find out if we only have one prop to update
1649
+ for (var key in updateProps) {
1650
+ if (updateProps.hasOwnProperty(key)) {
1651
+ if (updateSingleProp !== undefined) {
1652
+ updateSingleProp = false;
1653
+ break;
1654
+ }
1655
+ updateSingleProp = true;
1656
+ }
1657
+ }
1658
+
1659
+ // Utility function to apply precision and limit a value within the
1660
+ // draggable range
1661
+ function limitToRange(val, direction) {
1662
+ var defaultPrecision = series[direction.toLowerCase() + 'Axis']
1663
+ .categories ? 1 : 0,
1664
+ precision = pick(
1665
+ options['dragPrecision' + direction], defaultPrecision
1666
+ ),
1667
+ min = pick(options['dragMin' + direction], -Infinity),
1668
+ max = pick(options['dragMax' + direction], Infinity),
1669
+ res = val;
1670
+ if (precision) {
1671
+ res = Math.round(res / precision) * precision;
1672
+ }
1673
+ return Math.max(min, Math.min(max, res));
1674
+ }
1675
+
1676
+ // Assign new value to property. Adds dX/YValue to the old value, limiting
1677
+ // it within min/max ranges.
1678
+ objectEach(updateProps, function (val, key) {
1679
+ var oldVal = pointOrigin[key],
1680
+ newVal = limitToRange(
1681
+ oldVal + (val.axis === 'x' ? dXValue : dYValue),
1682
+ val.axis.toUpperCase()
1683
+ );
1684
+ // If we are updating a single prop, and it has a validation function
1685
+ // for the prop, run it. If it fails, don't update the value.
1686
+ if (
1687
+ !(
1688
+ updateSingleProp &&
1689
+ val.propValidate &&
1690
+ !val.propValidate(newVal, point)
1691
+ ) &&
1692
+ oldVal !== undefined
1693
+ ) {
1694
+ result[key] = newVal;
1695
+ }
1696
+ });
1697
+
1698
+ return result;
1699
+ };
1700
+
1701
+
1702
+ /**
1703
+ * Returns an SVGElement to use as the guide box for a set of points.
1704
+ *
1705
+ * @private
1706
+ * @param {Array<Highcharts.Point>} points
1707
+ * The state to set the guide box to.
1708
+ *
1709
+ * @return {Highcharts.SVGElement}
1710
+ * An SVG element for the guide box, not added to DOM.
1711
+ */
1712
+ H.Series.prototype.getGuideBox = function (points) {
1713
+ var chart = this.chart,
1714
+ minX = Infinity,
1715
+ maxX = -Infinity,
1716
+ minY = Infinity,
1717
+ maxY = -Infinity,
1718
+ changed;
1719
+
1720
+ // Find bounding box of all points
1721
+ each(points, function (point) {
1722
+ var bBox = point.graphic && point.graphic.getBBox() || point.shapeArgs;
1723
+ if (bBox && (bBox.width || bBox.height || bBox.x || bBox.y)) {
1724
+ changed = true;
1725
+ minX = Math.min(bBox.x, minX);
1726
+ maxX = Math.max(bBox.x + bBox.width, maxX);
1727
+ minY = Math.min(bBox.y, minY);
1728
+ maxY = Math.max(bBox.y + bBox.height, maxY);
1729
+ }
1730
+ });
1731
+
1732
+ return changed ? chart.renderer.rect(
1733
+ minX,
1734
+ minY,
1735
+ maxX - minX,
1736
+ maxY - minY
1737
+ ) : chart.renderer.g();
1738
+ };
1739
+
1740
+
1741
+ /**
1742
+ * On point mouse out. Hide drag handles, depending on state.
1743
+ *
1744
+ * @private
1745
+ * @param {Highcharts.Point} point
1746
+ * The point mousing out of.
1747
+ */
1748
+ function mouseOut(point) {
1749
+ var chart = point.series && point.series.chart;
1750
+ if (
1751
+ chart &&
1752
+ chart.dragHandles &&
1753
+ !(
1754
+ chart.dragDropData &&
1755
+ (
1756
+ chart.dragDropData.isDragging ||
1757
+ chart.dragDropData.isHoveringHandle === point.id
1758
+ )
1759
+ )
1760
+ ) {
1761
+ chart.hideDragHandles();
1762
+ }
1763
+ }
1764
+
1765
+
1766
+ /**
1767
+ * Mouseout on resize handle. Handle states, and possibly run mouseOut on point.
1768
+ *
1769
+ * @private
1770
+ * @param {Highcharts.Point} point
1771
+ * The point mousing out of.
1772
+ */
1773
+ function onResizeHandleMouseOut(point) {
1774
+ var chart = point.series.chart;
1775
+ if (
1776
+ chart.dragDropData &&
1777
+ point.id === chart.dragDropData.isHoveringHandle
1778
+ ) {
1779
+ delete chart.dragDropData.isHoveringHandle;
1780
+ }
1781
+ if (!chart.hoverPoint) {
1782
+ mouseOut(point);
1783
+ }
1784
+ }
1785
+
1786
+
1787
+ /**
1788
+ * Mousedown on resize handle. Init a drag if the conditions are right.
1789
+ *
1790
+ * @private
1791
+ * @param {global.Event} e
1792
+ * The mousedown event.
1793
+ *
1794
+ * @param {Highcharts.Point} point
1795
+ * The point mousing down on.
1796
+ *
1797
+ * @param {string} updateProp
1798
+ * The data property this resize handle is attached to for this point.
1799
+ */
1800
+ function onResizeHandleMouseDown(e, point, updateProp) {
1801
+ var chart = point.series.chart;
1802
+
1803
+ // Ignore if zoom/pan key is pressed
1804
+ if (chart.zoomOrPanKeyPressed(e)) {
1805
+ return;
1806
+ }
1807
+
1808
+ // Prevent zooming
1809
+ chart.mouseIsDown = false;
1810
+
1811
+ initDragDrop(e, point);
1812
+ chart.dragDropData.isDragging = true;
1813
+ chart.dragDropData.updateProp = e.updateProp = updateProp;
1814
+ point.firePointEvent('dragStart', e);
1815
+
1816
+ // Prevent default to avoid point click for dragging too
1817
+ e.stopPropagation();
1818
+ e.preventDefault();
1819
+ }
1820
+
1821
+
1822
+ /**
1823
+ * Render drag handles on a point - depending on which handles are enabled - and
1824
+ * attach events to them.
1825
+ * @private
1826
+ */
1827
+ H.Point.prototype.showDragHandles = function () {
1828
+ var point = this,
1829
+ series = point.series,
1830
+ chart = series.chart,
1831
+ renderer = chart.renderer,
1832
+ options = merge(series.options.dragDrop, point.options.dragDrop);
1833
+
1834
+ // Go through each updateProp and see if we are supposed to create a handle
1835
+ // for it.
1836
+ objectEach(series.dragDropProps, function (val, key) {
1837
+ var handleOptions = merge(
1838
+ defaultDragHandleOptions,
1839
+ val.handleOptions,
1840
+ options.dragHandle
1841
+ ),
1842
+ handleAttrs = {
1843
+ className: handleOptions.className,
1844
+ 'stroke-width': handleOptions.lineWidth,
1845
+ fill: handleOptions.color,
1846
+ stroke: handleOptions.lineColor
1847
+ },
1848
+ pathFormatter = handleOptions.pathFormatter || val.handleFormatter,
1849
+ positioner = val.handlePositioner,
1850
+ pos,
1851
+ handle,
1852
+ path,
1853
+ // Run validation function on whether or not we allow individual
1854
+ // updating of this prop.
1855
+ validate = val.validateIndividualDrag ?
1856
+ val.validateIndividualDrag(point) : true;
1857
+ if (
1858
+ val.resize &&
1859
+ validate &&
1860
+ val.resizeSide &&
1861
+ pathFormatter &&
1862
+ (
1863
+ options['draggable' + val.axis.toUpperCase()] ||
1864
+ options[val.optionName]
1865
+ ) &&
1866
+ options[val.optionName] !== false
1867
+ ) {
1868
+
1869
+ // Create group if it doesn't exist
1870
+ if (!chart.dragHandles) {
1871
+ chart.dragHandles = {
1872
+ group: renderer.g('drag-drop-handles')
1873
+ .add(series.markerGroup || series.group)
1874
+ };
1875
+ }
1876
+
1877
+ // Find position and path of handle
1878
+ pos = positioner(point);
1879
+ path = pathFormatter(point);
1880
+ if (!path || pos.x < 0 || pos.y < 0) {
1881
+ return;
1882
+ }
1883
+
1884
+ // If cursor is not set explicitly, use axis direction
1885
+ handleAttrs.cursor = handleOptions.cursor ||
1886
+ (val.axis === 'x') !== !!chart.inverted ?
1887
+ 'ew-resize' : 'ns-resize';
1888
+
1889
+ // Create and add the handle element
1890
+ chart.dragHandles[
1891
+ typeof val.resizeSide === 'function' ?
1892
+ val.resizeSide(point.options, point) : val.resizeSide
1893
+ ] = handle = renderer
1894
+ .path(path)
1895
+ .translate(pos.x, pos.y)
1896
+ .attr(handleAttrs)
1897
+ .add(chart.dragHandles.group);
1898
+
1899
+ // Add events
1900
+ addEvent(handle.element, 'mousedown', function (e) {
1901
+ onResizeHandleMouseDown(e, point, key);
1902
+ });
1903
+ addEvent(chart.dragHandles.group.element, 'mouseover', function () {
1904
+ chart.dragDropData = chart.dragDropData || {};
1905
+ chart.dragDropData.isHoveringHandle = point.id;
1906
+ });
1907
+ addEvent(chart.dragHandles.group.element, 'mouseout', function () {
1908
+ onResizeHandleMouseOut(point);
1909
+ });
1910
+ }
1911
+ });
1912
+ };
1913
+
1914
+
1915
+ /**
1916
+ * Remove the chart's drag handles if they exist.
1917
+ * @private
1918
+ */
1919
+ H.Chart.prototype.hideDragHandles = function () {
1920
+ var chart = this;
1921
+ if (chart.dragHandles) {
1922
+ objectEach(chart.dragHandles, function (val, key) {
1923
+ if (key !== 'group' && val.destroy) {
1924
+ val.destroy();
1925
+ }
1926
+ });
1927
+ if (chart.dragHandles.group && chart.dragHandles.group.destroy) {
1928
+ chart.dragHandles.group.destroy();
1929
+ }
1930
+ delete chart.dragHandles;
1931
+ }
1932
+ };
1933
+
1934
+
1935
+ /**
1936
+ * Utility function to count the number of props in an object.
1937
+ *
1938
+ * @private
1939
+ * @param {object} object
1940
+ * The object to count.
1941
+ *
1942
+ * @return {number}
1943
+ * Number of own properties on the object.
1944
+ */
1945
+ function countProps(object) {
1946
+ var count = 0;
1947
+ for (var p in object) {
1948
+ if (object.hasOwnProperty(p)) {
1949
+ count++;
1950
+ }
1951
+ }
1952
+ return count;
1953
+ }
1954
+
1955
+
1956
+ /**
1957
+ * Utility function to get the value of the first prop of an object. (Note that
1958
+ * the order of keys in an object is usually not guaranteed.)
1959
+ *
1960
+ * @private
1961
+ * @param {object} object
1962
+ * The object to count.
1963
+ *
1964
+ * @return {*}
1965
+ * Value of the first prop in the object.
1966
+ */
1967
+ function getFirstProp(object) {
1968
+ for (var p in object) {
1969
+ if (object.hasOwnProperty(p)) {
1970
+ return object[p];
1971
+ }
1972
+ }
1973
+ }
1974
+
1975
+
1976
+ /**
1977
+ * Mouseover on a point. Show drag handles if the conditions are right.
1978
+ *
1979
+ * @private
1980
+ * @param {Highcharts.Point} point
1981
+ * The point mousing over.
1982
+ */
1983
+ function mouseOver(point) {
1984
+ var series = point.series,
1985
+ chart = series && series.chart;
1986
+ if (
1987
+ chart &&
1988
+ !(chart.dragDropData && chart.dragDropData.isDragging) &&
1989
+ !chart.isDragDropAnimating &&
1990
+ series.options.dragDrop &&
1991
+ !(
1992
+ chart.options &&
1993
+ chart.options.chart &&
1994
+ chart.options.chart.options3d
1995
+ )
1996
+ ) {
1997
+ // Hide the handles if they exist on another point already
1998
+ if (chart.dragHandles) {
1999
+ chart.hideDragHandles();
2000
+ }
2001
+ point.showDragHandles();
2002
+ }
2003
+ }
2004
+
2005
+
2006
+ /**
2007
+ * On container mouse move. Handle drag sensitivity and fire drag event.
2008
+ *
2009
+ * @private
2010
+ * @param {global.Event} e
2011
+ * The mouse move event.
2012
+ *
2013
+ * @param {Highcharts.Chart} chart
2014
+ * The chart we are moving across.
2015
+ */
2016
+ function mouseMove(e, chart) {
2017
+ // Ignore if zoom/pan key is pressed
2018
+ if (chart.zoomOrPanKeyPressed(e)) {
2019
+ return;
2020
+ }
2021
+
2022
+ var dragDropData = chart.dragDropData,
2023
+ point,
2024
+ seriesDragDropOpts,
2025
+ newPoints,
2026
+ numNewPoints = 0,
2027
+ newPoint;
2028
+
2029
+ if (dragDropData && dragDropData.isDragging) {
2030
+ point = dragDropData.point;
2031
+ seriesDragDropOpts = point.series.options.dragDrop;
2032
+
2033
+ // No tooltip for dragging
2034
+ e.preventDefault();
2035
+
2036
+ // Update sensitivity test if not passed yet
2037
+ if (!dragDropData.draggedPastSensitivity) {
2038
+ dragDropData.draggedPastSensitivity = hasDraggedPastSensitivity(
2039
+ e, chart, pick(
2040
+ point.options.dragDrop &&
2041
+ point.options.dragDrop.dragSensitivity,
2042
+ seriesDragDropOpts &&
2043
+ seriesDragDropOpts.dragSensitivity,
2044
+ defaultDragSensitivity
2045
+ )
2046
+ );
2047
+ }
2048
+
2049
+ // If we have dragged past dragSensitivity, run the mousemove handler
2050
+ // for dragging
2051
+ if (dragDropData.draggedPastSensitivity) {
2052
+ // Find the new point values from the moving
2053
+ dragDropData.newPoints = getNewPoints(dragDropData, e);
2054
+
2055
+ // If we are only dragging one point, add it to the event
2056
+ newPoints = dragDropData.newPoints;
2057
+ numNewPoints = countProps(newPoints);
2058
+ newPoint = numNewPoints === 1 ?
2059
+ getFirstProp(newPoints) :
2060
+ null;
2061
+
2062
+ // Run the handler
2063
+ point.firePointEvent('drag', {
2064
+ origin: dragDropData.origin,
2065
+ newPoints: dragDropData.newPoints,
2066
+ newPoint: newPoint && newPoint.newValues,
2067
+ newPointId: newPoint && newPoint.point.id,
2068
+ numNewPoints: numNewPoints,
2069
+ pageX: e.pageX,
2070
+ pageY: e.pageY
2071
+ }, function () {
2072
+ dragMove(e, point);
2073
+ });
2074
+ }
2075
+ }
2076
+ }
2077
+
2078
+
2079
+ /**
2080
+ * On container mouse up. Fire drop event and reset state.
2081
+ *
2082
+ * @private
2083
+ * @param {global.Event} e
2084
+ * The mouse up event.
2085
+ *
2086
+ * @param {Highcharts.Chart} chart
2087
+ * The chart we were dragging in.
2088
+ */
2089
+ function mouseUp(e, chart) {
2090
+ var dragDropData = chart.dragDropData;
2091
+ if (
2092
+ dragDropData &&
2093
+ dragDropData.isDragging &&
2094
+ dragDropData.draggedPastSensitivity
2095
+ ) {
2096
+ var point = dragDropData.point,
2097
+ newPoints = dragDropData.newPoints,
2098
+ numNewPoints = countProps(newPoints),
2099
+ newPoint = numNewPoints === 1 ?
2100
+ getFirstProp(newPoints) :
2101
+ null;
2102
+
2103
+ // Hide the drag handles
2104
+ if (chart.dragHandles) {
2105
+ chart.hideDragHandles();
2106
+ }
2107
+
2108
+ // Prevent default action
2109
+ e.preventDefault();
2110
+ chart.cancelClick = true;
2111
+
2112
+ // Fire the event, with a default handler that updates the points
2113
+ point.firePointEvent('drop', {
2114
+ origin: dragDropData.origin,
2115
+ pageX: e.pageX,
2116
+ pageY: e.pageY,
2117
+ newPoints: newPoints,
2118
+ numNewPoints: numNewPoints,
2119
+ newPoint: newPoint && newPoint.newValues,
2120
+ newPointId: newPoint && newPoint.point.id
2121
+ }, function () {
2122
+ updatePoints(chart);
2123
+ });
2124
+ }
2125
+
2126
+ // Reset
2127
+ delete chart.dragDropData;
2128
+
2129
+ // Clean up the drag guide box if it exists. This is always added on
2130
+ // drag start, even if user is overriding events.
2131
+ if (chart.dragGuideBox) {
2132
+ chart.dragGuideBox.destroy();
2133
+ delete chart.dragGuideBox;
2134
+ }
2135
+ }
2136
+
2137
+
2138
+ /**
2139
+ * On container mouse down. Init dragdrop if conditions are right.
2140
+ *
2141
+ * @private
2142
+ * @param {global.Event} e
2143
+ * The mouse down event.
2144
+ *
2145
+ * @param {Highcharts.Chart} chart
2146
+ * The chart we are clicking.
2147
+ */
2148
+ function mouseDown(e, chart) {
2149
+ var dragPoint = chart.hoverPoint;
2150
+
2151
+ // Reset cancel click
2152
+ chart.cancelClick = false;
2153
+
2154
+ // Ignore if zoom/pan key is pressed
2155
+ if (chart.zoomOrPanKeyPressed(e)) {
2156
+ return;
2157
+ }
2158
+
2159
+ // Prevent zooming
2160
+ chart.mouseIsDown = false;
2161
+
2162
+ // If we somehow get a mousedown event while we are dragging, cancel
2163
+ if (chart.dragDropData && chart.dragDropData.isDragging) {
2164
+ mouseUp(e, chart);
2165
+ return;
2166
+ }
2167
+
2168
+ // If this point is movable, start dragging it
2169
+ if (dragPoint && isPointMovable(dragPoint)) {
2170
+ initDragDrop(e, dragPoint);
2171
+ chart.dragDropData.isDragging = true;
2172
+ dragPoint.firePointEvent('dragStart', e);
2173
+ }
2174
+ }
2175
+
2176
+
2177
+ // Point hover event. We use a short timeout due to issues with coordinating
2178
+ // point mouseover/out events on dragHandles and points. Particularly arearange
2179
+ // series are finicky since the markers are not individual points. This logic
2180
+ // should preferably be improved in the future. Notice that the mouseOut event
2181
+ // below must have a shorter timeout to ensure event order.
2182
+ addEvent(H.Point, 'mouseOver', function () {
2183
+ var point = this;
2184
+ setTimeout(function () {
2185
+ mouseOver(point);
2186
+ }, 12);
2187
+ });
2188
+
2189
+
2190
+ // Point mouseleave event. See above function for explanation of the timeout.
2191
+ addEvent(H.Point, 'mouseOut', function () {
2192
+ var point = this;
2193
+ setTimeout(function () {
2194
+ mouseOut(point);
2195
+ }, 10);
2196
+ });
2197
+
2198
+
2199
+ /**
2200
+ * Check whether the zoomKey or panKey is pressed.
2201
+ *
2202
+ * @private
2203
+ * @param {global.Event} e
2204
+ * A mouse event.
2205
+ *
2206
+ * @return {boolean}
2207
+ * True if the zoom or pan keys are pressed. False otherwise.
2208
+ */
2209
+ H.Chart.prototype.zoomOrPanKeyPressed = function (e) {
2210
+ // Check whether the panKey and zoomKey are set in chart.userOptions
2211
+ var chartOptions = this.userOptions.chart || {},
2212
+ panKey = chartOptions.panKey && chartOptions.panKey + 'Key',
2213
+ zoomKey = chartOptions.zoomKey && chartOptions.zoomKey + 'Key';
2214
+ return (e[zoomKey] || e[panKey]);
2215
+ };
2216
+
2217
+
2218
+ // Add events to document and chart after chart has been created
2219
+ H.Chart.prototype.callbacks.push(function (chart) {
2220
+ var container = chart.container,
2221
+ doc = H.doc;
2222
+
2223
+ // Only enable if we have a draggable chart
2224
+ if (isChartDraggable(chart)) {
2225
+ addEvent(container, 'mousemove', function (e) {
2226
+ mouseMove(e, chart);
2227
+ });
2228
+ addEvent(container, 'touchmove', function (e) {
2229
+ mouseMove(e, chart);
2230
+ });
2231
+ addEvent(container, 'mousedown', function (e) {
2232
+ mouseDown(e, chart);
2233
+ });
2234
+ addEvent(container, 'touchstart', function (e) {
2235
+ mouseDown(e, chart);
2236
+ });
2237
+ addEvent(container, 'mouseleave', function (e) {
2238
+ mouseUp(e, chart);
2239
+ });
2240
+ chart.unbindDragDropMouseUp = addEvent(doc, 'mouseup', function (e) {
2241
+ mouseUp(e, chart);
2242
+ });
2243
+ chart.unbindDragDropTouchEnd = addEvent(doc, 'touchend', function (e) {
2244
+ mouseUp(e, chart);
2245
+ });
2246
+
2247
+ // Add cleanup to make sure we don't pollute document
2248
+ addEvent(chart, 'destroy', function () {
2249
+ if (chart.unbindDragDropMouseUp) {
2250
+ chart.unbindDragDropMouseUp();
2251
+ }
2252
+ if (chart.unbindDragDropTouchEnd) {
2253
+ chart.unbindDragDropTouchEnd();
2254
+ }
2255
+ });
2256
+ }
2257
+ });