highcharts 9.3.2 → 10.1.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 (700) hide show
  1. package/bower.json +1 -1
  2. package/css/highcharts.css +19 -2
  3. package/css/highcharts.scss +17 -2
  4. package/css/themes/dark-unica.css +19 -2
  5. package/css/themes/grid-light.css +19 -2
  6. package/css/themes/sand-signika.css +19 -2
  7. package/es-modules/Accessibility/A11yI18n.js +4 -4
  8. package/es-modules/Accessibility/Accessibility.js +1 -1
  9. package/es-modules/Accessibility/Components/ContainerComponent.js +8 -9
  10. package/es-modules/Accessibility/Components/InfoRegionsComponent.js +14 -9
  11. package/es-modules/Accessibility/Components/LegendComponent.js +31 -23
  12. package/es-modules/Accessibility/Components/MenuComponent.js +15 -5
  13. package/es-modules/Accessibility/Components/RangeSelectorComponent.js +2 -2
  14. package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +7 -6
  15. package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +1 -1
  16. package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js +0 -1
  17. package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +34 -18
  18. package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +84 -33
  19. package/es-modules/Accessibility/Components/ZoomComponent.js +13 -10
  20. package/es-modules/Accessibility/FocusBorder.js +6 -5
  21. package/es-modules/Accessibility/HighContrastMode.js +2 -2
  22. package/es-modules/Accessibility/KeyboardNavigation.js +113 -98
  23. package/es-modules/Accessibility/Options/LangOptions.js +36 -31
  24. package/es-modules/Accessibility/Options/Options.js +66 -3
  25. package/es-modules/Accessibility/ProxyElement.js +14 -6
  26. package/es-modules/Accessibility/ProxyProvider.js +10 -2
  27. package/es-modules/Accessibility/Utils/ChartUtilities.js +9 -4
  28. package/es-modules/Core/Axis/Axis.js +180 -73
  29. package/es-modules/Core/Axis/Color/ColorAxis.js +22 -5
  30. package/es-modules/Core/Axis/GridAxis.js +15 -11
  31. package/es-modules/Core/Axis/LogarithmicAxis.js +1 -1
  32. package/es-modules/Core/Axis/OrdinalAxis.js +3 -2
  33. package/es-modules/Core/Axis/PlotLineOrBand/PlotLineOrBand.js +1 -1
  34. package/es-modules/Core/Axis/StackingAxis.js +0 -1
  35. package/es-modules/Core/Axis/Tick.js +2 -2
  36. package/es-modules/Core/Axis/TreeGridTick.js +11 -0
  37. package/es-modules/Core/Chart/Chart.js +21 -3
  38. package/es-modules/Core/Chart/Chart3D.js +1 -11
  39. package/es-modules/Core/Chart/ChartDefaults.js +43 -11
  40. package/es-modules/Core/Chart/MapChart.js +1 -6
  41. package/es-modules/Core/Chart/StockChart.js +1 -1
  42. package/es-modules/Core/DefaultOptions.js +8 -4
  43. package/es-modules/Core/Geometry/PolygonClip.js +84 -0
  44. package/es-modules/Core/Globals.js +4 -18
  45. package/es-modules/Core/HttpUtilities.js +13 -8
  46. package/es-modules/Core/Legend/Legend.js +11 -9
  47. package/es-modules/Core/Navigator.js +10 -7
  48. package/es-modules/Core/Pointer.js +15 -11
  49. package/es-modules/Core/Renderer/HTML/AST.js +68 -8
  50. package/es-modules/Core/Renderer/SVG/SVGElement.js +47 -63
  51. package/es-modules/Core/Renderer/SVG/SVGElement3D.js +17 -5
  52. package/es-modules/Core/Renderer/SVG/SVGRenderer.js +31 -28
  53. package/es-modules/Core/Renderer/SVG/SVGRenderer3D.js +1 -1
  54. package/es-modules/Core/Renderer/SVG/TextBuilder.js +12 -10
  55. package/es-modules/Core/Scrollbar.js +9 -5
  56. package/es-modules/Core/Series/DataLabel.js +65 -36
  57. package/es-modules/Core/Series/Point.js +2 -2
  58. package/es-modules/Core/Series/Series.js +52 -22
  59. package/es-modules/Core/Series/SeriesDefaults.js +4 -1
  60. package/es-modules/Core/Tooltip.js +14 -31
  61. package/es-modules/Core/Utilities.js +29 -29
  62. package/es-modules/Extensions/Annotations/Annotations.js +9 -2
  63. package/es-modules/Extensions/Annotations/ControlPoint.js +1 -1
  64. package/es-modules/Extensions/Annotations/MockPoint.js +1 -1
  65. package/es-modules/Extensions/Annotations/NavigationBindings.js +9 -1
  66. package/es-modules/Extensions/Annotations/Popup.js +1 -1
  67. package/es-modules/Extensions/Annotations/Types/BasicAnnotation.js +5 -3
  68. package/es-modules/Extensions/Boost/BoostInit.js +6 -1
  69. package/es-modules/Extensions/Boost/BoostOptions.js +26 -0
  70. package/es-modules/Extensions/Boost/Boostables.js +1 -0
  71. package/es-modules/Extensions/Boost/WGLRenderer.js +48 -37
  72. package/es-modules/Extensions/Boost/WGLShader.js +4 -3
  73. package/es-modules/Extensions/Breadcrumbs.js +873 -0
  74. package/es-modules/Extensions/Data.js +26 -14
  75. package/es-modules/Extensions/DataGrouping.js +8 -3
  76. package/es-modules/Extensions/Debugger/ErrorMessages.js +4 -0
  77. package/es-modules/Extensions/DraggablePoints.js +9 -7
  78. package/es-modules/Extensions/Drilldown.js +150 -95
  79. package/es-modules/Extensions/ExportData.js +1 -2
  80. package/es-modules/Extensions/Exporting/Exporting.js +31 -20
  81. package/es-modules/Extensions/Exporting/ExportingDefaults.js +49 -1
  82. package/es-modules/Extensions/FullScreen.js +121 -54
  83. package/es-modules/Extensions/GeoJSON.js +151 -125
  84. package/es-modules/Extensions/MarkerClusters.js +34 -20
  85. package/es-modules/Extensions/OfflineExporting/OfflineExporting.js +110 -22
  86. package/es-modules/Extensions/OfflineExporting/OfflineExportingDefaults.js +1 -1
  87. package/es-modules/Extensions/Oldie/Oldie.js +1 -1
  88. package/es-modules/Extensions/OverlappingDataLabels.js +5 -4
  89. package/es-modules/Extensions/Polar.js +4 -1
  90. package/es-modules/Extensions/ScrollablePlotArea.js +5 -1
  91. package/es-modules/Extensions/Stacking.js +4 -3
  92. package/es-modules/Extensions/Themes/HighContrastDark.js +10 -10
  93. package/es-modules/Extensions/Themes/HighContrastLight.js +10 -10
  94. package/es-modules/Maps/MapNavigation.js +50 -13
  95. package/es-modules/Maps/MapPointer.js +16 -0
  96. package/es-modules/Maps/MapUtilities.js +56 -0
  97. package/es-modules/Maps/MapView.js +611 -136
  98. package/es-modules/Maps/MapViewInsetsOptionsDefault.js +148 -0
  99. package/es-modules/Maps/MapViewOptionsDefault.js +60 -20
  100. package/es-modules/Maps/Projection.js +169 -77
  101. package/es-modules/Maps/Projections/EqualEarth.js +15 -6
  102. package/es-modules/Maps/Projections/LambertConformalConic.js +27 -19
  103. package/es-modules/Maps/Projections/Miller.js +23 -10
  104. package/es-modules/Maps/Projections/Orthographic.js +21 -10
  105. package/es-modules/Maps/Projections/WebMercator.js +25 -13
  106. package/es-modules/Series/ArcDiagram/ArcDiagramPoint.js +77 -0
  107. package/es-modules/Series/ArcDiagram/ArcDiagramSeries.js +589 -0
  108. package/es-modules/Series/CenteredUtilities.js +6 -1
  109. package/es-modules/Series/Column/ColumnSeries.js +4 -3
  110. package/es-modules/Series/DataModifyComposition.js +1 -0
  111. package/es-modules/Series/DependencyWheel/DependencyWheelSeries.js +2 -2
  112. package/es-modules/Series/DrawPointComposition.js +7 -4
  113. package/es-modules/Series/Flags/FlagsSeries.js +7 -12
  114. package/es-modules/Series/Gauge/GaugeSeries.js +1 -1
  115. package/es-modules/Series/Heatmap/HeatmapSeries.js +13 -20
  116. package/es-modules/Series/Lollipop/LollipopSeries.js +1 -1
  117. package/es-modules/Series/Map/MapPoint.js +24 -1
  118. package/es-modules/Series/Map/MapSeries.js +206 -169
  119. package/es-modules/Series/MapBubble/MapBubblePoint.js +16 -24
  120. package/es-modules/Series/MapBubble/MapBubbleSeries.js +58 -1
  121. package/es-modules/Series/MapPoint/MapPointPoint.js +2 -8
  122. package/es-modules/Series/MapPoint/MapPointSeries.js +40 -14
  123. package/es-modules/Series/NodesComposition.js +60 -13
  124. package/es-modules/Series/OHLC/OHLCSeries.js +7 -0
  125. package/es-modules/Series/Organization/OrganizationPoint.js +68 -2
  126. package/es-modules/Series/Organization/OrganizationSeries.js +79 -25
  127. package/es-modules/Series/Pie/PieDataLabel.js +3 -1
  128. package/es-modules/Series/Pie/PiePoint.js +12 -5
  129. package/es-modules/Series/Pie/PieSeries.js +12 -1
  130. package/es-modules/Series/Pie3D/Pie3DSeries.js +19 -0
  131. package/es-modules/Series/Sankey/SankeyColumnComposition.js +193 -0
  132. package/es-modules/Series/Sankey/SankeyPoint.js +37 -1
  133. package/es-modules/Series/Sankey/SankeySeries.js +13 -128
  134. package/es-modules/Series/Scatter/ScatterSeries.js +1 -1
  135. package/es-modules/Series/Sunburst/SunburstSeries.js +14 -3
  136. package/es-modules/Series/Treemap/TreemapSeries.js +88 -80
  137. package/es-modules/Series/Waterfall/WaterfallSeries.js +2 -0
  138. package/es-modules/Series/Wordcloud/WordcloudSeries.js +4 -4
  139. package/es-modules/Stock/Indicators/SMA/SMAIndicator.js +9 -2
  140. package/es-modules/Stock/StockToolsBindings.js +31 -24
  141. package/es-modules/Stock/StockToolsGui.js +1 -1
  142. package/es-modules/masters/highcharts-3d.src.js +1 -1
  143. package/es-modules/masters/highcharts-gantt.src.js +1 -1
  144. package/es-modules/masters/highcharts-more.src.js +1 -1
  145. package/es-modules/masters/highcharts.src.js +1 -1
  146. package/es-modules/masters/highmaps.src.js +1 -1
  147. package/es-modules/masters/highstock.src.js +1 -1
  148. package/es-modules/masters/indicators/acceleration-bands.src.js +1 -1
  149. package/es-modules/masters/indicators/accumulation-distribution.src.js +1 -1
  150. package/es-modules/masters/indicators/ao.src.js +1 -1
  151. package/es-modules/masters/indicators/apo.src.js +1 -1
  152. package/es-modules/masters/indicators/aroon-oscillator.src.js +1 -1
  153. package/es-modules/masters/indicators/aroon.src.js +1 -1
  154. package/es-modules/masters/indicators/atr.src.js +1 -1
  155. package/es-modules/masters/indicators/bollinger-bands.src.js +1 -1
  156. package/es-modules/masters/indicators/cci.src.js +1 -1
  157. package/es-modules/masters/indicators/chaikin.src.js +1 -1
  158. package/es-modules/masters/indicators/cmf.src.js +1 -1
  159. package/es-modules/masters/indicators/cmo.src.js +1 -1
  160. package/es-modules/masters/indicators/dema.src.js +1 -1
  161. package/es-modules/masters/indicators/disparity-index.src.js +1 -1
  162. package/es-modules/masters/indicators/dmi.src.js +1 -1
  163. package/es-modules/masters/indicators/dpo.src.js +1 -1
  164. package/es-modules/masters/indicators/ichimoku-kinko-hyo.src.js +1 -1
  165. package/es-modules/masters/indicators/indicators-all.src.js +1 -1
  166. package/es-modules/masters/indicators/indicators.src.js +1 -1
  167. package/es-modules/masters/indicators/keltner-channels.src.js +1 -1
  168. package/es-modules/masters/indicators/klinger.src.js +1 -1
  169. package/es-modules/masters/indicators/macd.src.js +1 -1
  170. package/es-modules/masters/indicators/mfi.src.js +1 -1
  171. package/es-modules/masters/indicators/momentum.src.js +1 -1
  172. package/es-modules/masters/indicators/natr.src.js +1 -1
  173. package/es-modules/masters/indicators/obv.src.js +1 -1
  174. package/es-modules/masters/indicators/pivot-points.src.js +1 -1
  175. package/es-modules/masters/indicators/ppo.src.js +1 -1
  176. package/es-modules/masters/indicators/price-channel.src.js +1 -1
  177. package/es-modules/masters/indicators/price-envelopes.src.js +1 -1
  178. package/es-modules/masters/indicators/psar.src.js +1 -1
  179. package/es-modules/masters/indicators/regressions.src.js +1 -1
  180. package/es-modules/masters/indicators/roc.src.js +1 -1
  181. package/es-modules/masters/indicators/rsi.src.js +1 -1
  182. package/es-modules/masters/indicators/slow-stochastic.src.js +1 -1
  183. package/es-modules/masters/indicators/stochastic.src.js +1 -1
  184. package/es-modules/masters/indicators/supertrend.src.js +1 -1
  185. package/es-modules/masters/indicators/tema.src.js +1 -1
  186. package/es-modules/masters/indicators/trendline.src.js +1 -1
  187. package/es-modules/masters/indicators/trix.src.js +1 -1
  188. package/es-modules/masters/indicators/volume-by-price.src.js +1 -1
  189. package/es-modules/masters/indicators/vwap.src.js +1 -1
  190. package/es-modules/masters/indicators/williams-r.src.js +1 -1
  191. package/es-modules/masters/indicators/wma.src.js +1 -1
  192. package/es-modules/masters/indicators/zigzag.src.js +1 -1
  193. package/es-modules/masters/modules/accessibility.src.js +1 -1
  194. package/es-modules/masters/modules/annotations-advanced.src.js +1 -1
  195. package/es-modules/masters/modules/annotations.src.js +1 -1
  196. package/es-modules/masters/modules/arc-diagram.src.js +14 -0
  197. package/es-modules/masters/modules/arrow-symbols.src.js +1 -1
  198. package/es-modules/masters/modules/boost-canvas.src.js +1 -1
  199. package/es-modules/masters/modules/boost.src.js +1 -1
  200. package/es-modules/masters/modules/broken-axis.src.js +1 -1
  201. package/es-modules/masters/modules/bullet.src.js +1 -1
  202. package/es-modules/masters/modules/coloraxis.src.js +1 -1
  203. package/es-modules/masters/modules/current-date-indicator.src.js +1 -1
  204. package/es-modules/masters/modules/cylinder.src.js +1 -1
  205. package/es-modules/masters/modules/data.src.js +1 -1
  206. package/es-modules/masters/modules/datagrouping.src.js +1 -1
  207. package/es-modules/masters/modules/debugger.src.js +1 -1
  208. package/es-modules/masters/modules/dependency-wheel.src.js +1 -1
  209. package/es-modules/masters/modules/dotplot.src.js +1 -1
  210. package/es-modules/masters/modules/drag-panes.src.js +1 -1
  211. package/es-modules/masters/modules/draggable-points.src.js +1 -1
  212. package/es-modules/masters/modules/drilldown.src.js +2 -1
  213. package/es-modules/masters/modules/dumbbell.src.js +1 -1
  214. package/es-modules/masters/modules/export-data.src.js +1 -1
  215. package/es-modules/masters/modules/exporting.src.js +1 -1
  216. package/es-modules/masters/modules/full-screen.src.js +1 -1
  217. package/es-modules/masters/modules/funnel.src.js +1 -1
  218. package/es-modules/masters/modules/funnel3d.src.js +1 -1
  219. package/es-modules/masters/modules/gantt.src.js +1 -1
  220. package/es-modules/masters/modules/grid-axis.src.js +1 -1
  221. package/es-modules/masters/modules/heatmap.src.js +1 -1
  222. package/es-modules/masters/modules/heikinashi.src.js +1 -1
  223. package/es-modules/masters/modules/histogram-bellcurve.src.js +1 -1
  224. package/es-modules/masters/modules/hollowcandlestick.src.js +1 -1
  225. package/es-modules/masters/modules/item-series.src.js +1 -1
  226. package/es-modules/masters/modules/lollipop.src.js +1 -1
  227. package/es-modules/masters/modules/map.src.js +5 -1
  228. package/es-modules/masters/modules/marker-clusters.src.js +1 -1
  229. package/es-modules/masters/modules/networkgraph.src.js +1 -1
  230. package/es-modules/masters/modules/no-data-to-display.src.js +1 -1
  231. package/es-modules/masters/modules/offline-exporting.src.js +1 -1
  232. package/es-modules/masters/modules/oldie-polyfills.src.js +1 -1
  233. package/es-modules/masters/modules/oldie.src.js +1 -1
  234. package/es-modules/masters/modules/organization.src.js +1 -1
  235. package/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
  236. package/es-modules/masters/modules/parallel-coordinates.src.js +1 -1
  237. package/es-modules/masters/modules/pareto.src.js +1 -1
  238. package/es-modules/masters/modules/pathfinder.src.js +1 -1
  239. package/es-modules/masters/modules/pattern-fill.src.js +1 -1
  240. package/es-modules/masters/modules/price-indicator.src.js +1 -1
  241. package/es-modules/masters/modules/pyramid3d.src.js +1 -1
  242. package/es-modules/masters/modules/sankey.src.js +1 -1
  243. package/es-modules/masters/modules/series-label.src.js +1 -1
  244. package/es-modules/masters/modules/solid-gauge.src.js +1 -1
  245. package/es-modules/masters/modules/sonification.src.js +1 -1
  246. package/es-modules/masters/modules/static-scale.src.js +1 -1
  247. package/es-modules/masters/modules/stock-tools.src.js +1 -1
  248. package/es-modules/masters/modules/stock.src.js +1 -1
  249. package/es-modules/masters/modules/streamgraph.src.js +1 -1
  250. package/es-modules/masters/modules/sunburst.src.js +1 -1
  251. package/es-modules/masters/modules/tilemap.src.js +1 -1
  252. package/es-modules/masters/modules/timeline.src.js +1 -1
  253. package/es-modules/masters/modules/treegrid.src.js +1 -1
  254. package/es-modules/masters/modules/treemap.src.js +5 -1
  255. package/es-modules/masters/modules/variable-pie.src.js +1 -1
  256. package/es-modules/masters/modules/variwide.src.js +1 -1
  257. package/es-modules/masters/modules/vector.src.js +1 -1
  258. package/es-modules/masters/modules/venn.src.js +1 -1
  259. package/es-modules/masters/modules/windbarb.src.js +1 -1
  260. package/es-modules/masters/modules/wordcloud.src.js +1 -1
  261. package/es-modules/masters/modules/xrange.src.js +1 -1
  262. package/es-modules/masters/themes/avocado.src.js +1 -1
  263. package/es-modules/masters/themes/brand-dark.src.js +1 -1
  264. package/es-modules/masters/themes/brand-light.src.js +1 -1
  265. package/es-modules/masters/themes/dark-blue.src.js +1 -1
  266. package/es-modules/masters/themes/dark-green.src.js +1 -1
  267. package/es-modules/masters/themes/dark-unica.src.js +1 -1
  268. package/es-modules/masters/themes/gray.src.js +1 -1
  269. package/es-modules/masters/themes/grid-light.src.js +1 -1
  270. package/es-modules/masters/themes/grid.src.js +1 -1
  271. package/es-modules/masters/themes/high-contrast-dark.src.js +1 -1
  272. package/es-modules/masters/themes/high-contrast-light.src.js +1 -1
  273. package/es-modules/masters/themes/sand-signika.src.js +1 -1
  274. package/es-modules/masters/themes/skies.src.js +1 -1
  275. package/es-modules/masters/themes/sunset.src.js +1 -1
  276. package/highcharts-3d.js +99 -98
  277. package/highcharts-3d.js.map +1 -1
  278. package/highcharts-3d.src.js +51 -21
  279. package/highcharts-gantt.js +808 -800
  280. package/highcharts-gantt.js.map +1 -1
  281. package/highcharts-gantt.src.js +781 -426
  282. package/highcharts-more.js +195 -194
  283. package/highcharts-more.js.map +1 -1
  284. package/highcharts-more.src.js +18 -4
  285. package/highcharts.d.ts +3224 -542
  286. package/highcharts.js +592 -584
  287. package/highcharts.js.map +1 -1
  288. package/highcharts.src.d.ts +3224 -542
  289. package/highcharts.src.js +732 -400
  290. package/highmaps.js +760 -728
  291. package/highmaps.js.map +1 -1
  292. package/highmaps.src.js +3840 -2189
  293. package/highstock.js +793 -786
  294. package/highstock.js.map +1 -1
  295. package/highstock.src.js +783 -432
  296. package/indicators/acceleration-bands.js +12 -11
  297. package/indicators/acceleration-bands.js.map +1 -1
  298. package/indicators/acceleration-bands.src.js +11 -2
  299. package/indicators/accumulation-distribution.js +5 -5
  300. package/indicators/accumulation-distribution.js.map +1 -1
  301. package/indicators/accumulation-distribution.src.js +11 -2
  302. package/indicators/ao.js +6 -6
  303. package/indicators/ao.js.map +1 -1
  304. package/indicators/ao.src.js +11 -2
  305. package/indicators/apo.js +5 -5
  306. package/indicators/apo.js.map +1 -1
  307. package/indicators/apo.src.js +11 -2
  308. package/indicators/aroon-oscillator.js +10 -10
  309. package/indicators/aroon-oscillator.js.map +1 -1
  310. package/indicators/aroon-oscillator.src.js +11 -2
  311. package/indicators/aroon.js +11 -11
  312. package/indicators/aroon.js.map +1 -1
  313. package/indicators/aroon.src.js +11 -2
  314. package/indicators/atr.js +5 -5
  315. package/indicators/atr.js.map +1 -1
  316. package/indicators/atr.src.js +11 -2
  317. package/indicators/bollinger-bands.js +12 -12
  318. package/indicators/bollinger-bands.js.map +1 -1
  319. package/indicators/bollinger-bands.src.js +11 -2
  320. package/indicators/cci.js +5 -5
  321. package/indicators/cci.js.map +1 -1
  322. package/indicators/cci.src.js +11 -2
  323. package/indicators/chaikin.js +8 -8
  324. package/indicators/chaikin.js.map +1 -1
  325. package/indicators/chaikin.src.js +11 -2
  326. package/indicators/cmf.js +6 -6
  327. package/indicators/cmf.js.map +1 -1
  328. package/indicators/cmf.src.js +11 -2
  329. package/indicators/cmo.js +5 -5
  330. package/indicators/cmo.js.map +1 -1
  331. package/indicators/cmo.src.js +11 -2
  332. package/indicators/dema.js +5 -5
  333. package/indicators/dema.js.map +1 -1
  334. package/indicators/dema.src.js +11 -2
  335. package/indicators/disparity-index.js +6 -6
  336. package/indicators/disparity-index.js.map +1 -1
  337. package/indicators/disparity-index.src.js +11 -2
  338. package/indicators/dmi.js +12 -12
  339. package/indicators/dmi.js.map +1 -1
  340. package/indicators/dmi.src.js +11 -2
  341. package/indicators/dpo.js +5 -5
  342. package/indicators/dpo.js.map +1 -1
  343. package/indicators/dpo.src.js +11 -2
  344. package/indicators/ema.js +2 -1
  345. package/indicators/ema.js.map +1 -1
  346. package/indicators/ema.src.js +10 -1
  347. package/indicators/ichimoku-kinko-hyo.js +16 -16
  348. package/indicators/ichimoku-kinko-hyo.js.map +1 -1
  349. package/indicators/ichimoku-kinko-hyo.src.js +11 -2
  350. package/indicators/indicators-all.js +195 -194
  351. package/indicators/indicators-all.js.map +1 -1
  352. package/indicators/indicators-all.src.js +21 -5
  353. package/indicators/indicators.js +13 -12
  354. package/indicators/indicators.js.map +1 -1
  355. package/indicators/indicators.src.js +21 -5
  356. package/indicators/keltner-channels.js +12 -11
  357. package/indicators/keltner-channels.js.map +1 -1
  358. package/indicators/keltner-channels.src.js +11 -2
  359. package/indicators/klinger.js +13 -13
  360. package/indicators/klinger.js.map +1 -1
  361. package/indicators/klinger.src.js +11 -2
  362. package/indicators/macd.js +12 -11
  363. package/indicators/macd.js.map +1 -1
  364. package/indicators/macd.src.js +11 -2
  365. package/indicators/mfi.js +6 -6
  366. package/indicators/mfi.js.map +1 -1
  367. package/indicators/mfi.src.js +11 -2
  368. package/indicators/momentum.js +5 -5
  369. package/indicators/momentum.js.map +1 -1
  370. package/indicators/momentum.src.js +11 -2
  371. package/indicators/natr.js +5 -4
  372. package/indicators/natr.js.map +1 -1
  373. package/indicators/natr.src.js +11 -2
  374. package/indicators/obv.js +5 -5
  375. package/indicators/obv.js.map +1 -1
  376. package/indicators/obv.src.js +11 -2
  377. package/indicators/pivot-points.js +11 -11
  378. package/indicators/pivot-points.js.map +1 -1
  379. package/indicators/pivot-points.src.js +11 -2
  380. package/indicators/ppo.js +5 -5
  381. package/indicators/ppo.js.map +1 -1
  382. package/indicators/ppo.src.js +11 -2
  383. package/indicators/price-channel.js +11 -11
  384. package/indicators/price-channel.js.map +1 -1
  385. package/indicators/price-channel.src.js +11 -2
  386. package/indicators/price-envelopes.js +8 -8
  387. package/indicators/price-envelopes.js.map +1 -1
  388. package/indicators/price-envelopes.src.js +11 -2
  389. package/indicators/psar.js +7 -6
  390. package/indicators/psar.js.map +1 -1
  391. package/indicators/psar.src.js +11 -2
  392. package/indicators/regressions.js +12 -12
  393. package/indicators/regressions.js.map +1 -1
  394. package/indicators/regressions.src.js +11 -2
  395. package/indicators/roc.js +5 -5
  396. package/indicators/roc.js.map +1 -1
  397. package/indicators/roc.src.js +11 -2
  398. package/indicators/rsi.js +6 -5
  399. package/indicators/rsi.js.map +1 -1
  400. package/indicators/rsi.src.js +11 -2
  401. package/indicators/slow-stochastic.js +5 -5
  402. package/indicators/slow-stochastic.js.map +1 -1
  403. package/indicators/slow-stochastic.src.js +11 -2
  404. package/indicators/stochastic.js +12 -12
  405. package/indicators/stochastic.js.map +1 -1
  406. package/indicators/stochastic.src.js +11 -2
  407. package/indicators/supertrend.js +10 -10
  408. package/indicators/supertrend.js.map +1 -1
  409. package/indicators/supertrend.src.js +11 -2
  410. package/indicators/tema.js +6 -6
  411. package/indicators/tema.js.map +1 -1
  412. package/indicators/tema.src.js +11 -2
  413. package/indicators/trendline.js +5 -5
  414. package/indicators/trendline.js.map +1 -1
  415. package/indicators/trendline.src.js +11 -2
  416. package/indicators/trix.js +4 -4
  417. package/indicators/trix.js.map +1 -1
  418. package/indicators/trix.src.js +11 -2
  419. package/indicators/volume-by-price.js +17 -17
  420. package/indicators/volume-by-price.js.map +1 -1
  421. package/indicators/volume-by-price.src.js +11 -2
  422. package/indicators/vwap.js +5 -5
  423. package/indicators/vwap.js.map +1 -1
  424. package/indicators/vwap.src.js +11 -2
  425. package/indicators/williams-r.js +6 -5
  426. package/indicators/williams-r.js.map +1 -1
  427. package/indicators/williams-r.src.js +11 -2
  428. package/indicators/wma.js +5 -5
  429. package/indicators/wma.js.map +1 -1
  430. package/indicators/wma.src.js +11 -2
  431. package/indicators/zigzag.js +6 -6
  432. package/indicators/zigzag.js.map +1 -1
  433. package/indicators/zigzag.src.js +11 -2
  434. package/lib/jspdf.js +299 -184
  435. package/lib/jspdf.src.js +25266 -18067
  436. package/lib/svg2pdf.js +35 -31
  437. package/lib/svg2pdf.src.js +5721 -4179
  438. package/modules/accessibility.js +245 -240
  439. package/modules/accessibility.js.map +1 -1
  440. package/modules/accessibility.src.js +510 -283
  441. package/modules/annotations-advanced.js +144 -144
  442. package/modules/annotations-advanced.js.map +1 -1
  443. package/modules/annotations-advanced.src.js +37 -11
  444. package/modules/annotations.js +79 -79
  445. package/modules/annotations.js.map +1 -1
  446. package/modules/annotations.src.js +32 -8
  447. package/modules/arc-diagram.js +25 -0
  448. package/modules/arc-diagram.js.map +1 -0
  449. package/modules/arc-diagram.src.js +778 -0
  450. package/modules/arrow-symbols.js +4 -3
  451. package/modules/arrow-symbols.js.map +1 -1
  452. package/modules/arrow-symbols.src.js +11 -2
  453. package/modules/boost-canvas.js +15 -15
  454. package/modules/boost-canvas.js.map +1 -1
  455. package/modules/boost-canvas.src.js +11 -2
  456. package/modules/boost.js +80 -79
  457. package/modules/boost.js.map +1 -1
  458. package/modules/boost.src.js +71 -43
  459. package/modules/broken-axis.js +13 -13
  460. package/modules/broken-axis.js.map +1 -1
  461. package/modules/broken-axis.src.js +11 -2
  462. package/modules/bullet.js +9 -9
  463. package/modules/bullet.js.map +1 -1
  464. package/modules/bullet.src.js +11 -2
  465. package/modules/coloraxis.js +24 -24
  466. package/modules/coloraxis.js.map +1 -1
  467. package/modules/coloraxis.src.js +33 -7
  468. package/modules/current-date-indicator.js +5 -4
  469. package/modules/current-date-indicator.js.map +1 -1
  470. package/modules/current-date-indicator.src.js +11 -2
  471. package/modules/cylinder.js +11 -11
  472. package/modules/cylinder.js.map +1 -1
  473. package/modules/cylinder.src.js +11 -2
  474. package/modules/data.js +34 -33
  475. package/modules/data.js.map +1 -1
  476. package/modules/data.src.js +59 -32
  477. package/modules/datagrouping.js +21 -20
  478. package/modules/datagrouping.js.map +1 -1
  479. package/modules/datagrouping.src.js +19 -5
  480. package/modules/debugger.js +8 -7
  481. package/modules/debugger.js.map +1 -1
  482. package/modules/debugger.src.js +15 -2
  483. package/modules/dependency-wheel.js +12 -11
  484. package/modules/dependency-wheel.js.map +1 -1
  485. package/modules/dependency-wheel.src.js +14 -5
  486. package/modules/dotplot.js +6 -6
  487. package/modules/dotplot.js.map +1 -1
  488. package/modules/dotplot.src.js +11 -2
  489. package/modules/drag-panes.js +10 -10
  490. package/modules/drag-panes.js.map +1 -1
  491. package/modules/drag-panes.src.js +11 -2
  492. package/modules/draggable-points.js +35 -34
  493. package/modules/draggable-points.js.map +1 -1
  494. package/modules/draggable-points.src.js +20 -9
  495. package/modules/drilldown.d.ts +19 -0
  496. package/modules/drilldown.js +36 -25
  497. package/modules/drilldown.js.map +1 -1
  498. package/modules/drilldown.src.d.ts +19 -0
  499. package/modules/drilldown.src.js +1091 -106
  500. package/modules/dumbbell.js +17 -17
  501. package/modules/dumbbell.js.map +1 -1
  502. package/modules/dumbbell.src.js +11 -2
  503. package/modules/export-data.js +21 -20
  504. package/modules/export-data.js.map +1 -1
  505. package/modules/export-data.src.js +12 -4
  506. package/modules/exporting.js +39 -39
  507. package/modules/exporting.js.map +1 -1
  508. package/modules/exporting.src.js +227 -92
  509. package/modules/full-screen.js +8 -7
  510. package/modules/full-screen.js.map +1 -1
  511. package/modules/full-screen.src.js +135 -58
  512. package/modules/funnel.js +12 -12
  513. package/modules/funnel.js.map +1 -1
  514. package/modules/funnel.src.js +11 -2
  515. package/modules/funnel3d.js +21 -21
  516. package/modules/funnel3d.js.map +1 -1
  517. package/modules/funnel3d.src.js +11 -2
  518. package/modules/gantt.js +216 -215
  519. package/modules/gantt.js.map +1 -1
  520. package/modules/gantt.src.js +60 -28
  521. package/modules/grid-axis.js +23 -23
  522. package/modules/grid-axis.js.map +1 -1
  523. package/modules/grid-axis.src.js +27 -13
  524. package/modules/heatmap.js +40 -39
  525. package/modules/heatmap.js.map +1 -1
  526. package/modules/heatmap.src.js +46 -27
  527. package/modules/heikinashi.js +8 -8
  528. package/modules/heikinashi.js.map +1 -1
  529. package/modules/heikinashi.src.js +11 -2
  530. package/modules/histogram-bellcurve.js +13 -13
  531. package/modules/histogram-bellcurve.js.map +1 -1
  532. package/modules/histogram-bellcurve.src.js +11 -2
  533. package/modules/hollowcandlestick.js +9 -9
  534. package/modules/hollowcandlestick.js.map +1 -1
  535. package/modules/hollowcandlestick.src.js +11 -2
  536. package/modules/item-series.js +12 -12
  537. package/modules/item-series.js.map +1 -1
  538. package/modules/item-series.src.js +11 -2
  539. package/modules/lollipop.js +7 -7
  540. package/modules/lollipop.js.map +1 -1
  541. package/modules/lollipop.src.js +12 -3
  542. package/modules/map.d.ts +80 -43
  543. package/modules/map.js +169 -144
  544. package/modules/map.js.map +1 -1
  545. package/modules/map.src.d.ts +80 -43
  546. package/modules/map.src.js +8024 -6696
  547. package/modules/marker-clusters.js +36 -36
  548. package/modules/marker-clusters.js.map +1 -1
  549. package/modules/marker-clusters.src.js +47 -23
  550. package/modules/networkgraph.d.ts +5 -0
  551. package/modules/networkgraph.js +49 -48
  552. package/modules/networkgraph.js.map +1 -1
  553. package/modules/networkgraph.src.d.ts +5 -0
  554. package/modules/networkgraph.src.js +77 -15
  555. package/modules/no-data-to-display.js +5 -5
  556. package/modules/no-data-to-display.js.map +1 -1
  557. package/modules/no-data-to-display.src.js +11 -2
  558. package/modules/offline-exporting.js +20 -18
  559. package/modules/offline-exporting.js.map +1 -1
  560. package/modules/offline-exporting.src.js +126 -25
  561. package/modules/oldie-polyfills.js +7 -7
  562. package/modules/oldie-polyfills.js.map +1 -1
  563. package/modules/oldie-polyfills.src.js +11 -2
  564. package/modules/oldie.js +30 -30
  565. package/modules/oldie.js.map +1 -1
  566. package/modules/oldie.src.js +12 -3
  567. package/modules/organization.js +16 -14
  568. package/modules/organization.js.map +1 -1
  569. package/modules/organization.src.js +166 -32
  570. package/modules/overlapping-datalabels.js +3 -2
  571. package/modules/overlapping-datalabels.js.map +1 -1
  572. package/modules/overlapping-datalabels.src.js +11 -2
  573. package/modules/parallel-coordinates.js +11 -11
  574. package/modules/parallel-coordinates.js.map +1 -1
  575. package/modules/parallel-coordinates.src.js +11 -2
  576. package/modules/pareto.js +7 -7
  577. package/modules/pareto.js.map +1 -1
  578. package/modules/pareto.src.js +11 -2
  579. package/modules/pathfinder.js +31 -31
  580. package/modules/pathfinder.js.map +1 -1
  581. package/modules/pathfinder.src.js +11 -2
  582. package/modules/pattern-fill.js +14 -14
  583. package/modules/pattern-fill.js.map +1 -1
  584. package/modules/pattern-fill.src.js +11 -2
  585. package/modules/price-indicator.js +5 -5
  586. package/modules/price-indicator.js.map +1 -1
  587. package/modules/price-indicator.src.js +11 -2
  588. package/modules/pyramid3d.js +4 -4
  589. package/modules/pyramid3d.js.map +1 -1
  590. package/modules/pyramid3d.src.js +11 -2
  591. package/modules/sankey.d.ts +5 -0
  592. package/modules/sankey.js +32 -29
  593. package/modules/sankey.js.map +1 -1
  594. package/modules/sankey.src.d.ts +5 -0
  595. package/modules/sankey.src.js +341 -157
  596. package/modules/series-label.js +18 -17
  597. package/modules/series-label.js.map +1 -1
  598. package/modules/series-label.src.js +11 -2
  599. package/modules/solid-gauge.js +10 -10
  600. package/modules/solid-gauge.js.map +1 -1
  601. package/modules/solid-gauge.src.js +11 -2
  602. package/modules/sonification.js +59 -59
  603. package/modules/sonification.js.map +1 -1
  604. package/modules/sonification.src.js +11 -2
  605. package/modules/static-scale.js +5 -4
  606. package/modules/static-scale.js.map +1 -1
  607. package/modules/static-scale.src.js +11 -2
  608. package/modules/stock-tools.js +145 -145
  609. package/modules/stock-tools.js.map +1 -1
  610. package/modules/stock-tools.src.js +64 -32
  611. package/modules/stock.js +204 -204
  612. package/modules/stock.js.map +1 -1
  613. package/modules/stock.src.js +62 -34
  614. package/modules/streamgraph.js +5 -4
  615. package/modules/streamgraph.js.map +1 -1
  616. package/modules/streamgraph.src.js +11 -2
  617. package/modules/sunburst.d.ts +3 -0
  618. package/modules/sunburst.js +73 -60
  619. package/modules/sunburst.js.map +1 -1
  620. package/modules/sunburst.src.d.ts +3 -0
  621. package/modules/sunburst.src.js +1048 -97
  622. package/modules/tilemap.js +17 -17
  623. package/modules/tilemap.js.map +1 -1
  624. package/modules/tilemap.src.js +11 -2
  625. package/modules/timeline.js +18 -18
  626. package/modules/timeline.js.map +1 -1
  627. package/modules/timeline.src.js +11 -2
  628. package/modules/treegrid.js +57 -56
  629. package/modules/treegrid.js.map +1 -1
  630. package/modules/treegrid.src.js +38 -13
  631. package/modules/treemap.d.ts +3 -0
  632. package/modules/treemap.js +53 -41
  633. package/modules/treemap.js.map +1 -1
  634. package/modules/treemap.src.d.ts +3 -0
  635. package/modules/treemap.src.js +1037 -95
  636. package/modules/variable-pie.js +9 -9
  637. package/modules/variable-pie.js.map +1 -1
  638. package/modules/variable-pie.src.js +11 -2
  639. package/modules/variwide.js +12 -12
  640. package/modules/variwide.js.map +1 -1
  641. package/modules/variwide.src.js +11 -2
  642. package/modules/vector.js +8 -7
  643. package/modules/vector.js.map +1 -1
  644. package/modules/vector.src.js +11 -2
  645. package/modules/venn.js +31 -31
  646. package/modules/venn.js.map +1 -1
  647. package/modules/venn.src.js +18 -6
  648. package/modules/windbarb.js +15 -15
  649. package/modules/windbarb.js.map +1 -1
  650. package/modules/windbarb.src.js +11 -2
  651. package/modules/wordcloud.js +24 -23
  652. package/modules/wordcloud.js.map +1 -1
  653. package/modules/wordcloud.src.js +22 -10
  654. package/modules/xrange.js +16 -16
  655. package/modules/xrange.js.map +1 -1
  656. package/modules/xrange.src.js +11 -2
  657. package/package.json +1 -1
  658. package/themes/avocado.js +4 -3
  659. package/themes/avocado.js.map +1 -1
  660. package/themes/avocado.src.js +11 -2
  661. package/themes/brand-dark.js +9 -8
  662. package/themes/brand-dark.js.map +1 -1
  663. package/themes/brand-dark.src.js +11 -2
  664. package/themes/brand-light.js +8 -8
  665. package/themes/brand-light.js.map +1 -1
  666. package/themes/brand-light.src.js +11 -2
  667. package/themes/dark-blue.js +9 -8
  668. package/themes/dark-blue.js.map +1 -1
  669. package/themes/dark-blue.src.js +11 -2
  670. package/themes/dark-green.js +9 -8
  671. package/themes/dark-green.js.map +1 -1
  672. package/themes/dark-green.src.js +11 -2
  673. package/themes/dark-unica.js +8 -7
  674. package/themes/dark-unica.js.map +1 -1
  675. package/themes/dark-unica.src.js +11 -2
  676. package/themes/gray.js +9 -8
  677. package/themes/gray.js.map +1 -1
  678. package/themes/gray.src.js +11 -2
  679. package/themes/grid-light.js +5 -4
  680. package/themes/grid-light.js.map +1 -1
  681. package/themes/grid-light.src.js +11 -2
  682. package/themes/grid.js +5 -5
  683. package/themes/grid.js.map +1 -1
  684. package/themes/grid.src.js +11 -2
  685. package/themes/high-contrast-dark.js +7 -7
  686. package/themes/high-contrast-dark.js.map +1 -1
  687. package/themes/high-contrast-dark.src.js +21 -12
  688. package/themes/high-contrast-light.js +3 -3
  689. package/themes/high-contrast-light.js.map +1 -1
  690. package/themes/high-contrast-light.src.js +21 -12
  691. package/themes/sand-signika.js +5 -5
  692. package/themes/sand-signika.js.map +1 -1
  693. package/themes/sand-signika.src.js +11 -2
  694. package/themes/skies.js +5 -5
  695. package/themes/skies.js.map +1 -1
  696. package/themes/skies.src.js +11 -2
  697. package/themes/sunset.js +3 -3
  698. package/themes/sunset.js.map +1 -1
  699. package/themes/sunset.src.js +11 -2
  700. package/es-modules/Maps/ProjectionDefinition.js +0 -9
@@ -8,16 +8,72 @@
8
8
  *
9
9
  * */
10
10
  'use strict';
11
+ var __extends = (this && this.__extends) || (function () {
12
+ var extendStatics = function (d, b) {
13
+ extendStatics = Object.setPrototypeOf ||
14
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
15
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16
+ return extendStatics(d, b);
17
+ };
18
+ return function (d, b) {
19
+ extendStatics(d, b);
20
+ function __() { this.constructor = d; }
21
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
22
+ };
23
+ })();
24
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
25
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
26
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
27
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
28
+ r[k] = a[j];
29
+ return r;
30
+ };
11
31
  import defaultOptions from './MapViewOptionsDefault.js';
32
+ import defaultInsetsOptions from './MapViewInsetsOptionsDefault.js';
33
+ import GeoJSONModule from '../Extensions/GeoJSON.js';
34
+ var topo2geo = GeoJSONModule.topo2geo;
35
+ import MapChart from '../Core/Chart/MapChart.js';
36
+ var maps = MapChart.maps;
37
+ import MU from './MapUtilities.js';
38
+ var boundsFromPath = MU.boundsFromPath, pointInPolygon = MU.pointInPolygon;
12
39
  import Projection from './Projection.js';
13
40
  import U from '../Core/Utilities.js';
14
- var addEvent = U.addEvent, clamp = U.clamp, fireEvent = U.fireEvent, isNumber = U.isNumber, merge = U.merge, pick = U.pick, relativeLength = U.relativeLength;
41
+ var addEvent = U.addEvent, clamp = U.clamp, fireEvent = U.fireEvent, isArray = U.isArray, isNumber = U.isNumber, isObject = U.isObject, isString = U.isString, merge = U.merge, pick = U.pick, relativeLength = U.relativeLength;
15
42
  /**
16
43
  * The world size in terms of 10k meters in the Web Mercator projection, to
17
44
  * match a 256 square tile to zoom level 0
18
45
  */
19
46
  var worldSize = 400.979322;
20
47
  var tileSize = 256;
48
+ // Compute the zoom from given bounds and the size of the playing field. Used in
49
+ // two places, hence the local function.
50
+ var zoomFromBounds = function (b, playingField) {
51
+ var width = playingField.width, height = playingField.height, scaleToField = Math.max((b.x2 - b.x1) / (width / tileSize), (b.y2 - b.y1) / (height / tileSize));
52
+ return Math.log(worldSize / scaleToField) / Math.log(2);
53
+ };
54
+ /*
55
+ const mergeCollections = <
56
+ T extends Array<AnyRecord|undefined>
57
+ >(a: T, b: T): T => {
58
+ b.forEach((newer, i): void => {
59
+ // Only merge by id supported for now. We may consider later to support
60
+ // more complex rules like those of `Chart.update` with `oneToOne`, but
61
+ // it is probably not needed. Existing insets can be disabled by
62
+ // overwriting the `geoBounds` with empty data.
63
+ if (newer && isString(newer.id)) {
64
+ const older = U.find(
65
+ a,
66
+ (aItem): boolean => (aItem && aItem.id) === newer.id
67
+ );
68
+ if (older) {
69
+ const aIndex = a.indexOf(older);
70
+ a[aIndex] = merge(older, newer);
71
+ }
72
+ }
73
+ });
74
+ return a;
75
+ };
76
+ */
21
77
  /**
22
78
  * The map view handles zooming and centering on the map, and various
23
79
  * client-side projection capabilities.
@@ -35,8 +91,60 @@ var tileSize = 256;
35
91
  var MapView = /** @class */ (function () {
36
92
  function MapView(chart, options) {
37
93
  var _this = this;
94
+ this.insets = [];
95
+ this.padding = [0, 0, 0, 0];
96
+ this.eventsToUnbind = [];
97
+ var recommendedMapView;
98
+ var recommendedProjection;
99
+ if (!(this instanceof MapViewInset)) {
100
+ // Handle the global map and series-level mapData
101
+ var geoMaps = __spreadArrays([
102
+ chart.options.chart.map
103
+ ], (chart.options.series || []).map(function (s) { return s.mapData; })).map(function (mapData) { return _this.getGeoMap(mapData); });
104
+ var allGeoBounds_1 = [];
105
+ geoMaps.forEach(function (geoMap) {
106
+ if (geoMap) {
107
+ // Use the first geo map as main
108
+ if (!recommendedMapView) {
109
+ recommendedMapView = geoMap['hc-recommended-mapview'];
110
+ }
111
+ // Combine the bounding boxes of all loaded maps
112
+ if (geoMap.bbox) {
113
+ var _a = geoMap.bbox, x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
114
+ allGeoBounds_1.push({ x1: x1, y1: y1, x2: x2, y2: y2 });
115
+ }
116
+ }
117
+ });
118
+ // Get the composite bounds
119
+ var geoBounds = (allGeoBounds_1.length &&
120
+ MapView.compositeBounds(allGeoBounds_1));
121
+ // Provide a best-guess recommended projection if not set in the map
122
+ // or in user options
123
+ if (geoBounds) {
124
+ var x1 = geoBounds.x1, y1 = geoBounds.y1, x2 = geoBounds.x2, y2 = geoBounds.y2;
125
+ recommendedProjection = (x2 - x1 > 180 && y2 - y1 > 90) ?
126
+ // Wide angle, go for the world view
127
+ {
128
+ name: 'EqualEarth'
129
+ } :
130
+ // Narrower angle, use a projection better suited for local
131
+ // view
132
+ {
133
+ name: 'LambertConformalConic',
134
+ parallels: [y1, y2],
135
+ rotation: [-(x1 + x2) / 2]
136
+ };
137
+ }
138
+ // Register the main geo map (from options.chart.map) if set
139
+ this.geoMap = geoMaps[0];
140
+ }
38
141
  this.userOptions = options || {};
39
- var o = merge(defaultOptions, options);
142
+ var o = merge(defaultOptions, { projection: recommendedProjection }, recommendedMapView, options);
143
+ // Merge the inset collections by id, or index if id missing
144
+ var recInsets = recommendedMapView && recommendedMapView.insets, optInsets = options && options.insets;
145
+ if (recInsets && optInsets) {
146
+ o.insets = MapView.mergeInsets(recInsets, optInsets);
147
+ }
40
148
  this.chart = chart;
41
149
  /**
42
150
  * The current center of the view in terms of `[longitude, latitude]`.
@@ -47,6 +155,9 @@ var MapView = /** @class */ (function () {
47
155
  this.center = o.center;
48
156
  this.options = o;
49
157
  this.projection = new Projection(o.projection);
158
+ // Initialize with full plot box so we don't have to check for undefined
159
+ // every time we use it
160
+ this.playingField = chart.plotBox;
50
161
  /**
51
162
  * The current zoom level of the view.
52
163
  * @name Highcharts.MapView#zoom
@@ -54,106 +165,54 @@ var MapView = /** @class */ (function () {
54
165
  * @type {number}
55
166
  */
56
167
  this.zoom = o.zoom || 0;
168
+ // Create the insets
169
+ this.createInsets();
57
170
  // Initialize and respond to chart size changes
58
- addEvent(chart, 'afterSetChartSize', function () {
171
+ this.eventsToUnbind.push(addEvent(chart, 'afterSetChartSize', function () {
172
+ _this.playingField = _this.getField();
59
173
  if (_this.minZoom === void 0 || // When initializing the chart
60
174
  _this.minZoom === _this.zoom // When resizing the chart
61
175
  ) {
62
176
  _this.fitToBounds(void 0, void 0, false);
63
- if (isNumber(_this.userOptions.zoom)) {
177
+ if (
178
+ // Set zoom only when initializing the chart
179
+ // (do not overwrite when zooming in/out, #17082)
180
+ !_this.chart.hasRendered &&
181
+ isNumber(_this.userOptions.zoom)) {
64
182
  _this.zoom = _this.userOptions.zoom;
65
183
  }
66
184
  if (_this.userOptions.center) {
67
185
  merge(true, _this.center, _this.userOptions.center);
68
186
  }
69
187
  }
70
- });
71
- // Set up panning for maps. In orthographic projections the globe will
72
- // rotate, otherwise adjust the map center.
73
- var mouseDownCenterProjected;
74
- var mouseDownKey;
75
- var mouseDownRotation;
76
- var onPan = function (e) {
77
- var pinchDown = chart.pointer.pinchDown;
78
- var mouseDownX = chart.mouseDownX, mouseDownY = chart.mouseDownY;
79
- if (pinchDown.length === 1) {
80
- mouseDownX = pinchDown[0].chartX;
81
- mouseDownY = pinchDown[0].chartY;
82
- }
83
- if (typeof mouseDownX === 'number' &&
84
- typeof mouseDownY === 'number') {
85
- var key = mouseDownX + "," + mouseDownY, _a = e.originalEvent, chartX = _a.chartX, chartY = _a.chartY;
86
- // Reset starting position
87
- if (key !== mouseDownKey) {
88
- mouseDownKey = key;
89
- mouseDownCenterProjected = _this.projection
90
- .forward(_this.center);
91
- mouseDownRotation = (_this.projection.options.rotation || [0, 0]).slice();
92
- }
93
- // Panning rotates the globe
94
- if (_this.projection.options.name === 'Orthographic' &&
95
- // ... but don't rotate if we're loading only a part of the
96
- // world
97
- (_this.minZoom || Infinity) < 3) {
98
- // Empirical ratio where the globe rotates roughly the same
99
- // speed as moving the pointer across the center of the
100
- // projection
101
- var ratio = 440 / (_this.getScale() * Math.min(chart.plotWidth, chart.plotHeight));
102
- if (mouseDownRotation) {
103
- var lon = (mouseDownX - chartX) * ratio -
104
- mouseDownRotation[0];
105
- var lat = clamp(-mouseDownRotation[1] -
106
- (mouseDownY - chartY) * ratio, -80, 80);
107
- _this.update({
108
- projection: {
109
- rotation: [-lon, -lat]
110
- },
111
- center: [lon, lat],
112
- zoom: _this.zoom
113
- }, true, false);
114
- }
115
- }
116
- else {
117
- var scale = _this.getScale();
118
- var newCenter = _this.projection.inverse([
119
- mouseDownCenterProjected[0] +
120
- (mouseDownX - chartX) / scale,
121
- mouseDownCenterProjected[1] -
122
- (mouseDownY - chartY) / scale
123
- ]);
124
- _this.setView(newCenter, void 0, true, false);
125
- }
126
- e.preventDefault();
127
- }
128
- };
129
- addEvent(chart, 'pan', onPan);
130
- addEvent(chart, 'touchpan', onPan);
131
- // Perform the map zoom by selection
132
- addEvent(chart, 'selection', function (evt) {
133
- // Zoom in
134
- if (!evt.resetSelection) {
135
- var x = evt.x - chart.plotLeft;
136
- var y = evt.y - chart.plotTop;
137
- var _a = _this.pixelsToProjectedUnits({ x: x, y: y }), y1 = _a.y, x1 = _a.x;
138
- var _b = _this.pixelsToProjectedUnits({ x: x + evt.width, y: y + evt.height }), y2 = _b.y, x2 = _b.x;
139
- _this.fitToBounds({ x1: x1, y1: y1, x2: x2, y2: y2 }, void 0, true, evt.originalEvent.touches ?
140
- // On touch zoom, don't animate, since we're already in
141
- // transformed zoom preview
142
- false :
143
- // On mouse zoom, obey the chart-level animation
144
- void 0);
145
- // Only for mouse. Touch users can pinch out.
146
- if (!/^touch/.test((evt.originalEvent.type))) {
147
- chart.showResetZoom();
148
- }
149
- evt.preventDefault();
150
- // Reset zoom
151
- }
152
- else {
153
- _this.zoomBy();
154
- }
155
- });
188
+ }));
189
+ this.setUpEvents();
156
190
  }
191
+ // Merge two collections of insets by the id
192
+ MapView.mergeInsets = function (a, b) {
193
+ var toObject = function (insets) {
194
+ var ob = {};
195
+ insets.forEach(function (inset, i) {
196
+ ob[inset && inset.id || "i" + i] = inset;
197
+ });
198
+ return ob;
199
+ };
200
+ var insetsObj = merge(toObject(a), toObject(b)), insets = Object
201
+ .keys(insetsObj)
202
+ .map(function (key) { return insetsObj[key]; });
203
+ return insets;
204
+ };
205
+ // Create MapViewInset instances from insets options
206
+ MapView.prototype.createInsets = function () {
207
+ var _this = this;
208
+ var options = this.options, insets = options.insets;
209
+ if (insets) {
210
+ insets.forEach(function (item) {
211
+ var inset = new MapViewInset(_this, merge(options.insetOptions, item));
212
+ _this.insets.push(inset);
213
+ });
214
+ }
215
+ };
157
216
  /**
158
217
  * Fit the view to given bounds
159
218
  *
@@ -174,9 +233,16 @@ var MapView = /** @class */ (function () {
174
233
  if (redraw === void 0) { redraw = true; }
175
234
  var b = bounds || this.getProjectedBounds();
176
235
  if (b) {
177
- var _a = this.chart, plotWidth = _a.plotWidth, plotHeight = _a.plotHeight, pad = pick(padding, bounds ? 0 : this.options.padding), paddingX = relativeLength(pad, plotWidth), paddingY = relativeLength(pad, plotHeight);
178
- var scaleToPlotArea = Math.max((b.x2 - b.x1) / ((plotWidth - paddingX) / tileSize), (b.y2 - b.y1) / ((plotHeight - paddingY) / tileSize));
179
- var zoom = Math.log(worldSize / scaleToPlotArea) / Math.log(2);
236
+ var pad = pick(padding, bounds ? 0 : this.options.padding), fullField = this.getField(false), padArr = isArray(pad) ? pad : [pad, pad, pad, pad];
237
+ this.padding = [
238
+ relativeLength(padArr[0], fullField.height),
239
+ relativeLength(padArr[1], fullField.width),
240
+ relativeLength(padArr[2], fullField.height),
241
+ relativeLength(padArr[3], fullField.width)
242
+ ];
243
+ // Apply the playing field, corrected with padding
244
+ this.playingField = this.getField();
245
+ var zoom = zoomFromBounds(b, this.playingField);
180
246
  // Reset minZoom when fitting to natural bounds
181
247
  if (!bounds) {
182
248
  this.minZoom = zoom;
@@ -188,21 +254,176 @@ var MapView = /** @class */ (function () {
188
254
  this.setView(center, zoom, redraw, animation);
189
255
  }
190
256
  };
257
+ MapView.prototype.getField = function (padded) {
258
+ if (padded === void 0) { padded = true; }
259
+ var padding = padded ? this.padding : [0, 0, 0, 0];
260
+ return {
261
+ x: padding[3],
262
+ y: padding[0],
263
+ width: this.chart.plotWidth - padding[1] - padding[3],
264
+ height: this.chart.plotHeight - padding[0] - padding[2]
265
+ };
266
+ };
267
+ MapView.prototype.getGeoMap = function (map) {
268
+ if (isString(map)) {
269
+ return maps[map];
270
+ }
271
+ if (isObject(map, true)) {
272
+ if (map.type === 'FeatureCollection') {
273
+ return map;
274
+ }
275
+ if (map.type === 'Topology') {
276
+ return topo2geo(map);
277
+ }
278
+ }
279
+ };
280
+ MapView.prototype.getMapBBox = function () {
281
+ var bounds = this.getProjectedBounds(), scale = this.getScale();
282
+ if (bounds) {
283
+ var padding = this.padding, p1 = this.projectedUnitsToPixels({
284
+ x: bounds.x1,
285
+ y: bounds.y2
286
+ }), width = ((bounds.x2 - bounds.x1) * scale +
287
+ padding[1] + padding[3]), height = ((bounds.y2 - bounds.y1) * scale +
288
+ padding[0] + padding[2]);
289
+ return {
290
+ width: width,
291
+ height: height,
292
+ x: p1.x - padding[3],
293
+ y: p1.y - padding[0]
294
+ };
295
+ }
296
+ };
191
297
  MapView.prototype.getProjectedBounds = function () {
192
298
  var allBounds = this.chart.series.reduce(function (acc, s) {
193
299
  var bounds = s.getProjectedBounds && s.getProjectedBounds();
194
- if (bounds) {
300
+ if (bounds &&
301
+ s.options.affectsMapView !== false) {
195
302
  acc.push(bounds);
196
303
  }
197
304
  return acc;
198
305
  }, []);
199
- return MapView.compositeBounds(allBounds);
306
+ return this.projection.bounds || MapView.compositeBounds(allBounds);
200
307
  };
201
308
  MapView.prototype.getScale = function () {
202
309
  // A zoom of 0 means the world (360x360 degrees) fits in a 256x256 px
203
310
  // tile
204
311
  return (tileSize / worldSize) * Math.pow(2, this.zoom);
205
312
  };
313
+ // Calculate the SVG transform to be applied to series groups
314
+ MapView.prototype.getSVGTransform = function () {
315
+ var _a = this.playingField, x = _a.x, y = _a.y, width = _a.width, height = _a.height, projectedCenter = this.projection.forward(this.center), flipFactor = this.projection.hasCoordinates ? -1 : 1, scaleX = this.getScale(), scaleY = scaleX * flipFactor, translateX = x + width / 2 - projectedCenter[0] * scaleX, translateY = y + height / 2 - projectedCenter[1] * scaleY;
316
+ return { scaleX: scaleX, scaleY: scaleY, translateX: translateX, translateY: translateY };
317
+ };
318
+ /**
319
+ * Convert map coordinates in longitude/latitude to pixels
320
+ *
321
+ * @function Highcharts.MapView#lonLatToPixels
322
+ * @since 10.0.0
323
+ * @param {Highcharts.MapLonLatObject} lonLat
324
+ * The map coordinates
325
+ * @return {Highcharts.PositionObject|undefined}
326
+ * The pixel position
327
+ */
328
+ MapView.prototype.lonLatToPixels = function (lonLat) {
329
+ var pos = this.lonLatToProjectedUnits(lonLat);
330
+ if (pos) {
331
+ return this.projectedUnitsToPixels(pos);
332
+ }
333
+ };
334
+ /**
335
+ * Get projected units from longitude/latitude. Insets are accounted for.
336
+ * Returns an object with x and y values corresponding to positions on the
337
+ * projected plane.
338
+ *
339
+ * @requires modules/map
340
+ *
341
+ * @function Highcharts.MapView#lonLatToProjectedUnits
342
+ *
343
+ * @since 10.0.0
344
+ * @sample maps/series/latlon-to-point/ Find a point from lon/lat
345
+ *
346
+ * @param {Highcharts.MapLonLatObject} lonLat Coordinates.
347
+ *
348
+ * @return {Highcharts.ProjectedXY} X and Y coordinates in terms of
349
+ * projected values
350
+ */
351
+ MapView.prototype.lonLatToProjectedUnits = function (lonLat) {
352
+ var chart = this.chart, mapTransforms = chart.mapTransforms;
353
+ // Legacy, built-in transforms
354
+ if (mapTransforms) {
355
+ for (var transform in mapTransforms) {
356
+ if (Object.hasOwnProperty.call(mapTransforms, transform) &&
357
+ mapTransforms[transform].hitZone) {
358
+ var coords = chart.transformFromLatLon(lonLat, mapTransforms[transform]);
359
+ if (coords && pointInPolygon(coords, mapTransforms[transform].hitZone.coordinates[0])) {
360
+ return coords;
361
+ }
362
+ }
363
+ }
364
+ return chart.transformFromLatLon(lonLat, mapTransforms['default'] // eslint-disable-line dot-notation
365
+ );
366
+ }
367
+ // Handle insets
368
+ for (var _i = 0, _a = this.insets; _i < _a.length; _i++) {
369
+ var inset = _a[_i];
370
+ if (inset.options.geoBounds &&
371
+ pointInPolygon({ x: lonLat.lon, y: lonLat.lat }, inset.options.geoBounds.coordinates[0])) {
372
+ var insetProjectedPoint = inset.projection.forward([lonLat.lon, lonLat.lat]), pxPoint = inset.projectedUnitsToPixels({ x: insetProjectedPoint[0], y: insetProjectedPoint[1] });
373
+ return this.pixelsToProjectedUnits(pxPoint);
374
+ }
375
+ }
376
+ var point = this.projection.forward([lonLat.lon, lonLat.lat]);
377
+ if (!point.outside) {
378
+ return { x: point[0], y: point[1] };
379
+ }
380
+ };
381
+ /**
382
+ * Calculate longitude/latitude values for a point or position. Returns an
383
+ * object with the numeric properties `lon` and `lat`.
384
+ *
385
+ * @requires modules/map
386
+ *
387
+ * @function Highcharts.MapView#projectedUnitsToLonLat
388
+ *
389
+ * @since 10.0.0
390
+ *
391
+ * @sample maps/demo/latlon-advanced/ Advanced lat/lon demo
392
+ *
393
+ * @param {Highcharts.Point|Highcharts.ProjectedXY} point
394
+ * A `Point` instance or anything containing `x` and `y` properties
395
+ * with numeric values.
396
+ *
397
+ * @return {Highcharts.MapLonLatObject|undefined} An object with `lat` and
398
+ * `lon` properties.
399
+ */
400
+ MapView.prototype.projectedUnitsToLonLat = function (point) {
401
+ var chart = this.chart, mapTransforms = chart.mapTransforms;
402
+ // Legacy, built-in transforms
403
+ if (mapTransforms) {
404
+ for (var transform in mapTransforms) {
405
+ if (Object.hasOwnProperty.call(mapTransforms, transform) &&
406
+ mapTransforms[transform].hitZone &&
407
+ pointInPolygon(point, mapTransforms[transform].hitZone.coordinates[0])) {
408
+ return chart.transformToLatLon(point, mapTransforms[transform]);
409
+ }
410
+ }
411
+ return chart.transformToLatLon(point, mapTransforms['default'] // eslint-disable-line dot-notation
412
+ );
413
+ }
414
+ var pxPoint = this.projectedUnitsToPixels(point);
415
+ for (var _i = 0, _a = this.insets; _i < _a.length; _i++) {
416
+ var inset = _a[_i];
417
+ if (inset.hitZone &&
418
+ pointInPolygon(pxPoint, inset.hitZone.coordinates[0])) {
419
+ var insetProjectedPoint = inset
420
+ .pixelsToProjectedUnits(pxPoint), coordinates_1 = inset.projection.inverse([insetProjectedPoint.x, insetProjectedPoint.y]);
421
+ return { lon: coordinates_1[0], lat: coordinates_1[1] };
422
+ }
423
+ }
424
+ var coordinates = this.projection.inverse([point.x, point.y]);
425
+ return { lon: coordinates[0], lat: coordinates[1] };
426
+ };
206
427
  MapView.prototype.redraw = function (animation) {
207
428
  this.chart.series.forEach(function (s) {
208
429
  if (s.useMapGeometry) {
@@ -228,7 +449,6 @@ var MapView = /** @class */ (function () {
228
449
  */
229
450
  MapView.prototype.setView = function (center, zoom, redraw, animation) {
230
451
  if (redraw === void 0) { redraw = true; }
231
- var zoomingIn = false;
232
452
  if (center) {
233
453
  this.center = center;
234
454
  }
@@ -239,64 +459,59 @@ var MapView = /** @class */ (function () {
239
459
  if (typeof this.options.maxZoom === 'number') {
240
460
  zoom = Math.min(zoom, this.options.maxZoom);
241
461
  }
242
- zoomingIn = zoom > this.zoom;
243
462
  this.zoom = zoom;
244
463
  }
245
- // Stay within the data bounds
246
464
  var bounds = this.getProjectedBounds();
247
- if (bounds &&
248
- // When zooming in, we don't need to adjust to the bounds, as that
249
- // could shift the location under the mouse
250
- !zoomingIn) {
251
- var projectedCenter = this.projection.forward(this.center);
252
- var _a = this.chart, plotWidth = _a.plotWidth, plotHeight = _a.plotHeight;
253
- var scale = this.getScale();
254
- var bottomLeft = this.projectedUnitsToPixels({
465
+ if (bounds) {
466
+ var projectedCenter = this.projection.forward(this.center), _a = this.playingField, x = _a.x, y = _a.y, width = _a.width, height = _a.height, scale = this.getScale(), bottomLeft = this.projectedUnitsToPixels({
255
467
  x: bounds.x1,
256
468
  y: bounds.y1
257
- });
258
- var topRight = this.projectedUnitsToPixels({
469
+ }), topRight = this.projectedUnitsToPixels({
259
470
  x: bounds.x2,
260
471
  y: bounds.y2
261
- });
262
- var boundsCenterProjected = [
472
+ }), boundsCenterProjected = [
263
473
  (bounds.x1 + bounds.x2) / 2,
264
474
  (bounds.y1 + bounds.y2) / 2
265
475
  ];
476
+ // Constrain to data bounds
266
477
  // Pixel coordinate system is reversed vs projected
267
- var x1 = bottomLeft.x;
268
- var y1 = topRight.y;
269
- var x2 = topRight.x;
270
- var y2 = bottomLeft.y;
478
+ var x1 = bottomLeft.x, y1 = topRight.y, x2 = topRight.x, y2 = bottomLeft.y;
271
479
  // Map smaller than plot area, center it
272
- if (x2 - x1 < plotWidth) {
480
+ if (x2 - x1 < width) {
273
481
  projectedCenter[0] = boundsCenterProjected[0];
274
482
  // Off west
275
483
  }
276
- else if (x1 < 0 && x2 < plotWidth) {
484
+ else if (x1 < x && x2 < x + width) {
277
485
  // Adjust eastwards
278
- projectedCenter[0] += Math.max(x1, x2 - plotWidth) / scale;
486
+ projectedCenter[0] += Math.max(x1 - x, x2 - width - x) / scale;
279
487
  // Off east
280
488
  }
281
- else if (x2 > plotWidth && x1 > 0) {
489
+ else if (x2 > x + width && x1 > x) {
282
490
  // Adjust westwards
283
- projectedCenter[0] += Math.min(x2 - plotWidth, x1) / scale;
491
+ projectedCenter[0] += Math.min(x2 - width - x, x1 - x) / scale;
284
492
  }
285
493
  // Map smaller than plot area, center it
286
- if (y2 - y1 < plotHeight) {
494
+ if (y2 - y1 < height) {
287
495
  projectedCenter[1] = boundsCenterProjected[1];
288
496
  // Off north
289
497
  }
290
- else if (y1 < 0 && y2 < plotHeight) {
498
+ else if (y1 < y && y2 < y + height) {
291
499
  // Adjust southwards
292
- projectedCenter[1] -= Math.max(y1, y2 - plotHeight) / scale;
500
+ projectedCenter[1] -= Math.max(y1 - y, y2 - height - y) / scale;
293
501
  // Off south
294
502
  }
295
- else if (y2 > plotHeight && y1 > 0) {
503
+ else if (y2 > y + height && y1 > y) {
296
504
  // Adjust northwards
297
- projectedCenter[1] -= Math.min(y2 - plotHeight, y1) / scale;
505
+ projectedCenter[1] -= Math.min(y2 - height - y, y1 - y) / scale;
298
506
  }
299
507
  this.center = this.projection.inverse(projectedCenter);
508
+ this.insets.forEach(function (inset) {
509
+ if (inset.options.field) {
510
+ inset.hitZone = inset.getHitZone();
511
+ inset.playingField = inset.getField();
512
+ }
513
+ });
514
+ this.render();
300
515
  }
301
516
  fireEvent(this, 'afterSetView');
302
517
  if (redraw) {
@@ -312,14 +527,24 @@ var MapView = /** @class */ (function () {
312
527
  * @return {Highcharts.PositionObject} The position in pixels
313
528
  */
314
529
  MapView.prototype.projectedUnitsToPixels = function (pos) {
315
- var scale = this.getScale();
316
- var projectedCenter = this.projection.forward(this.center);
317
- var centerPxX = this.chart.plotWidth / 2;
318
- var centerPxY = this.chart.plotHeight / 2;
530
+ var scale = this.getScale(), projectedCenter = this.projection.forward(this.center), field = this.playingField, centerPxX = field.x + field.width / 2, centerPxY = field.y + field.height / 2;
319
531
  var x = centerPxX - scale * (projectedCenter[0] - pos.x);
320
532
  var y = centerPxY + scale * (projectedCenter[1] - pos.y);
321
533
  return { x: x, y: y };
322
534
  };
535
+ /**
536
+ * Convert pixel position to longitude and latitude.
537
+ *
538
+ * @function Highcharts.MapView#pixelsToLonLat
539
+ * @since 10.0.0
540
+ * @param {Highcharts.PositionObject} pos
541
+ * The position in pixels
542
+ * @return {Highcharts.MapLonLatObject|undefined}
543
+ * The map coordinates
544
+ */
545
+ MapView.prototype.pixelsToLonLat = function (pos) {
546
+ return this.projectedUnitsToLonLat(this.pixelsToProjectedUnits(pos));
547
+ };
323
548
  /**
324
549
  * Convert pixel position to projected units
325
550
  *
@@ -329,15 +554,111 @@ var MapView = /** @class */ (function () {
329
554
  * @return {Highcharts.PositionObject} The position in projected units
330
555
  */
331
556
  MapView.prototype.pixelsToProjectedUnits = function (pos) {
332
- var x = pos.x, y = pos.y;
333
- var scale = this.getScale();
334
- var projectedCenter = this.projection.forward(this.center);
335
- var centerPxX = this.chart.plotWidth / 2;
336
- var centerPxY = this.chart.plotHeight / 2;
557
+ var x = pos.x, y = pos.y, scale = this.getScale(), projectedCenter = this.projection.forward(this.center), field = this.playingField, centerPxX = field.x + field.width / 2, centerPxY = field.y + field.height / 2;
337
558
  var projectedX = projectedCenter[0] + (x - centerPxX) / scale;
338
559
  var projectedY = projectedCenter[1] - (y - centerPxY) / scale;
339
560
  return { x: projectedX, y: projectedY };
340
561
  };
562
+ MapView.prototype.setUpEvents = function () {
563
+ var _this = this;
564
+ var chart = this.chart;
565
+ // Set up panning for maps. In orthographic projections the globe will
566
+ // rotate, otherwise adjust the map center.
567
+ var mouseDownCenterProjected;
568
+ var mouseDownKey;
569
+ var mouseDownRotation;
570
+ var onPan = function (e) {
571
+ var pinchDown = chart.pointer.pinchDown, projection = _this.projection;
572
+ var mouseDownX = chart.mouseDownX, mouseDownY = chart.mouseDownY;
573
+ if (pinchDown.length === 1) {
574
+ mouseDownX = pinchDown[0].chartX;
575
+ mouseDownY = pinchDown[0].chartY;
576
+ }
577
+ if (typeof mouseDownX === 'number' &&
578
+ typeof mouseDownY === 'number') {
579
+ var key = mouseDownX + "," + mouseDownY, _a = e.originalEvent, chartX = _a.chartX, chartY = _a.chartY;
580
+ // Reset starting position
581
+ if (key !== mouseDownKey) {
582
+ mouseDownKey = key;
583
+ mouseDownCenterProjected = _this.projection
584
+ .forward(_this.center);
585
+ mouseDownRotation = (_this.projection.options.rotation || [0, 0]).slice();
586
+ }
587
+ // Get the natural zoom level of the projection itself when
588
+ // zoomed to view the full world
589
+ var worldBounds = projection.def && projection.def.bounds, worldZoom = (worldBounds &&
590
+ zoomFromBounds(worldBounds, _this.playingField)) || -Infinity;
591
+ // Panning rotates the globe
592
+ if (projection.options.name === 'Orthographic' &&
593
+ // ... but don't rotate if we're loading only a part of the
594
+ // world
595
+ (_this.minZoom || Infinity) < worldZoom * 1.1) {
596
+ // Empirical ratio where the globe rotates roughly the same
597
+ // speed as moving the pointer across the center of the
598
+ // projection
599
+ var ratio = 440 / (_this.getScale() * Math.min(chart.plotWidth, chart.plotHeight));
600
+ if (mouseDownRotation) {
601
+ var lon = (mouseDownX - chartX) * ratio -
602
+ mouseDownRotation[0], lat = clamp(-mouseDownRotation[1] -
603
+ (mouseDownY - chartY) * ratio, -80, 80), zoom = _this.zoom;
604
+ _this.update({
605
+ projection: {
606
+ rotation: [-lon, -lat]
607
+ }
608
+ }, false);
609
+ _this.zoom = zoom;
610
+ chart.redraw(false);
611
+ }
612
+ }
613
+ else {
614
+ var scale = _this.getScale();
615
+ var newCenter = _this.projection.inverse([
616
+ mouseDownCenterProjected[0] +
617
+ (mouseDownX - chartX) / scale,
618
+ mouseDownCenterProjected[1] -
619
+ (mouseDownY - chartY) / scale
620
+ ]);
621
+ _this.setView(newCenter, void 0, true, false);
622
+ }
623
+ e.preventDefault();
624
+ }
625
+ };
626
+ addEvent(chart, 'pan', onPan);
627
+ addEvent(chart, 'touchpan', onPan);
628
+ // Perform the map zoom by selection
629
+ addEvent(chart, 'selection', function (evt) {
630
+ // Zoom in
631
+ if (!evt.resetSelection) {
632
+ var x = evt.x - chart.plotLeft;
633
+ var y = evt.y - chart.plotTop;
634
+ var _a = _this.pixelsToProjectedUnits({ x: x, y: y }), y1 = _a.y, x1 = _a.x;
635
+ var _b = _this.pixelsToProjectedUnits({ x: x + evt.width, y: y + evt.height }), y2 = _b.y, x2 = _b.x;
636
+ _this.fitToBounds({ x1: x1, y1: y1, x2: x2, y2: y2 }, void 0, true, evt.originalEvent.touches ?
637
+ // On touch zoom, don't animate, since we're already in
638
+ // transformed zoom preview
639
+ false :
640
+ // On mouse zoom, obey the chart-level animation
641
+ void 0);
642
+ // Only for mouse. Touch users can pinch out.
643
+ if (!/^touch/.test((evt.originalEvent.type))) {
644
+ chart.showResetZoom();
645
+ }
646
+ evt.preventDefault();
647
+ // Reset zoom
648
+ }
649
+ else {
650
+ _this.zoomBy();
651
+ }
652
+ });
653
+ };
654
+ MapView.prototype.render = function () {
655
+ // We need a group for the insets
656
+ if (!this.group) {
657
+ this.group = this.chart.renderer.g('map-view')
658
+ .attr({ zIndex: 4 })
659
+ .add();
660
+ }
661
+ };
341
662
  /**
342
663
  * Update the view with given options
343
664
  *
@@ -354,18 +675,41 @@ var MapView = /** @class */ (function () {
354
675
  if (redraw === void 0) { redraw = true; }
355
676
  var newProjection = options.projection;
356
677
  var isDirtyProjection = newProjection && ((Projection.toString(newProjection) !==
357
- Projection.toString(this.options.projection)));
678
+ Projection.toString(this.options.projection))), isDirtyInsets = false;
358
679
  merge(true, this.userOptions, options);
359
680
  merge(true, this.options, options);
360
- if (isDirtyProjection) {
681
+ // If anything changed with the insets, destroy them all and create
682
+ // again below
683
+ if ('insets' in options) {
684
+ this.insets.forEach(function (inset) { return inset.destroy(); });
685
+ this.insets.length = 0;
686
+ isDirtyInsets = true;
687
+ }
688
+ if (isDirtyProjection || isDirtyInsets) {
361
689
  this.chart.series.forEach(function (series) {
690
+ var groups = series.transformGroups;
362
691
  if (series.clearBounds) {
363
692
  series.clearBounds();
364
693
  }
365
694
  series.isDirty = true;
366
695
  series.isDirtyData = true;
696
+ // Destroy inset transform groups
697
+ if (isDirtyInsets && groups) {
698
+ while (groups.length > 1) {
699
+ var group = groups.pop();
700
+ if (group) {
701
+ group.destroy();
702
+ }
703
+ }
704
+ }
367
705
  });
368
- this.projection = new Projection(this.options.projection);
706
+ if (isDirtyProjection) {
707
+ this.projection = new Projection(this.options.projection);
708
+ }
709
+ // Create new insets
710
+ if (isDirtyInsets) {
711
+ this.createInsets();
712
+ }
369
713
  // Fit to natural bounds if center/zoom are not explicitly given
370
714
  if (!options.center && !isNumber(options.zoom)) {
371
715
  this.fitToBounds(void 0, void 0, false);
@@ -447,4 +791,135 @@ var MapView = /** @class */ (function () {
447
791
  };
448
792
  return MapView;
449
793
  }());
794
+ // Putting this in the same file due to circular dependency with MapView
795
+ var MapViewInset = /** @class */ (function (_super) {
796
+ __extends(MapViewInset, _super);
797
+ function MapViewInset(mapView, options) {
798
+ var _this = _super.call(this, mapView.chart, options) || this;
799
+ _this.id = options.id;
800
+ _this.mapView = mapView;
801
+ _this.options = merge(defaultInsetsOptions, options);
802
+ _this.allBounds = [];
803
+ if (_this.options.geoBounds) {
804
+ // The path in projected units in the map view's main projection.
805
+ // This is used for hit testing where the points should render.
806
+ var path = mapView.projection.path(_this.options.geoBounds);
807
+ _this.geoBoundsProjectedBox = boundsFromPath(path);
808
+ _this.geoBoundsProjectedPolygon = path.map(function (segment) { return [
809
+ segment[1] || 0,
810
+ segment[2] || 0
811
+ ]; });
812
+ }
813
+ return _this;
814
+ }
815
+ // Get the playing field in pixels
816
+ MapViewInset.prototype.getField = function (padded) {
817
+ if (padded === void 0) { padded = true; }
818
+ var hitZone = this.hitZone;
819
+ if (hitZone) {
820
+ var padding = padded ? this.padding : [0, 0, 0, 0], polygon = hitZone.coordinates[0], xs = polygon.map(function (xy) { return xy[0]; }), ys = polygon.map(function (xy) { return xy[1]; }), x = Math.min.apply(0, xs) + padding[3], x2 = Math.max.apply(0, xs) - padding[1], y = Math.min.apply(0, ys) + padding[0], y2 = Math.max.apply(0, ys) - padding[2];
821
+ if (isNumber(x) && isNumber(y)) {
822
+ return {
823
+ x: x,
824
+ y: y,
825
+ width: x2 - x,
826
+ height: y2 - y
827
+ };
828
+ }
829
+ }
830
+ // Fall back to plot area
831
+ return _super.prototype.getField.call(this, padded);
832
+ };
833
+ // Get the hit zone in pixels
834
+ MapViewInset.prototype.getHitZone = function () {
835
+ var _a = this, chart = _a.chart, mapView = _a.mapView, options = _a.options, coordinates = (options.field || {}).coordinates;
836
+ if (coordinates) {
837
+ var polygon = coordinates[0];
838
+ if (options.units === 'percent') {
839
+ var relativeTo_1 = options.relativeTo === 'mapBoundingBox' &&
840
+ mapView.getMapBBox() ||
841
+ merge(chart.plotBox, { x: 0, y: 0 });
842
+ polygon = polygon.map(function (xy) { return [
843
+ relativeLength(xy[0] + "%", relativeTo_1.width, relativeTo_1.x),
844
+ relativeLength(xy[1] + "%", relativeTo_1.height, relativeTo_1.y)
845
+ ]; });
846
+ }
847
+ return {
848
+ type: 'Polygon',
849
+ coordinates: [polygon]
850
+ };
851
+ }
852
+ };
853
+ MapViewInset.prototype.getProjectedBounds = function () {
854
+ return MapView.compositeBounds(this.allBounds);
855
+ };
856
+ // Determine whether a point on the main projected plane is inside the
857
+ // geoBounds of the inset.
858
+ MapViewInset.prototype.isInside = function (point) {
859
+ var _a = this, geoBoundsProjectedBox = _a.geoBoundsProjectedBox, geoBoundsProjectedPolygon = _a.geoBoundsProjectedPolygon;
860
+ return Boolean(
861
+ // First we do a pre-pass to check whether the test point is inside
862
+ // the rectangular bounding box of the polygon. This is less
863
+ // expensive and will rule out most cases.
864
+ geoBoundsProjectedBox &&
865
+ point.x >= geoBoundsProjectedBox.x1 &&
866
+ point.x <= geoBoundsProjectedBox.x2 &&
867
+ point.y >= geoBoundsProjectedBox.y1 &&
868
+ point.y <= geoBoundsProjectedBox.y2 &&
869
+ // Next, do the more expensive check whether the point is inside the
870
+ // polygon itself.
871
+ geoBoundsProjectedPolygon &&
872
+ pointInPolygon(point, geoBoundsProjectedPolygon));
873
+ };
874
+ // Render the map view inset with the border path
875
+ MapViewInset.prototype.render = function () {
876
+ var _a = this, chart = _a.chart, mapView = _a.mapView, options = _a.options, borderPath = options.borderPath || options.field;
877
+ if (borderPath && mapView.group) {
878
+ var animate = true;
879
+ if (!this.border) {
880
+ this.border = chart.renderer
881
+ .path()
882
+ .addClass('highcharts-mapview-inset-border')
883
+ .add(mapView.group);
884
+ animate = false;
885
+ }
886
+ if (!chart.styledMode) {
887
+ this.border.attr({
888
+ stroke: options.borderColor,
889
+ 'stroke-width': options.borderWidth
890
+ });
891
+ }
892
+ var crisp_1 = Math.round(this.border.strokeWidth()) % 2 / 2, field_1 = (options.relativeTo === 'mapBoundingBox' &&
893
+ mapView.getMapBBox()) || mapView.playingField;
894
+ var d = (borderPath.coordinates || []).reduce(function (d, lineString) {
895
+ return lineString.reduce(function (d, point, i) {
896
+ var x = point[0], y = point[1];
897
+ if (options.units === 'percent') {
898
+ x = chart.plotLeft + relativeLength(x + "%", field_1.width, field_1.x);
899
+ y = chart.plotTop + relativeLength(y + "%", field_1.height, field_1.y);
900
+ }
901
+ x = Math.floor(x) + crisp_1;
902
+ y = Math.floor(y) + crisp_1;
903
+ d.push(i === 0 ? ['M', x, y] : ['L', x, y]);
904
+ return d;
905
+ }, d);
906
+ }, []);
907
+ // Apply the border path
908
+ this.border[animate ? 'animate' : 'attr']({ d: d });
909
+ }
910
+ };
911
+ MapViewInset.prototype.destroy = function () {
912
+ if (this.border) {
913
+ this.border = this.border.destroy();
914
+ }
915
+ this.eventsToUnbind.forEach(function (f) { return f(); });
916
+ };
917
+ // No chart-level events for insets
918
+ MapViewInset.prototype.setUpEvents = function () { };
919
+ return MapViewInset;
920
+ }(MapView));
921
+ // Initialize the MapView after initialization, but before firstRender
922
+ addEvent(MapChart, 'afterInit', function () {
923
+ this.mapView = new MapView(this, this.options.mapView);
924
+ });
450
925
  export default MapView;