highcharts 8.1.0 → 8.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bower.json +1 -1
- package/css/highcharts.css +12 -0
- package/css/highcharts.scss +12 -0
- package/css/themes/dark-unica.css +12 -0
- package/css/themes/grid-light.css +12 -0
- package/css/themes/sand-signika.css +12 -0
- package/es-modules/{modules/accessibility/a11y-i18n.js → Accessibility/A11yI18n.js} +2 -2
- package/es-modules/{modules/accessibility/accessibility.js → Accessibility/Accessibility.js} +24 -21
- package/es-modules/{modules/accessibility → Accessibility}/AccessibilityComponent.js +73 -17
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/AnnotationsA11y.js +2 -4
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/ContainerComponent.js +8 -9
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/InfoRegionsComponent.js +9 -12
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/LegendComponent.js +60 -22
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/MenuComponent.js +4 -11
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/RangeSelectorComponent.js +8 -7
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +171 -0
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/SeriesComponent/NewDataAnnouncer.js +8 -7
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/SeriesComponent/SeriesComponent.js +5 -5
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/SeriesComponent/SeriesDescriber.js +6 -6
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/SeriesComponent/SeriesKeyboardNavigation.js +22 -20
- package/es-modules/{modules/accessibility/components → Accessibility/Components}/ZoomComponent.js +9 -8
- package/es-modules/{modules/accessibility/focusBorder.js → Accessibility/FocusBorder.js} +13 -10
- package/es-modules/{modules/accessibility/high-contrast-mode.js → Accessibility/HighContrastMode.js} +3 -2
- package/es-modules/{modules/accessibility/high-contrast-theme.js → Accessibility/HighContrastTheme.js} +0 -0
- package/es-modules/{modules/accessibility → Accessibility}/KeyboardNavigation.js +35 -22
- package/es-modules/{modules/accessibility → Accessibility}/KeyboardNavigationHandler.js +1 -1
- package/es-modules/{modules/accessibility/options/deprecatedOptions.js → Accessibility/Options/DeprecatedOptions.js} +10 -20
- package/es-modules/{modules/accessibility/options/langOptions.js → Accessibility/Options/LangOptions.js} +1 -1
- package/es-modules/{modules/accessibility/options/options.js → Accessibility/Options/Options.js} +1 -2
- package/es-modules/{modules/accessibility/utils → Accessibility/Utils}/Announcer.js +2 -2
- package/es-modules/{modules/accessibility/utils/chartUtilities.js → Accessibility/Utils/ChartUtilities.js} +8 -9
- package/es-modules/{modules/accessibility/utils → Accessibility/Utils}/DOMElementProvider.js +5 -5
- package/es-modules/{modules/accessibility/utils → Accessibility/Utils}/EventProvider.js +2 -2
- package/es-modules/{modules/accessibility/utils/htmlUtilities.js → Accessibility/Utils/HTMLUtilities.js} +3 -4
- package/es-modules/Core/Animation/AnimationUtilities.js +193 -0
- package/es-modules/Core/Animation/Fx.js +378 -0
- package/es-modules/{parts → Core/Axis}/Axis.js +153 -89
- package/es-modules/{parts-3d → Core/Axis}/Axis3D.js +12 -7
- package/es-modules/{modules/broken-axis.src.js → Core/Axis/BrokenAxis.js} +6 -8
- package/es-modules/{parts-map → Core/Axis}/ColorAxis.js +28 -31
- package/es-modules/{parts → Core/Axis}/DateTimeAxis.js +1 -1
- package/es-modules/{parts-gantt → Core/Axis}/GridAxis.js +136 -39
- package/es-modules/{parts-more → Core/Axis}/HiddenAxis.js +0 -0
- package/es-modules/{parts → Core/Axis}/LogarithmicAxis.js +1 -1
- package/es-modules/{parts-map → Core/Axis}/MapAxis.js +2 -2
- package/es-modules/{parts → Core/Axis}/NavigatorAxis.js +2 -2
- package/es-modules/{parts → Core/Axis}/OrdinalAxis.js +241 -224
- package/es-modules/{parts → Core/Axis}/PlotLineOrBand.js +24 -15
- package/es-modules/{parts-more → Core/Axis}/RadialAxis.js +34 -27
- package/es-modules/{parts → Core/Axis}/ScrollbarAxis.js +2 -2
- package/es-modules/{parts → Core/Axis}/StackingAxis.js +11 -2
- package/es-modules/{parts → Core/Axis}/Tick.js +14 -14
- package/es-modules/{parts-3d → Core/Axis}/Tick3D.js +1 -1
- package/es-modules/{parts-gantt → Core/Axis}/TreeGridAxis.js +81 -15
- package/es-modules/{parts-gantt → Core/Axis}/TreeGridTick.js +1 -1
- package/es-modules/{parts-3d → Core/Axis}/ZAxis.js +2 -2
- package/es-modules/{parts → Core/Chart}/Chart.js +225 -227
- package/es-modules/Core/Chart/Chart3D.js +1674 -0
- package/es-modules/{parts-gantt → Core/Chart}/GanttChart.js +13 -12
- package/es-modules/{parts → Core/Chart}/StockChart.js +26 -25
- package/es-modules/Core/Color/Color.js +419 -0
- package/es-modules/Core/Color/ColorType.js +9 -0
- package/es-modules/{parts → Core}/Color.js +1 -1
- package/es-modules/{parts → Core}/Dynamics.js +91 -61
- package/es-modules/{parts → Core}/Globals.js +9 -1
- package/es-modules/{parts → Core}/Interaction.js +27 -20
- package/es-modules/{parts → Core}/Legend.js +26 -11
- package/es-modules/{parts → Core}/MSPointer.js +2 -2
- package/es-modules/{parts → Core}/Navigator.js +24 -14
- package/es-modules/{parts → Core}/Options.js +157 -69
- package/es-modules/{parts → Core}/Pointer.js +50 -27
- package/es-modules/Core/Renderer/DOMElementType.js +9 -0
- package/es-modules/Core/Renderer/HTML/HTMLElement.js +220 -0
- package/es-modules/{parts/Html.js → Core/Renderer/HTML/HTMLRenderer.js} +16 -207
- package/es-modules/{parts → Core/Renderer/SVG}/SVGElement.js +186 -32
- package/es-modules/Core/Renderer/SVG/SVGLabel.js +410 -0
- package/es-modules/{parts/SvgRenderer.js → Core/Renderer/SVG/SVGRenderer.js} +426 -886
- package/es-modules/{parts-3d/SVGRenderer.js → Core/Renderer/SVG/SVGRenderer3D.js} +31 -23
- package/es-modules/{parts → Core}/Responsive.js +24 -14
- package/es-modules/{parts → Core}/Scrollbar.js +5 -4
- package/es-modules/Core/Series/BaseSeries.js +157 -0
- package/es-modules/{parts/Series.js → Core/Series/CartesianSeries.js} +119 -55
- package/es-modules/{parts → Core/Series}/DataLabels.js +40 -36
- package/es-modules/{parts → Core/Series}/Point.js +8 -10
- package/es-modules/Core/Series/Series.js +158 -0
- package/es-modules/{parts-3d/Series.js → Core/Series/Series3D.js} +5 -3
- package/es-modules/{parts → Core}/Time.js +11 -133
- package/es-modules/{parts → Core}/Tooltip.js +30 -27
- package/es-modules/{parts → Core}/Utilities.js +103 -562
- package/es-modules/{mixins/ajax.js → Extensions/Ajax.js} +9 -4
- package/es-modules/{annotations/annotations.src.js → Extensions/Annotations/Annotations.js} +901 -709
- package/es-modules/{annotations → Extensions/Annotations}/ControlPoint.js +2 -2
- package/es-modules/Extensions/Annotations/Controllables/ControllableCircle.js +117 -0
- package/es-modules/Extensions/Annotations/Controllables/ControllableImage.js +111 -0
- package/es-modules/{annotations/controllable → Extensions/Annotations/Controllables}/ControllableLabel.js +186 -146
- package/es-modules/{annotations/controllable → Extensions/Annotations/Controllables}/ControllablePath.js +81 -42
- package/es-modules/Extensions/Annotations/Controllables/ControllableRect.js +121 -0
- package/es-modules/{annotations/controllable/controllableMixin.js → Extensions/Annotations/Mixins/ControllableMixin.js} +8 -9
- package/es-modules/{annotations/eventEmitterMixin.js → Extensions/Annotations/Mixins/EventEmitterMixin.js} +7 -7
- package/es-modules/{annotations/controllable/markerMixin.js → Extensions/Annotations/Mixins/MarkerMixin.js} +10 -8
- package/es-modules/{annotations → Extensions/Annotations}/MockPoint.js +6 -6
- package/es-modules/{annotations/navigationBindings.js → Extensions/Annotations/NavigationBindings.js} +27 -16
- package/es-modules/{annotations/popup.js → Extensions/Annotations/Popup.js} +9 -9
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/BasicAnnotation.js +68 -20
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/CrookedLine.js +46 -19
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/ElliottWave.js +33 -12
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/Fibonacci.js +54 -22
- package/es-modules/Extensions/Annotations/Types/InfinityLine.js +147 -0
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/Measure.js +82 -52
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/Pitchfork.js +69 -32
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/Tunnel.js +58 -30
- package/es-modules/{annotations/types → Extensions/Annotations/Types}/VerticalLine.js +64 -33
- package/es-modules/{parts-gantt → Extensions}/ArrowSymbols.js +9 -11
- package/es-modules/{modules/boost/boost.js → Extensions/Boost/Boost.js} +8 -8
- package/es-modules/{modules/boost/boost-attach.js → Extensions/Boost/BoostAttach.js} +10 -8
- package/es-modules/{modules/boost/boost-init.js → Extensions/Boost/BoostInit.js} +7 -6
- package/es-modules/{modules/boost/boost-options.js → Extensions/Boost/BoostOptions.js} +1 -1
- package/es-modules/{modules/boost/boost-overrides.js → Extensions/Boost/BoostOverrides.js} +14 -11
- package/es-modules/{modules/boost/boost-utils.js → Extensions/Boost/BoostUtils.js} +6 -6
- package/es-modules/{modules/boost/boostable-map.js → Extensions/Boost/BoostableMap.js} +1 -1
- package/es-modules/{modules/boost/boostables.js → Extensions/Boost/Boostables.js} +0 -0
- package/es-modules/{modules/boost/named-colors.js → Extensions/Boost/NamedColors.js} +1 -1
- package/es-modules/{modules/boost/wgl-renderer.js → Extensions/Boost/WGLRenderer.js} +9 -9
- package/es-modules/{modules/boost/wgl-shader.js → Extensions/Boost/WGLShader.js} +3 -4
- package/es-modules/{modules/boost/wgl-vbuffer.js → Extensions/Boost/WGLVBuffer.js} +0 -0
- package/es-modules/{modules/boost-canvas.src.js → Extensions/BoostCanvas.js} +13 -9
- package/es-modules/{parts-gantt/CurrentDateIndicator.js → Extensions/CurrentDateIndication.js} +5 -7
- package/es-modules/{modules/data.src.js → Extensions/Data.js} +14 -16
- package/es-modules/{parts → Extensions}/DataGrouping.js +12 -9
- package/es-modules/{modules/debugger.src.js → Extensions/Debugger.js} +6 -6
- package/es-modules/{mixins/download-url.js → Extensions/DownloadURL.js} +15 -7
- package/es-modules/{modules/drag-panes.src.js → Extensions/DragPanes.js} +6 -6
- package/es-modules/{modules/draggable-points.src.js → Extensions/DraggablePoints.js} +21 -32
- package/es-modules/{modules/drilldown.src.js → Extensions/Drilldown.js} +64 -43
- package/es-modules/{modules/export-data.src.js → Extensions/ExportData.js} +126 -26
- package/es-modules/{modules/exporting.src.js → Extensions/Exporting.js} +26 -12
- package/es-modules/{modules/full-screen.src.js → Extensions/FullScreen.js} +5 -3
- package/es-modules/{parts-map → Extensions}/GeoJSON.js +112 -7
- package/es-modules/{modules/marker-clusters.src.js → Extensions/MarkerClusters.js} +29 -39
- package/es-modules/{parts-3d/Math.js → Extensions/Math3D.js} +17 -9
- package/es-modules/{modules/no-data-to-display.src.js → Extensions/NoDataToDisplay.js} +14 -15
- package/es-modules/{modules/offline-exporting.src.js → Extensions/OfflineExporting.js} +39 -35
- package/es-modules/{modules/oldie.src.js → Extensions/Oldie/Oldie.js} +19 -12
- package/es-modules/{parts-3d → Extensions/Oldie}/VMLAxis3D.js +1 -1
- package/es-modules/Extensions/Oldie/VMLRenderer3D.js +46 -0
- package/es-modules/{modules/oldie-polyfills.src.js → Extensions/OldiePolyfills.js} +5 -0
- package/es-modules/{modules/overlapping-datalabels.src.js → Extensions/OverlappingDataLabels.js} +14 -13
- package/es-modules/{parts-more → Extensions}/Pane.js +13 -12
- package/es-modules/{modules/parallel-coordinates.src.js → Extensions/ParallelCoordinates.js} +140 -138
- package/es-modules/{modules/pattern-fill.src.js → Extensions/PatternFill.js} +23 -15
- package/es-modules/{parts-more → Extensions}/Polar.js +15 -12
- package/es-modules/{modules/price-indicator.src.js → Extensions/PriceIndication.js} +5 -3
- package/es-modules/{parts → Extensions}/RangeSelector.js +112 -79
- package/es-modules/{parts → Extensions}/ScrollablePlotArea.js +19 -9
- package/es-modules/{modules/series-label.src.js → Extensions/SeriesLabel.js} +14 -10
- package/es-modules/{modules/sonification/chartSonify.js → Extensions/Sonification/ChartSonify.js} +212 -41
- package/es-modules/{modules/sonification → Extensions/Sonification}/Earcon.js +3 -7
- package/es-modules/{modules/sonification → Extensions/Sonification}/Instrument.js +35 -11
- package/es-modules/{modules/sonification/instrumentDefinitions.js → Extensions/Sonification/InstrumentDefinitions.js} +1 -1
- package/es-modules/{modules/sonification/musicalFrequencies.js → Extensions/Sonification/MusicalFrequencies.js} +0 -0
- package/es-modules/Extensions/Sonification/Options.js +34 -0
- package/es-modules/{modules/sonification/pointSonify.js → Extensions/Sonification/PointSonify.js} +43 -28
- package/es-modules/{modules/sonification/sonification.js → Extensions/Sonification/Sonification.js} +16 -12
- package/es-modules/{modules/sonification → Extensions/Sonification}/Timeline.js +25 -6
- package/es-modules/{modules/sonification/utilities.js → Extensions/Sonification/Utilities.js} +8 -5
- package/es-modules/{parts → Extensions}/Stacking.js +57 -18
- package/es-modules/{modules/static-scale.src.js → Extensions/StaticScale.js} +4 -4
- package/es-modules/{themes/avocado.js → Extensions/Themes/Avocado.js} +5 -4
- package/es-modules/{themes/dark-blue.js → Extensions/Themes/DarkBlue.js} +4 -2
- package/es-modules/{themes/dark-green.js → Extensions/Themes/DarkGreen.js} +4 -2
- package/es-modules/{themes/dark-unica.js → Extensions/Themes/DarkUnica.js} +6 -6
- package/es-modules/{themes/gray.js → Extensions/Themes/Gray.js} +5 -4
- package/es-modules/{themes/grid.js → Extensions/Themes/Grid.js} +4 -2
- package/es-modules/{themes/grid-light.js → Extensions/Themes/GridLight.js} +4 -2
- package/es-modules/{themes/high-contrast-dark.js → Extensions/Themes/HighContrastDark.js} +5 -4
- package/es-modules/{themes/high-contrast-light.js → Extensions/Themes/HighContrastLight.js} +4 -2
- package/es-modules/{themes/sand-signika.js → Extensions/Themes/SandSignika.js} +4 -2
- package/es-modules/{themes/skies.js → Extensions/Themes/Skies.js} +5 -3
- package/es-modules/{themes/sunset.js → Extensions/Themes/Sunset.js} +5 -4
- package/es-modules/{parts-gantt/Pathfinder.js → Gantt/Connection.js} +41 -284
- package/es-modules/Gantt/Pathfinder.js +816 -0
- package/es-modules/Gantt/PathfinderAlgorithms.js +659 -0
- package/es-modules/{parts-gantt → Gantt}/Tree.js +1 -1
- package/es-modules/{parts-map → Maps}/Map.js +24 -15
- package/es-modules/{parts-map → Maps}/MapNavigation.js +4 -5
- package/es-modules/{parts-map → Maps}/MapPointer.js +2 -4
- package/es-modules/{mixins/centered-series.js → Mixins/CenteredSeries.js} +7 -5
- package/es-modules/{parts-map/ColorMapSeriesMixin.js → Mixins/ColorMapSeries.js} +10 -6
- package/es-modules/{parts-map/ColorSeriesMixin.js → Mixins/ColorSeries.js} +12 -4
- package/es-modules/{mixins/derived-series.js → Mixins/DerivedSeries.js} +3 -3
- package/es-modules/{mixins/draw-point.js → Mixins/DrawPoint.js} +6 -1
- package/es-modules/{mixins/geometry.js → Mixins/Geometry.js} +0 -0
- package/es-modules/{mixins/geometry-circles.js → Mixins/GeometryCircles.js} +2 -2
- package/es-modules/{mixins/indicator-required.js → Mixins/IndicatorRequired.js} +1 -1
- package/es-modules/{mixins/legend-symbol.js → Mixins/LegendSymbol.js} +6 -10
- package/es-modules/{mixins/multipe-lines.js → Mixins/MultipleLines.js} +2 -2
- package/es-modules/{mixins/navigation.js → Mixins/Navigation.js} +0 -0
- package/es-modules/{mixins/nelder-mead.js → Mixins/NelderMead.js} +2 -2
- package/es-modules/{mixins/nodes.js → Mixins/Nodes.js} +7 -5
- package/es-modules/{mixins/on-series.js → Mixins/OnSeries.js} +3 -2
- package/es-modules/{mixins/polygon.js → Mixins/Polygon.js} +2 -2
- package/es-modules/{mixins/reduce-array.js → Mixins/ReduceArray.js} +1 -1
- package/es-modules/{mixins/tree-series.js → Mixins/TreeSeries.js} +2 -2
- package/es-modules/{parts-more → Series}/AreaRangeSeries.js +75 -38
- package/es-modules/{parts → Series}/AreaSeries.js +43 -25
- package/es-modules/{parts-more → Series}/AreaSplineRangeSeries.js +47 -10
- package/es-modules/{parts → Series}/AreaSplineSeries.js +49 -10
- package/es-modules/{parts → Series}/BarSeries.js +2 -5
- package/es-modules/{modules/bellcurve.src.js → Series/BellcurveSeries.js} +47 -7
- package/es-modules/{parts-more → Series}/BoxPlotSeries.js +18 -13
- package/es-modules/{parts-more → Series/Bubble}/BubbleLegend.js +11 -9
- package/es-modules/{parts-more → Series/Bubble}/BubbleSeries.js +25 -27
- package/es-modules/{modules/bullet.src.js → Series/BulletSeries.js} +9 -8
- package/es-modules/{parts → Series}/CandlestickSeries.js +11 -8
- package/es-modules/{parts-3d/Column.js → Series/Column3DSeries.js} +108 -28
- package/es-modules/{parts-more → Series}/ColumnPyramidSeries.js +9 -9
- package/es-modules/{parts-more → Series}/ColumnRangeSeries.js +21 -18
- package/es-modules/{parts → Series}/ColumnSeries.js +119 -41
- package/es-modules/{modules/cylinder.src.js → Series/CylinderSeries.js} +14 -14
- package/es-modules/{modules/dependency-wheel.src.js → Series/DependencyWheelSeries.js} +14 -12
- package/es-modules/{modules/dotplot.src.js → Series/DotplotSeries.js} +7 -15
- package/es-modules/{modules/dumbbell.src.js → Series/DumbbellSeries.js} +16 -10
- package/es-modules/{parts-more → Series}/ErrorBarSeries.js +8 -8
- package/es-modules/{parts → Series}/FlagsSeries.js +18 -12
- package/es-modules/{modules/funnel3d.src.js → Series/Funnel3DSeries.js} +14 -16
- package/es-modules/{modules/funnel.src.js → Series/FunnelSeries.js} +16 -14
- package/es-modules/{parts-gantt → Series}/GanttSeries.js +21 -20
- package/es-modules/{parts-more → Series}/GaugeSeries.js +14 -12
- package/es-modules/{parts-map → Series}/HeatmapSeries.js +23 -16
- package/es-modules/{modules/histogram.src.js → Series/HistogramSeries.js} +13 -9
- package/es-modules/{modules/item-series.src.js → Series/ItemSeries.js} +22 -14
- package/es-modules/Series/LineSeries.js +13 -0
- package/es-modules/{modules/lollipop.src.js → Series/LollipopSeries.js} +34 -10
- package/es-modules/{parts-map → Series}/MapBubbleSeries.js +8 -9
- package/es-modules/{parts-map → Series}/MapLineSeries.js +5 -7
- package/es-modules/{parts-map → Series}/MapPointSeries.js +9 -8
- package/es-modules/{parts-map → Series}/MapSeries.js +22 -18
- package/es-modules/{modules/networkgraph/draggable-nodes.js → Series/Networkgraph/DraggableNodes.js} +15 -30
- package/es-modules/{modules/networkgraph/integrations.js → Series/Networkgraph/Integrations.js} +1 -1
- package/es-modules/{modules/networkgraph/layouts.js → Series/Networkgraph/Layouts.js} +43 -13
- package/es-modules/{modules/networkgraph/networkgraph.src.js → Series/Networkgraph/Networkgraph.js} +29 -23
- package/es-modules/{modules/networkgraph → Series/Networkgraph}/QuadTree.js +2 -2
- package/es-modules/{parts → Series}/OHLCSeries.js +5 -7
- package/es-modules/{modules/organization.src.js → Series/OrganizationSeries.js} +10 -7
- package/es-modules/{parts-more → Series}/PackedBubbleSeries.js +104 -28
- package/es-modules/{modules/pareto.src.js → Series/ParetoSeries.js} +10 -9
- package/es-modules/{parts-3d/Pie.js → Series/Pie3DSeries.js} +5 -4
- package/es-modules/{parts → Series}/PieSeries.js +66 -31
- package/es-modules/{parts-more → Series}/PolygonSeries.js +13 -13
- package/es-modules/{modules/pyramid3d.src.js → Series/Pyramid3DSeries.js} +5 -7
- package/es-modules/{modules/sankey.src.js → Series/SankeySeries.js} +23 -21
- package/es-modules/{parts-3d/Scatter.js → Series/Scatter3DSeries.js} +10 -9
- package/es-modules/{parts → Series}/ScatterSeries.js +15 -10
- package/es-modules/{modules/solid-gauge.src.js → Series/SolidGaugeSeries.js} +112 -78
- package/es-modules/{parts → Series}/SplineSeries.js +9 -7
- package/es-modules/{modules/streamgraph.src.js → Series/StreamgraphSeries.js} +42 -6
- package/es-modules/{modules/sunburst.src.js → Series/SunburstSeries.js} +20 -13
- package/es-modules/{modules/tilemap.src.js → Series/TilemapSeries.js} +12 -9
- package/es-modules/{modules/timeline.src.js → Series/TimelineSeries.js} +16 -11
- package/es-modules/{modules/treemap.src.js → Series/TreemapSeries.js} +47 -40
- package/es-modules/{modules/variable-pie.src.js → Series/VariablePieSeries.js} +11 -8
- package/es-modules/{modules/variwide.src.js → Series/VariwideSeries.js} +12 -10
- package/es-modules/{modules/vector.src.js → Series/VectorSeries.js} +11 -7
- package/es-modules/{modules/venn.src.js → Series/VennSeries.js} +29 -20
- package/es-modules/{parts-more → Series}/WaterfallSeries.js +145 -66
- package/es-modules/{modules/windbarb.src.js → Series/WindbarbSeries.js} +13 -9
- package/es-modules/{modules/wordcloud.src.js → Series/WordcloudSeries.js} +17 -13
- package/es-modules/{modules/xrange.src.js → Series/XRangeSeries.js} +16 -12
- package/es-modules/{indicators/acceleration-bands.src.js → Stock/Indicators/ABIndicator.js} +8 -8
- package/es-modules/{indicators/accumulation-distribution.src.js → Stock/Indicators/ADIndicator.js} +5 -4
- package/es-modules/{indicators/ao.src.js → Stock/Indicators/AOIndicator.js} +6 -5
- package/es-modules/{indicators/apo.src.js → Stock/Indicators/APOIndicator.js} +8 -8
- package/es-modules/{indicators/atr.src.js → Stock/Indicators/ATRIndicator.js} +6 -6
- package/es-modules/{indicators/aroon.src.js → Stock/Indicators/AroonIndicator.js} +7 -6
- package/es-modules/{indicators/aroon-oscillator.src.js → Stock/Indicators/AroonOscillatorIndicator.js} +8 -8
- package/es-modules/{indicators/bollinger-bands.src.js → Stock/Indicators/BBIndicator.js} +8 -8
- package/es-modules/{indicators/cci.src.js → Stock/Indicators/CCIIndicator.js} +5 -4
- package/es-modules/{indicators/cmf.src.js → Stock/Indicators/CMFIndicator.js} +3 -4
- package/es-modules/{indicators/chaikin.src.js → Stock/Indicators/ChaikinIndicator.js} +10 -9
- package/es-modules/{indicators/dema.src.js → Stock/Indicators/DEMAIndicator.js} +8 -8
- package/es-modules/{indicators/dpo.src.js → Stock/Indicators/DPOIndicator.js} +5 -4
- package/es-modules/{indicators/ema.src.js → Stock/Indicators/EMAIndicator.js} +4 -4
- package/es-modules/{indicators/ichimoku-kinko-hyo.src.js → Stock/Indicators/IKHIndicator.js} +23 -20
- package/es-modules/{indicators/keltner-channels.src.js → Stock/Indicators/KeltnerChannelsIndicator.js} +11 -8
- package/es-modules/{indicators/macd.src.js → Stock/Indicators/MACDIndicator.js} +9 -6
- package/es-modules/{indicators/mfi.src.js → Stock/Indicators/MFIIndicator.js} +5 -4
- package/es-modules/{indicators/momentum.src.js → Stock/Indicators/MomentumIndicator.js} +5 -4
- package/es-modules/{indicators/natr.src.js → Stock/Indicators/NATRIndicator.js} +4 -6
- package/es-modules/{indicators/price-channel.src.js → Stock/Indicators/PCIndicator.js} +9 -8
- package/es-modules/{indicators/ppo.src.js → Stock/Indicators/PPOIndicator.js} +8 -8
- package/es-modules/{indicators/psar.src.js → Stock/Indicators/PSARIndicator.js} +3 -4
- package/es-modules/{indicators/pivot-points.src.js → Stock/Indicators/PivotPointsIndicator.js} +6 -6
- package/es-modules/{indicators/price-envelopes.src.js → Stock/Indicators/PriceEnvelopesIndicator.js} +6 -6
- package/es-modules/{indicators/roc.src.js → Stock/Indicators/ROCIndicator.js} +5 -4
- package/es-modules/{indicators/rsi.src.js → Stock/Indicators/RSIIndicator.js} +5 -4
- package/es-modules/{indicators/regressions.src.js → Stock/Indicators/RegressionIndicators.js} +8 -7
- package/es-modules/{indicators/indicators.src.js → Stock/Indicators/SMAIndicator.js} +12 -8
- package/es-modules/{indicators/slow-stochastic.src.js → Stock/Indicators/SlowStochasticIndicator.js} +6 -8
- package/es-modules/{indicators/stochastic.src.js → Stock/Indicators/StochasticIndicator.js} +9 -9
- package/es-modules/{indicators/supertrend.src.js → Stock/Indicators/SupertrendIndicator.js} +8 -7
- package/es-modules/{indicators/tema.src.js → Stock/Indicators/TEMAIndicator.js} +8 -8
- package/es-modules/{indicators/trix.src.js → Stock/Indicators/TRIXIndicator.js} +8 -8
- package/es-modules/{indicators/trendline.src.js → Stock/Indicators/TrendLineIndicator.js} +5 -4
- package/es-modules/{indicators/volume-by-price.src.js → Stock/Indicators/VBPIndicator.js} +10 -7
- package/es-modules/{indicators/vwap.src.js → Stock/Indicators/VWAPIndicator.js} +5 -4
- package/es-modules/{indicators/wma.src.js → Stock/Indicators/WMAIndicator.js} +5 -4
- package/es-modules/{indicators/williams-r.src.js → Stock/Indicators/WilliamsRIndicator.js} +7 -6
- package/es-modules/{indicators/zigzag.src.js → Stock/Indicators/ZigzagIndicator.js} +5 -7
- package/es-modules/{modules/stock-tools-bindings.js → Stock/StockToolsBindings.js} +22 -7
- package/es-modules/{modules/stock-tools-gui.js → Stock/StockToolsGui.js} +17 -17
- package/es-modules/error-messages.js +7 -2
- package/es-modules/highcharts.src.js +19853 -0
- package/es-modules/masters/highcharts-3d.src.js +11 -12
- package/es-modules/masters/highcharts-gantt.src.js +1 -1
- package/es-modules/masters/highcharts-more.src.js +15 -15
- package/es-modules/masters/highcharts.src.js +28 -27
- 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 +2 -2
- package/es-modules/masters/indicators/accumulation-distribution.src.js +2 -2
- package/es-modules/masters/indicators/ao.src.js +2 -2
- package/es-modules/masters/indicators/apo.src.js +2 -2
- package/es-modules/masters/indicators/aroon-oscillator.src.js +2 -2
- package/es-modules/masters/indicators/aroon.src.js +2 -2
- package/es-modules/masters/indicators/atr.src.js +2 -2
- package/es-modules/masters/indicators/bollinger-bands.src.js +2 -2
- package/es-modules/masters/indicators/cci.src.js +2 -2
- package/es-modules/masters/indicators/chaikin.src.js +2 -2
- package/es-modules/masters/indicators/cmf.src.js +2 -2
- package/es-modules/masters/indicators/dema.src.js +2 -2
- package/es-modules/masters/indicators/dpo.src.js +2 -2
- package/es-modules/masters/indicators/ema.src.js +2 -2
- package/es-modules/masters/indicators/ichimoku-kinko-hyo.src.js +2 -2
- package/es-modules/masters/indicators/indicators-all.src.js +41 -41
- package/es-modules/masters/indicators/indicators.src.js +2 -2
- package/es-modules/masters/indicators/keltner-channels.src.js +2 -2
- package/es-modules/masters/indicators/macd.src.js +2 -2
- package/es-modules/masters/indicators/mfi.src.js +2 -2
- package/es-modules/masters/indicators/momentum.src.js +2 -2
- package/es-modules/masters/indicators/natr.src.js +2 -2
- package/es-modules/masters/indicators/pivot-points.src.js +2 -2
- package/es-modules/masters/indicators/ppo.src.js +2 -2
- package/es-modules/masters/indicators/price-channel.src.js +2 -2
- package/es-modules/masters/indicators/price-envelopes.src.js +2 -2
- package/es-modules/masters/indicators/psar.src.js +2 -2
- package/es-modules/masters/indicators/regressions.src.js +2 -2
- package/es-modules/masters/indicators/roc.src.js +2 -2
- package/es-modules/masters/indicators/rsi.src.js +2 -2
- package/es-modules/masters/indicators/slow-stochastic.src.js +2 -2
- package/es-modules/masters/indicators/stochastic.src.js +2 -2
- package/es-modules/masters/indicators/supertrend.src.js +2 -2
- package/es-modules/masters/indicators/tema.src.js +2 -2
- package/es-modules/masters/indicators/trendline.src.js +2 -2
- package/es-modules/masters/indicators/trix.src.js +2 -2
- package/es-modules/masters/indicators/volume-by-price.src.js +2 -2
- package/es-modules/masters/indicators/vwap.src.js +2 -2
- package/es-modules/masters/indicators/williams-r.src.js +2 -2
- package/es-modules/masters/indicators/wma.src.js +2 -2
- package/es-modules/masters/indicators/zigzag.src.js +2 -2
- package/es-modules/masters/modules/accessibility.src.js +2 -2
- package/es-modules/masters/modules/annotations-advanced.src.js +13 -13
- package/es-modules/masters/modules/annotations.src.js +4 -4
- package/es-modules/masters/modules/arrow-symbols.src.js +2 -2
- package/es-modules/masters/modules/boost-canvas.src.js +2 -2
- package/es-modules/masters/modules/boost.src.js +2 -2
- package/es-modules/masters/modules/broken-axis.src.js +2 -2
- package/es-modules/masters/modules/bullet.src.js +2 -2
- package/es-modules/masters/modules/coloraxis.src.js +2 -2
- package/es-modules/masters/modules/current-date-indicator.src.js +2 -2
- package/es-modules/masters/modules/cylinder.src.js +2 -2
- package/es-modules/masters/modules/data.src.js +2 -2
- package/es-modules/masters/modules/datagrouping.src.js +2 -2
- package/es-modules/masters/modules/debugger.src.js +2 -2
- package/es-modules/masters/modules/dependency-wheel.src.js +2 -2
- package/es-modules/masters/modules/dotplot.src.js +2 -2
- package/es-modules/masters/modules/drag-panes.src.js +2 -2
- package/es-modules/masters/modules/draggable-points.src.js +2 -2
- package/es-modules/masters/modules/drilldown.src.js +2 -2
- package/es-modules/masters/modules/dumbbell.src.js +2 -2
- package/es-modules/masters/modules/export-data.src.js +2 -2
- package/es-modules/masters/modules/exporting.src.js +3 -3
- package/es-modules/masters/modules/full-screen.src.js +2 -2
- package/es-modules/masters/modules/funnel.src.js +2 -2
- package/es-modules/masters/modules/funnel3d.src.js +2 -2
- package/es-modules/masters/modules/gantt.src.js +6 -6
- package/es-modules/masters/modules/grid-axis.src.js +2 -2
- package/es-modules/masters/modules/heatmap.src.js +4 -4
- package/es-modules/masters/modules/histogram-bellcurve.src.js +3 -3
- package/es-modules/masters/modules/item-series.src.js +2 -2
- package/es-modules/masters/modules/lollipop.src.js +2 -2
- package/es-modules/masters/modules/map.src.js +13 -13
- package/es-modules/masters/modules/marker-clusters.src.js +2 -2
- package/es-modules/masters/modules/networkgraph.src.js +2 -2
- package/es-modules/masters/modules/no-data-to-display.src.js +2 -2
- package/es-modules/masters/modules/offline-exporting.src.js +2 -2
- package/es-modules/masters/modules/oldie-polyfills.src.js +2 -2
- package/es-modules/masters/modules/oldie.src.js +2 -2
- package/es-modules/masters/modules/organization.src.js +2 -2
- package/es-modules/masters/modules/overlapping-datalabels.src.js +2 -2
- package/es-modules/masters/modules/parallel-coordinates.src.js +2 -2
- package/es-modules/masters/modules/pareto.src.js +2 -2
- package/es-modules/masters/modules/pathfinder.src.js +2 -2
- package/es-modules/masters/modules/pattern-fill.src.js +2 -2
- package/es-modules/masters/modules/price-indicator.src.js +2 -2
- package/es-modules/masters/modules/pyramid3d.src.js +2 -2
- package/es-modules/masters/modules/sankey.src.js +2 -2
- package/es-modules/masters/modules/series-label.src.js +2 -2
- package/es-modules/masters/modules/solid-gauge.src.js +2 -2
- package/es-modules/masters/modules/sonification.src.js +2 -2
- package/es-modules/masters/modules/static-scale.src.js +2 -2
- package/es-modules/masters/modules/stock-tools.src.js +3 -3
- package/es-modules/masters/modules/stock.src.js +10 -10
- package/es-modules/masters/modules/streamgraph.src.js +2 -2
- package/es-modules/masters/modules/sunburst.src.js +2 -2
- package/es-modules/masters/modules/tilemap.src.js +2 -2
- package/es-modules/masters/modules/timeline.src.js +2 -2
- package/es-modules/masters/modules/treegrid.src.js +2 -2
- package/es-modules/masters/modules/treemap.src.js +2 -2
- package/es-modules/masters/modules/variable-pie.src.js +2 -2
- package/es-modules/masters/modules/variwide.src.js +2 -2
- package/es-modules/masters/modules/vector.src.js +2 -2
- package/es-modules/masters/modules/venn.src.js +2 -2
- package/es-modules/masters/modules/windbarb.src.js +2 -2
- package/es-modules/masters/modules/wordcloud.src.js +2 -2
- package/es-modules/masters/modules/xrange.src.js +2 -2
- package/es-modules/masters/themes/avocado.src.js +2 -2
- package/es-modules/masters/themes/dark-blue.src.js +2 -2
- package/es-modules/masters/themes/dark-green.src.js +2 -2
- package/es-modules/masters/themes/dark-unica.src.js +2 -2
- package/es-modules/masters/themes/gray.src.js +2 -2
- package/es-modules/masters/themes/grid-light.src.js +2 -2
- package/es-modules/masters/themes/grid.src.js +2 -2
- package/es-modules/masters/themes/high-contrast-dark.src.js +2 -2
- package/es-modules/masters/themes/high-contrast-light.src.js +2 -2
- package/es-modules/masters/themes/sand-signika.src.js +2 -2
- package/es-modules/masters/themes/skies.src.js +2 -2
- package/es-modules/masters/themes/sunset.src.js +2 -2
- package/highcharts-3d.js +86 -88
- package/highcharts-3d.js.map +1 -1
- package/highcharts-3d.src.js +1713 -1615
- package/highcharts-gantt.js +730 -697
- package/highcharts-gantt.js.map +1 -1
- package/highcharts-gantt.src.js +11747 -10110
- package/highcharts-more.js +164 -161
- package/highcharts-more.js.map +1 -1
- package/highcharts-more.src.js +766 -523
- package/highcharts.d.ts +7728 -1337
- package/highcharts.js +538 -515
- package/highcharts.js.map +1 -1
- package/highcharts.src.d.ts +7728 -1337
- package/highcharts.src.js +8517 -7691
- package/highmaps.js +636 -612
- package/highmaps.js.map +1 -1
- package/highmaps.src.js +9151 -8209
- package/highstock.js +697 -671
- package/highstock.js.map +1 -1
- package/highstock.src.js +8919 -8049
- package/indicators/acceleration-bands.js +8 -8
- package/indicators/acceleration-bands.js.map +1 -1
- package/indicators/acceleration-bands.src.js +8 -8
- package/indicators/accumulation-distribution.js +4 -4
- package/indicators/accumulation-distribution.js.map +1 -1
- package/indicators/accumulation-distribution.src.js +5 -5
- package/indicators/ao.js +5 -5
- package/indicators/ao.js.map +1 -1
- package/indicators/ao.src.js +6 -6
- package/indicators/apo.js +5 -5
- package/indicators/apo.js.map +1 -1
- package/indicators/apo.src.js +8 -9
- package/indicators/aroon-oscillator.js +8 -8
- package/indicators/aroon-oscillator.js.map +1 -1
- package/indicators/aroon-oscillator.src.js +8 -9
- package/indicators/aroon.js +7 -7
- package/indicators/aroon.js.map +1 -1
- package/indicators/aroon.src.js +7 -7
- package/indicators/atr.js +4 -4
- package/indicators/atr.js.map +1 -1
- package/indicators/atr.src.js +6 -14
- package/indicators/bollinger-bands.js +8 -8
- package/indicators/bollinger-bands.js.map +1 -1
- package/indicators/bollinger-bands.src.js +8 -8
- package/indicators/cci.js +4 -4
- package/indicators/cci.js.map +1 -1
- package/indicators/cci.src.js +5 -5
- package/indicators/chaikin.js +6 -6
- package/indicators/chaikin.js.map +1 -1
- package/indicators/chaikin.src.js +75 -75
- package/indicators/cmf.js +4 -4
- package/indicators/cmf.js.map +1 -1
- package/indicators/cmf.src.js +4 -4
- package/indicators/dema.js +5 -5
- package/indicators/dema.js.map +1 -1
- package/indicators/dema.src.js +8 -9
- package/indicators/dpo.js +4 -4
- package/indicators/dpo.js.map +1 -1
- package/indicators/dpo.src.js +5 -5
- package/indicators/ema.js +4 -4
- package/indicators/ema.js.map +1 -1
- package/indicators/ema.src.js +4 -5
- package/indicators/ichimoku-kinko-hyo.js +13 -13
- package/indicators/ichimoku-kinko-hyo.js.map +1 -1
- package/indicators/ichimoku-kinko-hyo.src.js +21 -20
- package/indicators/indicators-all.js +119 -118
- package/indicators/indicators-all.js.map +1 -1
- package/indicators/indicators-all.src.js +231 -240
- package/indicators/indicators.js +9 -9
- package/indicators/indicators.js.map +1 -1
- package/indicators/indicators.src.js +9 -9
- package/indicators/keltner-channels.js +8 -8
- package/indicators/keltner-channels.js.map +1 -1
- package/indicators/keltner-channels.src.js +13 -10
- package/indicators/macd.js +10 -10
- package/indicators/macd.js.map +1 -1
- package/indicators/macd.src.js +8 -7
- package/indicators/mfi.js +4 -4
- package/indicators/mfi.js.map +1 -1
- package/indicators/mfi.src.js +5 -5
- package/indicators/momentum.js +4 -4
- package/indicators/momentum.js.map +1 -1
- package/indicators/momentum.src.js +5 -5
- package/indicators/natr.js +3 -3
- package/indicators/natr.js.map +1 -1
- package/indicators/natr.src.js +5 -5
- package/indicators/pivot-points.js +8 -8
- package/indicators/pivot-points.js.map +1 -1
- package/indicators/pivot-points.src.js +6 -6
- package/indicators/ppo.js +5 -5
- package/indicators/ppo.js.map +1 -1
- package/indicators/ppo.src.js +8 -9
- package/indicators/price-channel.js +8 -8
- package/indicators/price-channel.js.map +1 -1
- package/indicators/price-channel.src.js +66 -66
- package/indicators/price-envelopes.js +6 -6
- package/indicators/price-envelopes.js.map +1 -1
- package/indicators/price-envelopes.src.js +6 -6
- package/indicators/psar.js +3 -3
- package/indicators/psar.js.map +1 -1
- package/indicators/psar.src.js +4 -4
- package/indicators/regressions.js +6 -6
- package/indicators/regressions.js.map +1 -1
- package/indicators/regressions.src.js +8 -8
- package/indicators/roc.js +3 -3
- package/indicators/roc.js.map +1 -1
- package/indicators/roc.src.js +5 -5
- package/indicators/rsi.js +4 -4
- package/indicators/rsi.js.map +1 -1
- package/indicators/rsi.src.js +5 -5
- package/indicators/slow-stochastic.js +5 -5
- package/indicators/slow-stochastic.js.map +1 -1
- package/indicators/slow-stochastic.src.js +7 -7
- package/indicators/stochastic.js +9 -9
- package/indicators/stochastic.js.map +1 -1
- package/indicators/stochastic.src.js +67 -67
- package/indicators/supertrend.js +9 -9
- package/indicators/supertrend.js.map +1 -1
- package/indicators/supertrend.src.js +9 -7
- package/indicators/tema.js +6 -6
- package/indicators/tema.js.map +1 -1
- package/indicators/tema.src.js +8 -9
- package/indicators/trendline.js +3 -3
- package/indicators/trendline.js.map +1 -1
- package/indicators/trendline.src.js +5 -5
- package/indicators/trix.js +4 -4
- package/indicators/trix.js.map +1 -1
- package/indicators/trix.src.js +8 -8
- package/indicators/volume-by-price.js +13 -13
- package/indicators/volume-by-price.js.map +1 -1
- package/indicators/volume-by-price.src.js +7 -8
- package/indicators/vwap.js +4 -4
- package/indicators/vwap.js.map +1 -1
- package/indicators/vwap.src.js +5 -5
- package/indicators/williams-r.js +4 -4
- package/indicators/williams-r.js.map +1 -1
- package/indicators/williams-r.src.js +7 -7
- package/indicators/wma.js +4 -4
- package/indicators/wma.js.map +1 -1
- package/indicators/wma.src.js +5 -5
- package/indicators/zigzag.js +4 -4
- package/indicators/zigzag.js.map +1 -1
- package/indicators/zigzag.src.js +6 -7
- package/modules/accessibility.d.ts +0 -35
- package/modules/accessibility.js +171 -168
- package/modules/accessibility.js.map +1 -1
- package/modules/accessibility.src.d.ts +0 -35
- package/modules/accessibility.src.js +369 -252
- package/modules/annotations-advanced.js +158 -136
- package/modules/annotations-advanced.js.map +1 -1
- package/modules/annotations-advanced.src.js +1929 -1263
- package/modules/annotations.js +105 -94
- package/modules/annotations.js.map +1 -1
- package/modules/annotations.src.js +1485 -1101
- package/modules/arrow-symbols.js +4 -4
- package/modules/arrow-symbols.js.map +1 -1
- package/modules/arrow-symbols.src.js +10 -12
- package/modules/boost-canvas.js +15 -15
- package/modules/boost-canvas.js.map +1 -1
- package/modules/boost-canvas.src.js +17 -17
- package/modules/boost.d.ts +4 -0
- package/modules/boost.js +77 -64
- package/modules/boost.js.map +1 -1
- package/modules/boost.src.d.ts +4 -0
- package/modules/boost.src.js +581 -33
- package/modules/broken-axis.js +10 -10
- package/modules/broken-axis.js.map +1 -1
- package/modules/broken-axis.src.js +4 -5
- package/modules/bullet.js +6 -6
- package/modules/bullet.js.map +1 -1
- package/modules/bullet.src.js +8 -8
- package/modules/coloraxis.js +22 -21
- package/modules/coloraxis.js.map +1 -1
- package/modules/coloraxis.src.js +67 -59
- package/modules/current-date-indicator.js +3 -3
- package/modules/current-date-indicator.js.map +1 -1
- package/modules/current-date-indicator.src.js +4 -5
- package/modules/cylinder.js +8 -8
- package/modules/cylinder.js.map +1 -1
- package/modules/cylinder.src.js +21 -23
- package/modules/data.d.ts +2 -2
- package/modules/data.js +32 -32
- package/modules/data.js.map +1 -1
- package/modules/data.src.d.ts +2 -2
- package/modules/data.src.js +26 -25
- package/modules/datagrouping.js +17 -17
- package/modules/datagrouping.js.map +1 -1
- package/modules/datagrouping.src.js +6 -7
- package/modules/debugger.js +5 -5
- package/modules/debugger.js.map +1 -1
- package/modules/debugger.src.js +13 -8
- package/modules/dependency-wheel.js +8 -8
- package/modules/dependency-wheel.js.map +1 -1
- package/modules/dependency-wheel.src.js +10 -10
- package/modules/dotplot.js +5 -5
- package/modules/dotplot.js.map +1 -1
- package/modules/dotplot.src.js +6 -14
- package/modules/drag-panes.js +10 -10
- package/modules/drag-panes.js.map +1 -1
- package/modules/drag-panes.src.js +4 -6
- package/modules/draggable-points.js +33 -33
- package/modules/draggable-points.js.map +1 -1
- package/modules/draggable-points.src.js +22 -35
- package/modules/drilldown.d.ts +1 -1
- package/modules/drilldown.js +23 -22
- package/modules/drilldown.js.map +1 -1
- package/modules/drilldown.src.d.ts +1 -1
- package/modules/drilldown.src.js +66 -53
- package/modules/dumbbell.d.ts +4 -0
- package/modules/dumbbell.js +24 -9
- package/modules/dumbbell.js.map +1 -1
- package/modules/dumbbell.src.d.ts +4 -0
- package/modules/dumbbell.src.js +1029 -104
- package/modules/export-data.d.ts +4 -29
- package/modules/export-data.js +21 -21
- package/modules/export-data.js.map +1 -1
- package/modules/export-data.src.d.ts +4 -29
- package/modules/export-data.src.js +155 -189
- package/modules/exporting.d.ts +2 -0
- package/modules/exporting.js +33 -33
- package/modules/exporting.js.map +1 -1
- package/modules/exporting.src.d.ts +2 -0
- package/modules/exporting.src.js +40 -30
- package/modules/full-screen.js +7 -7
- package/modules/full-screen.js.map +1 -1
- package/modules/full-screen.src.js +4 -3
- package/modules/funnel.js +9 -9
- package/modules/funnel.js.map +1 -1
- package/modules/funnel.src.js +14 -15
- package/modules/funnel3d.js +17 -17
- package/modules/funnel3d.js.map +1 -1
- package/modules/funnel3d.src.js +12 -14
- package/modules/gantt.js +194 -183
- package/modules/gantt.js.map +1 -1
- package/modules/gantt.src.js +2071 -1260
- package/modules/grid-axis.js +22 -19
- package/modules/grid-axis.js.map +1 -1
- package/modules/grid-axis.src.js +149 -43
- package/modules/heatmap.js +33 -32
- package/modules/heatmap.js.map +1 -1
- package/modules/heatmap.src.js +130 -114
- package/modules/histogram-bellcurve.js +10 -10
- package/modules/histogram-bellcurve.js.map +1 -1
- package/modules/histogram-bellcurve.src.js +57 -16
- package/modules/item-series.js +9 -9
- package/modules/item-series.js.map +1 -1
- package/modules/item-series.src.js +20 -13
- package/modules/lollipop.d.ts +20 -1
- package/modules/lollipop.js +26 -4
- package/modules/lollipop.js.map +1 -1
- package/modules/lollipop.src.d.ts +20 -1
- package/modules/lollipop.src.js +1452 -10
- package/modules/map.d.ts +2 -2
- package/modules/map.js +99 -98
- package/modules/map.js.map +1 -1
- package/modules/map.src.d.ts +2 -2
- package/modules/map.src.js +1442 -1326
- package/modules/marker-clusters.js +35 -36
- package/modules/marker-clusters.js.map +1 -1
- package/modules/marker-clusters.src.js +31 -51
- package/modules/networkgraph.js +47 -46
- package/modules/networkgraph.js.map +1 -1
- package/modules/networkgraph.src.js +98 -81
- package/modules/no-data-to-display.js +4 -4
- package/modules/no-data-to-display.js.map +1 -1
- package/modules/no-data-to-display.src.js +17 -13
- package/modules/offline-exporting.js +15 -15
- package/modules/offline-exporting.js.map +1 -1
- package/modules/offline-exporting.src.js +63 -46
- package/modules/oldie-polyfills.js +6 -6
- package/modules/oldie-polyfills.js.map +1 -1
- package/modules/oldie-polyfills.src.js +7 -2
- package/modules/oldie.js +52 -26
- package/modules/oldie.js.map +1 -1
- package/modules/oldie.src.js +1411 -34
- package/modules/organization.js +11 -11
- package/modules/organization.js.map +1 -1
- package/modules/organization.src.js +7 -6
- package/modules/overlapping-datalabels.js +1 -1
- package/modules/overlapping-datalabels.src.js +1 -1
- package/modules/parallel-coordinates.js +11 -11
- package/modules/parallel-coordinates.js.map +1 -1
- package/modules/parallel-coordinates.src.js +144 -136
- package/modules/pareto.js +5 -5
- package/modules/pareto.js.map +1 -1
- package/modules/pareto.src.js +8 -9
- package/modules/pathfinder.js +31 -27
- package/modules/pathfinder.js.map +1 -1
- package/modules/pathfinder.src.js +1589 -985
- package/modules/pattern-fill.js +13 -13
- package/modules/pattern-fill.js.map +1 -1
- package/modules/pattern-fill.src.js +25 -21
- package/modules/price-indicator.js +4 -4
- package/modules/price-indicator.js.map +1 -1
- package/modules/price-indicator.src.js +5 -3
- package/modules/pyramid3d.js +3 -3
- package/modules/pyramid3d.js.map +1 -1
- package/modules/pyramid3d.src.js +4 -5
- package/modules/sankey.js +25 -26
- package/modules/sankey.js.map +1 -1
- package/modules/sankey.src.js +39 -36
- package/modules/series-label.js +17 -17
- package/modules/series-label.js.map +1 -1
- package/modules/series-label.src.js +17 -17
- package/modules/solid-gauge.js +8 -8
- package/modules/solid-gauge.js.map +1 -1
- package/modules/solid-gauge.src.js +123 -91
- package/modules/sonification.d.ts +33 -16
- package/modules/sonification.js +55 -49
- package/modules/sonification.js.map +1 -1
- package/modules/sonification.src.d.ts +33 -16
- package/modules/sonification.src.js +361 -115
- package/modules/static-scale.js +4 -4
- package/modules/static-scale.js.map +1 -1
- package/modules/static-scale.src.js +3 -4
- package/modules/stock-tools.d.ts +23 -1
- package/modules/stock-tools.js +150 -84
- package/modules/stock-tools.js.map +1 -1
- package/modules/stock-tools.src.d.ts +23 -1
- package/modules/stock-tools.src.js +3792 -44
- package/modules/stock.js +161 -158
- package/modules/stock.js.map +1 -1
- package/modules/stock.src.js +456 -412
- package/modules/streamgraph.js +2 -2
- package/modules/streamgraph.js.map +1 -1
- package/modules/streamgraph.src.js +42 -5
- package/modules/sunburst.js +51 -49
- package/modules/sunburst.js.map +1 -1
- package/modules/sunburst.src.js +152 -52
- package/modules/tilemap.js +14 -14
- package/modules/tilemap.js.map +1 -1
- package/modules/tilemap.src.js +12 -11
- package/modules/timeline.js +14 -14
- package/modules/timeline.js.map +1 -1
- package/modules/timeline.src.js +19 -18
- package/modules/treegrid.js +57 -52
- package/modules/treegrid.js.map +1 -1
- package/modules/treegrid.src.js +236 -60
- package/modules/treemap.js +35 -34
- package/modules/treemap.js.map +1 -1
- package/modules/treemap.src.js +213 -118
- package/modules/variable-pie.js +8 -8
- package/modules/variable-pie.js.map +1 -1
- package/modules/variable-pie.src.js +12 -10
- package/modules/variwide.js +8 -8
- package/modules/variwide.js.map +1 -1
- package/modules/variwide.src.js +8 -8
- package/modules/vector.js +6 -6
- package/modules/vector.js.map +1 -1
- package/modules/vector.src.js +9 -9
- package/modules/venn.js +26 -26
- package/modules/venn.js.map +1 -1
- package/modules/venn.src.js +49 -37
- package/modules/windbarb.js +11 -11
- package/modules/windbarb.js.map +1 -1
- package/modules/windbarb.src.js +11 -12
- package/modules/wordcloud.js +19 -19
- package/modules/wordcloud.js.map +1 -1
- package/modules/wordcloud.src.js +26 -18
- package/modules/xrange.js +12 -12
- package/modules/xrange.js.map +1 -1
- package/modules/xrange.src.js +19 -20
- package/package.json +1 -1
- package/themes/avocado.js +3 -3
- package/themes/avocado.js.map +1 -1
- package/themes/avocado.src.js +5 -4
- package/themes/dark-blue.js +3 -3
- package/themes/dark-blue.js.map +1 -1
- package/themes/dark-blue.src.js +4 -3
- package/themes/dark-green.js +3 -3
- package/themes/dark-green.js.map +1 -1
- package/themes/dark-green.src.js +4 -3
- package/themes/dark-unica.js +7 -7
- package/themes/dark-unica.js.map +1 -1
- package/themes/dark-unica.src.js +6 -6
- package/themes/gray.js +3 -3
- package/themes/gray.js.map +1 -1
- package/themes/gray.src.js +5 -4
- package/themes/grid-light.js +4 -4
- package/themes/grid-light.js.map +1 -1
- package/themes/grid-light.src.js +4 -3
- package/themes/grid.js +3 -3
- package/themes/grid.js.map +1 -1
- package/themes/grid.src.js +4 -3
- package/themes/high-contrast-dark.js +6 -6
- package/themes/high-contrast-dark.js.map +1 -1
- package/themes/high-contrast-dark.src.js +5 -4
- package/themes/high-contrast-light.js +3 -3
- package/themes/high-contrast-light.js.map +1 -1
- package/themes/high-contrast-light.src.js +4 -3
- package/themes/sand-signika.js +5 -5
- package/themes/sand-signika.js.map +1 -1
- package/themes/sand-signika.src.js +4 -3
- package/themes/skies.js +4 -4
- package/themes/skies.js.map +1 -1
- package/themes/skies.src.js +5 -4
- package/themes/sunset.js +3 -3
- package/themes/sunset.js.map +1 -1
- package/themes/sunset.src.js +5 -4
- package/es-modules/annotations/controllable/ControllableCircle.js +0 -79
- package/es-modules/annotations/controllable/ControllableImage.js +0 -79
- package/es-modules/annotations/controllable/ControllableRect.js +0 -82
- package/es-modules/annotations/types/InfinityLine.js +0 -110
- package/es-modules/masters/modules/map-parser.src.js +0 -12
- package/es-modules/modules/accessibility/components/InfoRegionsComponent/AnnotationsA11y.js +0 -80
- package/es-modules/modules/accessibility/components/InfoRegionsComponent/InfoRegionsComponent.js +0 -499
- package/es-modules/modules/accessibility/components/SeriesComponent/forcedMarkers.js +0 -147
- package/es-modules/modules/map-parser.src.js +0 -365
- package/es-modules/modules/sonification/options.js +0 -36
- package/es-modules/parts-3d/Chart.js +0 -1577
- package/es-modules/parts-3d/VMLRenderer.js +0 -35
- package/es-modules/parts-gantt/PathfinderAlgorithms.js +0 -656
- package/modules/map-parser.d.ts +0 -17
- package/modules/map-parser.js +0 -17
- package/modules/map-parser.js.map +0 -1
- package/modules/map-parser.src.d.ts +0 -17
- package/modules/map-parser.src.js +0 -421
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Highcharts Gantt JS v8.
|
|
2
|
+
* @license Highcharts Gantt JS v8.2.2 (2020-10-22)
|
|
3
3
|
*
|
|
4
4
|
* Pathfinder
|
|
5
5
|
*
|
|
@@ -28,902 +28,174 @@
|
|
|
28
28
|
obj[path] = fn.apply(null, args);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
_registerModule(_modules, '
|
|
31
|
+
_registerModule(_modules, 'Extensions/ArrowSymbols.js', [_modules['Core/Renderer/SVG/SVGRenderer.js']], function (SVGRenderer) {
|
|
32
32
|
/* *
|
|
33
33
|
*
|
|
34
|
-
* (c)
|
|
35
|
-
*
|
|
34
|
+
* (c) 2017 Highsoft AS
|
|
35
|
+
* Authors: Lars A. V. Cabrera
|
|
36
36
|
*
|
|
37
37
|
* License: www.highcharts.com/license
|
|
38
38
|
*
|
|
39
39
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
40
40
|
*
|
|
41
41
|
* */
|
|
42
|
-
var extend = U.extend,
|
|
43
|
-
pick = U.pick;
|
|
44
|
-
var min = Math.min,
|
|
45
|
-
max = Math.max,
|
|
46
|
-
abs = Math.abs;
|
|
47
42
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
43
|
+
* Creates an arrow symbol. Like a triangle, except not filled.
|
|
44
|
+
* ```
|
|
45
|
+
* o
|
|
46
|
+
* o
|
|
47
|
+
* o
|
|
48
|
+
* o
|
|
49
|
+
* o
|
|
50
|
+
* o
|
|
51
|
+
* o
|
|
52
|
+
* ```
|
|
50
53
|
*
|
|
51
54
|
* @private
|
|
52
|
-
* @function
|
|
55
|
+
* @function
|
|
53
56
|
*
|
|
54
|
-
* @param {
|
|
55
|
-
*
|
|
57
|
+
* @param {number} x
|
|
58
|
+
* x position of the arrow
|
|
56
59
|
*
|
|
57
|
-
* @param {number}
|
|
58
|
-
*
|
|
60
|
+
* @param {number} y
|
|
61
|
+
* y position of the arrow
|
|
59
62
|
*
|
|
60
|
-
* @param {number}
|
|
61
|
-
*
|
|
63
|
+
* @param {number} w
|
|
64
|
+
* width of the arrow
|
|
62
65
|
*
|
|
63
|
-
* @
|
|
64
|
-
*
|
|
66
|
+
* @param {number} h
|
|
67
|
+
* height of the arrow
|
|
68
|
+
*
|
|
69
|
+
* @return {Highcharts.SVGPathArray}
|
|
70
|
+
* Path array
|
|
65
71
|
*/
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
cmp = min - obstacles[cursor].xMin;
|
|
75
|
-
if (cmp > 0) {
|
|
76
|
-
left = cursor + 1;
|
|
77
|
-
}
|
|
78
|
-
else if (cmp < 0) {
|
|
79
|
-
right = cursor - 1;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
return cursor;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return left > 0 ? left - 1 : 0;
|
|
86
|
-
}
|
|
72
|
+
SVGRenderer.prototype.symbols.arrow = function (x, y, w, h) {
|
|
73
|
+
return [
|
|
74
|
+
['M', x, y + h / 2],
|
|
75
|
+
['L', x + w, y],
|
|
76
|
+
['L', x, y + h / 2],
|
|
77
|
+
['L', x + w, y + h]
|
|
78
|
+
];
|
|
79
|
+
};
|
|
87
80
|
/**
|
|
88
|
-
*
|
|
81
|
+
* Creates a half-width arrow symbol. Like a triangle, except not filled.
|
|
82
|
+
* ```
|
|
83
|
+
* o
|
|
84
|
+
* o
|
|
85
|
+
* o
|
|
86
|
+
* o
|
|
87
|
+
* o
|
|
88
|
+
* ```
|
|
89
89
|
*
|
|
90
90
|
* @private
|
|
91
|
-
* @function
|
|
91
|
+
* @function
|
|
92
92
|
*
|
|
93
|
-
* @param {
|
|
94
|
-
*
|
|
93
|
+
* @param {number} x
|
|
94
|
+
* x position of the arrow
|
|
95
95
|
*
|
|
96
|
-
* @param {
|
|
97
|
-
*
|
|
96
|
+
* @param {number} y
|
|
97
|
+
* y position of the arrow
|
|
98
98
|
*
|
|
99
|
-
* @
|
|
100
|
-
*
|
|
99
|
+
* @param {number} w
|
|
100
|
+
* width of the arrow
|
|
101
|
+
*
|
|
102
|
+
* @param {number} h
|
|
103
|
+
* height of the arrow
|
|
104
|
+
*
|
|
105
|
+
* @return {Highcharts.SVGPathArray}
|
|
106
|
+
* Path array
|
|
101
107
|
*/
|
|
102
|
-
function
|
|
103
|
-
return (
|
|
104
|
-
|
|
105
|
-
point.y <= obstacle.yMax &&
|
|
106
|
-
point.y >= obstacle.yMin);
|
|
107
|
-
}
|
|
108
|
+
SVGRenderer.prototype.symbols['arrow-half'] = function (x, y, w, h) {
|
|
109
|
+
return SVGRenderer.prototype.symbols.arrow(x, y, w / 2, h);
|
|
110
|
+
};
|
|
108
111
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
112
|
+
* Creates a left-oriented triangle.
|
|
113
|
+
* ```
|
|
114
|
+
* o
|
|
115
|
+
* ooooooo
|
|
116
|
+
* ooooooooooooo
|
|
117
|
+
* ooooooo
|
|
118
|
+
* o
|
|
119
|
+
* ```
|
|
111
120
|
*
|
|
112
121
|
* @private
|
|
113
|
-
* @function
|
|
122
|
+
* @function
|
|
114
123
|
*
|
|
115
|
-
* @param {
|
|
116
|
-
*
|
|
124
|
+
* @param {number} x
|
|
125
|
+
* x position of the triangle
|
|
117
126
|
*
|
|
118
|
-
* @param {
|
|
119
|
-
*
|
|
127
|
+
* @param {number} y
|
|
128
|
+
* y position of the triangle
|
|
120
129
|
*
|
|
121
|
-
* @
|
|
122
|
-
*
|
|
130
|
+
* @param {number} w
|
|
131
|
+
* width of the triangle
|
|
132
|
+
*
|
|
133
|
+
* @param {number} h
|
|
134
|
+
* height of the triangle
|
|
135
|
+
*
|
|
136
|
+
* @return {Highcharts.SVGPathArray}
|
|
137
|
+
* Path array
|
|
123
138
|
*/
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return -1;
|
|
135
|
-
}
|
|
139
|
+
SVGRenderer.prototype.symbols['triangle-left'] = function (x, y, w, h) {
|
|
140
|
+
return [
|
|
141
|
+
['M', x + w, y],
|
|
142
|
+
['L', x, y + h / 2],
|
|
143
|
+
['L', x + w, y + h],
|
|
144
|
+
['Z']
|
|
145
|
+
];
|
|
146
|
+
};
|
|
136
147
|
/**
|
|
137
|
-
*
|
|
148
|
+
* Alias function for triangle-left.
|
|
138
149
|
*
|
|
139
150
|
* @private
|
|
140
|
-
* @function
|
|
151
|
+
* @function
|
|
141
152
|
*
|
|
142
|
-
* @param {
|
|
143
|
-
*
|
|
153
|
+
* @param {number} x
|
|
154
|
+
* x position of the arrow
|
|
155
|
+
*
|
|
156
|
+
* @param {number} y
|
|
157
|
+
* y position of the arrow
|
|
158
|
+
*
|
|
159
|
+
* @param {number} w
|
|
160
|
+
* width of the arrow
|
|
161
|
+
*
|
|
162
|
+
* @param {number} h
|
|
163
|
+
* height of the arrow
|
|
144
164
|
*
|
|
145
165
|
* @return {Highcharts.SVGPathArray}
|
|
146
|
-
*
|
|
166
|
+
* Path array
|
|
147
167
|
*/
|
|
148
|
-
|
|
149
|
-
var path = [];
|
|
150
|
-
if (segments.length) {
|
|
151
|
-
path.push(['M', segments[0].start.x, segments[0].start.y]);
|
|
152
|
-
for (var i = 0; i < segments.length; ++i) {
|
|
153
|
-
path.push(['L', segments[i].end.x, segments[i].end.y]);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return path;
|
|
157
|
-
}
|
|
168
|
+
SVGRenderer.prototype.symbols['arrow-filled'] = SVGRenderer.prototype.symbols['triangle-left'];
|
|
158
169
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
170
|
+
* Creates a half-width, left-oriented triangle.
|
|
171
|
+
* ```
|
|
172
|
+
* o
|
|
173
|
+
* oooo
|
|
174
|
+
* ooooooo
|
|
175
|
+
* oooo
|
|
176
|
+
* o
|
|
177
|
+
* ```
|
|
161
178
|
*
|
|
162
179
|
* @private
|
|
163
|
-
* @function
|
|
180
|
+
* @function
|
|
164
181
|
*
|
|
165
|
-
* @param {
|
|
166
|
-
*
|
|
182
|
+
* @param {number} x
|
|
183
|
+
* x position of the triangle
|
|
167
184
|
*
|
|
168
|
-
* @param {
|
|
169
|
-
*
|
|
185
|
+
* @param {number} y
|
|
186
|
+
* y position of the triangle
|
|
170
187
|
*
|
|
171
|
-
* @
|
|
188
|
+
* @param {number} w
|
|
189
|
+
* width of the triangle
|
|
190
|
+
*
|
|
191
|
+
* @param {number} h
|
|
192
|
+
* height of the triangle
|
|
193
|
+
*
|
|
194
|
+
* @return {Highcharts.SVGPathArray}
|
|
195
|
+
* Path array
|
|
172
196
|
*/
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
obstacle.yMax = min(obstacle.yMax, bounds.yMax);
|
|
176
|
-
obstacle.xMin = max(obstacle.xMin, bounds.xMin);
|
|
177
|
-
obstacle.xMax = min(obstacle.xMax, bounds.xMax);
|
|
178
|
-
}
|
|
179
|
-
// Define the available pathfinding algorithms.
|
|
180
|
-
// Algorithms take up to 3 arguments: starting point, ending point, and an
|
|
181
|
-
// options object.
|
|
182
|
-
var algorithms = {
|
|
183
|
-
/**
|
|
184
|
-
* Get an SVG path from a starting coordinate to an ending coordinate.
|
|
185
|
-
* Draws a straight line.
|
|
186
|
-
*
|
|
187
|
-
* @function Highcharts.Pathfinder.algorithms.straight
|
|
188
|
-
*
|
|
189
|
-
* @param {Highcharts.PositionObject} start
|
|
190
|
-
* Starting coordinate,
|
|
191
|
-
object with x/y props.
|
|
192
|
-
*
|
|
193
|
-
* @param {Highcharts.PositionObject} end
|
|
194
|
-
* Ending coordinate,
|
|
195
|
-
object with x/y props.
|
|
196
|
-
*
|
|
197
|
-
* @return {object}
|
|
198
|
-
* An object with the SVG path in Array form as accepted by the SVG
|
|
199
|
-
* renderer,
|
|
200
|
-
as well as an array of new obstacles making up this
|
|
201
|
-
* path.
|
|
202
|
-
*/
|
|
203
|
-
straight: function (start,
|
|
204
|
-
end) {
|
|
205
|
-
return {
|
|
206
|
-
path: [
|
|
207
|
-
['M',
|
|
208
|
-
start.x,
|
|
209
|
-
start.y],
|
|
210
|
-
['L',
|
|
211
|
-
end.x,
|
|
212
|
-
end.y]
|
|
213
|
-
],
|
|
214
|
-
obstacles: [{ start: start,
|
|
215
|
-
end: end }]
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
/**
|
|
219
|
-
* Find a path from a starting coordinate to an ending coordinate, using
|
|
220
|
-
* right angles only, and taking only starting/ending obstacle into
|
|
221
|
-
* consideration.
|
|
222
|
-
*
|
|
223
|
-
* @function Highcharts.Pathfinder.algorithms.simpleConnect
|
|
224
|
-
*
|
|
225
|
-
* @param {Highcharts.PositionObject} start
|
|
226
|
-
* Starting coordinate, object with x/y props.
|
|
227
|
-
*
|
|
228
|
-
* @param {Highcharts.PositionObject} end
|
|
229
|
-
* Ending coordinate, object with x/y props.
|
|
230
|
-
*
|
|
231
|
-
* @param {object} options
|
|
232
|
-
* Options for the algorithm:
|
|
233
|
-
* - chartObstacles: Array of chart obstacles to avoid
|
|
234
|
-
* - startDirectionX: Optional. True if starting in the X direction.
|
|
235
|
-
* If not provided, the algorithm starts in the direction that is
|
|
236
|
-
* the furthest between start/end.
|
|
237
|
-
*
|
|
238
|
-
* @return {object}
|
|
239
|
-
* An object with the SVG path in Array form as accepted by the SVG
|
|
240
|
-
* renderer, as well as an array of new obstacles making up this
|
|
241
|
-
* path.
|
|
242
|
-
*/
|
|
243
|
-
simpleConnect: extend(function (start, end, options) {
|
|
244
|
-
var segments = [],
|
|
245
|
-
endSegment,
|
|
246
|
-
dir = pick(options.startDirectionX,
|
|
247
|
-
abs(end.x - start.x) > abs(end.y - start.y)) ? 'x' : 'y',
|
|
248
|
-
chartObstacles = options.chartObstacles,
|
|
249
|
-
startObstacleIx = findObstacleFromPoint(chartObstacles,
|
|
250
|
-
start),
|
|
251
|
-
endObstacleIx = findObstacleFromPoint(chartObstacles,
|
|
252
|
-
end),
|
|
253
|
-
startObstacle,
|
|
254
|
-
endObstacle,
|
|
255
|
-
prevWaypoint,
|
|
256
|
-
waypoint,
|
|
257
|
-
waypoint2,
|
|
258
|
-
useMax,
|
|
259
|
-
endPoint;
|
|
260
|
-
// eslint-disable-next-line valid-jsdoc
|
|
261
|
-
/**
|
|
262
|
-
* Return a clone of a point with a property set from a target object,
|
|
263
|
-
* optionally with an offset
|
|
264
|
-
* @private
|
|
265
|
-
*/
|
|
266
|
-
function copyFromPoint(from, fromKey, to, toKey, offset) {
|
|
267
|
-
var point = {
|
|
268
|
-
x: from.x,
|
|
269
|
-
y: from.y
|
|
270
|
-
};
|
|
271
|
-
point[fromKey] = to[toKey || fromKey] + (offset || 0);
|
|
272
|
-
return point;
|
|
273
|
-
}
|
|
274
|
-
// eslint-disable-next-line valid-jsdoc
|
|
275
|
-
/**
|
|
276
|
-
* Return waypoint outside obstacle.
|
|
277
|
-
* @private
|
|
278
|
-
*/
|
|
279
|
-
function getMeOut(obstacle, point, direction) {
|
|
280
|
-
var useMax = abs(point[direction] - obstacle[direction + 'Min']) >
|
|
281
|
-
abs(point[direction] - obstacle[direction + 'Max']);
|
|
282
|
-
return copyFromPoint(point, direction, obstacle, direction + (useMax ? 'Max' : 'Min'), useMax ? 1 : -1);
|
|
283
|
-
}
|
|
284
|
-
// Pull out end point
|
|
285
|
-
if (endObstacleIx > -1) {
|
|
286
|
-
endObstacle = chartObstacles[endObstacleIx];
|
|
287
|
-
waypoint = getMeOut(endObstacle, end, dir);
|
|
288
|
-
endSegment = {
|
|
289
|
-
start: waypoint,
|
|
290
|
-
end: end
|
|
291
|
-
};
|
|
292
|
-
endPoint = waypoint;
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
endPoint = end;
|
|
296
|
-
}
|
|
297
|
-
// If an obstacle envelops the start point, add a segment to get out,
|
|
298
|
-
// and around it.
|
|
299
|
-
if (startObstacleIx > -1) {
|
|
300
|
-
startObstacle = chartObstacles[startObstacleIx];
|
|
301
|
-
waypoint = getMeOut(startObstacle, start, dir);
|
|
302
|
-
segments.push({
|
|
303
|
-
start: start,
|
|
304
|
-
end: waypoint
|
|
305
|
-
});
|
|
306
|
-
// If we are going back again, switch direction to get around start
|
|
307
|
-
// obstacle.
|
|
308
|
-
if (
|
|
309
|
-
// Going towards max from start:
|
|
310
|
-
waypoint[dir] >= start[dir] ===
|
|
311
|
-
// Going towards min to end:
|
|
312
|
-
waypoint[dir] >= endPoint[dir]) {
|
|
313
|
-
dir = dir === 'y' ? 'x' : 'y';
|
|
314
|
-
useMax = start[dir] < end[dir];
|
|
315
|
-
segments.push({
|
|
316
|
-
start: waypoint,
|
|
317
|
-
end: copyFromPoint(waypoint, dir, startObstacle, dir + (useMax ? 'Max' : 'Min'), useMax ? 1 : -1)
|
|
318
|
-
});
|
|
319
|
-
// Switch direction again
|
|
320
|
-
dir = dir === 'y' ? 'x' : 'y';
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
// We are around the start obstacle. Go towards the end in one
|
|
324
|
-
// direction.
|
|
325
|
-
prevWaypoint = segments.length ?
|
|
326
|
-
segments[segments.length - 1].end :
|
|
327
|
-
start;
|
|
328
|
-
waypoint = copyFromPoint(prevWaypoint, dir, endPoint);
|
|
329
|
-
segments.push({
|
|
330
|
-
start: prevWaypoint,
|
|
331
|
-
end: waypoint
|
|
332
|
-
});
|
|
333
|
-
// Final run to end point in the other direction
|
|
334
|
-
dir = dir === 'y' ? 'x' : 'y';
|
|
335
|
-
waypoint2 = copyFromPoint(waypoint, dir, endPoint);
|
|
336
|
-
segments.push({
|
|
337
|
-
start: waypoint,
|
|
338
|
-
end: waypoint2
|
|
339
|
-
});
|
|
340
|
-
// Finally add the endSegment
|
|
341
|
-
segments.push(endSegment);
|
|
342
|
-
return {
|
|
343
|
-
path: pathFromSegments(segments),
|
|
344
|
-
obstacles: segments
|
|
345
|
-
};
|
|
346
|
-
}, {
|
|
347
|
-
requiresObstacles: true
|
|
348
|
-
}),
|
|
349
|
-
/**
|
|
350
|
-
* Find a path from a starting coordinate to an ending coordinate, taking
|
|
351
|
-
* obstacles into consideration. Might not always find the optimal path,
|
|
352
|
-
* but is fast, and usually good enough.
|
|
353
|
-
*
|
|
354
|
-
* @function Highcharts.Pathfinder.algorithms.fastAvoid
|
|
355
|
-
*
|
|
356
|
-
* @param {Highcharts.PositionObject} start
|
|
357
|
-
* Starting coordinate, object with x/y props.
|
|
358
|
-
*
|
|
359
|
-
* @param {Highcharts.PositionObject} end
|
|
360
|
-
* Ending coordinate, object with x/y props.
|
|
361
|
-
*
|
|
362
|
-
* @param {object} options
|
|
363
|
-
* Options for the algorithm.
|
|
364
|
-
* - chartObstacles: Array of chart obstacles to avoid
|
|
365
|
-
* - lineObstacles: Array of line obstacles to jump over
|
|
366
|
-
* - obstacleMetrics: Object with metrics of chartObstacles cached
|
|
367
|
-
* - hardBounds: Hard boundaries to not cross
|
|
368
|
-
* - obstacleOptions: Options for the obstacles, including margin
|
|
369
|
-
* - startDirectionX: Optional. True if starting in the X direction.
|
|
370
|
-
* If not provided, the algorithm starts in the
|
|
371
|
-
* direction that is the furthest between
|
|
372
|
-
* start/end.
|
|
373
|
-
*
|
|
374
|
-
* @return {object}
|
|
375
|
-
* An object with the SVG path in Array form as accepted by the SVG
|
|
376
|
-
* renderer, as well as an array of new obstacles making up this
|
|
377
|
-
* path.
|
|
378
|
-
*/
|
|
379
|
-
fastAvoid: extend(function (start, end, options) {
|
|
380
|
-
/*
|
|
381
|
-
Algorithm rules/description
|
|
382
|
-
- Find initial direction
|
|
383
|
-
- Determine soft/hard max for each direction.
|
|
384
|
-
- Move along initial direction until obstacle.
|
|
385
|
-
- Change direction.
|
|
386
|
-
- If hitting obstacle, first try to change length of previous line
|
|
387
|
-
before changing direction again.
|
|
388
|
-
|
|
389
|
-
Soft min/max x = start/destination x +/- widest obstacle + margin
|
|
390
|
-
Soft min/max y = start/destination y +/- tallest obstacle + margin
|
|
391
|
-
|
|
392
|
-
@todo:
|
|
393
|
-
- Make retrospective, try changing prev segment to reduce
|
|
394
|
-
corners
|
|
395
|
-
- Fix logic for breaking out of end-points - not always picking
|
|
396
|
-
the best direction currently
|
|
397
|
-
- When going around the end obstacle we should not always go the
|
|
398
|
-
shortest route, rather pick the one closer to the end point
|
|
399
|
-
*/
|
|
400
|
-
var dirIsX = pick(options.startDirectionX,
|
|
401
|
-
abs(end.x - start.x) > abs(end.y - start.y)),
|
|
402
|
-
dir = dirIsX ? 'x' : 'y',
|
|
403
|
-
segments,
|
|
404
|
-
useMax,
|
|
405
|
-
extractedEndPoint,
|
|
406
|
-
endSegments = [],
|
|
407
|
-
forceObstacleBreak = false, // Used in clearPathTo to keep track of
|
|
408
|
-
// when to force break through an obstacle.
|
|
409
|
-
// Boundaries to stay within. If beyond soft boundary, prefer to
|
|
410
|
-
// change direction ASAP. If at hard max, always change immediately.
|
|
411
|
-
metrics = options.obstacleMetrics,
|
|
412
|
-
softMinX = min(start.x,
|
|
413
|
-
end.x) - metrics.maxWidth - 10,
|
|
414
|
-
softMaxX = max(start.x,
|
|
415
|
-
end.x) + metrics.maxWidth + 10,
|
|
416
|
-
softMinY = min(start.y,
|
|
417
|
-
end.y) - metrics.maxHeight - 10,
|
|
418
|
-
softMaxY = max(start.y,
|
|
419
|
-
end.y) + metrics.maxHeight + 10,
|
|
420
|
-
// Obstacles
|
|
421
|
-
chartObstacles = options.chartObstacles,
|
|
422
|
-
startObstacleIx = findLastObstacleBefore(chartObstacles,
|
|
423
|
-
softMinX),
|
|
424
|
-
endObstacleIx = findLastObstacleBefore(chartObstacles,
|
|
425
|
-
softMaxX);
|
|
426
|
-
// eslint-disable-next-line valid-jsdoc
|
|
427
|
-
/**
|
|
428
|
-
* How far can you go between two points before hitting an obstacle?
|
|
429
|
-
* Does not work for diagonal lines (because it doesn't have to).
|
|
430
|
-
* @private
|
|
431
|
-
*/
|
|
432
|
-
function pivotPoint(fromPoint, toPoint, directionIsX) {
|
|
433
|
-
var firstPoint,
|
|
434
|
-
lastPoint,
|
|
435
|
-
highestPoint,
|
|
436
|
-
lowestPoint,
|
|
437
|
-
i,
|
|
438
|
-
searchDirection = fromPoint.x < toPoint.x ? 1 : -1;
|
|
439
|
-
if (fromPoint.x < toPoint.x) {
|
|
440
|
-
firstPoint = fromPoint;
|
|
441
|
-
lastPoint = toPoint;
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
firstPoint = toPoint;
|
|
445
|
-
lastPoint = fromPoint;
|
|
446
|
-
}
|
|
447
|
-
if (fromPoint.y < toPoint.y) {
|
|
448
|
-
lowestPoint = fromPoint;
|
|
449
|
-
highestPoint = toPoint;
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
lowestPoint = toPoint;
|
|
453
|
-
highestPoint = fromPoint;
|
|
454
|
-
}
|
|
455
|
-
// Go through obstacle range in reverse if toPoint is before
|
|
456
|
-
// fromPoint in the X-dimension.
|
|
457
|
-
i = searchDirection < 0 ?
|
|
458
|
-
// Searching backwards, start at last obstacle before last point
|
|
459
|
-
min(findLastObstacleBefore(chartObstacles, lastPoint.x), chartObstacles.length - 1) :
|
|
460
|
-
// Forwards. Since we're not sorted by xMax, we have to look
|
|
461
|
-
// at all obstacles.
|
|
462
|
-
0;
|
|
463
|
-
// Go through obstacles in this X range
|
|
464
|
-
while (chartObstacles[i] && (searchDirection > 0 && chartObstacles[i].xMin <= lastPoint.x ||
|
|
465
|
-
searchDirection < 0 && chartObstacles[i].xMax >= firstPoint.x)) {
|
|
466
|
-
// If this obstacle is between from and to points in a straight
|
|
467
|
-
// line, pivot at the intersection.
|
|
468
|
-
if (chartObstacles[i].xMin <= lastPoint.x &&
|
|
469
|
-
chartObstacles[i].xMax >= firstPoint.x &&
|
|
470
|
-
chartObstacles[i].yMin <= highestPoint.y &&
|
|
471
|
-
chartObstacles[i].yMax >= lowestPoint.y) {
|
|
472
|
-
if (directionIsX) {
|
|
473
|
-
return {
|
|
474
|
-
y: fromPoint.y,
|
|
475
|
-
x: fromPoint.x < toPoint.x ?
|
|
476
|
-
chartObstacles[i].xMin - 1 :
|
|
477
|
-
chartObstacles[i].xMax + 1,
|
|
478
|
-
obstacle: chartObstacles[i]
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
// else ...
|
|
482
|
-
return {
|
|
483
|
-
x: fromPoint.x,
|
|
484
|
-
y: fromPoint.y < toPoint.y ?
|
|
485
|
-
chartObstacles[i].yMin - 1 :
|
|
486
|
-
chartObstacles[i].yMax + 1,
|
|
487
|
-
obstacle: chartObstacles[i]
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
i += searchDirection;
|
|
491
|
-
}
|
|
492
|
-
return toPoint;
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Decide in which direction to dodge or get out of an obstacle.
|
|
496
|
-
* Considers desired direction, which way is shortest, soft and hard
|
|
497
|
-
* bounds.
|
|
498
|
-
*
|
|
499
|
-
* (? Returns a string, either xMin, xMax, yMin or yMax.)
|
|
500
|
-
*
|
|
501
|
-
* @private
|
|
502
|
-
* @function
|
|
503
|
-
*
|
|
504
|
-
* @param {object} obstacle
|
|
505
|
-
* Obstacle to dodge/escape.
|
|
506
|
-
*
|
|
507
|
-
* @param {object} fromPoint
|
|
508
|
-
* Point with x/y props that's dodging/escaping.
|
|
509
|
-
*
|
|
510
|
-
* @param {object} toPoint
|
|
511
|
-
* Goal point.
|
|
512
|
-
*
|
|
513
|
-
* @param {boolean} dirIsX
|
|
514
|
-
* Dodge in X dimension.
|
|
515
|
-
*
|
|
516
|
-
* @param {object} bounds
|
|
517
|
-
* Hard and soft boundaries.
|
|
518
|
-
*
|
|
519
|
-
* @return {boolean}
|
|
520
|
-
* Use max or not.
|
|
521
|
-
*/
|
|
522
|
-
function getDodgeDirection(obstacle, fromPoint, toPoint, dirIsX, bounds) {
|
|
523
|
-
var softBounds = bounds.soft, hardBounds = bounds.hard, dir = dirIsX ? 'x' : 'y', toPointMax = { x: fromPoint.x, y: fromPoint.y }, toPointMin = { x: fromPoint.x, y: fromPoint.y }, minPivot, maxPivot, maxOutOfSoftBounds = obstacle[dir + 'Max'] >=
|
|
524
|
-
softBounds[dir + 'Max'], minOutOfSoftBounds = obstacle[dir + 'Min'] <=
|
|
525
|
-
softBounds[dir + 'Min'], maxOutOfHardBounds = obstacle[dir + 'Max'] >=
|
|
526
|
-
hardBounds[dir + 'Max'], minOutOfHardBounds = obstacle[dir + 'Min'] <=
|
|
527
|
-
hardBounds[dir + 'Min'],
|
|
528
|
-
// Find out if we should prefer one direction over the other if
|
|
529
|
-
// we can choose freely
|
|
530
|
-
minDistance = abs(obstacle[dir + 'Min'] - fromPoint[dir]), maxDistance = abs(obstacle[dir + 'Max'] - fromPoint[dir]),
|
|
531
|
-
// If it's a small difference, pick the one leading towards dest
|
|
532
|
-
// point. Otherwise pick the shortest distance
|
|
533
|
-
useMax = abs(minDistance - maxDistance) < 10 ?
|
|
534
|
-
fromPoint[dir] < toPoint[dir] :
|
|
535
|
-
maxDistance < minDistance;
|
|
536
|
-
// Check if we hit any obstacles trying to go around in either
|
|
537
|
-
// direction.
|
|
538
|
-
toPointMin[dir] = obstacle[dir + 'Min'];
|
|
539
|
-
toPointMax[dir] = obstacle[dir + 'Max'];
|
|
540
|
-
minPivot = pivotPoint(fromPoint, toPointMin, dirIsX)[dir] !==
|
|
541
|
-
toPointMin[dir];
|
|
542
|
-
maxPivot = pivotPoint(fromPoint, toPointMax, dirIsX)[dir] !==
|
|
543
|
-
toPointMax[dir];
|
|
544
|
-
useMax = minPivot ?
|
|
545
|
-
(maxPivot ? useMax : true) :
|
|
546
|
-
(maxPivot ? false : useMax);
|
|
547
|
-
// useMax now contains our preferred choice, bounds not taken into
|
|
548
|
-
// account. If both or neither direction is out of bounds we want to
|
|
549
|
-
// use this.
|
|
550
|
-
// Deal with soft bounds
|
|
551
|
-
useMax = minOutOfSoftBounds ?
|
|
552
|
-
(maxOutOfSoftBounds ? useMax : true) : // Out on min
|
|
553
|
-
(maxOutOfSoftBounds ? false : useMax); // Not out on min
|
|
554
|
-
// Deal with hard bounds
|
|
555
|
-
useMax = minOutOfHardBounds ?
|
|
556
|
-
(maxOutOfHardBounds ? useMax : true) : // Out on min
|
|
557
|
-
(maxOutOfHardBounds ? false : useMax); // Not out on min
|
|
558
|
-
return useMax;
|
|
559
|
-
}
|
|
560
|
-
// eslint-disable-next-line valid-jsdoc
|
|
561
|
-
/**
|
|
562
|
-
* Find a clear path between point.
|
|
563
|
-
* @private
|
|
564
|
-
*/
|
|
565
|
-
function clearPathTo(fromPoint, toPoint, dirIsX) {
|
|
566
|
-
// Don't waste time if we've hit goal
|
|
567
|
-
if (fromPoint.x === toPoint.x && fromPoint.y === toPoint.y) {
|
|
568
|
-
return [];
|
|
569
|
-
}
|
|
570
|
-
var dir = dirIsX ? 'x' : 'y',
|
|
571
|
-
pivot,
|
|
572
|
-
segments,
|
|
573
|
-
waypoint,
|
|
574
|
-
waypointUseMax,
|
|
575
|
-
envelopingObstacle,
|
|
576
|
-
secondEnvelopingObstacle,
|
|
577
|
-
envelopWaypoint,
|
|
578
|
-
obstacleMargin = options.obstacleOptions.margin,
|
|
579
|
-
bounds = {
|
|
580
|
-
soft: {
|
|
581
|
-
xMin: softMinX,
|
|
582
|
-
xMax: softMaxX,
|
|
583
|
-
yMin: softMinY,
|
|
584
|
-
yMax: softMaxY
|
|
585
|
-
},
|
|
586
|
-
hard: options.hardBounds
|
|
587
|
-
};
|
|
588
|
-
// If fromPoint is inside an obstacle we have a problem. Break out
|
|
589
|
-
// by just going to the outside of this obstacle. We prefer to go to
|
|
590
|
-
// the nearest edge in the chosen direction.
|
|
591
|
-
envelopingObstacle =
|
|
592
|
-
findObstacleFromPoint(chartObstacles, fromPoint);
|
|
593
|
-
if (envelopingObstacle > -1) {
|
|
594
|
-
envelopingObstacle = chartObstacles[envelopingObstacle];
|
|
595
|
-
waypointUseMax = getDodgeDirection(envelopingObstacle, fromPoint, toPoint, dirIsX, bounds);
|
|
596
|
-
// Cut obstacle to hard bounds to make sure we stay within
|
|
597
|
-
limitObstacleToBounds(envelopingObstacle, options.hardBounds);
|
|
598
|
-
envelopWaypoint = dirIsX ? {
|
|
599
|
-
y: fromPoint.y,
|
|
600
|
-
x: envelopingObstacle[waypointUseMax ? 'xMax' : 'xMin'] +
|
|
601
|
-
(waypointUseMax ? 1 : -1)
|
|
602
|
-
} : {
|
|
603
|
-
x: fromPoint.x,
|
|
604
|
-
y: envelopingObstacle[waypointUseMax ? 'yMax' : 'yMin'] +
|
|
605
|
-
(waypointUseMax ? 1 : -1)
|
|
606
|
-
};
|
|
607
|
-
// If we crashed into another obstacle doing this, we put the
|
|
608
|
-
// waypoint between them instead
|
|
609
|
-
secondEnvelopingObstacle = findObstacleFromPoint(chartObstacles, envelopWaypoint);
|
|
610
|
-
if (secondEnvelopingObstacle > -1) {
|
|
611
|
-
secondEnvelopingObstacle = chartObstacles[secondEnvelopingObstacle];
|
|
612
|
-
// Cut obstacle to hard bounds
|
|
613
|
-
limitObstacleToBounds(secondEnvelopingObstacle, options.hardBounds);
|
|
614
|
-
// Modify waypoint to lay between obstacles
|
|
615
|
-
envelopWaypoint[dir] = waypointUseMax ? max(envelopingObstacle[dir + 'Max'] - obstacleMargin + 1, (secondEnvelopingObstacle[dir + 'Min'] +
|
|
616
|
-
envelopingObstacle[dir + 'Max']) / 2) :
|
|
617
|
-
min((envelopingObstacle[dir + 'Min'] + obstacleMargin - 1), ((secondEnvelopingObstacle[dir + 'Max'] +
|
|
618
|
-
envelopingObstacle[dir + 'Min']) / 2));
|
|
619
|
-
// We are not going anywhere. If this happens for the first
|
|
620
|
-
// time, do nothing. Otherwise, try to go to the extreme of
|
|
621
|
-
// the obstacle pair in the current direction.
|
|
622
|
-
if (fromPoint.x === envelopWaypoint.x &&
|
|
623
|
-
fromPoint.y === envelopWaypoint.y) {
|
|
624
|
-
if (forceObstacleBreak) {
|
|
625
|
-
envelopWaypoint[dir] = waypointUseMax ?
|
|
626
|
-
max(envelopingObstacle[dir + 'Max'], secondEnvelopingObstacle[dir + 'Max']) + 1 :
|
|
627
|
-
min(envelopingObstacle[dir + 'Min'], secondEnvelopingObstacle[dir + 'Min']) - 1;
|
|
628
|
-
}
|
|
629
|
-
// Toggle on if off, and the opposite
|
|
630
|
-
forceObstacleBreak = !forceObstacleBreak;
|
|
631
|
-
}
|
|
632
|
-
else {
|
|
633
|
-
// This point is not identical to previous.
|
|
634
|
-
// Clear break trigger.
|
|
635
|
-
forceObstacleBreak = false;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
segments = [{
|
|
639
|
-
start: fromPoint,
|
|
640
|
-
end: envelopWaypoint
|
|
641
|
-
}];
|
|
642
|
-
}
|
|
643
|
-
else { // If not enveloping, use standard pivot calculation
|
|
644
|
-
pivot = pivotPoint(fromPoint, {
|
|
645
|
-
x: dirIsX ? toPoint.x : fromPoint.x,
|
|
646
|
-
y: dirIsX ? fromPoint.y : toPoint.y
|
|
647
|
-
}, dirIsX);
|
|
648
|
-
segments = [{
|
|
649
|
-
start: fromPoint,
|
|
650
|
-
end: {
|
|
651
|
-
x: pivot.x,
|
|
652
|
-
y: pivot.y
|
|
653
|
-
}
|
|
654
|
-
}];
|
|
655
|
-
// Pivot before goal, use a waypoint to dodge obstacle
|
|
656
|
-
if (pivot[dirIsX ? 'x' : 'y'] !== toPoint[dirIsX ? 'x' : 'y']) {
|
|
657
|
-
// Find direction of waypoint
|
|
658
|
-
waypointUseMax = getDodgeDirection(pivot.obstacle, pivot, toPoint, !dirIsX, bounds);
|
|
659
|
-
// Cut waypoint to hard bounds
|
|
660
|
-
limitObstacleToBounds(pivot.obstacle, options.hardBounds);
|
|
661
|
-
waypoint = {
|
|
662
|
-
x: dirIsX ?
|
|
663
|
-
pivot.x :
|
|
664
|
-
pivot.obstacle[waypointUseMax ? 'xMax' : 'xMin'] +
|
|
665
|
-
(waypointUseMax ? 1 : -1),
|
|
666
|
-
y: dirIsX ?
|
|
667
|
-
pivot.obstacle[waypointUseMax ? 'yMax' : 'yMin'] +
|
|
668
|
-
(waypointUseMax ? 1 : -1) :
|
|
669
|
-
pivot.y
|
|
670
|
-
};
|
|
671
|
-
// We're changing direction here, store that to make sure we
|
|
672
|
-
// also change direction when adding the last segment array
|
|
673
|
-
// after handling waypoint.
|
|
674
|
-
dirIsX = !dirIsX;
|
|
675
|
-
segments = segments.concat(clearPathTo({
|
|
676
|
-
x: pivot.x,
|
|
677
|
-
y: pivot.y
|
|
678
|
-
}, waypoint, dirIsX));
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
// Get segments for the other direction too
|
|
682
|
-
// Recursion is our friend
|
|
683
|
-
segments = segments.concat(clearPathTo(segments[segments.length - 1].end, toPoint, !dirIsX));
|
|
684
|
-
return segments;
|
|
685
|
-
}
|
|
686
|
-
// eslint-disable-next-line valid-jsdoc
|
|
687
|
-
/**
|
|
688
|
-
* Extract point to outside of obstacle in whichever direction is
|
|
689
|
-
* closest. Returns new point outside obstacle.
|
|
690
|
-
* @private
|
|
691
|
-
*/
|
|
692
|
-
function extractFromObstacle(obstacle, point, goalPoint) {
|
|
693
|
-
var dirIsX = min(obstacle.xMax - point.x,
|
|
694
|
-
point.x - obstacle.xMin) <
|
|
695
|
-
min(obstacle.yMax - point.y,
|
|
696
|
-
point.y - obstacle.yMin),
|
|
697
|
-
bounds = {
|
|
698
|
-
soft: options.hardBounds,
|
|
699
|
-
hard: options.hardBounds
|
|
700
|
-
},
|
|
701
|
-
useMax = getDodgeDirection(obstacle,
|
|
702
|
-
point,
|
|
703
|
-
goalPoint,
|
|
704
|
-
dirIsX,
|
|
705
|
-
bounds);
|
|
706
|
-
return dirIsX ? {
|
|
707
|
-
y: point.y,
|
|
708
|
-
x: obstacle[useMax ? 'xMax' : 'xMin'] + (useMax ? 1 : -1)
|
|
709
|
-
} : {
|
|
710
|
-
x: point.x,
|
|
711
|
-
y: obstacle[useMax ? 'yMax' : 'yMin'] + (useMax ? 1 : -1)
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
// Cut the obstacle array to soft bounds for optimization in large
|
|
715
|
-
// datasets.
|
|
716
|
-
chartObstacles =
|
|
717
|
-
chartObstacles.slice(startObstacleIx, endObstacleIx + 1);
|
|
718
|
-
// If an obstacle envelops the end point, move it out of there and add
|
|
719
|
-
// a little segment to where it was.
|
|
720
|
-
if ((endObstacleIx = findObstacleFromPoint(chartObstacles, end)) > -1) {
|
|
721
|
-
extractedEndPoint = extractFromObstacle(chartObstacles[endObstacleIx], end, start);
|
|
722
|
-
endSegments.push({
|
|
723
|
-
end: end,
|
|
724
|
-
start: extractedEndPoint
|
|
725
|
-
});
|
|
726
|
-
end = extractedEndPoint;
|
|
727
|
-
}
|
|
728
|
-
// If it's still inside one or more obstacles, get out of there by
|
|
729
|
-
// force-moving towards the start point.
|
|
730
|
-
while ((endObstacleIx = findObstacleFromPoint(chartObstacles, end)) > -1) {
|
|
731
|
-
useMax = end[dir] - start[dir] < 0;
|
|
732
|
-
extractedEndPoint = {
|
|
733
|
-
x: end.x,
|
|
734
|
-
y: end.y
|
|
735
|
-
};
|
|
736
|
-
extractedEndPoint[dir] = chartObstacles[endObstacleIx][useMax ? dir + 'Max' : dir + 'Min'] + (useMax ? 1 : -1);
|
|
737
|
-
endSegments.push({
|
|
738
|
-
end: end,
|
|
739
|
-
start: extractedEndPoint
|
|
740
|
-
});
|
|
741
|
-
end = extractedEndPoint;
|
|
742
|
-
}
|
|
743
|
-
// Find the path
|
|
744
|
-
segments = clearPathTo(start, end, dirIsX);
|
|
745
|
-
// Add the end-point segments
|
|
746
|
-
segments = segments.concat(endSegments.reverse());
|
|
747
|
-
return {
|
|
748
|
-
path: pathFromSegments(segments),
|
|
749
|
-
obstacles: segments
|
|
750
|
-
};
|
|
751
|
-
}, {
|
|
752
|
-
requiresObstacles: true
|
|
753
|
-
})
|
|
754
|
-
};
|
|
755
|
-
|
|
756
|
-
return algorithms;
|
|
757
|
-
});
|
|
758
|
-
_registerModule(_modules, 'parts-gantt/ArrowSymbols.js', [_modules['parts/Globals.js']], function (H) {
|
|
759
|
-
/* *
|
|
760
|
-
*
|
|
761
|
-
* (c) 2017 Highsoft AS
|
|
762
|
-
* Authors: Lars A. V. Cabrera
|
|
763
|
-
*
|
|
764
|
-
* License: www.highcharts.com/license
|
|
765
|
-
*
|
|
766
|
-
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
767
|
-
*
|
|
768
|
-
* */
|
|
769
|
-
/**
|
|
770
|
-
* Creates an arrow symbol. Like a triangle, except not filled.
|
|
771
|
-
* ```
|
|
772
|
-
* o
|
|
773
|
-
* o
|
|
774
|
-
* o
|
|
775
|
-
* o
|
|
776
|
-
* o
|
|
777
|
-
* o
|
|
778
|
-
* o
|
|
779
|
-
* ```
|
|
780
|
-
*
|
|
781
|
-
* @private
|
|
782
|
-
* @function
|
|
783
|
-
*
|
|
784
|
-
* @param {number} x
|
|
785
|
-
* x position of the arrow
|
|
786
|
-
*
|
|
787
|
-
* @param {number} y
|
|
788
|
-
* y position of the arrow
|
|
789
|
-
*
|
|
790
|
-
* @param {number} w
|
|
791
|
-
* width of the arrow
|
|
792
|
-
*
|
|
793
|
-
* @param {number} h
|
|
794
|
-
* height of the arrow
|
|
795
|
-
*
|
|
796
|
-
* @return {Highcharts.SVGPathArray}
|
|
797
|
-
* Path array
|
|
798
|
-
*/
|
|
799
|
-
H.SVGRenderer.prototype.symbols.arrow = function (x, y, w, h) {
|
|
800
|
-
return [
|
|
801
|
-
['M', x, y + h / 2],
|
|
802
|
-
['L', x + w, y],
|
|
803
|
-
['L', x, y + h / 2],
|
|
804
|
-
['L', x + w, y + h]
|
|
805
|
-
];
|
|
806
|
-
};
|
|
807
|
-
/**
|
|
808
|
-
* Creates a half-width arrow symbol. Like a triangle, except not filled.
|
|
809
|
-
* ```
|
|
810
|
-
* o
|
|
811
|
-
* o
|
|
812
|
-
* o
|
|
813
|
-
* o
|
|
814
|
-
* o
|
|
815
|
-
* ```
|
|
816
|
-
*
|
|
817
|
-
* @private
|
|
818
|
-
* @function
|
|
819
|
-
*
|
|
820
|
-
* @param {number} x
|
|
821
|
-
* x position of the arrow
|
|
822
|
-
*
|
|
823
|
-
* @param {number} y
|
|
824
|
-
* y position of the arrow
|
|
825
|
-
*
|
|
826
|
-
* @param {number} w
|
|
827
|
-
* width of the arrow
|
|
828
|
-
*
|
|
829
|
-
* @param {number} h
|
|
830
|
-
* height of the arrow
|
|
831
|
-
*
|
|
832
|
-
* @return {Highcharts.SVGPathArray}
|
|
833
|
-
* Path array
|
|
834
|
-
*/
|
|
835
|
-
H.SVGRenderer.prototype.symbols['arrow-half'] = function (x, y, w, h) {
|
|
836
|
-
return H.SVGRenderer.prototype.symbols.arrow(x, y, w / 2, h);
|
|
837
|
-
};
|
|
838
|
-
/**
|
|
839
|
-
* Creates a left-oriented triangle.
|
|
840
|
-
* ```
|
|
841
|
-
* o
|
|
842
|
-
* ooooooo
|
|
843
|
-
* ooooooooooooo
|
|
844
|
-
* ooooooo
|
|
845
|
-
* o
|
|
846
|
-
* ```
|
|
847
|
-
*
|
|
848
|
-
* @private
|
|
849
|
-
* @function
|
|
850
|
-
*
|
|
851
|
-
* @param {number} x
|
|
852
|
-
* x position of the triangle
|
|
853
|
-
*
|
|
854
|
-
* @param {number} y
|
|
855
|
-
* y position of the triangle
|
|
856
|
-
*
|
|
857
|
-
* @param {number} w
|
|
858
|
-
* width of the triangle
|
|
859
|
-
*
|
|
860
|
-
* @param {number} h
|
|
861
|
-
* height of the triangle
|
|
862
|
-
*
|
|
863
|
-
* @return {Highcharts.SVGPathArray}
|
|
864
|
-
* Path array
|
|
865
|
-
*/
|
|
866
|
-
H.SVGRenderer.prototype.symbols['triangle-left'] = function (x, y, w, h) {
|
|
867
|
-
return [
|
|
868
|
-
['M', x + w, y],
|
|
869
|
-
['L', x, y + h / 2],
|
|
870
|
-
['L', x + w, y + h],
|
|
871
|
-
['Z']
|
|
872
|
-
];
|
|
873
|
-
};
|
|
874
|
-
/**
|
|
875
|
-
* Alias function for triangle-left.
|
|
876
|
-
*
|
|
877
|
-
* @private
|
|
878
|
-
* @function
|
|
879
|
-
*
|
|
880
|
-
* @param {number} x
|
|
881
|
-
* x position of the arrow
|
|
882
|
-
*
|
|
883
|
-
* @param {number} y
|
|
884
|
-
* y position of the arrow
|
|
885
|
-
*
|
|
886
|
-
* @param {number} w
|
|
887
|
-
* width of the arrow
|
|
888
|
-
*
|
|
889
|
-
* @param {number} h
|
|
890
|
-
* height of the arrow
|
|
891
|
-
*
|
|
892
|
-
* @return {Highcharts.SVGPathArray}
|
|
893
|
-
* Path array
|
|
894
|
-
*/
|
|
895
|
-
H.SVGRenderer.prototype.symbols['arrow-filled'] =
|
|
896
|
-
H.SVGRenderer.prototype.symbols['triangle-left'];
|
|
897
|
-
/**
|
|
898
|
-
* Creates a half-width, left-oriented triangle.
|
|
899
|
-
* ```
|
|
900
|
-
* o
|
|
901
|
-
* oooo
|
|
902
|
-
* ooooooo
|
|
903
|
-
* oooo
|
|
904
|
-
* o
|
|
905
|
-
* ```
|
|
906
|
-
*
|
|
907
|
-
* @private
|
|
908
|
-
* @function
|
|
909
|
-
*
|
|
910
|
-
* @param {number} x
|
|
911
|
-
* x position of the triangle
|
|
912
|
-
*
|
|
913
|
-
* @param {number} y
|
|
914
|
-
* y position of the triangle
|
|
915
|
-
*
|
|
916
|
-
* @param {number} w
|
|
917
|
-
* width of the triangle
|
|
918
|
-
*
|
|
919
|
-
* @param {number} h
|
|
920
|
-
* height of the triangle
|
|
921
|
-
*
|
|
922
|
-
* @return {Highcharts.SVGPathArray}
|
|
923
|
-
* Path array
|
|
924
|
-
*/
|
|
925
|
-
H.SVGRenderer.prototype.symbols['triangle-left-half'] = function (x, y, w, h) {
|
|
926
|
-
return H.SVGRenderer.prototype.symbols['triangle-left'](x, y, w / 2, h);
|
|
197
|
+
SVGRenderer.prototype.symbols['triangle-left-half'] = function (x, y, w, h) {
|
|
198
|
+
return SVGRenderer.prototype.symbols['triangle-left'](x, y, w / 2, h);
|
|
927
199
|
};
|
|
928
200
|
/**
|
|
929
201
|
* Alias function for triangle-left-half.
|
|
@@ -946,11 +218,10 @@
|
|
|
946
218
|
* @return {Highcharts.SVGPathArray}
|
|
947
219
|
* Path array
|
|
948
220
|
*/
|
|
949
|
-
|
|
950
|
-
H.SVGRenderer.prototype.symbols['triangle-left-half'];
|
|
221
|
+
SVGRenderer.prototype.symbols['arrow-filled-half'] = SVGRenderer.prototype.symbols['triangle-left-half'];
|
|
951
222
|
|
|
952
223
|
});
|
|
953
|
-
_registerModule(_modules, '
|
|
224
|
+
_registerModule(_modules, 'Gantt/Connection.js', [_modules['Core/Globals.js'], _modules['Core/Options.js'], _modules['Core/Series/Point.js'], _modules['Core/Utilities.js']], function (H, O, Point, U) {
|
|
954
225
|
/* *
|
|
955
226
|
*
|
|
956
227
|
* (c) 2016 Highsoft AS
|
|
@@ -984,6 +255,7 @@
|
|
|
984
255
|
* @typedef {"fastAvoid"|"simpleConnect"|"straight"|string} Highcharts.PathfinderTypeValue
|
|
985
256
|
*/
|
|
986
257
|
''; // detach doclets above
|
|
258
|
+
var defaultOptions = O.defaultOptions;
|
|
987
259
|
var addEvent = U.addEvent,
|
|
988
260
|
defined = U.defined,
|
|
989
261
|
error = U.error,
|
|
@@ -1002,7 +274,7 @@
|
|
|
1002
274
|
and rendering it
|
|
1003
275
|
*/
|
|
1004
276
|
// Set default Pathfinder options
|
|
1005
|
-
extend(
|
|
277
|
+
extend(defaultOptions, {
|
|
1006
278
|
/**
|
|
1007
279
|
* The Pathfinder module allows you to define connections between any two
|
|
1008
280
|
* points, represented as lines - optionally with markers for the start
|
|
@@ -1361,10 +633,20 @@
|
|
|
1361
633
|
* @param {Highcharts.ConnectorsOptions} [options]
|
|
1362
634
|
* Connection options.
|
|
1363
635
|
*/
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
636
|
+
var Connection = /** @class */ (function () {
|
|
637
|
+
function Connection(from, to, options) {
|
|
638
|
+
/* *
|
|
639
|
+
*
|
|
640
|
+
* Properties
|
|
641
|
+
*
|
|
642
|
+
* */
|
|
643
|
+
this.chart = void 0;
|
|
644
|
+
this.fromPoint = void 0;
|
|
645
|
+
this.graphics = void 0;
|
|
646
|
+
this.pathfinder = void 0;
|
|
647
|
+
this.toPoint = void 0;
|
|
648
|
+
this.init(from, to, options);
|
|
649
|
+
}
|
|
1368
650
|
/**
|
|
1369
651
|
* Initialize the Connection object. Used as constructor only.
|
|
1370
652
|
*
|
|
@@ -1379,13 +661,13 @@
|
|
|
1379
661
|
* @param {Highcharts.ConnectorsOptions} [options]
|
|
1380
662
|
* Connection options.
|
|
1381
663
|
*/
|
|
1382
|
-
init
|
|
664
|
+
Connection.prototype.init = function (from, to, options) {
|
|
1383
665
|
this.fromPoint = from;
|
|
1384
666
|
this.toPoint = to;
|
|
1385
667
|
this.options = options;
|
|
1386
668
|
this.chart = from.series.chart;
|
|
1387
669
|
this.pathfinder = this.chart.pathfinder;
|
|
1388
|
-
}
|
|
670
|
+
};
|
|
1389
671
|
/**
|
|
1390
672
|
* Add (or update) this connection's path on chart. Stores reference to the
|
|
1391
673
|
* created element on this.graphics.path.
|
|
@@ -1398,10 +680,10 @@
|
|
|
1398
680
|
* @param {Highcharts.SVGAttributes} [attribs]
|
|
1399
681
|
* SVG attributes for the path.
|
|
1400
682
|
*
|
|
1401
|
-
* @param {Highcharts.AnimationOptionsObject} [animation]
|
|
683
|
+
* @param {Partial<Highcharts.AnimationOptionsObject>} [animation]
|
|
1402
684
|
* Animation options for the rendering.
|
|
1403
685
|
*/
|
|
1404
|
-
renderPath
|
|
686
|
+
Connection.prototype.renderPath = function (path, attribs, animation) {
|
|
1405
687
|
var connection = this,
|
|
1406
688
|
chart = this.chart,
|
|
1407
689
|
styledMode = chart.styledMode,
|
|
@@ -1440,7 +722,7 @@
|
|
|
1440
722
|
// Store reference on connection
|
|
1441
723
|
this.graphics = this.graphics || {};
|
|
1442
724
|
this.graphics.path = pathGraphic;
|
|
1443
|
-
}
|
|
725
|
+
};
|
|
1444
726
|
/**
|
|
1445
727
|
* Calculate and add marker graphics for connection to the chart. The
|
|
1446
728
|
* created/updated elements are stored on this.graphics.start and
|
|
@@ -1459,7 +741,7 @@
|
|
|
1459
741
|
* Connection path in array format. This is used to calculate the
|
|
1460
742
|
* rotation angle of the markers.
|
|
1461
743
|
*/
|
|
1462
|
-
addMarker
|
|
744
|
+
Connection.prototype.addMarker = function (type, options, path) {
|
|
1463
745
|
var connection = this,
|
|
1464
746
|
chart = connection.fromPoint.series.chart,
|
|
1465
747
|
pathfinder = chart.pathfinder,
|
|
@@ -1542,7 +824,7 @@
|
|
|
1542
824
|
connection.graphics[type].animate(box);
|
|
1543
825
|
}
|
|
1544
826
|
}
|
|
1545
|
-
}
|
|
827
|
+
};
|
|
1546
828
|
/**
|
|
1547
829
|
* Calculate and return connection path.
|
|
1548
830
|
* Note: Recalculates chart obstacles on demand if they aren't calculated.
|
|
@@ -1555,114 +837,1418 @@
|
|
|
1555
837
|
* @return {object|undefined}
|
|
1556
838
|
* Calculated SVG path data in array format.
|
|
1557
839
|
*/
|
|
1558
|
-
getPath
|
|
840
|
+
Connection.prototype.getPath = function (options) {
|
|
1559
841
|
var pathfinder = this.pathfinder,
|
|
1560
842
|
chart = this.chart,
|
|
1561
843
|
algorithm = pathfinder.algorithms[options.type],
|
|
1562
844
|
chartObstacles = pathfinder.chartObstacles;
|
|
1563
845
|
if (typeof algorithm !== 'function') {
|
|
1564
846
|
error('"' + options.type + '" is not a Pathfinder algorithm.');
|
|
1565
|
-
return
|
|
847
|
+
return {
|
|
848
|
+
path: [],
|
|
849
|
+
obstacles: []
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
// This function calculates obstacles on demand if they don't exist
|
|
853
|
+
if (algorithm.requiresObstacles && !chartObstacles) {
|
|
854
|
+
chartObstacles =
|
|
855
|
+
pathfinder.chartObstacles =
|
|
856
|
+
pathfinder.getChartObstacles(options);
|
|
857
|
+
// If the algorithmMargin was computed, store the result in default
|
|
858
|
+
// options.
|
|
859
|
+
chart.options.connectors.algorithmMargin =
|
|
860
|
+
options.algorithmMargin;
|
|
861
|
+
// Cache some metrics too
|
|
862
|
+
pathfinder.chartObstacleMetrics =
|
|
863
|
+
pathfinder.getObstacleMetrics(chartObstacles);
|
|
864
|
+
}
|
|
865
|
+
// Get the SVG path
|
|
866
|
+
return algorithm(
|
|
867
|
+
// From
|
|
868
|
+
this.fromPoint.getPathfinderAnchorPoint(options.startMarker),
|
|
869
|
+
// To
|
|
870
|
+
this.toPoint.getPathfinderAnchorPoint(options.endMarker), merge({
|
|
871
|
+
chartObstacles: chartObstacles,
|
|
872
|
+
lineObstacles: pathfinder.lineObstacles || [],
|
|
873
|
+
obstacleMetrics: pathfinder.chartObstacleMetrics,
|
|
874
|
+
hardBounds: {
|
|
875
|
+
xMin: 0,
|
|
876
|
+
xMax: chart.plotWidth,
|
|
877
|
+
yMin: 0,
|
|
878
|
+
yMax: chart.plotHeight
|
|
879
|
+
},
|
|
880
|
+
obstacleOptions: {
|
|
881
|
+
margin: options.algorithmMargin
|
|
882
|
+
},
|
|
883
|
+
startDirectionX: pathfinder.getAlgorithmStartDirection(options.startMarker)
|
|
884
|
+
}, options));
|
|
885
|
+
};
|
|
886
|
+
/**
|
|
887
|
+
* (re)Calculate and (re)draw the connection.
|
|
888
|
+
*
|
|
889
|
+
* @function Highcharts.Connection#render
|
|
890
|
+
*/
|
|
891
|
+
Connection.prototype.render = function () {
|
|
892
|
+
var connection = this,
|
|
893
|
+
fromPoint = connection.fromPoint,
|
|
894
|
+
series = fromPoint.series,
|
|
895
|
+
chart = series.chart,
|
|
896
|
+
pathfinder = chart.pathfinder,
|
|
897
|
+
pathResult,
|
|
898
|
+
path,
|
|
899
|
+
options = merge(chart.options.connectors,
|
|
900
|
+
series.options.connectors,
|
|
901
|
+
fromPoint.options.connectors,
|
|
902
|
+
connection.options),
|
|
903
|
+
attribs = {};
|
|
904
|
+
// Set path attribs
|
|
905
|
+
if (!chart.styledMode) {
|
|
906
|
+
attribs.stroke = options.lineColor || fromPoint.color;
|
|
907
|
+
attribs['stroke-width'] = options.lineWidth;
|
|
908
|
+
if (options.dashStyle) {
|
|
909
|
+
attribs.dashstyle = options.dashStyle;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
attribs['class'] = // eslint-disable-line dot-notation
|
|
913
|
+
'highcharts-point-connecting-path ' +
|
|
914
|
+
'highcharts-color-' + fromPoint.colorIndex;
|
|
915
|
+
options = merge(attribs, options);
|
|
916
|
+
// Set common marker options
|
|
917
|
+
if (!defined(options.marker.radius)) {
|
|
918
|
+
options.marker.radius = min(max(Math.ceil((options.algorithmMargin || 8) / 2) - 1, 1), 5);
|
|
919
|
+
}
|
|
920
|
+
// Get the path
|
|
921
|
+
pathResult = connection.getPath(options);
|
|
922
|
+
path = pathResult.path;
|
|
923
|
+
// Always update obstacle storage with obstacles from this path.
|
|
924
|
+
// We don't know if future calls will need this for their algorithm.
|
|
925
|
+
if (pathResult.obstacles) {
|
|
926
|
+
pathfinder.lineObstacles =
|
|
927
|
+
pathfinder.lineObstacles || [];
|
|
928
|
+
pathfinder.lineObstacles =
|
|
929
|
+
pathfinder.lineObstacles.concat(pathResult.obstacles);
|
|
930
|
+
}
|
|
931
|
+
// Add the calculated path to the pathfinder group
|
|
932
|
+
connection.renderPath(path, attribs, series.options.animation);
|
|
933
|
+
// Render the markers
|
|
934
|
+
connection.addMarker('start', merge(options.marker, options.startMarker), path);
|
|
935
|
+
connection.addMarker('end', merge(options.marker, options.endMarker), path);
|
|
936
|
+
};
|
|
937
|
+
/**
|
|
938
|
+
* Destroy connection by destroying the added graphics elements.
|
|
939
|
+
*
|
|
940
|
+
* @function Highcharts.Connection#destroy
|
|
941
|
+
*/
|
|
942
|
+
Connection.prototype.destroy = function () {
|
|
943
|
+
if (this.graphics) {
|
|
944
|
+
objectEach(this.graphics, function (val) {
|
|
945
|
+
val.destroy();
|
|
946
|
+
});
|
|
947
|
+
delete this.graphics;
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
return Connection;
|
|
951
|
+
}());
|
|
952
|
+
// Add to Highcharts namespace
|
|
953
|
+
H.Connection = Connection;
|
|
954
|
+
// Add pathfinding capabilities to Points
|
|
955
|
+
extend(Point.prototype, /** @lends Point.prototype */ {
|
|
956
|
+
/**
|
|
957
|
+
* Get coordinates of anchor point for pathfinder connection.
|
|
958
|
+
*
|
|
959
|
+
* @private
|
|
960
|
+
* @function Highcharts.Point#getPathfinderAnchorPoint
|
|
961
|
+
*
|
|
962
|
+
* @param {Highcharts.ConnectorsMarkerOptions} markerOptions
|
|
963
|
+
* Connection options for position on point.
|
|
964
|
+
*
|
|
965
|
+
* @return {Highcharts.PositionObject}
|
|
966
|
+
* An object with x/y properties for the position. Coordinates are
|
|
967
|
+
* in plot values, not relative to point.
|
|
968
|
+
*/
|
|
969
|
+
getPathfinderAnchorPoint: function (markerOptions) {
|
|
970
|
+
var bb = getPointBB(this),
|
|
971
|
+
x,
|
|
972
|
+
y;
|
|
973
|
+
switch (markerOptions.align) { // eslint-disable-line default-case
|
|
974
|
+
case 'right':
|
|
975
|
+
x = 'xMax';
|
|
976
|
+
break;
|
|
977
|
+
case 'left':
|
|
978
|
+
x = 'xMin';
|
|
979
|
+
}
|
|
980
|
+
switch (markerOptions.verticalAlign) { // eslint-disable-line default-case
|
|
981
|
+
case 'top':
|
|
982
|
+
y = 'yMin';
|
|
983
|
+
break;
|
|
984
|
+
case 'bottom':
|
|
985
|
+
y = 'yMax';
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
x: x ? bb[x] : (bb.xMin + bb.xMax) / 2,
|
|
989
|
+
y: y ? bb[y] : (bb.yMin + bb.yMax) / 2
|
|
990
|
+
};
|
|
991
|
+
},
|
|
992
|
+
/**
|
|
993
|
+
* Utility to get the angle from one point to another.
|
|
994
|
+
*
|
|
995
|
+
* @private
|
|
996
|
+
* @function Highcharts.Point#getRadiansToVector
|
|
997
|
+
*
|
|
998
|
+
* @param {Highcharts.PositionObject} v1
|
|
999
|
+
* The first vector, as an object with x/y properties.
|
|
1000
|
+
*
|
|
1001
|
+
* @param {Highcharts.PositionObject} v2
|
|
1002
|
+
* The second vector, as an object with x/y properties.
|
|
1003
|
+
*
|
|
1004
|
+
* @return {number}
|
|
1005
|
+
* The angle in degrees
|
|
1006
|
+
*/
|
|
1007
|
+
getRadiansToVector: function (v1, v2) {
|
|
1008
|
+
var box;
|
|
1009
|
+
if (!defined(v2)) {
|
|
1010
|
+
box = getPointBB(this);
|
|
1011
|
+
if (box) {
|
|
1012
|
+
v2 = {
|
|
1013
|
+
x: (box.xMin + box.xMax) / 2,
|
|
1014
|
+
y: (box.yMin + box.yMax) / 2
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
return Math.atan2(v2.y - v1.y, v1.x - v2.x);
|
|
1019
|
+
},
|
|
1020
|
+
/**
|
|
1021
|
+
* Utility to get the position of the marker, based on the path angle and
|
|
1022
|
+
* the marker's radius.
|
|
1023
|
+
*
|
|
1024
|
+
* @private
|
|
1025
|
+
* @function Highcharts.Point#getMarkerVector
|
|
1026
|
+
*
|
|
1027
|
+
* @param {number} radians
|
|
1028
|
+
* The angle in radians from the point center to another vector.
|
|
1029
|
+
*
|
|
1030
|
+
* @param {number} markerRadius
|
|
1031
|
+
* The radius of the marker, to calculate the additional distance to
|
|
1032
|
+
* the center of the marker.
|
|
1033
|
+
*
|
|
1034
|
+
* @param {object} anchor
|
|
1035
|
+
* The anchor point of the path and marker as an object with x/y
|
|
1036
|
+
* properties.
|
|
1037
|
+
*
|
|
1038
|
+
* @return {object}
|
|
1039
|
+
* The marker vector as an object with x/y properties.
|
|
1040
|
+
*/
|
|
1041
|
+
getMarkerVector: function (radians, markerRadius, anchor) {
|
|
1042
|
+
var twoPI = Math.PI * 2.0,
|
|
1043
|
+
theta = radians,
|
|
1044
|
+
bb = getPointBB(this),
|
|
1045
|
+
rectWidth = bb.xMax - bb.xMin,
|
|
1046
|
+
rectHeight = bb.yMax - bb.yMin,
|
|
1047
|
+
rAtan = Math.atan2(rectHeight,
|
|
1048
|
+
rectWidth),
|
|
1049
|
+
tanTheta = 1,
|
|
1050
|
+
leftOrRightRegion = false,
|
|
1051
|
+
rectHalfWidth = rectWidth / 2.0,
|
|
1052
|
+
rectHalfHeight = rectHeight / 2.0,
|
|
1053
|
+
rectHorizontalCenter = bb.xMin + rectHalfWidth,
|
|
1054
|
+
rectVerticalCenter = bb.yMin + rectHalfHeight,
|
|
1055
|
+
edgePoint = {
|
|
1056
|
+
x: rectHorizontalCenter,
|
|
1057
|
+
y: rectVerticalCenter
|
|
1058
|
+
},
|
|
1059
|
+
markerPoint = {},
|
|
1060
|
+
xFactor = 1,
|
|
1061
|
+
yFactor = 1;
|
|
1062
|
+
while (theta < -Math.PI) {
|
|
1063
|
+
theta += twoPI;
|
|
1064
|
+
}
|
|
1065
|
+
while (theta > Math.PI) {
|
|
1066
|
+
theta -= twoPI;
|
|
1067
|
+
}
|
|
1068
|
+
tanTheta = Math.tan(theta);
|
|
1069
|
+
if ((theta > -rAtan) && (theta <= rAtan)) {
|
|
1070
|
+
// Right side
|
|
1071
|
+
yFactor = -1;
|
|
1072
|
+
leftOrRightRegion = true;
|
|
1073
|
+
}
|
|
1074
|
+
else if (theta > rAtan && theta <= (Math.PI - rAtan)) {
|
|
1075
|
+
// Top side
|
|
1076
|
+
yFactor = -1;
|
|
1077
|
+
}
|
|
1078
|
+
else if (theta > (Math.PI - rAtan) || theta <= -(Math.PI - rAtan)) {
|
|
1079
|
+
// Left side
|
|
1080
|
+
xFactor = -1;
|
|
1081
|
+
leftOrRightRegion = true;
|
|
1082
|
+
}
|
|
1083
|
+
else {
|
|
1084
|
+
// Bottom side
|
|
1085
|
+
xFactor = -1;
|
|
1086
|
+
}
|
|
1087
|
+
// Correct the edgePoint according to the placement of the marker
|
|
1088
|
+
if (leftOrRightRegion) {
|
|
1089
|
+
edgePoint.x += xFactor * (rectHalfWidth);
|
|
1090
|
+
edgePoint.y += yFactor * (rectHalfWidth) * tanTheta;
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
edgePoint.x += xFactor * (rectHeight / (2.0 * tanTheta));
|
|
1094
|
+
edgePoint.y += yFactor * (rectHalfHeight);
|
|
1095
|
+
}
|
|
1096
|
+
if (anchor.x !== rectHorizontalCenter) {
|
|
1097
|
+
edgePoint.x = anchor.x;
|
|
1098
|
+
}
|
|
1099
|
+
if (anchor.y !== rectVerticalCenter) {
|
|
1100
|
+
edgePoint.y = anchor.y;
|
|
1101
|
+
}
|
|
1102
|
+
markerPoint.x = edgePoint.x + (markerRadius * Math.cos(theta));
|
|
1103
|
+
markerPoint.y = edgePoint.y - (markerRadius * Math.sin(theta));
|
|
1104
|
+
return markerPoint;
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
/**
|
|
1108
|
+
* Warn if using legacy options. Copy the options over. Note that this will
|
|
1109
|
+
* still break if using the legacy options in chart.update, addSeries etc.
|
|
1110
|
+
* @private
|
|
1111
|
+
*/
|
|
1112
|
+
function warnLegacy(chart) {
|
|
1113
|
+
if (chart.options.pathfinder ||
|
|
1114
|
+
chart.series.reduce(function (acc, series) {
|
|
1115
|
+
if (series.options) {
|
|
1116
|
+
merge(true, (series.options.connectors = series.options.connectors ||
|
|
1117
|
+
{}), series.options.pathfinder);
|
|
1118
|
+
}
|
|
1119
|
+
return acc || series.options && series.options.pathfinder;
|
|
1120
|
+
}, false)) {
|
|
1121
|
+
merge(true, (chart.options.connectors = chart.options.connectors || {}), chart.options.pathfinder);
|
|
1122
|
+
error('WARNING: Pathfinder options have been renamed. ' +
|
|
1123
|
+
'Use "chart.connectors" or "series.connectors" instead.');
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
return Connection;
|
|
1128
|
+
});
|
|
1129
|
+
_registerModule(_modules, 'Gantt/PathfinderAlgorithms.js', [_modules['Core/Utilities.js']], function (U) {
|
|
1130
|
+
/* *
|
|
1131
|
+
*
|
|
1132
|
+
* (c) 2016 Highsoft AS
|
|
1133
|
+
* Author: Øystein Moseng
|
|
1134
|
+
*
|
|
1135
|
+
* License: www.highcharts.com/license
|
|
1136
|
+
*
|
|
1137
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
1138
|
+
*
|
|
1139
|
+
* */
|
|
1140
|
+
var extend = U.extend,
|
|
1141
|
+
pick = U.pick;
|
|
1142
|
+
var min = Math.min,
|
|
1143
|
+
max = Math.max,
|
|
1144
|
+
abs = Math.abs;
|
|
1145
|
+
/**
|
|
1146
|
+
* Get index of last obstacle before xMin. Employs a type of binary search, and
|
|
1147
|
+
* thus requires that obstacles are sorted by xMin value.
|
|
1148
|
+
*
|
|
1149
|
+
* @private
|
|
1150
|
+
* @function findLastObstacleBefore
|
|
1151
|
+
*
|
|
1152
|
+
* @param {Array<object>} obstacles
|
|
1153
|
+
* Array of obstacles to search in.
|
|
1154
|
+
*
|
|
1155
|
+
* @param {number} xMin
|
|
1156
|
+
* The xMin threshold.
|
|
1157
|
+
*
|
|
1158
|
+
* @param {number} [startIx]
|
|
1159
|
+
* Starting index to search from. Must be within array range.
|
|
1160
|
+
*
|
|
1161
|
+
* @return {number}
|
|
1162
|
+
* The index of the last obstacle element before xMin.
|
|
1163
|
+
*/
|
|
1164
|
+
function findLastObstacleBefore(obstacles, xMin, startIx) {
|
|
1165
|
+
var left = startIx || 0, // left limit
|
|
1166
|
+
right = obstacles.length - 1, // right limit
|
|
1167
|
+
min = xMin - 0.0000001, // Make sure we include all obstacles at xMin
|
|
1168
|
+
cursor,
|
|
1169
|
+
cmp;
|
|
1170
|
+
while (left <= right) {
|
|
1171
|
+
cursor = (right + left) >> 1;
|
|
1172
|
+
cmp = min - obstacles[cursor].xMin;
|
|
1173
|
+
if (cmp > 0) {
|
|
1174
|
+
left = cursor + 1;
|
|
1175
|
+
}
|
|
1176
|
+
else if (cmp < 0) {
|
|
1177
|
+
right = cursor - 1;
|
|
1178
|
+
}
|
|
1179
|
+
else {
|
|
1180
|
+
return cursor;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
return left > 0 ? left - 1 : 0;
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Test if a point lays within an obstacle.
|
|
1187
|
+
*
|
|
1188
|
+
* @private
|
|
1189
|
+
* @function pointWithinObstacle
|
|
1190
|
+
*
|
|
1191
|
+
* @param {object} obstacle
|
|
1192
|
+
* Obstacle to test.
|
|
1193
|
+
*
|
|
1194
|
+
* @param {Highcharts.Point} point
|
|
1195
|
+
* Point with x/y props.
|
|
1196
|
+
*
|
|
1197
|
+
* @return {boolean}
|
|
1198
|
+
* Whether point is within the obstacle or not.
|
|
1199
|
+
*/
|
|
1200
|
+
function pointWithinObstacle(obstacle, point) {
|
|
1201
|
+
return (point.x <= obstacle.xMax &&
|
|
1202
|
+
point.x >= obstacle.xMin &&
|
|
1203
|
+
point.y <= obstacle.yMax &&
|
|
1204
|
+
point.y >= obstacle.yMin);
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Find the index of an obstacle that wraps around a point.
|
|
1208
|
+
* Returns -1 if not found.
|
|
1209
|
+
*
|
|
1210
|
+
* @private
|
|
1211
|
+
* @function findObstacleFromPoint
|
|
1212
|
+
*
|
|
1213
|
+
* @param {Array<object>} obstacles
|
|
1214
|
+
* Obstacles to test.
|
|
1215
|
+
*
|
|
1216
|
+
* @param {Highcharts.Point} point
|
|
1217
|
+
* Point with x/y props.
|
|
1218
|
+
*
|
|
1219
|
+
* @return {number}
|
|
1220
|
+
* Ix of the obstacle in the array, or -1 if not found.
|
|
1221
|
+
*/
|
|
1222
|
+
function findObstacleFromPoint(obstacles, point) {
|
|
1223
|
+
var i = findLastObstacleBefore(obstacles,
|
|
1224
|
+
point.x + 1) + 1;
|
|
1225
|
+
while (i--) {
|
|
1226
|
+
if (obstacles[i].xMax >= point.x &&
|
|
1227
|
+
// optimization using lazy evaluation
|
|
1228
|
+
pointWithinObstacle(obstacles[i], point)) {
|
|
1229
|
+
return i;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
return -1;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Get SVG path array from array of line segments.
|
|
1236
|
+
*
|
|
1237
|
+
* @private
|
|
1238
|
+
* @function pathFromSegments
|
|
1239
|
+
*
|
|
1240
|
+
* @param {Array<object>} segments
|
|
1241
|
+
* The segments to build the path from.
|
|
1242
|
+
*
|
|
1243
|
+
* @return {Highcharts.SVGPathArray}
|
|
1244
|
+
* SVG path array as accepted by the SVG Renderer.
|
|
1245
|
+
*/
|
|
1246
|
+
function pathFromSegments(segments) {
|
|
1247
|
+
var path = [];
|
|
1248
|
+
if (segments.length) {
|
|
1249
|
+
path.push(['M', segments[0].start.x, segments[0].start.y]);
|
|
1250
|
+
for (var i = 0; i < segments.length; ++i) {
|
|
1251
|
+
path.push(['L', segments[i].end.x, segments[i].end.y]);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
return path;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Limits obstacle max/mins in all directions to bounds. Modifies input
|
|
1258
|
+
* obstacle.
|
|
1259
|
+
*
|
|
1260
|
+
* @private
|
|
1261
|
+
* @function limitObstacleToBounds
|
|
1262
|
+
*
|
|
1263
|
+
* @param {object} obstacle
|
|
1264
|
+
* Obstacle to limit.
|
|
1265
|
+
*
|
|
1266
|
+
* @param {object} bounds
|
|
1267
|
+
* Bounds to use as limit.
|
|
1268
|
+
*
|
|
1269
|
+
* @return {void}
|
|
1270
|
+
*/
|
|
1271
|
+
function limitObstacleToBounds(obstacle, bounds) {
|
|
1272
|
+
obstacle.yMin = max(obstacle.yMin, bounds.yMin);
|
|
1273
|
+
obstacle.yMax = min(obstacle.yMax, bounds.yMax);
|
|
1274
|
+
obstacle.xMin = max(obstacle.xMin, bounds.xMin);
|
|
1275
|
+
obstacle.xMax = min(obstacle.xMax, bounds.xMax);
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Get an SVG path from a starting coordinate to an ending coordinate.
|
|
1279
|
+
* Draws a straight line.
|
|
1280
|
+
*
|
|
1281
|
+
* @function Highcharts.Pathfinder.algorithms.straight
|
|
1282
|
+
*
|
|
1283
|
+
* @param {Highcharts.PositionObject} start
|
|
1284
|
+
* Starting coordinate, object with x/y props.
|
|
1285
|
+
*
|
|
1286
|
+
* @param {Highcharts.PositionObject} end
|
|
1287
|
+
* Ending coordinate, object with x/y props.
|
|
1288
|
+
*
|
|
1289
|
+
* @return {object}
|
|
1290
|
+
* An object with the SVG path in Array form as accepted by the SVG
|
|
1291
|
+
* renderer, as well as an array of new obstacles making up this
|
|
1292
|
+
* path.
|
|
1293
|
+
*/
|
|
1294
|
+
function straight(start, end) {
|
|
1295
|
+
return {
|
|
1296
|
+
path: [
|
|
1297
|
+
['M', start.x, start.y],
|
|
1298
|
+
['L', end.x, end.y]
|
|
1299
|
+
],
|
|
1300
|
+
obstacles: [{ start: start, end: end }]
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Find a path from a starting coordinate to an ending coordinate, using
|
|
1305
|
+
* right angles only, and taking only starting/ending obstacle into
|
|
1306
|
+
* consideration.
|
|
1307
|
+
*
|
|
1308
|
+
* @function Highcharts.Pathfinder.algorithms.simpleConnect
|
|
1309
|
+
*
|
|
1310
|
+
* @param {Highcharts.PositionObject} start
|
|
1311
|
+
* Starting coordinate, object with x/y props.
|
|
1312
|
+
*
|
|
1313
|
+
* @param {Highcharts.PositionObject} end
|
|
1314
|
+
* Ending coordinate, object with x/y props.
|
|
1315
|
+
*
|
|
1316
|
+
* @param {object} options
|
|
1317
|
+
* Options for the algorithm:
|
|
1318
|
+
* - chartObstacles: Array of chart obstacles to avoid
|
|
1319
|
+
* - startDirectionX: Optional. True if starting in the X direction.
|
|
1320
|
+
* If not provided, the algorithm starts in the direction that is
|
|
1321
|
+
* the furthest between start/end.
|
|
1322
|
+
*
|
|
1323
|
+
* @return {object}
|
|
1324
|
+
* An object with the SVG path in Array form as accepted by the SVG
|
|
1325
|
+
* renderer, as well as an array of new obstacles making up this
|
|
1326
|
+
* path.
|
|
1327
|
+
*/
|
|
1328
|
+
var simpleConnect = extend(function (start,
|
|
1329
|
+
end,
|
|
1330
|
+
options) {
|
|
1331
|
+
var segments = [],
|
|
1332
|
+
endSegment,
|
|
1333
|
+
dir = pick(options.startDirectionX,
|
|
1334
|
+
abs(end.x - start.x) > abs(end.y - start.y)) ? 'x' : 'y',
|
|
1335
|
+
chartObstacles = options.chartObstacles,
|
|
1336
|
+
startObstacleIx = findObstacleFromPoint(chartObstacles,
|
|
1337
|
+
start),
|
|
1338
|
+
endObstacleIx = findObstacleFromPoint(chartObstacles,
|
|
1339
|
+
end),
|
|
1340
|
+
startObstacle,
|
|
1341
|
+
endObstacle,
|
|
1342
|
+
prevWaypoint,
|
|
1343
|
+
waypoint,
|
|
1344
|
+
waypoint2,
|
|
1345
|
+
useMax,
|
|
1346
|
+
endPoint;
|
|
1347
|
+
// eslint-disable-next-line valid-jsdoc
|
|
1348
|
+
/**
|
|
1349
|
+
* Return a clone of a point with a property set from a target object,
|
|
1350
|
+
* optionally with an offset
|
|
1351
|
+
* @private
|
|
1352
|
+
*/
|
|
1353
|
+
function copyFromPoint(from, fromKey, to, toKey, offset) {
|
|
1354
|
+
var point = {
|
|
1355
|
+
x: from.x,
|
|
1356
|
+
y: from.y
|
|
1357
|
+
};
|
|
1358
|
+
point[fromKey] = to[toKey || fromKey] + (offset || 0);
|
|
1359
|
+
return point;
|
|
1360
|
+
}
|
|
1361
|
+
// eslint-disable-next-line valid-jsdoc
|
|
1362
|
+
/**
|
|
1363
|
+
* Return waypoint outside obstacle.
|
|
1364
|
+
* @private
|
|
1365
|
+
*/
|
|
1366
|
+
function getMeOut(obstacle, point, direction) {
|
|
1367
|
+
var useMax = abs(point[direction] - obstacle[direction + 'Min']) >
|
|
1368
|
+
abs(point[direction] - obstacle[direction + 'Max']);
|
|
1369
|
+
return copyFromPoint(point, direction, obstacle, direction + (useMax ? 'Max' : 'Min'), useMax ? 1 : -1);
|
|
1370
|
+
}
|
|
1371
|
+
// Pull out end point
|
|
1372
|
+
if (endObstacleIx > -1) {
|
|
1373
|
+
endObstacle = chartObstacles[endObstacleIx];
|
|
1374
|
+
waypoint = getMeOut(endObstacle, end, dir);
|
|
1375
|
+
endSegment = {
|
|
1376
|
+
start: waypoint,
|
|
1377
|
+
end: end
|
|
1378
|
+
};
|
|
1379
|
+
endPoint = waypoint;
|
|
1380
|
+
}
|
|
1381
|
+
else {
|
|
1382
|
+
endPoint = end;
|
|
1383
|
+
}
|
|
1384
|
+
// If an obstacle envelops the start point, add a segment to get out,
|
|
1385
|
+
// and around it.
|
|
1386
|
+
if (startObstacleIx > -1) {
|
|
1387
|
+
startObstacle = chartObstacles[startObstacleIx];
|
|
1388
|
+
waypoint = getMeOut(startObstacle, start, dir);
|
|
1389
|
+
segments.push({
|
|
1390
|
+
start: start,
|
|
1391
|
+
end: waypoint
|
|
1392
|
+
});
|
|
1393
|
+
// If we are going back again, switch direction to get around start
|
|
1394
|
+
// obstacle.
|
|
1395
|
+
if (
|
|
1396
|
+
// Going towards max from start:
|
|
1397
|
+
waypoint[dir] >= start[dir] ===
|
|
1398
|
+
// Going towards min to end:
|
|
1399
|
+
waypoint[dir] >= endPoint[dir]) {
|
|
1400
|
+
dir = dir === 'y' ? 'x' : 'y';
|
|
1401
|
+
useMax = start[dir] < end[dir];
|
|
1402
|
+
segments.push({
|
|
1403
|
+
start: waypoint,
|
|
1404
|
+
end: copyFromPoint(waypoint, dir, startObstacle, dir + (useMax ? 'Max' : 'Min'), useMax ? 1 : -1)
|
|
1405
|
+
});
|
|
1406
|
+
// Switch direction again
|
|
1407
|
+
dir = dir === 'y' ? 'x' : 'y';
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
// We are around the start obstacle. Go towards the end in one
|
|
1411
|
+
// direction.
|
|
1412
|
+
prevWaypoint = segments.length ?
|
|
1413
|
+
segments[segments.length - 1].end :
|
|
1414
|
+
start;
|
|
1415
|
+
waypoint = copyFromPoint(prevWaypoint, dir, endPoint);
|
|
1416
|
+
segments.push({
|
|
1417
|
+
start: prevWaypoint,
|
|
1418
|
+
end: waypoint
|
|
1419
|
+
});
|
|
1420
|
+
// Final run to end point in the other direction
|
|
1421
|
+
dir = dir === 'y' ? 'x' : 'y';
|
|
1422
|
+
waypoint2 = copyFromPoint(waypoint, dir, endPoint);
|
|
1423
|
+
segments.push({
|
|
1424
|
+
start: waypoint,
|
|
1425
|
+
end: waypoint2
|
|
1426
|
+
});
|
|
1427
|
+
// Finally add the endSegment
|
|
1428
|
+
segments.push(endSegment);
|
|
1429
|
+
return {
|
|
1430
|
+
path: pathFromSegments(segments),
|
|
1431
|
+
obstacles: segments
|
|
1432
|
+
};
|
|
1433
|
+
}, {
|
|
1434
|
+
requiresObstacles: true
|
|
1435
|
+
});
|
|
1436
|
+
/**
|
|
1437
|
+
* Find a path from a starting coordinate to an ending coordinate, taking
|
|
1438
|
+
* obstacles into consideration. Might not always find the optimal path,
|
|
1439
|
+
* but is fast, and usually good enough.
|
|
1440
|
+
*
|
|
1441
|
+
* @function Highcharts.Pathfinder.algorithms.fastAvoid
|
|
1442
|
+
*
|
|
1443
|
+
* @param {Highcharts.PositionObject} start
|
|
1444
|
+
* Starting coordinate, object with x/y props.
|
|
1445
|
+
*
|
|
1446
|
+
* @param {Highcharts.PositionObject} end
|
|
1447
|
+
* Ending coordinate, object with x/y props.
|
|
1448
|
+
*
|
|
1449
|
+
* @param {object} options
|
|
1450
|
+
* Options for the algorithm.
|
|
1451
|
+
* - chartObstacles: Array of chart obstacles to avoid
|
|
1452
|
+
* - lineObstacles: Array of line obstacles to jump over
|
|
1453
|
+
* - obstacleMetrics: Object with metrics of chartObstacles cached
|
|
1454
|
+
* - hardBounds: Hard boundaries to not cross
|
|
1455
|
+
* - obstacleOptions: Options for the obstacles, including margin
|
|
1456
|
+
* - startDirectionX: Optional. True if starting in the X direction.
|
|
1457
|
+
* If not provided, the algorithm starts in the
|
|
1458
|
+
* direction that is the furthest between
|
|
1459
|
+
* start/end.
|
|
1460
|
+
*
|
|
1461
|
+
* @return {object}
|
|
1462
|
+
* An object with the SVG path in Array form as accepted by the SVG
|
|
1463
|
+
* renderer, as well as an array of new obstacles making up this
|
|
1464
|
+
* path.
|
|
1465
|
+
*/
|
|
1466
|
+
var fastAvoid = extend(function (start,
|
|
1467
|
+
end,
|
|
1468
|
+
options) {
|
|
1469
|
+
/*
|
|
1470
|
+
Algorithm rules/description
|
|
1471
|
+
- Find initial direction
|
|
1472
|
+
- Determine soft/hard max for each direction.
|
|
1473
|
+
- Move along initial direction until obstacle.
|
|
1474
|
+
- Change direction.
|
|
1475
|
+
- If hitting obstacle,
|
|
1476
|
+
first try to change length of previous line
|
|
1477
|
+
before changing direction again.
|
|
1478
|
+
|
|
1479
|
+
Soft min/max x = start/destination x +/- widest obstacle + margin
|
|
1480
|
+
Soft min/max y = start/destination y +/- tallest obstacle + margin
|
|
1481
|
+
|
|
1482
|
+
@todo:
|
|
1483
|
+
- Make retrospective,
|
|
1484
|
+
try changing prev segment to reduce
|
|
1485
|
+
corners
|
|
1486
|
+
- Fix logic for breaking out of end-points - not always picking
|
|
1487
|
+
the best direction currently
|
|
1488
|
+
- When going around the end obstacle we should not always go the
|
|
1489
|
+
shortest route,
|
|
1490
|
+
rather pick the one closer to the end point
|
|
1491
|
+
*/
|
|
1492
|
+
var dirIsX = pick(options.startDirectionX,
|
|
1493
|
+
abs(end.x - start.x) > abs(end.y - start.y)),
|
|
1494
|
+
dir = dirIsX ? 'x' : 'y',
|
|
1495
|
+
segments,
|
|
1496
|
+
useMax,
|
|
1497
|
+
extractedEndPoint,
|
|
1498
|
+
endSegments = [],
|
|
1499
|
+
forceObstacleBreak = false, // Used in clearPathTo to keep track of
|
|
1500
|
+
// when to force break through an obstacle.
|
|
1501
|
+
// Boundaries to stay within. If beyond soft boundary, prefer to
|
|
1502
|
+
// change direction ASAP. If at hard max, always change immediately.
|
|
1503
|
+
metrics = options.obstacleMetrics,
|
|
1504
|
+
softMinX = min(start.x,
|
|
1505
|
+
end.x) - metrics.maxWidth - 10,
|
|
1506
|
+
softMaxX = max(start.x,
|
|
1507
|
+
end.x) + metrics.maxWidth + 10,
|
|
1508
|
+
softMinY = min(start.y,
|
|
1509
|
+
end.y) - metrics.maxHeight - 10,
|
|
1510
|
+
softMaxY = max(start.y,
|
|
1511
|
+
end.y) + metrics.maxHeight + 10,
|
|
1512
|
+
// Obstacles
|
|
1513
|
+
chartObstacles = options.chartObstacles,
|
|
1514
|
+
startObstacleIx = findLastObstacleBefore(chartObstacles,
|
|
1515
|
+
softMinX),
|
|
1516
|
+
endObstacleIx = findLastObstacleBefore(chartObstacles,
|
|
1517
|
+
softMaxX);
|
|
1518
|
+
// eslint-disable-next-line valid-jsdoc
|
|
1519
|
+
/**
|
|
1520
|
+
* How far can you go between two points before hitting an obstacle?
|
|
1521
|
+
* Does not work for diagonal lines (because it doesn't have to).
|
|
1522
|
+
* @private
|
|
1523
|
+
*/
|
|
1524
|
+
function pivotPoint(fromPoint, toPoint, directionIsX) {
|
|
1525
|
+
var firstPoint,
|
|
1526
|
+
lastPoint,
|
|
1527
|
+
highestPoint,
|
|
1528
|
+
lowestPoint,
|
|
1529
|
+
i,
|
|
1530
|
+
searchDirection = fromPoint.x < toPoint.x ? 1 : -1;
|
|
1531
|
+
if (fromPoint.x < toPoint.x) {
|
|
1532
|
+
firstPoint = fromPoint;
|
|
1533
|
+
lastPoint = toPoint;
|
|
1534
|
+
}
|
|
1535
|
+
else {
|
|
1536
|
+
firstPoint = toPoint;
|
|
1537
|
+
lastPoint = fromPoint;
|
|
1538
|
+
}
|
|
1539
|
+
if (fromPoint.y < toPoint.y) {
|
|
1540
|
+
lowestPoint = fromPoint;
|
|
1541
|
+
highestPoint = toPoint;
|
|
1542
|
+
}
|
|
1543
|
+
else {
|
|
1544
|
+
lowestPoint = toPoint;
|
|
1545
|
+
highestPoint = fromPoint;
|
|
1546
|
+
}
|
|
1547
|
+
// Go through obstacle range in reverse if toPoint is before
|
|
1548
|
+
// fromPoint in the X-dimension.
|
|
1549
|
+
i = searchDirection < 0 ?
|
|
1550
|
+
// Searching backwards, start at last obstacle before last point
|
|
1551
|
+
min(findLastObstacleBefore(chartObstacles, lastPoint.x), chartObstacles.length - 1) :
|
|
1552
|
+
// Forwards. Since we're not sorted by xMax, we have to look
|
|
1553
|
+
// at all obstacles.
|
|
1554
|
+
0;
|
|
1555
|
+
// Go through obstacles in this X range
|
|
1556
|
+
while (chartObstacles[i] && (searchDirection > 0 && chartObstacles[i].xMin <= lastPoint.x ||
|
|
1557
|
+
searchDirection < 0 && chartObstacles[i].xMax >= firstPoint.x)) {
|
|
1558
|
+
// If this obstacle is between from and to points in a straight
|
|
1559
|
+
// line, pivot at the intersection.
|
|
1560
|
+
if (chartObstacles[i].xMin <= lastPoint.x &&
|
|
1561
|
+
chartObstacles[i].xMax >= firstPoint.x &&
|
|
1562
|
+
chartObstacles[i].yMin <= highestPoint.y &&
|
|
1563
|
+
chartObstacles[i].yMax >= lowestPoint.y) {
|
|
1564
|
+
if (directionIsX) {
|
|
1565
|
+
return {
|
|
1566
|
+
y: fromPoint.y,
|
|
1567
|
+
x: fromPoint.x < toPoint.x ?
|
|
1568
|
+
chartObstacles[i].xMin - 1 :
|
|
1569
|
+
chartObstacles[i].xMax + 1,
|
|
1570
|
+
obstacle: chartObstacles[i]
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
// else ...
|
|
1574
|
+
return {
|
|
1575
|
+
x: fromPoint.x,
|
|
1576
|
+
y: fromPoint.y < toPoint.y ?
|
|
1577
|
+
chartObstacles[i].yMin - 1 :
|
|
1578
|
+
chartObstacles[i].yMax + 1,
|
|
1579
|
+
obstacle: chartObstacles[i]
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
i += searchDirection;
|
|
1583
|
+
}
|
|
1584
|
+
return toPoint;
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Decide in which direction to dodge or get out of an obstacle.
|
|
1588
|
+
* Considers desired direction, which way is shortest, soft and hard
|
|
1589
|
+
* bounds.
|
|
1590
|
+
*
|
|
1591
|
+
* (? Returns a string, either xMin, xMax, yMin or yMax.)
|
|
1592
|
+
*
|
|
1593
|
+
* @private
|
|
1594
|
+
* @function
|
|
1595
|
+
*
|
|
1596
|
+
* @param {object} obstacle
|
|
1597
|
+
* Obstacle to dodge/escape.
|
|
1598
|
+
*
|
|
1599
|
+
* @param {object} fromPoint
|
|
1600
|
+
* Point with x/y props that's dodging/escaping.
|
|
1601
|
+
*
|
|
1602
|
+
* @param {object} toPoint
|
|
1603
|
+
* Goal point.
|
|
1604
|
+
*
|
|
1605
|
+
* @param {boolean} dirIsX
|
|
1606
|
+
* Dodge in X dimension.
|
|
1607
|
+
*
|
|
1608
|
+
* @param {object} bounds
|
|
1609
|
+
* Hard and soft boundaries.
|
|
1610
|
+
*
|
|
1611
|
+
* @return {boolean}
|
|
1612
|
+
* Use max or not.
|
|
1613
|
+
*/
|
|
1614
|
+
function getDodgeDirection(obstacle, fromPoint, toPoint, dirIsX, bounds) {
|
|
1615
|
+
var softBounds = bounds.soft, hardBounds = bounds.hard, dir = dirIsX ? 'x' : 'y', toPointMax = { x: fromPoint.x, y: fromPoint.y }, toPointMin = { x: fromPoint.x, y: fromPoint.y }, minPivot, maxPivot, maxOutOfSoftBounds = obstacle[dir + 'Max'] >=
|
|
1616
|
+
softBounds[dir + 'Max'], minOutOfSoftBounds = obstacle[dir + 'Min'] <=
|
|
1617
|
+
softBounds[dir + 'Min'], maxOutOfHardBounds = obstacle[dir + 'Max'] >=
|
|
1618
|
+
hardBounds[dir + 'Max'], minOutOfHardBounds = obstacle[dir + 'Min'] <=
|
|
1619
|
+
hardBounds[dir + 'Min'],
|
|
1620
|
+
// Find out if we should prefer one direction over the other if
|
|
1621
|
+
// we can choose freely
|
|
1622
|
+
minDistance = abs(obstacle[dir + 'Min'] - fromPoint[dir]), maxDistance = abs(obstacle[dir + 'Max'] - fromPoint[dir]),
|
|
1623
|
+
// If it's a small difference, pick the one leading towards dest
|
|
1624
|
+
// point. Otherwise pick the shortest distance
|
|
1625
|
+
useMax = abs(minDistance - maxDistance) < 10 ?
|
|
1626
|
+
fromPoint[dir] < toPoint[dir] :
|
|
1627
|
+
maxDistance < minDistance;
|
|
1628
|
+
// Check if we hit any obstacles trying to go around in either
|
|
1629
|
+
// direction.
|
|
1630
|
+
toPointMin[dir] = obstacle[dir + 'Min'];
|
|
1631
|
+
toPointMax[dir] = obstacle[dir + 'Max'];
|
|
1632
|
+
minPivot = pivotPoint(fromPoint, toPointMin, dirIsX)[dir] !==
|
|
1633
|
+
toPointMin[dir];
|
|
1634
|
+
maxPivot = pivotPoint(fromPoint, toPointMax, dirIsX)[dir] !==
|
|
1635
|
+
toPointMax[dir];
|
|
1636
|
+
useMax = minPivot ?
|
|
1637
|
+
(maxPivot ? useMax : true) :
|
|
1638
|
+
(maxPivot ? false : useMax);
|
|
1639
|
+
// useMax now contains our preferred choice, bounds not taken into
|
|
1640
|
+
// account. If both or neither direction is out of bounds we want to
|
|
1641
|
+
// use this.
|
|
1642
|
+
// Deal with soft bounds
|
|
1643
|
+
useMax = minOutOfSoftBounds ?
|
|
1644
|
+
(maxOutOfSoftBounds ? useMax : true) : // Out on min
|
|
1645
|
+
(maxOutOfSoftBounds ? false : useMax); // Not out on min
|
|
1646
|
+
// Deal with hard bounds
|
|
1647
|
+
useMax = minOutOfHardBounds ?
|
|
1648
|
+
(maxOutOfHardBounds ? useMax : true) : // Out on min
|
|
1649
|
+
(maxOutOfHardBounds ? false : useMax); // Not out on min
|
|
1650
|
+
return useMax;
|
|
1651
|
+
}
|
|
1652
|
+
// eslint-disable-next-line valid-jsdoc
|
|
1653
|
+
/**
|
|
1654
|
+
* Find a clear path between point.
|
|
1655
|
+
* @private
|
|
1656
|
+
*/
|
|
1657
|
+
function clearPathTo(fromPoint, toPoint, dirIsX) {
|
|
1658
|
+
// Don't waste time if we've hit goal
|
|
1659
|
+
if (fromPoint.x === toPoint.x && fromPoint.y === toPoint.y) {
|
|
1660
|
+
return [];
|
|
1661
|
+
}
|
|
1662
|
+
var dir = dirIsX ? 'x' : 'y',
|
|
1663
|
+
pivot,
|
|
1664
|
+
segments,
|
|
1665
|
+
waypoint,
|
|
1666
|
+
waypointUseMax,
|
|
1667
|
+
envelopingObstacle,
|
|
1668
|
+
secondEnvelopingObstacle,
|
|
1669
|
+
envelopWaypoint,
|
|
1670
|
+
obstacleMargin = options.obstacleOptions.margin,
|
|
1671
|
+
bounds = {
|
|
1672
|
+
soft: {
|
|
1673
|
+
xMin: softMinX,
|
|
1674
|
+
xMax: softMaxX,
|
|
1675
|
+
yMin: softMinY,
|
|
1676
|
+
yMax: softMaxY
|
|
1677
|
+
},
|
|
1678
|
+
hard: options.hardBounds
|
|
1679
|
+
};
|
|
1680
|
+
// If fromPoint is inside an obstacle we have a problem. Break out
|
|
1681
|
+
// by just going to the outside of this obstacle. We prefer to go to
|
|
1682
|
+
// the nearest edge in the chosen direction.
|
|
1683
|
+
envelopingObstacle =
|
|
1684
|
+
findObstacleFromPoint(chartObstacles, fromPoint);
|
|
1685
|
+
if (envelopingObstacle > -1) {
|
|
1686
|
+
envelopingObstacle = chartObstacles[envelopingObstacle];
|
|
1687
|
+
waypointUseMax = getDodgeDirection(envelopingObstacle, fromPoint, toPoint, dirIsX, bounds);
|
|
1688
|
+
// Cut obstacle to hard bounds to make sure we stay within
|
|
1689
|
+
limitObstacleToBounds(envelopingObstacle, options.hardBounds);
|
|
1690
|
+
envelopWaypoint = dirIsX ? {
|
|
1691
|
+
y: fromPoint.y,
|
|
1692
|
+
x: envelopingObstacle[waypointUseMax ? 'xMax' : 'xMin'] +
|
|
1693
|
+
(waypointUseMax ? 1 : -1)
|
|
1694
|
+
} : {
|
|
1695
|
+
x: fromPoint.x,
|
|
1696
|
+
y: envelopingObstacle[waypointUseMax ? 'yMax' : 'yMin'] +
|
|
1697
|
+
(waypointUseMax ? 1 : -1)
|
|
1698
|
+
};
|
|
1699
|
+
// If we crashed into another obstacle doing this, we put the
|
|
1700
|
+
// waypoint between them instead
|
|
1701
|
+
secondEnvelopingObstacle = findObstacleFromPoint(chartObstacles, envelopWaypoint);
|
|
1702
|
+
if (secondEnvelopingObstacle > -1) {
|
|
1703
|
+
secondEnvelopingObstacle = chartObstacles[secondEnvelopingObstacle];
|
|
1704
|
+
// Cut obstacle to hard bounds
|
|
1705
|
+
limitObstacleToBounds(secondEnvelopingObstacle, options.hardBounds);
|
|
1706
|
+
// Modify waypoint to lay between obstacles
|
|
1707
|
+
envelopWaypoint[dir] = waypointUseMax ? max(envelopingObstacle[dir + 'Max'] - obstacleMargin + 1, (secondEnvelopingObstacle[dir + 'Min'] +
|
|
1708
|
+
envelopingObstacle[dir + 'Max']) / 2) :
|
|
1709
|
+
min((envelopingObstacle[dir + 'Min'] + obstacleMargin - 1), ((secondEnvelopingObstacle[dir + 'Max'] +
|
|
1710
|
+
envelopingObstacle[dir + 'Min']) / 2));
|
|
1711
|
+
// We are not going anywhere. If this happens for the first
|
|
1712
|
+
// time, do nothing. Otherwise, try to go to the extreme of
|
|
1713
|
+
// the obstacle pair in the current direction.
|
|
1714
|
+
if (fromPoint.x === envelopWaypoint.x &&
|
|
1715
|
+
fromPoint.y === envelopWaypoint.y) {
|
|
1716
|
+
if (forceObstacleBreak) {
|
|
1717
|
+
envelopWaypoint[dir] = waypointUseMax ?
|
|
1718
|
+
max(envelopingObstacle[dir + 'Max'], secondEnvelopingObstacle[dir + 'Max']) + 1 :
|
|
1719
|
+
min(envelopingObstacle[dir + 'Min'], secondEnvelopingObstacle[dir + 'Min']) - 1;
|
|
1720
|
+
}
|
|
1721
|
+
// Toggle on if off, and the opposite
|
|
1722
|
+
forceObstacleBreak = !forceObstacleBreak;
|
|
1723
|
+
}
|
|
1724
|
+
else {
|
|
1725
|
+
// This point is not identical to previous.
|
|
1726
|
+
// Clear break trigger.
|
|
1727
|
+
forceObstacleBreak = false;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
segments = [{
|
|
1731
|
+
start: fromPoint,
|
|
1732
|
+
end: envelopWaypoint
|
|
1733
|
+
}];
|
|
1734
|
+
}
|
|
1735
|
+
else { // If not enveloping, use standard pivot calculation
|
|
1736
|
+
pivot = pivotPoint(fromPoint, {
|
|
1737
|
+
x: dirIsX ? toPoint.x : fromPoint.x,
|
|
1738
|
+
y: dirIsX ? fromPoint.y : toPoint.y
|
|
1739
|
+
}, dirIsX);
|
|
1740
|
+
segments = [{
|
|
1741
|
+
start: fromPoint,
|
|
1742
|
+
end: {
|
|
1743
|
+
x: pivot.x,
|
|
1744
|
+
y: pivot.y
|
|
1745
|
+
}
|
|
1746
|
+
}];
|
|
1747
|
+
// Pivot before goal, use a waypoint to dodge obstacle
|
|
1748
|
+
if (pivot[dirIsX ? 'x' : 'y'] !== toPoint[dirIsX ? 'x' : 'y']) {
|
|
1749
|
+
// Find direction of waypoint
|
|
1750
|
+
waypointUseMax = getDodgeDirection(pivot.obstacle, pivot, toPoint, !dirIsX, bounds);
|
|
1751
|
+
// Cut waypoint to hard bounds
|
|
1752
|
+
limitObstacleToBounds(pivot.obstacle, options.hardBounds);
|
|
1753
|
+
waypoint = {
|
|
1754
|
+
x: dirIsX ?
|
|
1755
|
+
pivot.x :
|
|
1756
|
+
pivot.obstacle[waypointUseMax ? 'xMax' : 'xMin'] +
|
|
1757
|
+
(waypointUseMax ? 1 : -1),
|
|
1758
|
+
y: dirIsX ?
|
|
1759
|
+
pivot.obstacle[waypointUseMax ? 'yMax' : 'yMin'] +
|
|
1760
|
+
(waypointUseMax ? 1 : -1) :
|
|
1761
|
+
pivot.y
|
|
1762
|
+
};
|
|
1763
|
+
// We're changing direction here, store that to make sure we
|
|
1764
|
+
// also change direction when adding the last segment array
|
|
1765
|
+
// after handling waypoint.
|
|
1766
|
+
dirIsX = !dirIsX;
|
|
1767
|
+
segments = segments.concat(clearPathTo({
|
|
1768
|
+
x: pivot.x,
|
|
1769
|
+
y: pivot.y
|
|
1770
|
+
}, waypoint, dirIsX));
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
// Get segments for the other direction too
|
|
1774
|
+
// Recursion is our friend
|
|
1775
|
+
segments = segments.concat(clearPathTo(segments[segments.length - 1].end, toPoint, !dirIsX));
|
|
1776
|
+
return segments;
|
|
1777
|
+
}
|
|
1778
|
+
// eslint-disable-next-line valid-jsdoc
|
|
1779
|
+
/**
|
|
1780
|
+
* Extract point to outside of obstacle in whichever direction is
|
|
1781
|
+
* closest. Returns new point outside obstacle.
|
|
1782
|
+
* @private
|
|
1783
|
+
*/
|
|
1784
|
+
function extractFromObstacle(obstacle, point, goalPoint) {
|
|
1785
|
+
var dirIsX = min(obstacle.xMax - point.x,
|
|
1786
|
+
point.x - obstacle.xMin) <
|
|
1787
|
+
min(obstacle.yMax - point.y,
|
|
1788
|
+
point.y - obstacle.yMin),
|
|
1789
|
+
bounds = {
|
|
1790
|
+
soft: options.hardBounds,
|
|
1791
|
+
hard: options.hardBounds
|
|
1792
|
+
},
|
|
1793
|
+
useMax = getDodgeDirection(obstacle,
|
|
1794
|
+
point,
|
|
1795
|
+
goalPoint,
|
|
1796
|
+
dirIsX,
|
|
1797
|
+
bounds);
|
|
1798
|
+
return dirIsX ? {
|
|
1799
|
+
y: point.y,
|
|
1800
|
+
x: obstacle[useMax ? 'xMax' : 'xMin'] + (useMax ? 1 : -1)
|
|
1801
|
+
} : {
|
|
1802
|
+
x: point.x,
|
|
1803
|
+
y: obstacle[useMax ? 'yMax' : 'yMin'] + (useMax ? 1 : -1)
|
|
1804
|
+
};
|
|
1805
|
+
}
|
|
1806
|
+
// Cut the obstacle array to soft bounds for optimization in large
|
|
1807
|
+
// datasets.
|
|
1808
|
+
chartObstacles =
|
|
1809
|
+
chartObstacles.slice(startObstacleIx, endObstacleIx + 1);
|
|
1810
|
+
// If an obstacle envelops the end point, move it out of there and add
|
|
1811
|
+
// a little segment to where it was.
|
|
1812
|
+
if ((endObstacleIx = findObstacleFromPoint(chartObstacles, end)) > -1) {
|
|
1813
|
+
extractedEndPoint = extractFromObstacle(chartObstacles[endObstacleIx], end, start);
|
|
1814
|
+
endSegments.push({
|
|
1815
|
+
end: end,
|
|
1816
|
+
start: extractedEndPoint
|
|
1817
|
+
});
|
|
1818
|
+
end = extractedEndPoint;
|
|
1819
|
+
}
|
|
1820
|
+
// If it's still inside one or more obstacles, get out of there by
|
|
1821
|
+
// force-moving towards the start point.
|
|
1822
|
+
while ((endObstacleIx = findObstacleFromPoint(chartObstacles, end)) > -1) {
|
|
1823
|
+
useMax = end[dir] - start[dir] < 0;
|
|
1824
|
+
extractedEndPoint = {
|
|
1825
|
+
x: end.x,
|
|
1826
|
+
y: end.y
|
|
1827
|
+
};
|
|
1828
|
+
extractedEndPoint[dir] = chartObstacles[endObstacleIx][useMax ? dir + 'Max' : dir + 'Min'] + (useMax ? 1 : -1);
|
|
1829
|
+
endSegments.push({
|
|
1830
|
+
end: end,
|
|
1831
|
+
start: extractedEndPoint
|
|
1832
|
+
});
|
|
1833
|
+
end = extractedEndPoint;
|
|
1834
|
+
}
|
|
1835
|
+
// Find the path
|
|
1836
|
+
segments = clearPathTo(start, end, dirIsX);
|
|
1837
|
+
// Add the end-point segments
|
|
1838
|
+
segments = segments.concat(endSegments.reverse());
|
|
1839
|
+
return {
|
|
1840
|
+
path: pathFromSegments(segments),
|
|
1841
|
+
obstacles: segments
|
|
1842
|
+
};
|
|
1843
|
+
}, {
|
|
1844
|
+
requiresObstacles: true
|
|
1845
|
+
});
|
|
1846
|
+
// Define the available pathfinding algorithms.
|
|
1847
|
+
// Algorithms take up to 3 arguments: starting point, ending point, and an
|
|
1848
|
+
// options object.
|
|
1849
|
+
var algorithms = {
|
|
1850
|
+
fastAvoid: fastAvoid,
|
|
1851
|
+
straight: straight,
|
|
1852
|
+
simpleConnect: simpleConnect
|
|
1853
|
+
};
|
|
1854
|
+
|
|
1855
|
+
return algorithms;
|
|
1856
|
+
});
|
|
1857
|
+
_registerModule(_modules, 'Gantt/Pathfinder.js', [_modules['Gantt/Connection.js'], _modules['Core/Chart/Chart.js'], _modules['Core/Globals.js'], _modules['Core/Options.js'], _modules['Core/Series/Point.js'], _modules['Core/Utilities.js'], _modules['Gantt/PathfinderAlgorithms.js']], function (Connection, Chart, H, O, Point, U, pathfinderAlgorithms) {
|
|
1858
|
+
/* *
|
|
1859
|
+
*
|
|
1860
|
+
* (c) 2016 Highsoft AS
|
|
1861
|
+
* Authors: Øystein Moseng, Lars A. V. Cabrera
|
|
1862
|
+
*
|
|
1863
|
+
* License: www.highcharts.com/license
|
|
1864
|
+
*
|
|
1865
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
1866
|
+
*
|
|
1867
|
+
* */
|
|
1868
|
+
/**
|
|
1869
|
+
* The default pathfinder algorithm to use for a chart. It is possible to define
|
|
1870
|
+
* your own algorithms by adding them to the
|
|
1871
|
+
* `Highcharts.Pathfinder.prototype.algorithms`
|
|
1872
|
+
* object before the chart has been created.
|
|
1873
|
+
*
|
|
1874
|
+
* The default algorithms are as follows:
|
|
1875
|
+
*
|
|
1876
|
+
* `straight`: Draws a straight line between the connecting
|
|
1877
|
+
* points. Does not avoid other points when drawing.
|
|
1878
|
+
*
|
|
1879
|
+
* `simpleConnect`: Finds a path between the points using right angles
|
|
1880
|
+
* only. Takes only starting/ending points into
|
|
1881
|
+
* account, and will not avoid other points.
|
|
1882
|
+
*
|
|
1883
|
+
* `fastAvoid`: Finds a path between the points using right angles
|
|
1884
|
+
* only. Will attempt to avoid other points, but its
|
|
1885
|
+
* focus is performance over accuracy. Works well with
|
|
1886
|
+
* less dense datasets.
|
|
1887
|
+
*
|
|
1888
|
+
* @typedef {"fastAvoid"|"simpleConnect"|"straight"|string} Highcharts.PathfinderTypeValue
|
|
1889
|
+
*/
|
|
1890
|
+
''; // detach doclets above
|
|
1891
|
+
var defaultOptions = O.defaultOptions;
|
|
1892
|
+
var addEvent = U.addEvent,
|
|
1893
|
+
defined = U.defined,
|
|
1894
|
+
error = U.error,
|
|
1895
|
+
extend = U.extend,
|
|
1896
|
+
merge = U.merge,
|
|
1897
|
+
objectEach = U.objectEach,
|
|
1898
|
+
pick = U.pick,
|
|
1899
|
+
splat = U.splat;
|
|
1900
|
+
var deg2rad = H.deg2rad,
|
|
1901
|
+
max = Math.max,
|
|
1902
|
+
min = Math.min;
|
|
1903
|
+
/*
|
|
1904
|
+
@todo:
|
|
1905
|
+
- Document how to write your own algorithms
|
|
1906
|
+
- Consider adding a Point.pathTo method that wraps creating a connection
|
|
1907
|
+
and rendering it
|
|
1908
|
+
*/
|
|
1909
|
+
// Set default Pathfinder options
|
|
1910
|
+
extend(defaultOptions, {
|
|
1911
|
+
/**
|
|
1912
|
+
* The Pathfinder module allows you to define connections between any two
|
|
1913
|
+
* points, represented as lines - optionally with markers for the start
|
|
1914
|
+
* and/or end points. Multiple algorithms are available for calculating how
|
|
1915
|
+
* the connecting lines are drawn.
|
|
1916
|
+
*
|
|
1917
|
+
* Connector functionality requires Highcharts Gantt to be loaded. In Gantt
|
|
1918
|
+
* charts, the connectors are used to draw dependencies between tasks.
|
|
1919
|
+
*
|
|
1920
|
+
* @see [dependency](series.gantt.data.dependency)
|
|
1921
|
+
*
|
|
1922
|
+
* @sample gantt/pathfinder/demo
|
|
1923
|
+
* Pathfinder connections
|
|
1924
|
+
*
|
|
1925
|
+
* @declare Highcharts.ConnectorsOptions
|
|
1926
|
+
* @product gantt
|
|
1927
|
+
* @optionparent connectors
|
|
1928
|
+
*/
|
|
1929
|
+
connectors: {
|
|
1930
|
+
/**
|
|
1931
|
+
* Enable connectors for this chart. Requires Highcharts Gantt.
|
|
1932
|
+
*
|
|
1933
|
+
* @type {boolean}
|
|
1934
|
+
* @default true
|
|
1935
|
+
* @since 6.2.0
|
|
1936
|
+
* @apioption connectors.enabled
|
|
1937
|
+
*/
|
|
1938
|
+
/**
|
|
1939
|
+
* Set the default dash style for this chart's connecting lines.
|
|
1940
|
+
*
|
|
1941
|
+
* @type {string}
|
|
1942
|
+
* @default solid
|
|
1943
|
+
* @since 6.2.0
|
|
1944
|
+
* @apioption connectors.dashStyle
|
|
1945
|
+
*/
|
|
1946
|
+
/**
|
|
1947
|
+
* Set the default color for this chart's Pathfinder connecting lines.
|
|
1948
|
+
* Defaults to the color of the point being connected.
|
|
1949
|
+
*
|
|
1950
|
+
* @type {Highcharts.ColorString}
|
|
1951
|
+
* @since 6.2.0
|
|
1952
|
+
* @apioption connectors.lineColor
|
|
1953
|
+
*/
|
|
1954
|
+
/**
|
|
1955
|
+
* Set the default pathfinder margin to use, in pixels. Some Pathfinder
|
|
1956
|
+
* algorithms attempt to avoid obstacles, such as other points in the
|
|
1957
|
+
* chart. These algorithms use this margin to determine how close lines
|
|
1958
|
+
* can be to an obstacle. The default is to compute this automatically
|
|
1959
|
+
* from the size of the obstacles in the chart.
|
|
1960
|
+
*
|
|
1961
|
+
* To draw connecting lines close to existing points, set this to a low
|
|
1962
|
+
* number. For more space around existing points, set this number
|
|
1963
|
+
* higher.
|
|
1964
|
+
*
|
|
1965
|
+
* @sample gantt/pathfinder/algorithm-margin
|
|
1966
|
+
* Small algorithmMargin
|
|
1967
|
+
*
|
|
1968
|
+
* @type {number}
|
|
1969
|
+
* @since 6.2.0
|
|
1970
|
+
* @apioption connectors.algorithmMargin
|
|
1971
|
+
*/
|
|
1972
|
+
/**
|
|
1973
|
+
* Set the default pathfinder algorithm to use for this chart. It is
|
|
1974
|
+
* possible to define your own algorithms by adding them to the
|
|
1975
|
+
* Highcharts.Pathfinder.prototype.algorithms object before the chart
|
|
1976
|
+
* has been created.
|
|
1977
|
+
*
|
|
1978
|
+
* The default algorithms are as follows:
|
|
1979
|
+
*
|
|
1980
|
+
* `straight`: Draws a straight line between the connecting
|
|
1981
|
+
* points. Does not avoid other points when drawing.
|
|
1982
|
+
*
|
|
1983
|
+
* `simpleConnect`: Finds a path between the points using right angles
|
|
1984
|
+
* only. Takes only starting/ending points into
|
|
1985
|
+
* account, and will not avoid other points.
|
|
1986
|
+
*
|
|
1987
|
+
* `fastAvoid`: Finds a path between the points using right angles
|
|
1988
|
+
* only. Will attempt to avoid other points, but its
|
|
1989
|
+
* focus is performance over accuracy. Works well with
|
|
1990
|
+
* less dense datasets.
|
|
1991
|
+
*
|
|
1992
|
+
* Default value: `straight` is used as default for most series types,
|
|
1993
|
+
* while `simpleConnect` is used as default for Gantt series, to show
|
|
1994
|
+
* dependencies between points.
|
|
1995
|
+
*
|
|
1996
|
+
* @sample gantt/pathfinder/demo
|
|
1997
|
+
* Different types used
|
|
1998
|
+
*
|
|
1999
|
+
* @type {Highcharts.PathfinderTypeValue}
|
|
2000
|
+
* @default undefined
|
|
2001
|
+
* @since 6.2.0
|
|
2002
|
+
*/
|
|
2003
|
+
type: 'straight',
|
|
2004
|
+
/**
|
|
2005
|
+
* Set the default pixel width for this chart's Pathfinder connecting
|
|
2006
|
+
* lines.
|
|
2007
|
+
*
|
|
2008
|
+
* @since 6.2.0
|
|
2009
|
+
*/
|
|
2010
|
+
lineWidth: 1,
|
|
2011
|
+
/**
|
|
2012
|
+
* Marker options for this chart's Pathfinder connectors. Note that
|
|
2013
|
+
* this option is overridden by the `startMarker` and `endMarker`
|
|
2014
|
+
* options.
|
|
2015
|
+
*
|
|
2016
|
+
* @declare Highcharts.ConnectorsMarkerOptions
|
|
2017
|
+
* @since 6.2.0
|
|
2018
|
+
*/
|
|
2019
|
+
marker: {
|
|
2020
|
+
/**
|
|
2021
|
+
* Set the radius of the connector markers. The default is
|
|
2022
|
+
* automatically computed based on the algorithmMargin setting.
|
|
2023
|
+
*
|
|
2024
|
+
* Setting marker.width and marker.height will override this
|
|
2025
|
+
* setting.
|
|
2026
|
+
*
|
|
2027
|
+
* @type {number}
|
|
2028
|
+
* @since 6.2.0
|
|
2029
|
+
* @apioption connectors.marker.radius
|
|
2030
|
+
*/
|
|
2031
|
+
/**
|
|
2032
|
+
* Set the width of the connector markers. If not supplied, this
|
|
2033
|
+
* is inferred from the marker radius.
|
|
2034
|
+
*
|
|
2035
|
+
* @type {number}
|
|
2036
|
+
* @since 6.2.0
|
|
2037
|
+
* @apioption connectors.marker.width
|
|
2038
|
+
*/
|
|
2039
|
+
/**
|
|
2040
|
+
* Set the height of the connector markers. If not supplied, this
|
|
2041
|
+
* is inferred from the marker radius.
|
|
2042
|
+
*
|
|
2043
|
+
* @type {number}
|
|
2044
|
+
* @since 6.2.0
|
|
2045
|
+
* @apioption connectors.marker.height
|
|
2046
|
+
*/
|
|
2047
|
+
/**
|
|
2048
|
+
* Set the color of the connector markers. By default this is the
|
|
2049
|
+
* same as the connector color.
|
|
2050
|
+
*
|
|
2051
|
+
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
|
2052
|
+
* @since 6.2.0
|
|
2053
|
+
* @apioption connectors.marker.color
|
|
2054
|
+
*/
|
|
2055
|
+
/**
|
|
2056
|
+
* Set the line/border color of the connector markers. By default
|
|
2057
|
+
* this is the same as the marker color.
|
|
2058
|
+
*
|
|
2059
|
+
* @type {Highcharts.ColorString}
|
|
2060
|
+
* @since 6.2.0
|
|
2061
|
+
* @apioption connectors.marker.lineColor
|
|
2062
|
+
*/
|
|
2063
|
+
/**
|
|
2064
|
+
* Enable markers for the connectors.
|
|
2065
|
+
*/
|
|
2066
|
+
enabled: false,
|
|
2067
|
+
/**
|
|
2068
|
+
* Horizontal alignment of the markers relative to the points.
|
|
2069
|
+
*
|
|
2070
|
+
* @type {Highcharts.AlignValue}
|
|
2071
|
+
*/
|
|
2072
|
+
align: 'center',
|
|
2073
|
+
/**
|
|
2074
|
+
* Vertical alignment of the markers relative to the points.
|
|
2075
|
+
*
|
|
2076
|
+
* @type {Highcharts.VerticalAlignValue}
|
|
2077
|
+
*/
|
|
2078
|
+
verticalAlign: 'middle',
|
|
2079
|
+
/**
|
|
2080
|
+
* Whether or not to draw the markers inside the points.
|
|
2081
|
+
*/
|
|
2082
|
+
inside: false,
|
|
2083
|
+
/**
|
|
2084
|
+
* Set the line/border width of the pathfinder markers.
|
|
2085
|
+
*/
|
|
2086
|
+
lineWidth: 1
|
|
2087
|
+
},
|
|
2088
|
+
/**
|
|
2089
|
+
* Marker options specific to the start markers for this chart's
|
|
2090
|
+
* Pathfinder connectors. Overrides the generic marker options.
|
|
2091
|
+
*
|
|
2092
|
+
* @declare Highcharts.ConnectorsStartMarkerOptions
|
|
2093
|
+
* @extends connectors.marker
|
|
2094
|
+
* @since 6.2.0
|
|
2095
|
+
*/
|
|
2096
|
+
startMarker: {
|
|
2097
|
+
/**
|
|
2098
|
+
* Set the symbol of the connector start markers.
|
|
2099
|
+
*/
|
|
2100
|
+
symbol: 'diamond'
|
|
2101
|
+
},
|
|
2102
|
+
/**
|
|
2103
|
+
* Marker options specific to the end markers for this chart's
|
|
2104
|
+
* Pathfinder connectors. Overrides the generic marker options.
|
|
2105
|
+
*
|
|
2106
|
+
* @declare Highcharts.ConnectorsEndMarkerOptions
|
|
2107
|
+
* @extends connectors.marker
|
|
2108
|
+
* @since 6.2.0
|
|
2109
|
+
*/
|
|
2110
|
+
endMarker: {
|
|
2111
|
+
/**
|
|
2112
|
+
* Set the symbol of the connector end markers.
|
|
2113
|
+
*/
|
|
2114
|
+
symbol: 'arrow-filled'
|
|
1566
2115
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
2116
|
+
}
|
|
2117
|
+
});
|
|
2118
|
+
/**
|
|
2119
|
+
* Override Pathfinder connector options for a series. Requires Highcharts Gantt
|
|
2120
|
+
* to be loaded.
|
|
2121
|
+
*
|
|
2122
|
+
* @declare Highcharts.SeriesConnectorsOptionsObject
|
|
2123
|
+
* @extends connectors
|
|
2124
|
+
* @since 6.2.0
|
|
2125
|
+
* @excluding enabled, algorithmMargin
|
|
2126
|
+
* @product gantt
|
|
2127
|
+
* @apioption plotOptions.series.connectors
|
|
2128
|
+
*/
|
|
2129
|
+
/**
|
|
2130
|
+
* Connect to a point. This option can be either a string, referring to the ID
|
|
2131
|
+
* of another point, or an object, or an array of either. If the option is an
|
|
2132
|
+
* array, each element defines a connection.
|
|
2133
|
+
*
|
|
2134
|
+
* @sample gantt/pathfinder/demo
|
|
2135
|
+
* Different connection types
|
|
2136
|
+
*
|
|
2137
|
+
* @declare Highcharts.XrangePointConnectorsOptionsObject
|
|
2138
|
+
* @type {string|Array<string|*>|*}
|
|
2139
|
+
* @extends plotOptions.series.connectors
|
|
2140
|
+
* @since 6.2.0
|
|
2141
|
+
* @excluding enabled
|
|
2142
|
+
* @product gantt
|
|
2143
|
+
* @requires highcharts-gantt
|
|
2144
|
+
* @apioption series.xrange.data.connect
|
|
2145
|
+
*/
|
|
2146
|
+
/**
|
|
2147
|
+
* The ID of the point to connect to.
|
|
2148
|
+
*
|
|
2149
|
+
* @type {string}
|
|
2150
|
+
* @since 6.2.0
|
|
2151
|
+
* @product gantt
|
|
2152
|
+
* @apioption series.xrange.data.connect.to
|
|
2153
|
+
*/
|
|
2154
|
+
/**
|
|
2155
|
+
* Get point bounding box using plotX/plotY and shapeArgs. If using
|
|
2156
|
+
* graphic.getBBox() directly, the bbox will be affected by animation.
|
|
2157
|
+
*
|
|
2158
|
+
* @private
|
|
2159
|
+
* @function
|
|
2160
|
+
*
|
|
2161
|
+
* @param {Highcharts.Point} point
|
|
2162
|
+
* The point to get BB of.
|
|
2163
|
+
*
|
|
2164
|
+
* @return {Highcharts.Dictionary<number>|null}
|
|
2165
|
+
* Result xMax, xMin, yMax, yMin.
|
|
2166
|
+
*/
|
|
2167
|
+
function getPointBB(point) {
|
|
2168
|
+
var shapeArgs = point.shapeArgs,
|
|
2169
|
+
bb;
|
|
2170
|
+
// Prefer using shapeArgs (columns)
|
|
2171
|
+
if (shapeArgs) {
|
|
2172
|
+
return {
|
|
2173
|
+
xMin: shapeArgs.x,
|
|
2174
|
+
xMax: shapeArgs.x + shapeArgs.width,
|
|
2175
|
+
yMin: shapeArgs.y,
|
|
2176
|
+
yMax: shapeArgs.y + shapeArgs.height
|
|
2177
|
+
};
|
|
2178
|
+
}
|
|
2179
|
+
// Otherwise use plotX/plotY and bb
|
|
2180
|
+
bb = point.graphic && point.graphic.getBBox();
|
|
2181
|
+
return bb ? {
|
|
2182
|
+
xMin: point.plotX - bb.width / 2,
|
|
2183
|
+
xMax: point.plotX + bb.width / 2,
|
|
2184
|
+
yMin: point.plotY - bb.height / 2,
|
|
2185
|
+
yMax: point.plotY + bb.height / 2
|
|
2186
|
+
} : null;
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Calculate margin to place around obstacles for the pathfinder in pixels.
|
|
2190
|
+
* Returns a minimum of 1 pixel margin.
|
|
2191
|
+
*
|
|
2192
|
+
* @private
|
|
2193
|
+
* @function
|
|
2194
|
+
*
|
|
2195
|
+
* @param {Array<object>} obstacles
|
|
2196
|
+
* Obstacles to calculate margin from.
|
|
2197
|
+
*
|
|
2198
|
+
* @return {number}
|
|
2199
|
+
* The calculated margin in pixels. At least 1.
|
|
2200
|
+
*/
|
|
2201
|
+
function calculateObstacleMargin(obstacles) {
|
|
2202
|
+
var len = obstacles.length,
|
|
2203
|
+
i = 0,
|
|
2204
|
+
j,
|
|
2205
|
+
obstacleDistance,
|
|
2206
|
+
distances = [],
|
|
2207
|
+
// Compute smallest distance between two rectangles
|
|
2208
|
+
distance = function (a,
|
|
2209
|
+
b,
|
|
2210
|
+
bbMargin) {
|
|
2211
|
+
// Count the distance even if we are slightly off
|
|
2212
|
+
var margin = pick(bbMargin, 10),
|
|
2213
|
+
yOverlap = a.yMax + margin > b.yMin - margin &&
|
|
2214
|
+
a.yMin - margin < b.yMax + margin,
|
|
2215
|
+
xOverlap = a.xMax + margin > b.xMin - margin &&
|
|
2216
|
+
a.xMin - margin < b.xMax + margin,
|
|
2217
|
+
xDistance = yOverlap ? (a.xMin > b.xMax ? a.xMin - b.xMax : b.xMin - a.xMax) : Infinity,
|
|
2218
|
+
yDistance = xOverlap ? (a.yMin > b.yMax ? a.yMin - b.yMax : b.yMin - a.yMax) : Infinity;
|
|
2219
|
+
// If the rectangles collide, try recomputing with smaller margin.
|
|
2220
|
+
// If they collide anyway, discard the obstacle.
|
|
2221
|
+
if (xOverlap && yOverlap) {
|
|
2222
|
+
return (margin ?
|
|
2223
|
+
distance(a, b, Math.floor(margin / 2)) :
|
|
2224
|
+
Infinity);
|
|
1579
2225
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
//
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
xMax: chart.plotWidth,
|
|
1592
|
-
yMin: 0,
|
|
1593
|
-
yMax: chart.plotHeight
|
|
1594
|
-
},
|
|
1595
|
-
obstacleOptions: {
|
|
1596
|
-
margin: options.algorithmMargin
|
|
1597
|
-
},
|
|
1598
|
-
startDirectionX: pathfinder.getAlgorithmStartDirection(options.startMarker)
|
|
1599
|
-
}, options));
|
|
1600
|
-
},
|
|
1601
|
-
/**
|
|
1602
|
-
* (re)Calculate and (re)draw the connection.
|
|
1603
|
-
*
|
|
1604
|
-
* @function Highcharts.Connection#render
|
|
1605
|
-
*/
|
|
1606
|
-
render: function () {
|
|
1607
|
-
var connection = this,
|
|
1608
|
-
fromPoint = connection.fromPoint,
|
|
1609
|
-
series = fromPoint.series,
|
|
1610
|
-
chart = series.chart,
|
|
1611
|
-
pathfinder = chart.pathfinder,
|
|
1612
|
-
pathResult,
|
|
1613
|
-
path,
|
|
1614
|
-
options = merge(chart.options.connectors,
|
|
1615
|
-
series.options.connectors,
|
|
1616
|
-
fromPoint.options.connectors,
|
|
1617
|
-
connection.options),
|
|
1618
|
-
attribs = {};
|
|
1619
|
-
// Set path attribs
|
|
1620
|
-
if (!chart.styledMode) {
|
|
1621
|
-
attribs.stroke = options.lineColor || fromPoint.color;
|
|
1622
|
-
attribs['stroke-width'] = options.lineWidth;
|
|
1623
|
-
if (options.dashStyle) {
|
|
1624
|
-
attribs.dashstyle = options.dashStyle;
|
|
2226
|
+
return min(xDistance, yDistance);
|
|
2227
|
+
};
|
|
2228
|
+
// Go over all obstacles and compare them to the others.
|
|
2229
|
+
for (; i < len; ++i) {
|
|
2230
|
+
// Compare to all obstacles ahead. We will already have compared this
|
|
2231
|
+
// obstacle to the ones before.
|
|
2232
|
+
for (j = i + 1; j < len; ++j) {
|
|
2233
|
+
obstacleDistance = distance(obstacles[i], obstacles[j]);
|
|
2234
|
+
// TODO: Magic number 80
|
|
2235
|
+
if (obstacleDistance < 80) { // Ignore large distances
|
|
2236
|
+
distances.push(obstacleDistance);
|
|
1625
2237
|
}
|
|
1626
2238
|
}
|
|
1627
|
-
attribs['class'] = // eslint-disable-line dot-notation
|
|
1628
|
-
'highcharts-point-connecting-path ' +
|
|
1629
|
-
'highcharts-color-' + fromPoint.colorIndex;
|
|
1630
|
-
options = merge(attribs, options);
|
|
1631
|
-
// Set common marker options
|
|
1632
|
-
if (!defined(options.marker.radius)) {
|
|
1633
|
-
options.marker.radius = min(max(Math.ceil((options.algorithmMargin || 8) / 2) - 1, 1), 5);
|
|
1634
|
-
}
|
|
1635
|
-
// Get the path
|
|
1636
|
-
pathResult = connection.getPath(options);
|
|
1637
|
-
path = pathResult.path;
|
|
1638
|
-
// Always update obstacle storage with obstacles from this path.
|
|
1639
|
-
// We don't know if future calls will need this for their algorithm.
|
|
1640
|
-
if (pathResult.obstacles) {
|
|
1641
|
-
pathfinder.lineObstacles =
|
|
1642
|
-
pathfinder.lineObstacles || [];
|
|
1643
|
-
pathfinder.lineObstacles =
|
|
1644
|
-
pathfinder.lineObstacles.concat(pathResult.obstacles);
|
|
1645
|
-
}
|
|
1646
|
-
// Add the calculated path to the pathfinder group
|
|
1647
|
-
connection.renderPath(path, attribs, series.options.animation);
|
|
1648
|
-
// Render the markers
|
|
1649
|
-
connection.addMarker('start', merge(options.marker, options.startMarker), path);
|
|
1650
|
-
connection.addMarker('end', merge(options.marker, options.endMarker), path);
|
|
1651
|
-
},
|
|
1652
|
-
/**
|
|
1653
|
-
* Destroy connection by destroying the added graphics elements.
|
|
1654
|
-
*
|
|
1655
|
-
* @function Highcharts.Connection#destroy
|
|
1656
|
-
*/
|
|
1657
|
-
destroy: function () {
|
|
1658
|
-
if (this.graphics) {
|
|
1659
|
-
objectEach(this.graphics, function (val) {
|
|
1660
|
-
val.destroy();
|
|
1661
|
-
});
|
|
1662
|
-
delete this.graphics;
|
|
1663
|
-
}
|
|
1664
2239
|
}
|
|
1665
|
-
|
|
2240
|
+
// Ensure we always have at least one value, even in very spaceous charts
|
|
2241
|
+
distances.push(80);
|
|
2242
|
+
return max(Math.floor(distances.sort(function (a, b) {
|
|
2243
|
+
return (a - b);
|
|
2244
|
+
})[
|
|
2245
|
+
// Discard first 10% of the relevant distances, and then grab
|
|
2246
|
+
// the smallest one.
|
|
2247
|
+
Math.floor(distances.length / 10)] / 2 - 1 // Divide the distance by 2 and subtract 1.
|
|
2248
|
+
), 1 // 1 is the minimum margin
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2251
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
1666
2252
|
/**
|
|
1667
2253
|
* The Pathfinder class.
|
|
1668
2254
|
*
|
|
@@ -1673,15 +2259,25 @@
|
|
|
1673
2259
|
* @param {Highcharts.Chart} chart
|
|
1674
2260
|
* The chart to operate on.
|
|
1675
2261
|
*/
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
2262
|
+
var Pathfinder = /** @class */ (function () {
|
|
2263
|
+
function Pathfinder(chart) {
|
|
2264
|
+
/* *
|
|
2265
|
+
*
|
|
2266
|
+
* Properties
|
|
2267
|
+
*
|
|
2268
|
+
* */
|
|
2269
|
+
this.chart = void 0;
|
|
2270
|
+
this.chartObstacles = void 0;
|
|
2271
|
+
this.chartObstacleMetrics = void 0;
|
|
2272
|
+
this.connections = void 0;
|
|
2273
|
+
this.group = void 0;
|
|
2274
|
+
this.lineObstacles = void 0;
|
|
2275
|
+
this.init(chart);
|
|
2276
|
+
}
|
|
1680
2277
|
/**
|
|
1681
2278
|
* @name Highcharts.Pathfinder#algorithms
|
|
1682
2279
|
* @type {Highcharts.Dictionary<Function>}
|
|
1683
2280
|
*/
|
|
1684
|
-
algorithms: pathfinderAlgorithms,
|
|
1685
2281
|
/**
|
|
1686
2282
|
* Initialize the Pathfinder object.
|
|
1687
2283
|
*
|
|
@@ -1690,7 +2286,7 @@
|
|
|
1690
2286
|
* @param {Highcharts.Chart} chart
|
|
1691
2287
|
* The chart context.
|
|
1692
2288
|
*/
|
|
1693
|
-
init
|
|
2289
|
+
Pathfinder.prototype.init = function (chart) {
|
|
1694
2290
|
// Initialize pathfinder with chart context
|
|
1695
2291
|
this.chart = chart;
|
|
1696
2292
|
// Init connection reference list
|
|
@@ -1699,7 +2295,7 @@
|
|
|
1699
2295
|
addEvent(chart, 'redraw', function () {
|
|
1700
2296
|
this.pathfinder.update();
|
|
1701
2297
|
});
|
|
1702
|
-
}
|
|
2298
|
+
};
|
|
1703
2299
|
/**
|
|
1704
2300
|
* Update Pathfinder connections from scratch.
|
|
1705
2301
|
*
|
|
@@ -1709,7 +2305,7 @@
|
|
|
1709
2305
|
* Whether or not to defer rendering of connections until
|
|
1710
2306
|
* series.afterAnimate event has fired. Used on first render.
|
|
1711
2307
|
*/
|
|
1712
|
-
update
|
|
2308
|
+
Pathfinder.prototype.update = function (deferRender) {
|
|
1713
2309
|
var chart = this.chart,
|
|
1714
2310
|
pathfinder = this,
|
|
1715
2311
|
oldConnections = pathfinder.connections;
|
|
@@ -1718,6 +2314,12 @@
|
|
|
1718
2314
|
chart.series.forEach(function (series) {
|
|
1719
2315
|
if (series.visible && !series.options.isInternal) {
|
|
1720
2316
|
series.points.forEach(function (point) {
|
|
2317
|
+
var ganttPointOptions = point.options;
|
|
2318
|
+
// For Gantt series the connect could be
|
|
2319
|
+
// defined as a dependency
|
|
2320
|
+
if (ganttPointOptions && ganttPointOptions.dependency) {
|
|
2321
|
+
ganttPointOptions.connect = ganttPointOptions.dependency;
|
|
2322
|
+
}
|
|
1721
2323
|
var to,
|
|
1722
2324
|
connects = (point.options &&
|
|
1723
2325
|
point.options.connect &&
|
|
@@ -1767,7 +2369,7 @@
|
|
|
1767
2369
|
delete this.lineObstacles;
|
|
1768
2370
|
// Draw the pending connections
|
|
1769
2371
|
pathfinder.renderConnections(deferRender);
|
|
1770
|
-
}
|
|
2372
|
+
};
|
|
1771
2373
|
/**
|
|
1772
2374
|
* Draw the chart's connecting paths.
|
|
1773
2375
|
*
|
|
@@ -1777,7 +2379,7 @@
|
|
|
1777
2379
|
* Whether or not to defer render until series animation is finished.
|
|
1778
2380
|
* Used on first render.
|
|
1779
2381
|
*/
|
|
1780
|
-
renderConnections
|
|
2382
|
+
Pathfinder.prototype.renderConnections = function (deferRender) {
|
|
1781
2383
|
if (deferRender) {
|
|
1782
2384
|
// Render after series are done animating
|
|
1783
2385
|
this.chart.series.forEach(function (series) {
|
|
@@ -1811,7 +2413,7 @@
|
|
|
1811
2413
|
connection.render();
|
|
1812
2414
|
});
|
|
1813
2415
|
}
|
|
1814
|
-
}
|
|
2416
|
+
};
|
|
1815
2417
|
/**
|
|
1816
2418
|
* Get obstacles for the points in the chart. Does not include connecting
|
|
1817
2419
|
* lines from Pathfinder. Applies algorithmMargin to the obstacles.
|
|
@@ -1826,7 +2428,7 @@
|
|
|
1826
2428
|
* An array of calculated obstacles. Each obstacle is defined as an
|
|
1827
2429
|
* object with xMin, xMax, yMin and yMax properties.
|
|
1828
2430
|
*/
|
|
1829
|
-
getChartObstacles
|
|
2431
|
+
Pathfinder.prototype.getChartObstacles = function (options) {
|
|
1830
2432
|
var obstacles = [],
|
|
1831
2433
|
series = this.chart.series,
|
|
1832
2434
|
margin = pick(options.algorithmMargin, 0),
|
|
@@ -1866,7 +2468,7 @@
|
|
|
1866
2468
|
});
|
|
1867
2469
|
}
|
|
1868
2470
|
return obstacles;
|
|
1869
|
-
}
|
|
2471
|
+
};
|
|
1870
2472
|
/**
|
|
1871
2473
|
* Utility function to get metrics for obstacles:
|
|
1872
2474
|
* - Widest obstacle width
|
|
@@ -1881,7 +2483,7 @@
|
|
|
1881
2483
|
* The calculated metrics, as an object with maxHeight and maxWidth
|
|
1882
2484
|
* properties.
|
|
1883
2485
|
*/
|
|
1884
|
-
getObstacleMetrics
|
|
2486
|
+
Pathfinder.prototype.getObstacleMetrics = function (obstacles) {
|
|
1885
2487
|
var maxWidth = 0,
|
|
1886
2488
|
maxHeight = 0,
|
|
1887
2489
|
width,
|
|
@@ -1901,7 +2503,7 @@
|
|
|
1901
2503
|
maxHeight: maxHeight,
|
|
1902
2504
|
maxWidth: maxWidth
|
|
1903
2505
|
};
|
|
1904
|
-
}
|
|
2506
|
+
};
|
|
1905
2507
|
/**
|
|
1906
2508
|
* Utility to get which direction to start the pathfinding algorithm
|
|
1907
2509
|
* (X vs Y), calculated from a set of marker options.
|
|
@@ -1914,17 +2516,18 @@
|
|
|
1914
2516
|
* @return {boolean}
|
|
1915
2517
|
* Returns true for X, false for Y, and undefined for autocalculate.
|
|
1916
2518
|
*/
|
|
1917
|
-
getAlgorithmStartDirection
|
|
2519
|
+
Pathfinder.prototype.getAlgorithmStartDirection = function (markerOptions) {
|
|
1918
2520
|
var xCenter = markerOptions.align !== 'left' &&
|
|
1919
2521
|
markerOptions.align !== 'right', yCenter = markerOptions.verticalAlign !== 'top' &&
|
|
1920
2522
|
markerOptions.verticalAlign !== 'bottom', undef;
|
|
1921
2523
|
return xCenter ?
|
|
1922
2524
|
(yCenter ? undef : false) : // x is centered
|
|
1923
2525
|
(yCenter ? true : undef); // x is off-center
|
|
1924
|
-
}
|
|
1925
|
-
|
|
2526
|
+
};
|
|
2527
|
+
return Pathfinder;
|
|
2528
|
+
}());
|
|
2529
|
+
Pathfinder.prototype.algorithms = pathfinderAlgorithms;
|
|
1926
2530
|
// Add to Highcharts namespace
|
|
1927
|
-
H.Connection = Connection;
|
|
1928
2531
|
H.Pathfinder = Pathfinder;
|
|
1929
2532
|
// Add pathfinding capabilities to Points
|
|
1930
2533
|
extend(Point.prototype, /** @lends Point.prototype */ {
|
|
@@ -2099,7 +2702,7 @@
|
|
|
2099
2702
|
}
|
|
2100
2703
|
}
|
|
2101
2704
|
// Initialize Pathfinder for charts
|
|
2102
|
-
|
|
2705
|
+
Chart.prototype.callbacks.push(function (chart) {
|
|
2103
2706
|
var options = chart.options;
|
|
2104
2707
|
if (options.connectors.enabled !== false) {
|
|
2105
2708
|
warnLegacy(chart);
|
|
@@ -2108,6 +2711,7 @@
|
|
|
2108
2711
|
}
|
|
2109
2712
|
});
|
|
2110
2713
|
|
|
2714
|
+
return Pathfinder;
|
|
2111
2715
|
});
|
|
2112
2716
|
_registerModule(_modules, 'masters/modules/pathfinder.src.js', [], function () {
|
|
2113
2717
|
|