highcharts 9.2.1 → 9.3.2

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 (896) hide show
  1. package/README.md +13 -6
  2. package/bower.json +1 -1
  3. package/css/annotations/popup.css +48 -8
  4. package/css/annotations/popup.scss +70 -22
  5. package/css/highcharts.css +46 -1
  6. package/css/highcharts.scss +40 -0
  7. package/css/stocktools/gui.css +1 -1
  8. package/css/themes/dark-unica.css +46 -1
  9. package/css/themes/grid-light.css +46 -1
  10. package/css/themes/sand-signika.css +46 -1
  11. package/es-modules/Accessibility/A11yI18n.js +269 -224
  12. package/es-modules/Accessibility/Accessibility.js +244 -129
  13. package/es-modules/Accessibility/AccessibilityComponent.js +78 -313
  14. package/es-modules/Accessibility/Components/AnnotationsA11y.js +19 -5
  15. package/es-modules/Accessibility/Components/ContainerComponent.js +53 -28
  16. package/es-modules/Accessibility/Components/InfoRegionsComponent.js +178 -120
  17. package/es-modules/Accessibility/Components/LegendComponent.js +251 -129
  18. package/es-modules/Accessibility/Components/MenuComponent.js +239 -154
  19. package/es-modules/Accessibility/Components/RangeSelectorComponent.js +172 -93
  20. package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +161 -115
  21. package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +138 -69
  22. package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js +67 -28
  23. package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +48 -56
  24. package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +387 -343
  25. package/es-modules/Accessibility/Components/ZoomComponent.js +156 -70
  26. package/es-modules/Accessibility/FocusBorder.js +192 -152
  27. package/es-modules/Accessibility/HighContrastMode.js +79 -66
  28. package/es-modules/Accessibility/HighContrastTheme.js +10 -0
  29. package/es-modules/Accessibility/KeyboardNavigation.js +151 -75
  30. package/es-modules/Accessibility/KeyboardNavigationHandler.js +71 -44
  31. package/es-modules/Accessibility/Options/DeprecatedOptions.js +21 -4
  32. package/es-modules/Accessibility/Options/LangOptions.js +4 -5
  33. package/es-modules/Accessibility/Options/Options.js +32 -17
  34. package/es-modules/Accessibility/ProxyElement.js +218 -0
  35. package/es-modules/Accessibility/ProxyProvider.js +302 -0
  36. package/es-modules/Accessibility/Utils/Announcer.js +17 -10
  37. package/es-modules/Accessibility/Utils/ChartUtilities.js +55 -45
  38. package/es-modules/Accessibility/Utils/DOMElementProvider.js +27 -15
  39. package/es-modules/Accessibility/Utils/EventProvider.js +27 -17
  40. package/es-modules/Accessibility/Utils/HTMLUtilities.js +125 -42
  41. package/es-modules/Core/Animation/Fx.js +5 -14
  42. package/es-modules/Core/Axis/Axis.js +77 -96
  43. package/es-modules/Core/Axis/Axis3D.js +10 -4
  44. package/es-modules/Core/Axis/AxisDefaults.js +35 -24
  45. package/es-modules/Core/Axis/BrokenAxis.js +17 -11
  46. package/es-modules/Core/Axis/Color/ColorAxis.js +7 -4
  47. package/es-modules/Core/Axis/Color/ColorAxisComposition.js +55 -5
  48. package/es-modules/Core/Axis/Color/ColorAxisDefaults.js +5 -5
  49. package/es-modules/Core/Axis/DateTimeAxis.js +3 -14
  50. package/es-modules/Core/Axis/GridAxis.js +26 -16
  51. package/es-modules/Core/Axis/NavigatorAxis.js +0 -5
  52. package/es-modules/Core/Axis/OrdinalAxis.js +88 -92
  53. package/es-modules/Core/Axis/PlotLineOrBand/PlotLineOrBand.js +4 -5
  54. package/es-modules/Core/Axis/PlotLineOrBand/PlotLineOrBandAxis.js +0 -5
  55. package/es-modules/Core/Axis/RadialAxis.js +7 -28
  56. package/es-modules/Core/Axis/ScrollbarAxis.js +27 -12
  57. package/es-modules/Core/Axis/StackingAxis.js +2 -1
  58. package/es-modules/Core/Axis/Tick.js +2 -4
  59. package/es-modules/Core/Axis/TreeGridAxis.js +28 -19
  60. package/es-modules/Core/Axis/TreeGridTick.js +5 -3
  61. package/es-modules/Core/Axis/WaterfallAxis.js +1 -1
  62. package/es-modules/Core/Axis/ZAxis.js +1 -1
  63. package/es-modules/Core/Chart/Chart.js +44 -47
  64. package/es-modules/Core/Chart/Chart3D.js +23 -10
  65. package/es-modules/Core/Chart/ChartDefaults.js +3 -4
  66. package/es-modules/Core/Chart/ChartNavigationComposition.js +92 -0
  67. package/es-modules/Core/Chart/GanttChart.js +4 -4
  68. package/es-modules/Core/Chart/MapChart.js +13 -25
  69. package/es-modules/Core/Chart/StockChart.js +13 -316
  70. package/es-modules/Core/Color/Palettes.js +22 -0
  71. package/es-modules/Core/DefaultOptions.js +22 -19
  72. package/es-modules/Core/Foundation.js +39 -31
  73. package/es-modules/Core/Geometry/CircleUtilities.js +2 -1
  74. package/es-modules/Core/Globals.js +1 -1
  75. package/es-modules/Core/HttpUtilities.js +8 -7
  76. package/es-modules/Core/Legend/Legend.js +19 -16
  77. package/es-modules/Core/Navigator.js +41 -30
  78. package/es-modules/Core/Pointer.js +52 -45
  79. package/es-modules/Core/Renderer/HTML/AST.js +29 -14
  80. package/es-modules/Core/Renderer/HTML/HTMLElement.js +27 -20
  81. package/es-modules/Core/Renderer/HTML/HTMLRenderer.js +8 -6
  82. package/es-modules/Core/Renderer/RendererUtilities.js +2 -2
  83. package/es-modules/Core/Renderer/SVG/SVGElement.js +11 -20
  84. package/es-modules/Core/Renderer/SVG/SVGLabel.js +17 -8
  85. package/es-modules/Core/Renderer/SVG/SVGRenderer.js +25 -29
  86. package/es-modules/Core/Renderer/SVG/SVGRenderer3D.js +12 -5
  87. package/es-modules/Core/Renderer/SVG/TextBuilder.js +18 -12
  88. package/es-modules/Core/Responsive.js +2 -3
  89. package/es-modules/Core/Scrollbar.js +14 -12
  90. package/es-modules/Core/ScrollbarDefaults.js +10 -9
  91. package/es-modules/Core/Series/DataLabel.js +19 -15
  92. package/es-modules/Core/Series/Point.js +22 -19
  93. package/es-modules/Core/Series/Series.js +200 -235
  94. package/es-modules/Core/Series/SeriesDefaults.js +8 -8
  95. package/es-modules/Core/Series/SeriesRegistry.js +1 -2
  96. package/es-modules/Core/Time.js +14 -11
  97. package/es-modules/Core/Tooltip.js +63 -53
  98. package/es-modules/Core/Utilities.js +20 -24
  99. package/es-modules/Data/DataConverter.js +483 -0
  100. package/es-modules/Data/DataPromise.js +252 -0
  101. package/es-modules/Data/DataSeriesConverter.js +207 -0
  102. package/es-modules/Data/DataTable.js +1205 -0
  103. package/es-modules/Data/Modifiers/ChainModifier.js +299 -0
  104. package/es-modules/Data/Modifiers/DataModifier.js +303 -0
  105. package/es-modules/Data/Modifiers/GroupModifier.js +144 -0
  106. package/es-modules/Data/Modifiers/InvertModifier.js +254 -0
  107. package/es-modules/Data/Modifiers/RangeModifier.js +143 -0
  108. package/es-modules/Data/Modifiers/SeriesPointsModifier.js +110 -0
  109. package/es-modules/Data/Modifiers/SortModifier.js +249 -0
  110. package/es-modules/Data/Parsers/CSVParser.js +400 -0
  111. package/es-modules/Data/Parsers/DataParser.js +101 -0
  112. package/es-modules/Data/Parsers/GoogleSheetsParser.js +223 -0
  113. package/es-modules/Data/Parsers/HTMLTableParser.js +213 -0
  114. package/es-modules/Data/Stores/CSVStore.js +317 -0
  115. package/es-modules/Data/Stores/DataStore.js +276 -0
  116. package/es-modules/Data/Stores/GoogleSheetsStore.js +169 -0
  117. package/es-modules/Data/Stores/HTMLTableStore.js +353 -0
  118. package/es-modules/Extensions/Annotations/Annotations.js +69 -18
  119. package/es-modules/Extensions/Annotations/ControlPoint.js +1 -3
  120. package/es-modules/Extensions/Annotations/Controllables/ControllableCircle.js +1 -1
  121. package/es-modules/Extensions/Annotations/Controllables/ControllableEllipse.js +199 -0
  122. package/es-modules/Extensions/Annotations/Controllables/ControllableImage.js +1 -1
  123. package/es-modules/Extensions/Annotations/Controllables/ControllableLabel.js +3 -6
  124. package/es-modules/Extensions/Annotations/Controllables/ControllablePath.js +3 -2
  125. package/es-modules/Extensions/Annotations/Controllables/ControllableRect.js +1 -1
  126. package/es-modules/Extensions/Annotations/Mixins/ControllableMixin.js +13 -4
  127. package/es-modules/Extensions/Annotations/Mixins/EventEmitterMixin.js +0 -1
  128. package/es-modules/Extensions/Annotations/Mixins/MarkerMixin.js +5 -4
  129. package/es-modules/Extensions/Annotations/NavigationBindings.js +120 -53
  130. package/es-modules/Extensions/Annotations/Popup.js +494 -148
  131. package/es-modules/Extensions/Annotations/Types/BasicAnnotation.js +51 -2
  132. package/es-modules/Extensions/Annotations/Types/CrookedLine.js +5 -3
  133. package/es-modules/Extensions/Annotations/Types/ElliottWave.js +1 -1
  134. package/es-modules/Extensions/Annotations/Types/Fibonacci.js +2 -3
  135. package/es-modules/Extensions/Annotations/Types/FibonacciTimeZones.js +219 -0
  136. package/es-modules/Extensions/Annotations/Types/InfinityLine.js +1 -1
  137. package/es-modules/Extensions/Annotations/Types/Measure.js +29 -19
  138. package/es-modules/Extensions/Annotations/Types/Pitchfork.js +7 -6
  139. package/es-modules/Extensions/Annotations/Types/TimeCycles.js +211 -0
  140. package/es-modules/Extensions/Annotations/Types/Tunnel.js +13 -10
  141. package/es-modules/Extensions/Annotations/Types/VerticalLine.js +1 -1
  142. package/es-modules/Extensions/Boost/BoostOptions.js +2 -2
  143. package/es-modules/Extensions/Boost/BoostOverrides.js +6 -10
  144. package/es-modules/Extensions/Boost/BoostUtils.js +0 -6
  145. package/es-modules/Extensions/Boost/WGLRenderer.js +16 -12
  146. package/es-modules/Extensions/Boost/WGLShader.js +13 -11
  147. package/es-modules/Extensions/Boost/WGLVBuffer.js +4 -7
  148. package/es-modules/Extensions/BoostCanvas.js +1 -2
  149. package/es-modules/Extensions/CurrentDateIndication.js +2 -3
  150. package/es-modules/Extensions/Data.js +77 -115
  151. package/es-modules/Extensions/DataGrouping.js +54 -32
  152. package/es-modules/Extensions/Debugger/ErrorMessages.js +2 -2
  153. package/es-modules/Extensions/DownloadURL.js +2 -2
  154. package/es-modules/Extensions/DragPanes.js +1 -2
  155. package/es-modules/Extensions/DraggablePoints.js +7 -8
  156. package/es-modules/Extensions/Drilldown.js +11 -7
  157. package/es-modules/Extensions/ExportData.js +6 -5
  158. package/es-modules/Extensions/Exporting/Exporting.js +35 -48
  159. package/es-modules/Extensions/Exporting/ExportingDefaults.js +8 -15
  160. package/es-modules/Extensions/FullScreen.js +4 -3
  161. package/es-modules/Extensions/GeoJSON.js +42 -66
  162. package/es-modules/Extensions/MarkerClusters.js +118 -98
  163. package/es-modules/Extensions/Math3D.js +4 -4
  164. package/es-modules/Extensions/NoDataToDisplay.js +1 -2
  165. package/es-modules/Extensions/OfflineExporting/OfflineExporting.js +33 -33
  166. package/es-modules/Extensions/OfflineExporting/OfflineExportingDefaults.js +1 -1
  167. package/es-modules/Extensions/Oldie/Oldie.js +14 -79
  168. package/es-modules/Extensions/Oldie/VMLAxis3D.js +5 -1
  169. package/es-modules/Extensions/OverlappingDataLabels.js +10 -6
  170. package/es-modules/Extensions/Pane.js +11 -12
  171. package/es-modules/Extensions/ParallelCoordinates.js +5 -3
  172. package/es-modules/Extensions/PatternFill.js +17 -11
  173. package/es-modules/Extensions/Polar.js +7 -4
  174. package/es-modules/Extensions/PriceIndication.js +2 -1
  175. package/es-modules/Extensions/RangeSelector.js +22 -59
  176. package/es-modules/Extensions/ScrollablePlotArea.js +2 -2
  177. package/es-modules/Extensions/SeriesLabel.js +1 -1
  178. package/es-modules/Extensions/Sonification/ChartSonify.js +279 -663
  179. package/es-modules/Extensions/Sonification/Earcon.js +136 -102
  180. package/es-modules/Extensions/Sonification/Instrument.js +493 -426
  181. package/es-modules/Extensions/Sonification/MusicalFrequencies.js +10 -0
  182. package/es-modules/Extensions/Sonification/Options.js +10 -0
  183. package/es-modules/Extensions/Sonification/PointSonify.js +207 -152
  184. package/es-modules/Extensions/Sonification/SeriesSonify.js +474 -0
  185. package/es-modules/Extensions/Sonification/SignalHandler.js +122 -0
  186. package/es-modules/Extensions/Sonification/Sonification.js +27 -53
  187. package/es-modules/Extensions/Sonification/{Utilities.js → SonificationUtilities.js} +70 -88
  188. package/es-modules/Extensions/Sonification/Timeline.js +250 -567
  189. package/es-modules/Extensions/Sonification/TimelineEvent.js +157 -0
  190. package/es-modules/Extensions/Sonification/TimelinePath.js +311 -0
  191. package/es-modules/Extensions/Stacking.js +5 -23
  192. package/es-modules/Extensions/Themes/BrandDark.js +293 -0
  193. package/es-modules/Extensions/Themes/BrandLight.js +259 -0
  194. package/es-modules/Extensions/Themes/DarkUnica.js +4 -2
  195. package/es-modules/Extensions/Themes/Grid.js +4 -2
  196. package/es-modules/Extensions/Themes/GridLight.js +4 -2
  197. package/es-modules/Gantt/Connection.js +2 -2
  198. package/es-modules/Gantt/Pathfinder.js +6 -5
  199. package/es-modules/Gantt/PathfinderAlgorithms.js +12 -12
  200. package/es-modules/Maps/MapNavigation.js +30 -68
  201. package/es-modules/Maps/MapNavigationOptionsDefault.js +3 -0
  202. package/es-modules/Maps/MapPointer.js +8 -5
  203. package/es-modules/Maps/MapSymbols.js +23 -3
  204. package/es-modules/Maps/MapView.js +450 -0
  205. package/es-modules/Maps/MapViewOptionsDefault.js +97 -0
  206. package/es-modules/Maps/Projection.js +436 -0
  207. package/es-modules/Maps/ProjectionDefinition.js +9 -0
  208. package/es-modules/Maps/Projections/EqualEarth.js +42 -0
  209. package/es-modules/Maps/Projections/LambertConformalConic.js +52 -0
  210. package/es-modules/Maps/Projections/Miller.js +16 -0
  211. package/es-modules/Maps/Projections/Orthographic.js +26 -0
  212. package/es-modules/Maps/Projections/ProjectionRegistry.js +19 -0
  213. package/es-modules/Maps/Projections/WebMercator.js +24 -0
  214. package/es-modules/Series/Area/AreaSeries.js +13 -13
  215. package/es-modules/Series/Area3DSeries.js +4 -2
  216. package/es-modules/Series/AreaRange/AreaRangeSeries.js +28 -17
  217. package/es-modules/Series/Bellcurve/BellcurveSeries.js +4 -9
  218. package/es-modules/Series/BoxPlot/BoxPlotSeries.js +1 -2
  219. package/es-modules/Series/Bubble/BubbleLegendDefaults.js +1 -2
  220. package/es-modules/Series/Bubble/BubbleLegendItem.js +5 -15
  221. package/es-modules/Series/Bubble/BubblePoint.js +5 -0
  222. package/es-modules/Series/Bubble/BubbleSeries.js +90 -50
  223. package/es-modules/Series/Candlestick/CandlestickSeries.js +10 -19
  224. package/es-modules/{Mixins/CenteredSeries.js → Series/CenteredUtilities.js} +45 -23
  225. package/es-modules/{Mixins/ColorMapSeries.js → Series/ColorMapMixin.js} +10 -8
  226. package/es-modules/Series/Column/ColumnDataLabel.js +5 -5
  227. package/es-modules/Series/Column/ColumnSeries.js +19 -18
  228. package/es-modules/Series/Column3D/Column3DComposition.js +1 -2
  229. package/es-modules/Series/ColumnPyramid/ColumnPyramidSeries.js +11 -8
  230. package/es-modules/Series/ColumnRange/ColumnRangeSeries.js +2 -1
  231. package/es-modules/Series/Cylinder/CylinderComposition.js +36 -4
  232. package/es-modules/Series/DataModifyComposition.js +539 -0
  233. package/es-modules/Series/DependencyWheel/DependencyWheelPoint.js +2 -6
  234. package/es-modules/Series/DependencyWheel/DependencyWheelSeries.js +1 -1
  235. package/es-modules/Series/DerivedComposition.js +137 -0
  236. package/es-modules/Series/DrawPointComposition.js +111 -0
  237. package/es-modules/Series/Dumbbell/DumbbellPoint.js +0 -1
  238. package/es-modules/Series/Dumbbell/DumbbellSeries.js +2 -6
  239. package/es-modules/Series/ErrorBar/ErrorBarSeries.js +1 -2
  240. package/es-modules/Series/Flags/FlagsSeries.js +18 -25
  241. package/es-modules/Series/Flags/FlagsSymbols.js +2 -2
  242. package/es-modules/Series/Funnel/FunnelSeries.js +6 -5
  243. package/es-modules/Series/Funnel3D/Funnel3DComposition.js +14 -8
  244. package/es-modules/Series/Funnel3D/Funnel3DSeries.js +2 -1
  245. package/es-modules/Series/Gantt/GanttPoint.js +1 -1
  246. package/es-modules/Series/Gantt/GanttSeries.js +3 -3
  247. package/es-modules/Series/Gauge/GaugePoint.js +1 -1
  248. package/es-modules/Series/Gauge/GaugeSeries.js +7 -7
  249. package/es-modules/Series/HLC/HLCPoint.js +55 -0
  250. package/es-modules/Series/HLC/HLCSeries.js +378 -0
  251. package/es-modules/Series/Heatmap/HeatmapPoint.js +13 -14
  252. package/es-modules/Series/Heatmap/HeatmapSeries.js +24 -12
  253. package/es-modules/Series/HeikinAshi/HeikinAshiSeries.js +10 -9
  254. package/es-modules/Series/Histogram/HistogramSeries.js +7 -11
  255. package/es-modules/Series/HollowCandlestick/HollowCandlestickPoint.js +1 -4
  256. package/es-modules/Series/HollowCandlestick/HollowCandlestickSeries.js +28 -30
  257. package/es-modules/Series/Item/ItemSeries.js +4 -5
  258. package/es-modules/Series/Line/LineSeries.js +1 -2
  259. package/es-modules/Series/Map/MapPoint.js +27 -14
  260. package/es-modules/Series/Map/MapSeries.js +283 -322
  261. package/es-modules/Series/MapBubble/MapBubblePoint.js +0 -3
  262. package/es-modules/Series/MapBubble/MapBubbleSeries.js +10 -1
  263. package/es-modules/Series/MapLine/MapLineSeries.js +2 -4
  264. package/es-modules/Series/MapPoint/MapPointPoint.js +5 -1
  265. package/es-modules/Series/MapPoint/MapPointSeries.js +99 -14
  266. package/es-modules/Series/Networkgraph/DraggableNodes.js +0 -4
  267. package/es-modules/Series/Networkgraph/Integrations.js +8 -22
  268. package/es-modules/Series/Networkgraph/Networkgraph.js +6 -10
  269. package/es-modules/Series/Networkgraph/QuadTree.js +1 -3
  270. package/es-modules/{Mixins/Nodes.js → Series/NodesComposition.js} +78 -30
  271. package/es-modules/Series/OHLC/OHLCPoint.js +2 -7
  272. package/es-modules/Series/OHLC/OHLCSeries.js +55 -183
  273. package/es-modules/{Mixins/OnSeries.js → Series/OnSeriesComposition.js} +53 -21
  274. package/es-modules/Series/Organization/OrganizationSeries.js +6 -5
  275. package/es-modules/Series/PackedBubble/PackedBubbleComposition.js +1 -0
  276. package/es-modules/Series/PackedBubble/PackedBubblePoint.js +1 -1
  277. package/es-modules/Series/PackedBubble/PackedBubbleSeries.js +48 -10
  278. package/es-modules/Series/ParetoSeries/ParetoSeries.js +3 -7
  279. package/es-modules/Series/Pie/PieDataLabel.js +1 -2
  280. package/es-modules/Series/Pie/PiePoint.js +2 -2
  281. package/es-modules/Series/Pie/PieSeries.js +7 -8
  282. package/es-modules/Series/Pie3D/Pie3DComposition.js +2 -1
  283. package/es-modules/Series/Pie3D/Pie3DPoint.js +2 -1
  284. package/es-modules/Series/Pie3D/Pie3DSeries.js +1 -1
  285. package/es-modules/Series/Pyramid3D/Pyramid3DSeries.js +2 -1
  286. package/es-modules/Series/Sankey/SankeyPoint.js +0 -4
  287. package/es-modules/Series/Sankey/SankeySeries.js +92 -22
  288. package/es-modules/Series/SolidGauge/SolidGaugeComposition.js +3 -1
  289. package/es-modules/Series/Spline/SplineSeries.js +0 -8
  290. package/es-modules/Series/Sunburst/SunburstPoint.js +2 -3
  291. package/es-modules/Series/Sunburst/SunburstSeries.js +6 -6
  292. package/es-modules/Series/Sunburst/SunburstUtilities.js +3 -2
  293. package/es-modules/Series/Tilemap/TilemapPoint.js +2 -5
  294. package/es-modules/Series/Tilemap/TilemapShapes.js +0 -7
  295. package/es-modules/Series/Timeline/TimelineSeries.js +3 -4
  296. package/es-modules/{Mixins/TreeSeries.js → Series/TreeUtilities.js} +88 -78
  297. package/es-modules/Series/Treemap/TreemapPoint.js +2 -2
  298. package/es-modules/Series/Treemap/TreemapSeries.js +22 -25
  299. package/es-modules/Series/Variwide/VariwideSeries.js +5 -1
  300. package/es-modules/Series/Venn/VennPoint.js +16 -7
  301. package/es-modules/Series/Venn/VennSeries.js +11 -17
  302. package/es-modules/Series/Venn/VennUtils.js +551 -439
  303. package/es-modules/Series/Waterfall/WaterfallSeries.js +8 -6
  304. package/es-modules/Series/Windbarb/WindbarbSeries.js +23 -24
  305. package/es-modules/Series/Wordcloud/WordcloudPoint.js +8 -6
  306. package/es-modules/Series/Wordcloud/WordcloudSeries.js +26 -22
  307. package/es-modules/Series/Wordcloud/WordcloudUtils.js +669 -484
  308. package/es-modules/Series/XRange/XRangePoint.js +7 -12
  309. package/es-modules/Series/XRange/XRangeSeries.js +4 -20
  310. package/es-modules/Stock/Indicators/ABands/ABandsIndicator.js +15 -6
  311. package/es-modules/Stock/Indicators/AO/AOIndicator.js +2 -3
  312. package/es-modules/Stock/Indicators/APO/APOIndicator.js +14 -20
  313. package/es-modules/Stock/Indicators/Aroon/AroonIndicator.js +4 -6
  314. package/es-modules/Stock/Indicators/AroonOscillator/AroonOscillatorIndicator.js +11 -13
  315. package/es-modules/Stock/Indicators/ArrayUtilities.js +47 -0
  316. package/es-modules/Stock/Indicators/BB/BBIndicator.js +39 -11
  317. package/es-modules/Stock/Indicators/CMF/CMFIndicator.js +35 -15
  318. package/es-modules/Stock/Indicators/Chaikin/ChaikinIndicator.js +6 -12
  319. package/es-modules/Stock/Indicators/DEMA/DEMAIndicator.js +1 -11
  320. package/es-modules/Stock/Indicators/DMI/DMIIndicator.js +28 -16
  321. package/es-modules/Stock/Indicators/DisparityIndex/DisparityIndexIndicator.js +18 -11
  322. package/es-modules/Stock/Indicators/EMA/EMAIndicator.js +1 -3
  323. package/es-modules/Stock/Indicators/IKH/IKHIndicator.js +6 -6
  324. package/es-modules/Stock/Indicators/KeltnerChannels/KeltnerChannelsIndicator.js +23 -9
  325. package/es-modules/Stock/Indicators/Klinger/KlingerIndicator.js +16 -19
  326. package/es-modules/Stock/Indicators/LinearRegression/LinearRegression.js +32 -14
  327. package/es-modules/Stock/Indicators/LinearRegressionAngle/LinearRegressionAngle.js +2 -2
  328. package/es-modules/Stock/Indicators/LinearRegressionIntercept/LinearRegressionIntercept.js +2 -2
  329. package/es-modules/Stock/Indicators/LinearRegressionSlopes/LinearRegressionSlopes.js +2 -2
  330. package/es-modules/Stock/Indicators/MACD/MACDIndicator.js +2 -3
  331. package/es-modules/Stock/Indicators/MultipleLinesComposition.js +294 -0
  332. package/es-modules/Stock/Indicators/NATR/NATRIndicator.js +1 -3
  333. package/es-modules/Stock/Indicators/PC/PCIndicator.js +25 -13
  334. package/es-modules/Stock/Indicators/PPO/PPOIndicator.js +1 -11
  335. package/es-modules/Stock/Indicators/PivotPoints/PivotPointsIndicator.js +2 -1
  336. package/es-modules/Stock/Indicators/RSI/RSIIndicator.js +2 -1
  337. package/es-modules/Stock/Indicators/SMA/SMAComposition.js +0 -26
  338. package/es-modules/Stock/Indicators/SMA/SMAIndicator.js +32 -50
  339. package/es-modules/Stock/Indicators/SlowStochastic/SlowStochasticIndicator.js +0 -8
  340. package/es-modules/Stock/Indicators/Stochastic/StochasticIndicator.js +18 -9
  341. package/es-modules/Stock/Indicators/Supertrend/SupertrendIndicator.js +4 -6
  342. package/es-modules/Stock/Indicators/TEMA/TEMAIndicator.js +26 -11
  343. package/es-modules/Stock/Indicators/TRIX/TRIXIndicator.js +6 -12
  344. package/es-modules/Stock/Indicators/VBP/VBPIndicator.js +26 -10
  345. package/es-modules/Stock/Indicators/VWAP/VWAPIndicator.js +19 -7
  346. package/es-modules/Stock/Indicators/WilliamsR/WilliamsRIndicator.js +2 -3
  347. package/es-modules/Stock/StockToolsBindings.js +156 -47
  348. package/es-modules/Stock/StockToolsGui.js +442 -37
  349. package/es-modules/masters/highcharts-3d.src.js +1 -1
  350. package/es-modules/masters/highcharts-gantt.src.js +1 -1
  351. package/es-modules/masters/highcharts-more.src.js +1 -1
  352. package/es-modules/masters/highcharts.src.js +1 -1
  353. package/es-modules/masters/highmaps.src.js +1 -1
  354. package/es-modules/masters/highstock.src.js +1 -1
  355. package/es-modules/masters/indicators/acceleration-bands.src.js +1 -1
  356. package/es-modules/masters/indicators/accumulation-distribution.src.js +1 -1
  357. package/es-modules/masters/indicators/ao.src.js +1 -1
  358. package/es-modules/masters/indicators/apo.src.js +1 -1
  359. package/es-modules/masters/indicators/aroon-oscillator.src.js +1 -1
  360. package/es-modules/masters/indicators/aroon.src.js +1 -1
  361. package/es-modules/masters/indicators/atr.src.js +1 -1
  362. package/es-modules/masters/indicators/bollinger-bands.src.js +1 -1
  363. package/es-modules/masters/indicators/cci.src.js +1 -1
  364. package/es-modules/masters/indicators/chaikin.src.js +1 -1
  365. package/es-modules/masters/indicators/cmf.src.js +1 -1
  366. package/es-modules/masters/indicators/cmo.src.js +1 -1
  367. package/es-modules/masters/indicators/dema.src.js +1 -1
  368. package/es-modules/masters/indicators/disparity-index.src.js +1 -1
  369. package/es-modules/masters/indicators/dmi.src.js +1 -1
  370. package/es-modules/masters/indicators/dpo.src.js +1 -1
  371. package/es-modules/masters/indicators/ema.src.js +4 -10
  372. package/es-modules/masters/indicators/ichimoku-kinko-hyo.src.js +1 -1
  373. package/es-modules/masters/indicators/indicators-all.src.js +2 -2
  374. package/es-modules/masters/indicators/indicators.src.js +2 -1
  375. package/es-modules/masters/indicators/keltner-channels.src.js +1 -1
  376. package/es-modules/masters/indicators/klinger.src.js +1 -1
  377. package/es-modules/masters/indicators/macd.src.js +1 -1
  378. package/es-modules/masters/indicators/mfi.src.js +1 -1
  379. package/es-modules/masters/indicators/momentum.src.js +1 -1
  380. package/es-modules/masters/indicators/natr.src.js +1 -1
  381. package/es-modules/masters/indicators/obv.src.js +1 -1
  382. package/es-modules/masters/indicators/pivot-points.src.js +1 -1
  383. package/es-modules/masters/indicators/ppo.src.js +1 -1
  384. package/es-modules/masters/indicators/price-channel.src.js +1 -1
  385. package/es-modules/masters/indicators/price-envelopes.src.js +1 -1
  386. package/es-modules/masters/indicators/psar.src.js +1 -1
  387. package/es-modules/masters/indicators/regressions.src.js +1 -1
  388. package/es-modules/masters/indicators/roc.src.js +1 -1
  389. package/es-modules/masters/indicators/rsi.src.js +1 -1
  390. package/es-modules/masters/indicators/slow-stochastic.src.js +1 -1
  391. package/es-modules/masters/indicators/stochastic.src.js +1 -1
  392. package/es-modules/masters/indicators/supertrend.src.js +1 -1
  393. package/es-modules/masters/indicators/tema.src.js +1 -1
  394. package/es-modules/masters/indicators/trendline.src.js +1 -1
  395. package/es-modules/masters/indicators/trix.src.js +1 -1
  396. package/es-modules/masters/indicators/volume-by-price.src.js +1 -1
  397. package/es-modules/masters/indicators/vwap.src.js +1 -1
  398. package/es-modules/masters/indicators/williams-r.src.js +1 -1
  399. package/es-modules/masters/indicators/wma.src.js +1 -1
  400. package/es-modules/masters/indicators/zigzag.src.js +1 -1
  401. package/es-modules/masters/modules/accessibility.src.js +16 -2
  402. package/es-modules/masters/modules/annotations-advanced.src.js +3 -1
  403. package/es-modules/masters/modules/annotations.src.js +1 -1
  404. package/es-modules/masters/modules/arrow-symbols.src.js +1 -1
  405. package/es-modules/masters/modules/boost-canvas.src.js +1 -1
  406. package/es-modules/masters/modules/boost.src.js +1 -1
  407. package/es-modules/masters/modules/broken-axis.src.js +1 -1
  408. package/es-modules/masters/modules/bullet.src.js +1 -1
  409. package/es-modules/masters/modules/coloraxis.src.js +1 -1
  410. package/es-modules/masters/modules/current-date-indicator.src.js +1 -1
  411. package/es-modules/masters/modules/cylinder.src.js +1 -1
  412. package/es-modules/masters/modules/data.src.js +6 -3
  413. package/es-modules/masters/modules/datagrouping.src.js +1 -1
  414. package/es-modules/masters/modules/debugger.src.js +1 -1
  415. package/es-modules/masters/modules/dependency-wheel.src.js +1 -1
  416. package/es-modules/masters/modules/dotplot.src.js +1 -1
  417. package/es-modules/masters/modules/drag-panes.src.js +1 -1
  418. package/es-modules/masters/modules/draggable-points.src.js +1 -1
  419. package/es-modules/masters/modules/drilldown.src.js +1 -1
  420. package/es-modules/masters/modules/dumbbell.src.js +1 -1
  421. package/es-modules/masters/modules/export-data.src.js +1 -1
  422. package/es-modules/masters/modules/exporting.src.js +1 -1
  423. package/es-modules/masters/modules/full-screen.src.js +1 -1
  424. package/es-modules/masters/modules/funnel.src.js +1 -1
  425. package/es-modules/masters/modules/funnel3d.src.js +1 -1
  426. package/es-modules/masters/modules/gantt.src.js +1 -1
  427. package/es-modules/masters/modules/grid-axis.src.js +1 -1
  428. package/es-modules/masters/modules/heatmap.src.js +1 -2
  429. package/es-modules/masters/modules/heikinashi.src.js +1 -1
  430. package/es-modules/masters/modules/histogram-bellcurve.src.js +1 -1
  431. package/es-modules/masters/modules/hollowcandlestick.src.js +1 -1
  432. package/es-modules/masters/modules/item-series.src.js +1 -1
  433. package/es-modules/masters/modules/lollipop.src.js +1 -1
  434. package/es-modules/masters/modules/map.src.js +1 -3
  435. package/es-modules/masters/modules/marker-clusters.src.js +1 -1
  436. package/es-modules/masters/modules/networkgraph.src.js +1 -1
  437. package/es-modules/masters/modules/no-data-to-display.src.js +1 -1
  438. package/es-modules/masters/modules/offline-exporting.src.js +1 -1
  439. package/es-modules/masters/modules/oldie-polyfills.src.js +1 -1
  440. package/es-modules/masters/modules/oldie.src.js +1 -1
  441. package/es-modules/masters/modules/organization.src.js +1 -1
  442. package/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
  443. package/es-modules/masters/modules/parallel-coordinates.src.js +1 -1
  444. package/es-modules/masters/modules/pareto.src.js +1 -1
  445. package/es-modules/masters/modules/pathfinder.src.js +1 -1
  446. package/es-modules/masters/modules/pattern-fill.src.js +1 -1
  447. package/es-modules/masters/modules/price-indicator.src.js +1 -1
  448. package/es-modules/masters/modules/pyramid3d.src.js +1 -1
  449. package/es-modules/masters/modules/sankey.src.js +1 -1
  450. package/es-modules/masters/modules/series-label.src.js +1 -1
  451. package/es-modules/masters/modules/solid-gauge.src.js +1 -1
  452. package/es-modules/masters/modules/sonification.src.js +33 -2
  453. package/es-modules/masters/modules/static-scale.src.js +1 -1
  454. package/es-modules/masters/modules/stock-tools.src.js +1 -1
  455. package/es-modules/masters/modules/stock.src.js +4 -1
  456. package/es-modules/masters/modules/streamgraph.src.js +1 -1
  457. package/es-modules/masters/modules/sunburst.src.js +1 -1
  458. package/es-modules/masters/modules/tilemap.src.js +1 -1
  459. package/es-modules/masters/modules/timeline.src.js +1 -1
  460. package/es-modules/masters/modules/treegrid.src.js +1 -1
  461. package/es-modules/masters/modules/treemap.src.js +1 -1
  462. package/es-modules/masters/modules/variable-pie.src.js +1 -1
  463. package/es-modules/masters/modules/variwide.src.js +1 -1
  464. package/es-modules/masters/modules/vector.src.js +1 -1
  465. package/es-modules/masters/modules/venn.src.js +1 -1
  466. package/es-modules/masters/modules/windbarb.src.js +1 -1
  467. package/es-modules/masters/modules/wordcloud.src.js +1 -1
  468. package/es-modules/masters/modules/xrange.src.js +1 -1
  469. package/es-modules/masters/themes/avocado.src.js +1 -1
  470. package/es-modules/masters/themes/brand-dark.src.js +14 -0
  471. package/es-modules/masters/themes/brand-light.src.js +14 -0
  472. package/es-modules/masters/themes/dark-blue.src.js +1 -1
  473. package/es-modules/masters/themes/dark-green.src.js +1 -1
  474. package/es-modules/masters/themes/dark-unica.src.js +1 -1
  475. package/es-modules/masters/themes/gray.src.js +1 -1
  476. package/es-modules/masters/themes/grid-light.src.js +1 -1
  477. package/es-modules/masters/themes/grid.src.js +1 -1
  478. package/es-modules/masters/themes/high-contrast-dark.src.js +1 -1
  479. package/es-modules/masters/themes/high-contrast-light.src.js +1 -1
  480. package/es-modules/masters/themes/sand-signika.src.js +1 -1
  481. package/es-modules/masters/themes/skies.src.js +1 -1
  482. package/es-modules/masters/themes/sunset.src.js +1 -1
  483. package/highcharts-3d.js +1 -1
  484. package/highcharts-3d.js.map +1 -1
  485. package/highcharts-3d.src.js +65 -35
  486. package/highcharts-gantt.js +800 -803
  487. package/highcharts-gantt.js.map +1 -1
  488. package/highcharts-gantt.src.js +1359 -1429
  489. package/highcharts-more.js +194 -193
  490. package/highcharts-more.js.map +1 -1
  491. package/highcharts-more.src.js +280 -222
  492. package/highcharts.d.ts +10228 -768
  493. package/highcharts.js +585 -588
  494. package/highcharts.js.map +1 -1
  495. package/highcharts.src.d.ts +10228 -768
  496. package/highcharts.src.js +995 -1066
  497. package/highmaps.js +727 -707
  498. package/highmaps.js.map +1 -1
  499. package/highmaps.src.js +3243 -2135
  500. package/highstock.js +788 -783
  501. package/highstock.js.map +1 -1
  502. package/highstock.src.js +2492 -1981
  503. package/indicators/acceleration-bands.d.ts +17 -1
  504. package/indicators/acceleration-bands.js +11 -9
  505. package/indicators/acceleration-bands.js.map +1 -1
  506. package/indicators/acceleration-bands.src.d.ts +17 -1
  507. package/indicators/acceleration-bands.src.js +238 -112
  508. package/indicators/accumulation-distribution.js +1 -1
  509. package/indicators/accumulation-distribution.src.js +1 -1
  510. package/indicators/ao.js +6 -6
  511. package/indicators/ao.js.map +1 -1
  512. package/indicators/ao.src.js +4 -4
  513. package/indicators/apo.js +5 -6
  514. package/indicators/apo.js.map +1 -1
  515. package/indicators/apo.src.js +16 -84
  516. package/indicators/aroon-oscillator.d.ts +17 -1
  517. package/indicators/aroon-oscillator.js +10 -9
  518. package/indicators/aroon-oscillator.js.map +1 -1
  519. package/indicators/aroon-oscillator.src.d.ts +17 -1
  520. package/indicators/aroon-oscillator.src.js +230 -177
  521. package/indicators/aroon.d.ts +17 -1
  522. package/indicators/aroon.js +11 -9
  523. package/indicators/aroon.js.map +1 -1
  524. package/indicators/aroon.src.d.ts +17 -1
  525. package/indicators/aroon.src.js +227 -112
  526. package/indicators/atr.js +1 -1
  527. package/indicators/atr.src.js +1 -1
  528. package/indicators/bollinger-bands.d.ts +17 -1
  529. package/indicators/bollinger-bands.js +12 -9
  530. package/indicators/bollinger-bands.js.map +1 -1
  531. package/indicators/bollinger-bands.src.d.ts +17 -1
  532. package/indicators/bollinger-bands.src.js +262 -117
  533. package/indicators/cci.js +1 -1
  534. package/indicators/cci.src.js +1 -1
  535. package/indicators/chaikin.js +8 -9
  536. package/indicators/chaikin.js.map +1 -1
  537. package/indicators/chaikin.src.js +8 -76
  538. package/indicators/cmf.js +1 -1
  539. package/indicators/cmf.js.map +1 -1
  540. package/indicators/cmf.src.js +36 -16
  541. package/indicators/cmo.js +1 -1
  542. package/indicators/cmo.src.js +1 -1
  543. package/indicators/dema.js +5 -6
  544. package/indicators/dema.js.map +1 -1
  545. package/indicators/dema.src.js +3 -75
  546. package/indicators/disparity-index.js +6 -7
  547. package/indicators/disparity-index.js.map +1 -1
  548. package/indicators/disparity-index.src.js +20 -74
  549. package/indicators/dmi.js +12 -11
  550. package/indicators/dmi.js.map +1 -1
  551. package/indicators/dmi.src.js +252 -121
  552. package/indicators/dpo.js +1 -1
  553. package/indicators/dpo.src.js +1 -1
  554. package/indicators/ema.js +1 -13
  555. package/indicators/ema.js.map +1 -1
  556. package/indicators/ema.src.js +7 -188
  557. package/indicators/ichimoku-kinko-hyo.js +1 -1
  558. package/indicators/ichimoku-kinko-hyo.js.map +1 -1
  559. package/indicators/ichimoku-kinko-hyo.src.js +7 -7
  560. package/indicators/indicators-all.d.ts +17 -1
  561. package/indicators/indicators-all.js +198 -203
  562. package/indicators/indicators-all.js.map +1 -1
  563. package/indicators/indicators-all.src.d.ts +17 -1
  564. package/indicators/indicators-all.src.js +892 -777
  565. package/indicators/indicators.js +12 -12
  566. package/indicators/indicators.js.map +1 -1
  567. package/indicators/indicators.src.js +213 -144
  568. package/indicators/keltner-channels.d.ts +17 -1
  569. package/indicators/keltner-channels.js +11 -10
  570. package/indicators/keltner-channels.js.map +1 -1
  571. package/indicators/keltner-channels.src.d.ts +17 -1
  572. package/indicators/keltner-channels.src.js +246 -118
  573. package/indicators/klinger.js +14 -13
  574. package/indicators/klinger.js.map +1 -1
  575. package/indicators/klinger.src.js +239 -187
  576. package/indicators/macd.js +2 -2
  577. package/indicators/macd.js.map +1 -1
  578. package/indicators/macd.src.js +3 -4
  579. package/indicators/mfi.js +1 -1
  580. package/indicators/mfi.src.js +1 -1
  581. package/indicators/momentum.js +1 -1
  582. package/indicators/momentum.src.js +1 -1
  583. package/indicators/natr.js +3 -3
  584. package/indicators/natr.js.map +1 -1
  585. package/indicators/natr.src.js +2 -4
  586. package/indicators/obv.js +1 -1
  587. package/indicators/obv.src.js +1 -1
  588. package/indicators/pivot-points.js +1 -1
  589. package/indicators/pivot-points.js.map +1 -1
  590. package/indicators/pivot-points.src.js +3 -2
  591. package/indicators/ppo.js +5 -6
  592. package/indicators/ppo.js.map +1 -1
  593. package/indicators/ppo.src.js +3 -75
  594. package/indicators/price-channel.d.ts +17 -1
  595. package/indicators/price-channel.js +11 -9
  596. package/indicators/price-channel.js.map +1 -1
  597. package/indicators/price-channel.src.d.ts +17 -1
  598. package/indicators/price-channel.src.js +288 -168
  599. package/indicators/price-envelopes.js +1 -1
  600. package/indicators/price-envelopes.src.js +1 -1
  601. package/indicators/psar.js +1 -1
  602. package/indicators/psar.src.js +1 -1
  603. package/indicators/regressions.js +1 -1
  604. package/indicators/regressions.js.map +1 -1
  605. package/indicators/regressions.src.js +39 -21
  606. package/indicators/roc.js +1 -1
  607. package/indicators/roc.src.js +1 -1
  608. package/indicators/rsi.js +1 -1
  609. package/indicators/rsi.js.map +1 -1
  610. package/indicators/rsi.src.js +3 -2
  611. package/indicators/slow-stochastic.js +5 -6
  612. package/indicators/slow-stochastic.js.map +1 -1
  613. package/indicators/slow-stochastic.src.js +2 -72
  614. package/indicators/stochastic.d.ts +17 -1
  615. package/indicators/stochastic.js +12 -10
  616. package/indicators/stochastic.js.map +1 -1
  617. package/indicators/stochastic.src.d.ts +17 -1
  618. package/indicators/stochastic.src.js +282 -165
  619. package/indicators/supertrend.js +10 -10
  620. package/indicators/supertrend.js.map +1 -1
  621. package/indicators/supertrend.src.js +6 -7
  622. package/indicators/tema.js +6 -7
  623. package/indicators/tema.js.map +1 -1
  624. package/indicators/tema.src.js +28 -75
  625. package/indicators/trendline.js +1 -1
  626. package/indicators/trendline.src.js +1 -1
  627. package/indicators/trix.js +4 -5
  628. package/indicators/trix.js.map +1 -1
  629. package/indicators/trix.src.js +8 -76
  630. package/indicators/volume-by-price.js +16 -16
  631. package/indicators/volume-by-price.js.map +1 -1
  632. package/indicators/volume-by-price.src.js +27 -10
  633. package/indicators/vwap.js +1 -1
  634. package/indicators/vwap.js.map +1 -1
  635. package/indicators/vwap.src.js +20 -8
  636. package/indicators/williams-r.js +5 -6
  637. package/indicators/williams-r.js.map +1 -1
  638. package/indicators/williams-r.src.js +41 -51
  639. package/indicators/wma.js +1 -1
  640. package/indicators/wma.src.js +1 -1
  641. package/indicators/zigzag.js +1 -1
  642. package/indicators/zigzag.src.js +1 -1
  643. package/modules/accessibility.d.ts +0 -30
  644. package/modules/accessibility.js +240 -216
  645. package/modules/accessibility.js.map +1 -1
  646. package/modules/accessibility.src.d.ts +0 -30
  647. package/modules/accessibility.src.js +7807 -6400
  648. package/modules/annotations-advanced.d.ts +30 -0
  649. package/modules/annotations-advanced.js +192 -165
  650. package/modules/annotations-advanced.js.map +1 -1
  651. package/modules/annotations-advanced.src.d.ts +30 -0
  652. package/modules/annotations-advanced.src.js +1716 -416
  653. package/modules/annotations.js +125 -110
  654. package/modules/annotations.js.map +1 -1
  655. package/modules/annotations.src.js +1059 -304
  656. package/modules/arrow-symbols.js +1 -1
  657. package/modules/arrow-symbols.src.js +1 -1
  658. package/modules/boost-canvas.js +15 -15
  659. package/modules/boost-canvas.js.map +1 -1
  660. package/modules/boost-canvas.src.js +3 -3
  661. package/modules/boost.js +79 -79
  662. package/modules/boost.js.map +1 -1
  663. package/modules/boost.src.js +42 -51
  664. package/modules/broken-axis.js +1 -1
  665. package/modules/broken-axis.js.map +1 -1
  666. package/modules/broken-axis.src.js +18 -12
  667. package/modules/bullet.js +1 -1
  668. package/modules/bullet.src.js +1 -1
  669. package/modules/coloraxis.js +24 -24
  670. package/modules/coloraxis.js.map +1 -1
  671. package/modules/coloraxis.src.js +77 -103
  672. package/modules/current-date-indicator.js +4 -4
  673. package/modules/current-date-indicator.js.map +1 -1
  674. package/modules/current-date-indicator.src.js +4 -4
  675. package/modules/cylinder.js +1 -1
  676. package/modules/cylinder.js.map +1 -1
  677. package/modules/cylinder.src.js +37 -5
  678. package/modules/data.d.ts +6 -6
  679. package/modules/data.js +32 -32
  680. package/modules/data.js.map +1 -1
  681. package/modules/data.src.d.ts +6 -6
  682. package/modules/data.src.js +94 -140
  683. package/modules/datagrouping.js +20 -20
  684. package/modules/datagrouping.js.map +1 -1
  685. package/modules/datagrouping.src.js +56 -33
  686. package/modules/debugger.js +3 -3
  687. package/modules/debugger.js.map +1 -1
  688. package/modules/debugger.src.js +3 -3
  689. package/modules/dependency-wheel.js +11 -11
  690. package/modules/dependency-wheel.js.map +1 -1
  691. package/modules/dependency-wheel.src.js +5 -8
  692. package/modules/dotplot.js +1 -1
  693. package/modules/dotplot.src.js +1 -1
  694. package/modules/drag-panes.js +8 -8
  695. package/modules/drag-panes.js.map +1 -1
  696. package/modules/drag-panes.src.js +3 -3
  697. package/modules/draggable-points.js +1 -1
  698. package/modules/draggable-points.js.map +1 -1
  699. package/modules/draggable-points.src.js +8 -9
  700. package/modules/drilldown.js +24 -24
  701. package/modules/drilldown.js.map +1 -1
  702. package/modules/drilldown.src.js +13 -8
  703. package/modules/dumbbell.js +17 -17
  704. package/modules/dumbbell.js.map +1 -1
  705. package/modules/dumbbell.src.js +4 -8
  706. package/modules/export-data.js +19 -19
  707. package/modules/export-data.js.map +1 -1
  708. package/modules/export-data.src.js +9 -8
  709. package/modules/exporting.js +39 -38
  710. package/modules/exporting.js.map +1 -1
  711. package/modules/exporting.src.js +134 -116
  712. package/modules/full-screen.js +1 -1
  713. package/modules/full-screen.js.map +1 -1
  714. package/modules/full-screen.src.js +5 -4
  715. package/modules/funnel.js +12 -12
  716. package/modules/funnel.js.map +1 -1
  717. package/modules/funnel.src.js +9 -6
  718. package/modules/funnel3d.js +1 -1
  719. package/modules/funnel3d.js.map +1 -1
  720. package/modules/funnel3d.src.js +17 -10
  721. package/modules/gantt.js +217 -218
  722. package/modules/gantt.js.map +1 -1
  723. package/modules/gantt.src.js +364 -363
  724. package/modules/grid-axis.js +1 -1
  725. package/modules/grid-axis.js.map +1 -1
  726. package/modules/grid-axis.src.js +27 -19
  727. package/modules/heatmap.js +39 -39
  728. package/modules/heatmap.js.map +1 -1
  729. package/modules/heatmap.src.js +132 -141
  730. package/modules/heikinashi.js +1 -1
  731. package/modules/heikinashi.js.map +1 -1
  732. package/modules/heikinashi.src.js +12 -10
  733. package/modules/histogram-bellcurve.js +13 -13
  734. package/modules/histogram-bellcurve.js.map +1 -1
  735. package/modules/histogram-bellcurve.src.js +97 -91
  736. package/modules/hollowcandlestick.js +9 -9
  737. package/modules/hollowcandlestick.js.map +1 -1
  738. package/modules/hollowcandlestick.src.js +31 -35
  739. package/modules/item-series.js +6 -6
  740. package/modules/item-series.js.map +1 -1
  741. package/modules/item-series.src.js +6 -6
  742. package/modules/lollipop.js +1 -1
  743. package/modules/lollipop.src.js +1 -1
  744. package/modules/map.d.ts +138 -14
  745. package/modules/map.js +144 -122
  746. package/modules/map.js.map +1 -1
  747. package/modules/map.src.d.ts +138 -14
  748. package/modules/map.src.js +2253 -1074
  749. package/modules/marker-clusters.js +36 -36
  750. package/modules/marker-clusters.js.map +1 -1
  751. package/modules/marker-clusters.src.js +176 -143
  752. package/modules/networkgraph.d.ts +12 -1
  753. package/modules/networkgraph.js +49 -49
  754. package/modules/networkgraph.js.map +1 -1
  755. package/modules/networkgraph.src.d.ts +12 -1
  756. package/modules/networkgraph.src.js +103 -78
  757. package/modules/no-data-to-display.js +5 -5
  758. package/modules/no-data-to-display.js.map +1 -1
  759. package/modules/no-data-to-display.src.js +3 -3
  760. package/modules/offline-exporting.js +18 -17
  761. package/modules/offline-exporting.js.map +1 -1
  762. package/modules/offline-exporting.src.js +39 -44
  763. package/modules/oldie-polyfills.js +1 -1
  764. package/modules/oldie-polyfills.src.js +1 -1
  765. package/modules/oldie.js +26 -26
  766. package/modules/oldie.js.map +1 -1
  767. package/modules/oldie.src.js +21 -81
  768. package/modules/organization.js +13 -13
  769. package/modules/organization.js.map +1 -1
  770. package/modules/organization.src.js +8 -6
  771. package/modules/overlapping-datalabels.js +1 -1
  772. package/modules/overlapping-datalabels.src.js +1 -1
  773. package/modules/parallel-coordinates.js +1 -1
  774. package/modules/parallel-coordinates.js.map +1 -1
  775. package/modules/parallel-coordinates.src.js +6 -4
  776. package/modules/pareto.js +7 -7
  777. package/modules/pareto.js.map +1 -1
  778. package/modules/pareto.src.js +89 -78
  779. package/modules/pathfinder.js +1 -1
  780. package/modules/pathfinder.js.map +1 -1
  781. package/modules/pathfinder.src.js +21 -20
  782. package/modules/pattern-fill.js +1 -1
  783. package/modules/pattern-fill.js.map +1 -1
  784. package/modules/pattern-fill.src.js +18 -12
  785. package/modules/price-indicator.js +1 -1
  786. package/modules/price-indicator.js.map +1 -1
  787. package/modules/price-indicator.src.js +3 -2
  788. package/modules/pyramid3d.js +1 -1
  789. package/modules/pyramid3d.js.map +1 -1
  790. package/modules/pyramid3d.src.js +3 -2
  791. package/modules/sankey.d.ts +12 -1
  792. package/modules/sankey.js +29 -29
  793. package/modules/sankey.js.map +1 -1
  794. package/modules/sankey.src.d.ts +12 -1
  795. package/modules/sankey.src.js +307 -181
  796. package/modules/series-label.js +1 -1
  797. package/modules/series-label.js.map +1 -1
  798. package/modules/series-label.src.js +2 -2
  799. package/modules/solid-gauge.js +1 -1
  800. package/modules/solid-gauge.js.map +1 -1
  801. package/modules/solid-gauge.src.js +17 -2
  802. package/modules/sonification.js +59 -55
  803. package/modules/sonification.js.map +1 -1
  804. package/modules/sonification.src.js +3093 -2594
  805. package/modules/static-scale.js +1 -1
  806. package/modules/static-scale.src.js +1 -1
  807. package/modules/stock-tools.js +178 -163
  808. package/modules/stock-tools.js.map +1 -1
  809. package/modules/stock-tools.src.js +1136 -229
  810. package/modules/stock.d.ts +39 -6
  811. package/modules/stock.js +204 -196
  812. package/modules/stock.js.map +1 -1
  813. package/modules/stock.src.d.ts +39 -6
  814. package/modules/stock.src.js +1822 -1240
  815. package/modules/streamgraph.js +1 -1
  816. package/modules/streamgraph.src.js +1 -1
  817. package/modules/sunburst.js +60 -60
  818. package/modules/sunburst.js.map +1 -1
  819. package/modules/sunburst.src.js +281 -248
  820. package/modules/tilemap.js +17 -17
  821. package/modules/tilemap.js.map +1 -1
  822. package/modules/tilemap.src.js +3 -13
  823. package/modules/timeline.js +18 -18
  824. package/modules/timeline.js.map +1 -1
  825. package/modules/timeline.src.js +5 -5
  826. package/modules/treegrid.js +56 -57
  827. package/modules/treegrid.js.map +1 -1
  828. package/modules/treegrid.src.js +201 -169
  829. package/modules/treemap.js +41 -41
  830. package/modules/treemap.js.map +1 -1
  831. package/modules/treemap.src.js +266 -232
  832. package/modules/variable-pie.js +1 -1
  833. package/modules/variable-pie.src.js +1 -1
  834. package/modules/variwide.js +1 -1
  835. package/modules/variwide.js.map +1 -1
  836. package/modules/variwide.src.js +7 -3
  837. package/modules/vector.js +1 -1
  838. package/modules/vector.src.js +1 -1
  839. package/modules/venn.js +31 -31
  840. package/modules/venn.js.map +1 -1
  841. package/modules/venn.src.js +740 -731
  842. package/modules/windbarb.js +15 -15
  843. package/modules/windbarb.js.map +1 -1
  844. package/modules/windbarb.src.js +90 -62
  845. package/modules/wordcloud.js +23 -24
  846. package/modules/wordcloud.js.map +1 -1
  847. package/modules/wordcloud.src.js +898 -954
  848. package/modules/xrange.js +2 -2
  849. package/modules/xrange.js.map +1 -1
  850. package/modules/xrange.src.js +12 -33
  851. package/package.json +1 -1
  852. package/themes/avocado.js +1 -1
  853. package/themes/avocado.src.js +1 -1
  854. package/themes/brand-dark.js +15 -0
  855. package/themes/brand-dark.js.map +1 -0
  856. package/themes/brand-dark.src.js +328 -0
  857. package/themes/brand-light.js +15 -0
  858. package/themes/brand-light.js.map +1 -0
  859. package/themes/brand-light.src.js +294 -0
  860. package/themes/dark-blue.js +1 -1
  861. package/themes/dark-blue.src.js +1 -1
  862. package/themes/dark-green.js +1 -1
  863. package/themes/dark-green.src.js +1 -1
  864. package/themes/dark-unica.js +1 -1
  865. package/themes/dark-unica.js.map +1 -1
  866. package/themes/dark-unica.src.js +5 -3
  867. package/themes/gray.js +1 -1
  868. package/themes/gray.src.js +1 -1
  869. package/themes/grid-light.js +1 -1
  870. package/themes/grid-light.js.map +1 -1
  871. package/themes/grid-light.src.js +5 -3
  872. package/themes/grid.js +1 -1
  873. package/themes/grid.js.map +1 -1
  874. package/themes/grid.src.js +5 -3
  875. package/themes/high-contrast-dark.js +1 -1
  876. package/themes/high-contrast-dark.src.js +1 -1
  877. package/themes/high-contrast-light.js +1 -1
  878. package/themes/high-contrast-light.src.js +1 -1
  879. package/themes/sand-signika.js +1 -1
  880. package/themes/sand-signika.src.js +1 -1
  881. package/themes/skies.js +1 -1
  882. package/themes/skies.src.js +1 -1
  883. package/themes/sunset.js +1 -1
  884. package/themes/sunset.src.js +1 -1
  885. package/es-modules/Core/Axis/MapAxis.js +0 -157
  886. package/es-modules/Core/Color/Palette.js +0 -82
  887. package/es-modules/Extensions/Sonification/InstrumentDefinitions.js +0 -32
  888. package/es-modules/Mixins/ColorSeries.js +0 -77
  889. package/es-modules/Mixins/DerivedSeries.js +0 -118
  890. package/es-modules/Mixins/DrawPoint.js +0 -81
  891. package/es-modules/Mixins/IndicatorRequired.js +0 -56
  892. package/es-modules/Mixins/MultipleLines.js +0 -181
  893. package/es-modules/Mixins/Navigation.js +0 -54
  894. package/es-modules/Mixins/NelderMead.js +0 -132
  895. package/es-modules/Mixins/Polygon.js +0 -259
  896. package/es-modules/Mixins/ReduceArray.js +0 -54
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highmaps JS v9.2.1 (2021-08-19)
2
+ * @license Highmaps JS v9.3.2 (2021-11-29)
3
3
  *
4
4
  * Highmaps as a plugin for Highcharts or Highcharts Stock.
5
5
  *
@@ -28,259 +28,7 @@
28
28
  obj[path] = fn.apply(null, args);
29
29
  }
30
30
  }
31
- _registerModule(_modules, 'Core/Axis/MapAxis.js', [_modules['Core/Axis/Axis.js'], _modules['Core/Utilities.js']], function (Axis, U) {
32
- /* *
33
- *
34
- * (c) 2010-2021 Torstein Honsi
35
- *
36
- * License: www.highcharts.com/license
37
- *
38
- * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
39
- *
40
- * */
41
- var addEvent = U.addEvent,
42
- pick = U.pick;
43
- /**
44
- * Map support for axes.
45
- * @private
46
- * @class
47
- */
48
- var MapAxisAdditions = /** @class */ (function () {
49
- /* *
50
- *
51
- * Constructors
52
- *
53
- * */
54
- function MapAxisAdditions(axis) {
55
- this.axis = axis;
56
- }
57
- return MapAxisAdditions;
58
- }());
59
- /**
60
- * Axis with map support.
61
- * @private
62
- * @class
63
- */
64
- var MapAxis = /** @class */ (function () {
65
- function MapAxis() {
66
- }
67
- /**
68
- * Extends axes with map support.
69
- * @private
70
- *
71
- * @param {Highcharts.Axis} AxisClass
72
- * Axis class to extend.
73
- */
74
- MapAxis.compose = function (AxisClass) {
75
- AxisClass.keepProps.push('mapAxis');
76
- /* eslint-disable no-invalid-this */
77
- addEvent(AxisClass, 'init', function () {
78
- var axis = this;
79
- if (!axis.mapAxis) {
80
- axis.mapAxis = new MapAxisAdditions(axis);
81
- }
82
- });
83
- // Override to use the extreme coordinates from the SVG shape, not the
84
- // data values
85
- addEvent(AxisClass, 'getSeriesExtremes', function () {
86
- if (!this.mapAxis) {
87
- return;
88
- }
89
- var axis = this;
90
- var xData = [];
91
- // Remove the xData array and cache it locally so that the proceed
92
- // method doesn't use it
93
- if (axis.isXAxis) {
94
- axis.series.forEach(function (series, i) {
95
- if (series.useMapGeometry) {
96
- xData[i] = series.xData;
97
- series.xData = [];
98
- }
99
- });
100
- axis.mapAxis.seriesXData = xData;
101
- }
102
- });
103
- addEvent(AxisClass, 'afterGetSeriesExtremes', function () {
104
- if (!this.mapAxis) {
105
- return;
106
- }
107
- var axis = this;
108
- var xData = axis.mapAxis.seriesXData || [];
109
- var dataMin,
110
- dataMax,
111
- useMapGeometry;
112
- // Run extremes logic for map and mapline
113
- if (axis.isXAxis) {
114
- dataMin = pick(axis.dataMin, Number.MAX_VALUE);
115
- dataMax = pick(axis.dataMax, -Number.MAX_VALUE);
116
- axis.series.forEach(function (series, i) {
117
- if (series.useMapGeometry) {
118
- dataMin = Math.min(dataMin, pick(series.minX, dataMin));
119
- dataMax = Math.max(dataMax, pick(series.maxX, dataMax));
120
- series.xData = xData[i]; // Reset xData array
121
- useMapGeometry = true;
122
- }
123
- });
124
- if (useMapGeometry) {
125
- axis.dataMin = dataMin;
126
- axis.dataMax = dataMax;
127
- }
128
- axis.mapAxis.seriesXData = void 0;
129
- }
130
- });
131
- // Override axis translation to make sure the aspect ratio is always
132
- // kept
133
- addEvent(AxisClass, 'afterSetAxisTranslation', function () {
134
- if (!this.mapAxis) {
135
- return;
136
- }
137
- var axis = this;
138
- var chart = axis.chart;
139
- var plotRatio = chart.plotWidth / chart.plotHeight;
140
- var xAxis = chart.xAxis[0];
141
- var mapRatio,
142
- adjustedAxisLength,
143
- padAxis,
144
- fixTo,
145
- fixDiff,
146
- preserveAspectRatio;
147
- // Check for map-like series
148
- if (axis.coll === 'yAxis' && typeof xAxis.transA !== 'undefined') {
149
- axis.series.forEach(function (series) {
150
- if (series.preserveAspectRatio) {
151
- preserveAspectRatio = true;
152
- }
153
- });
154
- }
155
- // On Y axis, handle both
156
- if (preserveAspectRatio) {
157
- // Use the same translation for both axes
158
- axis.transA = xAxis.transA = Math.min(axis.transA, xAxis.transA);
159
- mapRatio = plotRatio / ((xAxis.max - xAxis.min) /
160
- (axis.max - axis.min));
161
- // What axis to pad to put the map in the middle
162
- padAxis = mapRatio < 1 ? axis : xAxis;
163
- // Pad it
164
- adjustedAxisLength =
165
- (padAxis.max - padAxis.min) * padAxis.transA;
166
- padAxis.mapAxis.pixelPadding = padAxis.len - adjustedAxisLength;
167
- padAxis.minPixelPadding = padAxis.mapAxis.pixelPadding / 2;
168
- fixTo = padAxis.mapAxis.fixTo;
169
- if (fixTo) {
170
- fixDiff = fixTo[1] - padAxis.toValue(fixTo[0], true);
171
- fixDiff *= padAxis.transA;
172
- if (Math.abs(fixDiff) > padAxis.minPixelPadding ||
173
- (padAxis.min === padAxis.dataMin &&
174
- padAxis.max === padAxis.dataMax)) { // zooming out again, keep within restricted area
175
- fixDiff = 0;
176
- }
177
- padAxis.minPixelPadding -= fixDiff;
178
- }
179
- }
180
- });
181
- // Override Axis.render in order to delete the fixTo prop
182
- addEvent(AxisClass, 'render', function () {
183
- var axis = this;
184
- if (axis.mapAxis) {
185
- axis.mapAxis.fixTo = void 0;
186
- }
187
- });
188
- /* eslint-enable no-invalid-this */
189
- };
190
- return MapAxis;
191
- }());
192
- MapAxis.compose(Axis); // @todo move to factory functions
193
-
194
- return MapAxis;
195
- });
196
- _registerModule(_modules, 'Mixins/ColorSeries.js', [], function () {
197
- /* *
198
- *
199
- * (c) 2010-2021 Torstein Honsi
200
- *
201
- * License: www.highcharts.com/license
202
- *
203
- * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
204
- *
205
- * */
206
- /**
207
- * Mixin for maps and heatmaps
208
- *
209
- * @private
210
- * @mixin Highcharts.colorPointMixin
211
- */
212
- var colorPointMixin = {
213
- /* eslint-disable valid-jsdoc */
214
- /**
215
- * Set the visibility of a single point
216
- * @private
217
- * @function Highcharts.colorPointMixin.setVisible
218
- * @param {boolean} visible
219
- * @return {void}
220
- */
221
- setVisible: function (vis) {
222
- var point = this,
223
- method = vis ? 'show' : 'hide';
224
- point.visible = point.options.visible = Boolean(vis);
225
- // Show and hide associated elements
226
- ['graphic', 'dataLabel'].forEach(function (key) {
227
- if (point[key]) {
228
- point[key][method]();
229
- }
230
- });
231
- this.series.buildKDTree(); // rebuild kdtree #13195
232
- }
233
- /* eslint-enable valid-jsdoc */
234
- };
235
- /**
236
- * @private
237
- * @mixin Highcharts.colorSeriesMixin
238
- */
239
- var colorSeriesMixin = {
240
- optionalAxis: 'colorAxis',
241
- /* eslint-disable valid-jsdoc */
242
- /**
243
- * In choropleth maps,
244
- the color is a result of the value,
245
- so this needs
246
- * translation too
247
- * @private
248
- * @function Highcharts.colorSeriesMixin.translateColors
249
- * @return {void}
250
- */
251
- translateColors: function () {
252
- var series = this,
253
- points = this.data.length ? this.data : this.points,
254
- nullColor = this.options.nullColor,
255
- colorAxis = this.colorAxis,
256
- colorKey = this.colorKey;
257
- points.forEach(function (point) {
258
- var value = point.getNestedProperty(colorKey),
259
- color;
260
- color = point.options.color ||
261
- (point.isNull || point.value === null ?
262
- nullColor :
263
- (colorAxis && typeof value !== 'undefined') ?
264
- colorAxis.toColor(value, point) :
265
- point.color || series.color);
266
- if (color && point.color !== color) {
267
- point.color = color;
268
- if (series.options.legendType === 'point' && point.legendItem) {
269
- series.chart.legend.colorizeItem(point, point.visible);
270
- }
271
- }
272
- });
273
- }
274
- /* eslint-enable valid-jsdoc */
275
- };
276
- var exports = {
277
- colorPointMixin: colorPointMixin,
278
- colorSeriesMixin: colorSeriesMixin
279
- };
280
-
281
- return exports;
282
- });
283
- _registerModule(_modules, 'Core/Axis/Color/ColorAxisComposition.js', [_modules['Core/Color/Color.js'], _modules['Mixins/ColorSeries.js'], _modules['Core/Utilities.js']], function (Color, ColorSeriesMixins, U) {
31
+ _registerModule(_modules, 'Core/Axis/Color/ColorAxisComposition.js', [_modules['Core/Color/Color.js'], _modules['Core/Utilities.js']], function (Color, U) {
284
32
  /* *
285
33
  *
286
34
  * (c) 2010-2021 Torstein Honsi
@@ -291,8 +39,6 @@
291
39
  *
292
40
  * */
293
41
  var color = Color.parse;
294
- var colorPointMixin = ColorSeriesMixins.colorPointMixin,
295
- colorSeriesMixin = ColorSeriesMixins.colorSeriesMixin;
296
42
  var addEvent = U.addEvent,
297
43
  extend = U.extend,
298
44
  merge = U.merge,
@@ -305,6 +51,11 @@
305
51
  * */
306
52
  var ColorAxisComposition;
307
53
  (function (ColorAxisComposition) {
54
+ /* *
55
+ *
56
+ * Declarations
57
+ *
58
+ * */
308
59
  /* *
309
60
  *
310
61
  * Constants
@@ -334,7 +85,9 @@
334
85
  composedClasses.push(ChartClass);
335
86
  var chartProto = ChartClass.prototype;
336
87
  chartProto.collectionsWithUpdate.push('colorAxis');
337
- chartProto.collectionsWithInit.colorAxis = [chartProto.addColorAxis];
88
+ chartProto.collectionsWithInit.colorAxis = [
89
+ chartProto.addColorAxis
90
+ ];
338
91
  addEvent(ChartClass, 'afterGetAxes', onChartAfterGetAxes);
339
92
  wrapChartCreateAxis(ChartClass);
340
93
  }
@@ -352,8 +105,13 @@
352
105
  }
353
106
  if (composedClasses.indexOf(SeriesClass) === -1) {
354
107
  composedClasses.push(SeriesClass);
355
- extend(SeriesClass.prototype, colorSeriesMixin);
356
- extend(SeriesClass.prototype.pointClass.prototype, colorPointMixin);
108
+ extend(SeriesClass.prototype, {
109
+ optionalAxis: 'colorAxis',
110
+ translateColors: seriesTranslateColors
111
+ });
112
+ extend(SeriesClass.prototype.pointClass.prototype, {
113
+ setVisible: pointSetVisible
114
+ });
357
115
  addEvent(SeriesClass, 'afterTranslate', onSeriesAfterTranslate);
358
116
  addEvent(SeriesClass, 'bindAxes', onSeriesBindAxes);
359
117
  }
@@ -473,6 +231,53 @@
473
231
  axisTypes.push('colorAxis');
474
232
  }
475
233
  }
234
+ /**
235
+ * Set the visibility of a single point
236
+ * @private
237
+ * @function Highcharts.colorPointMixin.setVisible
238
+ * @param {boolean} visible
239
+ */
240
+ function pointSetVisible(vis) {
241
+ var point = this,
242
+ method = vis ? 'show' : 'hide';
243
+ point.visible = point.options.visible = Boolean(vis);
244
+ // Show and hide associated elements
245
+ ['graphic', 'dataLabel'].forEach(function (key) {
246
+ if (point[key]) {
247
+ point[key][method]();
248
+ }
249
+ });
250
+ this.series.buildKDTree(); // rebuild kdtree #13195
251
+ }
252
+ ColorAxisComposition.pointSetVisible = pointSetVisible;
253
+ /**
254
+ * In choropleth maps, the color is a result of the value, so this needs
255
+ * translation too
256
+ * @private
257
+ * @function Highcharts.colorSeriesMixin.translateColors
258
+ */
259
+ function seriesTranslateColors() {
260
+ var series = this,
261
+ points = this.data.length ? this.data : this.points,
262
+ nullColor = this.options.nullColor,
263
+ colorAxis = this.colorAxis,
264
+ colorKey = this.colorKey;
265
+ points.forEach(function (point) {
266
+ var value = point.getNestedProperty(colorKey),
267
+ color = point.options.color || (point.isNull || point.value === null ?
268
+ nullColor :
269
+ (colorAxis && typeof value !== 'undefined') ?
270
+ colorAxis.toColor(value,
271
+ point) :
272
+ point.color || series.color);
273
+ if (color && point.color !== color) {
274
+ point.color = color;
275
+ if (series.options.legendType === 'point' && point.legendItem) {
276
+ series.chart.legend.colorizeItem(point, point.visible);
277
+ }
278
+ }
279
+ });
280
+ }
476
281
  /**
477
282
  * @private
478
283
  */
@@ -525,7 +330,7 @@
525
330
 
526
331
  return ColorAxisComposition;
527
332
  });
528
- _registerModule(_modules, 'Core/Axis/Color/ColorAxisDefaults.js', [_modules['Core/Color/Palette.js']], function (Palette) {
333
+ _registerModule(_modules, 'Core/Axis/Color/ColorAxisDefaults.js', [], function () {
529
334
  /* *
530
335
  *
531
336
  * (c) 2010-2021 Torstein Honsi
@@ -588,7 +393,8 @@
588
393
  * categories, crosshair, dateTimeLabelFormats, height, left,
589
394
  * lineWidth, linkedTo, maxZoom, minRange, minTickInterval,
590
395
  * offset, opposite, pane, plotBands, plotLines,
591
- * reversedStacks, showEmpty, title, top, width, zoomEnabled
396
+ * reversedStacks, scrollbar, showEmpty, title, top, width,
397
+ * zoomEnabled
592
398
  * @product highcharts highstock highmaps
593
399
  * @type {*|Array<*>}
594
400
  * @optionparent colorAxis
@@ -823,7 +629,7 @@
823
629
  * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
824
630
  * @product highcharts highstock highmaps
825
631
  */
826
- color: Palette.neutralColor40
632
+ color: "#999999" /* neutralColor40 */
827
633
  },
828
634
  /**
829
635
  * The axis labels show the number for each tick.
@@ -865,7 +671,7 @@
865
671
  * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
866
672
  * @product highcharts highstock highmaps
867
673
  */
868
- minColor: Palette.highlightColor10,
674
+ minColor: "#e6ebf5" /* highlightColor10 */,
869
675
  /**
870
676
  * The color to represent the maximum of the color axis. Unless
871
677
  * [dataClasses](#colorAxis.dataClasses) or
@@ -884,7 +690,7 @@
884
690
  * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
885
691
  * @product highcharts highstock highmaps
886
692
  */
887
- maxColor: Palette.highlightColor100,
693
+ maxColor: "#003399" /* highlightColor100 */,
888
694
  /**
889
695
  * Color stops for the gradient of a scalar color axis. Use this in
890
696
  * cases where a linear gradient between a `minColor` and `maxColor`
@@ -1026,7 +832,8 @@
1026
832
  var _this = _super.call(this,
1027
833
  chart,
1028
834
  userOptions) || this;
1029
- _this.beforePadding = false; // Prevents unnecessary padding with `hc-more`
835
+ // Prevents unnecessary padding with `hc-more`
836
+ _this.beforePadding = false;
1030
837
  _this.chart = void 0;
1031
838
  _this.coll = 'colorAxis';
1032
839
  _this.dataClasses = void 0;
@@ -1335,7 +1142,9 @@
1335
1142
  zIndex: 1
1336
1143
  }).add(item.legendGroup);
1337
1144
  // Set how much space this legend item takes up
1338
- axis.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding);
1145
+ axis.legendItemWidth = (width +
1146
+ padding +
1147
+ (horiz ? itemDistance : labelPadding));
1339
1148
  axis.legendItemHeight = height + padding + (horiz ? labelPadding : 0);
1340
1149
  };
1341
1150
  /**
@@ -1427,8 +1236,8 @@
1427
1236
  * @param {Highcharts.Point} [point]
1428
1237
  * The Point object if the crosshair snaps to points.
1429
1238
  *
1430
- * @fires Highcharts.ColorAxis#event:afterDrawCrosshair
1431
- * @fires Highcharts.ColorAxis#event:drawCrosshair
1239
+ * @emits Highcharts.ColorAxis#event:afterDrawCrosshair
1240
+ * @emits Highcharts.ColorAxis#event:drawCrosshair
1432
1241
  */
1433
1242
  ColorAxis.prototype.drawCrosshair = function (e, point) {
1434
1243
  var axis = this;
@@ -1665,89 +1474,6 @@
1665
1474
 
1666
1475
  return ColorAxis;
1667
1476
  });
1668
- _registerModule(_modules, 'Mixins/ColorMapSeries.js', [_modules['Core/Globals.js'], _modules['Core/Series/Point.js'], _modules['Core/Utilities.js']], function (H, Point, U) {
1669
- /* *
1670
- *
1671
- * (c) 2010-2021 Torstein Honsi
1672
- *
1673
- * License: www.highcharts.com/license
1674
- *
1675
- * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
1676
- *
1677
- * */
1678
- var defined = U.defined,
1679
- addEvent = U.addEvent;
1680
- var noop = H.noop,
1681
- seriesTypes = H.seriesTypes;
1682
- // Move points to the top of the z-index order when hovered
1683
- addEvent(Point, 'afterSetState', function (e) {
1684
- var point = this; // eslint-disable-line no-invalid-this
1685
- if (point.moveToTopOnHover && point.graphic) {
1686
- point.graphic.attr({
1687
- zIndex: e && e.state === 'hover' ? 1 : 0
1688
- });
1689
- }
1690
- });
1691
- /**
1692
- * Mixin for maps and heatmaps
1693
- *
1694
- * @private
1695
- * @mixin Highcharts.colorMapPointMixin
1696
- */
1697
- var colorMapPointMixin = {
1698
- dataLabelOnNull: true,
1699
- moveToTopOnHover: true,
1700
- /* eslint-disable valid-jsdoc */
1701
- /**
1702
- * Color points have a value option that determines whether or not it is
1703
- * a null point
1704
- * @private
1705
- */
1706
- isValid: function () {
1707
- // undefined is allowed
1708
- return (this.value !== null &&
1709
- this.value !== Infinity &&
1710
- this.value !== -Infinity);
1711
- }
1712
- /* eslint-enable valid-jsdoc */
1713
- };
1714
- /**
1715
- * @private
1716
- * @mixin Highcharts.colorMapSeriesMixin
1717
- */
1718
- var colorMapSeriesMixin = {
1719
- pointArrayMap: ['value'],
1720
- axisTypes: ['xAxis', 'yAxis', 'colorAxis'],
1721
- trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
1722
- getSymbol: noop,
1723
- parallelArrays: ['x', 'y', 'value'],
1724
- colorKey: 'value',
1725
- pointAttribs: seriesTypes.column.prototype.pointAttribs,
1726
- /* eslint-disable valid-jsdoc */
1727
- /**
1728
- * Get the color attibutes to apply on the graphic
1729
- * @private
1730
- * @function Highcharts.colorMapSeriesMixin.colorAttribs
1731
- * @param {Highcharts.Point} point
1732
- * @return {Highcharts.SVGAttributes}
1733
- */
1734
- colorAttribs: function (point) {
1735
- var ret = {};
1736
- if (defined(point.color) &&
1737
- (!point.state || point.state === 'normal') // #15746
1738
- ) {
1739
- ret[this.colorProp || 'fill'] = point.color;
1740
- }
1741
- return ret;
1742
- }
1743
- };
1744
- var exports = {
1745
- colorMapPointMixin: colorMapPointMixin,
1746
- colorMapSeriesMixin: colorMapSeriesMixin
1747
- };
1748
-
1749
- return exports;
1750
- });
1751
1477
  _registerModule(_modules, 'Maps/MapNavigationOptionsDefault.js', [_modules['Core/DefaultOptions.js'], _modules['Core/Utilities.js']], function (D, U) {
1752
1478
  /* *
1753
1479
  *
@@ -1765,6 +1491,9 @@
1765
1491
  *
1766
1492
  * */
1767
1493
  /**
1494
+ * The `mapNavigation` option handles buttons for navigation in addition to
1495
+ * mousewheel and doubleclick handlers for map zooming.
1496
+ *
1768
1497
  * @product highmaps
1769
1498
  * @optionparent mapNavigation
1770
1499
  */
@@ -2022,6 +1751,7 @@
2022
1751
  var doc = H.doc;
2023
1752
  var addEvent = U.addEvent,
2024
1753
  extend = U.extend,
1754
+ isNumber = U.isNumber,
2025
1755
  merge = U.merge,
2026
1756
  objectEach = U.objectEach,
2027
1757
  pick = U.pick;
@@ -2185,8 +1915,8 @@
2185
1915
  this.unbindMouseWheel = this.unbindMouseWheel || addEvent(chart.container, doc.onwheel !== void 0 ? 'wheel' : // Newer Firefox
2186
1916
  doc.onmousewheel !== void 0 ? 'mousewheel' :
2187
1917
  'DOMMouseScroll', function (e) {
2188
- // Prevent scrolling when the pointer is over the element
2189
- // with that class, for example anotation popup #12100.
1918
+ // Prevent scrolling when the pointer is over the element with
1919
+ // that class, for example anotation popup #12100.
2190
1920
  if (!chart.pointer.inClass(e.target, 'highcharts-no-mousewheel')) {
2191
1921
  chart.pointer.onContainerMouseWheel(e);
2192
1922
  // Issue #5011, returning false from non-jQuery event does
@@ -2245,9 +1975,11 @@
2245
1975
  return inner;
2246
1976
  },
2247
1977
  /**
2248
- * Highmaps only. Zoom in or out of the map. See also {@link Point#zoomTo}.
2249
- * See {@link Chart#fromLatLonToPoint} for how to get the `centerX` and
2250
- * `centerY` parameters for a geographic location.
1978
+ * Highcharts Maps only. Zoom in or out of the map. See also
1979
+ * {@link Point#zoomTo}. See {@link Chart#fromLatLonToPoint} for how to get
1980
+ * the `centerX` and `centerY` parameters for a geographic location.
1981
+ *
1982
+ * Deprecated as of v9.3 in favor of [MapView.zoomBy](https://api.highcharts.com/class-reference/Highcharts.MapView#zoomBy).
2251
1983
  *
2252
1984
  * @function Highcharts.Chart#mapZoom
2253
1985
  *
@@ -2256,92 +1988,36 @@
2256
1988
  * in to half the current view. 2 zooms to twice the current view. If
2257
1989
  * omitted, the zoom is reset.
2258
1990
  *
2259
- * @param {number} [centerX]
2260
- * The X axis position to center around if available space.
1991
+ * @param {number} [xProjected]
1992
+ * The projected x position to keep stationary when zooming, if
1993
+ * available space.
2261
1994
  *
2262
- * @param {number} [centerY]
2263
- * The Y axis position to center around if available space.
1995
+ * @param {number} [yProjected]
1996
+ * The projected y position to keep stationary when zooming, if
1997
+ * available space.
2264
1998
  *
2265
- * @param {number} [mouseX]
2266
- * Fix the zoom to this position if possible. This is used for
1999
+ * @param {number} [chartX]
2000
+ * Keep this chart position stationary if possible. This is used for
2267
2001
  * example in mousewheel events, where the area under the mouse
2268
2002
  * should be fixed as we zoom in.
2269
2003
  *
2270
- * @param {number} [mouseY]
2271
- * Fix the zoom to this position if possible.
2004
+ * @param {number} [chartY]
2005
+ * Keep this chart position stationary if possible.
2272
2006
  *
2273
- * @return {void}
2007
+ * @deprecated
2274
2008
  */
2275
- mapZoom: function (howMuch, centerXArg, centerYArg, mouseX, mouseY, animation) {
2276
- var chart = this,
2277
- xAxis = chart.xAxis[0],
2278
- xRange = xAxis.max - xAxis.min,
2279
- centerX = pick(centerXArg,
2280
- xAxis.min + xRange / 2),
2281
- newXRange = xRange * howMuch,
2282
- yAxis = chart.yAxis[0],
2283
- yRange = yAxis.max - yAxis.min,
2284
- centerY = pick(centerYArg,
2285
- yAxis.min + yRange / 2),
2286
- newYRange = yRange * howMuch,
2287
- fixToX = mouseX ? ((mouseX - xAxis.pos) / xAxis.len) : 0.5,
2288
- fixToY = mouseY ? ((mouseY - yAxis.pos) / yAxis.len) : 0.5,
2289
- newXMin = centerX - newXRange * fixToX,
2290
- newYMin = centerY - newYRange * fixToY,
2291
- newExt = chart.fitToBox({
2292
- x: newXMin,
2293
- y: newYMin,
2294
- width: newXRange,
2295
- height: newYRange
2296
- }, {
2297
- x: xAxis.dataMin,
2298
- y: yAxis.dataMin,
2299
- width: xAxis.dataMax - xAxis.dataMin,
2300
- height: yAxis.dataMax - yAxis.dataMin
2301
- }),
2302
- zoomOut = (newExt.x <= xAxis.dataMin &&
2303
- newExt.width >=
2304
- xAxis.dataMax - xAxis.dataMin &&
2305
- newExt.y <= yAxis.dataMin &&
2306
- newExt.height >= yAxis.dataMax - yAxis.dataMin);
2307
- // When mousewheel zooming, fix the point under the mouse
2308
- if (mouseX && xAxis.mapAxis) {
2309
- xAxis.mapAxis.fixTo = [mouseX - xAxis.pos, centerXArg];
2310
- }
2311
- if (mouseY && yAxis.mapAxis) {
2312
- yAxis.mapAxis.fixTo = [mouseY - yAxis.pos, centerYArg];
2313
- }
2314
- // Zoom
2315
- if (typeof howMuch !== 'undefined' && !zoomOut) {
2316
- xAxis.setExtremes(newExt.x, newExt.x + newExt.width, false);
2317
- yAxis.setExtremes(newExt.y, newExt.y + newExt.height, false);
2318
- // Reset zoom
2319
- }
2320
- else {
2321
- xAxis.setExtremes(void 0, void 0, false);
2322
- yAxis.setExtremes(void 0, void 0, false);
2323
- }
2324
- // Prevent zooming until this one is finished animating
2325
- /*
2326
- chart.holdMapZoom = true;
2327
- setTimeout(function () {
2328
- chart.holdMapZoom = false;
2329
- }, 200);
2330
- */
2331
- /*
2332
- delay = animation ? animation.duration || 500 : 0;
2333
- if (delay) {
2334
- chart.isMapZooming = true;
2335
- setTimeout(function () {
2336
- chart.isMapZooming = false;
2337
- if (chart.mapZoomQueue) {
2338
- chart.mapZoom.apply(chart, chart.mapZoomQueue);
2339
- }
2340
- chart.mapZoomQueue = null;
2341
- }, delay);
2009
+ mapZoom: function (howMuch, xProjected, yProjected, chartX, chartY) {
2010
+ if (this.mapView) {
2011
+ if (isNumber(howMuch)) {
2012
+ // Compliance, mapView.zoomBy uses different values
2013
+ howMuch = Math.log(howMuch) / Math.log(0.5);
2014
+ }
2015
+ this.mapView.zoomBy(howMuch, isNumber(xProjected) && isNumber(yProjected) ?
2016
+ this.mapView.projection.inverse([xProjected, yProjected]) :
2017
+ void 0, isNumber(chartX) && isNumber(chartY) ?
2018
+ [chartX, chartY] :
2019
+ void 0);
2342
2020
  }
2343
- */
2344
- chart.redraw(animation);
2345
2021
  }
2346
2022
  });
2347
2023
  // Extend the Chart.render method to add zooming and panning
@@ -2364,7 +2040,8 @@
2364
2040
  * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
2365
2041
  *
2366
2042
  * */
2367
- var extend = U.extend,
2043
+ var defined = U.defined,
2044
+ extend = U.extend,
2368
2045
  pick = U.pick,
2369
2046
  wrap = U.wrap;
2370
2047
  /* eslint-disable no-invalid-this */
@@ -2383,7 +2060,7 @@
2383
2060
  }
2384
2061
  }
2385
2062
  else if (chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
2386
- chart.mapZoom(0.5, chart.xAxis[0].toValue(e.chartX), chart.yAxis[0].toValue(e.chartY), e.chartX, e.chartY);
2063
+ chart.mapZoom(0.5, void 0, void 0, e.chartX, e.chartY);
2387
2064
  }
2388
2065
  },
2389
2066
  // The event handler for the mouse scroll event
@@ -2391,7 +2068,9 @@
2391
2068
  var chart = this.chart;
2392
2069
  e = this.normalize(e);
2393
2070
  // Firefox uses e.deltaY or e.detail, WebKit and IE uses wheelDelta
2394
- var delta = e.deltaY || e.detail || -(e.wheelDelta / 120);
2071
+ // try wheelDelta first #15656
2072
+ var delta = (defined(e.wheelDelta) && -e.wheelDelta / 120) ||
2073
+ e.deltaY || e.detail;
2395
2074
  // Wheel zooming on trackpads have different behaviours in Firefox vs
2396
2075
  // WebKit. In Firefox the delta increments in steps by 1, so it is not
2397
2076
  // distinguishable from true mouse wheel. Therefore we use this timer
@@ -2407,8 +2086,9 @@
2407
2086
  totalWheelDelta = 0;
2408
2087
  }, 50);
2409
2088
  }
2410
- if (totalWheelDelta < 10 && chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop)) {
2411
- chart.mapZoom(Math.pow(chart.options.mapNavigation.mouseWheelSensitivity, delta), chart.xAxis[0].toValue(e.chartX), chart.yAxis[0].toValue(e.chartY), e.chartX, e.chartY,
2089
+ if (totalWheelDelta < 10 && chart.isInsidePlot(e.chartX - chart.plotLeft, e.chartY - chart.plotTop) && chart.mapView) {
2090
+ chart.mapView.zoomBy((chart.options.mapNavigation.mouseWheelSensitivity -
2091
+ 1) * -delta, void 0, [e.chartX, e.chartY],
2412
2092
  // Delta less than 1 indicates stepless/trackpad zooming, avoid
2413
2093
  // animation delaying the zoom
2414
2094
  Math.abs(delta) < 1 ? false : void 0);
@@ -2436,7 +2116,7 @@
2436
2116
  });
2437
2117
 
2438
2118
  });
2439
- _registerModule(_modules, 'Maps/MapSymbols.js', [_modules['Core/Renderer/SVG/SVGRenderer.js']], function (SVGRenderer) {
2119
+ _registerModule(_modules, 'Series/ColorMapMixin.js', [_modules['Core/Globals.js'], _modules['Core/Series/Point.js'], _modules['Core/Utilities.js']], function (H, Point, U) {
2440
2120
  /* *
2441
2121
  *
2442
2122
  * (c) 2010-2021 Torstein Honsi
@@ -2446,12 +2126,1403 @@
2446
2126
  * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
2447
2127
  *
2448
2128
  * */
2449
- var symbols = SVGRenderer.prototype.symbols;
2450
- /* *
2451
- *
2452
- * Functions
2129
+ // @todo cleanup & reduction - consider composition
2130
+ var noop = H.noop,
2131
+ seriesTypes = H.seriesTypes;
2132
+ var defined = U.defined,
2133
+ addEvent = U.addEvent;
2134
+ // Move points to the top of the z-index order when hovered
2135
+ addEvent(Point, 'afterSetState', function (e) {
2136
+ var point = this;
2137
+ if (point.moveToTopOnHover && point.graphic) {
2138
+ point.graphic.attr({
2139
+ zIndex: e && e.state === 'hover' ? 1 : 0
2140
+ });
2141
+ }
2142
+ });
2143
+ /**
2144
+ * Mixin for maps and heatmaps
2453
2145
  *
2454
- * */
2146
+ * @private
2147
+ * @mixin Highcharts.colorMapPointMixin
2148
+ */
2149
+ var PointMixin = {
2150
+ dataLabelOnNull: true,
2151
+ moveToTopOnHover: true,
2152
+ /* eslint-disable valid-jsdoc */
2153
+ /**
2154
+ * Color points have a value option that determines whether or not it is
2155
+ * a null point
2156
+ * @private
2157
+ */
2158
+ isValid: function () {
2159
+ // undefined is allowed
2160
+ return (this.value !== null &&
2161
+ this.value !== Infinity &&
2162
+ this.value !== -Infinity);
2163
+ }
2164
+ /* eslint-enable valid-jsdoc */
2165
+ };
2166
+ /**
2167
+ * @private
2168
+ * @mixin Highcharts.colorMapSeriesMixin
2169
+ */
2170
+ var SeriesMixin = {
2171
+ pointArrayMap: ['value'],
2172
+ axisTypes: ['xAxis', 'yAxis', 'colorAxis'],
2173
+ trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
2174
+ getSymbol: noop,
2175
+ parallelArrays: ['x', 'y', 'value'],
2176
+ colorKey: 'value',
2177
+ pointAttribs: seriesTypes.column.prototype.pointAttribs,
2178
+ /* eslint-disable valid-jsdoc */
2179
+ /**
2180
+ * Get the color attibutes to apply on the graphic
2181
+ * @private
2182
+ * @function Highcharts.colorMapSeriesMixin.colorAttribs
2183
+ * @param {Highcharts.Point} point
2184
+ * @return {Highcharts.SVGAttributes}
2185
+ * The SVG attributes
2186
+ */
2187
+ colorAttribs: function (point) {
2188
+ var ret = {};
2189
+ if (defined(point.color) &&
2190
+ (!point.state || point.state === 'normal') // #15746
2191
+ ) {
2192
+ ret[this.colorProp || 'fill'] = point.color;
2193
+ }
2194
+ return ret;
2195
+ }
2196
+ };
2197
+ var ColorMapMixin = {
2198
+ PointMixin: PointMixin,
2199
+ SeriesMixin: SeriesMixin
2200
+ };
2201
+
2202
+ return ColorMapMixin;
2203
+ });
2204
+ _registerModule(_modules, 'Maps/MapViewOptionsDefault.js', [], function () {
2205
+ /* *
2206
+ *
2207
+ * (c) 2010-2021 Torstein Honsi
2208
+ *
2209
+ * License: www.highcharts.com/license
2210
+ *
2211
+ * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
2212
+ *
2213
+ * */
2214
+ /**
2215
+ * The `mapView` options control the initial view of the chart, and how
2216
+ * projection is set up for raw geoJSON maps (beta as of v9.3).
2217
+ *
2218
+ * To set the view dynamically after chart generation, see
2219
+ * [mapView.setView](/class-reference/Highcharts.MapView#setView).
2220
+ *
2221
+ * @since 9.3.0
2222
+ * @product highmaps
2223
+ * @optionparent mapView
2224
+ */
2225
+ var defaultOptions = {
2226
+ /**
2227
+ * The center of the map in terms of longitude and latitude. For
2228
+ * preprojected maps (like in Map Collection v1.x),
2229
+ the units are projected
2230
+ * x and y units.
2231
+ *
2232
+ * @default [0, 0]
2233
+ * @type {Highcharts.LonLatArray}
2234
+ *
2235
+ * @sample {highmaps} maps/mapview/center-zoom
2236
+ * Custom view of a world map
2237
+ * @sample {highmaps} maps/mapview/get-view
2238
+ * Report the current view of a preprojected map
2239
+ */
2240
+ center: [0, 0],
2241
+ /**
2242
+ * Prevents the end user from zooming too far in on the map. See
2243
+ * [zoom](#mapView.zoom).
2244
+ *
2245
+ * @type {number|undefined}
2246
+ *
2247
+ * @sample {highmaps} maps/mapview/maxzoom
2248
+ * Prevent zooming in too far
2249
+ */
2250
+ maxZoom: void 0,
2251
+ /**
2252
+ * The padding inside the plot area when auto fitting to the map bounds. A
2253
+ * number signifies pixels,
2254
+ and a percentage is relative to the plot area
2255
+ * size.
2256
+ *
2257
+ * @sample {highmaps} maps/chart/plotbackgroundcolor-color
2258
+ * Visible plot area and percentage padding
2259
+ */
2260
+ padding: 0,
2261
+ /**
2262
+ * Beta feature in v9.3. The projection options allow applying client side
2263
+ * projection to a map given in coordinates,
2264
+ typically from TopoJSON or
2265
+ * GeoJSON.
2266
+ *
2267
+ * Sub-options are:
2268
+ * * `name`,
2269
+ which as of v9.3 can be `EqualEarth`,
2270
+ * `LambertConformalConic`,
2271
+ `Miller`,
2272
+ `Orthographic` or `WebMercator`.
2273
+ * * `parallels`,
2274
+ the standard parallels for the LambertConformalConic
2275
+ * projection.
2276
+ * * `rotation`,
2277
+ a three-axis rotation of the globe prior to projection,
2278
+ * which in practice can be used for example to render a world map with the
2279
+ * Americas centered (`[90, 0]`),
2280
+ or to rotate an orthographic projection.
2281
+ *
2282
+ * @type {Object}
2283
+ * @sample {highmaps} maps/demo/topojson-projection
2284
+ * Orthographic projection
2285
+ */
2286
+ projection: void 0,
2287
+ /**
2288
+ * The zoom level of a map. Higher zoom levels means more zoomed in. An
2289
+ * increase of 1 zooms in to a quarter of the viewed area (half the width
2290
+ * and height). Defaults to fitting to the map bounds.
2291
+ *
2292
+ * In a `WebMercator` projection,
2293
+ a zoom level of 0 represents
2294
+ * the world in a 256x256 pixel square. This is a common concept for WMS
2295
+ * tiling software.
2296
+ *
2297
+ * @type {number|undefined}
2298
+ * @sample {highmaps} maps/mapview/center-zoom
2299
+ * Custom view of a world map
2300
+ * @sample {highmaps} maps/mapview/get-view
2301
+ * Report the current view of a preprojected map
2302
+ */
2303
+ zoom: void 0
2304
+ };
2305
+ /* *
2306
+ *
2307
+ * Default Export
2308
+ *
2309
+ * */
2310
+
2311
+ return defaultOptions;
2312
+ });
2313
+ _registerModule(_modules, 'Maps/Projections/LambertConformalConic.js', [], function () {
2314
+ /* *
2315
+ * Lambert Conformal Conic projection
2316
+ * */
2317
+ var sign = Math.sign ||
2318
+ (function (n) { return (n === 0 ? 0 : n > 0 ? 1 : -1); }),
2319
+ scale = 63.78137,
2320
+ deg2rad = Math.PI / 180,
2321
+ halfPI = Math.PI / 2,
2322
+ eps10 = 1e-6,
2323
+ tany = function (y) { return Math.tan((halfPI + y) / 2); };
2324
+ var n = 0,
2325
+ c = 0;
2326
+ var LambertConformalConic = {
2327
+ init: function (options) {
2328
+ var parallels = (options.parallels || [])
2329
+ .map(function (n) { return n * deg2rad; }),
2330
+ lat1 = parallels[0] || 0,
2331
+ lat2 = parallels[1] || lat1,
2332
+ cosLat1 = Math.cos(lat1);
2333
+ // Apply the global variables
2334
+ n = lat1 === lat2 ?
2335
+ Math.sin(lat1) :
2336
+ Math.log(cosLat1 / Math.cos(lat2)) / Math.log(tany(lat2) / tany(lat1));
2337
+ if (Math.abs(n) < 1e-10) {
2338
+ n = (sign(n) || 1) * 1e-10;
2339
+ }
2340
+ c = cosLat1 * Math.pow(tany(lat1), n) / n;
2341
+ },
2342
+ forward: function (lonLat) {
2343
+ var lon = lonLat[0] * deg2rad;
2344
+ var lat = lonLat[1] * deg2rad;
2345
+ if (c > 0) {
2346
+ if (lat < -halfPI + eps10) {
2347
+ lat = -halfPI + eps10;
2348
+ }
2349
+ }
2350
+ else {
2351
+ if (lat > halfPI - eps10) {
2352
+ lat = halfPI - eps10;
2353
+ }
2354
+ }
2355
+ var r = c / Math.pow(tany(lat),
2356
+ n);
2357
+ return [
2358
+ r * Math.sin(n * lon) * scale,
2359
+ (c - r * Math.cos(n * lon)) * scale
2360
+ ];
2361
+ },
2362
+ inverse: function (xy) {
2363
+ var x = xy[0] / scale,
2364
+ y = xy[1] / scale,
2365
+ cy = c - y,
2366
+ rho = sign(n) * Math.sqrt(x * x + cy * cy);
2367
+ var l = Math.atan2(x,
2368
+ Math.abs(cy)) * sign(cy);
2369
+ if (cy * n < 0) {
2370
+ l -= Math.PI * sign(x) * sign(cy);
2371
+ }
2372
+ return [
2373
+ (l / n) / deg2rad,
2374
+ (2 * Math.atan(Math.pow(c / rho, 1 / n)) - halfPI) / deg2rad
2375
+ ];
2376
+ }
2377
+ };
2378
+
2379
+ return LambertConformalConic;
2380
+ });
2381
+ _registerModule(_modules, 'Maps/Projections/EqualEarth.js', [], function () {
2382
+ /* *
2383
+ *
2384
+ * Equal Earth projection, an equal-area projection designed to minimize
2385
+ * distortion and remain pleasing to the eye.
2386
+ *
2387
+ * Invented by Bojan Šavrič, Bernhard Jenny, and Tom Patterson in 2018. It is
2388
+ * inspired by the widely used Robinson projection.
2389
+ *
2390
+ * */
2391
+ var A1 = 1.340264,
2392
+ A2 = -0.081106,
2393
+ A3 = 0.000893,
2394
+ A4 = 0.003796,
2395
+ M = Math.sqrt(3) / 2.0,
2396
+ scale = 74.03120656864502;
2397
+ var EqualEarth = {
2398
+ forward: function (lonLat) {
2399
+ var d = Math.PI / 180,
2400
+ paramLat = Math.asin(M * Math.sin(lonLat[1] * d)),
2401
+ paramLatSq = paramLat * paramLat,
2402
+ paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
2403
+ var x = lonLat[0] * d * Math.cos(paramLat) * scale / (M *
2404
+ (A1 +
2405
+ 3 * A2 * paramLatSq +
2406
+ paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)));
2407
+ var y = paramLat * scale * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq));
2408
+ return [x, y];
2409
+ },
2410
+ inverse: function (xy) {
2411
+ var x = xy[0] / scale,
2412
+ y = xy[1] / scale,
2413
+ d = 180 / Math.PI,
2414
+ epsilon = 1e-9,
2415
+ iterations = 12;
2416
+ var paramLat = y,
2417
+ paramLatSq,
2418
+ paramLatPow6,
2419
+ fy,
2420
+ fpy,
2421
+ dlat,
2422
+ i;
2423
+ for (i = 0; i < iterations; ++i) {
2424
+ paramLatSq = paramLat * paramLat;
2425
+ paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
2426
+ fy = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq)) - y;
2427
+ fpy = A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq);
2428
+ paramLat -= dlat = fy / fpy;
2429
+ if (Math.abs(dlat) < epsilon) {
2430
+ break;
2431
+ }
2432
+ }
2433
+ paramLatSq = paramLat * paramLat;
2434
+ paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;
2435
+ var lon = d * M * x * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)) / Math.cos(paramLat);
2436
+ var lat = d * Math.asin(Math.sin(paramLat) / M);
2437
+ return [lon, lat];
2438
+ }
2439
+ };
2440
+
2441
+ return EqualEarth;
2442
+ });
2443
+ _registerModule(_modules, 'Maps/Projections/Miller.js', [], function () {
2444
+ /* *
2445
+ * Miller projection
2446
+ * */
2447
+ var quarterPI = Math.PI / 4,
2448
+ deg2rad = Math.PI / 180,
2449
+ scale = 63.78137;
2450
+ var Miller = {
2451
+ forward: function (lonLat) { return [
2452
+ lonLat[0] * deg2rad * scale,
2453
+ 1.25 * scale * Math.log(Math.tan(quarterPI + 0.4 * lonLat[1] * deg2rad))
2454
+ ]; },
2455
+ inverse: function (xy) { return [
2456
+ (xy[0] / scale) / deg2rad,
2457
+ 2.5 * (Math.atan(Math.exp(0.8 * (xy[1] / scale))) - quarterPI) / deg2rad
2458
+ ]; }
2459
+ };
2460
+
2461
+ return Miller;
2462
+ });
2463
+ _registerModule(_modules, 'Maps/Projections/Orthographic.js', [], function () {
2464
+ /* *
2465
+ * Orthographic projection
2466
+ * */
2467
+ var deg2rad = Math.PI / 180,
2468
+ scale = 63.78460826781007;
2469
+ var Orthographic = {
2470
+ forward: function (lonLat) {
2471
+ var lonDeg = lonLat[0],
2472
+ latDeg = lonLat[1];
2473
+ if (lonDeg < -90 || lonDeg > 90) {
2474
+ return [NaN, NaN];
2475
+ }
2476
+ var lat = latDeg * deg2rad;
2477
+ return [
2478
+ Math.cos(lat) * Math.sin(lonDeg * deg2rad) * scale,
2479
+ Math.sin(lat) * scale
2480
+ ];
2481
+ },
2482
+ inverse: function (xy) {
2483
+ var x = xy[0] / scale,
2484
+ y = xy[1] / scale,
2485
+ z = Math.sqrt(x * x + y * y),
2486
+ c = Math.asin(z),
2487
+ cSin = Math.sin(c),
2488
+ cCos = Math.cos(c);
2489
+ return [
2490
+ Math.atan2(x * cSin, z * cCos) / deg2rad,
2491
+ Math.asin(z && y * cSin / z) / deg2rad
2492
+ ];
2493
+ }
2494
+ };
2495
+
2496
+ return Orthographic;
2497
+ });
2498
+ _registerModule(_modules, 'Maps/Projections/WebMercator.js', [], function () {
2499
+ /* *
2500
+ * Web Mercator projection, used for most online map tile services
2501
+ * */
2502
+ var maxLatitude = 85.0511287798, // The latitude that defines a square
2503
+ r = 63.78137,
2504
+ deg2rad = Math.PI / 180;
2505
+ var WebMercator = {
2506
+ forward: function (lonLat) {
2507
+ if (Math.abs(lonLat[1]) > maxLatitude) {
2508
+ return [NaN,
2509
+ NaN];
2510
+ }
2511
+ var sinLat = Math.sin(lonLat[1] * deg2rad);
2512
+ return [
2513
+ r * lonLat[0] * deg2rad,
2514
+ r * Math.log((1 + sinLat) / (1 - sinLat)) / 2
2515
+ ];
2516
+ },
2517
+ inverse: function (xy) { return [
2518
+ xy[0] / (r * deg2rad),
2519
+ (2 * Math.atan(Math.exp(xy[1] / r)) - (Math.PI / 2)) / deg2rad
2520
+ ]; },
2521
+ maxLatitude: maxLatitude
2522
+ };
2523
+
2524
+ return WebMercator;
2525
+ });
2526
+ _registerModule(_modules, 'Maps/Projections/ProjectionRegistry.js', [_modules['Maps/Projections/LambertConformalConic.js'], _modules['Maps/Projections/EqualEarth.js'], _modules['Maps/Projections/Miller.js'], _modules['Maps/Projections/Orthographic.js'], _modules['Maps/Projections/WebMercator.js']], function (LambertConformalConic, EqualEarth, Miller, Orthographic, WebMercator) {
2527
+ /* *
2528
+ *
2529
+ * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
2530
+ *
2531
+ * */
2532
+ var registry = {
2533
+ EqualEarth: EqualEarth,
2534
+ LambertConformalConic: LambertConformalConic,
2535
+ Miller: Miller,
2536
+ Orthographic: Orthographic,
2537
+ WebMercator: WebMercator
2538
+ };
2539
+
2540
+ return registry;
2541
+ });
2542
+ _registerModule(_modules, 'Maps/Projection.js', [_modules['Maps/Projections/ProjectionRegistry.js'], _modules['Core/Utilities.js']], function (registry, U) {
2543
+ /* *
2544
+ *
2545
+ * (c) 2021 Torstein Honsi
2546
+ *
2547
+ * License: www.highcharts.com/license
2548
+ *
2549
+ * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
2550
+ *
2551
+ * */
2552
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
2553
+ for (var s = 0,
2554
+ i = 0,
2555
+ il = arguments.length; i < il; i++) s += arguments[i].length;
2556
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
2557
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
2558
+ r[k] = a[j];
2559
+ return r;
2560
+ };
2561
+ var erase = U.erase;
2562
+ var deg2rad = Math.PI * 2 / 360;
2563
+ // Safe padding on either side of the antimeridian to avoid points being
2564
+ // projected to the wrong side of the plane
2565
+ var floatCorrection = 0.000001;
2566
+ // Keep longitude within -180 and 180. This is faster than using the modulo
2567
+ // operator, and preserves the distinction between -180 and 180.
2568
+ var wrapLon = function (lon) {
2569
+ // Replacing the if's with while would increase the range, but make it prone
2570
+ // to crashes on bad data
2571
+ if (lon < -180) {
2572
+ lon += 360;
2573
+ }
2574
+ if (lon > 180) {
2575
+ lon -= 360;
2576
+ }
2577
+ return lon;
2578
+ };
2579
+ var Projection = /** @class */ (function () {
2580
+ function Projection(options) {
2581
+ if (options === void 0) { options = {}; }
2582
+ // Whether the chart has points, lines or polygons given as coordinates
2583
+ // with positive up, as opposed to paths in the SVG plane with positive
2584
+ // down.
2585
+ this.hasCoordinates = false;
2586
+ // Whether the chart has true projection as opposed to pre-projected geojson
2587
+ // as in the legacy map collection.
2588
+ this.hasGeoProjection = false;
2589
+ this.maxLatitude = 90;
2590
+ this.options = options;
2591
+ var name = options.name,
2592
+ rotation = options.rotation;
2593
+ this.rotator = rotation ? this.getRotator(rotation) : void 0;
2594
+ this.def = name ? Projection.registry[name] : void 0;
2595
+ var _a = this,
2596
+ def = _a.def,
2597
+ rotator = _a.rotator;
2598
+ if (def) {
2599
+ if (def.init) {
2600
+ def.init(options);
2601
+ }
2602
+ this.maxLatitude = def.maxLatitude || 90;
2603
+ this.hasGeoProjection = true;
2604
+ }
2605
+ if (rotator && def) {
2606
+ this.forward = function (lonLat) {
2607
+ lonLat = rotator.forward(lonLat);
2608
+ return def.forward(lonLat);
2609
+ };
2610
+ this.inverse = function (xy) {
2611
+ var lonLat = def.inverse(xy);
2612
+ return rotator.inverse(lonLat);
2613
+ };
2614
+ }
2615
+ else if (def) {
2616
+ this.forward = def.forward;
2617
+ this.inverse = def.inverse;
2618
+ }
2619
+ else if (rotator) {
2620
+ this.forward = rotator.forward;
2621
+ this.inverse = rotator.inverse;
2622
+ }
2623
+ }
2624
+ // Add a projection definition to the registry, accessible by its `name`.
2625
+ Projection.add = function (name, definition) {
2626
+ Projection.registry[name] = definition;
2627
+ };
2628
+ // Calculate the great circle between two given coordinates
2629
+ Projection.greatCircle = function (point1, point2, inclusive) {
2630
+ var atan2 = Math.atan2,
2631
+ cos = Math.cos,
2632
+ sin = Math.sin,
2633
+ sqrt = Math.sqrt;
2634
+ var lat1 = point1[1] * deg2rad;
2635
+ var lon1 = point1[0] * deg2rad;
2636
+ var lat2 = point2[1] * deg2rad;
2637
+ var lon2 = point2[0] * deg2rad;
2638
+ var deltaLat = lat2 - lat1;
2639
+ var deltaLng = lon2 - lon1;
2640
+ var calcA = sin(deltaLat / 2) * sin(deltaLat / 2) +
2641
+ cos(lat1) * cos(lat2) * sin(deltaLng / 2) * sin(deltaLng / 2);
2642
+ var calcB = 2 * atan2(sqrt(calcA),
2643
+ sqrt(1 - calcA));
2644
+ var distance = calcB * 6371e3; // in meters
2645
+ var jumps = Math.round(distance / 500000); // 500 km each jump
2646
+ var lineString = [];
2647
+ if (inclusive) {
2648
+ lineString.push(point1);
2649
+ }
2650
+ if (jumps > 1) {
2651
+ var step = 1 / jumps;
2652
+ for (var fraction = step; fraction < 0.999; // Account for float errors
2653
+ fraction += step) {
2654
+ var A = sin((1 - fraction) * calcB) / sin(calcB);
2655
+ var B = sin(fraction * calcB) / sin(calcB);
2656
+ var x = A * cos(lat1) * cos(lon1) + B * cos(lat2) * cos(lon2);
2657
+ var y = A * cos(lat1) * sin(lon1) + B * cos(lat2) * sin(lon2);
2658
+ var z = A * sin(lat1) + B * sin(lat2);
2659
+ var lat3 = atan2(z,
2660
+ sqrt(x * x + y * y));
2661
+ var lon3 = atan2(y,
2662
+ x);
2663
+ lineString.push([lon3 / deg2rad, lat3 / deg2rad]);
2664
+ }
2665
+ }
2666
+ if (inclusive) {
2667
+ lineString.push(point2);
2668
+ }
2669
+ return lineString;
2670
+ };
2671
+ Projection.insertGreatCircles = function (poly) {
2672
+ var i = poly.length - 1;
2673
+ while (i--) {
2674
+ // Distance in degrees, either in lon or lat. Avoid heavy
2675
+ // calculation of true distance.
2676
+ var roughDistance = Math.max(Math.abs(poly[i][0] - poly[i + 1][0]),
2677
+ Math.abs(poly[i][1] - poly[i + 1][1]));
2678
+ if (roughDistance > 10) {
2679
+ var greatCircle = Projection.greatCircle(poly[i],
2680
+ poly[i + 1]);
2681
+ if (greatCircle.length) {
2682
+ poly.splice.apply(poly, __spreadArrays([i + 1, 0], greatCircle));
2683
+ }
2684
+ }
2685
+ }
2686
+ };
2687
+ Projection.toString = function (options) {
2688
+ var _a = options || {},
2689
+ name = _a.name,
2690
+ rotation = _a.rotation;
2691
+ return [name, rotation && rotation.join(',')].join(';');
2692
+ };
2693
+ /*
2694
+ * Take the rotation options and return the appropriate projection functions
2695
+ */
2696
+ Projection.prototype.getRotator = function (rotation) {
2697
+ var deltaLambda = rotation[0] * deg2rad,
2698
+ deltaPhi = (rotation[1] || 0) * deg2rad,
2699
+ deltaGamma = (rotation[2] || 0) * deg2rad;
2700
+ var cosDeltaPhi = Math.cos(deltaPhi),
2701
+ sinDeltaPhi = Math.sin(deltaPhi),
2702
+ cosDeltaGamma = Math.cos(deltaGamma),
2703
+ sinDeltaGamma = Math.sin(deltaGamma);
2704
+ if (deltaLambda === 0 && deltaPhi === 0 && deltaGamma === 0) {
2705
+ // Don't waste processing time
2706
+ return;
2707
+ }
2708
+ return {
2709
+ forward: function (lonLat) {
2710
+ // Lambda (lon) rotation
2711
+ var lon = lonLat[0] * deg2rad + deltaLambda;
2712
+ // Phi (lat) and gamma rotation
2713
+ var lat = lonLat[1] * deg2rad,
2714
+ cosLat = Math.cos(lat),
2715
+ x = Math.cos(lon) * cosLat,
2716
+ y = Math.sin(lon) * cosLat,
2717
+ sinLat = Math.sin(lat),
2718
+ k = sinLat * cosDeltaPhi + x * sinDeltaPhi;
2719
+ return [
2720
+ Math.atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - sinLat * sinDeltaPhi) / deg2rad,
2721
+ Math.asin(k * cosDeltaGamma + y * sinDeltaGamma) / deg2rad
2722
+ ];
2723
+ },
2724
+ inverse: function (rLonLat) {
2725
+ // Lambda (lon) unrotation
2726
+ var lon = rLonLat[0] * deg2rad;
2727
+ // Phi (lat) and gamma unrotation
2728
+ var lat = rLonLat[1] * deg2rad,
2729
+ cosLat = Math.cos(lat),
2730
+ x = Math.cos(lon) * cosLat,
2731
+ y = Math.sin(lon) * cosLat,
2732
+ sinLat = Math.sin(lat),
2733
+ k = sinLat * cosDeltaGamma - y * sinDeltaGamma;
2734
+ return [
2735
+ (Math.atan2(y * cosDeltaGamma + sinLat * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi) - deltaLambda) / deg2rad,
2736
+ Math.asin(k * cosDeltaPhi - x * sinDeltaPhi) / deg2rad
2737
+ ];
2738
+ }
2739
+ };
2740
+ };
2741
+ // Project a lonlat coordinate position to xy. Dynamically overridden when
2742
+ // projection is set.
2743
+ Projection.prototype.forward = function (lonLat) {
2744
+ return lonLat;
2745
+ };
2746
+ // Project an xy chart coordinate position to lonlat. Dynamically overridden
2747
+ // when projection is set.
2748
+ Projection.prototype.inverse = function (xy) {
2749
+ return xy;
2750
+ };
2751
+ Projection.prototype.clipOnAntimeridian = function (poly, isPolygon) {
2752
+ var antimeridian = 180;
2753
+ var intersections = [];
2754
+ var polygons = [poly];
2755
+ poly.forEach(function (lonLat, i) {
2756
+ var previousLonLat = poly[i - 1];
2757
+ if (!i) {
2758
+ if (!isPolygon) {
2759
+ return;
2760
+ }
2761
+ // Else, wrap to beginning
2762
+ previousLonLat = poly[poly.length - 1];
2763
+ }
2764
+ var lon1 = previousLonLat[0],
2765
+ lon2 = lonLat[0];
2766
+ if (
2767
+ // Both points, after rotating for antimeridian, are on the far
2768
+ // side of the Earth
2769
+ (lon1 < -90 || lon1 > 90) &&
2770
+ (lon2 < -90 || lon2 > 90) &&
2771
+ // ... and on either side of the plane
2772
+ (lon1 > 0) !== (lon2 > 0)) {
2773
+ // Interpolate to the intersection latitude
2774
+ var fraction = (antimeridian - previousLonLat[0]) /
2775
+ (lonLat[0] - previousLonLat[0]);
2776
+ var lat = previousLonLat[1] +
2777
+ fraction * (lonLat[1] - previousLonLat[1]);
2778
+ intersections.push({
2779
+ i: i,
2780
+ lat: lat,
2781
+ direction: lon1 < 0 ? 1 : -1,
2782
+ previousLonLat: previousLonLat,
2783
+ lonLat: lonLat
2784
+ });
2785
+ }
2786
+ });
2787
+ var polarIntersection;
2788
+ if (intersections.length) {
2789
+ if (isPolygon) {
2790
+ // Simplified use of the even-odd rule, if there is an odd
2791
+ // amount of intersections between the polygon and the
2792
+ // antimeridian, the pole is inside the polygon. Applies
2793
+ // primarily to Antarctica.
2794
+ if (intersections.length % 2 === 1) {
2795
+ polarIntersection = intersections.slice().sort(function (a, b) { return Math.abs(b.lat) - Math.abs(a.lat); })[0];
2796
+ erase(intersections, polarIntersection);
2797
+ }
2798
+ // Pull out slices of the polygon that is on the opposite side
2799
+ // of the antimeridian compared to the starting point
2800
+ var i = intersections.length - 2;
2801
+ while (i >= 0) {
2802
+ var index = intersections[i].i;
2803
+ var lonPlus = wrapLon(antimeridian +
2804
+ intersections[i].direction * floatCorrection);
2805
+ var lonMinus = wrapLon(antimeridian -
2806
+ intersections[i].direction * floatCorrection);
2807
+ var slice = poly.splice.apply(poly,
2808
+ __spreadArrays([index,
2809
+ intersections[i + 1].i - index],
2810
+ Projection.greatCircle([lonPlus,
2811
+ intersections[i].lat],
2812
+ [lonPlus,
2813
+ intersections[i + 1].lat],
2814
+ true)));
2815
+ // Add interpolated points close to the cut
2816
+ slice.push.apply(slice, Projection.greatCircle([lonMinus, intersections[i + 1].lat], [lonMinus, intersections[i].lat], true));
2817
+ polygons.push(slice);
2818
+ i -= 2;
2819
+ }
2820
+ // Insert dummy points close to the pole
2821
+ if (polarIntersection) {
2822
+ for (var i_1 = 0; i_1 < polygons.length; i_1++) {
2823
+ var poly_1 = polygons[i_1];
2824
+ var indexOf = poly_1.indexOf(polarIntersection.lonLat);
2825
+ if (indexOf > -1) {
2826
+ var polarLatitude = (polarIntersection.lat < 0 ? -1 : 1) *
2827
+ this.maxLatitude;
2828
+ var lon1 = wrapLon(antimeridian +
2829
+ polarIntersection.direction * floatCorrection);
2830
+ var lon2 = wrapLon(antimeridian -
2831
+ polarIntersection.direction * floatCorrection);
2832
+ var polarSegment = Projection.greatCircle([lon1,
2833
+ polarIntersection.lat],
2834
+ [lon1,
2835
+ polarLatitude],
2836
+ true).concat(Projection.greatCircle([lon2,
2837
+ polarLatitude],
2838
+ [lon2,
2839
+ polarIntersection.lat],
2840
+ true));
2841
+ poly_1.splice.apply(poly_1, __spreadArrays([indexOf,
2842
+ 0], polarSegment));
2843
+ break;
2844
+ }
2845
+ }
2846
+ }
2847
+ // Map lines, not closed
2848
+ }
2849
+ else {
2850
+ var i = intersections.length;
2851
+ while (i--) {
2852
+ var index = intersections[i].i;
2853
+ var slice = poly.splice(index,
2854
+ poly.length,
2855
+ // Add interpolated point close to the cut
2856
+ [
2857
+ wrapLon(antimeridian +
2858
+ intersections[i].direction * floatCorrection),
2859
+ intersections[i].lat
2860
+ ]);
2861
+ // Add interpolated point close to the cut
2862
+ slice.unshift([
2863
+ wrapLon(antimeridian -
2864
+ intersections[i].direction * floatCorrection),
2865
+ intersections[i].lat
2866
+ ]);
2867
+ polygons.push(slice);
2868
+ }
2869
+ }
2870
+ }
2871
+ // Insert great circles along the cuts
2872
+ /*
2873
+ if (isPolygon && polygons.length > 1 || polarIntersection) {
2874
+ polygons.forEach(Projection.insertGreatCircles);
2875
+ }
2876
+ */
2877
+ return polygons;
2878
+ };
2879
+ // Take a GeoJSON geometry and return a translated SVGPath
2880
+ Projection.prototype.path = function (geometry) {
2881
+ var _this = this;
2882
+ var _a = this,
2883
+ def = _a.def,
2884
+ rotator = _a.rotator;
2885
+ var antimeridian = 180;
2886
+ var path = [];
2887
+ var isPolygon = geometry.type === 'Polygon' ||
2888
+ geometry.type === 'MultiPolygon';
2889
+ // @todo: It doesn't really have to do with whether north is
2890
+ // positive. It depends on whether the coordinates are
2891
+ // pre-projected.
2892
+ var hasGeoProjection = this.hasGeoProjection;
2893
+ // @todo better test for when to do this
2894
+ var projectingToPlane = this.options.name !== 'Orthographic';
2895
+ // We need to rotate in a separate step before applying antimeridian
2896
+ // clipping
2897
+ var preclip = projectingToPlane ? rotator : void 0;
2898
+ var postclip = projectingToPlane ? (def || this) : this;
2899
+ var addToPath = function (polygon) {
2900
+ // Create a copy of the original coordinates. The copy applies a
2901
+ // correction of points close to the antimeridian in order to
2902
+ // prevent the points to be projected to the wrong side of the
2903
+ // plane. Float errors in topojson or in the projection may cause
2904
+ // that.
2905
+ var poly = polygon.map(function (lonLat) {
2906
+ if (projectingToPlane) {
2907
+ if (preclip) {
2908
+ lonLat = preclip.forward(lonLat);
2909
+ }
2910
+ var lon = lonLat[0];
2911
+ if (Math.abs(lon - antimeridian) < floatCorrection) {
2912
+ if (lon < antimeridian) {
2913
+ lon = antimeridian - floatCorrection;
2914
+ }
2915
+ else {
2916
+ lon = antimeridian + floatCorrection;
2917
+ }
2918
+ }
2919
+ lonLat = [lon, lonLat[1]];
2920
+ }
2921
+ return lonLat;
2922
+ });
2923
+ var polygons = [poly];
2924
+ if (hasGeoProjection) {
2925
+ // Insert great circles into long straight lines
2926
+ Projection.insertGreatCircles(poly);
2927
+ if (projectingToPlane) {
2928
+ polygons = _this.clipOnAntimeridian(poly, isPolygon);
2929
+ }
2930
+ }
2931
+ polygons.forEach(function (poly) {
2932
+ if (poly.length < 2) {
2933
+ return;
2934
+ }
2935
+ var movedTo = false;
2936
+ var firstValidLonLat;
2937
+ var lastValidLonLat;
2938
+ var gap = false;
2939
+ var pushToPath = function (point) {
2940
+ if (!movedTo) {
2941
+ path.push(['M',
2942
+ point[0],
2943
+ point[1]]);
2944
+ movedTo = true;
2945
+ }
2946
+ else {
2947
+ path.push(['L', point[0], point[1]]);
2948
+ }
2949
+ };
2950
+ for (var i = 0; i < poly.length; i++) {
2951
+ var lonLat = poly[i];
2952
+ var point = postclip.forward(lonLat);
2953
+ var valid = (!isNaN(point[0]) &&
2954
+ !isNaN(point[1]) &&
2955
+ (!hasGeoProjection ||
2956
+ // Limited projections like Web Mercator
2957
+ (lonLat[1] <= _this.maxLatitude &&
2958
+ lonLat[1] >= -_this.maxLatitude)));
2959
+ if (valid) {
2960
+ // In order to be able to interpolate if the first or
2961
+ // last point is invalid (on the far side of the globe
2962
+ // in an orthographic projection), we need to push the
2963
+ // first valid point to the end of the polygon.
2964
+ if (isPolygon && !firstValidLonLat) {
2965
+ firstValidLonLat = lonLat;
2966
+ poly.push(lonLat);
2967
+ }
2968
+ // When entering the first valid point after a gap of
2969
+ // invalid points, typically on the far side of the
2970
+ // globe in an orthographic projection.
2971
+ if (gap && lastValidLonLat) {
2972
+ // For areas, in an orthographic projection, the
2973
+ // great circle between two visible points will be
2974
+ // close to the horizon. A possible exception may be
2975
+ // when the two points are on opposite sides of the
2976
+ // globe. It that poses a problem, we may have to
2977
+ // rewrite this to use the small circle related to
2978
+ // the current lon0 and lat0.
2979
+ if (isPolygon && hasGeoProjection) {
2980
+ var greatCircle = Projection.greatCircle(lastValidLonLat,
2981
+ lonLat);
2982
+ greatCircle.forEach(function (lonLat) {
2983
+ return pushToPath(postclip.forward(lonLat));
2984
+ });
2985
+ // For lines, just jump over the gap
2986
+ }
2987
+ else {
2988
+ movedTo = false;
2989
+ }
2990
+ }
2991
+ pushToPath(point);
2992
+ lastValidLonLat = lonLat;
2993
+ gap = false;
2994
+ }
2995
+ else {
2996
+ gap = true;
2997
+ }
2998
+ }
2999
+ });
3000
+ };
3001
+ if (geometry.type === 'LineString') {
3002
+ addToPath(geometry.coordinates);
3003
+ }
3004
+ else if (geometry.type === 'MultiLineString') {
3005
+ geometry.coordinates.forEach(function (c) { return addToPath(c); });
3006
+ }
3007
+ else if (geometry.type === 'Polygon') {
3008
+ geometry.coordinates.forEach(function (c) { return addToPath(c); });
3009
+ if (path.length) {
3010
+ path.push(['Z']);
3011
+ }
3012
+ }
3013
+ else if (geometry.type === 'MultiPolygon') {
3014
+ geometry.coordinates.forEach(function (polygons) {
3015
+ polygons.forEach(function (c) { return addToPath(c); });
3016
+ });
3017
+ if (path.length) {
3018
+ path.push(['Z']);
3019
+ }
3020
+ }
3021
+ return path;
3022
+ };
3023
+ Projection.registry = registry;
3024
+ return Projection;
3025
+ }());
3026
+
3027
+ return Projection;
3028
+ });
3029
+ _registerModule(_modules, 'Maps/MapView.js', [_modules['Maps/MapViewOptionsDefault.js'], _modules['Maps/Projection.js'], _modules['Core/Utilities.js']], function (defaultOptions, Projection, U) {
3030
+ /* *
3031
+ *
3032
+ * (c) 2010-2020 Torstein Honsi
3033
+ *
3034
+ * License: www.highcharts.com/license
3035
+ *
3036
+ * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
3037
+ *
3038
+ * */
3039
+ var addEvent = U.addEvent,
3040
+ clamp = U.clamp,
3041
+ fireEvent = U.fireEvent,
3042
+ isNumber = U.isNumber,
3043
+ merge = U.merge,
3044
+ pick = U.pick,
3045
+ relativeLength = U.relativeLength;
3046
+ /**
3047
+ * The world size in terms of 10k meters in the Web Mercator projection, to
3048
+ * match a 256 square tile to zoom level 0
3049
+ */
3050
+ var worldSize = 400.979322;
3051
+ var tileSize = 256;
3052
+ /**
3053
+ * The map view handles zooming and centering on the map, and various
3054
+ * client-side projection capabilities.
3055
+ *
3056
+ * On a chart instance, the map view is available as `chart.mapView`.
3057
+ *
3058
+ * @class
3059
+ * @name Highcharts.MapView
3060
+ *
3061
+ * @param {Highcharts.Chart} chart
3062
+ * The Chart instance
3063
+ * @param {Highcharts.MapViewOptions} options
3064
+ * MapView options
3065
+ */
3066
+ var MapView = /** @class */ (function () {
3067
+ function MapView(chart, options) {
3068
+ var _this = this;
3069
+ this.userOptions = options || {};
3070
+ var o = merge(defaultOptions,
3071
+ options);
3072
+ this.chart = chart;
3073
+ /**
3074
+ * The current center of the view in terms of `[longitude, latitude]`.
3075
+ * @name Highcharts.MapView#center
3076
+ * @readonly
3077
+ * @type {LonLatArray}
3078
+ */
3079
+ this.center = o.center;
3080
+ this.options = o;
3081
+ this.projection = new Projection(o.projection);
3082
+ /**
3083
+ * The current zoom level of the view.
3084
+ * @name Highcharts.MapView#zoom
3085
+ * @readonly
3086
+ * @type {number}
3087
+ */
3088
+ this.zoom = o.zoom || 0;
3089
+ // Initialize and respond to chart size changes
3090
+ addEvent(chart, 'afterSetChartSize', function () {
3091
+ if (_this.minZoom === void 0 || // When initializing the chart
3092
+ _this.minZoom === _this.zoom // When resizing the chart
3093
+ ) {
3094
+ _this.fitToBounds(void 0, void 0, false);
3095
+ if (isNumber(_this.userOptions.zoom)) {
3096
+ _this.zoom = _this.userOptions.zoom;
3097
+ }
3098
+ if (_this.userOptions.center) {
3099
+ merge(true, _this.center, _this.userOptions.center);
3100
+ }
3101
+ }
3102
+ });
3103
+ // Set up panning for maps. In orthographic projections the globe will
3104
+ // rotate, otherwise adjust the map center.
3105
+ var mouseDownCenterProjected;
3106
+ var mouseDownKey;
3107
+ var mouseDownRotation;
3108
+ var onPan = function (e) {
3109
+ var pinchDown = chart.pointer.pinchDown;
3110
+ var mouseDownX = chart.mouseDownX,
3111
+ mouseDownY = chart.mouseDownY;
3112
+ if (pinchDown.length === 1) {
3113
+ mouseDownX = pinchDown[0].chartX;
3114
+ mouseDownY = pinchDown[0].chartY;
3115
+ }
3116
+ if (typeof mouseDownX === 'number' &&
3117
+ typeof mouseDownY === 'number') {
3118
+ var key = mouseDownX + "," + mouseDownY, _a = e.originalEvent, chartX = _a.chartX, chartY = _a.chartY;
3119
+ // Reset starting position
3120
+ if (key !== mouseDownKey) {
3121
+ mouseDownKey = key;
3122
+ mouseDownCenterProjected = _this.projection
3123
+ .forward(_this.center);
3124
+ mouseDownRotation = (_this.projection.options.rotation || [0, 0]).slice();
3125
+ }
3126
+ // Panning rotates the globe
3127
+ if (_this.projection.options.name === 'Orthographic' &&
3128
+ // ... but don't rotate if we're loading only a part of the
3129
+ // world
3130
+ (_this.minZoom || Infinity) < 3) {
3131
+ // Empirical ratio where the globe rotates roughly the same
3132
+ // speed as moving the pointer across the center of the
3133
+ // projection
3134
+ var ratio = 440 / (_this.getScale() * Math.min(chart.plotWidth,
3135
+ chart.plotHeight));
3136
+ if (mouseDownRotation) {
3137
+ var lon = (mouseDownX - chartX) * ratio -
3138
+ mouseDownRotation[0];
3139
+ var lat = clamp(-mouseDownRotation[1] -
3140
+ (mouseDownY - chartY) * ratio, -80, 80);
3141
+ _this.update({
3142
+ projection: {
3143
+ rotation: [-lon, -lat]
3144
+ },
3145
+ center: [lon, lat],
3146
+ zoom: _this.zoom
3147
+ }, true, false);
3148
+ }
3149
+ }
3150
+ else {
3151
+ var scale = _this.getScale();
3152
+ var newCenter = _this.projection.inverse([
3153
+ mouseDownCenterProjected[0] +
3154
+ (mouseDownX - chartX) / scale,
3155
+ mouseDownCenterProjected[1] -
3156
+ (mouseDownY - chartY) / scale
3157
+ ]);
3158
+ _this.setView(newCenter, void 0, true, false);
3159
+ }
3160
+ e.preventDefault();
3161
+ }
3162
+ };
3163
+ addEvent(chart, 'pan', onPan);
3164
+ addEvent(chart, 'touchpan', onPan);
3165
+ // Perform the map zoom by selection
3166
+ addEvent(chart, 'selection', function (evt) {
3167
+ // Zoom in
3168
+ if (!evt.resetSelection) {
3169
+ var x = evt.x - chart.plotLeft;
3170
+ var y = evt.y - chart.plotTop;
3171
+ var _a = _this.pixelsToProjectedUnits({ x: x,
3172
+ y: y }),
3173
+ y1 = _a.y,
3174
+ x1 = _a.x;
3175
+ var _b = _this.pixelsToProjectedUnits({ x: x + evt.width,
3176
+ y: y + evt.height }),
3177
+ y2 = _b.y,
3178
+ x2 = _b.x;
3179
+ _this.fitToBounds({ x1: x1, y1: y1, x2: x2, y2: y2 }, void 0, true, evt.originalEvent.touches ?
3180
+ // On touch zoom, don't animate, since we're already in
3181
+ // transformed zoom preview
3182
+ false :
3183
+ // On mouse zoom, obey the chart-level animation
3184
+ void 0);
3185
+ // Only for mouse. Touch users can pinch out.
3186
+ if (!/^touch/.test((evt.originalEvent.type))) {
3187
+ chart.showResetZoom();
3188
+ }
3189
+ evt.preventDefault();
3190
+ // Reset zoom
3191
+ }
3192
+ else {
3193
+ _this.zoomBy();
3194
+ }
3195
+ });
3196
+ }
3197
+ /**
3198
+ * Fit the view to given bounds
3199
+ *
3200
+ * @function Highcharts.MapView#fitToBounds
3201
+ * @param {Object} bounds
3202
+ * Bounds in terms of projected units given as `{ x1, y1, x2, y2 }`.
3203
+ * If not set, fit to the bounds of the current data set
3204
+ * @param {number|string} [padding=0]
3205
+ * Padding inside the bounds. A number signifies pixels, while a
3206
+ * percentage string (like `5%`) can be used as a fraction of the
3207
+ * plot area size.
3208
+ * @param {boolean} [redraw=true]
3209
+ * Whether to redraw the chart immediately
3210
+ * @param {boolean|Partial<Highcharts.AnimationOptionsObject>} [animation]
3211
+ * What animation to use for redraw
3212
+ */
3213
+ MapView.prototype.fitToBounds = function (bounds, padding, redraw, animation) {
3214
+ if (redraw === void 0) { redraw = true; }
3215
+ var b = bounds || this.getProjectedBounds();
3216
+ if (b) {
3217
+ var _a = this.chart,
3218
+ plotWidth = _a.plotWidth,
3219
+ plotHeight = _a.plotHeight,
3220
+ pad = pick(padding,
3221
+ bounds ? 0 : this.options.padding),
3222
+ paddingX = relativeLength(pad,
3223
+ plotWidth),
3224
+ paddingY = relativeLength(pad,
3225
+ plotHeight);
3226
+ var scaleToPlotArea = Math.max((b.x2 - b.x1) / ((plotWidth - paddingX) / tileSize), (b.y2 - b.y1) / ((plotHeight - paddingY) / tileSize));
3227
+ var zoom = Math.log(worldSize / scaleToPlotArea) / Math.log(2);
3228
+ // Reset minZoom when fitting to natural bounds
3229
+ if (!bounds) {
3230
+ this.minZoom = zoom;
3231
+ }
3232
+ var center = this.projection.inverse([
3233
+ (b.x2 + b.x1) / 2,
3234
+ (b.y2 + b.y1) / 2
3235
+ ]);
3236
+ this.setView(center, zoom, redraw, animation);
3237
+ }
3238
+ };
3239
+ MapView.prototype.getProjectedBounds = function () {
3240
+ var allBounds = this.chart.series.reduce(function (acc,
3241
+ s) {
3242
+ var bounds = s.getProjectedBounds && s.getProjectedBounds();
3243
+ if (bounds) {
3244
+ acc.push(bounds);
3245
+ }
3246
+ return acc;
3247
+ }, []);
3248
+ return MapView.compositeBounds(allBounds);
3249
+ };
3250
+ MapView.prototype.getScale = function () {
3251
+ // A zoom of 0 means the world (360x360 degrees) fits in a 256x256 px
3252
+ // tile
3253
+ return (tileSize / worldSize) * Math.pow(2, this.zoom);
3254
+ };
3255
+ MapView.prototype.redraw = function (animation) {
3256
+ this.chart.series.forEach(function (s) {
3257
+ if (s.useMapGeometry) {
3258
+ s.isDirty = true;
3259
+ }
3260
+ });
3261
+ this.chart.redraw(animation);
3262
+ };
3263
+ /**
3264
+ * Set the view to given center and zoom values.
3265
+ * @function Highcharts.MapView#setView
3266
+ * @param {Highcharts.LonLatArray|undefined} center
3267
+ * The center point
3268
+ * @param {number} zoom
3269
+ * The zoom level
3270
+ * @param {boolean} [redraw=true]
3271
+ * Whether to redraw immediately
3272
+ * @param {boolean|Partial<Highcharts.AnimationOptionsObject>} [animation]
3273
+ * Animation options for the redraw
3274
+ *
3275
+ * @sample maps/mapview/setview
3276
+ * Set the view programmatically
3277
+ */
3278
+ MapView.prototype.setView = function (center, zoom, redraw, animation) {
3279
+ if (redraw === void 0) { redraw = true; }
3280
+ var zoomingIn = false;
3281
+ if (center) {
3282
+ this.center = center;
3283
+ }
3284
+ if (typeof zoom === 'number') {
3285
+ if (typeof this.minZoom === 'number') {
3286
+ zoom = Math.max(zoom, this.minZoom);
3287
+ }
3288
+ if (typeof this.options.maxZoom === 'number') {
3289
+ zoom = Math.min(zoom, this.options.maxZoom);
3290
+ }
3291
+ zoomingIn = zoom > this.zoom;
3292
+ this.zoom = zoom;
3293
+ }
3294
+ // Stay within the data bounds
3295
+ var bounds = this.getProjectedBounds();
3296
+ if (bounds &&
3297
+ // When zooming in, we don't need to adjust to the bounds, as that
3298
+ // could shift the location under the mouse
3299
+ !zoomingIn) {
3300
+ var projectedCenter = this.projection.forward(this.center);
3301
+ var _a = this.chart,
3302
+ plotWidth = _a.plotWidth,
3303
+ plotHeight = _a.plotHeight;
3304
+ var scale = this.getScale();
3305
+ var bottomLeft = this.projectedUnitsToPixels({
3306
+ x: bounds.x1,
3307
+ y: bounds.y1
3308
+ });
3309
+ var topRight = this.projectedUnitsToPixels({
3310
+ x: bounds.x2,
3311
+ y: bounds.y2
3312
+ });
3313
+ var boundsCenterProjected = [
3314
+ (bounds.x1 + bounds.x2) / 2,
3315
+ (bounds.y1 + bounds.y2) / 2
3316
+ ];
3317
+ // Pixel coordinate system is reversed vs projected
3318
+ var x1 = bottomLeft.x;
3319
+ var y1 = topRight.y;
3320
+ var x2 = topRight.x;
3321
+ var y2 = bottomLeft.y;
3322
+ // Map smaller than plot area, center it
3323
+ if (x2 - x1 < plotWidth) {
3324
+ projectedCenter[0] = boundsCenterProjected[0];
3325
+ // Off west
3326
+ }
3327
+ else if (x1 < 0 && x2 < plotWidth) {
3328
+ // Adjust eastwards
3329
+ projectedCenter[0] += Math.max(x1, x2 - plotWidth) / scale;
3330
+ // Off east
3331
+ }
3332
+ else if (x2 > plotWidth && x1 > 0) {
3333
+ // Adjust westwards
3334
+ projectedCenter[0] += Math.min(x2 - plotWidth, x1) / scale;
3335
+ }
3336
+ // Map smaller than plot area, center it
3337
+ if (y2 - y1 < plotHeight) {
3338
+ projectedCenter[1] = boundsCenterProjected[1];
3339
+ // Off north
3340
+ }
3341
+ else if (y1 < 0 && y2 < plotHeight) {
3342
+ // Adjust southwards
3343
+ projectedCenter[1] -= Math.max(y1, y2 - plotHeight) / scale;
3344
+ // Off south
3345
+ }
3346
+ else if (y2 > plotHeight && y1 > 0) {
3347
+ // Adjust northwards
3348
+ projectedCenter[1] -= Math.min(y2 - plotHeight, y1) / scale;
3349
+ }
3350
+ this.center = this.projection.inverse(projectedCenter);
3351
+ }
3352
+ fireEvent(this, 'afterSetView');
3353
+ if (redraw) {
3354
+ this.redraw(animation);
3355
+ }
3356
+ };
3357
+ /**
3358
+ * Convert projected units to pixel position
3359
+ *
3360
+ * @function Highcharts.MapView#projectedUnitsToPixels
3361
+ * @param {Highcharts.PositionObject} pos
3362
+ * The position in projected units
3363
+ * @return {Highcharts.PositionObject} The position in pixels
3364
+ */
3365
+ MapView.prototype.projectedUnitsToPixels = function (pos) {
3366
+ var scale = this.getScale();
3367
+ var projectedCenter = this.projection.forward(this.center);
3368
+ var centerPxX = this.chart.plotWidth / 2;
3369
+ var centerPxY = this.chart.plotHeight / 2;
3370
+ var x = centerPxX - scale * (projectedCenter[0] - pos.x);
3371
+ var y = centerPxY + scale * (projectedCenter[1] - pos.y);
3372
+ return { x: x, y: y };
3373
+ };
3374
+ /**
3375
+ * Convert pixel position to projected units
3376
+ *
3377
+ * @function Highcharts.MapView#pixelsToProjectedUnits
3378
+ * @param {Highcharts.PositionObject} pos
3379
+ * The position in pixels
3380
+ * @return {Highcharts.PositionObject} The position in projected units
3381
+ */
3382
+ MapView.prototype.pixelsToProjectedUnits = function (pos) {
3383
+ var x = pos.x,
3384
+ y = pos.y;
3385
+ var scale = this.getScale();
3386
+ var projectedCenter = this.projection.forward(this.center);
3387
+ var centerPxX = this.chart.plotWidth / 2;
3388
+ var centerPxY = this.chart.plotHeight / 2;
3389
+ var projectedX = projectedCenter[0] + (x - centerPxX) / scale;
3390
+ var projectedY = projectedCenter[1] - (y - centerPxY) / scale;
3391
+ return { x: projectedX, y: projectedY };
3392
+ };
3393
+ /**
3394
+ * Update the view with given options
3395
+ *
3396
+ * @function Highcharts.MapView#update
3397
+ *
3398
+ * @param {Partial<Highcharts.MapViewOptions>} options
3399
+ * The new map view options to apply
3400
+ * @param {boolean} [redraw=true]
3401
+ * Whether to redraw immediately
3402
+ * @param {boolean|Partial<Highcharts.AnimationOptionsObject>} [animation]
3403
+ * The animation to apply to a the redraw
3404
+ */
3405
+ MapView.prototype.update = function (options, redraw, animation) {
3406
+ if (redraw === void 0) { redraw = true; }
3407
+ var newProjection = options.projection;
3408
+ var isDirtyProjection = newProjection && ((Projection.toString(newProjection) !==
3409
+ Projection.toString(this.options.projection)));
3410
+ merge(true, this.userOptions, options);
3411
+ merge(true, this.options, options);
3412
+ if (isDirtyProjection) {
3413
+ this.chart.series.forEach(function (series) {
3414
+ if (series.clearBounds) {
3415
+ series.clearBounds();
3416
+ }
3417
+ series.isDirty = true;
3418
+ series.isDirtyData = true;
3419
+ });
3420
+ this.projection = new Projection(this.options.projection);
3421
+ // Fit to natural bounds if center/zoom are not explicitly given
3422
+ if (!options.center && !isNumber(options.zoom)) {
3423
+ this.fitToBounds(void 0, void 0, false);
3424
+ }
3425
+ }
3426
+ if (options.center || isNumber(options.zoom)) {
3427
+ this.setView(this.options.center, options.zoom, false);
3428
+ }
3429
+ if (redraw) {
3430
+ this.chart.redraw(animation);
3431
+ }
3432
+ };
3433
+ /**
3434
+ * Zoom the map view by a given number
3435
+ *
3436
+ * @function Highcharts.MapView#zoomBy
3437
+ *
3438
+ * @param {number|undefined} [howMuch]
3439
+ * The amount of zoom to apply. 1 zooms in on half the current view,
3440
+ * -1 zooms out. Pass `undefined` to zoom to the full bounds of the
3441
+ * map.
3442
+ * @param {Highcharts.LonLatArray} [coords]
3443
+ * Optional map coordinates to keep fixed
3444
+ * @param {Array<number>} [chartCoords]
3445
+ * Optional chart coordinates to keep fixed, in pixels
3446
+ * @param {boolean|Partial<Highcharts.AnimationOptionsObject>} [animation]
3447
+ * The animation to apply to a the redraw
3448
+ */
3449
+ MapView.prototype.zoomBy = function (howMuch, coords, chartCoords, animation) {
3450
+ var chart = this.chart;
3451
+ var projectedCenter = this.projection.forward(this.center);
3452
+ // let { x, y } = coords || {};
3453
+ var _a = coords ? this.projection.forward(coords) : [],
3454
+ x = _a[0],
3455
+ y = _a[1];
3456
+ if (typeof howMuch === 'number') {
3457
+ var zoom = this.zoom + howMuch;
3458
+ var center = void 0;
3459
+ // Keep chartX and chartY stationary - convert to lat and lng
3460
+ if (chartCoords) {
3461
+ var chartX = chartCoords[0],
3462
+ chartY = chartCoords[1];
3463
+ var scale = this.getScale();
3464
+ var offsetX = chartX - chart.plotLeft - chart.plotWidth / 2;
3465
+ var offsetY = chartY - chart.plotTop - chart.plotHeight / 2;
3466
+ x = projectedCenter[0] + offsetX / scale;
3467
+ y = projectedCenter[1] + offsetY / scale;
3468
+ }
3469
+ // Keep lon and lat stationary by adjusting the center
3470
+ if (typeof x === 'number' && typeof y === 'number') {
3471
+ var scale = 1 - Math.pow(2,
3472
+ this.zoom) / Math.pow(2,
3473
+ zoom);
3474
+ // const projectedCenter = this.projection.forward(this.center);
3475
+ var offsetX = projectedCenter[0] - x;
3476
+ var offsetY = projectedCenter[1] - y;
3477
+ projectedCenter[0] -= offsetX * scale;
3478
+ projectedCenter[1] += offsetY * scale;
3479
+ center = this.projection.inverse(projectedCenter);
3480
+ }
3481
+ this.setView(center, zoom, void 0, animation);
3482
+ // Undefined howMuch => reset zoom
3483
+ }
3484
+ else {
3485
+ this.fitToBounds(void 0, void 0, void 0, animation);
3486
+ }
3487
+ };
3488
+ /* *
3489
+ * Return the composite bounding box of a collection of bounding boxes
3490
+ */
3491
+ MapView.compositeBounds = function (arrayOfBounds) {
3492
+ if (arrayOfBounds.length) {
3493
+ return arrayOfBounds
3494
+ .slice(1)
3495
+ .reduce(function (acc, cur) {
3496
+ acc.x1 = Math.min(acc.x1, cur.x1);
3497
+ acc.y1 = Math.min(acc.y1, cur.y1);
3498
+ acc.x2 = Math.max(acc.x2, cur.x2);
3499
+ acc.y2 = Math.max(acc.y2, cur.y2);
3500
+ return acc;
3501
+ }, merge(arrayOfBounds[0]));
3502
+ }
3503
+ return;
3504
+ };
3505
+ return MapView;
3506
+ }());
3507
+
3508
+ return MapView;
3509
+ });
3510
+ _registerModule(_modules, 'Maps/MapSymbols.js', [_modules['Core/Renderer/SVG/SVGRenderer.js']], function (SVGRenderer) {
3511
+ /* *
3512
+ *
3513
+ * (c) 2010-2021 Torstein Honsi
3514
+ *
3515
+ * License: www.highcharts.com/license
3516
+ *
3517
+ * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
3518
+ *
3519
+ * */
3520
+ var symbols = SVGRenderer.prototype.symbols;
3521
+ /* *
3522
+ *
3523
+ * Functions
3524
+ *
3525
+ * */
2455
3526
  /* eslint-disable require-jsdoc, valid-jsdoc */
2456
3527
  function bottomButton(x, y, w, h, options) {
2457
3528
  var r = (options && options.r) || 0;
@@ -2467,15 +3538,35 @@
2467
3538
  // top side
2468
3539
  ['L', x + w - rTopRight, y],
2469
3540
  // top right corner
2470
- ['C', x + w - rTopRight / 2, y, x + w, y + rTopRight / 2, x + w, y + rTopRight],
3541
+ [
3542
+ 'C',
3543
+ x + w - rTopRight / 2,
3544
+ y,
3545
+ x + w,
3546
+ y + rTopRight / 2,
3547
+ x + w,
3548
+ y + rTopRight
3549
+ ],
2471
3550
  // right side
2472
3551
  ['L', x + w, y + h - rBottomRight],
2473
3552
  // bottom right corner
2474
- ['C', x + w, y + h - rBottomRight / 2, x + w - rBottomRight / 2, y + h, x + w - rBottomRight, y + h],
3553
+ [
3554
+ 'C', x + w, y + h - rBottomRight / 2,
3555
+ x + w - rBottomRight / 2, y + h,
3556
+ x + w - rBottomRight, y + h
3557
+ ],
2475
3558
  // bottom side
2476
3559
  ['L', x + rBottomLeft, y + h],
2477
3560
  // bottom left corner
2478
- ['C', x + rBottomLeft / 2, y + h, x, y + h - rBottomLeft / 2, x, y + h - rBottomLeft],
3561
+ [
3562
+ 'C',
3563
+ x + rBottomLeft / 2,
3564
+ y + h,
3565
+ x,
3566
+ y + h - rBottomLeft / 2,
3567
+ x,
3568
+ y + h - rBottomLeft
3569
+ ],
2479
3570
  // left side
2480
3571
  ['L', x, y + rTopLeft],
2481
3572
  // top left corner
@@ -2497,7 +3588,7 @@
2497
3588
 
2498
3589
  return symbols;
2499
3590
  });
2500
- _registerModule(_modules, 'Core/Chart/MapChart.js', [_modules['Core/Chart/Chart.js'], _modules['Core/DefaultOptions.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (Chart, D, SVGRenderer, U) {
3591
+ _registerModule(_modules, 'Core/Chart/MapChart.js', [_modules['Core/Chart/Chart.js'], _modules['Core/DefaultOptions.js'], _modules['Maps/MapView.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (Chart, D, MapView, SVGRenderer, U) {
2501
3592
  /* *
2502
3593
  *
2503
3594
  * (c) 2010-2021 Torstein Honsi
@@ -2524,7 +3615,10 @@
2524
3615
  };
2525
3616
  })();
2526
3617
  var getOptions = D.getOptions;
2527
- var merge = U.merge,
3618
+ var addEvent = U.addEvent,
3619
+ clamp = U.clamp,
3620
+ isNumber = U.isNumber,
3621
+ merge = U.merge,
2528
3622
  pick = U.pick;
2529
3623
  /**
2530
3624
  * Map-optimized chart. Use {@link Highcharts.Chart|Chart} for common charts.
@@ -2553,25 +3647,16 @@
2553
3647
  * Function to run when the chart has loaded and and all external
2554
3648
  * images are loaded.
2555
3649
  *
2556
- * @return {void}
2557
3650
  *
2558
- * @fires Highcharts.MapChart#event:init
2559
- * @fires Highcharts.MapChart#event:afterInit
3651
+ * @emits Highcharts.MapChart#event:init
3652
+ * @emits Highcharts.MapChart#event:afterInit
2560
3653
  */
2561
3654
  MapChart.prototype.init = function (userOptions, callback) {
2562
- var hiddenAxis = {
2563
- endOnTick: false,
2564
- visible: false,
2565
- minPadding: 0,
2566
- maxPadding: 0,
2567
- startOnTick: false
2568
- },
2569
- defaultCreditsOptions = getOptions().credits;
2570
- /* For visual testing
2571
- hiddenAxis.gridLineWidth = 1;
2572
- hiddenAxis.gridZIndex = 10;
2573
- hiddenAxis.tickPositions = undefined;
2574
- // */
3655
+ // Initialize the MapView after initialization, but before firstRender
3656
+ addEvent(this, 'afterInit', function () {
3657
+ this.mapView = new MapView(this, this.options.mapView);
3658
+ });
3659
+ var defaultCreditsOptions = getOptions().credits;
2575
3660
  var options = merge({
2576
3661
  chart: {
2577
3662
  panning: {
@@ -2585,19 +3670,13 @@
2585
3670
  '{geojson.copyrightShort}</a>'),
2586
3671
  mapTextFull: pick(defaultCreditsOptions.mapTextFull, '{geojson.copyright}')
2587
3672
  },
3673
+ mapView: {},
2588
3674
  tooltip: {
2589
3675
  followTouchMove: false
2590
- },
2591
- xAxis: hiddenAxis,
2592
- yAxis: merge(hiddenAxis, { reversed: true })
2593
- },
2594
- userOptions, // user's options
2595
- {
2596
- chart: {
2597
- inverted: false,
2598
- alignTicks: false
2599
3676
  }
2600
- });
3677
+ },
3678
+ userOptions // user's options
3679
+ );
2601
3680
  _super.prototype.init.call(this, options, callback);
2602
3681
  };
2603
3682
  return MapChart;
@@ -2656,6 +3735,7 @@
2656
3735
  * @param {string|Array<string|number>} path
2657
3736
  *
2658
3737
  * @return {Highcharts.SVGPathArray}
3738
+ * Splitted SVG path
2659
3739
  */
2660
3740
  function splitPath(path) {
2661
3741
  var arr;
@@ -2691,7 +3771,7 @@
2691
3771
 
2692
3772
  return MapChart;
2693
3773
  });
2694
- _registerModule(_modules, 'Series/Map/MapPoint.js', [_modules['Mixins/ColorMapSeries.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (ColorMapMixin, SeriesRegistry, U) {
3774
+ _registerModule(_modules, 'Series/Map/MapPoint.js', [_modules['Series/ColorMapMixin.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (ColorMapMixin, SeriesRegistry, U) {
2695
3775
  /* *
2696
3776
  *
2697
3777
  * (c) 2010-2021 Torstein Honsi
@@ -2717,7 +3797,6 @@
2717
3797
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2718
3798
  };
2719
3799
  })();
2720
- var colorMapPointMixin = ColorMapMixin.colorMapPointMixin;
2721
3800
  var ScatterSeries = SeriesRegistry.seriesTypes.scatter;
2722
3801
  var extend = U.extend;
2723
3802
  /* *
@@ -2747,6 +3826,22 @@
2747
3826
  *
2748
3827
  * */
2749
3828
  /* eslint-disable valid-jsdoc */
3829
+ // Get the projected path based on the geometry. May also be called on
3830
+ // mapData options (not point instances), hence static.
3831
+ MapPoint.getProjectedPath = function (point, projection) {
3832
+ if (!point.projectedPath) {
3833
+ if (projection && point.geometry) {
3834
+ // Always true when given GeoJSON coordinates
3835
+ projection.hasCoordinates = true;
3836
+ point.projectedPath = projection.path(point.geometry);
3837
+ // SVG path given directly in point options
3838
+ }
3839
+ else {
3840
+ point.projectedPath = point.path;
3841
+ }
3842
+ }
3843
+ return point.projectedPath || [];
3844
+ };
2750
3845
  /**
2751
3846
  * Extend the Point object to split paths.
2752
3847
  * @private
@@ -2765,11 +3860,6 @@
2765
3860
  mapPoint = typeof mapKey !== 'undefined' &&
2766
3861
  series.mapMap[mapKey];
2767
3862
  if (mapPoint) {
2768
- // This applies only to bubbles
2769
- if (series.xyFromShape) {
2770
- point.x = mapPoint._midX;
2771
- point.y = mapPoint._midY;
2772
- }
2773
3863
  extend(point, mapPoint); // copy over properties
2774
3864
  }
2775
3865
  else {
@@ -2803,18 +3893,20 @@
2803
3893
  * @function Highcharts.Point#zoomTo
2804
3894
  */
2805
3895
  MapPoint.prototype.zoomTo = function () {
2806
- var point = this,
2807
- series = point.series;
2808
- series.xAxis.setExtremes(point._minX, point._maxX, false);
2809
- series.yAxis.setExtremes(point._minY, point._maxY, false);
2810
- series.chart.redraw();
3896
+ var point = this;
3897
+ var chart = point.series.chart;
3898
+ if (chart.mapView && point.bounds) {
3899
+ chart.mapView.fitToBounds(point.bounds, void 0, false);
3900
+ point.series.isDirty = true;
3901
+ chart.redraw();
3902
+ }
2811
3903
  };
2812
3904
  return MapPoint;
2813
3905
  }(ScatterSeries.prototype.pointClass));
2814
3906
  extend(MapPoint.prototype, {
2815
- dataLabelOnNull: colorMapPointMixin.dataLabelOnNull,
2816
- isValid: colorMapPointMixin.isValid,
2817
- moveToTopOnHover: colorMapPointMixin.moveToTopOnHover
3907
+ dataLabelOnNull: ColorMapMixin.PointMixin.dataLabelOnNull,
3908
+ isValid: ColorMapMixin.PointMixin.isValid,
3909
+ moveToTopOnHover: ColorMapMixin.PointMixin.moveToTopOnHover
2818
3910
  });
2819
3911
  /* *
2820
3912
  *
@@ -2824,7 +3916,7 @@
2824
3916
 
2825
3917
  return MapPoint;
2826
3918
  });
2827
- _registerModule(_modules, 'Series/Map/MapSeries.js', [_modules['Mixins/ColorMapSeries.js'], _modules['Core/Globals.js'], _modules['Core/Legend/LegendSymbol.js'], _modules['Core/Chart/MapChart.js'], _modules['Series/Map/MapPoint.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/Series.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (ColorMapMixin, H, LegendSymbol, MapChart, MapPoint, palette, Series, SeriesRegistry, SVGRenderer, U) {
3919
+ _registerModule(_modules, 'Series/Map/MapSeries.js', [_modules['Core/Animation/AnimationUtilities.js'], _modules['Series/ColorMapMixin.js'], _modules['Series/CenteredUtilities.js'], _modules['Core/Globals.js'], _modules['Core/Legend/LegendSymbol.js'], _modules['Core/Chart/MapChart.js'], _modules['Series/Map/MapPoint.js'], _modules['Maps/MapView.js'], _modules['Core/Series/Series.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (A, ColorMapMixin, CU, H, LegendSymbol, MapChart, MapPoint, MapView, Series, SeriesRegistry, SVGRenderer, U) {
2828
3920
  /* *
2829
3921
  *
2830
3922
  * (c) 2010-2021 Torstein Honsi
@@ -2850,7 +3942,7 @@
2850
3942
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2851
3943
  };
2852
3944
  })();
2853
- var colorMapSeriesMixin = ColorMapMixin.colorMapSeriesMixin;
3945
+ var animObject = A.animObject;
2854
3946
  var noop = H.noop;
2855
3947
  var maps = MapChart.maps,
2856
3948
  splitPath = MapChart.splitPath;
@@ -2890,12 +3982,6 @@
2890
3982
  * */
2891
3983
  var _this = _super !== null && _super.apply(this,
2892
3984
  arguments) || this;
2893
- /* *
2894
- *
2895
- * Properties
2896
- *
2897
- * */
2898
- _this.baseTrans = void 0;
2899
3985
  _this.chart = void 0;
2900
3986
  _this.data = void 0;
2901
3987
  _this.group = void 0;
@@ -2919,25 +4005,17 @@
2919
4005
  * @private
2920
4006
  */
2921
4007
  MapSeries.prototype.animate = function (init) {
2922
- var chart = this.chart,
2923
- animation = this.options.animation,
2924
- group = this.group,
2925
- xAxis = this.xAxis,
2926
- yAxis = this.yAxis,
2927
- left = xAxis.pos,
2928
- top = yAxis.pos;
4008
+ var _a = this,
4009
+ chart = _a.chart,
4010
+ group = _a.group,
4011
+ animation = animObject(this.options.animation);
2929
4012
  if (chart.renderer.isSVG) {
2930
- if (animation === true) {
2931
- animation = {
2932
- duration: 1000
2933
- };
2934
- }
2935
4013
  // Initialize the animation
2936
4014
  if (init) {
2937
4015
  // Scale down the group and place it in the center
2938
4016
  group.attr({
2939
- translateX: left + xAxis.len / 2,
2940
- translateY: top + yAxis.len / 2,
4017
+ translateX: chart.plotLeft + chart.plotWidth / 2,
4018
+ translateY: chart.plotTop + chart.plotHeight / 2,
2941
4019
  scaleX: 0.001,
2942
4020
  scaleY: 0.001
2943
4021
  });
@@ -2945,8 +4023,8 @@
2945
4023
  }
2946
4024
  else {
2947
4025
  group.animate({
2948
- translateX: left,
2949
- translateY: top,
4026
+ translateX: chart.plotLeft,
4027
+ translateY: chart.plotTop,
2950
4028
  scaleX: 1,
2951
4029
  scaleY: 1
2952
4030
  }, animation);
@@ -2954,36 +4032,35 @@
2954
4032
  }
2955
4033
  };
2956
4034
  /**
2957
- * Animate in the new series from the clicked point in the old series.
2958
- * Depends on the drilldown.js module
4035
+ * Animate in the new series. Depends on the drilldown.js module.
2959
4036
  * @private
2960
4037
  */
2961
4038
  MapSeries.prototype.animateDrilldown = function (init) {
2962
- var toBox = this.chart.plotBox,
2963
- level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
2964
- fromBox = level.bBox,
2965
- animationOptions = this.chart.options.drilldown.animation,
2966
- scale;
2967
- if (!init) {
2968
- scale = Math.min(fromBox.width / toBox.width, fromBox.height / toBox.height);
2969
- level.shapeArgs = {
2970
- scaleX: scale,
2971
- scaleY: scale,
2972
- translateX: fromBox.x,
2973
- translateY: fromBox.y
2974
- };
2975
- this.points.forEach(function (point) {
2976
- if (point.graphic) {
2977
- point.graphic
2978
- .attr(level.shapeArgs)
2979
- .animate({
2980
- scaleX: 1,
2981
- scaleY: 1,
2982
- translateX: 0,
2983
- translateY: 0
2984
- }, animationOptions);
2985
- }
2986
- });
4039
+ var chart = this.chart,
4040
+ group = this.group;
4041
+ if (chart.renderer.isSVG) {
4042
+ // Initialize the animation
4043
+ if (init) {
4044
+ // Scale down the group and place it in the center. This is a
4045
+ // regression from <= v9.2, when it animated from the old point.
4046
+ group.attr({
4047
+ translateX: chart.plotLeft + chart.plotWidth / 2,
4048
+ translateY: chart.plotTop + chart.plotHeight / 2,
4049
+ scaleX: 0.1,
4050
+ scaleY: 0.1,
4051
+ opacity: 0.01
4052
+ });
4053
+ // Run the animation
4054
+ }
4055
+ else {
4056
+ group.animate({
4057
+ translateX: chart.plotLeft,
4058
+ translateY: chart.plotTop,
4059
+ scaleX: 1,
4060
+ scaleY: 1,
4061
+ opacity: 1
4062
+ });
4063
+ }
2987
4064
  }
2988
4065
  };
2989
4066
  /**
@@ -2991,8 +4068,17 @@
2991
4068
  * series and animate them into the origin point in the upper series.
2992
4069
  * @private
2993
4070
  */
2994
- MapSeries.prototype.animateDrillupFrom = function (level) {
2995
- ColumnSeries.prototype.animateDrillupFrom.call(this, level);
4071
+ MapSeries.prototype.animateDrillupFrom = function () {
4072
+ var chart = this.chart;
4073
+ if (chart.renderer.isSVG) {
4074
+ this.group.animate({
4075
+ translateX: chart.plotLeft + chart.plotWidth / 2,
4076
+ translateY: chart.plotTop + chart.plotHeight / 2,
4077
+ scaleX: 0.1,
4078
+ scaleY: 0.1,
4079
+ opacity: 0.01
4080
+ });
4081
+ }
2996
4082
  };
2997
4083
  /**
2998
4084
  * When drilling up, keep the upper series invisible until the lower series
@@ -3002,16 +4088,23 @@
3002
4088
  MapSeries.prototype.animateDrillupTo = function (init) {
3003
4089
  ColumnSeries.prototype.animateDrillupTo.call(this, init);
3004
4090
  };
4091
+ MapSeries.prototype.clearBounds = function () {
4092
+ this.points.forEach(function (point) {
4093
+ delete point.bounds;
4094
+ delete point.projectedPath;
4095
+ });
4096
+ delete this.bounds;
4097
+ };
3005
4098
  /**
3006
4099
  * Allow a quick redraw by just translating the area group. Used for zooming
3007
4100
  * and panning in capable browsers.
3008
4101
  * @private
3009
4102
  */
3010
4103
  MapSeries.prototype.doFullTranslate = function () {
3011
- return (this.isDirtyData ||
4104
+ return Boolean(this.isDirtyData ||
3012
4105
  this.chart.isResizing ||
3013
4106
  this.chart.renderer.isVML ||
3014
- !this.baseTrans);
4107
+ !this.hasRendered);
3015
4108
  };
3016
4109
  /**
3017
4110
  * Draw the data labels. Special for maps is the time that the data labels
@@ -3030,50 +4123,36 @@
3030
4123
  * @private
3031
4124
  */
3032
4125
  MapSeries.prototype.drawPoints = function () {
3033
- var series = this,
3034
- xAxis = series.xAxis,
3035
- yAxis = series.yAxis,
3036
- group = series.group,
3037
- chart = series.chart,
3038
- renderer = chart.renderer,
3039
- scaleX,
3040
- scaleY,
3041
- translateX,
3042
- translateY,
3043
- baseTrans = this.baseTrans,
3044
- transformGroup,
3045
- startTranslateX,
3046
- startTranslateY,
3047
- startScaleX,
3048
- startScaleY;
4126
+ var _this = this;
4127
+ var _a = this,
4128
+ chart = _a.chart,
4129
+ group = _a.group,
4130
+ svgTransform = _a.svgTransform;
4131
+ var mapView = chart.mapView,
4132
+ renderer = chart.renderer;
3049
4133
  // Set a group that handles transform during zooming and panning in
3050
4134
  // order to preserve clipping on series.group
3051
- if (!series.transformGroup) {
3052
- series.transformGroup = renderer.g()
3053
- .attr({
3054
- scaleX: 1,
3055
- scaleY: 1
3056
- })
3057
- .add(group);
3058
- series.transformGroup.survive = true;
4135
+ if (!this.transformGroup) {
4136
+ this.transformGroup = renderer.g().add(group);
4137
+ this.transformGroup.survive = true;
3059
4138
  }
3060
4139
  // Draw the shapes again
3061
- if (series.doFullTranslate()) {
4140
+ if (this.doFullTranslate()) {
3062
4141
  // Individual point actions.
3063
4142
  if (chart.hasRendered && !chart.styledMode) {
3064
- series.points.forEach(function (point) {
4143
+ this.points.forEach(function (point) {
3065
4144
  // Restore state color on update/redraw (#3529)
3066
4145
  if (point.shapeArgs) {
3067
- point.shapeArgs.fill = series.pointAttribs(point, point.state).fill;
4146
+ point.shapeArgs.fill = _this.pointAttribs(point, point.state).fill;
3068
4147
  }
3069
4148
  });
3070
4149
  }
3071
4150
  // Draw them in transformGroup
3072
- series.group = series.transformGroup;
3073
- ColumnSeries.prototype.drawPoints.apply(series);
3074
- series.group = group; // Reset
4151
+ this.group = this.transformGroup;
4152
+ ColumnSeries.prototype.drawPoints.apply(this);
4153
+ this.group = group; // Reset
3075
4154
  // Add class names
3076
- series.points.forEach(function (point) {
4155
+ this.points.forEach(function (point) {
3077
4156
  if (point.graphic) {
3078
4157
  var className = '';
3079
4158
  if (point.name) {
@@ -3092,203 +4171,138 @@
3092
4171
  }
3093
4172
  // In styled mode, apply point colors by CSS
3094
4173
  if (chart.styledMode) {
3095
- point.graphic.css(series.pointAttribs(point, point.selected && 'select' || void 0));
4174
+ point.graphic.css(_this.pointAttribs(point, point.selected && 'select' || void 0));
3096
4175
  }
3097
4176
  }
3098
4177
  });
3099
- // Set the base for later scale-zooming. The originX and originY
3100
- // properties are the axis values in the plot area's upper left
3101
- // corner.
3102
- this.baseTrans = {
3103
- originX: (xAxis.min -
3104
- xAxis.minPixelPadding / xAxis.transA),
3105
- originY: (yAxis.min -
3106
- yAxis.minPixelPadding / yAxis.transA +
3107
- (yAxis.reversed ? 0 : yAxis.len / yAxis.transA)),
3108
- transAX: xAxis.transA,
3109
- transAY: yAxis.transA
3110
- };
3111
- // Reset transformation in case we're doing a full translate
3112
- // (#3789)
3113
- this.transformGroup.animate({
3114
- translateX: 0,
3115
- translateY: 0,
3116
- scaleX: 1,
3117
- scaleY: 1
3118
- });
3119
- // Just update the scale and transform for better performance
3120
4178
  }
3121
- else {
3122
- scaleX = xAxis.transA / baseTrans.transAX;
3123
- scaleY = yAxis.transA / baseTrans.transAY;
3124
- translateX = xAxis.toPixels(baseTrans.originX, true);
3125
- translateY = yAxis.toPixels(baseTrans.originY, true);
3126
- // Handle rounding errors in normal view (#3789)
3127
- if (scaleX > 0.99 &&
3128
- scaleX < 1.01 &&
3129
- scaleY > 0.99 &&
3130
- scaleY < 1.01) {
3131
- scaleX = 1;
3132
- scaleY = 1;
3133
- translateX = Math.round(translateX);
3134
- translateY = Math.round(translateY);
3135
- }
3136
- /* Animate or move to the new zoom level. In order to prevent
3137
- flickering as the different transform components are set out
3138
- of sync (#5991), we run a fake animator attribute and set
3139
- scale and translation synchronously in the same step.
4179
+ // Apply the SVG transform
4180
+ if (mapView && svgTransform) {
4181
+ var strokeWidth_1 = pick(this.options[(this.pointAttrToOptions &&
4182
+ this.pointAttrToOptions['stroke-width']) || 'borderWidth'], 1 // Styled mode
4183
+ );
4184
+ /*
4185
+ Animate or move to the new zoom level. In order to prevent
4186
+ flickering as the different transform components are set out of sync
4187
+ (#5991), we run a fake animator attribute and set scale and
4188
+ translation synchronously in the same step.
3140
4189
 
3141
- A possible improvement to the API would be to handle this in
3142
- the renderer or animation engine itself, to ensure that when
3143
- we are animating multiple properties, we make sure that each
3144
- step for each property is performed in the same step. Also,
3145
- for symbols and for transform properties, it should induce a
3146
- single updateTransform and symbolAttr call. */
3147
- transformGroup = this.transformGroup;
3148
- if (chart.renderer.globalAnimation) {
3149
- startTranslateX = transformGroup.attr('translateX');
3150
- startTranslateY = transformGroup.attr('translateY');
3151
- startScaleX = transformGroup.attr('scaleX');
3152
- startScaleY = transformGroup.attr('scaleY');
3153
- transformGroup
4190
+ A possible improvement to the API would be to handle this in the
4191
+ renderer or animation engine itself, to ensure that when we are
4192
+ animating multiple properties, we make sure that each step for each
4193
+ property is performed in the same step. Also, for symbols and for
4194
+ transform properties, it should induce a single updateTransform and
4195
+ symbolAttr call.
4196
+ */
4197
+ var scale_1 = svgTransform.scaleX;
4198
+ var flipFactor_1 = svgTransform.scaleY > 0 ? 1 : -1;
4199
+ var transformGroup_1 = this.transformGroup;
4200
+ if (renderer.globalAnimation && chart.hasRendered) {
4201
+ var startTranslateX_1 = Number(transformGroup_1.attr('translateX')), startTranslateY_1 = Number(transformGroup_1.attr('translateY')), startScale_1 = Number(transformGroup_1.attr('scaleX'));
4202
+ var step = function (now,
4203
+ fx) {
4204
+ var scaleStep = startScale_1 +
4205
+ (scale_1 - startScale_1) * fx.pos;
4206
+ transformGroup_1.attr({
4207
+ translateX: (startTranslateX_1 +
4208
+ (svgTransform.translateX - startTranslateX_1) * fx.pos),
4209
+ translateY: (startTranslateY_1 +
4210
+ (svgTransform.translateY - startTranslateY_1) * fx.pos),
4211
+ scaleX: scaleStep,
4212
+ scaleY: scaleStep * flipFactor_1
4213
+ });
4214
+ group.element.setAttribute('stroke-width', strokeWidth_1 / scaleStep);
4215
+ };
4216
+ transformGroup_1
3154
4217
  .attr({ animator: 0 })
3155
- .animate({
3156
- animator: 1
3157
- }, {
3158
- step: function (now, fx) {
3159
- transformGroup.attr({
3160
- translateX: (startTranslateX +
3161
- (translateX - startTranslateX) * fx.pos),
3162
- translateY: (startTranslateY +
3163
- (translateY - startTranslateY) * fx.pos),
3164
- scaleX: (startScaleX +
3165
- (scaleX - startScaleX) *
3166
- fx.pos),
3167
- scaleY: (startScaleY +
3168
- (scaleY - startScaleY) * fx.pos)
3169
- });
3170
- }
3171
- });
3172
- // When dragging, animation is off.
4218
+ .animate({ animator: 1 }, { step: step });
4219
+ // When dragging or first rendering, animation is off
3173
4220
  }
3174
4221
  else {
3175
- transformGroup.attr({
3176
- translateX: translateX,
3177
- translateY: translateY,
3178
- scaleX: scaleX,
3179
- scaleY: scaleY
3180
- });
4222
+ transformGroup_1.attr(svgTransform);
4223
+ // Set the stroke-width directly on the group element so the
4224
+ // children inherit it. We need to use setAttribute directly,
4225
+ // because the stroke-widthSetter method expects a stroke color
4226
+ // also to be set.
4227
+ group.element.setAttribute('stroke-width', strokeWidth_1 / scale_1);
3181
4228
  }
3182
4229
  }
3183
- /* Set the stroke-width directly on the group element so the
3184
- children inherit it. We need to use setAttribute directly,
3185
- because the stroke-widthSetter method expects a stroke color also
3186
- to be set. */
3187
- if (!chart.styledMode) {
3188
- group.element.setAttribute('stroke-width', (pick(series.options[(series.pointAttrToOptions &&
3189
- series.pointAttrToOptions['stroke-width']) || 'borderWidth'], 1 // Styled mode
3190
- ) / (scaleX || 1)));
3191
- }
3192
4230
  this.drawMapDataLabels();
3193
4231
  };
3194
4232
  /**
3195
4233
  * Get the bounding box of all paths in the map combined.
3196
- * @private
4234
+ *
3197
4235
  */
3198
- MapSeries.prototype.getBox = function (paths) {
3199
- var MAX_VALUE = Number.MAX_VALUE,
3200
- maxX = -MAX_VALUE,
3201
- minX = MAX_VALUE,
3202
- maxY = -MAX_VALUE,
3203
- minY = MAX_VALUE,
3204
- minRange = MAX_VALUE,
3205
- xAxis = this.xAxis,
3206
- yAxis = this.yAxis,
3207
- hasBox;
3208
- // Find the bounding box
3209
- (paths || []).forEach(function (point) {
3210
- if (point.path) {
3211
- if (typeof point.path === 'string') {
3212
- point.path = splitPath(point.path);
3213
- // Legacy one-dimensional array
3214
- }
3215
- else if (point.path[0] === 'M') {
3216
- point.path = SVGRenderer.prototype.pathToSegments(point.path);
3217
- }
3218
- var path = point.path || [],
3219
- pointMaxX_1 = -MAX_VALUE,
3220
- pointMinX_1 = MAX_VALUE,
3221
- pointMaxY_1 = -MAX_VALUE,
3222
- pointMinY_1 = MAX_VALUE,
3223
- properties = point.properties;
3224
- // The first time a map point is used, analyze its box
3225
- if (!point._foundBox) {
3226
- path.forEach(function (seg) {
3227
- var x = seg[seg.length - 2];
3228
- var y = seg[seg.length - 1];
3229
- if (typeof x === 'number' && typeof y === 'number') {
3230
- pointMinX_1 = Math.min(pointMinX_1, x);
3231
- pointMaxX_1 = Math.max(pointMaxX_1, x);
3232
- pointMinY_1 = Math.min(pointMinY_1, y);
3233
- pointMaxY_1 = Math.max(pointMaxY_1, y);
4236
+ MapSeries.prototype.getProjectedBounds = function () {
4237
+ if (!this.bounds) {
4238
+ var MAX_VALUE_1 = Number.MAX_VALUE,
4239
+ projection_1 = this.chart.mapView &&
4240
+ this.chart.mapView.projection,
4241
+ allBounds_1 = [];
4242
+ // Find the bounding box of each point
4243
+ (this.points || []).forEach(function (point) {
4244
+ if (point.path || point.geometry) {
4245
+ // @todo Try to puth these two conversions in
4246
+ // MapPoint.applyOptions
4247
+ if (typeof point.path === 'string') {
4248
+ point.path = splitPath(point.path);
4249
+ // Legacy one-dimensional array
4250
+ }
4251
+ else if (isArray(point.path) &&
4252
+ point.path[0] === 'M') {
4253
+ point.path = SVGRenderer.prototype.pathToSegments(point.path);
4254
+ }
4255
+ // The first time a map point is used, analyze its box
4256
+ if (!point.bounds) {
4257
+ var path = MapPoint.getProjectedPath(point,
4258
+ projection_1),
4259
+ properties = point.properties;
4260
+ var x2_1 = -MAX_VALUE_1,
4261
+ x1_1 = MAX_VALUE_1,
4262
+ y2_1 = -MAX_VALUE_1,
4263
+ y1_1 = MAX_VALUE_1,
4264
+ validBounds_1;
4265
+ path.forEach(function (seg) {
4266
+ var x = seg[seg.length - 2];
4267
+ var y = seg[seg.length - 1];
4268
+ if (typeof x === 'number' &&
4269
+ typeof y === 'number') {
4270
+ x1_1 = Math.min(x1_1, x);
4271
+ x2_1 = Math.max(x2_1, x);
4272
+ y1_1 = Math.min(y1_1, y);
4273
+ y2_1 = Math.max(y2_1, y);
4274
+ validBounds_1 = true;
4275
+ }
4276
+ });
4277
+ if (validBounds_1) {
4278
+ // Cache point bounding box for use to position data
4279
+ // labels, bubbles etc
4280
+ var propMiddleX = (properties && properties['hc-middle-x']),
4281
+ midX = (x1_1 + (x2_1 - x1_1) * pick(point.middleX,
4282
+ isNumber(propMiddleX) ?
4283
+ propMiddleX : 0.5)),
4284
+ propMiddleY = (properties && properties['hc-middle-y']);
4285
+ var middleYFraction = pick(point.middleY,
4286
+ isNumber(propMiddleY) ? propMiddleY : 0.5);
4287
+ // No geographic geometry, only path given => flip
4288
+ if (!point.geometry) {
4289
+ middleYFraction = 1 - middleYFraction;
4290
+ }
4291
+ var midY = y2_1 - (y2_1 - y1_1) * middleYFraction;
4292
+ point.bounds = { midX: midX, midY: midY, x1: x1_1, y1: y1_1, x2: x2_1, y2: y2_1 };
4293
+ point.labelrank = pick(point.labelrank,
4294
+ // Bigger shape, higher rank
4295
+ (x2_1 - x1_1) * (y2_1 - y1_1));
3234
4296
  }
3235
- });
3236
- // Cache point bounding box for use to position data
3237
- // labels, bubbles etc
3238
- point._midX = (pointMinX_1 + (pointMaxX_1 - pointMinX_1) * pick(point.middleX, properties &&
3239
- properties['hc-middle-x'], 0.5));
3240
- point._midY = (pointMinY_1 + (pointMaxY_1 - pointMinY_1) * pick(point.middleY, properties &&
3241
- properties['hc-middle-y'], 0.5));
3242
- point._maxX = pointMaxX_1;
3243
- point._minX = pointMinX_1;
3244
- point._maxY = pointMaxY_1;
3245
- point._minY = pointMinY_1;
3246
- point.labelrank = pick(point.labelrank, (pointMaxX_1 - pointMinX_1) * (pointMaxY_1 - pointMinY_1));
3247
- point._foundBox = true;
4297
+ }
4298
+ if (point.bounds) {
4299
+ allBounds_1.push(point.bounds);
4300
+ }
3248
4301
  }
3249
- maxX = Math.max(maxX, point._maxX);
3250
- minX = Math.min(minX, point._minX);
3251
- maxY = Math.max(maxY, point._maxY);
3252
- minY = Math.min(minY, point._minY);
3253
- minRange = Math.min(point._maxX - point._minX, point._maxY - point._minY, minRange);
3254
- hasBox = true;
3255
- }
3256
- });
3257
- // Set the box for the whole series
3258
- if (hasBox) {
3259
- this.minY = Math.min(minY, pick(this.minY, MAX_VALUE));
3260
- this.maxY = Math.max(maxY, pick(this.maxY, -MAX_VALUE));
3261
- this.minX = Math.min(minX, pick(this.minX, MAX_VALUE));
3262
- this.maxX = Math.max(maxX, pick(this.maxX, -MAX_VALUE));
3263
- // If no minRange option is set, set the default minimum zooming
3264
- // range to 5 times the size of the smallest element
3265
- if (xAxis && typeof xAxis.options.minRange === 'undefined') {
3266
- xAxis.minRange = Math.min(5 * minRange, (this.maxX - this.minX) / 5, xAxis.minRange || MAX_VALUE);
3267
- }
3268
- if (yAxis && typeof yAxis.options.minRange === 'undefined') {
3269
- yAxis.minRange = Math.min(5 * minRange, (this.maxY - this.minY) / 5, yAxis.minRange || MAX_VALUE);
3270
- }
3271
- }
3272
- };
3273
- MapSeries.prototype.getExtremes = function () {
3274
- // Get the actual value extremes for colors
3275
- var _a = Series.prototype.getExtremes
3276
- .call(this,
3277
- this.valueData),
3278
- dataMin = _a.dataMin,
3279
- dataMax = _a.dataMax;
3280
- // Recalculate box on updated data
3281
- if (this.chart.hasRendered && this.isDirtyData) {
3282
- this.getBox(this.options.data);
3283
- }
3284
- if (isNumber(dataMin)) {
3285
- this.valueMin = dataMin;
3286
- }
3287
- if (isNumber(dataMax)) {
3288
- this.valueMax = dataMax;
4302
+ });
4303
+ this.bounds = MapView.compositeBounds(allBounds_1);
3289
4304
  }
3290
- // Extremes for the mock Y axis
3291
- return { dataMin: this.minY, dataMax: this.maxY };
4305
+ return this.bounds;
3292
4306
  };
3293
4307
  /**
3294
4308
  * Define hasData function for non-cartesian series. Returns true if the
@@ -3305,35 +4319,31 @@
3305
4319
  * @private
3306
4320
  */
3307
4321
  MapSeries.prototype.pointAttribs = function (point, state) {
3308
- var attr = point.series.chart.styledMode ?
4322
+ var _a = point.series.chart,
4323
+ mapView = _a.mapView,
4324
+ styledMode = _a.styledMode;
4325
+ var attr = styledMode ?
3309
4326
  this.colorAttribs(point) :
3310
4327
  ColumnSeries.prototype.pointAttribs.call(this,
3311
4328
  point,
3312
4329
  state);
3313
- // Set the stroke-width on the group element and let all point
3314
- // graphics inherit. That way we don't have to iterate over all
3315
- // points to update the stroke-width on zooming.
3316
- attr['stroke-width'] = pick(point.options[(this.pointAttrToOptions &&
3317
- this.pointAttrToOptions['stroke-width']) || 'borderWidth'], 'inherit');
3318
- return attr;
3319
- };
3320
- /**
3321
- * Override render to throw in an async call in IE8. Otherwise it chokes on
3322
- * the US counties demo.
3323
- * @private
3324
- */
3325
- MapSeries.prototype.render = function () {
3326
- var series = this,
3327
- render = Series.prototype.render;
3328
- // Give IE8 some time to breathe.
3329
- if (series.chart.renderer.isVML && series.data.length > 3000) {
3330
- setTimeout(function () {
3331
- render.call(series);
3332
- });
4330
+ // Individual stroke width
4331
+ var pointStrokeWidth = point.options[(this.pointAttrToOptions &&
4332
+ this.pointAttrToOptions['stroke-width']) || 'borderWidth'];
4333
+ if (pointStrokeWidth && mapView) {
4334
+ pointStrokeWidth /= mapView.getScale();
3333
4335
  }
3334
- else {
3335
- render.call(series);
4336
+ // In order for dash style to avoid being scaled, set the transformed
4337
+ // stroke width on the item
4338
+ if (attr.dashstyle && mapView && this.options.borderWidth) {
4339
+ pointStrokeWidth = this.options.borderWidth / mapView.getScale();
3336
4340
  }
4341
+ attr['stroke-width'] = pick(pointStrokeWidth,
4342
+ // By default set the stroke-width on the group element and let all
4343
+ // point graphics inherit. That way we don't have to iterate over
4344
+ // all points to update the stroke-width on zooming.
4345
+ 'inherit');
4346
+ return attr;
3337
4347
  };
3338
4348
  /**
3339
4349
  * Extend setData to join in mapData. If the allAreas option is true, all
@@ -3400,7 +4410,7 @@
3400
4410
  }
3401
4411
  });
3402
4412
  }
3403
- this.getBox(data);
4413
+ // this.getBox(data as any);
3404
4414
  // Pick up transform definitions for chart
3405
4415
  this.chart.mapTransforms = mapTransforms =
3406
4416
  chartOptions.mapTransforms ||
@@ -3445,7 +4455,7 @@
3445
4455
  });
3446
4456
  }
3447
4457
  if (options.allAreas) {
3448
- this.getBox(mapData);
4458
+ // this.getBox(mapData);
3449
4459
  data = data || [];
3450
4460
  // Registered the point codes that actually hold data
3451
4461
  if (joinBy[1]) {
@@ -3469,12 +4479,13 @@
3469
4479
  updatePoints = false;
3470
4480
  }
3471
4481
  });
3472
- }
3473
- else {
4482
+ } /* else {
3474
4483
  this.getBox(dataUsed); // Issue #4784
3475
- }
4484
+ } */
3476
4485
  }
3477
4486
  Series.prototype.setData.call(this, data, redraw, animation, updatePoints);
4487
+ this.processData();
4488
+ this.generatePoints();
3478
4489
  };
3479
4490
  /**
3480
4491
  * Extend setOptions by picking up the joinBy option and applying it to a
@@ -3502,85 +4513,56 @@
3502
4513
  */
3503
4514
  MapSeries.prototype.translate = function () {
3504
4515
  var series = this,
3505
- xAxis = series.xAxis,
3506
- yAxis = series.yAxis,
3507
- doFullTranslate = series.doFullTranslate();
3508
- series.generatePoints();
3509
- series.data.forEach(function (point) {
4516
+ doFullTranslate = series.doFullTranslate(),
4517
+ mapView = this.chart.mapView,
4518
+ projection = mapView && mapView.projection;
4519
+ // Recalculate box on updated data
4520
+ if (this.chart.hasRendered && (this.isDirtyData || !this.hasRendered)) {
4521
+ this.processData();
4522
+ this.generatePoints();
4523
+ delete this.bounds;
4524
+ this.getProjectedBounds();
4525
+ }
4526
+ // Calculate the SVG transform
4527
+ var svgTransform;
4528
+ if (mapView) {
4529
+ var scale = mapView.getScale();
4530
+ var _a = mapView.projection.forward(mapView.center),
4531
+ x = _a[0],
4532
+ y = _a[1];
4533
+ // When dealing with unprojected coordinates, y axis is flipped.
4534
+ var flipFactor = mapView.projection.hasCoordinates ? -1 : 1;
4535
+ var translateX = this.chart.plotWidth / 2 - x * scale,
4536
+ translateY = this.chart.plotHeight / 2 - y * scale * flipFactor;
4537
+ svgTransform = {
4538
+ scaleX: scale,
4539
+ scaleY: scale * flipFactor,
4540
+ translateX: translateX,
4541
+ translateY: translateY
4542
+ };
4543
+ this.svgTransform = svgTransform;
4544
+ }
4545
+ series.points.forEach(function (point) {
3510
4546
  // Record the middle point (loosely based on centroid),
3511
4547
  // determined by the middleX and middleY options.
3512
- if (isNumber(point._midX) && isNumber(point._midY)) {
3513
- point.plotX = xAxis.toPixels(point._midX, true);
3514
- point.plotY = yAxis.toPixels(point._midY, true);
4548
+ if (svgTransform &&
4549
+ point.bounds &&
4550
+ isNumber(point.bounds.midX) &&
4551
+ isNumber(point.bounds.midY)) {
4552
+ point.plotX = point.bounds.midX * svgTransform.scaleX +
4553
+ svgTransform.translateX;
4554
+ point.plotY = point.bounds.midY * svgTransform.scaleY +
4555
+ svgTransform.translateY;
3515
4556
  }
3516
4557
  if (doFullTranslate) {
3517
4558
  point.shapeType = 'path';
3518
4559
  point.shapeArgs = {
3519
- d: series.translatePath(point.path)
4560
+ d: MapPoint.getProjectedPath(point, projection)
3520
4561
  };
3521
4562
  }
3522
4563
  });
3523
4564
  fireEvent(series, 'afterTranslate');
3524
4565
  };
3525
- /**
3526
- * Translate the path, so it automatically fits into the plot area box.
3527
- * @private
3528
- */
3529
- MapSeries.prototype.translatePath = function (path) {
3530
- var series = this,
3531
- xAxis = series.xAxis,
3532
- yAxis = series.yAxis,
3533
- xMin = xAxis.min,
3534
- xTransA = xAxis.transA,
3535
- xMinPixelPadding = xAxis.minPixelPadding,
3536
- yMin = yAxis.min,
3537
- yTransA = yAxis.transA,
3538
- yMinPixelPadding = yAxis.minPixelPadding,
3539
- ret = []; // Preserve the original
3540
- // Do the translation
3541
- if (path) {
3542
- path.forEach(function (seg) {
3543
- if (seg[0] === 'M') {
3544
- ret.push([
3545
- 'M',
3546
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
3547
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding
3548
- ]);
3549
- }
3550
- else if (seg[0] === 'L') {
3551
- ret.push([
3552
- 'L',
3553
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
3554
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding
3555
- ]);
3556
- }
3557
- else if (seg[0] === 'C') {
3558
- ret.push([
3559
- 'C',
3560
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
3561
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding,
3562
- (seg[3] - (xMin || 0)) * xTransA + xMinPixelPadding,
3563
- (seg[4] - (yMin || 0)) * yTransA + yMinPixelPadding,
3564
- (seg[5] - (xMin || 0)) * xTransA + xMinPixelPadding,
3565
- (seg[6] - (yMin || 0)) * yTransA + yMinPixelPadding
3566
- ]);
3567
- }
3568
- else if (seg[0] === 'Q') {
3569
- ret.push([
3570
- 'Q',
3571
- (seg[1] - (xMin || 0)) * xTransA + xMinPixelPadding,
3572
- (seg[2] - (yMin || 0)) * yTransA + yMinPixelPadding,
3573
- (seg[3] - (xMin || 0)) * xTransA + xMinPixelPadding,
3574
- (seg[4] - (yMin || 0)) * yTransA + yMinPixelPadding
3575
- ]);
3576
- }
3577
- else if (seg[0] === 'Z') {
3578
- ret.push(['Z']);
3579
- }
3580
- });
3581
- }
3582
- return ret;
3583
- };
3584
4566
  /**
3585
4567
  * The map series is used for basic choropleth maps, where each map area has
3586
4568
  * a color based on its value.
@@ -3626,7 +4608,7 @@
3626
4608
  *
3627
4609
  * @private
3628
4610
  */
3629
- nullColor: palette.neutralColor3,
4611
+ nullColor: "#f7f7f7" /* neutralColor3 */,
3630
4612
  /**
3631
4613
  * Whether to allow pointer interaction like tooltips and mouse events
3632
4614
  * on null points.
@@ -3680,7 +4662,7 @@
3680
4662
  *
3681
4663
  * @private
3682
4664
  */
3683
- borderColor: palette.neutralColor20,
4665
+ borderColor: "#cccccc" /* neutralColor20 */,
3684
4666
  /**
3685
4667
  * The border width of each map area.
3686
4668
  *
@@ -3811,11 +4793,11 @@
3811
4793
  select: {
3812
4794
  /**
3813
4795
  * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
3814
- * @default ${palette.neutralColor20}
4796
+ * @default #cccccc
3815
4797
  * @product highmaps
3816
4798
  * @apioption plotOptions.series.states.select.color
3817
4799
  */
3818
- color: palette.neutralColor20
4800
+ color: "#cccccc" /* neutralColor20 */
3819
4801
  },
3820
4802
  inactive: {
3821
4803
  opacity: 1
@@ -3826,9 +4808,9 @@
3826
4808
  }(ScatterSeries));
3827
4809
  extend(MapSeries.prototype, {
3828
4810
  type: 'map',
3829
- axisTypes: colorMapSeriesMixin.axisTypes,
3830
- colorAttribs: colorMapSeriesMixin.colorAttribs,
3831
- colorKey: colorMapSeriesMixin.colorKey,
4811
+ axisTypes: ColorMapMixin.SeriesMixin.axisTypes,
4812
+ colorAttribs: ColorMapMixin.SeriesMixin.colorAttribs,
4813
+ colorKey: ColorMapMixin.SeriesMixin.colorKey,
3832
4814
  // When tooltip is not shared, this series (and derivatives) requires
3833
4815
  // direct touch/hover. KD-tree does not apply.
3834
4816
  directTouch: true,
@@ -3839,15 +4821,17 @@
3839
4821
  drawGraph: noop,
3840
4822
  drawLegendSymbol: LegendSymbol.drawRectangle,
3841
4823
  forceDL: true,
4824
+ getCenter: CU.getCenter,
3842
4825
  getExtremesFromAll: true,
3843
- getSymbol: colorMapSeriesMixin.getSymbol,
3844
- parallelArrays: colorMapSeriesMixin.parallelArrays,
3845
- pointArrayMap: colorMapSeriesMixin.pointArrayMap,
4826
+ getSymbol: ColorMapMixin.SeriesMixin.getSymbol,
4827
+ isCartesian: false,
4828
+ parallelArrays: ColorMapMixin.SeriesMixin.parallelArrays,
4829
+ pointArrayMap: ColorMapMixin.SeriesMixin.pointArrayMap,
3846
4830
  pointClass: MapPoint,
3847
4831
  // X axis and Y axis must have same translation slope
3848
4832
  preserveAspectRatio: true,
3849
4833
  searchPoint: noop,
3850
- trackerGroups: colorMapSeriesMixin.trackerGroups,
4834
+ trackerGroups: ColorMapMixin.SeriesMixin.trackerGroups,
3851
4835
  // Get axis extremes from paths, not values
3852
4836
  useMapGeometry: true
3853
4837
  });
@@ -3863,8 +4847,8 @@
3863
4847
  *
3864
4848
  * */
3865
4849
  /**
3866
- * A map data object containing a `path` definition and optionally additional
3867
- * properties to join in the data as per the `joinBy` option.
4850
+ * A map data object containing a `geometry` or `path` definition and optionally
4851
+ * additional properties to join in the `data` as per the `joinBy` option.
3868
4852
  *
3869
4853
  * @sample maps/demo/category-map/
3870
4854
  * Map data and joinBy
@@ -3955,6 +4939,45 @@
3955
4939
  * @product highmaps
3956
4940
  * @apioption series.map.data.drilldown
3957
4941
  */
4942
+ /**
4943
+ * For map and mapline series types, the geometry of a point.
4944
+ *
4945
+ * To achieve a better separation between the structure and the data,
4946
+ * it is recommended to use `mapData` to define the geometry instead
4947
+ * of defining it on the data points themselves.
4948
+ *
4949
+ * The geometry object is compatible to that of a `feature` in geoJSON, so
4950
+ * features of geoJSON can be passed directly into the `data`, optionally
4951
+ * after first filtering and processing it.
4952
+ *
4953
+ * @sample maps/series/data-geometry/
4954
+ * Geometry defined in data
4955
+ *
4956
+ * @type {Object}
4957
+ * @since 9.3.0
4958
+ * @product highmaps
4959
+ * @apioption series.map.data.geometry
4960
+ */
4961
+ /**
4962
+ * The geometry type. Can be one of `LineString`, `Polygon`, `MultiLineString`
4963
+ * or `MultiPolygon`.
4964
+ *
4965
+ * @type {string}
4966
+ * @since 9.3.0
4967
+ * @product highmaps
4968
+ * @validvalue ["LineString", "Polygon", "MultiLineString", "MultiPolygon"]
4969
+ * @apioption series.map.data.geometry.type
4970
+ */
4971
+ /**
4972
+ * The geometry coordinates in terms of arrays of `[longitude, latitude]`, or
4973
+ * a two dimensional array of the same. The dimensionality must comply with the
4974
+ * `type`.
4975
+ *
4976
+ * @type {Array<LonLatArray>|Array<Array<LonLatArray>>}
4977
+ * @since 9.3.0
4978
+ * @product highmaps
4979
+ * @apioption series.map.data.geometry.coordinates
4980
+ */
3958
4981
  /**
3959
4982
  * An id for the point. This can be used after render time to get a
3960
4983
  * pointer to the point object through `chart.get()`.
@@ -4016,6 +5039,9 @@
4016
5039
  * it is recommended to use `mapData` to define that paths instead
4017
5040
  * of defining them on the data points themselves.
4018
5041
  *
5042
+ * For providing true geographical shapes based on longitude and latitude, use
5043
+ * the `geometry` option instead.
5044
+ *
4019
5045
  * @sample maps/series/data-path/
4020
5046
  * Paths defined in data
4021
5047
  *
@@ -4111,12 +5137,8 @@
4111
5137
  /* eslint-disable valid-jsdoc */
4112
5138
  /**
4113
5139
  * Get presentational attributes
4114
- *
4115
5140
  * @private
4116
5141
  * @function Highcharts.seriesTypes.mapline#pointAttribs
4117
- * @param {Highcharts.Point} point
4118
- * @param {string} state
4119
- * @return {Highcharts.SVGAttributes}
4120
5142
  */
4121
5143
  MapLineSeries.prototype.pointAttribs = function (point, state) {
4122
5144
  var attr = MapSeries.prototype.pointAttribs.call(this,
@@ -4223,6 +5245,8 @@
4223
5245
  * ```
4224
5246
  *
4225
5247
  * @type {Array<number|Array<string,(number|null)>|null|*>}
5248
+ * @extends series.map.data
5249
+ * @excluding drilldown
4226
5250
  * @product highmaps
4227
5251
  * @apioption series.mapline.data
4228
5252
  */
@@ -4257,7 +5281,8 @@
4257
5281
  };
4258
5282
  })();
4259
5283
  var ScatterSeries = SeriesRegistry.seriesTypes.scatter;
4260
- var merge = U.merge;
5284
+ var isNumber = U.isNumber,
5285
+ merge = U.merge;
4261
5286
  /* *
4262
5287
  *
4263
5288
  * Class
@@ -4292,6 +5317,10 @@
4292
5317
  options);
4293
5318
  return _super.prototype.applyOptions.call(this, mergedOptions, x);
4294
5319
  };
5320
+ MapPointPoint.prototype.isValid = function () {
5321
+ return Boolean(this.options.geometry ||
5322
+ (isNumber(this.x) && isNumber(this.y)));
5323
+ };
4295
5324
  return MapPointPoint;
4296
5325
  }(ScatterSeries.prototype.pointClass));
4297
5326
  /* *
@@ -4302,7 +5331,7 @@
4302
5331
 
4303
5332
  return MapPointPoint;
4304
5333
  });
4305
- _registerModule(_modules, 'Series/MapPoint/MapPointSeries.js', [_modules['Series/MapPoint/MapPointPoint.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MapPointPoint, palette, SeriesRegistry, U) {
5334
+ _registerModule(_modules, 'Series/MapPoint/MapPointSeries.js', [_modules['Core/Globals.js'], _modules['Series/MapPoint/MapPointPoint.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (H, MapPointPoint, SeriesRegistry, U) {
4306
5335
  /* *
4307
5336
  *
4308
5337
  * (c) 2010-2021 Torstein Honsi
@@ -4328,8 +5357,11 @@
4328
5357
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4329
5358
  };
4330
5359
  })();
5360
+ var noop = H.noop;
4331
5361
  var ScatterSeries = SeriesRegistry.seriesTypes.scatter;
4332
5362
  var extend = U.extend,
5363
+ fireEvent = U.fireEvent,
5364
+ isNumber = U.isNumber,
4333
5365
  merge = U.merge;
4334
5366
  /* *
4335
5367
  *
@@ -4376,6 +5408,56 @@
4376
5408
  this.dataLabelsGroup.clip(this.chart.clipRect);
4377
5409
  }
4378
5410
  };
5411
+ MapPointSeries.prototype.translate = function () {
5412
+ var _this = this;
5413
+ var mapView = this.chart.mapView;
5414
+ if (!this.processedXData) {
5415
+ this.processData();
5416
+ }
5417
+ this.generatePoints();
5418
+ // Create map based translation
5419
+ if (mapView) {
5420
+ var _a = mapView.projection,
5421
+ forward_1 = _a.forward,
5422
+ hasCoordinates_1 = _a.hasCoordinates;
5423
+ this.points.forEach(function (p) {
5424
+ var _a = p.x,
5425
+ x = _a === void 0 ? void 0 : _a,
5426
+ _b = p.y,
5427
+ y = _b === void 0 ? void 0 : _b;
5428
+ var geometry = p.options.geometry,
5429
+ coordinates = (geometry &&
5430
+ geometry.type === 'Point' &&
5431
+ geometry.coordinates);
5432
+ if (coordinates) {
5433
+ var xy = forward_1(coordinates);
5434
+ x = xy[0];
5435
+ y = xy[1];
5436
+ // Map bubbles getting geometry from shape
5437
+ }
5438
+ else if (p.bounds) {
5439
+ x = p.bounds.midX;
5440
+ y = p.bounds.midY;
5441
+ }
5442
+ if (isNumber(x) && isNumber(y)) {
5443
+ var plotCoords = mapView.projectedUnitsToPixels({ x: x,
5444
+ y: y });
5445
+ p.plotX = plotCoords.x;
5446
+ p.plotY = hasCoordinates_1 ?
5447
+ plotCoords.y :
5448
+ _this.chart.plotHeight - plotCoords.y;
5449
+ }
5450
+ else {
5451
+ p.plotX = void 0;
5452
+ p.plotY = void 0;
5453
+ }
5454
+ p.isInside = _this.isPointInside(p);
5455
+ // Find point zone
5456
+ p.zone = _this.zones.length ? p.getZone() : void 0;
5457
+ });
5458
+ }
5459
+ fireEvent(this, 'afterTranslate');
5460
+ };
4379
5461
  /**
4380
5462
  * A mappoint series is a special form of scatter series where the points
4381
5463
  * can be laid out in map coordinates on top of a map.
@@ -4398,7 +5480,7 @@
4398
5480
  overflow: false,
4399
5481
  style: {
4400
5482
  /** @internal */
4401
- color: palette.neutralColor100
5483
+ color: "#000000" /* neutralColor100 */
4402
5484
  }
4403
5485
  }
4404
5486
  });
@@ -4406,8 +5488,12 @@
4406
5488
  }(ScatterSeries));
4407
5489
  extend(MapPointSeries.prototype, {
4408
5490
  type: 'mappoint',
5491
+ axisTypes: ['colorAxis'],
4409
5492
  forceDL: true,
4410
- pointClass: MapPointPoint
5493
+ isCartesian: false,
5494
+ pointClass: MapPointPoint,
5495
+ searchPoint: noop,
5496
+ useMapGeometry: true // #16534
4411
5497
  });
4412
5498
  SeriesRegistry.registerSeriesType('mappoint', MapPointSeries);
4413
5499
  /* *
@@ -4443,16 +5529,17 @@
4443
5529
  * data: [0, 5, 3, 5]
4444
5530
  * ```
4445
5531
  *
4446
- * 2. An array of arrays with 2 values. In this case, the values correspond to
4447
- * `x,y`. If the first value is a string, it is applied as the name of the
4448
- * point, and the `x` value is inferred.
4449
- * ```js
4450
- * data: [
4451
- * [0, 1],
4452
- * [1, 8],
4453
- * [2, 7]
4454
- * ]
4455
- * ```
5532
+ * 2. An array of arrays with 2 values. In this case, the values correspond
5533
+ * to `[hc-key, value]`. Example:
5534
+ *
5535
+ * ```js
5536
+ * data: [
5537
+ * ['us-ny', 0],
5538
+ * ['us-mi', 5],
5539
+ * ['us-tx', 3],
5540
+ * ['us-ak', 5]
5541
+ * ]
5542
+ * ```
4456
5543
  *
4457
5544
  * 3. An array of objects with named values. The following snippet shows only a
4458
5545
  * few settings, see the complete options set below. If the total number of
@@ -4479,6 +5566,42 @@
4479
5566
  * @product highmaps
4480
5567
  * @apioption series.mappoint.data
4481
5568
  */
5569
+ /**
5570
+ * The geometry of a point.
5571
+ *
5572
+ * To achieve a better separation between the structure and the data,
5573
+ * it is recommended to use `mapData` to define the geometry instead
5574
+ * of defining it on the data points themselves.
5575
+ *
5576
+ * The geometry object is compatible to that of a `feature` in geoJSON, so
5577
+ * features of geoJSON can be passed directly into the `data`, optionally
5578
+ * after first filtering and processing it.
5579
+ *
5580
+ * @sample maps/series/data-geometry/
5581
+ * geometry defined in data
5582
+ *
5583
+ * @type {Object}
5584
+ * @since 9.3.0
5585
+ * @product highmaps
5586
+ * @apioption series.mappoint.data.geometry
5587
+ */
5588
+ /**
5589
+ * The geometry type, which in case of the `mappoint` series is always `Point`.
5590
+ *
5591
+ * @type {string}
5592
+ * @since 9.3.0
5593
+ * @product highmaps
5594
+ * @validvalue ["Point"]
5595
+ * @apioption series.mappoint.data.geometry.type
5596
+ */
5597
+ /**
5598
+ * The geometry coordinates in terms of `[longitude, latitude]`.
5599
+ *
5600
+ * @type {Highcharts.LonLatArray}
5601
+ * @since 9.3.0
5602
+ * @product highmaps
5603
+ * @apioption series.mappoint.data.geometry.coordinates
5604
+ */
4482
5605
  /**
4483
5606
  * The latitude of the point. Must be combined with the `lon` option
4484
5607
  * to work. Overrides `x` and `y` values.
@@ -4527,7 +5650,7 @@
4527
5650
 
4528
5651
  return MapPointSeries;
4529
5652
  });
4530
- _registerModule(_modules, 'Series/Bubble/BubbleLegendDefaults.js', [_modules['Core/Color/Palette.js']], function (Palette) {
5653
+ _registerModule(_modules, 'Series/Bubble/BubbleLegendDefaults.js', [], function () {
4531
5654
  /* *
4532
5655
  *
4533
5656
  * (c) 2010-2021 Highsoft AS
@@ -4700,7 +5823,7 @@
4700
5823
  /** @ignore-option */
4701
5824
  fontSize: '10px',
4702
5825
  /** @ignore-option */
4703
- color: Palette.neutralColor100
5826
+ color: "#000000" /* neutralColor100 */
4704
5827
  },
4705
5828
  /**
4706
5829
  * The x position offset of the label relative to the
@@ -4892,7 +6015,6 @@
4892
6015
  * Bubble legend options
4893
6016
  * @param {Highcharts.Legend} legend
4894
6017
  * Legend
4895
- * @return {void}
4896
6018
  */
4897
6019
  BubbleLegendItem.prototype.init = function (options, legend) {
4898
6020
  this.options = options;
@@ -4905,9 +6027,8 @@
4905
6027
  *
4906
6028
  * @private
4907
6029
  * @function Highcharts.BubbleLegend#addToLegend
4908
- * @param {Array<(Highcharts.Point|Highcharts.Series)>}
4909
- * All legend items
4910
- * @return {void}
6030
+ * @param {Array<(Highcharts.Point|Highcharts.Series)>} items
6031
+ * All legend items
4911
6032
  */
4912
6033
  BubbleLegendItem.prototype.addToLegend = function (items) {
4913
6034
  // Insert bubbleLegend into legend items
@@ -4921,7 +6042,6 @@
4921
6042
  * @function Highcharts.BubbleLegend#drawLegendSymbol
4922
6043
  * @param {Highcharts.Legend} legend
4923
6044
  * Legend instance
4924
- * @return {void}
4925
6045
  */
4926
6046
  BubbleLegendItem.prototype.drawLegendSymbol = function (legend) {
4927
6047
  var chart = this.chart,
@@ -4964,7 +6084,6 @@
4964
6084
  *
4965
6085
  * @private
4966
6086
  * @function Highcharts.BubbleLegend#setOptions
4967
- * @return {void}
4968
6087
  */
4969
6088
  BubbleLegendItem.prototype.setOptions = function () {
4970
6089
  var ranges = this.ranges,
@@ -5037,7 +6156,6 @@
5037
6156
  *
5038
6157
  * @private
5039
6158
  * @function Highcharts.BubbleLegend#render
5040
- * @return {void}
5041
6159
  */
5042
6160
  BubbleLegendItem.prototype.render = function () {
5043
6161
  var renderer = this.chart.renderer,
@@ -5072,7 +6190,6 @@
5072
6190
  * @function Highcharts.BubbleLegend#renderRange
5073
6191
  * @param {Highcharts.LegendBubbleLegendRangesOptions} range
5074
6192
  * Range options
5075
- * @return {void}
5076
6193
  */
5077
6194
  BubbleLegendItem.prototype.renderRange = function (range) {
5078
6195
  var mainRange = this.ranges[0],
@@ -5154,7 +6271,6 @@
5154
6271
  *
5155
6272
  * @private
5156
6273
  * @function Highcharts.BubbleLegend#getMaxLabelSize
5157
- * @return {Highcharts.BBoxObject}
5158
6274
  */
5159
6275
  BubbleLegendItem.prototype.getMaxLabelSize = function () {
5160
6276
  var labels = this.symbols.labels;
@@ -5197,7 +6313,6 @@
5197
6313
  *
5198
6314
  * @private
5199
6315
  * @function Highcharts.BubbleLegend#hideOverlappingLabels
5200
- * @return {void}
5201
6316
  */
5202
6317
  BubbleLegendItem.prototype.hideOverlappingLabels = function () {
5203
6318
  var chart = this.chart,
@@ -5286,8 +6401,9 @@
5286
6401
  plotSizeX = chart.plotSizeX,
5287
6402
  plotSizeY = chart.plotSizeY,
5288
6403
  bubbleSeries = chart.series[this.options.seriesIndex],
5289
- minSize = Math.ceil(bubbleSeries.minPxSize),
5290
- maxPxSize = Math.ceil(bubbleSeries.maxPxSize),
6404
+ pxSizes = bubbleSeries.getPxExtremes(),
6405
+ minSize = Math.ceil(pxSizes.minPxSize),
6406
+ maxPxSize = Math.ceil(pxSizes.maxPxSize),
5291
6407
  plotSize = Math.min(plotSizeY,
5292
6408
  plotSizeX);
5293
6409
  var calculatedSize,
@@ -5317,7 +6433,6 @@
5317
6433
  * @function Highcharts.BubbleLegend#updateRanges
5318
6434
  * @param {number} min
5319
6435
  * @param {number} max
5320
- * @return {void}
5321
6436
  */
5322
6437
  BubbleLegendItem.prototype.updateRanges = function (min, max) {
5323
6438
  var bubbleLegendOptions = this.legend.options.bubbleLegend;
@@ -5332,17 +6447,17 @@
5332
6447
  *
5333
6448
  * @private
5334
6449
  * @function Highcharts.BubbleLegend#correctSizes
5335
- * @return {void}
5336
6450
  */
5337
6451
  BubbleLegendItem.prototype.correctSizes = function () {
5338
6452
  var legend = this.legend,
5339
6453
  chart = this.chart,
5340
6454
  bubbleSeries = chart.series[this.options.seriesIndex],
5341
- bubbleSeriesSize = bubbleSeries.maxPxSize,
6455
+ pxSizes = bubbleSeries.getPxExtremes(),
6456
+ bubbleSeriesSize = pxSizes.maxPxSize,
5342
6457
  bubbleLegendSize = this.options.maxSize;
5343
6458
  if (Math.abs(Math.ceil(bubbleSeriesSize) - bubbleLegendSize) >
5344
6459
  1) {
5345
- this.updateRanges(this.options.minSize, bubbleSeries.maxPxSize);
6460
+ this.updateRanges(this.options.minSize, pxSizes.maxPxSize);
5346
6461
  legend.render();
5347
6462
  }
5348
6463
  };
@@ -5717,6 +6832,11 @@
5717
6832
  };
5718
6833
  return BubblePoint;
5719
6834
  }(ScatterPoint));
6835
+ /* *
6836
+ *
6837
+ * Class Prototype
6838
+ *
6839
+ * */
5720
6840
  extend(BubblePoint.prototype, {
5721
6841
  ttBelow: false
5722
6842
  });
@@ -5759,14 +6879,14 @@
5759
6879
  var _a = SeriesRegistry.seriesTypes,
5760
6880
  ColumnSeries = _a.column,
5761
6881
  ScatterSeries = _a.scatter;
5762
- var arrayMax = U.arrayMax,
6882
+ var addEvent = U.addEvent,
6883
+ arrayMax = U.arrayMax,
5763
6884
  arrayMin = U.arrayMin,
5764
6885
  clamp = U.clamp,
5765
6886
  extend = U.extend,
5766
6887
  isNumber = U.isNumber,
5767
6888
  merge = U.merge,
5768
- pick = U.pick,
5769
- pInt = U.pInt;
6889
+ pick = U.pick;
5770
6890
  /* *
5771
6891
  *
5772
6892
  * Class
@@ -5836,20 +6956,49 @@
5836
6956
  * the axis needs to add padding in accordance with the point sizes.
5837
6957
  * @private
5838
6958
  */
5839
- BubbleSeries.prototype.getRadii = function (zMin, zMax, series) {
6959
+ BubbleSeries.prototype.getRadii = function () {
6960
+ var _this = this;
5840
6961
  var len,
5841
6962
  i,
5842
6963
  zData = this.zData,
5843
6964
  yData = this.yData,
5844
- minSize = series.minPxSize,
5845
- maxSize = series.maxPxSize,
5846
6965
  radii = [],
5847
- value;
6966
+ value,
6967
+ zExtremes = this.chart.bubbleZExtremes;
6968
+ var _a = this.getPxExtremes(),
6969
+ minPxSize = _a.minPxSize,
6970
+ maxPxSize = _a.maxPxSize;
6971
+ // Get the collective Z extremes of all bubblish series. The chart-level
6972
+ // `bubbleZExtremes` are only computed once, and reset on `updatedData`
6973
+ // in any member series.
6974
+ if (!zExtremes) {
6975
+ var zMin_1 = Number.MAX_VALUE;
6976
+ var zMax_1 = -Number.MAX_VALUE;
6977
+ var valid_1;
6978
+ this.chart.series.forEach(function (otherSeries) {
6979
+ if (otherSeries.bubblePadding && (otherSeries.visible ||
6980
+ !_this.chart.options.chart.ignoreHiddenSeries)) {
6981
+ var zExtremes_1 = otherSeries.getZExtremes();
6982
+ if (zExtremes_1) {
6983
+ zMin_1 = Math.min(zMin_1 || zExtremes_1.zMin, zExtremes_1.zMin);
6984
+ zMax_1 = Math.max(zMax_1 || zExtremes_1.zMax, zExtremes_1.zMax);
6985
+ valid_1 = true;
6986
+ }
6987
+ }
6988
+ });
6989
+ if (valid_1) {
6990
+ zExtremes = { zMin: zMin_1, zMax: zMax_1 };
6991
+ this.chart.bubbleZExtremes = zExtremes;
6992
+ }
6993
+ else {
6994
+ zExtremes = { zMin: 0, zMax: 0 };
6995
+ }
6996
+ }
5848
6997
  // Set the shape type and arguments to be picked up in drawPoints
5849
6998
  for (i = 0, len = zData.length; i < len; i++) {
5850
6999
  value = zData[i];
5851
7000
  // Separate method to get individual radius for bubbleLegend
5852
- radii.push(this.getRadius(zMin, zMax, minSize, maxSize, value, yData[i]));
7001
+ radii.push(this.getRadius(zExtremes.zMin, zExtremes.zMax, minPxSize, maxPxSize, value, yData[i]));
5853
7002
  }
5854
7003
  this.radii = radii;
5855
7004
  };
@@ -5919,25 +7068,28 @@
5919
7068
  * @private
5920
7069
  */
5921
7070
  BubbleSeries.prototype.translate = function () {
5922
- var i,
5923
- data = this.data,
5924
- point,
5925
- radius,
5926
- radii = this.radii;
5927
7071
  // Run the parent method
5928
7072
  _super.prototype.translate.call(this);
7073
+ this.getRadii();
7074
+ this.translateBubble();
7075
+ };
7076
+ BubbleSeries.prototype.translateBubble = function () {
7077
+ var _a = this,
7078
+ data = _a.data,
7079
+ radii = _a.radii;
7080
+ var minPxSize = this.getPxExtremes().minPxSize;
5929
7081
  // Set the shape type and arguments to be picked up in drawPoints
5930
- i = data.length;
7082
+ var i = data.length;
5931
7083
  while (i--) {
5932
- point = data[i];
5933
- radius = radii ? radii[i] : 0; // #1737
5934
- if (isNumber(radius) && radius >= this.minPxSize / 2) {
5935
- // Shape arguments
5936
- point.marker = extend(point.marker, {
5937
- radius: radius,
5938
- width: 2 * radius,
5939
- height: 2 * radius
5940
- });
7084
+ var point = data[i];
7085
+ var radius = radii ? radii[i] : 0; // #1737
7086
+ if (isNumber(radius) && radius >= minPxSize / 2) {
7087
+ // Shape arguments
7088
+ point.marker = extend(point.marker, {
7089
+ radius: radius,
7090
+ width: 2 * radius,
7091
+ height: 2 * radius
7092
+ });
5941
7093
  // Alignment box for the data label
5942
7094
  point.dlBox = {
5943
7095
  x: point.plotX - radius,
@@ -5952,6 +7104,41 @@
5952
7104
  }
5953
7105
  }
5954
7106
  };
7107
+ BubbleSeries.prototype.getPxExtremes = function () {
7108
+ var smallestSize = Math.min(this.chart.plotWidth,
7109
+ this.chart.plotHeight);
7110
+ var getPxSize = function (length) {
7111
+ var isPercent;
7112
+ if (typeof length === 'string') {
7113
+ isPercent = /%$/.test(length);
7114
+ length = parseInt(length, 10);
7115
+ }
7116
+ return isPercent ? smallestSize * length / 100 : length;
7117
+ };
7118
+ var minPxSize = getPxSize(pick(this.options.minSize, 8));
7119
+ // Prioritize min size if conflict to make sure bubbles are
7120
+ // always visible. #5873
7121
+ var maxPxSize = Math.max(getPxSize(pick(this.options.maxSize, '20%')),
7122
+ minPxSize);
7123
+ return { minPxSize: minPxSize, maxPxSize: maxPxSize };
7124
+ };
7125
+ BubbleSeries.prototype.getZExtremes = function () {
7126
+ var options = this.options,
7127
+ zData = (this.zData || []).filter(isNumber);
7128
+ if (zData.length) {
7129
+ var zMin = pick(options.zMin,
7130
+ clamp(arrayMin(zData),
7131
+ options.displayNegative === false ?
7132
+ (options.zThreshold || 0) :
7133
+ -Number.MAX_VALUE,
7134
+ Number.MAX_VALUE));
7135
+ var zMax = pick(options.zMax,
7136
+ arrayMax(zData));
7137
+ if (isNumber(zMin) && isNumber(zMax)) {
7138
+ return { zMin: zMin, zMax: zMax };
7139
+ }
7140
+ }
7141
+ };
5955
7142
  BubbleSeries.compose = BubbleLegendComposition.compose;
5956
7143
  /**
5957
7144
  * A bubble series is a three dimensional series type where each point
@@ -6204,6 +7391,10 @@
6204
7391
  specialGroup: 'group',
6205
7392
  zoneAxis: 'z'
6206
7393
  });
7394
+ // On updated data in any series, delete the chart-level Z extremes cache
7395
+ addEvent(BubbleSeries, 'updatedData', function (e) {
7396
+ delete e.target.chart.bubbleZExtremes;
7397
+ });
6207
7398
  /* *
6208
7399
  *
6209
7400
  * Axis ?
@@ -6220,70 +7411,36 @@
6220
7411
  isXAxis = this.isXAxis,
6221
7412
  dataKey = isXAxis ? 'xData' : 'yData',
6222
7413
  min = this.min,
6223
- extremes = {},
6224
- smallestSize = Math.min(chart.plotWidth,
6225
- chart.plotHeight),
6226
- zMin = Number.MAX_VALUE,
6227
- zMax = -Number.MAX_VALUE,
6228
7414
  range = this.max - min,
6229
7415
  transA = axisLength / range,
6230
- activeSeries = [];
7416
+ hasActiveSeries;
6231
7417
  // Handle padding on the second pass, or on redraw
6232
7418
  this.series.forEach(function (series) {
6233
- var seriesOptions = series.options,
6234
- zData;
6235
7419
  if (series.bubblePadding &&
6236
7420
  (series.visible || !chart.options.chart.ignoreHiddenSeries)) {
6237
7421
  // Correction for #1673
6238
7422
  axis.allowZoomOutside = true;
6239
- // Cache it
6240
- activeSeries.push(series);
6241
- if (isXAxis) { // because X axis is evaluated first
6242
- // For each series, translate the size extremes to pixel values
6243
- ['minSize', 'maxSize'].forEach(function (prop) {
6244
- var length = seriesOptions[prop],
6245
- isPercent = /%$/.test(length);
6246
- length = pInt(length);
6247
- extremes[prop] = isPercent ?
6248
- smallestSize * length / 100 :
6249
- length;
6250
- });
6251
- series.minPxSize = extremes.minSize;
6252
- // Prioritize min size if conflict to make sure bubbles are
6253
- // always visible. #5873
6254
- series.maxPxSize = Math.max(extremes.maxSize, extremes.minSize);
6255
- // Find the min and max Z
6256
- zData = series.zData.filter(isNumber);
6257
- if (zData.length) { // #1735
6258
- zMin = pick(seriesOptions.zMin, clamp(arrayMin(zData), seriesOptions.displayNegative === false ?
6259
- seriesOptions.zThreshold :
6260
- -Number.MAX_VALUE, zMin));
6261
- zMax = pick(seriesOptions.zMax, Math.max(zMax, arrayMax(zData)));
6262
- }
7423
+ hasActiveSeries = true;
7424
+ var data = series[dataKey];
7425
+ if (isXAxis) {
7426
+ series.getRadii(0, 0, series);
6263
7427
  }
6264
- }
6265
- });
6266
- activeSeries.forEach(function (series) {
6267
- var data = series[dataKey],
6268
- i = data.length,
6269
- radius;
6270
- if (isXAxis) {
6271
- series.getRadii(zMin, zMax, series);
6272
- }
6273
- if (range > 0) {
6274
- while (i--) {
6275
- if (isNumber(data[i]) &&
6276
- axis.dataMin <= data[i] &&
6277
- data[i] <= axis.max) {
6278
- radius = series.radii ? series.radii[i] : 0;
6279
- pxMin = Math.min(((data[i] - min) * transA) - radius, pxMin);
6280
- pxMax = Math.max(((data[i] - min) * transA) + radius, pxMax);
7428
+ if (range > 0) {
7429
+ var i = data.length;
7430
+ while (i--) {
7431
+ if (isNumber(data[i]) &&
7432
+ axis.dataMin <= data[i] &&
7433
+ data[i] <= axis.max) {
7434
+ var radius = series.radii && series.radii[i] || 0;
7435
+ pxMin = Math.min(((data[i] - min) * transA) - radius, pxMin);
7436
+ pxMax = Math.max(((data[i] - min) * transA) + radius, pxMax);
7437
+ }
6281
7438
  }
6282
7439
  }
6283
7440
  }
6284
7441
  });
6285
7442
  // Apply the padding to the min and max properties
6286
- if (activeSeries.length && range > 0 && !this.logarithmic) {
7443
+ if (hasActiveSeries && range > 0 && !this.logarithmic) {
6287
7444
  pxMax -= axisLength;
6288
7445
  transA *= (axisLength +
6289
7446
  Math.max(0, pxMin) - // #8901
@@ -6477,9 +7634,6 @@
6477
7634
  };
6478
7635
  return MapBubblePoint;
6479
7636
  }(BubbleSeries.prototype.pointClass));
6480
- extend(MapBubblePoint.prototype, {
6481
- ttBelow: false
6482
- });
6483
7637
  /* *
6484
7638
  *
6485
7639
  * Default Export
@@ -6514,6 +7668,7 @@
6514
7668
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6515
7669
  };
6516
7670
  })();
7671
+ var MapPointSeries = SeriesRegistry.seriesTypes.mappoint;
6517
7672
  var extend = U.extend,
6518
7673
  merge = U.merge;
6519
7674
  /* *
@@ -6543,6 +7698,11 @@
6543
7698
  _this.points = void 0;
6544
7699
  return _this;
6545
7700
  }
7701
+ MapBubbleSeries.prototype.translate = function () {
7702
+ MapPointSeries.prototype.translate.call(this);
7703
+ this.getRadii();
7704
+ this.translateBubble();
7705
+ };
6546
7706
  /* *
6547
7707
  *
6548
7708
  * Static Properties
@@ -6678,12 +7838,15 @@
6678
7838
  }(BubbleSeries));
6679
7839
  extend(MapBubbleSeries.prototype, {
6680
7840
  type: 'mapbubble',
6681
- getBox: MapSeries.prototype.getBox,
7841
+ axisTypes: ['colorAxis'],
7842
+ getProjectedBounds: MapSeries.prototype.getProjectedBounds,
7843
+ isCartesian: false,
6682
7844
  // If one single value is passed, it is interpreted as z
6683
7845
  pointArrayMap: ['z'],
6684
7846
  pointClass: MapBubblePoint,
6685
7847
  setData: MapSeries.prototype.setData,
6686
7848
  setOptions: MapSeries.prototype.setOptions,
7849
+ useMapGeometry: true,
6687
7850
  xyFromShape: true
6688
7851
  });
6689
7852
  SeriesRegistry.registerSeriesType('mapbubble', MapBubbleSeries);
@@ -6761,7 +7924,7 @@
6761
7924
 
6762
7925
  return MapBubbleSeries;
6763
7926
  });
6764
- _registerModule(_modules, 'Series/Heatmap/HeatmapPoint.js', [_modules['Mixins/ColorMapSeries.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (ColorMapMixin, SeriesRegistry, U) {
7927
+ _registerModule(_modules, 'Series/Heatmap/HeatmapPoint.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) {
6765
7928
  /* *
6766
7929
  *
6767
7930
  * (c) 2010-2021 Torstein Honsi
@@ -6787,9 +7950,9 @@
6787
7950
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6788
7951
  };
6789
7952
  })();
6790
- var colorMapPointMixin = ColorMapMixin.colorMapPointMixin;
6791
7953
  var ScatterPoint = SeriesRegistry.seriesTypes.scatter.prototype.pointClass;
6792
7954
  var clamp = U.clamp,
7955
+ defined = U.defined,
6793
7956
  extend = U.extend,
6794
7957
  pick = U.pick;
6795
7958
  /* *
@@ -6828,7 +7991,8 @@
6828
7991
  var point = _super.prototype.applyOptions.call(this,
6829
7992
  options,
6830
7993
  x);
6831
- point.formatPrefix = point.isNull || point.value === null ? 'null' : 'point';
7994
+ point.formatPrefix = point.isNull || point.value === null ?
7995
+ 'null' : 'point';
6832
7996
  return point;
6833
7997
  };
6834
7998
  HeatmapPoint.prototype.getCellAttributes = function () {
@@ -6867,22 +8031,22 @@
6867
8031
  false,
6868
8032
  true) || 0)), -yAxis.len, 2 * yAxis.len)
6869
8033
  };
8034
+ var dimensions = [['width', 'x'], ['height', 'y']];
6870
8035
  // Handle marker's fixed width, and height values including border
6871
8036
  // and pointPadding while calculating cell attributes.
6872
- [['width', 'x'], ['height', 'y']].forEach(function (dimension) {
8037
+ dimensions.forEach(function (dimension) {
6873
8038
  var prop = dimension[0],
6874
8039
  direction = dimension[1];
6875
8040
  var start = direction + '1', end = direction + '2';
6876
8041
  var side = Math.abs(cellAttr[start] - cellAttr[end]),
6877
8042
  borderWidth = markerOptions &&
6878
8043
  markerOptions.lineWidth || 0,
6879
- plotPos = Math.abs(cellAttr[start] + cellAttr[end]) / 2;
6880
- if (markerOptions[prop] &&
6881
- markerOptions[prop] < side) {
6882
- cellAttr[start] = plotPos - (markerOptions[prop] / 2) -
6883
- (borderWidth / 2);
6884
- cellAttr[end] = plotPos + (markerOptions[prop] / 2) +
6885
- (borderWidth / 2);
8044
+ plotPos = Math.abs(cellAttr[start] + cellAttr[end]) / 2,
8045
+ widthOrHeight = markerOptions && markerOptions[prop];
8046
+ if (defined(widthOrHeight) && widthOrHeight < side) {
8047
+ var halfCellSize = widthOrHeight / 2 + borderWidth / 2;
8048
+ cellAttr[start] = plotPos - halfCellSize;
8049
+ cellAttr[end] = plotPos + halfCellSize;
6886
8050
  }
6887
8051
  // Handle pointPadding
6888
8052
  if (pointPadding) {
@@ -6931,8 +8095,9 @@
6931
8095
  return HeatmapPoint;
6932
8096
  }(ScatterPoint));
6933
8097
  extend(HeatmapPoint.prototype, {
6934
- dataLabelOnNull: colorMapPointMixin.dataLabelOnNull,
6935
- moveToTopOnHover: colorMapPointMixin.moveToTopOnHover
8098
+ dataLabelOnNull: true,
8099
+ moveToTopOnHover: true,
8100
+ ttBelow: false
6936
8101
  });
6937
8102
  /* *
6938
8103
  *
@@ -6942,7 +8107,7 @@
6942
8107
 
6943
8108
  return HeatmapPoint;
6944
8109
  });
6945
- _registerModule(_modules, 'Series/Heatmap/HeatmapSeries.js', [_modules['Core/Color/Color.js'], _modules['Mixins/ColorMapSeries.js'], _modules['Series/Heatmap/HeatmapPoint.js'], _modules['Core/Legend/LegendSymbol.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (Color, ColorMapMixin, HeatmapPoint, LegendSymbol, palette, SeriesRegistry, SVGRenderer, U) {
8110
+ _registerModule(_modules, 'Series/Heatmap/HeatmapSeries.js', [_modules['Core/Color/Color.js'], _modules['Series/ColorMapMixin.js'], _modules['Series/Heatmap/HeatmapPoint.js'], _modules['Core/Legend/LegendSymbol.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (Color, ColorMapMixin, HeatmapPoint, LegendSymbol, SeriesRegistry, SVGRenderer, U) {
6946
8111
  /* *
6947
8112
  *
6948
8113
  * (c) 2010-2021 Torstein Honsi
@@ -6968,7 +8133,6 @@
6968
8133
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6969
8134
  };
6970
8135
  })();
6971
- var colorMapSeriesMixin = ColorMapMixin.colorMapSeriesMixin;
6972
8136
  var Series = SeriesRegistry.series,
6973
8137
  _a = SeriesRegistry.seriesTypes,
6974
8138
  ColumnSeries = _a.column,
@@ -7034,11 +8198,25 @@
7034
8198
  this.points.forEach(function (point) {
7035
8199
  if (point.graphic) {
7036
8200
  point.graphic[_this.chart.styledMode ? 'css' : 'animate'](_this.colorAttribs(point));
8201
+ // @todo
8202
+ // Applying the border radius here is not optimal. It should
8203
+ // be set in the shapeArgs or returned from `markerAttribs`.
8204
+ // However, Series.drawPoints does not pick up markerAttribs
8205
+ // to be passed over to `renderer.symbol`. Also, image
8206
+ // symbols are not positioned by their top left corner like
8207
+ // other symbols are. This should be refactored, then we
8208
+ // could save ourselves some tests for .hasImage etc. And
8209
+ // the evaluation of borderRadius would be moved to
8210
+ // `markerAttribs`.
7037
8211
  if (_this.options.borderRadius) {
7038
8212
  point.graphic.attr({
7039
8213
  r: _this.options.borderRadius
7040
8214
  });
7041
8215
  }
8216
+ // Saving option for reapplying later
8217
+ // when changing point's states (#16165)
8218
+ (point.shapeArgs || {}).r = _this.options.borderRadius;
8219
+ (point.shapeArgs || {}).d = point.graphic.pathArray;
7042
8220
  if (point.value === null) { // #15708
7043
8221
  point.graphic.addClass('highcharts-null-point');
7044
8222
  }
@@ -7113,10 +8291,10 @@
7113
8291
  y: point.plotY
7114
8292
  };
7115
8293
  }
7116
- // Setting width and height attributes on image does not affect
7117
- // on its dimensions.
8294
+ // Setting width and height attributes on image does not affect on its
8295
+ // dimensions.
7118
8296
  if (state) {
7119
- seriesStateOptions = seriesMarkerOptions.states[state] || {};
8297
+ seriesStateOptions = (seriesMarkerOptions.states[state] || {});
7120
8298
  pointStateOptions = pointMarkerOptions.states &&
7121
8299
  pointMarkerOptions.states[state] || {};
7122
8300
  [['width', 'x'], ['height', 'y']].forEach(function (dimension) {
@@ -7334,7 +8512,7 @@
7334
8512
  *
7335
8513
  * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
7336
8514
  */
7337
- nullColor: palette.neutralColor3,
8515
+ nullColor: "#f7f7f7" /* neutralColor3 */,
7338
8516
  dataLabels: {
7339
8517
  formatter: function () {
7340
8518
  var numberFormatter = this.series.chart.numberFormatter;
@@ -7519,9 +8697,9 @@
7519
8697
  * @private
7520
8698
  */
7521
8699
  alignDataLabel: ColumnSeries.prototype.alignDataLabel,
7522
- axisTypes: colorMapSeriesMixin.axisTypes,
7523
- colorAttribs: colorMapSeriesMixin.colorAttribs,
7524
- colorKey: colorMapSeriesMixin.colorKey,
8700
+ axisTypes: ColorMapMixin.SeriesMixin.axisTypes,
8701
+ colorAttribs: ColorMapMixin.SeriesMixin.colorAttribs,
8702
+ colorKey: ColorMapMixin.SeriesMixin.colorKey,
7525
8703
  directTouch: true,
7526
8704
  /**
7527
8705
  * @private
@@ -7529,10 +8707,10 @@
7529
8707
  drawLegendSymbol: LegendSymbol.drawRectangle,
7530
8708
  getExtremesFromAll: true,
7531
8709
  getSymbol: Series.prototype.getSymbol,
7532
- parallelArrays: colorMapSeriesMixin.parallelArrays,
8710
+ parallelArrays: ColorMapMixin.SeriesMixin.parallelArrays,
7533
8711
  pointArrayMap: ['y', 'value'],
7534
8712
  pointClass: HeatmapPoint,
7535
- trackerGroups: colorMapSeriesMixin.trackerGroups
8713
+ trackerGroups: ColorMapMixin.SeriesMixin.trackerGroups
7536
8714
  });
7537
8715
  SeriesRegistry.registerSeriesType('heatmap', HeatmapSeries);
7538
8716
  /* *
@@ -8051,6 +9229,11 @@
8051
9229
  * @name Highcharts.MapLatLonObject#lon
8052
9230
  * @type {number}
8053
9231
  */
9232
+ /**
9233
+ * An array of longitude, latitude.
9234
+ *
9235
+ * @typedef {Array<number>} Highcharts.LonLatArray
9236
+ */
8054
9237
  ''; // detach doclets above
8055
9238
  /* eslint-disable no-invalid-this, valid-jsdoc */
8056
9239
  /**
@@ -8106,13 +9289,11 @@
8106
9289
  * In case of loading the library from a `script` tag,
8107
9290
  * this option is not needed, it will be loaded from there by default.
8108
9291
  *
8109
- * @type {function}
8110
- * @product highmaps
8111
- * @apioption chart.proj4
9292
+ * @type {Function}
9293
+ * @product highmaps
9294
+ * @apioption chart.proj4
8112
9295
  */
8113
- var proj4 = (this.userOptions.chart &&
8114
- this.userOptions.chart.proj4 ||
8115
- win.proj4);
9296
+ var proj4 = this.options.chart.proj4 || win.proj4;
8116
9297
  if (!proj4) {
8117
9298
  error(21, false, this);
8118
9299
  return {
@@ -8120,6 +9301,22 @@
8120
9301
  y: null
8121
9302
  };
8122
9303
  }
9304
+ var _a = transform.jsonmarginX,
9305
+ jsonmarginX = _a === void 0 ? 0 : _a,
9306
+ _b = transform.jsonmarginY,
9307
+ jsonmarginY = _b === void 0 ? 0 : _b,
9308
+ _c = transform.jsonres,
9309
+ jsonres = _c === void 0 ? 1 : _c,
9310
+ _d = transform.scale,
9311
+ scale = _d === void 0 ? 1 : _d,
9312
+ _e = transform.xoffset,
9313
+ xoffset = _e === void 0 ? 0 : _e,
9314
+ _f = transform.xpan,
9315
+ xpan = _f === void 0 ? 0 : _f,
9316
+ _g = transform.yoffset,
9317
+ yoffset = _g === void 0 ? 0 : _g,
9318
+ _h = transform.ypan,
9319
+ ypan = _h === void 0 ? 0 : _h;
8123
9320
  var projected = proj4(transform.crs,
8124
9321
  [latLon.lon,
8125
9322
  latLon.lat]),
@@ -8132,12 +9329,8 @@
8132
9329
  -projected[0] * sinAngle + projected[1] * cosAngle
8133
9330
  ] : projected;
8134
9331
  return {
8135
- x: ((rotated[0] - (transform.xoffset || 0)) * (transform.scale || 1) +
8136
- (transform.xpan || 0)) * (transform.jsonres || 1) +
8137
- (transform.jsonmarginX || 0),
8138
- y: (((transform.yoffset || 0) - rotated[1]) * (transform.scale || 1) +
8139
- (transform.ypan || 0)) * (transform.jsonres || 1) -
8140
- (transform.jsonmarginY || 0)
9332
+ x: ((rotated[0] - xoffset) * scale + xpan) * jsonres + jsonmarginX,
9333
+ y: -(((yoffset - rotated[1]) * scale + ypan) * jsonres - jsonmarginY)
8141
9334
  };
8142
9335
  };
8143
9336
  /**
@@ -8163,18 +9356,33 @@
8163
9356
  * An object with `lat` and `lon` properties.
8164
9357
  */
8165
9358
  Chart.prototype.transformToLatLon = function (point, transform) {
8166
- if (typeof win.proj4 === 'undefined') {
9359
+ var proj4 = this.options.chart.proj4 || win.proj4;
9360
+ if (!proj4) {
8167
9361
  error(21, false, this);
8168
9362
  return;
8169
9363
  }
9364
+ if (point.y === null) {
9365
+ return;
9366
+ }
9367
+ var _a = transform.jsonmarginX,
9368
+ jsonmarginX = _a === void 0 ? 0 : _a,
9369
+ _b = transform.jsonmarginY,
9370
+ jsonmarginY = _b === void 0 ? 0 : _b,
9371
+ _c = transform.jsonres,
9372
+ jsonres = _c === void 0 ? 1 : _c,
9373
+ _d = transform.scale,
9374
+ scale = _d === void 0 ? 1 : _d,
9375
+ _e = transform.xoffset,
9376
+ xoffset = _e === void 0 ? 0 : _e,
9377
+ _f = transform.xpan,
9378
+ xpan = _f === void 0 ? 0 : _f,
9379
+ _g = transform.yoffset,
9380
+ yoffset = _g === void 0 ? 0 : _g,
9381
+ _h = transform.ypan,
9382
+ ypan = _h === void 0 ? 0 : _h;
8170
9383
  var normalized = {
8171
- x: ((point.x -
8172
- (transform.jsonmarginX || 0)) / (transform.jsonres || 1) -
8173
- (transform.xpan || 0)) / (transform.scale || 1) +
8174
- (transform.xoffset || 0),
8175
- y: ((-point.y - (transform.jsonmarginY || 0)) / (transform.jsonres || 1) +
8176
- (transform.ypan || 0)) / (transform.scale || 1) +
8177
- (transform.yoffset || 0)
9384
+ x: ((point.x - jsonmarginX) / jsonres - xpan) / scale + xoffset,
9385
+ y: ((point.y - jsonmarginY) / jsonres + ypan) / scale + yoffset
8178
9386
  },
8179
9387
  cosAngle = transform.cosAngle ||
8180
9388
  (transform.rotation && Math.cos(transform.rotation)),
@@ -8207,16 +9415,15 @@
8207
9415
  * An object with `lat` and `lon` properties.
8208
9416
  */
8209
9417
  Chart.prototype.fromPointToLatLon = function (point) {
8210
- var transforms = this.mapTransforms,
8211
- transform;
9418
+ var transforms = this.mapTransforms;
8212
9419
  if (!transforms) {
8213
9420
  error(22, false, this);
8214
9421
  return;
8215
9422
  }
8216
- for (transform in transforms) {
9423
+ for (var transform in transforms) {
8217
9424
  if (Object.hasOwnProperty.call(transforms, transform) &&
8218
9425
  transforms[transform].hitZone &&
8219
- pointInPolygon({ x: point.x, y: -point.y }, transforms[transform].hitZone.coordinates[0])) {
9426
+ pointInPolygon(point, transforms[transform].hitZone.coordinates[0])) {
8220
9427
  return this.transformToLatLon(point, transforms[transform]);
8221
9428
  }
8222
9429
  }
@@ -8255,7 +9462,7 @@
8255
9462
  if (Object.hasOwnProperty.call(transforms, transform) &&
8256
9463
  transforms[transform].hitZone) {
8257
9464
  coords = this.transformFromLatLon(latLon, transforms[transform]);
8258
- if (pointInPolygon({ x: coords.x, y: -coords.y }, transforms[transform].hitZone.coordinates[0])) {
9465
+ if (pointInPolygon(coords, transforms[transform].hitZone.coordinates[0])) {
8259
9466
  return coords;
8260
9467
  }
8261
9468
  }
@@ -8294,64 +9501,36 @@
8294
9501
  * An object ready for the `mapData` option.
8295
9502
  */
8296
9503
  H.geojson = function (geojson, hType, series) {
8297
- var mapData = [],
8298
- path = [],
8299
- polygonToPath = function (polygon) {
8300
- polygon.forEach(function (point,
8301
- i) {
8302
- if (i === 0) {
8303
- path.push(['M',
8304
- point[0], -point[1]]);
8305
- }
8306
- else {
8307
- path.push(['L', point[0], -point[1]]);
8308
- }
8309
- });
8310
- };
8311
- hType = hType || 'map';
9504
+ if (hType === void 0) { hType = 'map'; }
9505
+ var mapData = [];
9506
+ var path = [];
8312
9507
  geojson.features.forEach(function (feature) {
8313
- var geometry = feature.geometry,
9508
+ var geometry = feature.geometry || {},
8314
9509
  type = geometry.type,
8315
9510
  coordinates = geometry.coordinates,
8316
9511
  properties = feature.properties,
8317
- point;
9512
+ pointOptions;
8318
9513
  path = [];
8319
- if (hType === 'map' || hType === 'mapbubble') {
8320
- if (type === 'Polygon') {
8321
- coordinates.forEach(polygonToPath);
8322
- path.push(['Z']);
8323
- }
8324
- else if (type === 'MultiPolygon') {
8325
- coordinates.forEach(function (items) {
8326
- items.forEach(polygonToPath);
8327
- });
8328
- path.push(['Z']);
8329
- }
8330
- if (path.length) {
8331
- point = { path: path };
9514
+ if ((hType === 'map' || hType === 'mapbubble') &&
9515
+ (type === 'Polygon' || type === 'MultiPolygon')) {
9516
+ if (coordinates.length) {
9517
+ pointOptions = { geometry: { coordinates: coordinates, type: type } };
8332
9518
  }
8333
9519
  }
8334
- else if (hType === 'mapline') {
8335
- if (type === 'LineString') {
8336
- polygonToPath(coordinates);
8337
- }
8338
- else if (type === 'MultiLineString') {
8339
- coordinates.forEach(polygonToPath);
8340
- }
8341
- if (path.length) {
8342
- point = { path: path };
9520
+ else if (hType === 'mapline' &&
9521
+ (type === 'LineString' ||
9522
+ type === 'MultiLineString')) {
9523
+ if (coordinates.length) {
9524
+ pointOptions = { geometry: { coordinates: coordinates, type: type } };
8343
9525
  }
8344
9526
  }
8345
- else if (hType === 'mappoint') {
8346
- if (type === 'Point') {
8347
- point = {
8348
- x: coordinates[0],
8349
- y: -coordinates[1]
8350
- };
9527
+ else if (hType === 'mappoint' && type === 'Point') {
9528
+ if (coordinates.length) {
9529
+ pointOptions = { geometry: { coordinates: coordinates, type: type } };
8351
9530
  }
8352
9531
  }
8353
- if (point) {
8354
- mapData.push(extend(point, {
9532
+ if (pointOptions) {
9533
+ mapData.push(extend(pointOptions, {
8355
9534
  name: properties.name || properties.NAME,
8356
9535
  /**
8357
9536
  * In Highmaps, when data is loaded from GeoJSON, the GeoJSON