highcharts 9.2.2 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -6
- package/bower.json +1 -1
- package/css/annotations/popup.css +48 -8
- package/css/annotations/popup.scss +70 -22
- package/css/highcharts.css +45 -0
- package/css/highcharts.scss +40 -0
- package/css/themes/dark-unica.css +45 -0
- package/css/themes/grid-light.css +45 -0
- package/css/themes/sand-signika.css +45 -0
- package/es-modules/Accessibility/A11yI18n.js +273 -224
- package/es-modules/Accessibility/Accessibility.js +233 -128
- package/es-modules/Accessibility/AccessibilityComponent.js +79 -314
- package/es-modules/Accessibility/Components/AnnotationsA11y.js +10 -0
- package/es-modules/Accessibility/Components/ContainerComponent.js +52 -27
- package/es-modules/Accessibility/Components/InfoRegionsComponent.js +46 -23
- package/es-modules/Accessibility/Components/LegendComponent.js +97 -65
- package/es-modules/Accessibility/Components/MenuComponent.js +59 -40
- package/es-modules/Accessibility/Components/RangeSelectorComponent.js +5 -8
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +152 -115
- package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +133 -68
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js +64 -27
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +38 -21
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +380 -325
- package/es-modules/Accessibility/Components/ZoomComponent.js +28 -20
- package/es-modules/Accessibility/FocusBorder.js +192 -147
- package/es-modules/Accessibility/HighContrastMode.js +78 -66
- package/es-modules/Accessibility/HighContrastTheme.js +10 -0
- package/es-modules/Accessibility/KeyboardNavigation.js +144 -70
- package/es-modules/Accessibility/KeyboardNavigationHandler.js +71 -44
- package/es-modules/Accessibility/Options/DeprecatedOptions.js +11 -1
- package/es-modules/Accessibility/Options/LangOptions.js +1 -2
- package/es-modules/Accessibility/Options/Options.js +32 -17
- package/es-modules/Accessibility/ProxyElement.js +212 -0
- package/es-modules/Accessibility/ProxyProvider.js +305 -0
- package/es-modules/Accessibility/Utils/Announcer.js +15 -8
- package/es-modules/Accessibility/Utils/ChartUtilities.js +41 -16
- package/es-modules/Accessibility/Utils/DOMElementProvider.js +27 -15
- package/es-modules/Accessibility/Utils/EventProvider.js +27 -17
- package/es-modules/Accessibility/Utils/HTMLUtilities.js +125 -30
- package/es-modules/Core/Axis/Axis.js +37 -30
- package/es-modules/Core/Axis/AxisDefaults.js +35 -24
- package/es-modules/Core/Axis/Color/ColorAxisComposition.js +54 -4
- package/es-modules/Core/Axis/Color/ColorAxisDefaults.js +5 -5
- package/es-modules/Core/Axis/OrdinalAxis.js +8 -12
- package/es-modules/Core/Axis/PlotLineOrBand/PlotLineOrBand.js +4 -5
- package/es-modules/Core/Axis/ScrollbarAxis.js +10 -3
- package/es-modules/Core/Axis/TreeGridAxis.js +2 -2
- package/es-modules/Core/Axis/TreeGridTick.js +1 -2
- package/es-modules/Core/Chart/Chart.js +2 -3
- package/es-modules/Core/Chart/ChartDefaults.js +3 -4
- package/es-modules/Core/Chart/ChartNavigationComposition.js +92 -0
- package/es-modules/Core/Chart/MapChart.js +10 -22
- package/es-modules/Core/Chart/StockChart.js +3 -293
- package/es-modules/Core/Color/Palettes.js +22 -0
- package/es-modules/Core/DefaultOptions.js +19 -17
- package/es-modules/Core/Foundation.js +39 -31
- package/es-modules/Core/Globals.js +1 -1
- package/es-modules/Core/HttpUtilities.js +3 -3
- package/es-modules/Core/Legend/Legend.js +7 -3
- package/es-modules/Core/Navigator.js +7 -8
- package/es-modules/Core/Pointer.js +39 -36
- package/es-modules/Core/Renderer/HTML/AST.js +2 -0
- package/es-modules/Core/Renderer/HTML/HTMLElement.js +23 -18
- package/es-modules/Core/Renderer/SVG/SVGElement.js +3 -4
- package/es-modules/Core/Renderer/SVG/SVGRenderer.js +21 -18
- package/es-modules/Core/Renderer/SVG/TextBuilder.js +3 -3
- package/es-modules/Core/ScrollbarDefaults.js +10 -9
- package/es-modules/Core/Series/DataLabel.js +2 -3
- package/es-modules/Core/Series/Point.js +5 -3
- package/es-modules/Core/Series/Series.js +153 -162
- package/es-modules/Core/Series/SeriesDefaults.js +3 -4
- package/es-modules/Core/Series/SeriesRegistry.js +1 -2
- package/es-modules/Core/Tooltip.js +44 -17
- package/es-modules/Core/Utilities.js +15 -7
- package/es-modules/Data/DataConverter.js +489 -0
- package/es-modules/Data/DataPromise.js +252 -0
- package/es-modules/Data/DataSeriesConverter.js +203 -0
- package/es-modules/Data/DataTable.js +1204 -0
- package/es-modules/Data/Modifiers/ChainModifier.js +299 -0
- package/es-modules/Data/Modifiers/DataModifier.js +303 -0
- package/es-modules/Data/Modifiers/GroupModifier.js +144 -0
- package/es-modules/Data/Modifiers/InvertModifier.js +254 -0
- package/es-modules/Data/Modifiers/RangeModifier.js +143 -0
- package/es-modules/Data/Modifiers/SeriesPointsModifier.js +110 -0
- package/es-modules/Data/Modifiers/SortModifier.js +249 -0
- package/es-modules/Data/Parsers/CSVParser.js +399 -0
- package/es-modules/Data/Parsers/DataParser.js +101 -0
- package/es-modules/Data/Parsers/GoogleSheetsParser.js +220 -0
- package/es-modules/Data/Parsers/HTMLTableParser.js +213 -0
- package/es-modules/Data/Stores/CSVStore.js +317 -0
- package/es-modules/Data/Stores/DataStore.js +276 -0
- package/es-modules/Data/Stores/GoogleSheetsStore.js +167 -0
- package/es-modules/Data/Stores/HTMLTableStore.js +351 -0
- package/es-modules/Extensions/Annotations/Annotations.js +61 -11
- package/es-modules/Extensions/Annotations/ControlPoint.js +1 -1
- package/es-modules/Extensions/Annotations/Controllables/ControllableEllipse.js +199 -0
- package/es-modules/Extensions/Annotations/Mixins/ControllableMixin.js +7 -1
- package/es-modules/Extensions/Annotations/NavigationBindings.js +68 -19
- package/es-modules/Extensions/Annotations/Popup.js +479 -141
- package/es-modules/Extensions/Annotations/Types/BasicAnnotation.js +51 -2
- package/es-modules/Extensions/Annotations/Types/CrookedLine.js +1 -1
- package/es-modules/Extensions/Annotations/Types/Fibonacci.js +2 -3
- package/es-modules/Extensions/Annotations/Types/FibonacciTimeZones.js +219 -0
- package/es-modules/Extensions/Annotations/Types/InfinityLine.js +1 -1
- package/es-modules/Extensions/Annotations/Types/Measure.js +14 -8
- package/es-modules/Extensions/Annotations/Types/Pitchfork.js +5 -5
- package/es-modules/Extensions/Annotations/Types/TimeCycles.js +207 -0
- package/es-modules/Extensions/Annotations/Types/Tunnel.js +3 -5
- package/es-modules/Extensions/Annotations/Types/VerticalLine.js +1 -1
- package/es-modules/Extensions/Boost/BoostOverrides.js +3 -1
- package/es-modules/Extensions/Boost/WGLShader.js +4 -3
- package/es-modules/Extensions/BoostCanvas.js +1 -2
- package/es-modules/Extensions/CurrentDateIndication.js +2 -3
- package/es-modules/Extensions/DataGrouping.js +31 -18
- package/es-modules/Extensions/DownloadURL.js +2 -2
- package/es-modules/Extensions/DragPanes.js +1 -2
- package/es-modules/Extensions/Drilldown.js +2 -3
- package/es-modules/Extensions/Exporting/Exporting.js +8 -7
- package/es-modules/Extensions/Exporting/ExportingDefaults.js +8 -15
- package/es-modules/Extensions/GeoJSON.js +39 -63
- package/es-modules/Extensions/MarkerClusters.js +115 -97
- package/es-modules/Extensions/NoDataToDisplay.js +1 -2
- package/es-modules/Extensions/OfflineExporting/OfflineExporting.js +9 -8
- package/es-modules/Extensions/OfflineExporting/OfflineExportingDefaults.js +1 -1
- package/es-modules/Extensions/Oldie/Oldie.js +2 -3
- package/es-modules/Extensions/Pane.js +5 -6
- package/es-modules/Extensions/RangeSelector.js +3 -4
- package/es-modules/Extensions/Sonification/ChartSonify.js +247 -637
- package/es-modules/Extensions/Sonification/Earcon.js +136 -102
- package/es-modules/Extensions/Sonification/Instrument.js +496 -426
- package/es-modules/Extensions/Sonification/MusicalFrequencies.js +10 -0
- package/es-modules/Extensions/Sonification/Options.js +10 -0
- package/es-modules/Extensions/Sonification/PointSonify.js +203 -152
- package/es-modules/Extensions/Sonification/SeriesSonify.js +459 -0
- package/es-modules/Extensions/Sonification/SignalHandler.js +124 -0
- package/es-modules/Extensions/Sonification/Sonification.js +26 -52
- package/es-modules/Extensions/Sonification/{Utilities.js → SonificationUtilities.js} +62 -84
- package/es-modules/Extensions/Sonification/Timeline.js +255 -567
- package/es-modules/Extensions/Sonification/TimelineEvent.js +158 -0
- package/es-modules/Extensions/Sonification/TimelinePath.js +311 -0
- package/es-modules/Maps/MapNavigation.js +27 -64
- package/es-modules/Maps/MapNavigationOptionsDefault.js +3 -0
- package/es-modules/Maps/MapPointer.js +7 -5
- package/es-modules/Maps/MapView.js +450 -0
- package/es-modules/Maps/MapViewOptionsDefault.js +95 -0
- package/es-modules/Maps/Projection.js +433 -0
- package/es-modules/Maps/ProjectionDefinition.js +9 -0
- package/es-modules/Maps/Projections/EqualEarth.js +42 -0
- package/es-modules/Maps/Projections/Miller.js +17 -0
- package/es-modules/Maps/Projections/Orthographic.js +26 -0
- package/es-modules/Maps/Projections/ProjectionRegistry.js +17 -0
- package/es-modules/Maps/Projections/WebMercator.js +25 -0
- package/es-modules/Series/AreaRange/AreaRangeSeries.js +4 -5
- package/es-modules/Series/Bellcurve/BellcurveSeries.js +2 -8
- package/es-modules/Series/BoxPlot/BoxPlotSeries.js +1 -2
- package/es-modules/Series/Bubble/BubbleLegendDefaults.js +1 -2
- package/es-modules/Series/Bubble/BubbleLegendItem.js +3 -3
- package/es-modules/Series/Bubble/BubblePoint.js +5 -0
- package/es-modules/Series/Bubble/BubbleSeries.js +90 -50
- package/es-modules/Series/Candlestick/CandlestickSeries.js +10 -18
- package/es-modules/{Mixins/CenteredSeries.js → Series/CenteredUtilities.js} +45 -23
- package/es-modules/Series/ColorMapComposition.js +109 -0
- package/es-modules/Series/Column/ColumnDataLabel.js +5 -5
- package/es-modules/Series/Column/ColumnSeries.js +3 -4
- package/es-modules/Series/ColumnPyramid/ColumnPyramidSeries.js +6 -6
- package/es-modules/Series/DataModifyComposition.js +539 -0
- package/es-modules/Series/DependencyWheel/DependencyWheelPoint.js +2 -6
- package/es-modules/Series/DerivedComposition.js +137 -0
- package/es-modules/Series/DrawPointComposition.js +111 -0
- package/es-modules/Series/Dumbbell/DumbbellSeries.js +2 -3
- package/es-modules/Series/ErrorBar/ErrorBarSeries.js +1 -2
- package/es-modules/Series/Flags/FlagsSeries.js +18 -25
- package/es-modules/Series/Funnel/FunnelSeries.js +6 -5
- package/es-modules/Series/Gantt/GanttSeries.js +0 -2
- package/es-modules/Series/Gauge/GaugePoint.js +1 -1
- package/es-modules/Series/Gauge/GaugeSeries.js +7 -7
- package/es-modules/Series/HLC/HLCPoint.js +55 -0
- package/es-modules/Series/HLC/HLCSeries.js +383 -0
- package/es-modules/Series/Heatmap/HeatmapPoint.js +3 -4
- package/es-modules/Series/Heatmap/HeatmapSeries.js +19 -6
- package/es-modules/Series/HeikinAshi/HeikinAshiSeries.js +2 -3
- package/es-modules/Series/Histogram/HistogramSeries.js +3 -7
- package/es-modules/Series/HollowCandlestick/HollowCandlestickSeries.js +9 -10
- package/es-modules/Series/Line/LineSeries.js +1 -2
- package/es-modules/Series/Map/MapPoint.js +23 -16
- package/es-modules/Series/Map/MapSeries.js +268 -309
- package/es-modules/Series/MapBubble/MapBubblePoint.js +0 -3
- package/es-modules/Series/MapBubble/MapBubbleSeries.js +10 -1
- package/es-modules/Series/MapPoint/MapPointPoint.js +5 -1
- package/es-modules/Series/MapPoint/MapPointSeries.js +87 -4
- package/es-modules/Series/Networkgraph/Networkgraph.js +5 -5
- package/es-modules/{Mixins/Nodes.js → Series/NodesComposition.js} +76 -29
- package/es-modules/Series/OHLC/OHLCPoint.js +2 -6
- package/es-modules/Series/OHLC/OHLCSeries.js +55 -183
- package/es-modules/{Mixins/OnSeries.js → Series/OnSeriesComposition.js} +53 -21
- package/es-modules/Series/Organization/OrganizationSeries.js +2 -3
- package/es-modules/Series/PackedBubble/PackedBubbleSeries.js +46 -6
- package/es-modules/Series/ParetoSeries/ParetoSeries.js +3 -7
- package/es-modules/Series/Pie/PieDataLabel.js +1 -2
- package/es-modules/Series/Pie/PieSeries.js +6 -7
- package/es-modules/Series/Sankey/SankeyPoint.js +0 -4
- package/es-modules/Series/Sankey/SankeySeries.js +89 -20
- package/es-modules/Series/Sunburst/SunburstPoint.js +2 -3
- package/es-modules/Series/Sunburst/SunburstSeries.js +4 -4
- package/es-modules/Series/Tilemap/TilemapPoint.js +2 -3
- package/es-modules/Series/Timeline/TimelineSeries.js +3 -4
- package/es-modules/{Mixins/TreeSeries.js → Series/TreeUtilities.js} +86 -76
- package/es-modules/Series/Treemap/TreemapPoint.js +2 -2
- package/es-modules/Series/Treemap/TreemapSeries.js +8 -8
- package/es-modules/Series/Venn/VennPoint.js +16 -7
- package/es-modules/Series/Venn/VennSeries.js +5 -8
- package/es-modules/Series/Venn/VennUtils.js +550 -439
- package/es-modules/Series/Waterfall/WaterfallSeries.js +2 -3
- package/es-modules/Series/Windbarb/WindbarbSeries.js +23 -24
- package/es-modules/Series/Wordcloud/WordcloudPoint.js +8 -6
- package/es-modules/Series/Wordcloud/WordcloudSeries.js +24 -20
- package/es-modules/Series/Wordcloud/WordcloudUtils.js +673 -484
- package/es-modules/Series/XRange/XRangePoint.js +1 -0
- package/es-modules/Stock/Indicators/ABands/ABandsIndicator.js +3 -6
- package/es-modules/Stock/Indicators/AO/AOIndicator.js +2 -3
- package/es-modules/Stock/Indicators/APO/APOIndicator.js +14 -20
- package/es-modules/Stock/Indicators/Aroon/AroonIndicator.js +3 -6
- package/es-modules/Stock/Indicators/AroonOscillator/AroonOscillatorIndicator.js +11 -13
- package/es-modules/Stock/Indicators/ArrayUtilities.js +47 -0
- package/es-modules/Stock/Indicators/BB/BBIndicator.js +27 -11
- package/es-modules/Stock/Indicators/Chaikin/ChaikinIndicator.js +6 -12
- package/es-modules/Stock/Indicators/DEMA/DEMAIndicator.js +1 -11
- package/es-modules/Stock/Indicators/DMI/DMIIndicator.js +19 -11
- package/es-modules/Stock/Indicators/DisparityIndex/DisparityIndexIndicator.js +17 -11
- package/es-modules/Stock/Indicators/EMA/EMAIndicator.js +1 -3
- package/es-modules/Stock/Indicators/KeltnerChannels/KeltnerChannelsIndicator.js +11 -9
- package/es-modules/Stock/Indicators/Klinger/KlingerIndicator.js +8 -16
- package/es-modules/Stock/Indicators/LinearRegression/LinearRegression.js +2 -2
- package/es-modules/Stock/Indicators/LinearRegressionAngle/LinearRegressionAngle.js +2 -2
- package/es-modules/Stock/Indicators/LinearRegressionIntercept/LinearRegressionIntercept.js +2 -2
- package/es-modules/Stock/Indicators/LinearRegressionSlopes/LinearRegressionSlopes.js +2 -2
- package/es-modules/Stock/Indicators/MACD/MACDIndicator.js +1 -2
- package/es-modules/{Mixins/MultipleLines.js → Stock/Indicators/MultipleLinesComposition.js} +136 -87
- package/es-modules/Stock/Indicators/NATR/NATRIndicator.js +1 -3
- package/es-modules/Stock/Indicators/PC/PCIndicator.js +14 -13
- package/es-modules/Stock/Indicators/PPO/PPOIndicator.js +1 -11
- package/es-modules/Stock/Indicators/SMA/SMAComposition.js +0 -26
- package/es-modules/Stock/Indicators/SMA/SMAIndicator.js +9 -32
- package/es-modules/Stock/Indicators/SlowStochastic/SlowStochasticIndicator.js +0 -8
- package/es-modules/Stock/Indicators/Stochastic/StochasticIndicator.js +15 -8
- package/es-modules/Stock/Indicators/Supertrend/SupertrendIndicator.js +4 -6
- package/es-modules/Stock/Indicators/TEMA/TEMAIndicator.js +26 -11
- package/es-modules/Stock/Indicators/TRIX/TRIXIndicator.js +6 -12
- package/es-modules/Stock/Indicators/VBP/VBPIndicator.js +20 -3
- package/es-modules/Stock/Indicators/WilliamsR/WilliamsRIndicator.js +2 -3
- package/es-modules/Stock/StockToolsBindings.js +144 -42
- package/es-modules/Stock/StockToolsGui.js +405 -11
- package/es-modules/masters/highcharts-3d.src.js +1 -1
- package/es-modules/masters/highcharts-gantt.src.js +1 -1
- package/es-modules/masters/highcharts-more.src.js +1 -1
- package/es-modules/masters/highcharts.src.js +1 -1
- package/es-modules/masters/highmaps.src.js +1 -1
- package/es-modules/masters/highstock.src.js +1 -1
- package/es-modules/masters/indicators/acceleration-bands.src.js +1 -1
- package/es-modules/masters/indicators/accumulation-distribution.src.js +1 -1
- package/es-modules/masters/indicators/ao.src.js +1 -1
- package/es-modules/masters/indicators/apo.src.js +1 -1
- package/es-modules/masters/indicators/aroon-oscillator.src.js +1 -1
- package/es-modules/masters/indicators/aroon.src.js +1 -1
- package/es-modules/masters/indicators/atr.src.js +1 -1
- package/es-modules/masters/indicators/bollinger-bands.src.js +1 -1
- package/es-modules/masters/indicators/cci.src.js +1 -1
- package/es-modules/masters/indicators/chaikin.src.js +1 -1
- package/es-modules/masters/indicators/cmf.src.js +1 -1
- package/es-modules/masters/indicators/cmo.src.js +1 -1
- package/es-modules/masters/indicators/dema.src.js +1 -1
- package/es-modules/masters/indicators/disparity-index.src.js +1 -1
- package/es-modules/masters/indicators/dmi.src.js +1 -1
- package/es-modules/masters/indicators/dpo.src.js +1 -1
- package/es-modules/masters/indicators/ema.src.js +4 -10
- package/es-modules/masters/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/es-modules/masters/indicators/indicators-all.src.js +2 -2
- package/es-modules/masters/indicators/indicators.src.js +2 -1
- package/es-modules/masters/indicators/keltner-channels.src.js +1 -1
- package/es-modules/masters/indicators/klinger.src.js +1 -1
- package/es-modules/masters/indicators/macd.src.js +1 -1
- package/es-modules/masters/indicators/mfi.src.js +1 -1
- package/es-modules/masters/indicators/momentum.src.js +1 -1
- package/es-modules/masters/indicators/natr.src.js +1 -1
- package/es-modules/masters/indicators/obv.src.js +1 -1
- package/es-modules/masters/indicators/pivot-points.src.js +1 -1
- package/es-modules/masters/indicators/ppo.src.js +1 -1
- package/es-modules/masters/indicators/price-channel.src.js +1 -1
- package/es-modules/masters/indicators/price-envelopes.src.js +1 -1
- package/es-modules/masters/indicators/psar.src.js +1 -1
- package/es-modules/masters/indicators/regressions.src.js +1 -1
- package/es-modules/masters/indicators/roc.src.js +1 -1
- package/es-modules/masters/indicators/rsi.src.js +1 -1
- package/es-modules/masters/indicators/slow-stochastic.src.js +1 -1
- package/es-modules/masters/indicators/stochastic.src.js +1 -1
- package/es-modules/masters/indicators/supertrend.src.js +1 -1
- package/es-modules/masters/indicators/tema.src.js +1 -1
- package/es-modules/masters/indicators/trendline.src.js +1 -1
- package/es-modules/masters/indicators/trix.src.js +1 -1
- package/es-modules/masters/indicators/volume-by-price.src.js +1 -1
- package/es-modules/masters/indicators/vwap.src.js +1 -1
- package/es-modules/masters/indicators/williams-r.src.js +1 -1
- package/es-modules/masters/indicators/wma.src.js +1 -1
- package/es-modules/masters/indicators/zigzag.src.js +1 -1
- package/es-modules/masters/modules/accessibility.src.js +16 -2
- package/es-modules/masters/modules/annotations-advanced.src.js +3 -1
- package/es-modules/masters/modules/annotations.src.js +1 -1
- package/es-modules/masters/modules/arrow-symbols.src.js +1 -1
- package/es-modules/masters/modules/boost-canvas.src.js +1 -1
- package/es-modules/masters/modules/boost.src.js +1 -1
- package/es-modules/masters/modules/broken-axis.src.js +1 -1
- package/es-modules/masters/modules/bullet.src.js +1 -1
- package/es-modules/masters/modules/coloraxis.src.js +1 -1
- package/es-modules/masters/modules/current-date-indicator.src.js +1 -1
- package/es-modules/masters/modules/cylinder.src.js +1 -1
- package/es-modules/masters/modules/data.src.js +6 -3
- package/es-modules/masters/modules/datagrouping.src.js +1 -1
- package/es-modules/masters/modules/debugger.src.js +1 -1
- package/es-modules/masters/modules/dependency-wheel.src.js +1 -1
- package/es-modules/masters/modules/dotplot.src.js +1 -1
- package/es-modules/masters/modules/drag-panes.src.js +1 -1
- package/es-modules/masters/modules/draggable-points.src.js +1 -1
- package/es-modules/masters/modules/drilldown.src.js +1 -1
- package/es-modules/masters/modules/dumbbell.src.js +1 -1
- package/es-modules/masters/modules/export-data.src.js +1 -1
- package/es-modules/masters/modules/exporting.src.js +1 -1
- package/es-modules/masters/modules/full-screen.src.js +1 -1
- package/es-modules/masters/modules/funnel.src.js +1 -1
- package/es-modules/masters/modules/funnel3d.src.js +1 -1
- package/es-modules/masters/modules/gantt.src.js +1 -1
- package/es-modules/masters/modules/grid-axis.src.js +1 -1
- package/es-modules/masters/modules/heatmap.src.js +1 -2
- package/es-modules/masters/modules/heikinashi.src.js +1 -1
- package/es-modules/masters/modules/histogram-bellcurve.src.js +1 -1
- package/es-modules/masters/modules/hollowcandlestick.src.js +1 -1
- package/es-modules/masters/modules/item-series.src.js +1 -1
- package/es-modules/masters/modules/lollipop.src.js +1 -1
- package/es-modules/masters/modules/map.src.js +1 -3
- package/es-modules/masters/modules/marker-clusters.src.js +1 -1
- package/es-modules/masters/modules/networkgraph.src.js +1 -1
- package/es-modules/masters/modules/no-data-to-display.src.js +1 -1
- package/es-modules/masters/modules/offline-exporting.src.js +1 -1
- package/es-modules/masters/modules/oldie-polyfills.src.js +1 -1
- package/es-modules/masters/modules/oldie.src.js +1 -1
- package/es-modules/masters/modules/organization.src.js +1 -1
- package/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
- package/es-modules/masters/modules/parallel-coordinates.src.js +1 -1
- package/es-modules/masters/modules/pareto.src.js +1 -1
- package/es-modules/masters/modules/pathfinder.src.js +1 -1
- package/es-modules/masters/modules/pattern-fill.src.js +1 -1
- package/es-modules/masters/modules/price-indicator.src.js +1 -1
- package/es-modules/masters/modules/pyramid3d.src.js +1 -1
- package/es-modules/masters/modules/sankey.src.js +1 -1
- package/es-modules/masters/modules/series-label.src.js +1 -1
- package/es-modules/masters/modules/solid-gauge.src.js +1 -1
- package/es-modules/masters/modules/sonification.src.js +33 -2
- package/es-modules/masters/modules/static-scale.src.js +1 -1
- package/es-modules/masters/modules/stock-tools.src.js +1 -1
- package/es-modules/masters/modules/stock.src.js +4 -1
- package/es-modules/masters/modules/streamgraph.src.js +1 -1
- package/es-modules/masters/modules/sunburst.src.js +1 -1
- package/es-modules/masters/modules/tilemap.src.js +1 -1
- package/es-modules/masters/modules/timeline.src.js +1 -1
- package/es-modules/masters/modules/treegrid.src.js +1 -1
- package/es-modules/masters/modules/treemap.src.js +1 -1
- package/es-modules/masters/modules/variable-pie.src.js +1 -1
- package/es-modules/masters/modules/variwide.src.js +1 -1
- package/es-modules/masters/modules/vector.src.js +1 -1
- package/es-modules/masters/modules/venn.src.js +1 -1
- package/es-modules/masters/modules/windbarb.src.js +1 -1
- package/es-modules/masters/modules/wordcloud.src.js +1 -1
- package/es-modules/masters/modules/xrange.src.js +1 -1
- package/es-modules/masters/themes/avocado.src.js +1 -1
- package/es-modules/masters/themes/dark-blue.src.js +1 -1
- package/es-modules/masters/themes/dark-green.src.js +1 -1
- package/es-modules/masters/themes/dark-unica.src.js +1 -1
- package/es-modules/masters/themes/gray.src.js +1 -1
- package/es-modules/masters/themes/grid-light.src.js +1 -1
- package/es-modules/masters/themes/grid.src.js +1 -1
- package/es-modules/masters/themes/high-contrast-dark.src.js +1 -1
- package/es-modules/masters/themes/high-contrast-light.src.js +1 -1
- package/es-modules/masters/themes/sand-signika.src.js +1 -1
- package/es-modules/masters/themes/skies.src.js +1 -1
- package/es-modules/masters/themes/sunset.src.js +1 -1
- package/highcharts-3d.js +1 -1
- package/highcharts-3d.src.js +1 -1
- package/highcharts-gantt.js +801 -804
- package/highcharts-gantt.js.map +1 -1
- package/highcharts-gantt.src.js +775 -739
- package/highcharts-more.js +194 -193
- package/highcharts-more.js.map +1 -1
- package/highcharts-more.src.js +207 -119
- package/highcharts.d.ts +9670 -4217
- package/highcharts.js +585 -588
- package/highcharts.js.map +1 -1
- package/highcharts.src.d.ts +9670 -4217
- package/highcharts.src.js +608 -587
- package/highmaps.js +726 -708
- package/highmaps.js.map +1 -1
- package/highmaps.src.js +2708 -1587
- package/highstock.js +788 -783
- package/highstock.js.map +1 -1
- package/highstock.src.js +1896 -1267
- package/indicators/acceleration-bands.js +10 -9
- package/indicators/acceleration-bands.js.map +1 -1
- package/indicators/acceleration-bands.src.js +156 -112
- package/indicators/accumulation-distribution.js +1 -1
- package/indicators/accumulation-distribution.src.js +1 -1
- package/indicators/ao.js +6 -6
- package/indicators/ao.js.map +1 -1
- package/indicators/ao.src.js +4 -4
- package/indicators/apo.js +5 -6
- package/indicators/apo.js.map +1 -1
- package/indicators/apo.src.js +16 -84
- package/indicators/aroon-oscillator.js +9 -9
- package/indicators/aroon-oscillator.js.map +1 -1
- package/indicators/aroon-oscillator.src.js +160 -177
- package/indicators/aroon.js +9 -9
- package/indicators/aroon.js.map +1 -1
- package/indicators/aroon.src.js +156 -112
- package/indicators/atr.js +1 -1
- package/indicators/atr.src.js +1 -1
- package/indicators/bollinger-bands.js +10 -9
- package/indicators/bollinger-bands.js.map +1 -1
- package/indicators/bollinger-bands.src.js +180 -117
- package/indicators/cci.js +1 -1
- package/indicators/cci.src.js +1 -1
- package/indicators/chaikin.js +8 -9
- package/indicators/chaikin.js.map +1 -1
- package/indicators/chaikin.src.js +8 -76
- package/indicators/cmf.js +1 -1
- package/indicators/cmf.src.js +1 -1
- package/indicators/cmo.js +1 -1
- package/indicators/cmo.src.js +1 -1
- package/indicators/dema.js +5 -6
- package/indicators/dema.js.map +1 -1
- package/indicators/dema.src.js +3 -75
- package/indicators/disparity-index.js +6 -7
- package/indicators/disparity-index.js.map +1 -1
- package/indicators/disparity-index.src.js +19 -74
- package/indicators/dmi.js +11 -11
- package/indicators/dmi.js.map +1 -1
- package/indicators/dmi.src.js +173 -116
- package/indicators/dpo.js +1 -1
- package/indicators/dpo.src.js +1 -1
- package/indicators/ema.js +1 -13
- package/indicators/ema.js.map +1 -1
- package/indicators/ema.src.js +7 -188
- package/indicators/ichimoku-kinko-hyo.js +1 -1
- package/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/indicators/indicators-all.js +197 -203
- package/indicators/indicators-all.js.map +1 -1
- package/indicators/indicators-all.src.js +649 -720
- package/indicators/indicators.js +12 -12
- package/indicators/indicators.js.map +1 -1
- package/indicators/indicators.src.js +188 -124
- package/indicators/keltner-channels.js +10 -10
- package/indicators/keltner-channels.js.map +1 -1
- package/indicators/keltner-channels.src.js +164 -118
- package/indicators/klinger.js +12 -13
- package/indicators/klinger.js.map +1 -1
- package/indicators/klinger.src.js +161 -184
- package/indicators/macd.js +2 -2
- package/indicators/macd.js.map +1 -1
- package/indicators/macd.src.js +2 -3
- package/indicators/mfi.js +1 -1
- package/indicators/mfi.src.js +1 -1
- package/indicators/momentum.js +1 -1
- package/indicators/momentum.src.js +1 -1
- package/indicators/natr.js +3 -3
- package/indicators/natr.js.map +1 -1
- package/indicators/natr.src.js +2 -4
- package/indicators/obv.js +1 -1
- package/indicators/obv.src.js +1 -1
- package/indicators/pivot-points.js +1 -1
- package/indicators/pivot-points.src.js +1 -1
- package/indicators/ppo.js +5 -6
- package/indicators/ppo.js.map +1 -1
- package/indicators/ppo.src.js +3 -75
- package/indicators/price-channel.js +9 -9
- package/indicators/price-channel.js.map +1 -1
- package/indicators/price-channel.src.js +207 -168
- package/indicators/price-envelopes.js +1 -1
- package/indicators/price-envelopes.src.js +1 -1
- package/indicators/psar.js +1 -1
- package/indicators/psar.src.js +1 -1
- package/indicators/regressions.js +1 -1
- package/indicators/regressions.src.js +9 -9
- package/indicators/roc.js +1 -1
- package/indicators/roc.src.js +1 -1
- package/indicators/rsi.js +1 -1
- package/indicators/rsi.src.js +1 -1
- package/indicators/slow-stochastic.js +5 -6
- package/indicators/slow-stochastic.js.map +1 -1
- package/indicators/slow-stochastic.src.js +2 -72
- package/indicators/stochastic.js +10 -10
- package/indicators/stochastic.js.map +1 -1
- package/indicators/stochastic.src.js +209 -164
- package/indicators/supertrend.js +10 -10
- package/indicators/supertrend.js.map +1 -1
- package/indicators/supertrend.src.js +6 -7
- package/indicators/tema.js +6 -7
- package/indicators/tema.js.map +1 -1
- package/indicators/tema.src.js +28 -75
- package/indicators/trendline.js +1 -1
- package/indicators/trendline.src.js +1 -1
- package/indicators/trix.js +4 -5
- package/indicators/trix.js.map +1 -1
- package/indicators/trix.src.js +8 -76
- package/indicators/volume-by-price.js +16 -16
- package/indicators/volume-by-price.js.map +1 -1
- package/indicators/volume-by-price.src.js +21 -3
- package/indicators/vwap.js +1 -1
- package/indicators/vwap.src.js +1 -1
- package/indicators/williams-r.js +5 -6
- package/indicators/williams-r.js.map +1 -1
- package/indicators/williams-r.src.js +41 -51
- package/indicators/wma.js +1 -1
- package/indicators/wma.src.js +1 -1
- package/indicators/zigzag.js +1 -1
- package/indicators/zigzag.src.js +1 -1
- package/modules/accessibility.d.ts +5 -0
- package/modules/accessibility.js +234 -216
- package/modules/accessibility.js.map +1 -1
- package/modules/accessibility.src.d.ts +5 -0
- package/modules/accessibility.src.js +9709 -8608
- package/modules/annotations-advanced.d.ts +30 -0
- package/modules/annotations-advanced.js +191 -165
- package/modules/annotations-advanced.js.map +1 -1
- package/modules/annotations-advanced.src.d.ts +30 -0
- package/modules/annotations-advanced.src.js +1578 -320
- package/modules/annotations.js +121 -107
- package/modules/annotations.js.map +1 -1
- package/modules/annotations.src.js +958 -229
- package/modules/arrow-symbols.js +1 -1
- package/modules/arrow-symbols.src.js +1 -1
- package/modules/boost-canvas.js +15 -15
- package/modules/boost-canvas.js.map +1 -1
- package/modules/boost-canvas.src.js +3 -3
- package/modules/boost.js +79 -79
- package/modules/boost.js.map +1 -1
- package/modules/boost.src.js +10 -9
- package/modules/broken-axis.js +1 -1
- package/modules/broken-axis.src.js +1 -1
- package/modules/bullet.js +1 -1
- package/modules/bullet.src.js +1 -1
- package/modules/coloraxis.js +24 -24
- package/modules/coloraxis.js.map +1 -1
- package/modules/coloraxis.src.js +69 -98
- package/modules/current-date-indicator.js +4 -4
- package/modules/current-date-indicator.js.map +1 -1
- package/modules/current-date-indicator.src.js +4 -4
- package/modules/cylinder.js +1 -1
- package/modules/cylinder.src.js +1 -1
- package/modules/data.js +19 -19
- package/modules/data.js.map +1 -1
- package/modules/data.src.js +9 -6
- package/modules/datagrouping.js +20 -20
- package/modules/datagrouping.js.map +1 -1
- package/modules/datagrouping.src.js +33 -19
- package/modules/debugger.js +1 -1
- package/modules/debugger.src.js +1 -1
- package/modules/dependency-wheel.js +11 -11
- package/modules/dependency-wheel.js.map +1 -1
- package/modules/dependency-wheel.src.js +4 -7
- package/modules/dotplot.js +1 -1
- package/modules/dotplot.src.js +1 -1
- package/modules/drag-panes.js +8 -8
- package/modules/drag-panes.js.map +1 -1
- package/modules/drag-panes.src.js +3 -3
- package/modules/draggable-points.js +1 -1
- package/modules/draggable-points.src.js +1 -1
- package/modules/drilldown.js +24 -24
- package/modules/drilldown.js.map +1 -1
- package/modules/drilldown.src.js +4 -4
- package/modules/dumbbell.js +17 -17
- package/modules/dumbbell.js.map +1 -1
- package/modules/dumbbell.src.js +4 -4
- package/modules/export-data.js +1 -1
- package/modules/export-data.js.map +1 -1
- package/modules/export-data.src.js +3 -3
- package/modules/exporting.js +39 -38
- package/modules/exporting.js.map +1 -1
- package/modules/exporting.src.js +98 -67
- package/modules/full-screen.js +1 -1
- package/modules/full-screen.src.js +1 -1
- package/modules/funnel.js +12 -12
- package/modules/funnel.js.map +1 -1
- package/modules/funnel.src.js +9 -6
- package/modules/funnel3d.js +1 -1
- package/modules/funnel3d.src.js +1 -1
- package/modules/gantt.js +217 -218
- package/modules/gantt.js.map +1 -1
- package/modules/gantt.src.js +167 -152
- package/modules/grid-axis.js +1 -1
- package/modules/grid-axis.src.js +1 -1
- package/modules/heatmap.js +39 -39
- package/modules/heatmap.js.map +1 -1
- package/modules/heatmap.src.js +177 -162
- package/modules/heikinashi.js +1 -1
- package/modules/heikinashi.src.js +4 -4
- package/modules/histogram-bellcurve.js +13 -13
- package/modules/histogram-bellcurve.js.map +1 -1
- package/modules/histogram-bellcurve.src.js +91 -86
- package/modules/hollowcandlestick.js +9 -9
- package/modules/hollowcandlestick.js.map +1 -1
- package/modules/hollowcandlestick.src.js +11 -11
- package/modules/item-series.js +1 -1
- package/modules/item-series.src.js +1 -1
- package/modules/lollipop.js +1 -1
- package/modules/lollipop.src.js +1 -1
- package/modules/map.d.ts +136 -14
- package/modules/map.js +142 -122
- package/modules/map.js.map +1 -1
- package/modules/map.src.d.ts +136 -14
- package/modules/map.src.js +2129 -1029
- package/modules/marker-clusters.js +36 -36
- package/modules/marker-clusters.js.map +1 -1
- package/modules/marker-clusters.src.js +173 -142
- package/modules/networkgraph.d.ts +12 -1
- package/modules/networkgraph.js +49 -49
- package/modules/networkgraph.js.map +1 -1
- package/modules/networkgraph.src.d.ts +12 -1
- package/modules/networkgraph.src.js +91 -43
- package/modules/no-data-to-display.js +5 -5
- package/modules/no-data-to-display.js.map +1 -1
- package/modules/no-data-to-display.src.js +3 -3
- package/modules/offline-exporting.js +17 -17
- package/modules/offline-exporting.js.map +1 -1
- package/modules/offline-exporting.src.js +13 -13
- package/modules/oldie-polyfills.js +1 -1
- package/modules/oldie-polyfills.src.js +1 -1
- package/modules/oldie.js +26 -26
- package/modules/oldie.js.map +1 -1
- package/modules/oldie.src.js +4 -4
- package/modules/organization.js +13 -13
- package/modules/organization.js.map +1 -1
- package/modules/organization.src.js +4 -4
- package/modules/overlapping-datalabels.js +1 -1
- package/modules/overlapping-datalabels.src.js +1 -1
- package/modules/parallel-coordinates.js +1 -1
- package/modules/parallel-coordinates.src.js +1 -1
- package/modules/pareto.js +7 -7
- package/modules/pareto.js.map +1 -1
- package/modules/pareto.src.js +89 -78
- package/modules/pathfinder.js +1 -1
- package/modules/pathfinder.src.js +1 -1
- package/modules/pattern-fill.js +1 -1
- package/modules/pattern-fill.src.js +1 -1
- package/modules/price-indicator.js +1 -1
- package/modules/price-indicator.src.js +1 -1
- package/modules/pyramid3d.js +1 -1
- package/modules/pyramid3d.src.js +1 -1
- package/modules/sankey.d.ts +12 -1
- package/modules/sankey.js +29 -29
- package/modules/sankey.js.map +1 -1
- package/modules/sankey.src.d.ts +12 -1
- package/modules/sankey.src.js +300 -176
- package/modules/series-label.js +1 -1
- package/modules/series-label.src.js +1 -1
- package/modules/solid-gauge.js +1 -1
- package/modules/solid-gauge.src.js +1 -1
- package/modules/sonification.js +59 -55
- package/modules/sonification.js.map +1 -1
- package/modules/sonification.src.js +3034 -2553
- package/modules/static-scale.js +1 -1
- package/modules/static-scale.src.js +1 -1
- package/modules/stock-tools.js +177 -164
- package/modules/stock-tools.js.map +1 -1
- package/modules/stock-tools.src.js +1001 -131
- package/modules/stock.d.ts +39 -6
- package/modules/stock.js +204 -196
- package/modules/stock.js.map +1 -1
- package/modules/stock.src.d.ts +39 -6
- package/modules/stock.src.js +1689 -1081
- package/modules/streamgraph.js +1 -1
- package/modules/streamgraph.src.js +1 -1
- package/modules/sunburst.js +61 -60
- package/modules/sunburst.js.map +1 -1
- package/modules/sunburst.src.js +329 -266
- package/modules/tilemap.js +17 -17
- package/modules/tilemap.js.map +1 -1
- package/modules/tilemap.src.js +3 -4
- package/modules/timeline.js +18 -18
- package/modules/timeline.js.map +1 -1
- package/modules/timeline.src.js +5 -5
- package/modules/treegrid.js +56 -57
- package/modules/treegrid.js.map +1 -1
- package/modules/treegrid.src.js +126 -120
- package/modules/treemap.js +41 -41
- package/modules/treemap.js.map +1 -1
- package/modules/treemap.src.js +319 -254
- package/modules/variable-pie.js +1 -1
- package/modules/variable-pie.src.js +1 -1
- package/modules/variwide.js +1 -1
- package/modules/variwide.src.js +1 -1
- package/modules/vector.js +1 -1
- package/modules/vector.src.js +1 -1
- package/modules/venn.js +31 -31
- package/modules/venn.js.map +1 -1
- package/modules/venn.src.js +731 -721
- package/modules/windbarb.js +15 -15
- package/modules/windbarb.js.map +1 -1
- package/modules/windbarb.src.js +90 -62
- package/modules/wordcloud.js +23 -24
- package/modules/wordcloud.js.map +1 -1
- package/modules/wordcloud.src.js +897 -949
- package/modules/xrange.js +2 -2
- package/modules/xrange.js.map +1 -1
- package/modules/xrange.src.js +2 -1
- package/package.json +1 -1
- package/themes/avocado.js +1 -1
- package/themes/avocado.src.js +1 -1
- package/themes/dark-blue.js +1 -1
- package/themes/dark-blue.src.js +1 -1
- package/themes/dark-green.js +1 -1
- package/themes/dark-green.src.js +1 -1
- package/themes/dark-unica.js +1 -1
- package/themes/dark-unica.src.js +1 -1
- package/themes/gray.js +1 -1
- package/themes/gray.src.js +1 -1
- package/themes/grid-light.js +1 -1
- package/themes/grid-light.src.js +1 -1
- package/themes/grid.js +1 -1
- package/themes/grid.src.js +1 -1
- package/themes/high-contrast-dark.js +1 -1
- package/themes/high-contrast-dark.src.js +1 -1
- package/themes/high-contrast-light.js +1 -1
- package/themes/high-contrast-light.src.js +1 -1
- package/themes/sand-signika.js +1 -1
- package/themes/sand-signika.src.js +1 -1
- package/themes/skies.js +1 -1
- package/themes/skies.src.js +1 -1
- package/themes/sunset.js +1 -1
- package/themes/sunset.src.js +1 -1
- package/es-modules/Core/Axis/MapAxis.js +0 -157
- package/es-modules/Core/Color/Palette.js +0 -82
- package/es-modules/Extensions/Sonification/InstrumentDefinitions.js +0 -32
- package/es-modules/Mixins/ColorMapSeries.js +0 -82
- package/es-modules/Mixins/ColorSeries.js +0 -77
- package/es-modules/Mixins/DerivedSeries.js +0 -118
- package/es-modules/Mixins/DrawPoint.js +0 -81
- package/es-modules/Mixins/IndicatorRequired.js +0 -56
- package/es-modules/Mixins/Navigation.js +0 -54
- package/es-modules/Mixins/NelderMead.js +0 -132
- package/es-modules/Mixins/Polygon.js +0 -259
- package/es-modules/Mixins/ReduceArray.js +0 -54
package/modules/wordcloud.src.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Highcharts JS v9.
|
|
2
|
+
* @license Highcharts JS v9.3.0 (2021-10-21)
|
|
3
3
|
*
|
|
4
4
|
* (c) 2016-2021 Highsoft AS
|
|
5
5
|
* Authors: Jon Arild Nygard
|
|
@@ -27,417 +27,123 @@
|
|
|
27
27
|
obj[path] = fn.apply(null, args);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
_registerModule(_modules, '
|
|
30
|
+
_registerModule(_modules, 'Series/DrawPointComposition.js', [], function () {
|
|
31
31
|
/* *
|
|
32
32
|
*
|
|
33
33
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
34
34
|
*
|
|
35
35
|
* */
|
|
36
|
-
/**
|
|
37
|
-
* @private
|
|
38
|
-
* @interface Highcharts.PolygonPointObject
|
|
39
|
-
*/ /**
|
|
40
|
-
* @name Highcharts.PolygonPointObject#0
|
|
41
|
-
* @type {number}
|
|
42
|
-
*/ /**
|
|
43
|
-
* @name Highcharts.PolygonPointObject#1
|
|
44
|
-
* @type {number}
|
|
45
|
-
*/
|
|
46
|
-
/**
|
|
47
|
-
* @private
|
|
48
|
-
* @interface Highcharts.PolygonObject
|
|
49
|
-
* @extends Array<Highcharts.PolygonPointObject>
|
|
50
|
-
*/ /**
|
|
51
|
-
* @name Highcharts.PolygonObject#axes
|
|
52
|
-
* @type {Array<PolygonPointObject>}
|
|
53
|
-
*/
|
|
54
|
-
var find = U.find,
|
|
55
|
-
isArray = U.isArray,
|
|
56
|
-
isNumber = U.isNumber;
|
|
57
|
-
var deg2rad = H.deg2rad;
|
|
58
|
-
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
59
|
-
/**
|
|
60
|
-
* Alternative solution to correctFloat.
|
|
61
|
-
* E.g Highcharts.correctFloat(123, 2) returns 120, when it should be 123.
|
|
62
|
-
*
|
|
63
|
-
* @private
|
|
64
|
-
* @function correctFloat
|
|
65
|
-
* @param {number} number
|
|
66
|
-
* @param {number} [precision]
|
|
67
|
-
* @return {number}
|
|
68
|
-
*/
|
|
69
|
-
var correctFloat = function (number,
|
|
70
|
-
precision) {
|
|
71
|
-
var p = isNumber(precision) ? precision : 14,
|
|
72
|
-
magnitude = Math.pow(10,
|
|
73
|
-
p);
|
|
74
|
-
return Math.round(number * magnitude) / magnitude;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Calculates the normals to a line between two points.
|
|
78
|
-
*
|
|
79
|
-
* @private
|
|
80
|
-
* @function getNormals
|
|
81
|
-
* @param {Highcharts.PolygonPointObject} p1
|
|
82
|
-
* Start point for the line. Array of x and y value.
|
|
83
|
-
* @param {Highcharts.PolygonPointObject} p2
|
|
84
|
-
* End point for the line. Array of x and y value.
|
|
85
|
-
* @return {Highcharts.PolygonObject}
|
|
86
|
-
* Returns the two normals in an array.
|
|
87
|
-
*/
|
|
88
|
-
var getNormals = function getNormal(p1,
|
|
89
|
-
p2) {
|
|
90
|
-
var dx = p2[0] - p1[0], // x2 - x1
|
|
91
|
-
dy = p2[1] - p1[1]; // y2 - y1
|
|
92
|
-
return [
|
|
93
|
-
[-dy,
|
|
94
|
-
dx],
|
|
95
|
-
[dy, -dx]
|
|
96
|
-
];
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Calculates the dot product of two coordinates. The result is a scalar value.
|
|
100
|
-
*
|
|
101
|
-
* @private
|
|
102
|
-
* @function dotProduct
|
|
103
|
-
* @param {Highcharts.PolygonPointObject} a
|
|
104
|
-
* The x and y coordinates of the first point.
|
|
105
|
-
*
|
|
106
|
-
* @param {Highcharts.PolygonPointObject} b
|
|
107
|
-
* The x and y coordinates of the second point.
|
|
108
|
-
*
|
|
109
|
-
* @return {number}
|
|
110
|
-
* Returns the dot product of a and b.
|
|
111
|
-
*/
|
|
112
|
-
var dotProduct = function dotProduct(a,
|
|
113
|
-
b) {
|
|
114
|
-
var ax = a[0],
|
|
115
|
-
ay = a[1],
|
|
116
|
-
bx = b[0],
|
|
117
|
-
by = b[1];
|
|
118
|
-
return ax * bx + ay * by;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Projects a polygon onto a coordinate.
|
|
122
|
-
*
|
|
123
|
-
* @private
|
|
124
|
-
* @function project
|
|
125
|
-
* @param {Highcharts.PolygonObject} polygon
|
|
126
|
-
* Array of points in a polygon.
|
|
127
|
-
* @param {Highcharts.PolygonPointObject} target
|
|
128
|
-
* The coordinate of pr
|
|
129
|
-
* @return {Highcharts.RangeObject}
|
|
130
|
-
*/
|
|
131
|
-
var project = function project(polygon,
|
|
132
|
-
target) {
|
|
133
|
-
var products = polygon.map(function (point) {
|
|
134
|
-
return dotProduct(point,
|
|
135
|
-
target);
|
|
136
|
-
});
|
|
137
|
-
return {
|
|
138
|
-
min: Math.min.apply(this, products),
|
|
139
|
-
max: Math.max.apply(this, products)
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Rotates a point clockwise around the origin.
|
|
144
|
-
*
|
|
145
|
-
* @private
|
|
146
|
-
* @function rotate2DToOrigin
|
|
147
|
-
* @param {Highcharts.PolygonPointObject} point
|
|
148
|
-
* The x and y coordinates for the point.
|
|
149
|
-
* @param {number} angle
|
|
150
|
-
* The angle of rotation.
|
|
151
|
-
* @return {Highcharts.PolygonPointObject}
|
|
152
|
-
* The x and y coordinate for the rotated point.
|
|
153
|
-
*/
|
|
154
|
-
var rotate2DToOrigin = function (point,
|
|
155
|
-
angle) {
|
|
156
|
-
var x = point[0],
|
|
157
|
-
y = point[1],
|
|
158
|
-
rad = deg2rad * -angle,
|
|
159
|
-
cosAngle = Math.cos(rad),
|
|
160
|
-
sinAngle = Math.sin(rad);
|
|
161
|
-
return [
|
|
162
|
-
correctFloat(x * cosAngle - y * sinAngle),
|
|
163
|
-
correctFloat(x * sinAngle + y * cosAngle)
|
|
164
|
-
];
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* Rotate a point clockwise around another point.
|
|
168
|
-
*
|
|
169
|
-
* @private
|
|
170
|
-
* @function rotate2DToPoint
|
|
171
|
-
* @param {Highcharts.PolygonPointObject} point
|
|
172
|
-
* The x and y coordinates for the point.
|
|
173
|
-
* @param {Highcharts.PolygonPointObject} origin
|
|
174
|
-
* The point to rotate around.
|
|
175
|
-
* @param {number} angle
|
|
176
|
-
* The angle of rotation.
|
|
177
|
-
* @return {Highcharts.PolygonPointObject}
|
|
178
|
-
* The x and y coordinate for the rotated point.
|
|
179
|
-
*/
|
|
180
|
-
var rotate2DToPoint = function (point,
|
|
181
|
-
origin,
|
|
182
|
-
angle) {
|
|
183
|
-
var x = point[0] - origin[0],
|
|
184
|
-
y = point[1] - origin[1],
|
|
185
|
-
rotated = rotate2DToOrigin([x,
|
|
186
|
-
y],
|
|
187
|
-
angle);
|
|
188
|
-
return [
|
|
189
|
-
rotated[0] + origin[0],
|
|
190
|
-
rotated[1] + origin[1]
|
|
191
|
-
];
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* @private
|
|
195
|
-
*/
|
|
196
|
-
var isAxesEqual = function (axis1,
|
|
197
|
-
axis2) {
|
|
198
|
-
return (axis1[0] === axis2[0] &&
|
|
199
|
-
axis1[1] === axis2[1]);
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* @private
|
|
203
|
-
*/
|
|
204
|
-
var getAxesFromPolygon = function (polygon) {
|
|
205
|
-
var points,
|
|
206
|
-
axes = polygon.axes;
|
|
207
|
-
if (!isArray(axes)) {
|
|
208
|
-
axes = [];
|
|
209
|
-
points = points = polygon.concat([polygon[0]]);
|
|
210
|
-
points.reduce(function findAxis(p1, p2) {
|
|
211
|
-
var normals = getNormals(p1,
|
|
212
|
-
p2),
|
|
213
|
-
axis = normals[0]; // Use the left normal as axis.
|
|
214
|
-
// Check that the axis is unique.
|
|
215
|
-
if (!find(axes,
|
|
216
|
-
function (existing) {
|
|
217
|
-
return isAxesEqual(existing,
|
|
218
|
-
axis);
|
|
219
|
-
})) {
|
|
220
|
-
axes.push(axis);
|
|
221
|
-
}
|
|
222
|
-
// Return p2 to be used as p1 in next iteration.
|
|
223
|
-
return p2;
|
|
224
|
-
});
|
|
225
|
-
polygon.axes = axes;
|
|
226
|
-
}
|
|
227
|
-
return axes;
|
|
228
|
-
};
|
|
229
|
-
/**
|
|
230
|
-
* @private
|
|
231
|
-
*/
|
|
232
|
-
var getAxes = function (polygon1,
|
|
233
|
-
polygon2) {
|
|
234
|
-
// Get the axis from both polygons.
|
|
235
|
-
var axes1 = getAxesFromPolygon(polygon1),
|
|
236
|
-
axes2 = getAxesFromPolygon(polygon2);
|
|
237
|
-
return axes1.concat(axes2);
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* @private
|
|
241
|
-
*/
|
|
242
|
-
var getPolygon = function (x,
|
|
243
|
-
y,
|
|
244
|
-
width,
|
|
245
|
-
height,
|
|
246
|
-
rotation) {
|
|
247
|
-
var origin = [x,
|
|
248
|
-
y],
|
|
249
|
-
left = x - (width / 2),
|
|
250
|
-
right = x + (width / 2),
|
|
251
|
-
top = y - (height / 2),
|
|
252
|
-
bottom = y + (height / 2),
|
|
253
|
-
polygon = [
|
|
254
|
-
[left,
|
|
255
|
-
top],
|
|
256
|
-
[right,
|
|
257
|
-
top],
|
|
258
|
-
[right,
|
|
259
|
-
bottom],
|
|
260
|
-
[left,
|
|
261
|
-
bottom]
|
|
262
|
-
];
|
|
263
|
-
return polygon.map(function (point) {
|
|
264
|
-
return rotate2DToPoint(point, origin, -rotation);
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
/**
|
|
268
|
-
* @private
|
|
269
|
-
*/
|
|
270
|
-
var getBoundingBoxFromPolygon = function (points) {
|
|
271
|
-
return points.reduce(function (obj,
|
|
272
|
-
point) {
|
|
273
|
-
var x = point[0],
|
|
274
|
-
y = point[1];
|
|
275
|
-
obj.left = Math.min(x, obj.left);
|
|
276
|
-
obj.right = Math.max(x, obj.right);
|
|
277
|
-
obj.bottom = Math.max(y, obj.bottom);
|
|
278
|
-
obj.top = Math.min(y, obj.top);
|
|
279
|
-
return obj;
|
|
280
|
-
}, {
|
|
281
|
-
left: Number.MAX_VALUE,
|
|
282
|
-
right: -Number.MAX_VALUE,
|
|
283
|
-
bottom: -Number.MAX_VALUE,
|
|
284
|
-
top: Number.MAX_VALUE
|
|
285
|
-
});
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* @private
|
|
289
|
-
*/
|
|
290
|
-
var isPolygonsOverlappingOnAxis = function (axis,
|
|
291
|
-
polygon1,
|
|
292
|
-
polygon2) {
|
|
293
|
-
var projection1 = project(polygon1,
|
|
294
|
-
axis),
|
|
295
|
-
projection2 = project(polygon2,
|
|
296
|
-
axis),
|
|
297
|
-
isOverlapping = !(projection2.min > projection1.max ||
|
|
298
|
-
projection2.max < projection1.min);
|
|
299
|
-
return !isOverlapping;
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* Checks wether two convex polygons are colliding by using the Separating Axis
|
|
303
|
-
* Theorem.
|
|
304
|
-
*
|
|
305
|
-
* @private
|
|
306
|
-
* @function isPolygonsColliding
|
|
307
|
-
* @param {Highcharts.PolygonObject} polygon1
|
|
308
|
-
* First polygon.
|
|
309
|
-
*
|
|
310
|
-
* @param {Highcharts.PolygonObject} polygon2
|
|
311
|
-
* Second polygon.
|
|
312
|
-
*
|
|
313
|
-
* @return {boolean}
|
|
314
|
-
* Returns true if they are colliding, otherwise false.
|
|
315
|
-
*/
|
|
316
|
-
var isPolygonsColliding = function isPolygonsColliding(polygon1,
|
|
317
|
-
polygon2) {
|
|
318
|
-
var axes = getAxes(polygon1,
|
|
319
|
-
polygon2),
|
|
320
|
-
overlappingOnAllAxes = !find(axes,
|
|
321
|
-
function (axis) {
|
|
322
|
-
return isPolygonsOverlappingOnAxis(axis,
|
|
323
|
-
polygon1,
|
|
324
|
-
polygon2);
|
|
325
|
-
});
|
|
326
|
-
return overlappingOnAllAxes;
|
|
327
|
-
};
|
|
328
|
-
/**
|
|
329
|
-
* @private
|
|
330
|
-
*/
|
|
331
|
-
var movePolygon = function (deltaX,
|
|
332
|
-
deltaY,
|
|
333
|
-
polygon) {
|
|
334
|
-
return polygon.map(function (point) {
|
|
335
|
-
return [
|
|
336
|
-
point[0] + deltaX,
|
|
337
|
-
point[1] + deltaY
|
|
338
|
-
];
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
|
-
var collision = {
|
|
342
|
-
getBoundingBoxFromPolygon: getBoundingBoxFromPolygon,
|
|
343
|
-
getPolygon: getPolygon,
|
|
344
|
-
isPolygonsColliding: isPolygonsColliding,
|
|
345
|
-
movePolygon: movePolygon,
|
|
346
|
-
rotate2DToOrigin: rotate2DToOrigin,
|
|
347
|
-
rotate2DToPoint: rotate2DToPoint
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
return collision;
|
|
351
|
-
});
|
|
352
|
-
_registerModule(_modules, 'Mixins/DrawPoint.js', [], function () {
|
|
353
36
|
/* *
|
|
354
37
|
*
|
|
355
|
-
*
|
|
38
|
+
* Composition
|
|
356
39
|
*
|
|
357
40
|
* */
|
|
358
|
-
var
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (this.shouldDraw()) {
|
|
389
|
-
if (!graphic) {
|
|
390
|
-
this.graphic = graphic =
|
|
391
|
-
renderer[params.shapeType](params.shapeArgs)
|
|
392
|
-
.add(params.group);
|
|
41
|
+
var DrawPointComposition;
|
|
42
|
+
(function (DrawPointComposition) {
|
|
43
|
+
/* *
|
|
44
|
+
*
|
|
45
|
+
* Declarations
|
|
46
|
+
*
|
|
47
|
+
* */
|
|
48
|
+
/* *
|
|
49
|
+
*
|
|
50
|
+
* Constants
|
|
51
|
+
*
|
|
52
|
+
* */
|
|
53
|
+
var composedClasses = [];
|
|
54
|
+
/* *
|
|
55
|
+
*
|
|
56
|
+
* Functions
|
|
57
|
+
*
|
|
58
|
+
* */
|
|
59
|
+
/* eslint-disable valid-jsdoc */
|
|
60
|
+
/**
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
function compose(PointClass) {
|
|
64
|
+
if (composedClasses.indexOf(PointClass) === -1) {
|
|
65
|
+
composedClasses.push(PointClass);
|
|
66
|
+
var pointProto = PointClass.prototype;
|
|
67
|
+
pointProto.draw = draw;
|
|
68
|
+
if (!pointProto.shouldDraw) {
|
|
69
|
+
pointProto.shouldDraw = shouldDraw;
|
|
70
|
+
}
|
|
393
71
|
}
|
|
394
|
-
|
|
395
|
-
.css(css)
|
|
396
|
-
.attr(params.attribs)
|
|
397
|
-
.animate(animatableAttribs, params.isNew ? false : animation, onComplete);
|
|
72
|
+
return PointClass;
|
|
398
73
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
74
|
+
DrawPointComposition.compose = compose;
|
|
75
|
+
/**
|
|
76
|
+
* Handles the drawing of a component.
|
|
77
|
+
* Can be used for any type of component that reserves the graphic property,
|
|
78
|
+
* and provides a shouldDraw on its context.
|
|
79
|
+
*
|
|
80
|
+
* @private
|
|
81
|
+
*
|
|
82
|
+
* @todo add type checking.
|
|
83
|
+
* @todo export this function to enable usage
|
|
84
|
+
*/
|
|
85
|
+
function draw(params) {
|
|
86
|
+
var _this = this;
|
|
87
|
+
var animatableAttribs = params.animatableAttribs,
|
|
88
|
+
onComplete = params.onComplete,
|
|
89
|
+
css = params.css,
|
|
90
|
+
renderer = params.renderer;
|
|
91
|
+
var animation = (this.series && this.series.chart.hasRendered) ?
|
|
92
|
+
// Chart-level animation on updates
|
|
93
|
+
void 0 :
|
|
94
|
+
// Series-level animation on new points
|
|
95
|
+
(this.series &&
|
|
96
|
+
this.series.options.animation);
|
|
97
|
+
var graphic = this.graphic;
|
|
98
|
+
params.attribs = params.attribs || {};
|
|
99
|
+
// Assigning class in dot notation does go well in IE8
|
|
100
|
+
// eslint-disable-next-line dot-notation
|
|
101
|
+
params.attribs['class'] = this.getClassName();
|
|
102
|
+
if (this.shouldDraw()) {
|
|
103
|
+
if (!graphic) {
|
|
104
|
+
this.graphic = graphic =
|
|
105
|
+
renderer[params.shapeType](params.shapeArgs)
|
|
106
|
+
.add(params.group);
|
|
404
107
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
destroy_1();
|
|
410
|
-
});
|
|
108
|
+
graphic
|
|
109
|
+
.css(css)
|
|
110
|
+
.attr(params.attribs)
|
|
111
|
+
.animate(animatableAttribs, params.isNew ? false : animation, onComplete);
|
|
411
112
|
}
|
|
412
|
-
else {
|
|
413
|
-
destroy_1()
|
|
113
|
+
else if (graphic) {
|
|
114
|
+
var destroy_1 = function () {
|
|
115
|
+
_this.graphic = graphic = (graphic && graphic.destroy());
|
|
116
|
+
if (typeof onComplete === 'function') {
|
|
117
|
+
onComplete();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
// animate only runs complete callback if something was animated.
|
|
121
|
+
if (Object.keys(animatableAttribs).length) {
|
|
122
|
+
graphic.animate(animatableAttribs, void 0, function () {
|
|
123
|
+
destroy_1();
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
destroy_1();
|
|
128
|
+
}
|
|
414
129
|
}
|
|
415
130
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
attribs['class'] = point.getClassName();
|
|
429
|
-
// Call draw to render component
|
|
430
|
-
draw.call(point, params);
|
|
431
|
-
};
|
|
432
|
-
var drawPointModule = {
|
|
433
|
-
draw: draw,
|
|
434
|
-
drawPoint: drawPoint,
|
|
435
|
-
isFn: isFn
|
|
436
|
-
};
|
|
131
|
+
/**
|
|
132
|
+
* @private
|
|
133
|
+
*/
|
|
134
|
+
function shouldDraw() {
|
|
135
|
+
return !this.isNull;
|
|
136
|
+
}
|
|
137
|
+
})(DrawPointComposition || (DrawPointComposition = {}));
|
|
138
|
+
/* *
|
|
139
|
+
*
|
|
140
|
+
* Default Export
|
|
141
|
+
*
|
|
142
|
+
* */
|
|
437
143
|
|
|
438
|
-
return
|
|
144
|
+
return DrawPointComposition;
|
|
439
145
|
});
|
|
440
|
-
_registerModule(_modules, 'Series/Wordcloud/WordcloudPoint.js', [_modules['
|
|
146
|
+
_registerModule(_modules, 'Series/Wordcloud/WordcloudPoint.js', [_modules['Series/DrawPointComposition.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (DrawPointComposition, SeriesRegistry, U) {
|
|
441
147
|
/* *
|
|
442
148
|
*
|
|
443
149
|
* Experimental Highcharts module which enables visualization of a word cloud.
|
|
@@ -489,23 +195,24 @@
|
|
|
489
195
|
* Functions
|
|
490
196
|
*
|
|
491
197
|
* */
|
|
492
|
-
WordcloudPoint.prototype.shouldDraw = function () {
|
|
493
|
-
var point = this;
|
|
494
|
-
return !point.isNull;
|
|
495
|
-
};
|
|
496
198
|
WordcloudPoint.prototype.isValid = function () {
|
|
497
199
|
return true;
|
|
498
200
|
};
|
|
499
201
|
return WordcloudPoint;
|
|
500
202
|
}(ColumnSeries.prototype.pointClass));
|
|
501
203
|
extend(WordcloudPoint.prototype, {
|
|
502
|
-
draw: DrawPointMixin.drawPoint,
|
|
503
204
|
weight: 1
|
|
504
205
|
});
|
|
206
|
+
DrawPointComposition.compose(WordcloudPoint);
|
|
207
|
+
/* *
|
|
208
|
+
*
|
|
209
|
+
* Default Export
|
|
210
|
+
*
|
|
211
|
+
* */
|
|
505
212
|
|
|
506
213
|
return WordcloudPoint;
|
|
507
214
|
});
|
|
508
|
-
_registerModule(_modules, 'Series/Wordcloud/WordcloudUtils.js', [_modules['
|
|
215
|
+
_registerModule(_modules, 'Series/Wordcloud/WordcloudUtils.js', [_modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (H, U) {
|
|
509
216
|
/* *
|
|
510
217
|
*
|
|
511
218
|
* Experimental Highcharts module which enables visualization of a word cloud.
|
|
@@ -517,574 +224,800 @@
|
|
|
517
224
|
*
|
|
518
225
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
519
226
|
* */
|
|
520
|
-
var
|
|
521
|
-
movePolygon = PolygonMixin.movePolygon;
|
|
227
|
+
var deg2rad = H.deg2rad;
|
|
522
228
|
var extend = U.extend,
|
|
523
229
|
find = U.find,
|
|
524
230
|
isNumber = U.isNumber,
|
|
525
231
|
isObject = U.isObject,
|
|
526
232
|
merge = U.merge;
|
|
527
233
|
/* *
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
// If they no longer intersects, remove the cache from the point.
|
|
596
|
-
if (!intersects) {
|
|
597
|
-
delete point.lastCollidedWith;
|
|
234
|
+
*
|
|
235
|
+
* Functions
|
|
236
|
+
*
|
|
237
|
+
* */
|
|
238
|
+
/* eslint-disable valid-jsdoc */
|
|
239
|
+
/**
|
|
240
|
+
* Detects if there is a collision between two rectangles.
|
|
241
|
+
*
|
|
242
|
+
* @private
|
|
243
|
+
* @function isRectanglesIntersecting
|
|
244
|
+
*
|
|
245
|
+
* @param {Highcharts.PolygonBoxObject} r1
|
|
246
|
+
* First rectangle.
|
|
247
|
+
*
|
|
248
|
+
* @param {Highcharts.PolygonBoxObject} r2
|
|
249
|
+
* Second rectangle.
|
|
250
|
+
*
|
|
251
|
+
* @return {boolean}
|
|
252
|
+
* Returns true if the rectangles overlap.
|
|
253
|
+
*/
|
|
254
|
+
function isRectanglesIntersecting(r1, r2) {
|
|
255
|
+
return !(r2.left > r1.right ||
|
|
256
|
+
r2.right < r1.left ||
|
|
257
|
+
r2.top > r1.bottom ||
|
|
258
|
+
r2.bottom < r1.top);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Calculates the normals to a line between two points.
|
|
262
|
+
*
|
|
263
|
+
* @private
|
|
264
|
+
* @function getNormals
|
|
265
|
+
* @param {Highcharts.PolygonPointObject} p1
|
|
266
|
+
* Start point for the line. Array of x and y value.
|
|
267
|
+
* @param {Highcharts.PolygonPointObject} p2
|
|
268
|
+
* End point for the line. Array of x and y value.
|
|
269
|
+
* @return {Highcharts.PolygonObject}
|
|
270
|
+
* Returns the two normals in an array.
|
|
271
|
+
*/
|
|
272
|
+
function getNormals(p1, p2) {
|
|
273
|
+
var dx = p2[0] - p1[0], // x2 - x1
|
|
274
|
+
dy = p2[1] - p1[1]; // y2 - y1
|
|
275
|
+
return [
|
|
276
|
+
[-dy,
|
|
277
|
+
dx],
|
|
278
|
+
[dy, -dx]
|
|
279
|
+
];
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
function getAxesFromPolygon(polygon) {
|
|
285
|
+
var points,
|
|
286
|
+
axes = polygon.axes || [];
|
|
287
|
+
if (!axes.length) {
|
|
288
|
+
axes = [];
|
|
289
|
+
points = points = polygon.concat([polygon[0]]);
|
|
290
|
+
points.reduce(function findAxis(p1, p2) {
|
|
291
|
+
var normals = getNormals(p1,
|
|
292
|
+
p2),
|
|
293
|
+
axis = normals[0]; // Use the left normal as axis.
|
|
294
|
+
// Check that the axis is unique.
|
|
295
|
+
if (!find(axes,
|
|
296
|
+
function (existing) {
|
|
297
|
+
return existing[0] === axis[0] &&
|
|
298
|
+
existing[1] === axis[1];
|
|
299
|
+
})) {
|
|
300
|
+
axes.push(axis);
|
|
598
301
|
}
|
|
302
|
+
// Return p2 to be used as p1 in next iteration.
|
|
303
|
+
return p2;
|
|
304
|
+
});
|
|
305
|
+
polygon.axes = axes;
|
|
306
|
+
}
|
|
307
|
+
return axes;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Projects a polygon onto a coordinate.
|
|
311
|
+
*
|
|
312
|
+
* @private
|
|
313
|
+
* @function project
|
|
314
|
+
* @param {Highcharts.PolygonObject} polygon
|
|
315
|
+
* Array of points in a polygon.
|
|
316
|
+
* @param {Highcharts.PolygonPointObject} target
|
|
317
|
+
* The coordinate of pr
|
|
318
|
+
* @return {Highcharts.RangeObject}
|
|
319
|
+
*/
|
|
320
|
+
function project(polygon, target) {
|
|
321
|
+
var products = polygon.map(function (point) {
|
|
322
|
+
var ax = point[0],
|
|
323
|
+
ay = point[1],
|
|
324
|
+
bx = target[0],
|
|
325
|
+
by = target[1];
|
|
326
|
+
return ax * bx + ay * by;
|
|
327
|
+
});
|
|
328
|
+
return {
|
|
329
|
+
min: Math.min.apply(this, products),
|
|
330
|
+
max: Math.max.apply(this, products)
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
function isPolygonsOverlappingOnAxis(axis, polygon1, polygon2) {
|
|
337
|
+
var projection1 = project(polygon1,
|
|
338
|
+
axis),
|
|
339
|
+
projection2 = project(polygon2,
|
|
340
|
+
axis),
|
|
341
|
+
isOverlapping = !(projection2.min > projection1.max ||
|
|
342
|
+
projection2.max < projection1.min);
|
|
343
|
+
return !isOverlapping;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Checks wether two convex polygons are colliding by using the Separating
|
|
347
|
+
* Axis Theorem.
|
|
348
|
+
*
|
|
349
|
+
* @private
|
|
350
|
+
* @function isPolygonsColliding
|
|
351
|
+
* @param {Highcharts.PolygonObject} polygon1
|
|
352
|
+
* First polygon.
|
|
353
|
+
*
|
|
354
|
+
* @param {Highcharts.PolygonObject} polygon2
|
|
355
|
+
* Second polygon.
|
|
356
|
+
*
|
|
357
|
+
* @return {boolean}
|
|
358
|
+
* Returns true if they are colliding, otherwise false.
|
|
359
|
+
*/
|
|
360
|
+
function isPolygonsColliding(polygon1, polygon2) {
|
|
361
|
+
// Get the axis from both polygons.
|
|
362
|
+
var axes1 = getAxesFromPolygon(polygon1),
|
|
363
|
+
axes2 = getAxesFromPolygon(polygon2),
|
|
364
|
+
axes = axes1.concat(axes2),
|
|
365
|
+
overlappingOnAllAxes = !find(axes,
|
|
366
|
+
function (axis) { return isPolygonsOverlappingOnAxis(axis,
|
|
367
|
+
polygon1,
|
|
368
|
+
polygon2); });
|
|
369
|
+
return overlappingOnAllAxes;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Detects if a word collides with any previously placed words.
|
|
373
|
+
*
|
|
374
|
+
* @private
|
|
375
|
+
* @function intersectsAnyWord
|
|
376
|
+
*
|
|
377
|
+
* @param {Highcharts.Point} point
|
|
378
|
+
* Point which the word is connected to.
|
|
379
|
+
*
|
|
380
|
+
* @param {Array<Highcharts.Point>} points
|
|
381
|
+
* Previously placed points to check against.
|
|
382
|
+
*
|
|
383
|
+
* @return {boolean}
|
|
384
|
+
* Returns true if there is collision.
|
|
385
|
+
*/
|
|
386
|
+
function intersectsAnyWord(point, points) {
|
|
387
|
+
var intersects = false,
|
|
388
|
+
rect = point.rect,
|
|
389
|
+
polygon = point.polygon,
|
|
390
|
+
lastCollidedWith = point.lastCollidedWith,
|
|
391
|
+
isIntersecting = function (p) {
|
|
392
|
+
var result = isRectanglesIntersecting(rect,
|
|
393
|
+
p.rect);
|
|
394
|
+
if (result &&
|
|
395
|
+
(point.rotation % 90 || p.rotation % 90)) {
|
|
396
|
+
result = isPolygonsColliding(polygon, p.polygon);
|
|
599
397
|
}
|
|
600
|
-
|
|
601
|
-
|
|
398
|
+
return result;
|
|
399
|
+
};
|
|
400
|
+
// If the point has already intersected a different point, chances are
|
|
401
|
+
// they are still intersecting. So as an enhancement we check this
|
|
402
|
+
// first.
|
|
403
|
+
if (lastCollidedWith) {
|
|
404
|
+
intersects = isIntersecting(lastCollidedWith);
|
|
405
|
+
// If they no longer intersects, remove the cache from the point.
|
|
602
406
|
if (!intersects) {
|
|
603
|
-
|
|
604
|
-
var result = isIntersecting(p);
|
|
605
|
-
if (result) {
|
|
606
|
-
point.lastCollidedWith = p;
|
|
607
|
-
}
|
|
608
|
-
return result;
|
|
609
|
-
});
|
|
407
|
+
delete point.lastCollidedWith;
|
|
610
408
|
}
|
|
611
|
-
return intersects;
|
|
612
409
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
* @param {number} attempt
|
|
621
|
-
* How far along the spiral we have traversed.
|
|
622
|
-
*
|
|
623
|
-
* @param {Highcharts.WordcloudSpiralParamsObject} [params]
|
|
624
|
-
* Additional parameters.
|
|
625
|
-
*
|
|
626
|
-
* @return {boolean|Highcharts.PositionObject}
|
|
627
|
-
* Resulting coordinates, x and y. False if the word should be dropped from
|
|
628
|
-
* the visualization.
|
|
629
|
-
*/
|
|
630
|
-
function archimedeanSpiral(attempt, params) {
|
|
631
|
-
var field = params.field,
|
|
632
|
-
result = false,
|
|
633
|
-
maxDelta = (field.width * field.width) + (field.height * field.height),
|
|
634
|
-
t = attempt * 0.8; // 0.2 * 4 = 0.8. Enlarging the spiral.
|
|
635
|
-
// Emergency brake. TODO make spiralling logic more foolproof.
|
|
636
|
-
if (attempt <= 10000) {
|
|
637
|
-
result = {
|
|
638
|
-
x: t * Math.cos(t),
|
|
639
|
-
y: t * Math.sin(t)
|
|
640
|
-
};
|
|
641
|
-
if (!(Math.min(Math.abs(result.x), Math.abs(result.y)) < maxDelta)) {
|
|
642
|
-
result = false;
|
|
410
|
+
// If not already found, then check if we can find a point that is
|
|
411
|
+
// intersecting.
|
|
412
|
+
if (!intersects) {
|
|
413
|
+
intersects = !!find(points, function (p) {
|
|
414
|
+
var result = isIntersecting(p);
|
|
415
|
+
if (result) {
|
|
416
|
+
point.lastCollidedWith = p;
|
|
643
417
|
}
|
|
644
|
-
|
|
645
|
-
|
|
418
|
+
return result;
|
|
419
|
+
});
|
|
646
420
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}, result = false;
|
|
672
|
-
t -= 1;
|
|
421
|
+
return intersects;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Gives a set of cordinates for an Archimedian Spiral.
|
|
425
|
+
*
|
|
426
|
+
* @private
|
|
427
|
+
* @function archimedeanSpiral
|
|
428
|
+
*
|
|
429
|
+
* @param {number} attempt
|
|
430
|
+
* How far along the spiral we have traversed.
|
|
431
|
+
*
|
|
432
|
+
* @param {Highcharts.WordcloudSpiralParamsObject} [params]
|
|
433
|
+
* Additional parameters.
|
|
434
|
+
*
|
|
435
|
+
* @return {boolean|Highcharts.PositionObject}
|
|
436
|
+
* Resulting coordinates, x and y. False if the word should be dropped from
|
|
437
|
+
* the visualization.
|
|
438
|
+
*/
|
|
439
|
+
function archimedeanSpiral(attempt, params) {
|
|
440
|
+
var field = params.field,
|
|
441
|
+
result = false,
|
|
442
|
+
maxDelta = (field.width * field.width) + (field.height * field.height),
|
|
443
|
+
t = attempt * 0.8; // 0.2 * 4 = 0.8. Enlarging the spiral.
|
|
444
|
+
// Emergency brake. TODO make spiralling logic more foolproof.
|
|
673
445
|
if (attempt <= 10000) {
|
|
674
|
-
|
|
446
|
+
result = {
|
|
447
|
+
x: t * Math.cos(t),
|
|
448
|
+
y: t * Math.sin(t)
|
|
449
|
+
};
|
|
450
|
+
if (!(Math.min(Math.abs(result.x), Math.abs(result.y)) < maxDelta)) {
|
|
451
|
+
result = false;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return result;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Gives a set of cordinates for an rectangular spiral.
|
|
458
|
+
*
|
|
459
|
+
* @private
|
|
460
|
+
* @function squareSpiral
|
|
461
|
+
*
|
|
462
|
+
* @param {number} attempt
|
|
463
|
+
* How far along the spiral we have traversed.
|
|
464
|
+
*
|
|
465
|
+
* @param {Highcharts.WordcloudSpiralParamsObject} [params]
|
|
466
|
+
* Additional parameters.
|
|
467
|
+
*
|
|
468
|
+
* @return {boolean|Highcharts.PositionObject}
|
|
469
|
+
* Resulting coordinates, x and y. False if the word should be dropped from
|
|
470
|
+
* the visualization.
|
|
471
|
+
*/
|
|
472
|
+
function squareSpiral(attempt, params) {
|
|
473
|
+
var a = attempt * 4,
|
|
474
|
+
k = Math.ceil((Math.sqrt(a) - 1) / 2),
|
|
475
|
+
t = 2 * k + 1,
|
|
476
|
+
m = Math.pow(t, 2),
|
|
477
|
+
isBoolean = function (x) {
|
|
478
|
+
return typeof x === 'boolean';
|
|
479
|
+
}, result = false;
|
|
480
|
+
t -= 1;
|
|
481
|
+
if (attempt <= 10000) {
|
|
482
|
+
if (isBoolean(result) && a >= m - t) {
|
|
483
|
+
result = {
|
|
484
|
+
x: k - (m - a),
|
|
485
|
+
y: -k
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
m -= t;
|
|
489
|
+
if (isBoolean(result) && a >= m - t) {
|
|
490
|
+
result = {
|
|
491
|
+
x: -k,
|
|
492
|
+
y: -k + (m - a)
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
m -= t;
|
|
496
|
+
if (isBoolean(result)) {
|
|
497
|
+
if (a >= m - t) {
|
|
675
498
|
result = {
|
|
676
|
-
x: k
|
|
677
|
-
y:
|
|
499
|
+
x: -k + (m - a),
|
|
500
|
+
y: k
|
|
678
501
|
};
|
|
679
502
|
}
|
|
680
|
-
|
|
681
|
-
if (isBoolean(result) && a >= m - t) {
|
|
503
|
+
else {
|
|
682
504
|
result = {
|
|
683
|
-
x:
|
|
684
|
-
y:
|
|
505
|
+
x: k,
|
|
506
|
+
y: k - (m - a - t)
|
|
685
507
|
};
|
|
686
508
|
}
|
|
687
|
-
m -= t;
|
|
688
|
-
if (isBoolean(result)) {
|
|
689
|
-
if (a >= m - t) {
|
|
690
|
-
result = {
|
|
691
|
-
x: -k + (m - a),
|
|
692
|
-
y: k
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
else {
|
|
696
|
-
result = {
|
|
697
|
-
x: k,
|
|
698
|
-
y: k - (m - a - t)
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
result.x *= 5;
|
|
703
|
-
result.y *= 5;
|
|
704
509
|
}
|
|
705
|
-
|
|
510
|
+
result.x *= 5;
|
|
511
|
+
result.y *= 5;
|
|
706
512
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
return result;
|
|
513
|
+
return result;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Gives a set of cordinates for an rectangular spiral.
|
|
517
|
+
*
|
|
518
|
+
* @private
|
|
519
|
+
* @function rectangularSpiral
|
|
520
|
+
*
|
|
521
|
+
* @param {number} attempt
|
|
522
|
+
* How far along the spiral we have traversed.
|
|
523
|
+
*
|
|
524
|
+
* @param {Highcharts.WordcloudSpiralParamsObject} [params]
|
|
525
|
+
* Additional parameters.
|
|
526
|
+
*
|
|
527
|
+
* @return {boolean|Higcharts.PositionObject}
|
|
528
|
+
* Resulting coordinates, x and y. False if the word should be dropped from
|
|
529
|
+
* the visualization.
|
|
530
|
+
*/
|
|
531
|
+
function rectangularSpiral(attempt, params) {
|
|
532
|
+
var result = squareSpiral(attempt,
|
|
533
|
+
params),
|
|
534
|
+
field = params.field;
|
|
535
|
+
if (result) {
|
|
536
|
+
result.x *= field.ratioX;
|
|
537
|
+
result.y *= field.ratioY;
|
|
733
538
|
}
|
|
734
|
-
|
|
539
|
+
return result;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* @private
|
|
543
|
+
* @function getRandomPosition
|
|
544
|
+
*
|
|
545
|
+
* @param {number} size
|
|
546
|
+
* Random factor.
|
|
547
|
+
*
|
|
548
|
+
* @return {number}
|
|
549
|
+
* Random position.
|
|
550
|
+
*/
|
|
551
|
+
function getRandomPosition(size) {
|
|
552
|
+
return Math.round((size * (Math.random() + 0.5)) / 2);
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Calculates the proper scale to fit the cloud inside the plotting area.
|
|
556
|
+
*
|
|
557
|
+
* @private
|
|
558
|
+
* @function getScale
|
|
559
|
+
*
|
|
560
|
+
* @param {number} targetWidth
|
|
561
|
+
* Width of target area.
|
|
562
|
+
*
|
|
563
|
+
* @param {number} targetHeight
|
|
564
|
+
* Height of target area.
|
|
565
|
+
*
|
|
566
|
+
* @param {object} field
|
|
567
|
+
* The playing field.
|
|
568
|
+
*
|
|
569
|
+
* @param {Highcharts.Series} series
|
|
570
|
+
* Series object.
|
|
571
|
+
*
|
|
572
|
+
* @return {number}
|
|
573
|
+
* Returns the value to scale the playing field up to the size of the target
|
|
574
|
+
* area.
|
|
575
|
+
*/
|
|
576
|
+
function getScale(targetWidth, targetHeight, field) {
|
|
577
|
+
var height = Math.max(Math.abs(field.top),
|
|
578
|
+
Math.abs(field.bottom)) * 2,
|
|
579
|
+
width = Math.max(Math.abs(field.left),
|
|
580
|
+
Math.abs(field.right)) * 2,
|
|
581
|
+
scaleX = width > 0 ? 1 / width * targetWidth : 1,
|
|
582
|
+
scaleY = height > 0 ? 1 / height * targetHeight : 1;
|
|
583
|
+
return Math.min(scaleX, scaleY);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Calculates what is called the playing field. The field is the area which
|
|
587
|
+
* all the words are allowed to be positioned within. The area is
|
|
588
|
+
* proportioned to match the target aspect ratio.
|
|
589
|
+
*
|
|
590
|
+
* @private
|
|
591
|
+
* @function getPlayingField
|
|
592
|
+
*
|
|
593
|
+
* @param {number} targetWidth
|
|
594
|
+
* Width of the target area.
|
|
595
|
+
*
|
|
596
|
+
* @param {number} targetHeight
|
|
597
|
+
* Height of the target area.
|
|
598
|
+
*
|
|
599
|
+
* @param {Array<Highcharts.Point>} data
|
|
600
|
+
* Array of points.
|
|
601
|
+
*
|
|
602
|
+
* @param {object} data.dimensions
|
|
603
|
+
* The height and width of the word.
|
|
604
|
+
*
|
|
605
|
+
* @return {object}
|
|
606
|
+
* The width and height of the playing field.
|
|
607
|
+
*/
|
|
608
|
+
function getPlayingField(targetWidth, targetHeight, data) {
|
|
609
|
+
var info = data.reduce(function (obj,
|
|
610
|
+
point) {
|
|
611
|
+
var dimensions = point.dimensions,
|
|
612
|
+
x = Math.max(dimensions.width,
|
|
613
|
+
dimensions.height);
|
|
614
|
+
// Find largest height.
|
|
615
|
+
obj.maxHeight = Math.max(obj.maxHeight, dimensions.height);
|
|
616
|
+
// Find largest width.
|
|
617
|
+
obj.maxWidth = Math.max(obj.maxWidth, dimensions.width);
|
|
618
|
+
// Sum up the total maximum area of all the words.
|
|
619
|
+
obj.area += x * x;
|
|
620
|
+
return obj;
|
|
621
|
+
}, {
|
|
622
|
+
maxHeight: 0,
|
|
623
|
+
maxWidth: 0,
|
|
624
|
+
area: 0
|
|
625
|
+
}),
|
|
735
626
|
/**
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
* @param {number} size
|
|
740
|
-
* Random factor.
|
|
741
|
-
*
|
|
742
|
-
* @return {number}
|
|
743
|
-
* Random position.
|
|
627
|
+
* Use largest width, largest height, or root of total area to give
|
|
628
|
+
* size to the playing field.
|
|
744
629
|
*/
|
|
745
|
-
|
|
746
|
-
|
|
630
|
+
x = Math.max(info.maxHeight, // Have enough space for the tallest word
|
|
631
|
+
info.maxWidth, // Have enough space for the broadest word
|
|
632
|
+
// Adjust 15% to account for close packing of words
|
|
633
|
+
Math.sqrt(info.area) * 0.85), ratioX = targetWidth > targetHeight ? targetWidth / targetHeight : 1, ratioY = targetHeight > targetWidth ? targetHeight / targetWidth : 1;
|
|
634
|
+
return {
|
|
635
|
+
width: x * ratioX,
|
|
636
|
+
height: x * ratioY,
|
|
637
|
+
ratioX: ratioX,
|
|
638
|
+
ratioY: ratioY
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Calculates a number of degrees to rotate, based upon a number of
|
|
643
|
+
* orientations within a range from-to.
|
|
644
|
+
*
|
|
645
|
+
* @private
|
|
646
|
+
* @function getRotation
|
|
647
|
+
*
|
|
648
|
+
* @param {number} [orientations]
|
|
649
|
+
* Number of orientations.
|
|
650
|
+
*
|
|
651
|
+
* @param {number} [index]
|
|
652
|
+
* Index of point, used to decide orientation.
|
|
653
|
+
*
|
|
654
|
+
* @param {number} [from]
|
|
655
|
+
* The smallest degree of rotation.
|
|
656
|
+
*
|
|
657
|
+
* @param {number} [to]
|
|
658
|
+
* The largest degree of rotation.
|
|
659
|
+
*
|
|
660
|
+
* @return {boolean|number}
|
|
661
|
+
* Returns the resulting rotation for the word. Returns false if invalid
|
|
662
|
+
* input parameters.
|
|
663
|
+
*/
|
|
664
|
+
function getRotation(orientations, index, from, to) {
|
|
665
|
+
var result = false, // Default to false
|
|
666
|
+
range,
|
|
667
|
+
intervals,
|
|
668
|
+
orientation;
|
|
669
|
+
// Check if we have valid input parameters.
|
|
670
|
+
if (isNumber(orientations) &&
|
|
671
|
+
isNumber(index) &&
|
|
672
|
+
isNumber(from) &&
|
|
673
|
+
isNumber(to) &&
|
|
674
|
+
orientations > 0 &&
|
|
675
|
+
index > -1 &&
|
|
676
|
+
to > from) {
|
|
677
|
+
range = to - from;
|
|
678
|
+
intervals = range / (orientations - 1 || 1);
|
|
679
|
+
orientation = index % orientations;
|
|
680
|
+
result = from + (orientation * intervals);
|
|
747
681
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
var height = Math.max(Math.abs(field.top),
|
|
773
|
-
Math.abs(field.bottom)) * 2,
|
|
774
|
-
width = Math.max(Math.abs(field.left),
|
|
775
|
-
Math.abs(field.right)) * 2,
|
|
776
|
-
scaleX = width > 0 ? 1 / width * targetWidth : 1,
|
|
777
|
-
scaleY = height > 0 ? 1 / height * targetHeight : 1;
|
|
778
|
-
return Math.min(scaleX, scaleY);
|
|
682
|
+
return result;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Calculates the spiral positions and store them in scope for quick access.
|
|
686
|
+
*
|
|
687
|
+
* @private
|
|
688
|
+
* @function getSpiral
|
|
689
|
+
*
|
|
690
|
+
* @param {Function} fn
|
|
691
|
+
* The spiral function.
|
|
692
|
+
*
|
|
693
|
+
* @param {object} params
|
|
694
|
+
* Additional parameters for the spiral.
|
|
695
|
+
*
|
|
696
|
+
* @return {Function}
|
|
697
|
+
* Function with access to spiral positions.
|
|
698
|
+
*/
|
|
699
|
+
function getSpiral(fn, params) {
|
|
700
|
+
var length = 10000,
|
|
701
|
+
i,
|
|
702
|
+
arr = [];
|
|
703
|
+
for (i = 1; i < length; i++) {
|
|
704
|
+
// @todo unnecessary amount of precaclulation
|
|
705
|
+
arr.push(fn(i, params));
|
|
779
706
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
var info = data.reduce(function (obj,
|
|
806
|
-
point) {
|
|
807
|
-
var dimensions = point.dimensions,
|
|
808
|
-
x = Math.max(dimensions.width,
|
|
809
|
-
dimensions.height);
|
|
810
|
-
// Find largest height.
|
|
811
|
-
obj.maxHeight = Math.max(obj.maxHeight, dimensions.height);
|
|
812
|
-
// Find largest width.
|
|
813
|
-
obj.maxWidth = Math.max(obj.maxWidth, dimensions.width);
|
|
814
|
-
// Sum up the total maximum area of all the words.
|
|
815
|
-
obj.area += x * x;
|
|
816
|
-
return obj;
|
|
817
|
-
}, {
|
|
818
|
-
maxHeight: 0,
|
|
819
|
-
maxWidth: 0,
|
|
820
|
-
area: 0
|
|
821
|
-
}),
|
|
822
|
-
/**
|
|
823
|
-
* Use largest width, largest height, or root of total area to give
|
|
824
|
-
* size to the playing field.
|
|
825
|
-
*/
|
|
826
|
-
x = Math.max(info.maxHeight, // Have enough space for the tallest word
|
|
827
|
-
info.maxWidth, // Have enough space for the broadest word
|
|
828
|
-
// Adjust 15% to account for close packing of words
|
|
829
|
-
Math.sqrt(info.area) * 0.85), ratioX = targetWidth > targetHeight ? targetWidth / targetHeight : 1, ratioY = targetHeight > targetWidth ? targetHeight / targetWidth : 1;
|
|
830
|
-
return {
|
|
831
|
-
width: x * ratioX,
|
|
832
|
-
height: x * ratioY,
|
|
833
|
-
ratioX: ratioX,
|
|
834
|
-
ratioY: ratioY
|
|
707
|
+
return function (attempt) {
|
|
708
|
+
return attempt <= length ? arr[attempt - 1] : false;
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Detects if a word is placed outside the playing field.
|
|
713
|
+
*
|
|
714
|
+
* @private
|
|
715
|
+
* @function outsidePlayingField
|
|
716
|
+
*
|
|
717
|
+
* @param {Highcharts.PolygonBoxObject} rect
|
|
718
|
+
* The word box.
|
|
719
|
+
*
|
|
720
|
+
* @param {Highcharts.WordcloudFieldObject} field
|
|
721
|
+
* The width and height of the playing field.
|
|
722
|
+
*
|
|
723
|
+
* @return {boolean}
|
|
724
|
+
* Returns true if the word is placed outside the field.
|
|
725
|
+
*/
|
|
726
|
+
function outsidePlayingField(rect, field) {
|
|
727
|
+
var playingField = {
|
|
728
|
+
left: -(field.width / 2),
|
|
729
|
+
right: field.width / 2,
|
|
730
|
+
top: -(field.height / 2),
|
|
731
|
+
bottom: field.height / 2
|
|
835
732
|
};
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
733
|
+
return !(playingField.left < rect.left &&
|
|
734
|
+
playingField.right > rect.right &&
|
|
735
|
+
playingField.top < rect.top &&
|
|
736
|
+
playingField.bottom > rect.bottom);
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* @private
|
|
740
|
+
*/
|
|
741
|
+
function movePolygon(deltaX, deltaY, polygon) {
|
|
742
|
+
return polygon.map(function (point) {
|
|
743
|
+
return [
|
|
744
|
+
point[0] + deltaX,
|
|
745
|
+
point[1] + deltaY
|
|
746
|
+
];
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Check if a point intersects with previously placed words, or if it goes
|
|
751
|
+
* outside the field boundaries. If a collision, then try to adjusts the
|
|
752
|
+
* position.
|
|
753
|
+
*
|
|
754
|
+
* @private
|
|
755
|
+
* @function intersectionTesting
|
|
756
|
+
*
|
|
757
|
+
* @param {Highcharts.Point} point
|
|
758
|
+
* Point to test for intersections.
|
|
759
|
+
*
|
|
760
|
+
* @param {Highcharts.WordcloudTestOptionsObject} options
|
|
761
|
+
* Options object.
|
|
762
|
+
*
|
|
763
|
+
* @return {boolean|Highcharts.PositionObject}
|
|
764
|
+
* Returns an object with how much to correct the positions. Returns false
|
|
765
|
+
* if the word should not be placed at all.
|
|
766
|
+
*/
|
|
767
|
+
function intersectionTesting(point, options) {
|
|
768
|
+
var placed = options.placed,
|
|
769
|
+
field = options.field,
|
|
770
|
+
rectangle = options.rectangle,
|
|
771
|
+
polygon = options.polygon,
|
|
772
|
+
spiral = options.spiral,
|
|
773
|
+
attempt = 1,
|
|
774
|
+
delta = {
|
|
775
|
+
x: 0,
|
|
776
|
+
y: 0
|
|
777
|
+
},
|
|
778
|
+
// Make a copy to update values during intersection testing.
|
|
779
|
+
rect = point.rect = extend({},
|
|
780
|
+
rectangle);
|
|
781
|
+
point.polygon = polygon;
|
|
782
|
+
point.rotation = options.rotation;
|
|
783
|
+
/* while w intersects any previously placed words:
|
|
784
|
+
do {
|
|
785
|
+
move w a little bit along a spiral path
|
|
786
|
+
} while any part of w is outside the playing field and
|
|
787
|
+
the spiral radius is still smallish */
|
|
788
|
+
while (delta !== false &&
|
|
789
|
+
(intersectsAnyWord(point, placed) ||
|
|
790
|
+
outsidePlayingField(rect, field))) {
|
|
791
|
+
delta = spiral(attempt);
|
|
792
|
+
if (isObject(delta)) {
|
|
793
|
+
// Update the DOMRect with new positions.
|
|
794
|
+
rect.left = rectangle.left + delta.x;
|
|
795
|
+
rect.right = rectangle.right + delta.x;
|
|
796
|
+
rect.top = rectangle.top + delta.y;
|
|
797
|
+
rect.bottom = rectangle.bottom + delta.y;
|
|
798
|
+
point.polygon = movePolygon(delta.x, delta.y, polygon);
|
|
878
799
|
}
|
|
879
|
-
|
|
800
|
+
attempt++;
|
|
880
801
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
802
|
+
return delta;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Extends the playing field to have enough space to fit a given word.
|
|
806
|
+
*
|
|
807
|
+
* @private
|
|
808
|
+
* @function extendPlayingField
|
|
809
|
+
*
|
|
810
|
+
* @param {Highcharts.WordcloudFieldObject} field
|
|
811
|
+
* The width, height and ratios of a playing field.
|
|
812
|
+
*
|
|
813
|
+
* @param {Highcharts.PolygonBoxObject} rectangle
|
|
814
|
+
* The bounding box of the word to add space for.
|
|
815
|
+
*
|
|
816
|
+
* @return {Highcharts.WordcloudFieldObject}
|
|
817
|
+
* Returns the extended playing field with updated height and width.
|
|
818
|
+
*/
|
|
819
|
+
function extendPlayingField(field, rectangle) {
|
|
820
|
+
var height,
|
|
821
|
+
width,
|
|
822
|
+
ratioX,
|
|
823
|
+
ratioY,
|
|
824
|
+
x,
|
|
825
|
+
extendWidth,
|
|
826
|
+
extendHeight,
|
|
827
|
+
result;
|
|
828
|
+
if (isObject(field) && isObject(rectangle)) {
|
|
829
|
+
height = (rectangle.bottom - rectangle.top);
|
|
830
|
+
width = (rectangle.right - rectangle.left);
|
|
831
|
+
ratioX = field.ratioX;
|
|
832
|
+
ratioY = field.ratioY;
|
|
833
|
+
// Use the same variable to extend both the height and width.
|
|
834
|
+
x = ((width * ratioX) > (height * ratioY)) ? width : height;
|
|
835
|
+
// Multiply variable with ratios to preserve aspect ratio.
|
|
836
|
+
extendWidth = x * ratioX;
|
|
837
|
+
extendHeight = x * ratioY;
|
|
838
|
+
// Calculate the size of the new field after adding
|
|
839
|
+
// space for the word.
|
|
840
|
+
result = merge(field, {
|
|
841
|
+
// Add space on the left and right.
|
|
842
|
+
width: field.width + (extendWidth * 2),
|
|
843
|
+
// Add space on the top and bottom.
|
|
844
|
+
height: field.height + (extendHeight * 2)
|
|
845
|
+
});
|
|
908
846
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
* Detects if a word is placed outside the playing field.
|
|
912
|
-
*
|
|
913
|
-
* @private
|
|
914
|
-
* @function outsidePlayingField
|
|
915
|
-
*
|
|
916
|
-
* @param {Highcharts.PolygonBoxObject} rect
|
|
917
|
-
* The word box.
|
|
918
|
-
*
|
|
919
|
-
* @param {Highcharts.WordcloudFieldObject} field
|
|
920
|
-
* The width and height of the playing field.
|
|
921
|
-
*
|
|
922
|
-
* @return {boolean}
|
|
923
|
-
* Returns true if the word is placed outside the field.
|
|
924
|
-
*/
|
|
925
|
-
function outsidePlayingField(rect, field) {
|
|
926
|
-
var playingField = {
|
|
927
|
-
left: -(field.width / 2),
|
|
928
|
-
right: field.width / 2,
|
|
929
|
-
top: -(field.height / 2),
|
|
930
|
-
bottom: field.height / 2
|
|
931
|
-
};
|
|
932
|
-
return !(playingField.left < rect.left &&
|
|
933
|
-
playingField.right > rect.right &&
|
|
934
|
-
playingField.top < rect.top &&
|
|
935
|
-
playingField.bottom > rect.bottom);
|
|
847
|
+
else {
|
|
848
|
+
result = field;
|
|
936
849
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
spiral = options.spiral,
|
|
962
|
-
attempt = 1,
|
|
963
|
-
delta = {
|
|
964
|
-
x: 0,
|
|
965
|
-
y: 0
|
|
966
|
-
},
|
|
967
|
-
// Make a copy to update values during intersection testing.
|
|
968
|
-
rect = point.rect = extend({},
|
|
969
|
-
rectangle);
|
|
970
|
-
point.polygon = polygon;
|
|
971
|
-
point.rotation = options.rotation;
|
|
972
|
-
/* while w intersects any previously placed words:
|
|
973
|
-
do {
|
|
974
|
-
move w a little bit along a spiral path
|
|
975
|
-
} while any part of w is outside the playing field and
|
|
976
|
-
the spiral radius is still smallish */
|
|
977
|
-
while (delta !== false &&
|
|
978
|
-
(intersectsAnyWord(point, placed) ||
|
|
979
|
-
outsidePlayingField(rect, field))) {
|
|
980
|
-
delta = spiral(attempt);
|
|
981
|
-
if (isObject(delta)) {
|
|
982
|
-
// Update the DOMRect with new positions.
|
|
983
|
-
rect.left = rectangle.left + delta.x;
|
|
984
|
-
rect.right = rectangle.right + delta.x;
|
|
985
|
-
rect.top = rectangle.top + delta.y;
|
|
986
|
-
rect.bottom = rectangle.bottom + delta.y;
|
|
987
|
-
point.polygon = movePolygon(delta.x, delta.y, polygon);
|
|
988
|
-
}
|
|
989
|
-
attempt++;
|
|
990
|
-
}
|
|
991
|
-
return delta;
|
|
850
|
+
// Return the new extended field.
|
|
851
|
+
return result;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* If a rectangle is outside a give field, then the boundaries of the field
|
|
855
|
+
* is adjusted accordingly. Modifies the field object which is passed as the
|
|
856
|
+
* first parameter.
|
|
857
|
+
*
|
|
858
|
+
* @private
|
|
859
|
+
* @function updateFieldBoundaries
|
|
860
|
+
*
|
|
861
|
+
* @param {Highcharts.WordcloudFieldObject} field
|
|
862
|
+
* The bounding box of a playing field.
|
|
863
|
+
*
|
|
864
|
+
* @param {Highcharts.PolygonBoxObject} rectangle
|
|
865
|
+
* The bounding box for a placed point.
|
|
866
|
+
*
|
|
867
|
+
* @return {Highcharts.WordcloudFieldObject}
|
|
868
|
+
* Returns a modified field object.
|
|
869
|
+
*/
|
|
870
|
+
function updateFieldBoundaries(field, rectangle) {
|
|
871
|
+
// @todo improve type checking.
|
|
872
|
+
if (!isNumber(field.left) || field.left > rectangle.left) {
|
|
873
|
+
field.left = rectangle.left;
|
|
992
874
|
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
* Extends the playing field to have enough space to fit a given word.
|
|
996
|
-
*
|
|
997
|
-
* @private
|
|
998
|
-
* @function extendPlayingField
|
|
999
|
-
*
|
|
1000
|
-
* @param {Highcharts.WordcloudFieldObject} field
|
|
1001
|
-
* The width, height and ratios of a playing field.
|
|
1002
|
-
*
|
|
1003
|
-
* @param {Highcharts.PolygonBoxObject} rectangle
|
|
1004
|
-
* The bounding box of the word to add space for.
|
|
1005
|
-
*
|
|
1006
|
-
* @return {Highcharts.WordcloudFieldObject}
|
|
1007
|
-
* Returns the extended playing field with updated height and width.
|
|
1008
|
-
*/
|
|
1009
|
-
function extendPlayingField(field, rectangle) {
|
|
1010
|
-
var height,
|
|
1011
|
-
width,
|
|
1012
|
-
ratioX,
|
|
1013
|
-
ratioY,
|
|
1014
|
-
x,
|
|
1015
|
-
extendWidth,
|
|
1016
|
-
extendHeight,
|
|
1017
|
-
result;
|
|
1018
|
-
if (isObject(field) && isObject(rectangle)) {
|
|
1019
|
-
height = (rectangle.bottom - rectangle.top);
|
|
1020
|
-
width = (rectangle.right - rectangle.left);
|
|
1021
|
-
ratioX = field.ratioX;
|
|
1022
|
-
ratioY = field.ratioY;
|
|
1023
|
-
// Use the same variable to extend both the height and width.
|
|
1024
|
-
x = ((width * ratioX) > (height * ratioY)) ? width : height;
|
|
1025
|
-
// Multiply variable with ratios to preserve aspect ratio.
|
|
1026
|
-
extendWidth = x * ratioX;
|
|
1027
|
-
extendHeight = x * ratioY;
|
|
1028
|
-
// Calculate the size of the new field after adding
|
|
1029
|
-
// space for the word.
|
|
1030
|
-
result = merge(field, {
|
|
1031
|
-
// Add space on the left and right.
|
|
1032
|
-
width: field.width + (extendWidth * 2),
|
|
1033
|
-
// Add space on the top and bottom.
|
|
1034
|
-
height: field.height + (extendHeight * 2)
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
else {
|
|
1038
|
-
result = field;
|
|
1039
|
-
}
|
|
1040
|
-
// Return the new extended field.
|
|
1041
|
-
return result;
|
|
875
|
+
if (!isNumber(field.right) || field.right < rectangle.right) {
|
|
876
|
+
field.right = rectangle.right;
|
|
1042
877
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
* If a rectangle is outside a give field, then the boundaries of the field
|
|
1046
|
-
* is adjusted accordingly. Modifies the field object which is passed as the
|
|
1047
|
-
* first parameter.
|
|
1048
|
-
*
|
|
1049
|
-
* @private
|
|
1050
|
-
* @function updateFieldBoundaries
|
|
1051
|
-
*
|
|
1052
|
-
* @param {Highcharts.WordcloudFieldObject} field
|
|
1053
|
-
* The bounding box of a playing field.
|
|
1054
|
-
*
|
|
1055
|
-
* @param {Highcharts.PolygonBoxObject} rectangle
|
|
1056
|
-
* The bounding box for a placed point.
|
|
1057
|
-
*
|
|
1058
|
-
* @return {Highcharts.WordcloudFieldObject}
|
|
1059
|
-
* Returns a modified field object.
|
|
1060
|
-
*/
|
|
1061
|
-
function updateFieldBoundaries(field, rectangle) {
|
|
1062
|
-
// @todo improve type checking.
|
|
1063
|
-
if (!isNumber(field.left) || field.left > rectangle.left) {
|
|
1064
|
-
field.left = rectangle.left;
|
|
1065
|
-
}
|
|
1066
|
-
if (!isNumber(field.right) || field.right < rectangle.right) {
|
|
1067
|
-
field.right = rectangle.right;
|
|
1068
|
-
}
|
|
1069
|
-
if (!isNumber(field.top) || field.top > rectangle.top) {
|
|
1070
|
-
field.top = rectangle.top;
|
|
1071
|
-
}
|
|
1072
|
-
if (!isNumber(field.bottom) || field.bottom < rectangle.bottom) {
|
|
1073
|
-
field.bottom = rectangle.bottom;
|
|
1074
|
-
}
|
|
1075
|
-
return field;
|
|
878
|
+
if (!isNumber(field.top) || field.top > rectangle.top) {
|
|
879
|
+
field.top = rectangle.top;
|
|
1076
880
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
881
|
+
if (!isNumber(field.bottom) || field.bottom < rectangle.bottom) {
|
|
882
|
+
field.bottom = rectangle.bottom;
|
|
883
|
+
}
|
|
884
|
+
return field;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Alternative solution to correctFloat.
|
|
888
|
+
* E.g Highcharts.correctFloat(123, 2) returns 120, when it should be 123.
|
|
889
|
+
*
|
|
890
|
+
* @private
|
|
891
|
+
* @function correctFloat
|
|
892
|
+
* @param {number} number
|
|
893
|
+
* @param {number} [precision]
|
|
894
|
+
* @return {number}
|
|
895
|
+
*/
|
|
896
|
+
function correctFloat(number, precision) {
|
|
897
|
+
var p = isNumber(precision) ? precision : 14,
|
|
898
|
+
magnitude = Math.pow(10,
|
|
899
|
+
p);
|
|
900
|
+
return Math.round(number * magnitude) / magnitude;
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* @private
|
|
904
|
+
*/
|
|
905
|
+
function getBoundingBoxFromPolygon(points) {
|
|
906
|
+
return points.reduce(function (obj, point) {
|
|
907
|
+
var x = point[0],
|
|
908
|
+
y = point[1];
|
|
909
|
+
obj.left = Math.min(x, obj.left);
|
|
910
|
+
obj.right = Math.max(x, obj.right);
|
|
911
|
+
obj.bottom = Math.max(y, obj.bottom);
|
|
912
|
+
obj.top = Math.min(y, obj.top);
|
|
913
|
+
return obj;
|
|
914
|
+
}, {
|
|
915
|
+
left: Number.MAX_VALUE,
|
|
916
|
+
right: -Number.MAX_VALUE,
|
|
917
|
+
bottom: -Number.MAX_VALUE,
|
|
918
|
+
top: Number.MAX_VALUE
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* @private
|
|
923
|
+
*/
|
|
924
|
+
function getPolygon(x, y, width, height, rotation) {
|
|
925
|
+
var origin = [x,
|
|
926
|
+
y],
|
|
927
|
+
left = x - (width / 2),
|
|
928
|
+
right = x + (width / 2),
|
|
929
|
+
top = y - (height / 2),
|
|
930
|
+
bottom = y + (height / 2),
|
|
931
|
+
polygon = [
|
|
932
|
+
[left,
|
|
933
|
+
top],
|
|
934
|
+
[right,
|
|
935
|
+
top],
|
|
936
|
+
[right,
|
|
937
|
+
bottom],
|
|
938
|
+
[left,
|
|
939
|
+
bottom]
|
|
940
|
+
];
|
|
941
|
+
return polygon.map(function (point) {
|
|
942
|
+
return rotate2DToPoint(point, origin, -rotation);
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Rotates a point clockwise around the origin.
|
|
947
|
+
*
|
|
948
|
+
* @private
|
|
949
|
+
* @function rotate2DToOrigin
|
|
950
|
+
* @param {Highcharts.PolygonPointObject} point
|
|
951
|
+
* The x and y coordinates for the point.
|
|
952
|
+
* @param {number} angle
|
|
953
|
+
* The angle of rotation.
|
|
954
|
+
* @return {Highcharts.PolygonPointObject}
|
|
955
|
+
* The x and y coordinate for the rotated point.
|
|
956
|
+
*/
|
|
957
|
+
function rotate2DToOrigin(point, angle) {
|
|
958
|
+
var x = point[0],
|
|
959
|
+
y = point[1],
|
|
960
|
+
rad = deg2rad * -angle,
|
|
961
|
+
cosAngle = Math.cos(rad),
|
|
962
|
+
sinAngle = Math.sin(rad);
|
|
963
|
+
return [
|
|
964
|
+
correctFloat(x * cosAngle - y * sinAngle),
|
|
965
|
+
correctFloat(x * sinAngle + y * cosAngle)
|
|
966
|
+
];
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Rotate a point clockwise around another point.
|
|
970
|
+
*
|
|
971
|
+
* @private
|
|
972
|
+
* @function rotate2DToPoint
|
|
973
|
+
* @param {Highcharts.PolygonPointObject} point
|
|
974
|
+
* The x and y coordinates for the point.
|
|
975
|
+
* @param {Highcharts.PolygonPointObject} origin
|
|
976
|
+
* The point to rotate around.
|
|
977
|
+
* @param {number} angle
|
|
978
|
+
* The angle of rotation.
|
|
979
|
+
* @return {Highcharts.PolygonPointObject}
|
|
980
|
+
* The x and y coordinate for the rotated point.
|
|
981
|
+
*/
|
|
982
|
+
function rotate2DToPoint(point, origin, angle) {
|
|
983
|
+
var x = point[0] - origin[0],
|
|
984
|
+
y = point[1] - origin[1],
|
|
985
|
+
rotated = rotate2DToOrigin([x,
|
|
986
|
+
y],
|
|
987
|
+
angle);
|
|
988
|
+
return [
|
|
989
|
+
rotated[0] + origin[0],
|
|
990
|
+
rotated[1] + origin[1]
|
|
991
|
+
];
|
|
992
|
+
}
|
|
1079
993
|
/* *
|
|
1080
994
|
*
|
|
1081
995
|
* Default export
|
|
1082
996
|
*
|
|
1083
997
|
* */
|
|
998
|
+
var WordcloudUtils = {
|
|
999
|
+
archimedeanSpiral: archimedeanSpiral,
|
|
1000
|
+
extendPlayingField: extendPlayingField,
|
|
1001
|
+
getBoundingBoxFromPolygon: getBoundingBoxFromPolygon,
|
|
1002
|
+
getPlayingField: getPlayingField,
|
|
1003
|
+
getPolygon: getPolygon,
|
|
1004
|
+
getRandomPosition: getRandomPosition,
|
|
1005
|
+
getRotation: getRotation,
|
|
1006
|
+
getScale: getScale,
|
|
1007
|
+
getSpiral: getSpiral,
|
|
1008
|
+
intersectionTesting: intersectionTesting,
|
|
1009
|
+
isPolygonsColliding: isPolygonsColliding,
|
|
1010
|
+
isRectanglesIntersecting: isRectanglesIntersecting,
|
|
1011
|
+
rectangularSpiral: rectangularSpiral,
|
|
1012
|
+
rotate2DToOrigin: rotate2DToOrigin,
|
|
1013
|
+
rotate2DToPoint: rotate2DToPoint,
|
|
1014
|
+
squareSpiral: squareSpiral,
|
|
1015
|
+
updateFieldBoundaries: updateFieldBoundaries
|
|
1016
|
+
};
|
|
1084
1017
|
|
|
1085
1018
|
return WordcloudUtils;
|
|
1086
1019
|
});
|
|
1087
|
-
_registerModule(_modules, 'Series/Wordcloud/WordcloudSeries.js', [_modules['Core/Globals.js'], _modules['
|
|
1020
|
+
_registerModule(_modules, 'Series/Wordcloud/WordcloudSeries.js', [_modules['Core/Globals.js'], _modules['Core/Series/Series.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js'], _modules['Series/Wordcloud/WordcloudPoint.js'], _modules['Series/Wordcloud/WordcloudUtils.js']], function (H, Series, SeriesRegistry, U, WordcloudPoint, WordcloudUtils) {
|
|
1088
1021
|
/* *
|
|
1089
1022
|
*
|
|
1090
1023
|
* Experimental Highcharts module which enables visualization of a word cloud.
|
|
@@ -1113,18 +1046,33 @@
|
|
|
1113
1046
|
};
|
|
1114
1047
|
})();
|
|
1115
1048
|
var noop = H.noop;
|
|
1116
|
-
var getBoundingBoxFromPolygon = PolygonMixin.getBoundingBoxFromPolygon,
|
|
1117
|
-
getPolygon = PolygonMixin.getPolygon,
|
|
1118
|
-
isPolygonsColliding = PolygonMixin.isPolygonsColliding,
|
|
1119
|
-
rotate2DToOrigin = PolygonMixin.rotate2DToOrigin,
|
|
1120
|
-
rotate2DToPoint = PolygonMixin.rotate2DToPoint;
|
|
1121
1049
|
var ColumnSeries = SeriesRegistry.seriesTypes.column;
|
|
1122
1050
|
var extend = U.extend,
|
|
1123
|
-
find = U.find,
|
|
1124
1051
|
isArray = U.isArray,
|
|
1125
1052
|
isNumber = U.isNumber,
|
|
1126
1053
|
isObject = U.isObject,
|
|
1127
1054
|
merge = U.merge;
|
|
1055
|
+
var archimedeanSpiral = WordcloudUtils.archimedeanSpiral,
|
|
1056
|
+
extendPlayingField = WordcloudUtils.extendPlayingField,
|
|
1057
|
+
getBoundingBoxFromPolygon = WordcloudUtils.getBoundingBoxFromPolygon,
|
|
1058
|
+
getPlayingField = WordcloudUtils.getPlayingField,
|
|
1059
|
+
getPolygon = WordcloudUtils.getPolygon,
|
|
1060
|
+
getRandomPosition = WordcloudUtils.getRandomPosition,
|
|
1061
|
+
getRotation = WordcloudUtils.getRotation,
|
|
1062
|
+
getScale = WordcloudUtils.getScale,
|
|
1063
|
+
getSpiral = WordcloudUtils.getSpiral,
|
|
1064
|
+
intersectionTesting = WordcloudUtils.intersectionTesting,
|
|
1065
|
+
isPolygonsColliding = WordcloudUtils.isPolygonsColliding,
|
|
1066
|
+
rectangularSpiral = WordcloudUtils.rectangularSpiral,
|
|
1067
|
+
rotate2DToOrigin = WordcloudUtils.rotate2DToOrigin,
|
|
1068
|
+
rotate2DToPoint = WordcloudUtils.rotate2DToPoint,
|
|
1069
|
+
squareSpiral = WordcloudUtils.squareSpiral,
|
|
1070
|
+
updateFieldBoundaries = WordcloudUtils.updateFieldBoundaries;
|
|
1071
|
+
/* *
|
|
1072
|
+
*
|
|
1073
|
+
* Class
|
|
1074
|
+
*
|
|
1075
|
+
* */
|
|
1128
1076
|
/**
|
|
1129
1077
|
* @private
|
|
1130
1078
|
* @class
|
|
@@ -1262,8 +1210,8 @@
|
|
|
1262
1210
|
};
|
|
1263
1211
|
});
|
|
1264
1212
|
// Calculate the playing field.
|
|
1265
|
-
field =
|
|
1266
|
-
spiral =
|
|
1213
|
+
field = getPlayingField(xAxis.len, yAxis.len, data);
|
|
1214
|
+
spiral = getSpiral(series.spirals[options.spiral], {
|
|
1267
1215
|
field: field
|
|
1268
1216
|
});
|
|
1269
1217
|
// Draw all the points.
|
|
@@ -1299,7 +1247,7 @@
|
|
|
1299
1247
|
point.dimensions.height,
|
|
1300
1248
|
placement.rotation),
|
|
1301
1249
|
rectangle = getBoundingBoxFromPolygon(polygon),
|
|
1302
|
-
delta =
|
|
1250
|
+
delta = intersectionTesting(point, {
|
|
1303
1251
|
rectangle: rectangle,
|
|
1304
1252
|
polygon: polygon,
|
|
1305
1253
|
field: field,
|
|
@@ -1311,9 +1259,9 @@
|
|
|
1311
1259
|
// If there is no space for the word, extend the playing field.
|
|
1312
1260
|
if (!delta && allowExtendPlayingField) {
|
|
1313
1261
|
// Extend the playing field to fit the word.
|
|
1314
|
-
field =
|
|
1262
|
+
field = extendPlayingField(field, rectangle);
|
|
1315
1263
|
// Run intersection testing one more time to place the word.
|
|
1316
|
-
delta =
|
|
1264
|
+
delta = intersectionTesting(point, {
|
|
1317
1265
|
rectangle: rectangle,
|
|
1318
1266
|
polygon: polygon,
|
|
1319
1267
|
field: field,
|
|
@@ -1331,7 +1279,7 @@
|
|
|
1331
1279
|
rectangle.right += delta.x;
|
|
1332
1280
|
rectangle.top += delta.y;
|
|
1333
1281
|
rectangle.bottom += delta.y;
|
|
1334
|
-
field =
|
|
1282
|
+
field = updateFieldBoundaries(field, rectangle);
|
|
1335
1283
|
placed.push(point);
|
|
1336
1284
|
point.isNull = false;
|
|
1337
1285
|
point.isInside = true; // #15447
|
|
@@ -1369,7 +1317,7 @@
|
|
|
1369
1317
|
// Destroy the element after use.
|
|
1370
1318
|
testElement = testElement.destroy();
|
|
1371
1319
|
// Scale the series group to fit within the plotArea.
|
|
1372
|
-
scale =
|
|
1320
|
+
scale = getScale(xAxis.len, yAxis.len, field);
|
|
1373
1321
|
series.group.attr({
|
|
1374
1322
|
scaleX: scale,
|
|
1375
1323
|
scaleY: scale
|
|
@@ -1513,7 +1461,7 @@
|
|
|
1513
1461
|
return WordcloudSeries;
|
|
1514
1462
|
}(ColumnSeries));
|
|
1515
1463
|
extend(WordcloudSeries.prototype, {
|
|
1516
|
-
animate:
|
|
1464
|
+
animate: noop,
|
|
1517
1465
|
animateDrilldown: noop,
|
|
1518
1466
|
animateDrillupFrom: noop,
|
|
1519
1467
|
pointClass: WordcloudPoint,
|
|
@@ -1526,9 +1474,9 @@
|
|
|
1526
1474
|
var field = options.field,
|
|
1527
1475
|
r = options.rotation;
|
|
1528
1476
|
return {
|
|
1529
|
-
x:
|
|
1530
|
-
y:
|
|
1531
|
-
rotation:
|
|
1477
|
+
x: getRandomPosition(field.width) - (field.width / 2),
|
|
1478
|
+
y: getRandomPosition(field.height) - (field.height / 2),
|
|
1479
|
+
rotation: getRotation(r.orientations, point.index, r.from, r.to)
|
|
1532
1480
|
};
|
|
1533
1481
|
},
|
|
1534
1482
|
center: function (point, options) {
|
|
@@ -1536,7 +1484,7 @@
|
|
|
1536
1484
|
return {
|
|
1537
1485
|
x: 0,
|
|
1538
1486
|
y: 0,
|
|
1539
|
-
rotation:
|
|
1487
|
+
rotation: getRotation(r.orientations, point.index, r.from, r.to)
|
|
1540
1488
|
};
|
|
1541
1489
|
}
|
|
1542
1490
|
},
|
|
@@ -1545,13 +1493,13 @@
|
|
|
1545
1493
|
// collision with either another word or the borders. To implement a custom
|
|
1546
1494
|
// spiral, look at the function archimedeanSpiral for example.
|
|
1547
1495
|
spirals: {
|
|
1548
|
-
'archimedean':
|
|
1549
|
-
'rectangular':
|
|
1550
|
-
'square':
|
|
1496
|
+
'archimedean': archimedeanSpiral,
|
|
1497
|
+
'rectangular': rectangularSpiral,
|
|
1498
|
+
'square': squareSpiral
|
|
1551
1499
|
},
|
|
1552
1500
|
utils: {
|
|
1553
|
-
extendPlayingField:
|
|
1554
|
-
getRotation:
|
|
1501
|
+
extendPlayingField: extendPlayingField,
|
|
1502
|
+
getRotation: getRotation,
|
|
1555
1503
|
isPolygonsColliding: isPolygonsColliding,
|
|
1556
1504
|
rotate2DToOrigin: rotate2DToOrigin,
|
|
1557
1505
|
rotate2DToPoint: rotate2DToPoint
|