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 Highstock JS v8.
|
|
2
|
+
* @license Highstock JS v8.2.2 (2020-10-22)
|
|
3
3
|
*
|
|
4
4
|
* Advanced Highstock tools
|
|
5
5
|
*
|
|
@@ -29,7 +29,3725 @@
|
|
|
29
29
|
obj[path] = fn.apply(null, args);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
_registerModule(_modules, '
|
|
32
|
+
_registerModule(_modules, 'Extensions/Annotations/Mixins/EventEmitterMixin.js', [_modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (H, U) {
|
|
33
|
+
/* *
|
|
34
|
+
*
|
|
35
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
36
|
+
*
|
|
37
|
+
* */
|
|
38
|
+
var addEvent = U.addEvent,
|
|
39
|
+
fireEvent = U.fireEvent,
|
|
40
|
+
objectEach = U.objectEach,
|
|
41
|
+
pick = U.pick,
|
|
42
|
+
removeEvent = U.removeEvent;
|
|
43
|
+
/* eslint-disable valid-jsdoc */
|
|
44
|
+
/**
|
|
45
|
+
* It provides methods for:
|
|
46
|
+
* - adding and handling DOM events and a drag event,
|
|
47
|
+
* - mapping a mouse move event to the distance between two following events.
|
|
48
|
+
* The units of the distance are specific to a transformation,
|
|
49
|
+
* e.g. for rotation they are radians, for scaling they are scale factors.
|
|
50
|
+
*
|
|
51
|
+
* @private
|
|
52
|
+
* @mixin
|
|
53
|
+
* @memberOf Annotation
|
|
54
|
+
*/
|
|
55
|
+
var eventEmitterMixin = {
|
|
56
|
+
/**
|
|
57
|
+
* Add emitter events.
|
|
58
|
+
*/
|
|
59
|
+
addEvents: function () {
|
|
60
|
+
var emitter = this,
|
|
61
|
+
addMouseDownEvent = function (element) {
|
|
62
|
+
addEvent(element,
|
|
63
|
+
H.isTouchDevice ? 'touchstart' : 'mousedown',
|
|
64
|
+
function (e) {
|
|
65
|
+
emitter.onMouseDown(e);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
addMouseDownEvent(this.graphic.element);
|
|
69
|
+
(emitter.labels || []).forEach(function (label) {
|
|
70
|
+
if (label.options.useHTML && label.graphic.text) {
|
|
71
|
+
// Mousedown event bound to HTML element (#13070).
|
|
72
|
+
addMouseDownEvent(label.graphic.text.element);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
objectEach(emitter.options.events, function (event, type) {
|
|
76
|
+
var eventHandler = function (e) {
|
|
77
|
+
if (type !== 'click' || !emitter.cancelClick) {
|
|
78
|
+
event.call(emitter,
|
|
79
|
+
emitter.chart.pointer.normalize(e),
|
|
80
|
+
emitter.target);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
if ((emitter.nonDOMEvents || []).indexOf(type) === -1) {
|
|
84
|
+
emitter.graphic.on(type, eventHandler);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
addEvent(emitter, type, eventHandler);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (emitter.options.draggable) {
|
|
91
|
+
addEvent(emitter, 'drag', emitter.onDrag);
|
|
92
|
+
if (!emitter.graphic.renderer.styledMode) {
|
|
93
|
+
var cssPointer_1 = {
|
|
94
|
+
cursor: {
|
|
95
|
+
x: 'ew-resize',
|
|
96
|
+
y: 'ns-resize',
|
|
97
|
+
xy: 'move'
|
|
98
|
+
}[emitter.options.draggable]
|
|
99
|
+
};
|
|
100
|
+
emitter.graphic.css(cssPointer_1);
|
|
101
|
+
(emitter.labels || []).forEach(function (label) {
|
|
102
|
+
if (label.options.useHTML && label.graphic.text) {
|
|
103
|
+
label.graphic.text.css(cssPointer_1);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!emitter.isUpdating) {
|
|
109
|
+
fireEvent(emitter, 'add');
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* Remove emitter document events.
|
|
114
|
+
*/
|
|
115
|
+
removeDocEvents: function () {
|
|
116
|
+
if (this.removeDrag) {
|
|
117
|
+
this.removeDrag = this.removeDrag();
|
|
118
|
+
}
|
|
119
|
+
if (this.removeMouseUp) {
|
|
120
|
+
this.removeMouseUp = this.removeMouseUp();
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
/**
|
|
124
|
+
* Mouse down handler.
|
|
125
|
+
*/
|
|
126
|
+
onMouseDown: function (e) {
|
|
127
|
+
var emitter = this,
|
|
128
|
+
pointer = emitter.chart.pointer,
|
|
129
|
+
prevChartX,
|
|
130
|
+
prevChartY;
|
|
131
|
+
if (e.preventDefault) {
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
}
|
|
134
|
+
// On right click, do nothing:
|
|
135
|
+
if (e.button === 2) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
e = pointer.normalize(e);
|
|
139
|
+
prevChartX = e.chartX;
|
|
140
|
+
prevChartY = e.chartY;
|
|
141
|
+
emitter.cancelClick = false;
|
|
142
|
+
emitter.chart.hasDraggedAnnotation = true;
|
|
143
|
+
emitter.removeDrag = addEvent(H.doc, H.isTouchDevice ? 'touchmove' : 'mousemove', function (e) {
|
|
144
|
+
emitter.hasDragged = true;
|
|
145
|
+
e = pointer.normalize(e);
|
|
146
|
+
e.prevChartX = prevChartX;
|
|
147
|
+
e.prevChartY = prevChartY;
|
|
148
|
+
fireEvent(emitter, 'drag', e);
|
|
149
|
+
prevChartX = e.chartX;
|
|
150
|
+
prevChartY = e.chartY;
|
|
151
|
+
});
|
|
152
|
+
emitter.removeMouseUp = addEvent(H.doc, H.isTouchDevice ? 'touchend' : 'mouseup', function (e) {
|
|
153
|
+
emitter.cancelClick = emitter.hasDragged;
|
|
154
|
+
emitter.hasDragged = false;
|
|
155
|
+
emitter.chart.hasDraggedAnnotation = false;
|
|
156
|
+
// ControlPoints vs Annotation:
|
|
157
|
+
fireEvent(pick(emitter.target, emitter), 'afterUpdate');
|
|
158
|
+
emitter.onMouseUp(e);
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Mouse up handler.
|
|
163
|
+
*/
|
|
164
|
+
onMouseUp: function (_e) {
|
|
165
|
+
var chart = this.chart,
|
|
166
|
+
annotation = this.target || this,
|
|
167
|
+
annotationsOptions = chart.options.annotations,
|
|
168
|
+
index = chart.annotations.indexOf(annotation);
|
|
169
|
+
this.removeDocEvents();
|
|
170
|
+
annotationsOptions[index] = annotation.options;
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* Drag and drop event. All basic annotations should share this
|
|
174
|
+
* capability as well as the extended ones.
|
|
175
|
+
*/
|
|
176
|
+
onDrag: function (e) {
|
|
177
|
+
if (this.chart.isInsidePlot(e.chartX - this.chart.plotLeft, e.chartY - this.chart.plotTop)) {
|
|
178
|
+
var translation = this.mouseMoveToTranslation(e);
|
|
179
|
+
if (this.options.draggable === 'x') {
|
|
180
|
+
translation.y = 0;
|
|
181
|
+
}
|
|
182
|
+
if (this.options.draggable === 'y') {
|
|
183
|
+
translation.x = 0;
|
|
184
|
+
}
|
|
185
|
+
if (this.points.length) {
|
|
186
|
+
this.translate(translation.x, translation.y);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
this.shapes.forEach(function (shape) {
|
|
190
|
+
shape.translate(translation.x, translation.y);
|
|
191
|
+
});
|
|
192
|
+
this.labels.forEach(function (label) {
|
|
193
|
+
label.translate(translation.x, translation.y);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
this.redraw(false);
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
/**
|
|
200
|
+
* Map mouse move event to the radians.
|
|
201
|
+
*/
|
|
202
|
+
mouseMoveToRadians: function (e, cx, cy) {
|
|
203
|
+
var prevDy = e.prevChartY - cy,
|
|
204
|
+
prevDx = e.prevChartX - cx,
|
|
205
|
+
dy = e.chartY - cy,
|
|
206
|
+
dx = e.chartX - cx,
|
|
207
|
+
temp;
|
|
208
|
+
if (this.chart.inverted) {
|
|
209
|
+
temp = prevDx;
|
|
210
|
+
prevDx = prevDy;
|
|
211
|
+
prevDy = temp;
|
|
212
|
+
temp = dx;
|
|
213
|
+
dx = dy;
|
|
214
|
+
dy = temp;
|
|
215
|
+
}
|
|
216
|
+
return Math.atan2(dy, dx) - Math.atan2(prevDy, prevDx);
|
|
217
|
+
},
|
|
218
|
+
/**
|
|
219
|
+
* Map mouse move event to the distance between two following events.
|
|
220
|
+
*/
|
|
221
|
+
mouseMoveToTranslation: function (e) {
|
|
222
|
+
var dx = e.chartX - e.prevChartX,
|
|
223
|
+
dy = e.chartY - e.prevChartY,
|
|
224
|
+
temp;
|
|
225
|
+
if (this.chart.inverted) {
|
|
226
|
+
temp = dy;
|
|
227
|
+
dy = dx;
|
|
228
|
+
dx = temp;
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
x: dx,
|
|
232
|
+
y: dy
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Map mouse move to the scale factors.
|
|
237
|
+
*
|
|
238
|
+
* @param {Object} e event
|
|
239
|
+
* @param {number} cx center x
|
|
240
|
+
* @param {number} cy center y
|
|
241
|
+
**/
|
|
242
|
+
mouseMoveToScale: function (e, cx, cy) {
|
|
243
|
+
var prevDx = e.prevChartX - cx,
|
|
244
|
+
prevDy = e.prevChartY - cy,
|
|
245
|
+
dx = e.chartX - cx,
|
|
246
|
+
dy = e.chartY - cy,
|
|
247
|
+
sx = (dx || 1) / (prevDx || 1),
|
|
248
|
+
sy = (dy || 1) / (prevDy || 1),
|
|
249
|
+
temp;
|
|
250
|
+
if (this.chart.inverted) {
|
|
251
|
+
temp = sy;
|
|
252
|
+
sy = sx;
|
|
253
|
+
sx = temp;
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
x: sx,
|
|
257
|
+
y: sy
|
|
258
|
+
};
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* Destroy the event emitter.
|
|
262
|
+
*/
|
|
263
|
+
destroy: function () {
|
|
264
|
+
this.removeDocEvents();
|
|
265
|
+
removeEvent(this);
|
|
266
|
+
this.hcEvents = null;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
return eventEmitterMixin;
|
|
271
|
+
});
|
|
272
|
+
_registerModule(_modules, 'Extensions/Annotations/ControlPoint.js', [_modules['Core/Utilities.js'], _modules['Extensions/Annotations/Mixins/EventEmitterMixin.js']], function (U, eventEmitterMixin) {
|
|
273
|
+
/* *
|
|
274
|
+
*
|
|
275
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
276
|
+
*
|
|
277
|
+
* */
|
|
278
|
+
/**
|
|
279
|
+
* Callback to modify annotation's possitioner controls.
|
|
280
|
+
*
|
|
281
|
+
* @callback Highcharts.AnnotationControlPointPositionerFunction
|
|
282
|
+
* @param {Highcharts.AnnotationControlPoint} this
|
|
283
|
+
* @param {Highcharts.AnnotationControllable} target
|
|
284
|
+
* @return {Highcharts.PositionObject}
|
|
285
|
+
*/
|
|
286
|
+
var extend = U.extend,
|
|
287
|
+
merge = U.merge,
|
|
288
|
+
pick = U.pick;
|
|
289
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
290
|
+
/**
|
|
291
|
+
* A control point class which is a connection between controllable
|
|
292
|
+
* transform methods and a user actions.
|
|
293
|
+
*
|
|
294
|
+
* @requires modules/annotations
|
|
295
|
+
*
|
|
296
|
+
* @class
|
|
297
|
+
* @name Highcharts.AnnotationControlPoint
|
|
298
|
+
*
|
|
299
|
+
* @hideconstructor
|
|
300
|
+
*
|
|
301
|
+
* @param {Highcharts.Chart} chart
|
|
302
|
+
* A chart instance.
|
|
303
|
+
*
|
|
304
|
+
* @param {Highcharts.AnnotationControllable} target
|
|
305
|
+
* A controllable instance which is a target for a control point.
|
|
306
|
+
*
|
|
307
|
+
* @param {Highcharts.AnnotationControlPointOptionsObject} options
|
|
308
|
+
* An options object.
|
|
309
|
+
*
|
|
310
|
+
* @param {number} [index]
|
|
311
|
+
* Point index.
|
|
312
|
+
*/
|
|
313
|
+
var ControlPoint = /** @class */ (function () {
|
|
314
|
+
function ControlPoint(chart, target, options, index) {
|
|
315
|
+
/**
|
|
316
|
+
*
|
|
317
|
+
* Properties
|
|
318
|
+
*
|
|
319
|
+
*/
|
|
320
|
+
this.addEvents = eventEmitterMixin.addEvents;
|
|
321
|
+
this.graphic = void 0;
|
|
322
|
+
this.mouseMoveToRadians = eventEmitterMixin.mouseMoveToRadians;
|
|
323
|
+
this.mouseMoveToScale = eventEmitterMixin.mouseMoveToScale;
|
|
324
|
+
this.mouseMoveToTranslation = eventEmitterMixin.mouseMoveToTranslation;
|
|
325
|
+
this.onDrag = eventEmitterMixin.onDrag;
|
|
326
|
+
this.onMouseDown = eventEmitterMixin.onMouseDown;
|
|
327
|
+
this.onMouseUp = eventEmitterMixin.onMouseUp;
|
|
328
|
+
this.removeDocEvents = eventEmitterMixin.removeDocEvents;
|
|
329
|
+
/**
|
|
330
|
+
*
|
|
331
|
+
* Functions
|
|
332
|
+
*
|
|
333
|
+
*/
|
|
334
|
+
/**
|
|
335
|
+
* List of events for `anntation.options.events` that should not be
|
|
336
|
+
* added to `annotation.graphic` but to the `annotation`.
|
|
337
|
+
* @private
|
|
338
|
+
* @name Highcharts.AnnotationControlPoint#nonDOMEvents
|
|
339
|
+
* @type {Array<string>}
|
|
340
|
+
*/
|
|
341
|
+
this.nonDOMEvents = ['drag'];
|
|
342
|
+
this.chart = chart;
|
|
343
|
+
this.target = target;
|
|
344
|
+
this.options = options;
|
|
345
|
+
this.index = pick(options.index, index);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Set the visibility of the control point.
|
|
349
|
+
*
|
|
350
|
+
* @function Highcharts.AnnotationControlPoint#setVisibility
|
|
351
|
+
*
|
|
352
|
+
* @param {boolean} visible
|
|
353
|
+
* Visibility of the control point.
|
|
354
|
+
*
|
|
355
|
+
* @return {void}
|
|
356
|
+
*/
|
|
357
|
+
ControlPoint.prototype.setVisibility = function (visible) {
|
|
358
|
+
this.graphic.attr('visibility', visible ? 'visible' : 'hidden');
|
|
359
|
+
this.options.visible = visible;
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Render the control point.
|
|
363
|
+
* @private
|
|
364
|
+
*/
|
|
365
|
+
ControlPoint.prototype.render = function () {
|
|
366
|
+
var chart = this.chart,
|
|
367
|
+
options = this.options;
|
|
368
|
+
this.graphic = chart.renderer
|
|
369
|
+
.symbol(options.symbol, 0, 0, options.width, options.height)
|
|
370
|
+
.add(chart.controlPointsGroup)
|
|
371
|
+
.css(options.style);
|
|
372
|
+
this.setVisibility(options.visible);
|
|
373
|
+
// npm test -- --tests "highcharts/annotations-advanced/*"
|
|
374
|
+
this.addEvents();
|
|
375
|
+
};
|
|
376
|
+
/**
|
|
377
|
+
* Redraw the control point.
|
|
378
|
+
* @private
|
|
379
|
+
* @param {boolean} [animation]
|
|
380
|
+
*/
|
|
381
|
+
ControlPoint.prototype.redraw = function (animation) {
|
|
382
|
+
this.graphic[animation ? 'animate' : 'attr'](this.options.positioner.call(this, this.target));
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Destroy the control point.
|
|
386
|
+
* @private
|
|
387
|
+
*/
|
|
388
|
+
ControlPoint.prototype.destroy = function () {
|
|
389
|
+
eventEmitterMixin.destroy.call(this);
|
|
390
|
+
if (this.graphic) {
|
|
391
|
+
this.graphic = this.graphic.destroy();
|
|
392
|
+
}
|
|
393
|
+
this.chart = null;
|
|
394
|
+
this.target = null;
|
|
395
|
+
this.options = null;
|
|
396
|
+
};
|
|
397
|
+
/**
|
|
398
|
+
* Update the control point.
|
|
399
|
+
*
|
|
400
|
+
* @function Highcharts.AnnotationControlPoint#update
|
|
401
|
+
*
|
|
402
|
+
* @param {Partial<Highcharts.AnnotationControlPointOptionsObject>} userOptions
|
|
403
|
+
* New options for the control point.
|
|
404
|
+
*
|
|
405
|
+
* @return {void}
|
|
406
|
+
*/
|
|
407
|
+
ControlPoint.prototype.update = function (userOptions) {
|
|
408
|
+
var chart = this.chart,
|
|
409
|
+
target = this.target,
|
|
410
|
+
index = this.index,
|
|
411
|
+
options = merge(true,
|
|
412
|
+
this.options,
|
|
413
|
+
userOptions);
|
|
414
|
+
this.destroy();
|
|
415
|
+
this.constructor(chart, target, options, index);
|
|
416
|
+
this.render(chart.controlPointsGroup);
|
|
417
|
+
this.redraw();
|
|
418
|
+
};
|
|
419
|
+
return ControlPoint;
|
|
420
|
+
}());
|
|
421
|
+
|
|
422
|
+
return ControlPoint;
|
|
423
|
+
});
|
|
424
|
+
_registerModule(_modules, 'Extensions/Annotations/MockPoint.js', [_modules['Core/Globals.js'], _modules['Core/Utilities.js'], _modules['Core/Axis/Axis.js']], function (H, U, Axis) {
|
|
425
|
+
/* *
|
|
426
|
+
*
|
|
427
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
428
|
+
*
|
|
429
|
+
* */
|
|
430
|
+
/**
|
|
431
|
+
* @private
|
|
432
|
+
* @interface Highcharts.AnnotationMockLabelOptionsObject
|
|
433
|
+
*/ /**
|
|
434
|
+
* Point instance of the point.
|
|
435
|
+
* @name Highcharts.AnnotationMockLabelOptionsObject#point
|
|
436
|
+
* @type {Highcharts.AnnotationMockPoint}
|
|
437
|
+
*/ /**
|
|
438
|
+
* X value translated to x axis scale.
|
|
439
|
+
* @name Highcharts.AnnotationMockLabelOptionsObject#x
|
|
440
|
+
* @type {number|null}
|
|
441
|
+
*/ /**
|
|
442
|
+
* Y value translated to y axis scale.
|
|
443
|
+
* @name Highcharts.AnnotationMockLabelOptionsObject#y
|
|
444
|
+
* @type {number|null}
|
|
445
|
+
*/
|
|
446
|
+
/**
|
|
447
|
+
* A mock series instance imitating a real series from a real point.
|
|
448
|
+
* @private
|
|
449
|
+
* @interface Highcharts.AnnotationMockSeries
|
|
450
|
+
*/ /**
|
|
451
|
+
* Whether a series is visible.
|
|
452
|
+
* @name Highcharts.AnnotationMockSeries#visible
|
|
453
|
+
* @type {boolean}
|
|
454
|
+
*/ /**
|
|
455
|
+
* A chart instance.
|
|
456
|
+
* @name Highcharts.AnnotationMockSeries#chart
|
|
457
|
+
* @type {Highcharts.Chart}
|
|
458
|
+
*/ /**
|
|
459
|
+
* @name Highcharts.AnnotationMockSeries#getPlotBox
|
|
460
|
+
* @type {Function}
|
|
461
|
+
*/
|
|
462
|
+
/**
|
|
463
|
+
* Indicates if this is a mock point for an annotation.
|
|
464
|
+
* @name Highcharts.Point#mock
|
|
465
|
+
* @type {boolean|undefined}
|
|
466
|
+
*/
|
|
467
|
+
var defined = U.defined,
|
|
468
|
+
extend = U.extend,
|
|
469
|
+
fireEvent = U.fireEvent;
|
|
470
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
471
|
+
/**
|
|
472
|
+
* A trimmed point object which imitates {@link Highchart.Point} class. It is
|
|
473
|
+
* created when there is a need of pointing to some chart's position using axis
|
|
474
|
+
* values or pixel values
|
|
475
|
+
*
|
|
476
|
+
* @requires modules/annotations
|
|
477
|
+
*
|
|
478
|
+
* @private
|
|
479
|
+
* @class
|
|
480
|
+
* @name Highcharts.AnnotationMockPoint
|
|
481
|
+
*
|
|
482
|
+
* @hideconstructor
|
|
483
|
+
*
|
|
484
|
+
* @param {Highcharts.Chart} chart
|
|
485
|
+
* The chart instance.
|
|
486
|
+
*
|
|
487
|
+
* @param {Highcharts.AnnotationControllable|null} target
|
|
488
|
+
* The related controllable.
|
|
489
|
+
*
|
|
490
|
+
* @param {Highcharts.AnnotationMockPointOptionsObject|Function} options
|
|
491
|
+
* The options object.
|
|
492
|
+
*/
|
|
493
|
+
var MockPoint = /** @class */ (function () {
|
|
494
|
+
function MockPoint(chart, target, options) {
|
|
495
|
+
this.isInside = void 0;
|
|
496
|
+
this.plotX = void 0;
|
|
497
|
+
this.plotY = void 0;
|
|
498
|
+
this.x = void 0;
|
|
499
|
+
this.y = void 0;
|
|
500
|
+
/* *
|
|
501
|
+
*
|
|
502
|
+
* Functions
|
|
503
|
+
*
|
|
504
|
+
* */
|
|
505
|
+
/**
|
|
506
|
+
* A flag indicating that a point is not the real one.
|
|
507
|
+
*
|
|
508
|
+
* @type {boolean}
|
|
509
|
+
* @default true
|
|
510
|
+
*/
|
|
511
|
+
this.mock = true;
|
|
512
|
+
/**
|
|
513
|
+
* A mock series instance imitating a real series from a real point.
|
|
514
|
+
*
|
|
515
|
+
* @name Annotation.AnnotationMockPoint#series
|
|
516
|
+
* @type {Highcharts.AnnotationMockSeries}
|
|
517
|
+
*/
|
|
518
|
+
this.series = {
|
|
519
|
+
visible: true,
|
|
520
|
+
chart: chart,
|
|
521
|
+
getPlotBox: H.Series.prototype.getPlotBox
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* @name Annotation.AnnotationMockPoint#target
|
|
525
|
+
* @type {Highcharts.AnnotationControllable|null}
|
|
526
|
+
*/
|
|
527
|
+
this.target = target || null;
|
|
528
|
+
/**
|
|
529
|
+
* Options for the mock point.
|
|
530
|
+
*
|
|
531
|
+
* @name Annotation.AnnotationMockPoint#options
|
|
532
|
+
* @type {Highcharts.AnnotationsMockPointOptionsObject}
|
|
533
|
+
*/
|
|
534
|
+
this.options = options;
|
|
535
|
+
/**
|
|
536
|
+
* If an xAxis is set it represents the point's value in terms of the
|
|
537
|
+
* xAxis.
|
|
538
|
+
*
|
|
539
|
+
* @name Annotation.AnnotationMockPoint#x
|
|
540
|
+
* @type {number|undefined}
|
|
541
|
+
*/
|
|
542
|
+
/**
|
|
543
|
+
* If an yAxis is set it represents the point's value in terms of the
|
|
544
|
+
* yAxis.
|
|
545
|
+
*
|
|
546
|
+
* @name Annotation.AnnotationMockPoint#y
|
|
547
|
+
* @type {number|undefined}
|
|
548
|
+
*/
|
|
549
|
+
/**
|
|
550
|
+
* It represents the point's pixel x coordinate relative to its plot
|
|
551
|
+
* box.
|
|
552
|
+
*
|
|
553
|
+
* @name Annotation.AnnotationMockPoint#plotX
|
|
554
|
+
* @type {number|undefined}
|
|
555
|
+
*/
|
|
556
|
+
/**
|
|
557
|
+
* It represents the point's pixel y position relative to its plot box.
|
|
558
|
+
*
|
|
559
|
+
* @name Annotation.AnnotationMockPoint#plotY
|
|
560
|
+
* @type {number|undefined}
|
|
561
|
+
*/
|
|
562
|
+
/**
|
|
563
|
+
* Whether the point is inside the plot box.
|
|
564
|
+
*
|
|
565
|
+
* @name Annotation.AnnotationMockPoint#isInside
|
|
566
|
+
* @type {boolean|undefined}
|
|
567
|
+
*/
|
|
568
|
+
this.applyOptions(this.getOptions());
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Create a mock point from a real Highcharts point.
|
|
572
|
+
*
|
|
573
|
+
* @private
|
|
574
|
+
* @static
|
|
575
|
+
*
|
|
576
|
+
* @param {Highcharts.Point} point
|
|
577
|
+
*
|
|
578
|
+
* @return {Highcharts.AnnotationMockPoint}
|
|
579
|
+
* A mock point instance.
|
|
580
|
+
*/
|
|
581
|
+
MockPoint.fromPoint = function (point) {
|
|
582
|
+
return new MockPoint(point.series.chart, null, {
|
|
583
|
+
x: point.x,
|
|
584
|
+
y: point.y,
|
|
585
|
+
xAxis: point.series.xAxis,
|
|
586
|
+
yAxis: point.series.yAxis
|
|
587
|
+
});
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* Get the pixel position from the point like object.
|
|
591
|
+
*
|
|
592
|
+
* @private
|
|
593
|
+
* @static
|
|
594
|
+
*
|
|
595
|
+
* @param {Highcharts.AnnotationPointType} point
|
|
596
|
+
*
|
|
597
|
+
* @param {boolean} [paneCoordinates]
|
|
598
|
+
* whether the pixel position should be relative
|
|
599
|
+
*
|
|
600
|
+
* @return {Highcharts.PositionObject} pixel position
|
|
601
|
+
*/
|
|
602
|
+
MockPoint.pointToPixels = function (point, paneCoordinates) {
|
|
603
|
+
var series = point.series,
|
|
604
|
+
chart = series.chart,
|
|
605
|
+
x = point.plotX,
|
|
606
|
+
y = point.plotY,
|
|
607
|
+
plotBox;
|
|
608
|
+
if (chart.inverted) {
|
|
609
|
+
if (point.mock) {
|
|
610
|
+
x = point.plotY;
|
|
611
|
+
y = point.plotX;
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
x = chart.plotWidth - point.plotY;
|
|
615
|
+
y = chart.plotHeight - point.plotX;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
if (series && !paneCoordinates) {
|
|
619
|
+
plotBox = series.getPlotBox();
|
|
620
|
+
x += plotBox.translateX;
|
|
621
|
+
y += plotBox.translateY;
|
|
622
|
+
}
|
|
623
|
+
return {
|
|
624
|
+
x: x,
|
|
625
|
+
y: y
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* Get fresh mock point options from the point like object.
|
|
630
|
+
*
|
|
631
|
+
* @private
|
|
632
|
+
* @static
|
|
633
|
+
*
|
|
634
|
+
* @param {Highcharts.AnnotationPointType} point
|
|
635
|
+
*
|
|
636
|
+
* @return {Highcharts.AnnotationMockPointOptionsObject}
|
|
637
|
+
* A mock point's options.
|
|
638
|
+
*/
|
|
639
|
+
MockPoint.pointToOptions = function (point) {
|
|
640
|
+
return {
|
|
641
|
+
x: point.x,
|
|
642
|
+
y: point.y,
|
|
643
|
+
xAxis: point.series.xAxis,
|
|
644
|
+
yAxis: point.series.yAxis
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* Check if the point has dynamic options.
|
|
649
|
+
* @private
|
|
650
|
+
* @return {boolean}
|
|
651
|
+
* A positive flag if the point has dynamic options.
|
|
652
|
+
*/
|
|
653
|
+
MockPoint.prototype.hasDynamicOptions = function () {
|
|
654
|
+
return typeof this.options === 'function';
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* Get the point's options.
|
|
658
|
+
* @private
|
|
659
|
+
* @return {Highcharts.AnnotationMockPointOptionsObject}
|
|
660
|
+
* The mock point's options.
|
|
661
|
+
*/
|
|
662
|
+
MockPoint.prototype.getOptions = function () {
|
|
663
|
+
return this.hasDynamicOptions() ?
|
|
664
|
+
this.options(this.target) :
|
|
665
|
+
this.options;
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* Apply options for the point.
|
|
669
|
+
* @private
|
|
670
|
+
* @param {Highcharts.AnnotationMockPointOptionsObject} options
|
|
671
|
+
*/
|
|
672
|
+
MockPoint.prototype.applyOptions = function (options) {
|
|
673
|
+
this.command = options.command;
|
|
674
|
+
this.setAxis(options, 'x');
|
|
675
|
+
this.setAxis(options, 'y');
|
|
676
|
+
this.refresh();
|
|
677
|
+
};
|
|
678
|
+
/**
|
|
679
|
+
* Set x or y axis.
|
|
680
|
+
* @private
|
|
681
|
+
* @param {Highcharts.AnnotationMockPointOptionsObject} options
|
|
682
|
+
* @param {string} xOrY
|
|
683
|
+
* 'x' or 'y' string literal
|
|
684
|
+
*/
|
|
685
|
+
MockPoint.prototype.setAxis = function (options, xOrY) {
|
|
686
|
+
var axisName = (xOrY + 'Axis'),
|
|
687
|
+
axisOptions = options[axisName],
|
|
688
|
+
chart = this.series.chart;
|
|
689
|
+
this.series[axisName] =
|
|
690
|
+
axisOptions instanceof Axis ?
|
|
691
|
+
axisOptions :
|
|
692
|
+
defined(axisOptions) ?
|
|
693
|
+
(chart[axisName][axisOptions] ||
|
|
694
|
+
chart.get(axisOptions)) :
|
|
695
|
+
null;
|
|
696
|
+
};
|
|
697
|
+
/**
|
|
698
|
+
* Transform the mock point to an anchor (relative position on the chart).
|
|
699
|
+
* @private
|
|
700
|
+
* @return {Array<number>}
|
|
701
|
+
* A quadruple of numbers which denotes x, y, width and height of the box
|
|
702
|
+
**/
|
|
703
|
+
MockPoint.prototype.toAnchor = function () {
|
|
704
|
+
var anchor = [this.plotX,
|
|
705
|
+
this.plotY, 0, 0];
|
|
706
|
+
if (this.series.chart.inverted) {
|
|
707
|
+
anchor[0] = this.plotY;
|
|
708
|
+
anchor[1] = this.plotX;
|
|
709
|
+
}
|
|
710
|
+
return anchor;
|
|
711
|
+
};
|
|
712
|
+
/**
|
|
713
|
+
* Returns a label config object - the same as
|
|
714
|
+
* Highcharts.Point.prototype.getLabelConfig
|
|
715
|
+
* @private
|
|
716
|
+
* @return {Highcharts.AnnotationMockLabelOptionsObject} the point's label config
|
|
717
|
+
*/
|
|
718
|
+
MockPoint.prototype.getLabelConfig = function () {
|
|
719
|
+
return {
|
|
720
|
+
x: this.x,
|
|
721
|
+
y: this.y,
|
|
722
|
+
point: this
|
|
723
|
+
};
|
|
724
|
+
};
|
|
725
|
+
/**
|
|
726
|
+
* Check if the point is inside its pane.
|
|
727
|
+
* @private
|
|
728
|
+
* @return {boolean} A flag indicating whether the point is inside the pane.
|
|
729
|
+
*/
|
|
730
|
+
MockPoint.prototype.isInsidePlot = function () {
|
|
731
|
+
var plotX = this.plotX,
|
|
732
|
+
plotY = this.plotY,
|
|
733
|
+
xAxis = this.series.xAxis,
|
|
734
|
+
yAxis = this.series.yAxis,
|
|
735
|
+
e = {
|
|
736
|
+
x: plotX,
|
|
737
|
+
y: plotY,
|
|
738
|
+
isInsidePlot: true
|
|
739
|
+
};
|
|
740
|
+
if (xAxis) {
|
|
741
|
+
e.isInsidePlot = defined(plotX) && plotX >= 0 && plotX <= xAxis.len;
|
|
742
|
+
}
|
|
743
|
+
if (yAxis) {
|
|
744
|
+
e.isInsidePlot =
|
|
745
|
+
e.isInsidePlot &&
|
|
746
|
+
defined(plotY) &&
|
|
747
|
+
plotY >= 0 && plotY <= yAxis.len;
|
|
748
|
+
}
|
|
749
|
+
fireEvent(this.series.chart, 'afterIsInsidePlot', e);
|
|
750
|
+
return e.isInsidePlot;
|
|
751
|
+
};
|
|
752
|
+
/**
|
|
753
|
+
* Refresh point values and coordinates based on its options.
|
|
754
|
+
* @private
|
|
755
|
+
*/
|
|
756
|
+
MockPoint.prototype.refresh = function () {
|
|
757
|
+
var series = this.series,
|
|
758
|
+
xAxis = series.xAxis,
|
|
759
|
+
yAxis = series.yAxis,
|
|
760
|
+
options = this.getOptions();
|
|
761
|
+
if (xAxis) {
|
|
762
|
+
this.x = options.x;
|
|
763
|
+
this.plotX = xAxis.toPixels(options.x, true);
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
this.x = null;
|
|
767
|
+
this.plotX = options.x;
|
|
768
|
+
}
|
|
769
|
+
if (yAxis) {
|
|
770
|
+
this.y = options.y;
|
|
771
|
+
this.plotY = yAxis.toPixels(options.y, true);
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
this.y = null;
|
|
775
|
+
this.plotY = options.y;
|
|
776
|
+
}
|
|
777
|
+
this.isInside = this.isInsidePlot();
|
|
778
|
+
};
|
|
779
|
+
/**
|
|
780
|
+
* Translate the point.
|
|
781
|
+
*
|
|
782
|
+
* @private
|
|
783
|
+
*
|
|
784
|
+
* @param {number|undefined} cx
|
|
785
|
+
* Origin x transformation.
|
|
786
|
+
*
|
|
787
|
+
* @param {number|undefined} cy
|
|
788
|
+
* Origin y transformation.
|
|
789
|
+
*
|
|
790
|
+
* @param {number} dx
|
|
791
|
+
* Translation for x coordinate.
|
|
792
|
+
*
|
|
793
|
+
* @param {number} dy
|
|
794
|
+
* Translation for y coordinate.
|
|
795
|
+
**/
|
|
796
|
+
MockPoint.prototype.translate = function (_cx, _cy, dx, dy) {
|
|
797
|
+
if (!this.hasDynamicOptions()) {
|
|
798
|
+
this.plotX += dx;
|
|
799
|
+
this.plotY += dy;
|
|
800
|
+
this.refreshOptions();
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
/**
|
|
804
|
+
* Scale the point.
|
|
805
|
+
*
|
|
806
|
+
* @private
|
|
807
|
+
*
|
|
808
|
+
* @param {number} cx
|
|
809
|
+
* Origin x transformation.
|
|
810
|
+
*
|
|
811
|
+
* @param {number} cy
|
|
812
|
+
* Origin y transformation.
|
|
813
|
+
*
|
|
814
|
+
* @param {number} sx
|
|
815
|
+
* Scale factor x.
|
|
816
|
+
*
|
|
817
|
+
* @param {number} sy
|
|
818
|
+
* Scale factor y.
|
|
819
|
+
*/
|
|
820
|
+
MockPoint.prototype.scale = function (cx, cy, sx, sy) {
|
|
821
|
+
if (!this.hasDynamicOptions()) {
|
|
822
|
+
var x = this.plotX * sx,
|
|
823
|
+
y = this.plotY * sy,
|
|
824
|
+
tx = (1 - sx) * cx,
|
|
825
|
+
ty = (1 - sy) * cy;
|
|
826
|
+
this.plotX = tx + x;
|
|
827
|
+
this.plotY = ty + y;
|
|
828
|
+
this.refreshOptions();
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
/**
|
|
832
|
+
* Rotate the point.
|
|
833
|
+
* @private
|
|
834
|
+
* @param {number} cx origin x rotation
|
|
835
|
+
* @param {number} cy origin y rotation
|
|
836
|
+
* @param {number} radians
|
|
837
|
+
*/
|
|
838
|
+
MockPoint.prototype.rotate = function (cx, cy, radians) {
|
|
839
|
+
if (!this.hasDynamicOptions()) {
|
|
840
|
+
var cos = Math.cos(radians),
|
|
841
|
+
sin = Math.sin(radians),
|
|
842
|
+
x = this.plotX,
|
|
843
|
+
y = this.plotY,
|
|
844
|
+
tx,
|
|
845
|
+
ty;
|
|
846
|
+
x -= cx;
|
|
847
|
+
y -= cy;
|
|
848
|
+
tx = x * cos - y * sin;
|
|
849
|
+
ty = x * sin + y * cos;
|
|
850
|
+
this.plotX = tx + cx;
|
|
851
|
+
this.plotY = ty + cy;
|
|
852
|
+
this.refreshOptions();
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Refresh point options based on its plot coordinates.
|
|
857
|
+
* @private
|
|
858
|
+
*/
|
|
859
|
+
MockPoint.prototype.refreshOptions = function () {
|
|
860
|
+
var series = this.series,
|
|
861
|
+
xAxis = series.xAxis,
|
|
862
|
+
yAxis = series.yAxis;
|
|
863
|
+
this.x = this.options.x = xAxis ?
|
|
864
|
+
this.options.x = xAxis.toValue(this.plotX, true) :
|
|
865
|
+
this.plotX;
|
|
866
|
+
this.y = this.options.y = yAxis ?
|
|
867
|
+
yAxis.toValue(this.plotY, true) :
|
|
868
|
+
this.plotY;
|
|
869
|
+
};
|
|
870
|
+
return MockPoint;
|
|
871
|
+
}());
|
|
872
|
+
|
|
873
|
+
return MockPoint;
|
|
874
|
+
});
|
|
875
|
+
_registerModule(_modules, 'Extensions/Annotations/Mixins/ControllableMixin.js', [_modules['Extensions/Annotations/ControlPoint.js'], _modules['Extensions/Annotations/MockPoint.js'], _modules['Core/Tooltip.js'], _modules['Core/Utilities.js']], function (ControlPoint, MockPoint, Tooltip, U) {
|
|
876
|
+
/* *
|
|
877
|
+
*
|
|
878
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
879
|
+
*
|
|
880
|
+
* */
|
|
881
|
+
var isObject = U.isObject,
|
|
882
|
+
isString = U.isString,
|
|
883
|
+
merge = U.merge,
|
|
884
|
+
splat = U.splat;
|
|
885
|
+
/**
|
|
886
|
+
* An object which denots a controllable's anchor positions - relative and
|
|
887
|
+
* absolute.
|
|
888
|
+
*
|
|
889
|
+
* @private
|
|
890
|
+
* @interface Highcharts.AnnotationAnchorObject
|
|
891
|
+
*/ /**
|
|
892
|
+
* Relative to the plot area position
|
|
893
|
+
* @name Highcharts.AnnotationAnchorObject#relativePosition
|
|
894
|
+
* @type {Highcharts.BBoxObject}
|
|
895
|
+
*/ /**
|
|
896
|
+
* Absolute position
|
|
897
|
+
* @name Highcharts.AnnotationAnchorObject#absolutePosition
|
|
898
|
+
* @type {Highcharts.BBoxObject}
|
|
899
|
+
*/
|
|
900
|
+
/**
|
|
901
|
+
* @interface Highcharts.AnnotationControllable
|
|
902
|
+
*/ /**
|
|
903
|
+
* @name Highcharts.AnnotationControllable#annotation
|
|
904
|
+
* @type {Highcharts.Annotation}
|
|
905
|
+
*/ /**
|
|
906
|
+
* @name Highcharts.AnnotationControllable#chart
|
|
907
|
+
* @type {Highcharts.Chart}
|
|
908
|
+
*/ /**
|
|
909
|
+
* @name Highcharts.AnnotationControllable#collection
|
|
910
|
+
* @type {string}
|
|
911
|
+
*/ /**
|
|
912
|
+
* @private
|
|
913
|
+
* @name Highcharts.AnnotationControllable#controlPoints
|
|
914
|
+
* @type {Array<Highcharts.AnnotationControlPoint>}
|
|
915
|
+
*/ /**
|
|
916
|
+
* @name Highcharts.AnnotationControllable#points
|
|
917
|
+
* @type {Array<Highcharts.Point>}
|
|
918
|
+
*/
|
|
919
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
920
|
+
/**
|
|
921
|
+
* It provides methods for handling points, control points
|
|
922
|
+
* and points transformations.
|
|
923
|
+
*
|
|
924
|
+
* @private
|
|
925
|
+
* @mixin
|
|
926
|
+
* @name Highcharts.AnnotationControllableMixin
|
|
927
|
+
*/
|
|
928
|
+
var controllableMixin = {
|
|
929
|
+
/**
|
|
930
|
+
* Init the controllable
|
|
931
|
+
*/
|
|
932
|
+
init: function (annotation,
|
|
933
|
+
options,
|
|
934
|
+
index) {
|
|
935
|
+
this.annotation = annotation;
|
|
936
|
+
this.chart = annotation.chart;
|
|
937
|
+
this.options = options;
|
|
938
|
+
this.points = [];
|
|
939
|
+
this.controlPoints = [];
|
|
940
|
+
this.index = index;
|
|
941
|
+
this.linkPoints();
|
|
942
|
+
this.addControlPoints();
|
|
943
|
+
},
|
|
944
|
+
/**
|
|
945
|
+
* Redirect attr usage on the controllable graphic element.
|
|
946
|
+
*/
|
|
947
|
+
attr: function () {
|
|
948
|
+
this.graphic.attr.apply(this.graphic, arguments);
|
|
949
|
+
},
|
|
950
|
+
/**
|
|
951
|
+
* Get the controllable's points options.
|
|
952
|
+
*
|
|
953
|
+
* @return {Array<Highcharts.PointOptionsObject>}
|
|
954
|
+
* An array of points' options.
|
|
955
|
+
*/
|
|
956
|
+
getPointsOptions: function () {
|
|
957
|
+
var options = this.options;
|
|
958
|
+
return (options.points || (options.point && splat(options.point)));
|
|
959
|
+
},
|
|
960
|
+
/**
|
|
961
|
+
* Utility function for mapping item's options
|
|
962
|
+
* to element's attribute
|
|
963
|
+
*
|
|
964
|
+
* @param {Highcharts.AnnotationsLabelsOptions|Highcharts.AnnotationsShapesOptions} options
|
|
965
|
+
*
|
|
966
|
+
* @return {Highcharts.SVGAttributes}
|
|
967
|
+
* Mapped options.
|
|
968
|
+
*/
|
|
969
|
+
attrsFromOptions: function (options) {
|
|
970
|
+
var map = this.constructor.attrsMap,
|
|
971
|
+
attrs = {},
|
|
972
|
+
key,
|
|
973
|
+
mappedKey,
|
|
974
|
+
styledMode = this.chart.styledMode;
|
|
975
|
+
for (key in options) { // eslint-disable-line guard-for-in
|
|
976
|
+
mappedKey = map[key];
|
|
977
|
+
if (mappedKey &&
|
|
978
|
+
(!styledMode ||
|
|
979
|
+
['fill', 'stroke', 'stroke-width']
|
|
980
|
+
.indexOf(mappedKey) === -1)) {
|
|
981
|
+
attrs[mappedKey] = options[key];
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return attrs;
|
|
985
|
+
},
|
|
986
|
+
/**
|
|
987
|
+
* Returns object which denotes anchor position - relative and absolute.
|
|
988
|
+
*
|
|
989
|
+
* @param {Highcharts.AnnotationPointType} point
|
|
990
|
+
* A point like object.
|
|
991
|
+
*
|
|
992
|
+
* @return {Highcharts.AnnotationAnchorObject} a controllable anchor
|
|
993
|
+
*/
|
|
994
|
+
anchor: function (point) {
|
|
995
|
+
var plotBox = point.series.getPlotBox(),
|
|
996
|
+
chart = point.series.chart,
|
|
997
|
+
box = point.mock ?
|
|
998
|
+
point.toAnchor() :
|
|
999
|
+
Tooltip.prototype.getAnchor.call({
|
|
1000
|
+
chart: point.series.chart
|
|
1001
|
+
},
|
|
1002
|
+
point),
|
|
1003
|
+
anchor = {
|
|
1004
|
+
x: box[0] + (this.options.x || 0),
|
|
1005
|
+
y: box[1] + (this.options.y || 0),
|
|
1006
|
+
height: box[2] || 0,
|
|
1007
|
+
width: box[3] || 0
|
|
1008
|
+
};
|
|
1009
|
+
return {
|
|
1010
|
+
relativePosition: anchor,
|
|
1011
|
+
absolutePosition: merge(anchor, {
|
|
1012
|
+
x: anchor.x + (point.mock ? plotBox.translateX : chart.plotLeft),
|
|
1013
|
+
y: anchor.y + (point.mock ? plotBox.translateY : chart.plotTop)
|
|
1014
|
+
})
|
|
1015
|
+
};
|
|
1016
|
+
},
|
|
1017
|
+
/**
|
|
1018
|
+
* Map point's options to a point-like object.
|
|
1019
|
+
*
|
|
1020
|
+
* @param {string|Function|Highcharts.AnnotationMockPointOptionsObject|Highcharts.AnnotationPointType} pointOptions
|
|
1021
|
+
* Point's options.
|
|
1022
|
+
*
|
|
1023
|
+
* @param {Highcharts.AnnotationPointType} point
|
|
1024
|
+
* A point-like instance.
|
|
1025
|
+
*
|
|
1026
|
+
* @return {Highcharts.AnnotationPointType|null}
|
|
1027
|
+
* if the point is found/set returns this point, otherwise null
|
|
1028
|
+
*/
|
|
1029
|
+
point: function (pointOptions, point) {
|
|
1030
|
+
if (pointOptions && pointOptions.series) {
|
|
1031
|
+
return pointOptions;
|
|
1032
|
+
}
|
|
1033
|
+
if (!point || point.series === null) {
|
|
1034
|
+
if (isObject(pointOptions)) {
|
|
1035
|
+
point = new MockPoint(this.chart, this, pointOptions);
|
|
1036
|
+
}
|
|
1037
|
+
else if (isString(pointOptions)) {
|
|
1038
|
+
point = this.chart.get(pointOptions) || null;
|
|
1039
|
+
}
|
|
1040
|
+
else if (typeof pointOptions === 'function') {
|
|
1041
|
+
var pointConfig = pointOptions.call(point,
|
|
1042
|
+
this);
|
|
1043
|
+
point = pointConfig.series ?
|
|
1044
|
+
pointConfig :
|
|
1045
|
+
new MockPoint(this.chart, this, pointOptions);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return point;
|
|
1049
|
+
},
|
|
1050
|
+
/**
|
|
1051
|
+
* Find point-like objects based on points options.
|
|
1052
|
+
*
|
|
1053
|
+
* @return {Array<Annotation.PointLike>} an array of point-like objects
|
|
1054
|
+
*/
|
|
1055
|
+
linkPoints: function () {
|
|
1056
|
+
var pointsOptions = this.getPointsOptions(),
|
|
1057
|
+
points = this.points,
|
|
1058
|
+
len = (pointsOptions && pointsOptions.length) || 0,
|
|
1059
|
+
i,
|
|
1060
|
+
point;
|
|
1061
|
+
for (i = 0; i < len; i++) {
|
|
1062
|
+
point = this.point(pointsOptions[i], points[i]);
|
|
1063
|
+
if (!point) {
|
|
1064
|
+
points.length = 0;
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
if (point.mock) {
|
|
1068
|
+
point.refresh();
|
|
1069
|
+
}
|
|
1070
|
+
points[i] = point;
|
|
1071
|
+
}
|
|
1072
|
+
return points;
|
|
1073
|
+
},
|
|
1074
|
+
/**
|
|
1075
|
+
* Add control points to a controllable.
|
|
1076
|
+
*/
|
|
1077
|
+
addControlPoints: function () {
|
|
1078
|
+
var controlPointsOptions = this.options.controlPoints;
|
|
1079
|
+
(controlPointsOptions || []).forEach(function (controlPointOptions, i) {
|
|
1080
|
+
var options = merge(this.options.controlPointOptions,
|
|
1081
|
+
controlPointOptions);
|
|
1082
|
+
if (!options.index) {
|
|
1083
|
+
options.index = i;
|
|
1084
|
+
}
|
|
1085
|
+
controlPointsOptions[i] = options;
|
|
1086
|
+
this.controlPoints.push(new ControlPoint(this.chart, this, options));
|
|
1087
|
+
}, this);
|
|
1088
|
+
},
|
|
1089
|
+
/**
|
|
1090
|
+
* Check if a controllable should be rendered/redrawn.
|
|
1091
|
+
*
|
|
1092
|
+
* @return {boolean}
|
|
1093
|
+
* Whether a controllable should be drawn.
|
|
1094
|
+
*/
|
|
1095
|
+
shouldBeDrawn: function () {
|
|
1096
|
+
return Boolean(this.points.length);
|
|
1097
|
+
},
|
|
1098
|
+
/**
|
|
1099
|
+
* Render a controllable.
|
|
1100
|
+
*/
|
|
1101
|
+
render: function (_parentGroup) {
|
|
1102
|
+
this.controlPoints.forEach(function (controlPoint) {
|
|
1103
|
+
controlPoint.render();
|
|
1104
|
+
});
|
|
1105
|
+
},
|
|
1106
|
+
/**
|
|
1107
|
+
* Redraw a controllable.
|
|
1108
|
+
*
|
|
1109
|
+
* @param {boolean} [animation]
|
|
1110
|
+
*/
|
|
1111
|
+
redraw: function (animation) {
|
|
1112
|
+
this.controlPoints.forEach(function (controlPoint) {
|
|
1113
|
+
controlPoint.redraw(animation);
|
|
1114
|
+
});
|
|
1115
|
+
},
|
|
1116
|
+
/**
|
|
1117
|
+
* Transform a controllable with a specific transformation.
|
|
1118
|
+
*
|
|
1119
|
+
* @param {string} transformation a transformation name
|
|
1120
|
+
* @param {number|null} cx origin x transformation
|
|
1121
|
+
* @param {number|null} cy origin y transformation
|
|
1122
|
+
* @param {number} p1 param for the transformation
|
|
1123
|
+
* @param {number} [p2] param for the transformation
|
|
1124
|
+
*/
|
|
1125
|
+
transform: function (transformation, cx, cy, p1, p2) {
|
|
1126
|
+
if (this.chart.inverted) {
|
|
1127
|
+
var temp = cx;
|
|
1128
|
+
cx = cy;
|
|
1129
|
+
cy = temp;
|
|
1130
|
+
}
|
|
1131
|
+
this.points.forEach(function (point, i) {
|
|
1132
|
+
this.transformPoint(transformation, cx, cy, p1, p2, i);
|
|
1133
|
+
}, this);
|
|
1134
|
+
},
|
|
1135
|
+
/**
|
|
1136
|
+
* Transform a point with a specific transformation
|
|
1137
|
+
* If a transformed point is a real point it is replaced with
|
|
1138
|
+
* the mock point.
|
|
1139
|
+
*
|
|
1140
|
+
* @param {string} transformation a transformation name
|
|
1141
|
+
* @param {number|null} cx origin x transformation
|
|
1142
|
+
* @param {number|null} cy origin y transformation
|
|
1143
|
+
* @param {number} p1 param for the transformation
|
|
1144
|
+
* @param {number|undefined} p2 param for the transformation
|
|
1145
|
+
* @param {number} i index of the point
|
|
1146
|
+
*/
|
|
1147
|
+
transformPoint: function (transformation, cx, cy, p1, p2, i) {
|
|
1148
|
+
var point = this.points[i];
|
|
1149
|
+
if (!point.mock) {
|
|
1150
|
+
point = this.points[i] = MockPoint.fromPoint(point);
|
|
1151
|
+
}
|
|
1152
|
+
point[transformation](cx, cy, p1, p2);
|
|
1153
|
+
},
|
|
1154
|
+
/**
|
|
1155
|
+
* Translate a controllable.
|
|
1156
|
+
*
|
|
1157
|
+
* @param {number} dx translation for x coordinate
|
|
1158
|
+
* @param {number} dy translation for y coordinate
|
|
1159
|
+
**/
|
|
1160
|
+
translate: function (dx, dy) {
|
|
1161
|
+
this.transform('translate', null, null, dx, dy);
|
|
1162
|
+
},
|
|
1163
|
+
/**
|
|
1164
|
+
* Translate a specific point within a controllable.
|
|
1165
|
+
*
|
|
1166
|
+
* @param {number} dx translation for x coordinate
|
|
1167
|
+
* @param {number} dy translation for y coordinate
|
|
1168
|
+
* @param {number} i index of the point
|
|
1169
|
+
**/
|
|
1170
|
+
translatePoint: function (dx, dy, i) {
|
|
1171
|
+
this.transformPoint('translate', null, null, dx, dy, i);
|
|
1172
|
+
},
|
|
1173
|
+
/**
|
|
1174
|
+
* Translate shape within controllable item.
|
|
1175
|
+
* Replaces `controllable.translate` method.
|
|
1176
|
+
*
|
|
1177
|
+
* @param {number} dx translation for x coordinate
|
|
1178
|
+
* @param {number} dy translation for y coordinate
|
|
1179
|
+
*/
|
|
1180
|
+
translateShape: function (dx, dy) {
|
|
1181
|
+
var chart = this.annotation.chart,
|
|
1182
|
+
// Annotation.options
|
|
1183
|
+
shapeOptions = this.annotation.userOptions,
|
|
1184
|
+
// Chart.options.annotations
|
|
1185
|
+
annotationIndex = chart.annotations.indexOf(this.annotation),
|
|
1186
|
+
chartOptions = chart.options.annotations[annotationIndex];
|
|
1187
|
+
this.translatePoint(dx, dy, 0);
|
|
1188
|
+
// Options stored in:
|
|
1189
|
+
// - chart (for exporting)
|
|
1190
|
+
// - current config (for redraws)
|
|
1191
|
+
chartOptions[this.collection][this.index].point = this.options.point;
|
|
1192
|
+
shapeOptions[this.collection][this.index].point = this.options.point;
|
|
1193
|
+
},
|
|
1194
|
+
/**
|
|
1195
|
+
* Rotate a controllable.
|
|
1196
|
+
*
|
|
1197
|
+
* @param {number} cx origin x rotation
|
|
1198
|
+
* @param {number} cy origin y rotation
|
|
1199
|
+
* @param {number} radians
|
|
1200
|
+
**/
|
|
1201
|
+
rotate: function (cx, cy, radians) {
|
|
1202
|
+
this.transform('rotate', cx, cy, radians);
|
|
1203
|
+
},
|
|
1204
|
+
/**
|
|
1205
|
+
* Scale a controllable.
|
|
1206
|
+
*
|
|
1207
|
+
* @param {number} cx origin x rotation
|
|
1208
|
+
* @param {number} cy origin y rotation
|
|
1209
|
+
* @param {number} sx scale factor x
|
|
1210
|
+
* @param {number} sy scale factor y
|
|
1211
|
+
*/
|
|
1212
|
+
scale: function (cx, cy, sx, sy) {
|
|
1213
|
+
this.transform('scale', cx, cy, sx, sy);
|
|
1214
|
+
},
|
|
1215
|
+
/**
|
|
1216
|
+
* Set control points' visibility.
|
|
1217
|
+
*
|
|
1218
|
+
* @param {boolean} visible
|
|
1219
|
+
*/
|
|
1220
|
+
setControlPointsVisibility: function (visible) {
|
|
1221
|
+
this.controlPoints.forEach(function (controlPoint) {
|
|
1222
|
+
controlPoint.setVisibility(visible);
|
|
1223
|
+
});
|
|
1224
|
+
},
|
|
1225
|
+
/**
|
|
1226
|
+
* Destroy a controllable.
|
|
1227
|
+
*/
|
|
1228
|
+
destroy: function () {
|
|
1229
|
+
if (this.graphic) {
|
|
1230
|
+
this.graphic = this.graphic.destroy();
|
|
1231
|
+
}
|
|
1232
|
+
if (this.tracker) {
|
|
1233
|
+
this.tracker = this.tracker.destroy();
|
|
1234
|
+
}
|
|
1235
|
+
this.controlPoints.forEach(function (controlPoint) {
|
|
1236
|
+
controlPoint.destroy();
|
|
1237
|
+
});
|
|
1238
|
+
this.chart = null;
|
|
1239
|
+
this.points = null;
|
|
1240
|
+
this.controlPoints = null;
|
|
1241
|
+
this.options = null;
|
|
1242
|
+
if (this.annotation) {
|
|
1243
|
+
this.annotation = null;
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
/**
|
|
1247
|
+
* Update a controllable.
|
|
1248
|
+
*
|
|
1249
|
+
* @param {Object} newOptions
|
|
1250
|
+
*/
|
|
1251
|
+
update: function (newOptions) {
|
|
1252
|
+
var annotation = this.annotation,
|
|
1253
|
+
options = merge(true,
|
|
1254
|
+
this.options,
|
|
1255
|
+
newOptions),
|
|
1256
|
+
parentGroup = this.graphic.parentGroup;
|
|
1257
|
+
this.destroy();
|
|
1258
|
+
this.constructor(annotation, options);
|
|
1259
|
+
this.render(parentGroup);
|
|
1260
|
+
this.redraw();
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
|
|
1264
|
+
return controllableMixin;
|
|
1265
|
+
});
|
|
1266
|
+
_registerModule(_modules, 'Extensions/Annotations/Mixins/MarkerMixin.js', [_modules['Core/Chart/Chart.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Utilities.js']], function (Chart, SVGRenderer, U) {
|
|
1267
|
+
/* *
|
|
1268
|
+
*
|
|
1269
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
1270
|
+
*
|
|
1271
|
+
* */
|
|
1272
|
+
var addEvent = U.addEvent,
|
|
1273
|
+
defined = U.defined,
|
|
1274
|
+
merge = U.merge,
|
|
1275
|
+
objectEach = U.objectEach,
|
|
1276
|
+
uniqueKey = U.uniqueKey;
|
|
1277
|
+
/**
|
|
1278
|
+
* Options for configuring markers for annotations.
|
|
1279
|
+
*
|
|
1280
|
+
* An example of the arrow marker:
|
|
1281
|
+
* <pre>
|
|
1282
|
+
* {
|
|
1283
|
+
* arrow: {
|
|
1284
|
+
* id: 'arrow',
|
|
1285
|
+
* tagName: 'marker',
|
|
1286
|
+
* refY: 5,
|
|
1287
|
+
* refX: 5,
|
|
1288
|
+
* markerWidth: 10,
|
|
1289
|
+
* markerHeight: 10,
|
|
1290
|
+
* children: [{
|
|
1291
|
+
* tagName: 'path',
|
|
1292
|
+
* attrs: {
|
|
1293
|
+
* d: 'M 0 0 L 10 5 L 0 10 Z',
|
|
1294
|
+
* strokeWidth: 0
|
|
1295
|
+
* }
|
|
1296
|
+
* }]
|
|
1297
|
+
* }
|
|
1298
|
+
* }
|
|
1299
|
+
* </pre>
|
|
1300
|
+
*
|
|
1301
|
+
* @sample highcharts/annotations/custom-markers/
|
|
1302
|
+
* Define a custom marker for annotations
|
|
1303
|
+
*
|
|
1304
|
+
* @sample highcharts/css/annotations-markers/
|
|
1305
|
+
* Define markers in a styled mode
|
|
1306
|
+
*
|
|
1307
|
+
* @type {Highcharts.Dictionary<Highcharts.SVGDefinitionObject>}
|
|
1308
|
+
* @since 6.0.0
|
|
1309
|
+
* @optionparent defs
|
|
1310
|
+
*/
|
|
1311
|
+
var defaultMarkers = {
|
|
1312
|
+
/**
|
|
1313
|
+
* @type {Highcharts.SVGDefinitionObject}
|
|
1314
|
+
*/
|
|
1315
|
+
arrow: {
|
|
1316
|
+
tagName: 'marker',
|
|
1317
|
+
render: false,
|
|
1318
|
+
id: 'arrow',
|
|
1319
|
+
refY: 5,
|
|
1320
|
+
refX: 9,
|
|
1321
|
+
markerWidth: 10,
|
|
1322
|
+
markerHeight: 10,
|
|
1323
|
+
/**
|
|
1324
|
+
* @type {Array<Highcharts.DefsOptions>}
|
|
1325
|
+
*/
|
|
1326
|
+
children: [{
|
|
1327
|
+
tagName: 'path',
|
|
1328
|
+
d: 'M 0 0 L 10 5 L 0 10 Z',
|
|
1329
|
+
strokeWidth: 0
|
|
1330
|
+
}]
|
|
1331
|
+
},
|
|
1332
|
+
/**
|
|
1333
|
+
* @type {Highcharts.SVGDefinitionObject}
|
|
1334
|
+
*/
|
|
1335
|
+
'reverse-arrow': {
|
|
1336
|
+
tagName: 'marker',
|
|
1337
|
+
render: false,
|
|
1338
|
+
id: 'reverse-arrow',
|
|
1339
|
+
refY: 5,
|
|
1340
|
+
refX: 1,
|
|
1341
|
+
markerWidth: 10,
|
|
1342
|
+
markerHeight: 10,
|
|
1343
|
+
children: [{
|
|
1344
|
+
tagName: 'path',
|
|
1345
|
+
// reverse triangle (used as an arrow)
|
|
1346
|
+
d: 'M 0 5 L 10 0 L 10 10 Z',
|
|
1347
|
+
strokeWidth: 0
|
|
1348
|
+
}]
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
SVGRenderer.prototype.addMarker = function (id, markerOptions) {
|
|
1352
|
+
var options = { id: id };
|
|
1353
|
+
var attrs = {
|
|
1354
|
+
stroke: markerOptions.color || 'none',
|
|
1355
|
+
fill: markerOptions.color || 'rgba(0, 0, 0, 0.75)'
|
|
1356
|
+
};
|
|
1357
|
+
options.children = markerOptions.children.map(function (child) {
|
|
1358
|
+
return merge(attrs, child);
|
|
1359
|
+
});
|
|
1360
|
+
var marker = this.definition(merge(true, {
|
|
1361
|
+
markerWidth: 20,
|
|
1362
|
+
markerHeight: 20,
|
|
1363
|
+
refX: 0,
|
|
1364
|
+
refY: 0,
|
|
1365
|
+
orient: 'auto'
|
|
1366
|
+
},
|
|
1367
|
+
markerOptions,
|
|
1368
|
+
options));
|
|
1369
|
+
marker.id = id;
|
|
1370
|
+
return marker;
|
|
1371
|
+
};
|
|
1372
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
1373
|
+
/**
|
|
1374
|
+
* @private
|
|
1375
|
+
*/
|
|
1376
|
+
function createMarkerSetter(markerType) {
|
|
1377
|
+
return function (value) {
|
|
1378
|
+
this.attr(markerType, 'url(#' + value + ')');
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* @private
|
|
1383
|
+
* @mixin
|
|
1384
|
+
* @name Highcharts.AnnotaitonMarkerMixin
|
|
1385
|
+
*/
|
|
1386
|
+
var markerMixin = {
|
|
1387
|
+
markerEndSetter: createMarkerSetter('marker-end'),
|
|
1388
|
+
markerStartSetter: createMarkerSetter('marker-start'),
|
|
1389
|
+
/**
|
|
1390
|
+
* Set markers.
|
|
1391
|
+
* @private
|
|
1392
|
+
* @param {Highcharts.AnnotationControllablePath} item
|
|
1393
|
+
*/
|
|
1394
|
+
setItemMarkers: function (item) {
|
|
1395
|
+
var itemOptions = item.options,
|
|
1396
|
+
chart = item.chart,
|
|
1397
|
+
defs = chart.options.defs,
|
|
1398
|
+
fill = itemOptions.fill,
|
|
1399
|
+
color = defined(fill) && fill !== 'none' ?
|
|
1400
|
+
fill :
|
|
1401
|
+
itemOptions.stroke,
|
|
1402
|
+
setMarker = function (markerType) {
|
|
1403
|
+
var markerId = itemOptions[markerType],
|
|
1404
|
+
def,
|
|
1405
|
+
predefinedMarker,
|
|
1406
|
+
key,
|
|
1407
|
+
marker;
|
|
1408
|
+
if (markerId) {
|
|
1409
|
+
for (key in defs) { // eslint-disable-line guard-for-in
|
|
1410
|
+
def = defs[key];
|
|
1411
|
+
if (markerId === def.id &&
|
|
1412
|
+
def.tagName === 'marker') {
|
|
1413
|
+
predefinedMarker = def;
|
|
1414
|
+
break;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
if (predefinedMarker) {
|
|
1418
|
+
marker = item[markerType] = chart.renderer
|
|
1419
|
+
.addMarker((itemOptions.id || uniqueKey()) + '-' +
|
|
1420
|
+
predefinedMarker.id, merge(predefinedMarker, { color: color }));
|
|
1421
|
+
item.attr(markerType, marker.attr('id'));
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
};
|
|
1425
|
+
['markerStart', 'markerEnd'].forEach(setMarker);
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
addEvent(Chart, 'afterGetContainer', function () {
|
|
1429
|
+
this.options.defs = merge(defaultMarkers, this.options.defs || {});
|
|
1430
|
+
objectEach(this.options.defs, function (def) {
|
|
1431
|
+
if (def.tagName === 'marker' && def.render !== false) {
|
|
1432
|
+
this.renderer.addMarker(def.id, def);
|
|
1433
|
+
}
|
|
1434
|
+
}, this);
|
|
1435
|
+
});
|
|
1436
|
+
|
|
1437
|
+
return markerMixin;
|
|
1438
|
+
});
|
|
1439
|
+
_registerModule(_modules, 'Extensions/Annotations/Controllables/ControllablePath.js', [_modules['Extensions/Annotations/Mixins/ControllableMixin.js'], _modules['Core/Globals.js'], _modules['Extensions/Annotations/Mixins/MarkerMixin.js'], _modules['Core/Utilities.js']], function (ControllableMixin, H, MarkerMixin, U) {
|
|
1440
|
+
/* *
|
|
1441
|
+
*
|
|
1442
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
1443
|
+
*
|
|
1444
|
+
* */
|
|
1445
|
+
var extend = U.extend;
|
|
1446
|
+
// See TRACKER_FILL in highcharts.src.js
|
|
1447
|
+
var TRACKER_FILL = 'rgba(192,192,192,' + (H.svg ? 0.0001 : 0.002) + ')';
|
|
1448
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
1449
|
+
/**
|
|
1450
|
+
* A controllable path class.
|
|
1451
|
+
*
|
|
1452
|
+
* @requires modules/annotations
|
|
1453
|
+
*
|
|
1454
|
+
* @private
|
|
1455
|
+
* @class
|
|
1456
|
+
* @name Highcharts.AnnotationControllablePath
|
|
1457
|
+
*
|
|
1458
|
+
* @param {Highcharts.Annotation}
|
|
1459
|
+
* Related annotation.
|
|
1460
|
+
*
|
|
1461
|
+
* @param {Highcharts.AnnotationsShapeOptions} options
|
|
1462
|
+
* A path's options object.
|
|
1463
|
+
*
|
|
1464
|
+
* @param {number} index
|
|
1465
|
+
* Index of the path.
|
|
1466
|
+
*/
|
|
1467
|
+
var ControllablePath = /** @class */ (function () {
|
|
1468
|
+
/* *
|
|
1469
|
+
*
|
|
1470
|
+
* Constructors
|
|
1471
|
+
*
|
|
1472
|
+
* */
|
|
1473
|
+
function ControllablePath(annotation, options, index) {
|
|
1474
|
+
/* *
|
|
1475
|
+
*
|
|
1476
|
+
* Properties
|
|
1477
|
+
*
|
|
1478
|
+
* */
|
|
1479
|
+
this.addControlPoints = ControllableMixin.addControlPoints;
|
|
1480
|
+
this.anchor = ControllableMixin.anchor;
|
|
1481
|
+
this.attr = ControllableMixin.attr;
|
|
1482
|
+
this.attrsFromOptions = ControllableMixin.attrsFromOptions;
|
|
1483
|
+
this.destroy = ControllableMixin.destroy;
|
|
1484
|
+
this.getPointsOptions = ControllableMixin.getPointsOptions;
|
|
1485
|
+
this.init = ControllableMixin.init;
|
|
1486
|
+
this.linkPoints = ControllableMixin.linkPoints;
|
|
1487
|
+
this.point = ControllableMixin.point;
|
|
1488
|
+
this.rotate = ControllableMixin.rotate;
|
|
1489
|
+
this.scale = ControllableMixin.scale;
|
|
1490
|
+
this.setControlPointsVisibility = ControllableMixin.setControlPointsVisibility;
|
|
1491
|
+
this.setMarkers = MarkerMixin.setItemMarkers;
|
|
1492
|
+
this.transform = ControllableMixin.transform;
|
|
1493
|
+
this.transformPoint = ControllableMixin.transformPoint;
|
|
1494
|
+
this.translate = ControllableMixin.translate;
|
|
1495
|
+
this.translatePoint = ControllableMixin.translatePoint;
|
|
1496
|
+
this.translateShape = ControllableMixin.translateShape;
|
|
1497
|
+
this.update = ControllableMixin.update;
|
|
1498
|
+
/**
|
|
1499
|
+
* @type 'path'
|
|
1500
|
+
*/
|
|
1501
|
+
this.type = 'path';
|
|
1502
|
+
this.init(annotation, options, index);
|
|
1503
|
+
this.collection = 'shapes';
|
|
1504
|
+
}
|
|
1505
|
+
/* *
|
|
1506
|
+
*
|
|
1507
|
+
* Functions
|
|
1508
|
+
*
|
|
1509
|
+
* */
|
|
1510
|
+
/**
|
|
1511
|
+
* Map the controllable path to 'd' path attribute.
|
|
1512
|
+
*
|
|
1513
|
+
* @return {Highcharts.SVGPathArray|null}
|
|
1514
|
+
* A path's d attribute.
|
|
1515
|
+
*/
|
|
1516
|
+
ControllablePath.prototype.toD = function () {
|
|
1517
|
+
var dOption = this.options.d;
|
|
1518
|
+
if (dOption) {
|
|
1519
|
+
return typeof dOption === 'function' ?
|
|
1520
|
+
dOption.call(this) :
|
|
1521
|
+
dOption;
|
|
1522
|
+
}
|
|
1523
|
+
var points = this.points,
|
|
1524
|
+
len = points.length,
|
|
1525
|
+
showPath = len,
|
|
1526
|
+
point = points[0],
|
|
1527
|
+
position = showPath && this.anchor(point).absolutePosition,
|
|
1528
|
+
pointIndex = 0,
|
|
1529
|
+
command,
|
|
1530
|
+
d = [];
|
|
1531
|
+
if (position) {
|
|
1532
|
+
d.push(['M', position.x, position.y]);
|
|
1533
|
+
while (++pointIndex < len && showPath) {
|
|
1534
|
+
point = points[pointIndex];
|
|
1535
|
+
command = point.command || 'L';
|
|
1536
|
+
position = this.anchor(point).absolutePosition;
|
|
1537
|
+
if (command === 'M') {
|
|
1538
|
+
d.push([command, position.x, position.y]);
|
|
1539
|
+
}
|
|
1540
|
+
else if (command === 'L') {
|
|
1541
|
+
d.push([command, position.x, position.y]);
|
|
1542
|
+
}
|
|
1543
|
+
else if (command === 'Z') {
|
|
1544
|
+
d.push([command]);
|
|
1545
|
+
}
|
|
1546
|
+
showPath = point.series.visible;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
return showPath ?
|
|
1550
|
+
this.chart.renderer.crispLine(d, this.graphic.strokeWidth()) :
|
|
1551
|
+
null;
|
|
1552
|
+
};
|
|
1553
|
+
ControllablePath.prototype.shouldBeDrawn = function () {
|
|
1554
|
+
return (ControllableMixin.shouldBeDrawn.call(this) || Boolean(this.options.d));
|
|
1555
|
+
};
|
|
1556
|
+
ControllablePath.prototype.render = function (parent) {
|
|
1557
|
+
var options = this.options,
|
|
1558
|
+
attrs = this.attrsFromOptions(options);
|
|
1559
|
+
this.graphic = this.annotation.chart.renderer
|
|
1560
|
+
.path([['M', 0, 0]])
|
|
1561
|
+
.attr(attrs)
|
|
1562
|
+
.add(parent);
|
|
1563
|
+
if (options.className) {
|
|
1564
|
+
this.graphic.addClass(options.className);
|
|
1565
|
+
}
|
|
1566
|
+
this.tracker = this.annotation.chart.renderer
|
|
1567
|
+
.path([['M', 0, 0]])
|
|
1568
|
+
.addClass('highcharts-tracker-line')
|
|
1569
|
+
.attr({
|
|
1570
|
+
zIndex: 2
|
|
1571
|
+
})
|
|
1572
|
+
.add(parent);
|
|
1573
|
+
if (!this.annotation.chart.styledMode) {
|
|
1574
|
+
this.tracker.attr({
|
|
1575
|
+
'stroke-linejoin': 'round',
|
|
1576
|
+
stroke: TRACKER_FILL,
|
|
1577
|
+
fill: TRACKER_FILL,
|
|
1578
|
+
'stroke-width': this.graphic.strokeWidth() +
|
|
1579
|
+
options.snap * 2
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
ControllableMixin.render.call(this);
|
|
1583
|
+
extend(this.graphic, {
|
|
1584
|
+
markerStartSetter: MarkerMixin.markerStartSetter,
|
|
1585
|
+
markerEndSetter: MarkerMixin.markerEndSetter
|
|
1586
|
+
});
|
|
1587
|
+
this.setMarkers(this);
|
|
1588
|
+
};
|
|
1589
|
+
ControllablePath.prototype.redraw = function (animation) {
|
|
1590
|
+
var d = this.toD(),
|
|
1591
|
+
action = animation ? 'animate' : 'attr';
|
|
1592
|
+
if (d) {
|
|
1593
|
+
this.graphic[action]({ d: d });
|
|
1594
|
+
this.tracker[action]({ d: d });
|
|
1595
|
+
}
|
|
1596
|
+
else {
|
|
1597
|
+
this.graphic.attr({ d: 'M 0 ' + -9e9 });
|
|
1598
|
+
this.tracker.attr({ d: 'M 0 ' + -9e9 });
|
|
1599
|
+
}
|
|
1600
|
+
this.graphic.placed = this.tracker.placed = Boolean(d);
|
|
1601
|
+
ControllableMixin.redraw.call(this, animation);
|
|
1602
|
+
};
|
|
1603
|
+
/* *
|
|
1604
|
+
*
|
|
1605
|
+
* Static Properties
|
|
1606
|
+
*
|
|
1607
|
+
* */
|
|
1608
|
+
/**
|
|
1609
|
+
* A map object which allows to map options attributes to element attributes
|
|
1610
|
+
*
|
|
1611
|
+
* @name Highcharts.AnnotationControllablePath.attrsMap
|
|
1612
|
+
* @type {Highcharts.Dictionary<string>}
|
|
1613
|
+
*/
|
|
1614
|
+
ControllablePath.attrsMap = {
|
|
1615
|
+
dashStyle: 'dashstyle',
|
|
1616
|
+
strokeWidth: 'stroke-width',
|
|
1617
|
+
stroke: 'stroke',
|
|
1618
|
+
fill: 'fill',
|
|
1619
|
+
zIndex: 'zIndex'
|
|
1620
|
+
};
|
|
1621
|
+
return ControllablePath;
|
|
1622
|
+
}());
|
|
1623
|
+
|
|
1624
|
+
return ControllablePath;
|
|
1625
|
+
});
|
|
1626
|
+
_registerModule(_modules, 'Extensions/Annotations/Controllables/ControllableRect.js', [_modules['Extensions/Annotations/Mixins/ControllableMixin.js'], _modules['Extensions/Annotations/Controllables/ControllablePath.js'], _modules['Core/Utilities.js']], function (ControllableMixin, ControllablePath, U) {
|
|
1627
|
+
/* *
|
|
1628
|
+
*
|
|
1629
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
1630
|
+
*
|
|
1631
|
+
* */
|
|
1632
|
+
var merge = U.merge;
|
|
1633
|
+
/**
|
|
1634
|
+
* @typedef {Annotation.ControllablePath.AttrsMap}
|
|
1635
|
+
* Annotation.ControllableRect.AttrsMap
|
|
1636
|
+
* @property {string} width=width
|
|
1637
|
+
* @property {string} height=height
|
|
1638
|
+
*/
|
|
1639
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
1640
|
+
/**
|
|
1641
|
+
* A controllable rect class.
|
|
1642
|
+
*
|
|
1643
|
+
* @requires modules/annotations
|
|
1644
|
+
*
|
|
1645
|
+
* @private
|
|
1646
|
+
* @class
|
|
1647
|
+
* @name Highcharts.AnnotationControllableRect
|
|
1648
|
+
*
|
|
1649
|
+
* @param {Highcharts.Annotation} annotation
|
|
1650
|
+
* An annotation instance.
|
|
1651
|
+
*
|
|
1652
|
+
* @param {Highcharts.AnnotationsShapeOptions} options
|
|
1653
|
+
* A rect's options.
|
|
1654
|
+
*
|
|
1655
|
+
* @param {number} index
|
|
1656
|
+
* Index of the rectangle
|
|
1657
|
+
*/
|
|
1658
|
+
var ControllableRect = /** @class */ (function () {
|
|
1659
|
+
/* *
|
|
1660
|
+
*
|
|
1661
|
+
* Constructors
|
|
1662
|
+
*
|
|
1663
|
+
* */
|
|
1664
|
+
function ControllableRect(annotation, options, index) {
|
|
1665
|
+
/* *
|
|
1666
|
+
*
|
|
1667
|
+
* Properties
|
|
1668
|
+
*
|
|
1669
|
+
* */
|
|
1670
|
+
this.addControlPoints = ControllableMixin.addControlPoints;
|
|
1671
|
+
this.anchor = ControllableMixin.anchor;
|
|
1672
|
+
this.attr = ControllableMixin.attr;
|
|
1673
|
+
this.attrsFromOptions = ControllableMixin.attrsFromOptions;
|
|
1674
|
+
this.destroy = ControllableMixin.destroy;
|
|
1675
|
+
this.getPointsOptions = ControllableMixin.getPointsOptions;
|
|
1676
|
+
this.init = ControllableMixin.init;
|
|
1677
|
+
this.linkPoints = ControllableMixin.linkPoints;
|
|
1678
|
+
this.point = ControllableMixin.point;
|
|
1679
|
+
this.rotate = ControllableMixin.rotate;
|
|
1680
|
+
this.scale = ControllableMixin.scale;
|
|
1681
|
+
this.setControlPointsVisibility = ControllableMixin.setControlPointsVisibility;
|
|
1682
|
+
this.shouldBeDrawn = ControllableMixin.shouldBeDrawn;
|
|
1683
|
+
this.transform = ControllableMixin.transform;
|
|
1684
|
+
this.transformPoint = ControllableMixin.transformPoint;
|
|
1685
|
+
this.translatePoint = ControllableMixin.translatePoint;
|
|
1686
|
+
this.translateShape = ControllableMixin.translateShape;
|
|
1687
|
+
this.update = ControllableMixin.update;
|
|
1688
|
+
/**
|
|
1689
|
+
* @type 'rect'
|
|
1690
|
+
*/
|
|
1691
|
+
this.type = 'rect';
|
|
1692
|
+
this.translate = ControllableMixin.translateShape;
|
|
1693
|
+
this.init(annotation, options, index);
|
|
1694
|
+
this.collection = 'shapes';
|
|
1695
|
+
}
|
|
1696
|
+
/* *
|
|
1697
|
+
*
|
|
1698
|
+
* Functions
|
|
1699
|
+
*
|
|
1700
|
+
* */
|
|
1701
|
+
ControllableRect.prototype.render = function (parent) {
|
|
1702
|
+
var attrs = this.attrsFromOptions(this.options);
|
|
1703
|
+
this.graphic = this.annotation.chart.renderer
|
|
1704
|
+
.rect(0, -9e9, 0, 0)
|
|
1705
|
+
.attr(attrs)
|
|
1706
|
+
.add(parent);
|
|
1707
|
+
ControllableMixin.render.call(this);
|
|
1708
|
+
};
|
|
1709
|
+
ControllableRect.prototype.redraw = function (animation) {
|
|
1710
|
+
var position = this.anchor(this.points[0]).absolutePosition;
|
|
1711
|
+
if (position) {
|
|
1712
|
+
this.graphic[animation ? 'animate' : 'attr']({
|
|
1713
|
+
x: position.x,
|
|
1714
|
+
y: position.y,
|
|
1715
|
+
width: this.options.width,
|
|
1716
|
+
height: this.options.height
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
else {
|
|
1720
|
+
this.attr({
|
|
1721
|
+
x: 0,
|
|
1722
|
+
y: -9e9
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
this.graphic.placed = Boolean(position);
|
|
1726
|
+
ControllableMixin.redraw.call(this, animation);
|
|
1727
|
+
};
|
|
1728
|
+
/* *
|
|
1729
|
+
*
|
|
1730
|
+
* Static Properties
|
|
1731
|
+
*
|
|
1732
|
+
* */
|
|
1733
|
+
/**
|
|
1734
|
+
* A map object which allows to map options attributes to element attributes
|
|
1735
|
+
*
|
|
1736
|
+
* @type {Annotation.ControllableRect.AttrsMap}
|
|
1737
|
+
*/
|
|
1738
|
+
ControllableRect.attrsMap = merge(ControllablePath.attrsMap, {
|
|
1739
|
+
width: 'width',
|
|
1740
|
+
height: 'height'
|
|
1741
|
+
});
|
|
1742
|
+
return ControllableRect;
|
|
1743
|
+
}());
|
|
1744
|
+
|
|
1745
|
+
return ControllableRect;
|
|
1746
|
+
});
|
|
1747
|
+
_registerModule(_modules, 'Extensions/Annotations/Controllables/ControllableCircle.js', [_modules['Extensions/Annotations/Mixins/ControllableMixin.js'], _modules['Extensions/Annotations/Controllables/ControllablePath.js'], _modules['Core/Utilities.js']], function (ControllableMixin, ControllablePath, U) {
|
|
1748
|
+
/* *
|
|
1749
|
+
*
|
|
1750
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
1751
|
+
*
|
|
1752
|
+
* */
|
|
1753
|
+
var merge = U.merge;
|
|
1754
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
1755
|
+
/**
|
|
1756
|
+
* A controllable circle class.
|
|
1757
|
+
*
|
|
1758
|
+
* @requires modules/annotations
|
|
1759
|
+
*
|
|
1760
|
+
* @private
|
|
1761
|
+
* @class
|
|
1762
|
+
* @name Highcharts.AnnotationControllableCircle
|
|
1763
|
+
*
|
|
1764
|
+
* @param {Highcharts.Annotation} annotation an annotation instance
|
|
1765
|
+
* @param {Highcharts.AnnotationsShapeOptions} options a shape's options
|
|
1766
|
+
* @param {number} index of the circle
|
|
1767
|
+
*/
|
|
1768
|
+
var ControllableCircle = /** @class */ (function () {
|
|
1769
|
+
/* *
|
|
1770
|
+
*
|
|
1771
|
+
* Constructors
|
|
1772
|
+
*
|
|
1773
|
+
* */
|
|
1774
|
+
function ControllableCircle(annotation, options, index) {
|
|
1775
|
+
/* *
|
|
1776
|
+
*
|
|
1777
|
+
* Properties
|
|
1778
|
+
*
|
|
1779
|
+
* */
|
|
1780
|
+
this.addControlPoints = ControllableMixin.addControlPoints;
|
|
1781
|
+
this.anchor = ControllableMixin.anchor;
|
|
1782
|
+
this.attr = ControllableMixin.attr;
|
|
1783
|
+
this.attrsFromOptions = ControllableMixin.attrsFromOptions;
|
|
1784
|
+
this.destroy = ControllableMixin.destroy;
|
|
1785
|
+
this.getPointsOptions = ControllableMixin.getPointsOptions;
|
|
1786
|
+
this.init = ControllableMixin.init;
|
|
1787
|
+
this.linkPoints = ControllableMixin.linkPoints;
|
|
1788
|
+
this.point = ControllableMixin.point;
|
|
1789
|
+
this.rotate = ControllableMixin.rotate;
|
|
1790
|
+
this.scale = ControllableMixin.scale;
|
|
1791
|
+
this.setControlPointsVisibility = ControllableMixin.setControlPointsVisibility;
|
|
1792
|
+
this.shouldBeDrawn = ControllableMixin.shouldBeDrawn;
|
|
1793
|
+
this.transform = ControllableMixin.transform;
|
|
1794
|
+
this.transformPoint = ControllableMixin.transformPoint;
|
|
1795
|
+
this.translatePoint = ControllableMixin.translatePoint;
|
|
1796
|
+
this.translateShape = ControllableMixin.translateShape;
|
|
1797
|
+
this.update = ControllableMixin.update;
|
|
1798
|
+
/**
|
|
1799
|
+
* @type 'circle'
|
|
1800
|
+
*/
|
|
1801
|
+
this.type = 'circle';
|
|
1802
|
+
this.translate = ControllableMixin.translateShape;
|
|
1803
|
+
this.init(annotation, options, index);
|
|
1804
|
+
this.collection = 'shapes';
|
|
1805
|
+
}
|
|
1806
|
+
/* *
|
|
1807
|
+
*
|
|
1808
|
+
* Functions
|
|
1809
|
+
*
|
|
1810
|
+
* */
|
|
1811
|
+
ControllableCircle.prototype.render = function (parent) {
|
|
1812
|
+
var attrs = this.attrsFromOptions(this.options);
|
|
1813
|
+
this.graphic = this.annotation.chart.renderer
|
|
1814
|
+
.circle(0, -9e9, 0)
|
|
1815
|
+
.attr(attrs)
|
|
1816
|
+
.add(parent);
|
|
1817
|
+
ControllableMixin.render.call(this);
|
|
1818
|
+
};
|
|
1819
|
+
ControllableCircle.prototype.redraw = function (animation) {
|
|
1820
|
+
var position = this.anchor(this.points[0]).absolutePosition;
|
|
1821
|
+
if (position) {
|
|
1822
|
+
this.graphic[animation ? 'animate' : 'attr']({
|
|
1823
|
+
x: position.x,
|
|
1824
|
+
y: position.y,
|
|
1825
|
+
r: this.options.r
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
else {
|
|
1829
|
+
this.graphic.attr({
|
|
1830
|
+
x: 0,
|
|
1831
|
+
y: -9e9
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
this.graphic.placed = Boolean(position);
|
|
1835
|
+
ControllableMixin.redraw.call(this, animation);
|
|
1836
|
+
};
|
|
1837
|
+
/**
|
|
1838
|
+
* Set the radius.
|
|
1839
|
+
*
|
|
1840
|
+
* @param {number} r a radius to be set
|
|
1841
|
+
*/
|
|
1842
|
+
ControllableCircle.prototype.setRadius = function (r) {
|
|
1843
|
+
this.options.r = r;
|
|
1844
|
+
};
|
|
1845
|
+
/* *
|
|
1846
|
+
*
|
|
1847
|
+
* Static Properties
|
|
1848
|
+
*
|
|
1849
|
+
* */
|
|
1850
|
+
/**
|
|
1851
|
+
* A map object which allows to map options attributes to element
|
|
1852
|
+
* attributes.
|
|
1853
|
+
*
|
|
1854
|
+
* @name Highcharts.AnnotationControllableCircle.attrsMap
|
|
1855
|
+
* @type {Highcharts.Dictionary<string>}
|
|
1856
|
+
*/
|
|
1857
|
+
ControllableCircle.attrsMap = merge(ControllablePath.attrsMap, { r: 'r' });
|
|
1858
|
+
return ControllableCircle;
|
|
1859
|
+
}());
|
|
1860
|
+
|
|
1861
|
+
return ControllableCircle;
|
|
1862
|
+
});
|
|
1863
|
+
_registerModule(_modules, 'Extensions/Annotations/Controllables/ControllableLabel.js', [_modules['Extensions/Annotations/Mixins/ControllableMixin.js'], _modules['Extensions/Annotations/MockPoint.js'], _modules['Core/Renderer/SVG/SVGRenderer.js'], _modules['Core/Tooltip.js'], _modules['Core/Utilities.js']], function (ControllableMixin, MockPoint, SVGRenderer, Tooltip, U) {
|
|
1864
|
+
/* *
|
|
1865
|
+
*
|
|
1866
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
1867
|
+
*
|
|
1868
|
+
* */
|
|
1869
|
+
var extend = U.extend,
|
|
1870
|
+
format = U.format,
|
|
1871
|
+
isNumber = U.isNumber,
|
|
1872
|
+
pick = U.pick;
|
|
1873
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
1874
|
+
/**
|
|
1875
|
+
* A controllable label class.
|
|
1876
|
+
*
|
|
1877
|
+
* @requires modules/annotations
|
|
1878
|
+
*
|
|
1879
|
+
* @private
|
|
1880
|
+
* @class
|
|
1881
|
+
* @name Highcharts.AnnotationControllableLabel
|
|
1882
|
+
*
|
|
1883
|
+
* @param {Highcharts.Annotation} annotation
|
|
1884
|
+
* An annotation instance.
|
|
1885
|
+
* @param {Highcharts.AnnotationsLabelOptions} options
|
|
1886
|
+
* A label's options.
|
|
1887
|
+
* @param {number} index
|
|
1888
|
+
* Index of the label.
|
|
1889
|
+
*/
|
|
1890
|
+
var ControllableLabel = /** @class */ (function () {
|
|
1891
|
+
/* *
|
|
1892
|
+
*
|
|
1893
|
+
* Constructors
|
|
1894
|
+
*
|
|
1895
|
+
* */
|
|
1896
|
+
function ControllableLabel(annotation, options, index) {
|
|
1897
|
+
/* *
|
|
1898
|
+
*
|
|
1899
|
+
* Properties
|
|
1900
|
+
*
|
|
1901
|
+
* */
|
|
1902
|
+
this.addControlPoints = ControllableMixin.addControlPoints;
|
|
1903
|
+
this.attr = ControllableMixin.attr;
|
|
1904
|
+
this.attrsFromOptions = ControllableMixin.attrsFromOptions;
|
|
1905
|
+
this.destroy = ControllableMixin.destroy;
|
|
1906
|
+
this.getPointsOptions = ControllableMixin.getPointsOptions;
|
|
1907
|
+
this.init = ControllableMixin.init;
|
|
1908
|
+
this.linkPoints = ControllableMixin.linkPoints;
|
|
1909
|
+
this.point = ControllableMixin.point;
|
|
1910
|
+
this.rotate = ControllableMixin.rotate;
|
|
1911
|
+
this.scale = ControllableMixin.scale;
|
|
1912
|
+
this.setControlPointsVisibility = ControllableMixin.setControlPointsVisibility;
|
|
1913
|
+
this.shouldBeDrawn = ControllableMixin.shouldBeDrawn;
|
|
1914
|
+
this.transform = ControllableMixin.transform;
|
|
1915
|
+
this.transformPoint = ControllableMixin.transformPoint;
|
|
1916
|
+
this.translateShape = ControllableMixin.translateShape;
|
|
1917
|
+
this.update = ControllableMixin.update;
|
|
1918
|
+
this.init(annotation, options, index);
|
|
1919
|
+
this.collection = 'labels';
|
|
1920
|
+
}
|
|
1921
|
+
/* *
|
|
1922
|
+
*
|
|
1923
|
+
* Static Functions
|
|
1924
|
+
*
|
|
1925
|
+
* */
|
|
1926
|
+
/**
|
|
1927
|
+
* Returns new aligned position based alignment options and box to align to.
|
|
1928
|
+
* It is almost a one-to-one copy from SVGElement.prototype.align
|
|
1929
|
+
* except it does not use and mutate an element
|
|
1930
|
+
*
|
|
1931
|
+
* @param {Highcharts.AnnotationAlignObject} alignOptions
|
|
1932
|
+
*
|
|
1933
|
+
* @param {Highcharts.BBoxObject} box
|
|
1934
|
+
*
|
|
1935
|
+
* @return {Highcharts.PositionObject}
|
|
1936
|
+
* Aligned position.
|
|
1937
|
+
*/
|
|
1938
|
+
ControllableLabel.alignedPosition = function (alignOptions, box) {
|
|
1939
|
+
var align = alignOptions.align,
|
|
1940
|
+
vAlign = alignOptions.verticalAlign,
|
|
1941
|
+
x = (box.x || 0) + (alignOptions.x || 0),
|
|
1942
|
+
y = (box.y || 0) + (alignOptions.y || 0),
|
|
1943
|
+
alignFactor,
|
|
1944
|
+
vAlignFactor;
|
|
1945
|
+
if (align === 'right') {
|
|
1946
|
+
alignFactor = 1;
|
|
1947
|
+
}
|
|
1948
|
+
else if (align === 'center') {
|
|
1949
|
+
alignFactor = 2;
|
|
1950
|
+
}
|
|
1951
|
+
if (alignFactor) {
|
|
1952
|
+
x += (box.width - (alignOptions.width || 0)) / alignFactor;
|
|
1953
|
+
}
|
|
1954
|
+
if (vAlign === 'bottom') {
|
|
1955
|
+
vAlignFactor = 1;
|
|
1956
|
+
}
|
|
1957
|
+
else if (vAlign === 'middle') {
|
|
1958
|
+
vAlignFactor = 2;
|
|
1959
|
+
}
|
|
1960
|
+
if (vAlignFactor) {
|
|
1961
|
+
y += (box.height - (alignOptions.height || 0)) / vAlignFactor;
|
|
1962
|
+
}
|
|
1963
|
+
return {
|
|
1964
|
+
x: Math.round(x),
|
|
1965
|
+
y: Math.round(y)
|
|
1966
|
+
};
|
|
1967
|
+
};
|
|
1968
|
+
/**
|
|
1969
|
+
* Returns new alignment options for a label if the label is outside the
|
|
1970
|
+
* plot area. It is almost a one-to-one copy from
|
|
1971
|
+
* Series.prototype.justifyDataLabel except it does not mutate the label and
|
|
1972
|
+
* it works with absolute instead of relative position.
|
|
1973
|
+
*/
|
|
1974
|
+
ControllableLabel.justifiedOptions = function (chart, label, alignOptions, alignAttr) {
|
|
1975
|
+
var align = alignOptions.align,
|
|
1976
|
+
verticalAlign = alignOptions.verticalAlign,
|
|
1977
|
+
padding = label.box ? 0 : (label.padding || 0),
|
|
1978
|
+
bBox = label.getBBox(),
|
|
1979
|
+
off,
|
|
1980
|
+
//
|
|
1981
|
+
options = {
|
|
1982
|
+
align: align,
|
|
1983
|
+
verticalAlign: verticalAlign,
|
|
1984
|
+
x: alignOptions.x,
|
|
1985
|
+
y: alignOptions.y,
|
|
1986
|
+
width: label.width,
|
|
1987
|
+
height: label.height
|
|
1988
|
+
},
|
|
1989
|
+
//
|
|
1990
|
+
x = alignAttr.x - chart.plotLeft,
|
|
1991
|
+
y = alignAttr.y - chart.plotTop;
|
|
1992
|
+
// Off left
|
|
1993
|
+
off = x + padding;
|
|
1994
|
+
if (off < 0) {
|
|
1995
|
+
if (align === 'right') {
|
|
1996
|
+
options.align = 'left';
|
|
1997
|
+
}
|
|
1998
|
+
else {
|
|
1999
|
+
options.x = -off;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
// Off right
|
|
2003
|
+
off = x + bBox.width - padding;
|
|
2004
|
+
if (off > chart.plotWidth) {
|
|
2005
|
+
if (align === 'left') {
|
|
2006
|
+
options.align = 'right';
|
|
2007
|
+
}
|
|
2008
|
+
else {
|
|
2009
|
+
options.x = chart.plotWidth - off;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
// Off top
|
|
2013
|
+
off = y + padding;
|
|
2014
|
+
if (off < 0) {
|
|
2015
|
+
if (verticalAlign === 'bottom') {
|
|
2016
|
+
options.verticalAlign = 'top';
|
|
2017
|
+
}
|
|
2018
|
+
else {
|
|
2019
|
+
options.y = -off;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
// Off bottom
|
|
2023
|
+
off = y + bBox.height - padding;
|
|
2024
|
+
if (off > chart.plotHeight) {
|
|
2025
|
+
if (verticalAlign === 'top') {
|
|
2026
|
+
options.verticalAlign = 'bottom';
|
|
2027
|
+
}
|
|
2028
|
+
else {
|
|
2029
|
+
options.y = chart.plotHeight - off;
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
return options;
|
|
2033
|
+
};
|
|
2034
|
+
/* *
|
|
2035
|
+
*
|
|
2036
|
+
* Functions
|
|
2037
|
+
*
|
|
2038
|
+
* */
|
|
2039
|
+
/**
|
|
2040
|
+
* Translate the point of the label by deltaX and deltaY translations.
|
|
2041
|
+
* The point is the label's anchor.
|
|
2042
|
+
*
|
|
2043
|
+
* @param {number} dx translation for x coordinate
|
|
2044
|
+
* @param {number} dy translation for y coordinate
|
|
2045
|
+
*/
|
|
2046
|
+
ControllableLabel.prototype.translatePoint = function (dx, dy) {
|
|
2047
|
+
ControllableMixin.translatePoint.call(this, dx, dy, 0);
|
|
2048
|
+
};
|
|
2049
|
+
/**
|
|
2050
|
+
* Translate x and y position relative to the label's anchor.
|
|
2051
|
+
*
|
|
2052
|
+
* @param {number} dx translation for x coordinate
|
|
2053
|
+
* @param {number} dy translation for y coordinate
|
|
2054
|
+
*/
|
|
2055
|
+
ControllableLabel.prototype.translate = function (dx, dy) {
|
|
2056
|
+
var chart = this.annotation.chart,
|
|
2057
|
+
// Annotation.options
|
|
2058
|
+
labelOptions = this.annotation.userOptions,
|
|
2059
|
+
// Chart.options.annotations
|
|
2060
|
+
annotationIndex = chart.annotations.indexOf(this.annotation),
|
|
2061
|
+
chartAnnotations = chart.options.annotations,
|
|
2062
|
+
chartOptions = chartAnnotations[annotationIndex],
|
|
2063
|
+
temp;
|
|
2064
|
+
if (chart.inverted) {
|
|
2065
|
+
temp = dx;
|
|
2066
|
+
dx = dy;
|
|
2067
|
+
dy = temp;
|
|
2068
|
+
}
|
|
2069
|
+
// Local options:
|
|
2070
|
+
this.options.x += dx;
|
|
2071
|
+
this.options.y += dy;
|
|
2072
|
+
// Options stored in chart:
|
|
2073
|
+
chartOptions[this.collection][this.index].x = this.options.x;
|
|
2074
|
+
chartOptions[this.collection][this.index].y = this.options.y;
|
|
2075
|
+
labelOptions[this.collection][this.index].x = this.options.x;
|
|
2076
|
+
labelOptions[this.collection][this.index].y = this.options.y;
|
|
2077
|
+
};
|
|
2078
|
+
ControllableLabel.prototype.render = function (parent) {
|
|
2079
|
+
var options = this.options,
|
|
2080
|
+
attrs = this.attrsFromOptions(options),
|
|
2081
|
+
style = options.style;
|
|
2082
|
+
this.graphic = this.annotation.chart.renderer
|
|
2083
|
+
.label('', 0, -9999, // #10055
|
|
2084
|
+
options.shape, null, null, options.useHTML, null, 'annotation-label')
|
|
2085
|
+
.attr(attrs)
|
|
2086
|
+
.add(parent);
|
|
2087
|
+
if (!this.annotation.chart.styledMode) {
|
|
2088
|
+
if (style.color === 'contrast') {
|
|
2089
|
+
style.color = this.annotation.chart.renderer.getContrast(ControllableLabel.shapesWithoutBackground.indexOf(options.shape) > -1 ? '#FFFFFF' : options.backgroundColor);
|
|
2090
|
+
}
|
|
2091
|
+
this.graphic
|
|
2092
|
+
.css(options.style)
|
|
2093
|
+
.shadow(options.shadow);
|
|
2094
|
+
}
|
|
2095
|
+
if (options.className) {
|
|
2096
|
+
this.graphic.addClass(options.className);
|
|
2097
|
+
}
|
|
2098
|
+
this.graphic.labelrank = options.labelrank;
|
|
2099
|
+
ControllableMixin.render.call(this);
|
|
2100
|
+
};
|
|
2101
|
+
ControllableLabel.prototype.redraw = function (animation) {
|
|
2102
|
+
var options = this.options,
|
|
2103
|
+
text = this.text || options.format || options.text,
|
|
2104
|
+
label = this.graphic,
|
|
2105
|
+
point = this.points[0],
|
|
2106
|
+
anchor,
|
|
2107
|
+
attrs;
|
|
2108
|
+
label.attr({
|
|
2109
|
+
text: text ?
|
|
2110
|
+
format(text, point.getLabelConfig(), this.annotation.chart) :
|
|
2111
|
+
options.formatter.call(point, this)
|
|
2112
|
+
});
|
|
2113
|
+
anchor = this.anchor(point);
|
|
2114
|
+
attrs = this.position(anchor);
|
|
2115
|
+
if (attrs) {
|
|
2116
|
+
label.alignAttr = attrs;
|
|
2117
|
+
attrs.anchorX = anchor.absolutePosition.x;
|
|
2118
|
+
attrs.anchorY = anchor.absolutePosition.y;
|
|
2119
|
+
label[animation ? 'animate' : 'attr'](attrs);
|
|
2120
|
+
}
|
|
2121
|
+
else {
|
|
2122
|
+
label.attr({
|
|
2123
|
+
x: 0,
|
|
2124
|
+
y: -9999 // #10055
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2127
|
+
label.placed = !!attrs;
|
|
2128
|
+
ControllableMixin.redraw.call(this, animation);
|
|
2129
|
+
};
|
|
2130
|
+
/**
|
|
2131
|
+
* All basic shapes don't support alignTo() method except label.
|
|
2132
|
+
* For a controllable label, we need to subtract translation from
|
|
2133
|
+
* options.
|
|
2134
|
+
*/
|
|
2135
|
+
ControllableLabel.prototype.anchor = function (_point) {
|
|
2136
|
+
var anchor = ControllableMixin.anchor.apply(this,
|
|
2137
|
+
arguments),
|
|
2138
|
+
x = this.options.x || 0,
|
|
2139
|
+
y = this.options.y || 0;
|
|
2140
|
+
anchor.absolutePosition.x -= x;
|
|
2141
|
+
anchor.absolutePosition.y -= y;
|
|
2142
|
+
anchor.relativePosition.x -= x;
|
|
2143
|
+
anchor.relativePosition.y -= y;
|
|
2144
|
+
return anchor;
|
|
2145
|
+
};
|
|
2146
|
+
/**
|
|
2147
|
+
* Returns the label position relative to its anchor.
|
|
2148
|
+
*
|
|
2149
|
+
* @param {Highcharts.AnnotationAnchorObject} anchor
|
|
2150
|
+
*
|
|
2151
|
+
* @return {Highcharts.PositionObject|null}
|
|
2152
|
+
*/
|
|
2153
|
+
ControllableLabel.prototype.position = function (anchor) {
|
|
2154
|
+
var item = this.graphic,
|
|
2155
|
+
chart = this.annotation.chart,
|
|
2156
|
+
point = this.points[0],
|
|
2157
|
+
itemOptions = this.options,
|
|
2158
|
+
anchorAbsolutePosition = anchor.absolutePosition,
|
|
2159
|
+
anchorRelativePosition = anchor.relativePosition,
|
|
2160
|
+
itemPosition,
|
|
2161
|
+
alignTo,
|
|
2162
|
+
itemPosRelativeX,
|
|
2163
|
+
itemPosRelativeY,
|
|
2164
|
+
showItem = point.series.visible &&
|
|
2165
|
+
MockPoint.prototype.isInsidePlot.call(point);
|
|
2166
|
+
if (showItem) {
|
|
2167
|
+
if (itemOptions.distance) {
|
|
2168
|
+
itemPosition = Tooltip.prototype.getPosition.call({
|
|
2169
|
+
chart: chart,
|
|
2170
|
+
distance: pick(itemOptions.distance, 16)
|
|
2171
|
+
}, item.width, item.height, {
|
|
2172
|
+
plotX: anchorRelativePosition.x,
|
|
2173
|
+
plotY: anchorRelativePosition.y,
|
|
2174
|
+
negative: point.negative,
|
|
2175
|
+
ttBelow: point.ttBelow,
|
|
2176
|
+
h: (anchorRelativePosition.height || anchorRelativePosition.width)
|
|
2177
|
+
});
|
|
2178
|
+
}
|
|
2179
|
+
else if (itemOptions.positioner) {
|
|
2180
|
+
itemPosition = itemOptions.positioner.call(this);
|
|
2181
|
+
}
|
|
2182
|
+
else {
|
|
2183
|
+
alignTo = {
|
|
2184
|
+
x: anchorAbsolutePosition.x,
|
|
2185
|
+
y: anchorAbsolutePosition.y,
|
|
2186
|
+
width: 0,
|
|
2187
|
+
height: 0
|
|
2188
|
+
};
|
|
2189
|
+
itemPosition = ControllableLabel.alignedPosition(extend(itemOptions, {
|
|
2190
|
+
width: item.width,
|
|
2191
|
+
height: item.height
|
|
2192
|
+
}), alignTo);
|
|
2193
|
+
if (this.options.overflow === 'justify') {
|
|
2194
|
+
itemPosition = ControllableLabel.alignedPosition(ControllableLabel.justifiedOptions(chart, item, itemOptions, itemPosition), alignTo);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
if (itemOptions.crop) {
|
|
2198
|
+
itemPosRelativeX = itemPosition.x - chart.plotLeft;
|
|
2199
|
+
itemPosRelativeY = itemPosition.y - chart.plotTop;
|
|
2200
|
+
showItem =
|
|
2201
|
+
chart.isInsidePlot(itemPosRelativeX, itemPosRelativeY) &&
|
|
2202
|
+
chart.isInsidePlot(itemPosRelativeX + item.width, itemPosRelativeY + item.height);
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
return showItem ? itemPosition : null;
|
|
2206
|
+
};
|
|
2207
|
+
/* *
|
|
2208
|
+
*
|
|
2209
|
+
* Static Properties
|
|
2210
|
+
*
|
|
2211
|
+
* */
|
|
2212
|
+
/**
|
|
2213
|
+
* A map object which allows to map options attributes to element attributes
|
|
2214
|
+
*
|
|
2215
|
+
* @type {Highcharts.Dictionary<string>}
|
|
2216
|
+
*/
|
|
2217
|
+
ControllableLabel.attrsMap = {
|
|
2218
|
+
backgroundColor: 'fill',
|
|
2219
|
+
borderColor: 'stroke',
|
|
2220
|
+
borderWidth: 'stroke-width',
|
|
2221
|
+
zIndex: 'zIndex',
|
|
2222
|
+
borderRadius: 'r',
|
|
2223
|
+
padding: 'padding'
|
|
2224
|
+
};
|
|
2225
|
+
/**
|
|
2226
|
+
* Shapes which do not have background - the object is used for proper
|
|
2227
|
+
* setting of the contrast color.
|
|
2228
|
+
*
|
|
2229
|
+
* @type {Array<string>}
|
|
2230
|
+
*/
|
|
2231
|
+
ControllableLabel.shapesWithoutBackground = ['connector'];
|
|
2232
|
+
return ControllableLabel;
|
|
2233
|
+
}());
|
|
2234
|
+
/* ********************************************************************** */
|
|
2235
|
+
/**
|
|
2236
|
+
* General symbol definition for labels with connector
|
|
2237
|
+
* @private
|
|
2238
|
+
*/
|
|
2239
|
+
SVGRenderer.prototype.symbols.connector = function (x, y, w, h, options) {
|
|
2240
|
+
var anchorX = options && options.anchorX,
|
|
2241
|
+
anchorY = options && options.anchorY,
|
|
2242
|
+
path,
|
|
2243
|
+
yOffset,
|
|
2244
|
+
lateral = w / 2;
|
|
2245
|
+
if (isNumber(anchorX) && isNumber(anchorY)) {
|
|
2246
|
+
path = [['M', anchorX, anchorY]];
|
|
2247
|
+
// Prefer 45 deg connectors
|
|
2248
|
+
yOffset = y - anchorY;
|
|
2249
|
+
if (yOffset < 0) {
|
|
2250
|
+
yOffset = -h - yOffset;
|
|
2251
|
+
}
|
|
2252
|
+
if (yOffset < w) {
|
|
2253
|
+
lateral = anchorX < x + (w / 2) ? yOffset : w - yOffset;
|
|
2254
|
+
}
|
|
2255
|
+
// Anchor below label
|
|
2256
|
+
if (anchorY > y + h) {
|
|
2257
|
+
path.push(['L', x + lateral, y + h]);
|
|
2258
|
+
// Anchor above label
|
|
2259
|
+
}
|
|
2260
|
+
else if (anchorY < y) {
|
|
2261
|
+
path.push(['L', x + lateral, y]);
|
|
2262
|
+
// Anchor left of label
|
|
2263
|
+
}
|
|
2264
|
+
else if (anchorX < x) {
|
|
2265
|
+
path.push(['L', x, y + h / 2]);
|
|
2266
|
+
// Anchor right of label
|
|
2267
|
+
}
|
|
2268
|
+
else if (anchorX > x + w) {
|
|
2269
|
+
path.push(['L', x + w, y + h / 2]);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
return path || [];
|
|
2273
|
+
};
|
|
2274
|
+
|
|
2275
|
+
return ControllableLabel;
|
|
2276
|
+
});
|
|
2277
|
+
_registerModule(_modules, 'Extensions/Annotations/Controllables/ControllableImage.js', [_modules['Extensions/Annotations/Controllables/ControllableLabel.js'], _modules['Extensions/Annotations/Mixins/ControllableMixin.js']], function (ControllableLabel, ControllableMixin) {
|
|
2278
|
+
/* *
|
|
2279
|
+
*
|
|
2280
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
2281
|
+
*
|
|
2282
|
+
* */
|
|
2283
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
2284
|
+
/**
|
|
2285
|
+
* A controllable image class.
|
|
2286
|
+
*
|
|
2287
|
+
* @requires modules/annotations
|
|
2288
|
+
*
|
|
2289
|
+
* @private
|
|
2290
|
+
* @class
|
|
2291
|
+
* @name Highcharts.AnnotationControllableImage
|
|
2292
|
+
*
|
|
2293
|
+
* @param {Highcharts.Annotation} annotation
|
|
2294
|
+
* An annotation instance.
|
|
2295
|
+
*
|
|
2296
|
+
* @param {Highcharts.AnnotationsShapeOptions} options
|
|
2297
|
+
* A controllable's options.
|
|
2298
|
+
*
|
|
2299
|
+
* @param {number} index
|
|
2300
|
+
* Index of the image.
|
|
2301
|
+
*/
|
|
2302
|
+
var ControllableImage = /** @class */ (function () {
|
|
2303
|
+
/* *
|
|
2304
|
+
*
|
|
2305
|
+
* Constructors
|
|
2306
|
+
*
|
|
2307
|
+
* */
|
|
2308
|
+
function ControllableImage(annotation, options, index) {
|
|
2309
|
+
/* *
|
|
2310
|
+
*
|
|
2311
|
+
* Properties
|
|
2312
|
+
*
|
|
2313
|
+
* */
|
|
2314
|
+
this.addControlPoints = ControllableMixin.addControlPoints;
|
|
2315
|
+
this.anchor = ControllableMixin.anchor;
|
|
2316
|
+
this.attr = ControllableMixin.attr;
|
|
2317
|
+
this.attrsFromOptions = ControllableMixin.attrsFromOptions;
|
|
2318
|
+
this.destroy = ControllableMixin.destroy;
|
|
2319
|
+
this.getPointsOptions = ControllableMixin.getPointsOptions;
|
|
2320
|
+
this.init = ControllableMixin.init;
|
|
2321
|
+
this.linkPoints = ControllableMixin.linkPoints;
|
|
2322
|
+
this.point = ControllableMixin.point;
|
|
2323
|
+
this.rotate = ControllableMixin.rotate;
|
|
2324
|
+
this.scale = ControllableMixin.scale;
|
|
2325
|
+
this.setControlPointsVisibility = ControllableMixin.setControlPointsVisibility;
|
|
2326
|
+
this.shouldBeDrawn = ControllableMixin.shouldBeDrawn;
|
|
2327
|
+
this.transform = ControllableMixin.transform;
|
|
2328
|
+
this.transformPoint = ControllableMixin.transformPoint;
|
|
2329
|
+
this.translatePoint = ControllableMixin.translatePoint;
|
|
2330
|
+
this.translateShape = ControllableMixin.translateShape;
|
|
2331
|
+
this.update = ControllableMixin.update;
|
|
2332
|
+
/**
|
|
2333
|
+
* @type 'image'
|
|
2334
|
+
*/
|
|
2335
|
+
this.type = 'image';
|
|
2336
|
+
this.translate = ControllableMixin.translateShape;
|
|
2337
|
+
this.init(annotation, options, index);
|
|
2338
|
+
this.collection = 'shapes';
|
|
2339
|
+
}
|
|
2340
|
+
ControllableImage.prototype.render = function (parent) {
|
|
2341
|
+
var attrs = this.attrsFromOptions(this.options),
|
|
2342
|
+
options = this.options;
|
|
2343
|
+
this.graphic = this.annotation.chart.renderer
|
|
2344
|
+
.image(options.src, 0, -9e9, options.width, options.height)
|
|
2345
|
+
.attr(attrs)
|
|
2346
|
+
.add(parent);
|
|
2347
|
+
this.graphic.width = options.width;
|
|
2348
|
+
this.graphic.height = options.height;
|
|
2349
|
+
ControllableMixin.render.call(this);
|
|
2350
|
+
};
|
|
2351
|
+
ControllableImage.prototype.redraw = function (animation) {
|
|
2352
|
+
var anchor = this.anchor(this.points[0]),
|
|
2353
|
+
position = ControllableLabel.prototype.position.call(this,
|
|
2354
|
+
anchor);
|
|
2355
|
+
if (position) {
|
|
2356
|
+
this.graphic[animation ? 'animate' : 'attr']({
|
|
2357
|
+
x: position.x,
|
|
2358
|
+
y: position.y
|
|
2359
|
+
});
|
|
2360
|
+
}
|
|
2361
|
+
else {
|
|
2362
|
+
this.graphic.attr({
|
|
2363
|
+
x: 0,
|
|
2364
|
+
y: -9e9
|
|
2365
|
+
});
|
|
2366
|
+
}
|
|
2367
|
+
this.graphic.placed = Boolean(position);
|
|
2368
|
+
ControllableMixin.redraw.call(this, animation);
|
|
2369
|
+
};
|
|
2370
|
+
/* *
|
|
2371
|
+
*
|
|
2372
|
+
* Static Properties
|
|
2373
|
+
*
|
|
2374
|
+
* */
|
|
2375
|
+
/**
|
|
2376
|
+
* A map object which allows to map options attributes to element attributes
|
|
2377
|
+
*
|
|
2378
|
+
* @name Highcharts.AnnotationControllableImage.attrsMap
|
|
2379
|
+
* @type {Highcharts.Dictionary<string>}
|
|
2380
|
+
*/
|
|
2381
|
+
ControllableImage.attrsMap = {
|
|
2382
|
+
width: 'width',
|
|
2383
|
+
height: 'height',
|
|
2384
|
+
zIndex: 'zIndex'
|
|
2385
|
+
};
|
|
2386
|
+
return ControllableImage;
|
|
2387
|
+
}());
|
|
2388
|
+
|
|
2389
|
+
return ControllableImage;
|
|
2390
|
+
});
|
|
2391
|
+
_registerModule(_modules, 'Extensions/Annotations/Annotations.js', [_modules['Core/Animation/AnimationUtilities.js'], _modules['Core/Chart/Chart.js'], _modules['Extensions/Annotations/Mixins/ControllableMixin.js'], _modules['Extensions/Annotations/Controllables/ControllableRect.js'], _modules['Extensions/Annotations/Controllables/ControllableCircle.js'], _modules['Extensions/Annotations/Controllables/ControllablePath.js'], _modules['Extensions/Annotations/Controllables/ControllableImage.js'], _modules['Extensions/Annotations/Controllables/ControllableLabel.js'], _modules['Extensions/Annotations/ControlPoint.js'], _modules['Extensions/Annotations/Mixins/EventEmitterMixin.js'], _modules['Core/Globals.js'], _modules['Extensions/Annotations/MockPoint.js'], _modules['Core/Pointer.js'], _modules['Core/Utilities.js']], function (A, Chart, ControllableMixin, ControllableRect, ControllableCircle, ControllablePath, ControllableImage, ControllableLabel, ControlPoint, EventEmitterMixin, H, MockPoint, Pointer, U) {
|
|
2392
|
+
/* *
|
|
2393
|
+
*
|
|
2394
|
+
* (c) 2009-2017 Highsoft, Black Label
|
|
2395
|
+
*
|
|
2396
|
+
* License: www.highcharts.com/license
|
|
2397
|
+
*
|
|
2398
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
2399
|
+
*
|
|
2400
|
+
* */
|
|
2401
|
+
var getDeferredAnimation = A.getDeferredAnimation;
|
|
2402
|
+
var chartProto = Chart.prototype;
|
|
2403
|
+
var addEvent = U.addEvent,
|
|
2404
|
+
defined = U.defined,
|
|
2405
|
+
destroyObjectProperties = U.destroyObjectProperties,
|
|
2406
|
+
erase = U.erase,
|
|
2407
|
+
extend = U.extend,
|
|
2408
|
+
find = U.find,
|
|
2409
|
+
fireEvent = U.fireEvent,
|
|
2410
|
+
merge = U.merge,
|
|
2411
|
+
pick = U.pick,
|
|
2412
|
+
splat = U.splat,
|
|
2413
|
+
wrap = U.wrap;
|
|
2414
|
+
/* *********************************************************************
|
|
2415
|
+
*
|
|
2416
|
+
* ANNOTATION
|
|
2417
|
+
*
|
|
2418
|
+
******************************************************************** */
|
|
2419
|
+
/**
|
|
2420
|
+
* Possible directions for draggable annotations. An empty string (`''`)
|
|
2421
|
+
* makes the annotation undraggable.
|
|
2422
|
+
*
|
|
2423
|
+
* @typedef {''|'x'|'xy'|'y'} Highcharts.AnnotationDraggableValue
|
|
2424
|
+
*/
|
|
2425
|
+
/**
|
|
2426
|
+
* @private
|
|
2427
|
+
* @typedef {
|
|
2428
|
+
* Highcharts.AnnotationControllableCircle|
|
|
2429
|
+
* Highcharts.AnnotationControllableImage|
|
|
2430
|
+
* Highcharts.AnnotationControllablePath|
|
|
2431
|
+
* Highcharts.AnnotationControllableRect
|
|
2432
|
+
* }
|
|
2433
|
+
* Highcharts.AnnotationShapeType
|
|
2434
|
+
* @requires modules/annotations
|
|
2435
|
+
*/
|
|
2436
|
+
/**
|
|
2437
|
+
* @private
|
|
2438
|
+
* @typedef {
|
|
2439
|
+
* Highcharts.AnnotationControllableLabel
|
|
2440
|
+
* }
|
|
2441
|
+
* Highcharts.AnnotationLabelType
|
|
2442
|
+
* @requires modules/annotations
|
|
2443
|
+
*/
|
|
2444
|
+
/**
|
|
2445
|
+
* A point-like object, a mock point or a point used in series.
|
|
2446
|
+
* @private
|
|
2447
|
+
* @typedef {Highcharts.AnnotationMockPoint|Highcharts.Point} Highcharts.AnnotationPointType
|
|
2448
|
+
* @requires modules/annotations
|
|
2449
|
+
*/
|
|
2450
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
2451
|
+
/**
|
|
2452
|
+
* An annotation class which serves as a container for items like labels or
|
|
2453
|
+
* shapes. Created items are positioned on the chart either by linking them to
|
|
2454
|
+
* existing points or created mock points
|
|
2455
|
+
*
|
|
2456
|
+
* @class
|
|
2457
|
+
* @name Highcharts.Annotation
|
|
2458
|
+
*
|
|
2459
|
+
* @param {Highcharts.Chart} chart a chart instance
|
|
2460
|
+
* @param {Highcharts.AnnotationsOptions} userOptions the options object
|
|
2461
|
+
*/
|
|
2462
|
+
var Annotation = /** @class */ (function () {
|
|
2463
|
+
/* *
|
|
2464
|
+
*
|
|
2465
|
+
* Constructors
|
|
2466
|
+
*
|
|
2467
|
+
* */
|
|
2468
|
+
function Annotation(chart, userOptions) {
|
|
2469
|
+
/* *
|
|
2470
|
+
*
|
|
2471
|
+
* Properties
|
|
2472
|
+
*
|
|
2473
|
+
* */
|
|
2474
|
+
this.annotation = void 0;
|
|
2475
|
+
this.coll = 'annotations';
|
|
2476
|
+
this.collection = void 0;
|
|
2477
|
+
this.animationConfig = void 0;
|
|
2478
|
+
this.graphic = void 0;
|
|
2479
|
+
this.group = void 0;
|
|
2480
|
+
this.labelCollector = void 0;
|
|
2481
|
+
this.labelsGroup = void 0;
|
|
2482
|
+
this.shapesGroup = void 0;
|
|
2483
|
+
var labelsAndShapes;
|
|
2484
|
+
/**
|
|
2485
|
+
* The chart that the annotation belongs to.
|
|
2486
|
+
*
|
|
2487
|
+
* @type {Highcharts.Chart}
|
|
2488
|
+
*/
|
|
2489
|
+
this.chart = chart;
|
|
2490
|
+
/**
|
|
2491
|
+
* The array of points which defines the annotation.
|
|
2492
|
+
*
|
|
2493
|
+
* @type {Array<Highcharts.Point>}
|
|
2494
|
+
*/
|
|
2495
|
+
this.points = [];
|
|
2496
|
+
/**
|
|
2497
|
+
* The array of control points.
|
|
2498
|
+
*
|
|
2499
|
+
* @private
|
|
2500
|
+
* @name Highcharts.Annotation#controlPoints
|
|
2501
|
+
* @type {Array<Annotation.ControlPoint>}
|
|
2502
|
+
*/
|
|
2503
|
+
this.controlPoints = [];
|
|
2504
|
+
this.coll = 'annotations';
|
|
2505
|
+
/**
|
|
2506
|
+
* The array of labels which belong to the annotation.
|
|
2507
|
+
*
|
|
2508
|
+
* @private
|
|
2509
|
+
* @name Highcharts.Annotation#labels
|
|
2510
|
+
* @type {Array<Highcharts.AnnotationLabelType>}
|
|
2511
|
+
*/
|
|
2512
|
+
this.labels = [];
|
|
2513
|
+
/**
|
|
2514
|
+
* The array of shapes which belong to the annotation.
|
|
2515
|
+
*
|
|
2516
|
+
* @private
|
|
2517
|
+
* @name Highcharts.Annotation#shapes
|
|
2518
|
+
* @type {Array<Highcharts.AnnotationShapeType>}
|
|
2519
|
+
*/
|
|
2520
|
+
this.shapes = [];
|
|
2521
|
+
/**
|
|
2522
|
+
* The options for the annotations.
|
|
2523
|
+
*
|
|
2524
|
+
* @name Highcharts.Annotation#options
|
|
2525
|
+
* @type {Highcharts.AnnotationsOptions}
|
|
2526
|
+
*/
|
|
2527
|
+
this.options = merge(this.defaultOptions, userOptions);
|
|
2528
|
+
/**
|
|
2529
|
+
* The user options for the annotations.
|
|
2530
|
+
*
|
|
2531
|
+
* @name Highcharts.Annotation#userOptions
|
|
2532
|
+
* @type {Highcharts.AnnotationsOptions}
|
|
2533
|
+
*/
|
|
2534
|
+
this.userOptions = userOptions;
|
|
2535
|
+
// Handle labels and shapes - those are arrays
|
|
2536
|
+
// Merging does not work with arrays (stores reference)
|
|
2537
|
+
labelsAndShapes = this.getLabelsAndShapesOptions(this.options, userOptions);
|
|
2538
|
+
this.options.labels = labelsAndShapes.labels;
|
|
2539
|
+
this.options.shapes = labelsAndShapes.shapes;
|
|
2540
|
+
/**
|
|
2541
|
+
* The callback that reports to the overlapping-labels module which
|
|
2542
|
+
* labels it should account for.
|
|
2543
|
+
* @private
|
|
2544
|
+
* @name Highcharts.Annotation#labelCollector
|
|
2545
|
+
* @type {Function}
|
|
2546
|
+
*/
|
|
2547
|
+
/**
|
|
2548
|
+
* The group svg element.
|
|
2549
|
+
*
|
|
2550
|
+
* @name Highcharts.Annotation#group
|
|
2551
|
+
* @type {Highcharts.SVGElement}
|
|
2552
|
+
*/
|
|
2553
|
+
/**
|
|
2554
|
+
* The group svg element of the annotation's shapes.
|
|
2555
|
+
*
|
|
2556
|
+
* @name Highcharts.Annotation#shapesGroup
|
|
2557
|
+
* @type {Highcharts.SVGElement}
|
|
2558
|
+
*/
|
|
2559
|
+
/**
|
|
2560
|
+
* The group svg element of the annotation's labels.
|
|
2561
|
+
*
|
|
2562
|
+
* @name Highcharts.Annotation#labelsGroup
|
|
2563
|
+
* @type {Highcharts.SVGElement}
|
|
2564
|
+
*/
|
|
2565
|
+
this.init(chart, this.options);
|
|
2566
|
+
}
|
|
2567
|
+
/**
|
|
2568
|
+
* Initialize the annotation.
|
|
2569
|
+
* @private
|
|
2570
|
+
*/
|
|
2571
|
+
Annotation.prototype.init = function () {
|
|
2572
|
+
var chart = this.chart,
|
|
2573
|
+
animOptions = this.options.animation;
|
|
2574
|
+
this.linkPoints();
|
|
2575
|
+
this.addControlPoints();
|
|
2576
|
+
this.addShapes();
|
|
2577
|
+
this.addLabels();
|
|
2578
|
+
this.setLabelCollector();
|
|
2579
|
+
this.animationConfig = getDeferredAnimation(chart, animOptions);
|
|
2580
|
+
};
|
|
2581
|
+
Annotation.prototype.getLabelsAndShapesOptions = function (baseOptions, newOptions) {
|
|
2582
|
+
var mergedOptions = {};
|
|
2583
|
+
['labels', 'shapes'].forEach(function (name) {
|
|
2584
|
+
if (baseOptions[name]) {
|
|
2585
|
+
mergedOptions[name] = splat(newOptions[name]).map(function (basicOptions, i) {
|
|
2586
|
+
return merge(baseOptions[name][i], basicOptions);
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
});
|
|
2590
|
+
return mergedOptions;
|
|
2591
|
+
};
|
|
2592
|
+
Annotation.prototype.addShapes = function () {
|
|
2593
|
+
(this.options.shapes || []).forEach(function (shapeOptions, i) {
|
|
2594
|
+
var shape = this.initShape(shapeOptions,
|
|
2595
|
+
i);
|
|
2596
|
+
merge(true, this.options.shapes[i], shape.options);
|
|
2597
|
+
}, this);
|
|
2598
|
+
};
|
|
2599
|
+
Annotation.prototype.addLabels = function () {
|
|
2600
|
+
(this.options.labels || []).forEach(function (labelsOptions, i) {
|
|
2601
|
+
var labels = this.initLabel(labelsOptions,
|
|
2602
|
+
i);
|
|
2603
|
+
merge(true, this.options.labels[i], labels.options);
|
|
2604
|
+
}, this);
|
|
2605
|
+
};
|
|
2606
|
+
Annotation.prototype.addClipPaths = function () {
|
|
2607
|
+
this.setClipAxes();
|
|
2608
|
+
if (this.clipXAxis && this.clipYAxis) {
|
|
2609
|
+
this.clipRect = this.chart.renderer.clipRect(this.getClipBox());
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
Annotation.prototype.setClipAxes = function () {
|
|
2613
|
+
var xAxes = this.chart.xAxis,
|
|
2614
|
+
yAxes = this.chart.yAxis,
|
|
2615
|
+
linkedAxes = (this.options.labels || [])
|
|
2616
|
+
.concat(this.options.shapes || [])
|
|
2617
|
+
.reduce(function (axes,
|
|
2618
|
+
labelOrShape) {
|
|
2619
|
+
return [
|
|
2620
|
+
xAxes[labelOrShape &&
|
|
2621
|
+
labelOrShape.point &&
|
|
2622
|
+
labelOrShape.point.xAxis] || axes[0],
|
|
2623
|
+
yAxes[labelOrShape &&
|
|
2624
|
+
labelOrShape.point &&
|
|
2625
|
+
labelOrShape.point.yAxis] || axes[1]
|
|
2626
|
+
];
|
|
2627
|
+
}, []);
|
|
2628
|
+
this.clipXAxis = linkedAxes[0];
|
|
2629
|
+
this.clipYAxis = linkedAxes[1];
|
|
2630
|
+
};
|
|
2631
|
+
Annotation.prototype.getClipBox = function () {
|
|
2632
|
+
if (this.clipXAxis && this.clipYAxis) {
|
|
2633
|
+
return {
|
|
2634
|
+
x: this.clipXAxis.left,
|
|
2635
|
+
y: this.clipYAxis.top,
|
|
2636
|
+
width: this.clipXAxis.width,
|
|
2637
|
+
height: this.clipYAxis.height
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
Annotation.prototype.setLabelCollector = function () {
|
|
2642
|
+
var annotation = this;
|
|
2643
|
+
annotation.labelCollector = function () {
|
|
2644
|
+
return annotation.labels.reduce(function (labels, label) {
|
|
2645
|
+
if (!label.options.allowOverlap) {
|
|
2646
|
+
labels.push(label.graphic);
|
|
2647
|
+
}
|
|
2648
|
+
return labels;
|
|
2649
|
+
}, []);
|
|
2650
|
+
};
|
|
2651
|
+
annotation.chart.labelCollectors.push(annotation.labelCollector);
|
|
2652
|
+
};
|
|
2653
|
+
/**
|
|
2654
|
+
* Set an annotation options.
|
|
2655
|
+
* @private
|
|
2656
|
+
* @param {Highcharts.AnnotationsOptions} - user options for an annotation
|
|
2657
|
+
*/
|
|
2658
|
+
Annotation.prototype.setOptions = function (userOptions) {
|
|
2659
|
+
this.options = merge(this.defaultOptions, userOptions);
|
|
2660
|
+
};
|
|
2661
|
+
Annotation.prototype.redraw = function (animation) {
|
|
2662
|
+
this.linkPoints();
|
|
2663
|
+
if (!this.graphic) {
|
|
2664
|
+
this.render();
|
|
2665
|
+
}
|
|
2666
|
+
if (this.clipRect) {
|
|
2667
|
+
this.clipRect.animate(this.getClipBox());
|
|
2668
|
+
}
|
|
2669
|
+
this.redrawItems(this.shapes, animation);
|
|
2670
|
+
this.redrawItems(this.labels, animation);
|
|
2671
|
+
ControllableMixin.redraw.call(this, animation);
|
|
2672
|
+
};
|
|
2673
|
+
/**
|
|
2674
|
+
* @private
|
|
2675
|
+
* @param {Array<Highcharts.AnnotationControllable>} items
|
|
2676
|
+
* @param {boolean} [animation]
|
|
2677
|
+
*/
|
|
2678
|
+
Annotation.prototype.redrawItems = function (items, animation) {
|
|
2679
|
+
var i = items.length;
|
|
2680
|
+
// needs a backward loop
|
|
2681
|
+
// labels/shapes array might be modified
|
|
2682
|
+
// due to destruction of the item
|
|
2683
|
+
while (i--) {
|
|
2684
|
+
this.redrawItem(items[i], animation);
|
|
2685
|
+
}
|
|
2686
|
+
};
|
|
2687
|
+
/**
|
|
2688
|
+
* @private
|
|
2689
|
+
* @param {Array<Highcharts.AnnotationControllable>} items
|
|
2690
|
+
*/
|
|
2691
|
+
Annotation.prototype.renderItems = function (items) {
|
|
2692
|
+
var i = items.length;
|
|
2693
|
+
while (i--) {
|
|
2694
|
+
this.renderItem(items[i]);
|
|
2695
|
+
}
|
|
2696
|
+
};
|
|
2697
|
+
Annotation.prototype.render = function () {
|
|
2698
|
+
var renderer = this.chart.renderer;
|
|
2699
|
+
this.graphic = renderer
|
|
2700
|
+
.g('annotation')
|
|
2701
|
+
.attr({
|
|
2702
|
+
opacity: 0,
|
|
2703
|
+
zIndex: this.options.zIndex,
|
|
2704
|
+
visibility: this.options.visible ?
|
|
2705
|
+
'visible' :
|
|
2706
|
+
'hidden'
|
|
2707
|
+
})
|
|
2708
|
+
.add();
|
|
2709
|
+
this.shapesGroup = renderer
|
|
2710
|
+
.g('annotation-shapes')
|
|
2711
|
+
.add(this.graphic)
|
|
2712
|
+
.clip(this.chart.plotBoxClip);
|
|
2713
|
+
this.labelsGroup = renderer
|
|
2714
|
+
.g('annotation-labels')
|
|
2715
|
+
.attr({
|
|
2716
|
+
// hideOverlappingLabels requires translation
|
|
2717
|
+
translateX: 0,
|
|
2718
|
+
translateY: 0
|
|
2719
|
+
})
|
|
2720
|
+
.add(this.graphic);
|
|
2721
|
+
this.addClipPaths();
|
|
2722
|
+
if (this.clipRect) {
|
|
2723
|
+
this.graphic.clip(this.clipRect);
|
|
2724
|
+
}
|
|
2725
|
+
// Render shapes and labels before adding events (#13070).
|
|
2726
|
+
this.renderItems(this.shapes);
|
|
2727
|
+
this.renderItems(this.labels);
|
|
2728
|
+
this.addEvents();
|
|
2729
|
+
ControllableMixin.render.call(this);
|
|
2730
|
+
};
|
|
2731
|
+
/**
|
|
2732
|
+
* Set the annotation's visibility.
|
|
2733
|
+
* @private
|
|
2734
|
+
* @param {boolean} [visible]
|
|
2735
|
+
* Whether to show or hide an annotation. If the param is omitted, the
|
|
2736
|
+
* annotation's visibility is toggled.
|
|
2737
|
+
*/
|
|
2738
|
+
Annotation.prototype.setVisibility = function (visible) {
|
|
2739
|
+
var options = this.options,
|
|
2740
|
+
visibility = pick(visible, !options.visible);
|
|
2741
|
+
this.graphic.attr('visibility', visibility ? 'visible' : 'hidden');
|
|
2742
|
+
if (!visibility) {
|
|
2743
|
+
this.setControlPointsVisibility(false);
|
|
2744
|
+
}
|
|
2745
|
+
options.visible = visibility;
|
|
2746
|
+
};
|
|
2747
|
+
Annotation.prototype.setControlPointsVisibility = function (visible) {
|
|
2748
|
+
var setItemControlPointsVisibility = function (item) {
|
|
2749
|
+
item.setControlPointsVisibility(visible);
|
|
2750
|
+
};
|
|
2751
|
+
ControllableMixin.setControlPointsVisibility.call(this, visible);
|
|
2752
|
+
this.shapes.forEach(setItemControlPointsVisibility);
|
|
2753
|
+
this.labels.forEach(setItemControlPointsVisibility);
|
|
2754
|
+
};
|
|
2755
|
+
/**
|
|
2756
|
+
* Destroy the annotation. This function does not touch the chart
|
|
2757
|
+
* that the annotation belongs to (all annotations are kept in
|
|
2758
|
+
* the chart.annotations array) - it is recommended to use
|
|
2759
|
+
* {@link Highcharts.Chart#removeAnnotation} instead.
|
|
2760
|
+
* @private
|
|
2761
|
+
*/
|
|
2762
|
+
Annotation.prototype.destroy = function () {
|
|
2763
|
+
var chart = this.chart,
|
|
2764
|
+
destroyItem = function (item) {
|
|
2765
|
+
item.destroy();
|
|
2766
|
+
};
|
|
2767
|
+
this.labels.forEach(destroyItem);
|
|
2768
|
+
this.shapes.forEach(destroyItem);
|
|
2769
|
+
this.clipXAxis = null;
|
|
2770
|
+
this.clipYAxis = null;
|
|
2771
|
+
erase(chart.labelCollectors, this.labelCollector);
|
|
2772
|
+
EventEmitterMixin.destroy.call(this);
|
|
2773
|
+
ControllableMixin.destroy.call(this);
|
|
2774
|
+
destroyObjectProperties(this, chart);
|
|
2775
|
+
};
|
|
2776
|
+
/**
|
|
2777
|
+
* See {@link Highcharts.Chart#removeAnnotation}.
|
|
2778
|
+
* @private
|
|
2779
|
+
*/
|
|
2780
|
+
Annotation.prototype.remove = function () {
|
|
2781
|
+
// Let chart.update() remove annoations on demand
|
|
2782
|
+
return this.chart.removeAnnotation(this);
|
|
2783
|
+
};
|
|
2784
|
+
/**
|
|
2785
|
+
* Updates an annotation.
|
|
2786
|
+
*
|
|
2787
|
+
* @function Highcharts.Annotation#update
|
|
2788
|
+
*
|
|
2789
|
+
* @param {Partial<Highcharts.AnnotationsOptions>} userOptions
|
|
2790
|
+
* New user options for the annotation.
|
|
2791
|
+
*
|
|
2792
|
+
* @return {void}
|
|
2793
|
+
*/
|
|
2794
|
+
Annotation.prototype.update = function (userOptions, redraw) {
|
|
2795
|
+
var chart = this.chart,
|
|
2796
|
+
labelsAndShapes = this.getLabelsAndShapesOptions(this.userOptions,
|
|
2797
|
+
userOptions),
|
|
2798
|
+
userOptionsIndex = chart.annotations.indexOf(this),
|
|
2799
|
+
options = merge(true,
|
|
2800
|
+
this.userOptions,
|
|
2801
|
+
userOptions);
|
|
2802
|
+
options.labels = labelsAndShapes.labels;
|
|
2803
|
+
options.shapes = labelsAndShapes.shapes;
|
|
2804
|
+
this.destroy();
|
|
2805
|
+
this.constructor(chart, options);
|
|
2806
|
+
// Update options in chart options, used in exporting (#9767):
|
|
2807
|
+
chart.options.annotations[userOptionsIndex] = options;
|
|
2808
|
+
this.isUpdating = true;
|
|
2809
|
+
if (pick(redraw, true)) {
|
|
2810
|
+
chart.redraw();
|
|
2811
|
+
}
|
|
2812
|
+
fireEvent(this, 'afterUpdate');
|
|
2813
|
+
this.isUpdating = false;
|
|
2814
|
+
};
|
|
2815
|
+
/* *************************************************************
|
|
2816
|
+
* ITEM SECTION
|
|
2817
|
+
* Contains methods for handling a single item in an annotation
|
|
2818
|
+
**************************************************************** */
|
|
2819
|
+
/**
|
|
2820
|
+
* Initialisation of a single shape
|
|
2821
|
+
* @private
|
|
2822
|
+
* @param {Object} shapeOptions - a confg object for a single shape
|
|
2823
|
+
*/
|
|
2824
|
+
Annotation.prototype.initShape = function (shapeOptions, index) {
|
|
2825
|
+
var options = merge(this.options.shapeOptions, {
|
|
2826
|
+
controlPointOptions: this.options.controlPointOptions
|
|
2827
|
+
},
|
|
2828
|
+
shapeOptions),
|
|
2829
|
+
shape = new Annotation.shapesMap[options.type](this,
|
|
2830
|
+
options,
|
|
2831
|
+
index);
|
|
2832
|
+
shape.itemType = 'shape';
|
|
2833
|
+
this.shapes.push(shape);
|
|
2834
|
+
return shape;
|
|
2835
|
+
};
|
|
2836
|
+
/**
|
|
2837
|
+
* Initialisation of a single label
|
|
2838
|
+
* @private
|
|
2839
|
+
*/
|
|
2840
|
+
Annotation.prototype.initLabel = function (labelOptions, index) {
|
|
2841
|
+
var options = merge(this.options.labelOptions, {
|
|
2842
|
+
controlPointOptions: this.options.controlPointOptions
|
|
2843
|
+
},
|
|
2844
|
+
labelOptions),
|
|
2845
|
+
label = new ControllableLabel(this,
|
|
2846
|
+
options,
|
|
2847
|
+
index);
|
|
2848
|
+
label.itemType = 'label';
|
|
2849
|
+
this.labels.push(label);
|
|
2850
|
+
return label;
|
|
2851
|
+
};
|
|
2852
|
+
/**
|
|
2853
|
+
* Redraw a single item.
|
|
2854
|
+
* @private
|
|
2855
|
+
* @param {Annotation.Label|Annotation.Shape} item
|
|
2856
|
+
* @param {boolean} [animation]
|
|
2857
|
+
*/
|
|
2858
|
+
Annotation.prototype.redrawItem = function (item, animation) {
|
|
2859
|
+
item.linkPoints();
|
|
2860
|
+
if (!item.shouldBeDrawn()) {
|
|
2861
|
+
this.destroyItem(item);
|
|
2862
|
+
}
|
|
2863
|
+
else {
|
|
2864
|
+
if (!item.graphic) {
|
|
2865
|
+
this.renderItem(item);
|
|
2866
|
+
}
|
|
2867
|
+
item.redraw(pick(animation, true) && item.graphic.placed);
|
|
2868
|
+
if (item.points.length) {
|
|
2869
|
+
this.adjustVisibility(item);
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
};
|
|
2873
|
+
/**
|
|
2874
|
+
* Hide or show annotaiton attached to points.
|
|
2875
|
+
* @private
|
|
2876
|
+
* @param {Annotation.Label|Annotation.Shape} item
|
|
2877
|
+
*/
|
|
2878
|
+
Annotation.prototype.adjustVisibility = function (item) {
|
|
2879
|
+
var hasVisiblePoints = false,
|
|
2880
|
+
label = item.graphic;
|
|
2881
|
+
item.points.forEach(function (point) {
|
|
2882
|
+
if (point.series.visible !== false &&
|
|
2883
|
+
point.visible !== false) {
|
|
2884
|
+
hasVisiblePoints = true;
|
|
2885
|
+
}
|
|
2886
|
+
});
|
|
2887
|
+
if (!hasVisiblePoints) {
|
|
2888
|
+
label.hide();
|
|
2889
|
+
}
|
|
2890
|
+
else if (label.visibility === 'hidden') {
|
|
2891
|
+
label.show();
|
|
2892
|
+
}
|
|
2893
|
+
};
|
|
2894
|
+
/**
|
|
2895
|
+
* Destroy a single item.
|
|
2896
|
+
* @private
|
|
2897
|
+
* @param {Annotation.Label|Annotation.Shape} item
|
|
2898
|
+
*/
|
|
2899
|
+
Annotation.prototype.destroyItem = function (item) {
|
|
2900
|
+
// erase from shapes or labels array
|
|
2901
|
+
erase(this[item.itemType + 's'], item);
|
|
2902
|
+
item.destroy();
|
|
2903
|
+
};
|
|
2904
|
+
/**
|
|
2905
|
+
* @private
|
|
2906
|
+
*/
|
|
2907
|
+
Annotation.prototype.renderItem = function (item) {
|
|
2908
|
+
item.render(item.itemType === 'label' ?
|
|
2909
|
+
this.labelsGroup :
|
|
2910
|
+
this.shapesGroup);
|
|
2911
|
+
};
|
|
2912
|
+
/**
|
|
2913
|
+
* @private
|
|
2914
|
+
*/
|
|
2915
|
+
Annotation.ControlPoint = ControlPoint;
|
|
2916
|
+
/**
|
|
2917
|
+
* @private
|
|
2918
|
+
*/
|
|
2919
|
+
Annotation.MockPoint = MockPoint;
|
|
2920
|
+
/**
|
|
2921
|
+
* An object uses for mapping between a shape type and a constructor.
|
|
2922
|
+
* To add a new shape type extend this object with type name as a key
|
|
2923
|
+
* and a constructor as its value.
|
|
2924
|
+
*/
|
|
2925
|
+
Annotation.shapesMap = {
|
|
2926
|
+
'rect': ControllableRect,
|
|
2927
|
+
'circle': ControllableCircle,
|
|
2928
|
+
'path': ControllablePath,
|
|
2929
|
+
'image': ControllableImage
|
|
2930
|
+
};
|
|
2931
|
+
/**
|
|
2932
|
+
* @private
|
|
2933
|
+
*/
|
|
2934
|
+
Annotation.types = {};
|
|
2935
|
+
return Annotation;
|
|
2936
|
+
}());
|
|
2937
|
+
merge(true, Annotation.prototype, ControllableMixin, EventEmitterMixin,
|
|
2938
|
+
// restore original Annotation implementation after mixin overwrite
|
|
2939
|
+
merge(Annotation.prototype,
|
|
2940
|
+
/** @lends Highcharts.Annotation# */
|
|
2941
|
+
{
|
|
2942
|
+
/**
|
|
2943
|
+
* List of events for `annotation.options.events` that should not be
|
|
2944
|
+
* added to `annotation.graphic` but to the `annotation`.
|
|
2945
|
+
*
|
|
2946
|
+
* @private
|
|
2947
|
+
* @type {Array<string>}
|
|
2948
|
+
*/
|
|
2949
|
+
nonDOMEvents: ['add', 'afterUpdate', 'drag', 'remove'],
|
|
2950
|
+
/**
|
|
2951
|
+
* A basic type of an annotation. It allows to add custom labels
|
|
2952
|
+
* or shapes. The items can be tied to points, axis coordinates
|
|
2953
|
+
* or chart pixel coordinates.
|
|
2954
|
+
*
|
|
2955
|
+
* @sample highcharts/annotations/basic/
|
|
2956
|
+
* Basic annotations
|
|
2957
|
+
* @sample highcharts/demo/annotations/
|
|
2958
|
+
* Advanced annotations
|
|
2959
|
+
* @sample highcharts/css/annotations
|
|
2960
|
+
* Styled mode
|
|
2961
|
+
* @sample highcharts/annotations-advanced/controllable
|
|
2962
|
+
* Controllable items
|
|
2963
|
+
* @sample {highstock} stock/annotations/fibonacci-retracements
|
|
2964
|
+
* Custom annotation, Fibonacci retracement
|
|
2965
|
+
*
|
|
2966
|
+
* @type {Array<*>}
|
|
2967
|
+
* @since 6.0.0
|
|
2968
|
+
* @requires modules/annotations
|
|
2969
|
+
* @optionparent annotations
|
|
2970
|
+
*
|
|
2971
|
+
* @private
|
|
2972
|
+
*/
|
|
2973
|
+
defaultOptions: {
|
|
2974
|
+
/**
|
|
2975
|
+
* Sets an ID for an annotation. Can be user later when
|
|
2976
|
+
* removing an annotation in [Chart#removeAnnotation(id)](
|
|
2977
|
+
* /class-reference/Highcharts.Chart#removeAnnotation) method.
|
|
2978
|
+
*
|
|
2979
|
+
* @type {number|string}
|
|
2980
|
+
* @apioption annotations.id
|
|
2981
|
+
*/
|
|
2982
|
+
/**
|
|
2983
|
+
* Whether the annotation is visible.
|
|
2984
|
+
*
|
|
2985
|
+
* @sample highcharts/annotations/visible/
|
|
2986
|
+
* Set annotation visibility
|
|
2987
|
+
*/
|
|
2988
|
+
visible: true,
|
|
2989
|
+
/**
|
|
2990
|
+
* Enable or disable the initial animation when a series is
|
|
2991
|
+
* displayed for the `annotation`. The animation can also be set
|
|
2992
|
+
* as a configuration object. Please note that this option only
|
|
2993
|
+
* applies to the initial animation.
|
|
2994
|
+
* For other animations, see [chart.animation](#chart.animation)
|
|
2995
|
+
* and the animation parameter under the API methods.
|
|
2996
|
+
* The following properties are supported:
|
|
2997
|
+
*
|
|
2998
|
+
* - `defer`: The animation delay time in milliseconds.
|
|
2999
|
+
*
|
|
3000
|
+
* @sample {highcharts} highcharts/annotations/defer/
|
|
3001
|
+
* Animation defer settings
|
|
3002
|
+
* @type {boolean|Partial<Highcharts.AnimationOptionsObject>}
|
|
3003
|
+
* @since 8.2.0
|
|
3004
|
+
* @apioption annotations.animation
|
|
3005
|
+
*/
|
|
3006
|
+
animation: {},
|
|
3007
|
+
/**
|
|
3008
|
+
* The animation delay time in milliseconds.
|
|
3009
|
+
* Set to `0` renders annotation immediately.
|
|
3010
|
+
* As `undefined` inherits defer time from the [series.animation.defer](#plotOptions.series.animation.defer).
|
|
3011
|
+
*
|
|
3012
|
+
* @type {number}
|
|
3013
|
+
* @since 8.2.0
|
|
3014
|
+
* @apioption annotations.animation.defer
|
|
3015
|
+
*/
|
|
3016
|
+
/**
|
|
3017
|
+
* Allow an annotation to be draggable by a user. Possible
|
|
3018
|
+
* values are `'x'`, `'xy'`, `'y'` and `''` (disabled).
|
|
3019
|
+
*
|
|
3020
|
+
* @sample highcharts/annotations/draggable/
|
|
3021
|
+
* Annotations draggable: 'xy'
|
|
3022
|
+
*
|
|
3023
|
+
* @type {Highcharts.AnnotationDraggableValue}
|
|
3024
|
+
*/
|
|
3025
|
+
draggable: 'xy',
|
|
3026
|
+
/**
|
|
3027
|
+
* Options for annotation's labels. Each label inherits options
|
|
3028
|
+
* from the labelOptions object. An option from the labelOptions
|
|
3029
|
+
* can be overwritten by config for a specific label.
|
|
3030
|
+
*
|
|
3031
|
+
* @requires modules/annotations
|
|
3032
|
+
*/
|
|
3033
|
+
labelOptions: {
|
|
3034
|
+
/**
|
|
3035
|
+
* The alignment of the annotation's label. If right,
|
|
3036
|
+
* the right side of the label should be touching the point.
|
|
3037
|
+
*
|
|
3038
|
+
* @sample highcharts/annotations/label-position/
|
|
3039
|
+
* Set labels position
|
|
3040
|
+
*
|
|
3041
|
+
* @type {Highcharts.AlignValue}
|
|
3042
|
+
*/
|
|
3043
|
+
align: 'center',
|
|
3044
|
+
/**
|
|
3045
|
+
* Whether to allow the annotation's labels to overlap.
|
|
3046
|
+
* To make the labels less sensitive for overlapping,
|
|
3047
|
+
* the can be set to 0.
|
|
3048
|
+
*
|
|
3049
|
+
* @sample highcharts/annotations/tooltip-like/
|
|
3050
|
+
* Hide overlapping labels
|
|
3051
|
+
*/
|
|
3052
|
+
allowOverlap: false,
|
|
3053
|
+
/**
|
|
3054
|
+
* The background color or gradient for the annotation's
|
|
3055
|
+
* label.
|
|
3056
|
+
*
|
|
3057
|
+
* @sample highcharts/annotations/label-presentation/
|
|
3058
|
+
* Set labels graphic options
|
|
3059
|
+
*
|
|
3060
|
+
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
|
3061
|
+
*/
|
|
3062
|
+
backgroundColor: 'rgba(0, 0, 0, 0.75)',
|
|
3063
|
+
/**
|
|
3064
|
+
* The border color for the annotation's label.
|
|
3065
|
+
*
|
|
3066
|
+
* @sample highcharts/annotations/label-presentation/
|
|
3067
|
+
* Set labels graphic options
|
|
3068
|
+
*
|
|
3069
|
+
* @type {Highcharts.ColorString}
|
|
3070
|
+
*/
|
|
3071
|
+
borderColor: 'black',
|
|
3072
|
+
/**
|
|
3073
|
+
* The border radius in pixels for the annotaiton's label.
|
|
3074
|
+
*
|
|
3075
|
+
* @sample highcharts/annotations/label-presentation/
|
|
3076
|
+
* Set labels graphic options
|
|
3077
|
+
*/
|
|
3078
|
+
borderRadius: 3,
|
|
3079
|
+
/**
|
|
3080
|
+
* The border width in pixels for the annotation's label
|
|
3081
|
+
*
|
|
3082
|
+
* @sample highcharts/annotations/label-presentation/
|
|
3083
|
+
* Set labels graphic options
|
|
3084
|
+
*/
|
|
3085
|
+
borderWidth: 1,
|
|
3086
|
+
/**
|
|
3087
|
+
* A class name for styling by CSS.
|
|
3088
|
+
*
|
|
3089
|
+
* @sample highcharts/css/annotations
|
|
3090
|
+
* Styled mode annotations
|
|
3091
|
+
*
|
|
3092
|
+
* @since 6.0.5
|
|
3093
|
+
*/
|
|
3094
|
+
className: '',
|
|
3095
|
+
/**
|
|
3096
|
+
* Whether to hide the annotation's label
|
|
3097
|
+
* that is outside the plot area.
|
|
3098
|
+
*
|
|
3099
|
+
* @sample highcharts/annotations/label-crop-overflow/
|
|
3100
|
+
* Crop or justify labels
|
|
3101
|
+
*/
|
|
3102
|
+
crop: false,
|
|
3103
|
+
/**
|
|
3104
|
+
* The label's pixel distance from the point.
|
|
3105
|
+
*
|
|
3106
|
+
* @sample highcharts/annotations/label-position/
|
|
3107
|
+
* Set labels position
|
|
3108
|
+
*
|
|
3109
|
+
* @type {number}
|
|
3110
|
+
* @apioption annotations.labelOptions.distance
|
|
3111
|
+
*/
|
|
3112
|
+
/**
|
|
3113
|
+
* A
|
|
3114
|
+
* [format](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)
|
|
3115
|
+
* string for the data label.
|
|
3116
|
+
*
|
|
3117
|
+
* @see [plotOptions.series.dataLabels.format](plotOptions.series.dataLabels.format.html)
|
|
3118
|
+
*
|
|
3119
|
+
* @sample highcharts/annotations/label-text/
|
|
3120
|
+
* Set labels text
|
|
3121
|
+
*
|
|
3122
|
+
* @type {string}
|
|
3123
|
+
* @apioption annotations.labelOptions.format
|
|
3124
|
+
*/
|
|
3125
|
+
/**
|
|
3126
|
+
* Alias for the format option.
|
|
3127
|
+
*
|
|
3128
|
+
* @see [format](annotations.labelOptions.format.html)
|
|
3129
|
+
*
|
|
3130
|
+
* @sample highcharts/annotations/label-text/
|
|
3131
|
+
* Set labels text
|
|
3132
|
+
*
|
|
3133
|
+
* @type {string}
|
|
3134
|
+
* @apioption annotations.labelOptions.text
|
|
3135
|
+
*/
|
|
3136
|
+
/**
|
|
3137
|
+
* Callback JavaScript function to format the annotation's
|
|
3138
|
+
* label. Note that if a `format` or `text` are defined,
|
|
3139
|
+
* the format or text take precedence and the formatter is
|
|
3140
|
+
* ignored. `This` refers to a point object.
|
|
3141
|
+
*
|
|
3142
|
+
* @sample highcharts/annotations/label-text/
|
|
3143
|
+
* Set labels text
|
|
3144
|
+
*
|
|
3145
|
+
* @type {Highcharts.FormatterCallbackFunction<Highcharts.Point>}
|
|
3146
|
+
* @default function () { return defined(this.y) ? this.y : 'Annotation label'; }
|
|
3147
|
+
*/
|
|
3148
|
+
formatter: function () {
|
|
3149
|
+
return defined(this.y) ? this.y : 'Annotation label';
|
|
3150
|
+
},
|
|
3151
|
+
/**
|
|
3152
|
+
* Whether the annotation is visible in the exported data
|
|
3153
|
+
* table.
|
|
3154
|
+
*
|
|
3155
|
+
* @sample highcharts/annotations/include-in-data-export/
|
|
3156
|
+
* Do not include in the data export
|
|
3157
|
+
*
|
|
3158
|
+
* @since 8.2.0
|
|
3159
|
+
* @requires modules/export-data
|
|
3160
|
+
*/
|
|
3161
|
+
includeInDataExport: true,
|
|
3162
|
+
/**
|
|
3163
|
+
* How to handle the annotation's label that flow outside
|
|
3164
|
+
* the plot area. The justify option aligns the label inside
|
|
3165
|
+
* the plot area.
|
|
3166
|
+
*
|
|
3167
|
+
* @sample highcharts/annotations/label-crop-overflow/
|
|
3168
|
+
* Crop or justify labels
|
|
3169
|
+
*
|
|
3170
|
+
* @validvalue ["allow", "justify"]
|
|
3171
|
+
*/
|
|
3172
|
+
overflow: 'justify',
|
|
3173
|
+
/**
|
|
3174
|
+
* When either the borderWidth or the backgroundColor is
|
|
3175
|
+
* set, this is the padding within the box.
|
|
3176
|
+
*
|
|
3177
|
+
* @sample highcharts/annotations/label-presentation/
|
|
3178
|
+
* Set labels graphic options
|
|
3179
|
+
*/
|
|
3180
|
+
padding: 5,
|
|
3181
|
+
/**
|
|
3182
|
+
* The shadow of the box. The shadow can be an object
|
|
3183
|
+
* configuration containing `color`, `offsetX`, `offsetY`,
|
|
3184
|
+
* `opacity` and `width`.
|
|
3185
|
+
*
|
|
3186
|
+
* @sample highcharts/annotations/label-presentation/
|
|
3187
|
+
* Set labels graphic options
|
|
3188
|
+
*
|
|
3189
|
+
* @type {boolean|Highcharts.ShadowOptionsObject}
|
|
3190
|
+
*/
|
|
3191
|
+
shadow: false,
|
|
3192
|
+
/**
|
|
3193
|
+
* The name of a symbol to use for the border around the
|
|
3194
|
+
* label. Symbols are predefined functions on the Renderer
|
|
3195
|
+
* object.
|
|
3196
|
+
*
|
|
3197
|
+
* @sample highcharts/annotations/shapes/
|
|
3198
|
+
* Available shapes for labels
|
|
3199
|
+
*/
|
|
3200
|
+
shape: 'callout',
|
|
3201
|
+
/**
|
|
3202
|
+
* Styles for the annotation's label.
|
|
3203
|
+
*
|
|
3204
|
+
* @see [plotOptions.series.dataLabels.style](plotOptions.series.dataLabels.style.html)
|
|
3205
|
+
*
|
|
3206
|
+
* @sample highcharts/annotations/label-presentation/
|
|
3207
|
+
* Set labels graphic options
|
|
3208
|
+
*
|
|
3209
|
+
* @type {Highcharts.CSSObject}
|
|
3210
|
+
*/
|
|
3211
|
+
style: {
|
|
3212
|
+
/** @ignore */
|
|
3213
|
+
fontSize: '11px',
|
|
3214
|
+
/** @ignore */
|
|
3215
|
+
fontWeight: 'normal',
|
|
3216
|
+
/** @ignore */
|
|
3217
|
+
color: 'contrast'
|
|
3218
|
+
},
|
|
3219
|
+
/**
|
|
3220
|
+
* Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)
|
|
3221
|
+
* to render the annotation's label.
|
|
3222
|
+
*/
|
|
3223
|
+
useHTML: false,
|
|
3224
|
+
/**
|
|
3225
|
+
* The vertical alignment of the annotation's label.
|
|
3226
|
+
*
|
|
3227
|
+
* @sample highcharts/annotations/label-position/
|
|
3228
|
+
* Set labels position
|
|
3229
|
+
*
|
|
3230
|
+
* @type {Highcharts.VerticalAlignValue}
|
|
3231
|
+
*/
|
|
3232
|
+
verticalAlign: 'bottom',
|
|
3233
|
+
/**
|
|
3234
|
+
* The x position offset of the label relative to the point.
|
|
3235
|
+
* Note that if a `distance` is defined, the distance takes
|
|
3236
|
+
* precedence over `x` and `y` options.
|
|
3237
|
+
*
|
|
3238
|
+
* @sample highcharts/annotations/label-position/
|
|
3239
|
+
* Set labels position
|
|
3240
|
+
*/
|
|
3241
|
+
x: 0,
|
|
3242
|
+
/**
|
|
3243
|
+
* The y position offset of the label relative to the point.
|
|
3244
|
+
* Note that if a `distance` is defined, the distance takes
|
|
3245
|
+
* precedence over `x` and `y` options.
|
|
3246
|
+
*
|
|
3247
|
+
* @sample highcharts/annotations/label-position/
|
|
3248
|
+
* Set labels position
|
|
3249
|
+
*/
|
|
3250
|
+
y: -16
|
|
3251
|
+
},
|
|
3252
|
+
/**
|
|
3253
|
+
* An array of labels for the annotation. For options that apply
|
|
3254
|
+
* to multiple labels, they can be added to the
|
|
3255
|
+
* [labelOptions](annotations.labelOptions.html).
|
|
3256
|
+
*
|
|
3257
|
+
* @type {Array<*>}
|
|
3258
|
+
* @extends annotations.labelOptions
|
|
3259
|
+
* @apioption annotations.labels
|
|
3260
|
+
*/
|
|
3261
|
+
/**
|
|
3262
|
+
* This option defines the point to which the label will be
|
|
3263
|
+
* connected. It can be either the point which exists in the
|
|
3264
|
+
* series - it is referenced by the point's id - or a new point
|
|
3265
|
+
* with defined x, y properties and optionally axes.
|
|
3266
|
+
*
|
|
3267
|
+
* @sample highcharts/annotations/mock-point/
|
|
3268
|
+
* Attach annotation to a mock point
|
|
3269
|
+
*
|
|
3270
|
+
* @declare Highcharts.AnnotationMockPointOptionsObject
|
|
3271
|
+
* @type {string|*}
|
|
3272
|
+
* @requires modules/annotations
|
|
3273
|
+
* @apioption annotations.labels.point
|
|
3274
|
+
*/
|
|
3275
|
+
/**
|
|
3276
|
+
* The x position of the point. Units can be either in axis
|
|
3277
|
+
* or chart pixel coordinates.
|
|
3278
|
+
*
|
|
3279
|
+
* @type {number}
|
|
3280
|
+
* @apioption annotations.labels.point.x
|
|
3281
|
+
*/
|
|
3282
|
+
/**
|
|
3283
|
+
* The y position of the point. Units can be either in axis
|
|
3284
|
+
* or chart pixel coordinates.
|
|
3285
|
+
*
|
|
3286
|
+
* @type {number}
|
|
3287
|
+
* @apioption annotations.labels.point.y
|
|
3288
|
+
*/
|
|
3289
|
+
/**
|
|
3290
|
+
* This number defines which xAxis the point is connected to.
|
|
3291
|
+
* It refers to either the axis id or the index of the axis in
|
|
3292
|
+
* the xAxis array. If the option is not configured or the axis
|
|
3293
|
+
* is not found the point's x coordinate refers to the chart
|
|
3294
|
+
* pixels.
|
|
3295
|
+
*
|
|
3296
|
+
* @type {number|string|null}
|
|
3297
|
+
* @apioption annotations.labels.point.xAxis
|
|
3298
|
+
*/
|
|
3299
|
+
/**
|
|
3300
|
+
* This number defines which yAxis the point is connected to.
|
|
3301
|
+
* It refers to either the axis id or the index of the axis in
|
|
3302
|
+
* the yAxis array. If the option is not configured or the axis
|
|
3303
|
+
* is not found the point's y coordinate refers to the chart
|
|
3304
|
+
* pixels.
|
|
3305
|
+
*
|
|
3306
|
+
* @type {number|string|null}
|
|
3307
|
+
* @apioption annotations.labels.point.yAxis
|
|
3308
|
+
*/
|
|
3309
|
+
/**
|
|
3310
|
+
* An array of shapes for the annotation. For options that apply
|
|
3311
|
+
* to multiple shapes, then can be added to the
|
|
3312
|
+
* [shapeOptions](annotations.shapeOptions.html).
|
|
3313
|
+
*
|
|
3314
|
+
* @type {Array<*>}
|
|
3315
|
+
* @extends annotations.shapeOptions
|
|
3316
|
+
* @apioption annotations.shapes
|
|
3317
|
+
*/
|
|
3318
|
+
/**
|
|
3319
|
+
* This option defines the point to which the shape will be
|
|
3320
|
+
* connected. It can be either the point which exists in the
|
|
3321
|
+
* series - it is referenced by the point's id - or a new point
|
|
3322
|
+
* with defined x, y properties and optionally axes.
|
|
3323
|
+
*
|
|
3324
|
+
* @declare Highcharts.AnnotationMockPointOptionsObject
|
|
3325
|
+
* @type {string|Highcharts.AnnotationMockPointOptionsObject}
|
|
3326
|
+
* @extends annotations.labels.point
|
|
3327
|
+
* @apioption annotations.shapes.point
|
|
3328
|
+
*/
|
|
3329
|
+
/**
|
|
3330
|
+
* An array of points for the shape. This option is available
|
|
3331
|
+
* for shapes which can use multiple points such as path. A
|
|
3332
|
+
* point can be either a point object or a point's id.
|
|
3333
|
+
*
|
|
3334
|
+
* @see [annotations.shapes.point](annotations.shapes.point.html)
|
|
3335
|
+
*
|
|
3336
|
+
* @declare Highcharts.AnnotationMockPointOptionsObject
|
|
3337
|
+
* @type {Array<string|*>}
|
|
3338
|
+
* @extends annotations.labels.point
|
|
3339
|
+
* @apioption annotations.shapes.points
|
|
3340
|
+
*/
|
|
3341
|
+
/**
|
|
3342
|
+
* The URL for an image to use as the annotation shape. Note,
|
|
3343
|
+
* type has to be set to `'image'`.
|
|
3344
|
+
*
|
|
3345
|
+
* @see [annotations.shapes.type](annotations.shapes.type)
|
|
3346
|
+
* @sample highcharts/annotations/shape-src/
|
|
3347
|
+
* Define a marker image url for annotations
|
|
3348
|
+
*
|
|
3349
|
+
* @type {string}
|
|
3350
|
+
* @apioption annotations.shapes.src
|
|
3351
|
+
*/
|
|
3352
|
+
/**
|
|
3353
|
+
* Id of the marker which will be drawn at the final vertex of
|
|
3354
|
+
* the path. Custom markers can be defined in defs property.
|
|
3355
|
+
*
|
|
3356
|
+
* @see [defs.markers](defs.markers.html)
|
|
3357
|
+
*
|
|
3358
|
+
* @sample highcharts/annotations/custom-markers/
|
|
3359
|
+
* Define a custom marker for annotations
|
|
3360
|
+
*
|
|
3361
|
+
* @type {string}
|
|
3362
|
+
* @apioption annotations.shapes.markerEnd
|
|
3363
|
+
*/
|
|
3364
|
+
/**
|
|
3365
|
+
* Id of the marker which will be drawn at the first vertex of
|
|
3366
|
+
* the path. Custom markers can be defined in defs property.
|
|
3367
|
+
*
|
|
3368
|
+
* @see [defs.markers](defs.markers.html)
|
|
3369
|
+
*
|
|
3370
|
+
* @sample {highcharts} highcharts/annotations/custom-markers/
|
|
3371
|
+
* Define a custom marker for annotations
|
|
3372
|
+
*
|
|
3373
|
+
* @type {string}
|
|
3374
|
+
* @apioption annotations.shapes.markerStart
|
|
3375
|
+
*/
|
|
3376
|
+
/**
|
|
3377
|
+
* Options for annotation's shapes. Each shape inherits options
|
|
3378
|
+
* from the shapeOptions object. An option from the shapeOptions
|
|
3379
|
+
* can be overwritten by config for a specific shape.
|
|
3380
|
+
*
|
|
3381
|
+
* @requires modules/annotations
|
|
3382
|
+
*/
|
|
3383
|
+
shapeOptions: {
|
|
3384
|
+
/**
|
|
3385
|
+
* The width of the shape.
|
|
3386
|
+
*
|
|
3387
|
+
* @sample highcharts/annotations/shape/
|
|
3388
|
+
* Basic shape annotation
|
|
3389
|
+
*
|
|
3390
|
+
* @type {number}
|
|
3391
|
+
* @apioption annotations.shapeOptions.width
|
|
3392
|
+
**/
|
|
3393
|
+
/**
|
|
3394
|
+
* The height of the shape.
|
|
3395
|
+
*
|
|
3396
|
+
* @sample highcharts/annotations/shape/
|
|
3397
|
+
* Basic shape annotation
|
|
3398
|
+
*
|
|
3399
|
+
* @type {number}
|
|
3400
|
+
* @apioption annotations.shapeOptions.height
|
|
3401
|
+
*/
|
|
3402
|
+
/**
|
|
3403
|
+
* The type of the shape, e.g. circle or rectangle.
|
|
3404
|
+
*
|
|
3405
|
+
* @sample highcharts/annotations/shape/
|
|
3406
|
+
* Basic shape annotation
|
|
3407
|
+
*
|
|
3408
|
+
* @type {string}
|
|
3409
|
+
* @default rect
|
|
3410
|
+
* @apioption annotations.shapeOptions.type
|
|
3411
|
+
*/
|
|
3412
|
+
/**
|
|
3413
|
+
* The URL for an image to use as the annotation shape.
|
|
3414
|
+
* Note, type has to be set to `'image'`.
|
|
3415
|
+
*
|
|
3416
|
+
* @see [annotations.shapeOptions.type](annotations.shapeOptions.type)
|
|
3417
|
+
* @sample highcharts/annotations/shape-src/
|
|
3418
|
+
* Define a marker image url for annotations
|
|
3419
|
+
*
|
|
3420
|
+
* @type {string}
|
|
3421
|
+
* @apioption annotations.shapeOptions.src
|
|
3422
|
+
*/
|
|
3423
|
+
/**
|
|
3424
|
+
* Name of the dash style to use for the shape's stroke.
|
|
3425
|
+
*
|
|
3426
|
+
* @sample {highcharts} highcharts/plotoptions/series-dashstyle-all/
|
|
3427
|
+
* Possible values demonstrated
|
|
3428
|
+
*
|
|
3429
|
+
* @type {Highcharts.DashStyleValue}
|
|
3430
|
+
* @apioption annotations.shapeOptions.dashStyle
|
|
3431
|
+
*/
|
|
3432
|
+
/**
|
|
3433
|
+
* The color of the shape's stroke.
|
|
3434
|
+
*
|
|
3435
|
+
* @sample highcharts/annotations/shape/
|
|
3436
|
+
* Basic shape annotation
|
|
3437
|
+
*
|
|
3438
|
+
* @type {Highcharts.ColorString}
|
|
3439
|
+
*/
|
|
3440
|
+
stroke: 'rgba(0, 0, 0, 0.75)',
|
|
3441
|
+
/**
|
|
3442
|
+
* The pixel stroke width of the shape.
|
|
3443
|
+
*
|
|
3444
|
+
* @sample highcharts/annotations/shape/
|
|
3445
|
+
* Basic shape annotation
|
|
3446
|
+
*/
|
|
3447
|
+
strokeWidth: 1,
|
|
3448
|
+
/**
|
|
3449
|
+
* The color of the shape's fill.
|
|
3450
|
+
*
|
|
3451
|
+
* @sample highcharts/annotations/shape/
|
|
3452
|
+
* Basic shape annotation
|
|
3453
|
+
*
|
|
3454
|
+
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
|
3455
|
+
*/
|
|
3456
|
+
fill: 'rgba(0, 0, 0, 0.75)',
|
|
3457
|
+
/**
|
|
3458
|
+
* The radius of the shape.
|
|
3459
|
+
*
|
|
3460
|
+
* @sample highcharts/annotations/shape/
|
|
3461
|
+
* Basic shape annotation
|
|
3462
|
+
*/
|
|
3463
|
+
r: 0,
|
|
3464
|
+
/**
|
|
3465
|
+
* Defines additional snapping area around an annotation
|
|
3466
|
+
* making this annotation to focus. Defined in pixels.
|
|
3467
|
+
*/
|
|
3468
|
+
snap: 2
|
|
3469
|
+
},
|
|
3470
|
+
/**
|
|
3471
|
+
* Options for annotation's control points. Each control point
|
|
3472
|
+
* inherits options from controlPointOptions object.
|
|
3473
|
+
* Options from the controlPointOptions can be overwritten
|
|
3474
|
+
* by options in a specific control point.
|
|
3475
|
+
*
|
|
3476
|
+
* @declare Highcharts.AnnotationControlPointOptionsObject
|
|
3477
|
+
* @requires modules/annotations
|
|
3478
|
+
* @apioption annotations.controlPointOptions
|
|
3479
|
+
*/
|
|
3480
|
+
controlPointOptions: {
|
|
3481
|
+
/**
|
|
3482
|
+
* @type {Highcharts.AnnotationControlPointPositionerFunction}
|
|
3483
|
+
* @apioption annotations.controlPointOptions.positioner
|
|
3484
|
+
*/
|
|
3485
|
+
symbol: 'circle',
|
|
3486
|
+
width: 10,
|
|
3487
|
+
height: 10,
|
|
3488
|
+
style: {
|
|
3489
|
+
stroke: 'black',
|
|
3490
|
+
'stroke-width': 2,
|
|
3491
|
+
fill: 'white'
|
|
3492
|
+
},
|
|
3493
|
+
visible: false,
|
|
3494
|
+
events: {}
|
|
3495
|
+
},
|
|
3496
|
+
/**
|
|
3497
|
+
* Event callback when annotation is added to the chart.
|
|
3498
|
+
*
|
|
3499
|
+
* @type {Highcharts.EventCallbackFunction<Highcharts.Annotation>}
|
|
3500
|
+
* @since 7.1.0
|
|
3501
|
+
* @apioption annotations.events.add
|
|
3502
|
+
*/
|
|
3503
|
+
/**
|
|
3504
|
+
* Event callback when annotation is updated (e.g. drag and
|
|
3505
|
+
* droppped or resized by control points).
|
|
3506
|
+
*
|
|
3507
|
+
* @type {Highcharts.EventCallbackFunction<Highcharts.Annotation>}
|
|
3508
|
+
* @since 7.1.0
|
|
3509
|
+
* @apioption annotations.events.afterUpdate
|
|
3510
|
+
*/
|
|
3511
|
+
/**
|
|
3512
|
+
* Event callback when annotation is removed from the chart.
|
|
3513
|
+
*
|
|
3514
|
+
* @type {Highcharts.EventCallbackFunction<Highcharts.Annotation>}
|
|
3515
|
+
* @since 7.1.0
|
|
3516
|
+
* @apioption annotations.events.remove
|
|
3517
|
+
*/
|
|
3518
|
+
/**
|
|
3519
|
+
* Events available in annotations.
|
|
3520
|
+
*
|
|
3521
|
+
* @requires modules/annotations
|
|
3522
|
+
*/
|
|
3523
|
+
events: {},
|
|
3524
|
+
/**
|
|
3525
|
+
* The Z index of the annotation.
|
|
3526
|
+
*/
|
|
3527
|
+
zIndex: 6
|
|
3528
|
+
}
|
|
3529
|
+
}));
|
|
3530
|
+
H.extendAnnotation = function (Constructor, BaseConstructor, prototype, defaultOptions) {
|
|
3531
|
+
BaseConstructor = BaseConstructor || Annotation;
|
|
3532
|
+
merge(true, Constructor.prototype, BaseConstructor.prototype, prototype);
|
|
3533
|
+
Constructor.prototype.defaultOptions = merge(Constructor.prototype.defaultOptions, defaultOptions || {});
|
|
3534
|
+
};
|
|
3535
|
+
/* *********************************************************************
|
|
3536
|
+
*
|
|
3537
|
+
* EXTENDING CHART PROTOTYPE
|
|
3538
|
+
*
|
|
3539
|
+
******************************************************************** */
|
|
3540
|
+
extend(chartProto, /** @lends Highcharts.Chart# */ {
|
|
3541
|
+
initAnnotation: function (userOptions) {
|
|
3542
|
+
var Constructor = Annotation.types[userOptions.type] || Annotation,
|
|
3543
|
+
annotation = new Constructor(this,
|
|
3544
|
+
userOptions);
|
|
3545
|
+
this.annotations.push(annotation);
|
|
3546
|
+
return annotation;
|
|
3547
|
+
},
|
|
3548
|
+
/**
|
|
3549
|
+
* Add an annotation to the chart after render time.
|
|
3550
|
+
*
|
|
3551
|
+
* @param {Highcharts.AnnotationsOptions} options
|
|
3552
|
+
* The annotation options for the new, detailed annotation.
|
|
3553
|
+
* @param {boolean} [redraw]
|
|
3554
|
+
*
|
|
3555
|
+
* @return {Highcharts.Annotation} - The newly generated annotation.
|
|
3556
|
+
*/
|
|
3557
|
+
addAnnotation: function (userOptions, redraw) {
|
|
3558
|
+
var annotation = this.initAnnotation(userOptions);
|
|
3559
|
+
this.options.annotations.push(annotation.options);
|
|
3560
|
+
if (pick(redraw, true)) {
|
|
3561
|
+
annotation.redraw();
|
|
3562
|
+
annotation.graphic.attr({
|
|
3563
|
+
opacity: 1
|
|
3564
|
+
});
|
|
3565
|
+
}
|
|
3566
|
+
return annotation;
|
|
3567
|
+
},
|
|
3568
|
+
/**
|
|
3569
|
+
* Remove an annotation from the chart.
|
|
3570
|
+
*
|
|
3571
|
+
* @param {number|string|Highcharts.Annotation} idOrAnnotation
|
|
3572
|
+
* The annotation's id or direct annotation object.
|
|
3573
|
+
*/
|
|
3574
|
+
removeAnnotation: function (idOrAnnotation) {
|
|
3575
|
+
var annotations = this.annotations,
|
|
3576
|
+
annotation = idOrAnnotation.coll === 'annotations' ?
|
|
3577
|
+
idOrAnnotation :
|
|
3578
|
+
find(annotations,
|
|
3579
|
+
function (annotation) {
|
|
3580
|
+
return annotation.options.id === idOrAnnotation;
|
|
3581
|
+
});
|
|
3582
|
+
if (annotation) {
|
|
3583
|
+
fireEvent(annotation, 'remove');
|
|
3584
|
+
erase(this.options.annotations, annotation.options);
|
|
3585
|
+
erase(annotations, annotation);
|
|
3586
|
+
annotation.destroy();
|
|
3587
|
+
}
|
|
3588
|
+
},
|
|
3589
|
+
drawAnnotations: function () {
|
|
3590
|
+
this.plotBoxClip.attr(this.plotBox);
|
|
3591
|
+
this.annotations.forEach(function (annotation) {
|
|
3592
|
+
annotation.redraw();
|
|
3593
|
+
annotation.graphic.animate({
|
|
3594
|
+
opacity: 1
|
|
3595
|
+
}, annotation.animationConfig);
|
|
3596
|
+
});
|
|
3597
|
+
}
|
|
3598
|
+
});
|
|
3599
|
+
// Let chart.update() update annotations
|
|
3600
|
+
chartProto.collectionsWithUpdate.push('annotations');
|
|
3601
|
+
// Let chart.update() create annoations on demand
|
|
3602
|
+
chartProto.collectionsWithInit.annotations = [chartProto.addAnnotation];
|
|
3603
|
+
chartProto.callbacks.push(function (chart) {
|
|
3604
|
+
chart.annotations = [];
|
|
3605
|
+
if (!chart.options.annotations) {
|
|
3606
|
+
chart.options.annotations = [];
|
|
3607
|
+
}
|
|
3608
|
+
chart.plotBoxClip = this.renderer.clipRect(this.plotBox);
|
|
3609
|
+
chart.controlPointsGroup = chart.renderer
|
|
3610
|
+
.g('control-points')
|
|
3611
|
+
.attr({ zIndex: 99 })
|
|
3612
|
+
.clip(chart.plotBoxClip)
|
|
3613
|
+
.add();
|
|
3614
|
+
chart.options.annotations.forEach(function (annotationOptions, i) {
|
|
3615
|
+
var annotation = chart.initAnnotation(annotationOptions);
|
|
3616
|
+
chart.options.annotations[i] = annotation.options;
|
|
3617
|
+
});
|
|
3618
|
+
chart.drawAnnotations();
|
|
3619
|
+
addEvent(chart, 'redraw', chart.drawAnnotations);
|
|
3620
|
+
addEvent(chart, 'destroy', function () {
|
|
3621
|
+
chart.plotBoxClip.destroy();
|
|
3622
|
+
chart.controlPointsGroup.destroy();
|
|
3623
|
+
});
|
|
3624
|
+
addEvent(chart, 'exportData', function (event) {
|
|
3625
|
+
var _a,
|
|
3626
|
+
_b,
|
|
3627
|
+
_c,
|
|
3628
|
+
_d,
|
|
3629
|
+
_e,
|
|
3630
|
+
_f,
|
|
3631
|
+
_g,
|
|
3632
|
+
_h;
|
|
3633
|
+
var annotations = chart.annotations,
|
|
3634
|
+
csvColumnHeaderFormatter = ((this.options.exporting &&
|
|
3635
|
+
this.options.exporting.csv) ||
|
|
3636
|
+
{}).columnHeaderFormatter,
|
|
3637
|
+
// If second row doesn't have xValues
|
|
3638
|
+
// then it is a title row thus multiple level header is in use.
|
|
3639
|
+
multiLevelHeaders = !event.dataRows[1].xValues,
|
|
3640
|
+
annotationHeader = (_b = (_a = chart.options.lang) === null || _a === void 0 ? void 0 : _a.exportData) === null || _b === void 0 ? void 0 : _b.annotationHeader,
|
|
3641
|
+
columnHeaderFormatter = function (index) {
|
|
3642
|
+
var s;
|
|
3643
|
+
if (csvColumnHeaderFormatter) {
|
|
3644
|
+
s = csvColumnHeaderFormatter(index);
|
|
3645
|
+
if (s !== false) {
|
|
3646
|
+
return s;
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
s = annotationHeader + ' ' + index;
|
|
3650
|
+
if (multiLevelHeaders) {
|
|
3651
|
+
return {
|
|
3652
|
+
columnTitle: s,
|
|
3653
|
+
topLevelColumnTitle: s
|
|
3654
|
+
};
|
|
3655
|
+
}
|
|
3656
|
+
return s;
|
|
3657
|
+
}, startRowLength = event.dataRows[0].length, annotationSeparator = (_e = (_d = (_c = chart.options.exporting) === null || _c === void 0 ? void 0 : _c.csv) === null || _d === void 0 ? void 0 : _d.annotations) === null || _e === void 0 ? void 0 : _e.itemDelimiter, joinAnnotations = (_h = (_g = (_f = chart.options.exporting) === null || _f === void 0 ? void 0 : _f.csv) === null || _g === void 0 ? void 0 : _g.annotations) === null || _h === void 0 ? void 0 : _h.join;
|
|
3658
|
+
annotations.forEach(function (annotation) {
|
|
3659
|
+
if (annotation.options.labelOptions.includeInDataExport) {
|
|
3660
|
+
annotation.labels.forEach(function (label) {
|
|
3661
|
+
if (label.options.text) {
|
|
3662
|
+
var annotationText_1 = label.options.text;
|
|
3663
|
+
label.points.forEach(function (points) {
|
|
3664
|
+
var annotationX = points.x,
|
|
3665
|
+
xAxisIndex = points.series.xAxis ?
|
|
3666
|
+
points.series.xAxis.options.index :
|
|
3667
|
+
-1;
|
|
3668
|
+
var wasAdded = false;
|
|
3669
|
+
// Annotation not connected to any xAxis -
|
|
3670
|
+
// add new row.
|
|
3671
|
+
if (xAxisIndex === -1) {
|
|
3672
|
+
var n = event.dataRows[0].length,
|
|
3673
|
+
newRow = new Array(n);
|
|
3674
|
+
for (var i = 0; i < n; ++i) {
|
|
3675
|
+
newRow[i] = '';
|
|
3676
|
+
}
|
|
3677
|
+
newRow.push(annotationText_1);
|
|
3678
|
+
newRow.xValues = [];
|
|
3679
|
+
newRow.xValues[xAxisIndex] = annotationX;
|
|
3680
|
+
event.dataRows.push(newRow);
|
|
3681
|
+
wasAdded = true;
|
|
3682
|
+
}
|
|
3683
|
+
// Annotation placed on a exported data point
|
|
3684
|
+
// - add new column
|
|
3685
|
+
if (!wasAdded) {
|
|
3686
|
+
event.dataRows.forEach(function (row, rowIndex) {
|
|
3687
|
+
if (!wasAdded &&
|
|
3688
|
+
row.xValues &&
|
|
3689
|
+
xAxisIndex !== void 0 &&
|
|
3690
|
+
annotationX === row.xValues[xAxisIndex]) {
|
|
3691
|
+
if (joinAnnotations &&
|
|
3692
|
+
row.length > startRowLength) {
|
|
3693
|
+
row[row.length - 1] +=
|
|
3694
|
+
annotationSeparator + annotationText_1;
|
|
3695
|
+
}
|
|
3696
|
+
else {
|
|
3697
|
+
row.push(annotationText_1);
|
|
3698
|
+
}
|
|
3699
|
+
wasAdded = true;
|
|
3700
|
+
}
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
// Annotation not placed on any exported data point,
|
|
3704
|
+
// but connected to the xAxis - add new row
|
|
3705
|
+
if (!wasAdded) {
|
|
3706
|
+
var n = event.dataRows[0].length,
|
|
3707
|
+
newRow = new Array(n);
|
|
3708
|
+
for (var i = 0; i < n; ++i) {
|
|
3709
|
+
newRow[i] = '';
|
|
3710
|
+
}
|
|
3711
|
+
newRow[0] = annotationX;
|
|
3712
|
+
newRow.push(annotationText_1);
|
|
3713
|
+
newRow.xValues = [];
|
|
3714
|
+
if (xAxisIndex !== void 0) {
|
|
3715
|
+
newRow.xValues[xAxisIndex] = annotationX;
|
|
3716
|
+
}
|
|
3717
|
+
event.dataRows.push(newRow);
|
|
3718
|
+
}
|
|
3719
|
+
});
|
|
3720
|
+
}
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
});
|
|
3724
|
+
var maxRowLen = 0;
|
|
3725
|
+
event.dataRows.forEach(function (row) {
|
|
3726
|
+
maxRowLen = Math.max(maxRowLen, row.length);
|
|
3727
|
+
});
|
|
3728
|
+
var newRows = maxRowLen - event.dataRows[0].length;
|
|
3729
|
+
for (var i = 0; i < newRows; i++) {
|
|
3730
|
+
var header = columnHeaderFormatter(i + 1);
|
|
3731
|
+
if (multiLevelHeaders) {
|
|
3732
|
+
event.dataRows[0].push(header.topLevelColumnTitle);
|
|
3733
|
+
event.dataRows[1].push(header.columnTitle);
|
|
3734
|
+
}
|
|
3735
|
+
else {
|
|
3736
|
+
event.dataRows[0].push(header);
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
});
|
|
3740
|
+
});
|
|
3741
|
+
wrap(Pointer.prototype, 'onContainerMouseDown', function (proceed) {
|
|
3742
|
+
if (!this.chart.hasDraggedAnnotation) {
|
|
3743
|
+
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
|
3744
|
+
}
|
|
3745
|
+
});
|
|
3746
|
+
H.Annotation = Annotation;
|
|
3747
|
+
|
|
3748
|
+
return Annotation;
|
|
3749
|
+
});
|
|
3750
|
+
_registerModule(_modules, 'Mixins/Navigation.js', [], function () {
|
|
33
3751
|
/**
|
|
34
3752
|
*
|
|
35
3753
|
* (c) 2010-2018 Paweł Fus
|
|
@@ -88,7 +3806,7 @@
|
|
|
88
3806
|
|
|
89
3807
|
return chartNavigation;
|
|
90
3808
|
});
|
|
91
|
-
_registerModule(_modules, '
|
|
3809
|
+
_registerModule(_modules, 'Extensions/Annotations/NavigationBindings.js', [_modules['Extensions/Annotations/Annotations.js'], _modules['Core/Chart/Chart.js'], _modules['Mixins/Navigation.js'], _modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (Annotation, Chart, chartNavigationMixin, H, U) {
|
|
92
3810
|
/* *
|
|
93
3811
|
*
|
|
94
3812
|
* (c) 2009-2017 Highsoft, Black Label
|
|
@@ -98,6 +3816,19 @@
|
|
|
98
3816
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
99
3817
|
*
|
|
100
3818
|
* */
|
|
3819
|
+
var addEvent = U.addEvent,
|
|
3820
|
+
attr = U.attr,
|
|
3821
|
+
extend = U.extend,
|
|
3822
|
+
format = U.format,
|
|
3823
|
+
fireEvent = U.fireEvent,
|
|
3824
|
+
isArray = U.isArray,
|
|
3825
|
+
isFunction = U.isFunction,
|
|
3826
|
+
isNumber = U.isNumber,
|
|
3827
|
+
isObject = U.isObject,
|
|
3828
|
+
merge = U.merge,
|
|
3829
|
+
objectEach = U.objectEach,
|
|
3830
|
+
pick = U.pick,
|
|
3831
|
+
setOptions = U.setOptions;
|
|
101
3832
|
/**
|
|
102
3833
|
* A config object for navigation bindings in annotations.
|
|
103
3834
|
*
|
|
@@ -124,18 +3855,6 @@
|
|
|
124
3855
|
* @name Highcharts.NavigationBindingsOptionsObject#steps
|
|
125
3856
|
* @type {Array<Function>|undefined}
|
|
126
3857
|
*/
|
|
127
|
-
var addEvent = U.addEvent,
|
|
128
|
-
attr = U.attr,
|
|
129
|
-
extend = U.extend,
|
|
130
|
-
format = U.format,
|
|
131
|
-
fireEvent = U.fireEvent,
|
|
132
|
-
isArray = U.isArray,
|
|
133
|
-
isFunction = U.isFunction,
|
|
134
|
-
isNumber = U.isNumber,
|
|
135
|
-
isObject = U.isObject,
|
|
136
|
-
merge = U.merge,
|
|
137
|
-
objectEach = U.objectEach,
|
|
138
|
-
pick = U.pick;
|
|
139
3858
|
var doc = H.doc,
|
|
140
3859
|
win = H.win,
|
|
141
3860
|
PREFIX = 'highcharts-';
|
|
@@ -293,7 +4012,7 @@
|
|
|
293
4012
|
navigation.bindingsChartClick(this, e);
|
|
294
4013
|
}
|
|
295
4014
|
}));
|
|
296
|
-
navigation.eventsToUnbind.push(addEvent(chart.container, 'mousemove', function (e) {
|
|
4015
|
+
navigation.eventsToUnbind.push(addEvent(chart.container, H.isTouchDevice ? 'touchmove' : 'mousemove', function (e) {
|
|
297
4016
|
navigation.bindingsContainerMouseMove(this, e);
|
|
298
4017
|
}));
|
|
299
4018
|
};
|
|
@@ -553,6 +4272,7 @@
|
|
|
553
4272
|
function traverse(option, key, parentEditables, parent) {
|
|
554
4273
|
var nextParent;
|
|
555
4274
|
if (parentEditables &&
|
|
4275
|
+
option &&
|
|
556
4276
|
nonEditables.indexOf(key) === -1 &&
|
|
557
4277
|
((parentEditables.indexOf &&
|
|
558
4278
|
parentEditables.indexOf(key)) >= 0 ||
|
|
@@ -753,7 +4473,7 @@
|
|
|
753
4473
|
rect: ['shapes'],
|
|
754
4474
|
// Crooked lines, elliots, arrows etc:
|
|
755
4475
|
crookedLine: [],
|
|
756
|
-
basicAnnotation: []
|
|
4476
|
+
basicAnnotation: ['shapes', 'labelOptions']
|
|
757
4477
|
};
|
|
758
4478
|
// Define non editable fields per annotation, for example Rectangle inherits
|
|
759
4479
|
// options from Measure, but crosshairs are not available
|
|
@@ -770,7 +4490,7 @@
|
|
|
770
4490
|
* @type {bindingsUtils}
|
|
771
4491
|
*/
|
|
772
4492
|
NavigationBindings.prototype.utils = bindingsUtils;
|
|
773
|
-
|
|
4493
|
+
Chart.prototype.initNavigationBindings = function () {
|
|
774
4494
|
var chart = this,
|
|
775
4495
|
options = chart.options;
|
|
776
4496
|
if (options && options.navigation && options.navigation.bindings) {
|
|
@@ -779,10 +4499,10 @@
|
|
|
779
4499
|
chart.navigationBindings.initUpdate();
|
|
780
4500
|
}
|
|
781
4501
|
};
|
|
782
|
-
addEvent(
|
|
4502
|
+
addEvent(Chart, 'load', function () {
|
|
783
4503
|
this.initNavigationBindings();
|
|
784
4504
|
});
|
|
785
|
-
addEvent(
|
|
4505
|
+
addEvent(Chart, 'destroy', function () {
|
|
786
4506
|
if (this.navigationBindings) {
|
|
787
4507
|
this.navigationBindings.destroy();
|
|
788
4508
|
}
|
|
@@ -790,7 +4510,7 @@
|
|
|
790
4510
|
addEvent(NavigationBindings, 'deselectButton', function () {
|
|
791
4511
|
this.selectedButtonElement = null;
|
|
792
4512
|
});
|
|
793
|
-
addEvent(
|
|
4513
|
+
addEvent(Annotation, 'remove', function () {
|
|
794
4514
|
if (this.chart.navigationBindings) {
|
|
795
4515
|
this.chart.navigationBindings.deselectAnnotation();
|
|
796
4516
|
}
|
|
@@ -810,7 +4530,7 @@
|
|
|
810
4530
|
navigation = annotation.chart.navigationBindings,
|
|
811
4531
|
prevAnnotation = navigation.activeAnnotation;
|
|
812
4532
|
if (originalClick) {
|
|
813
|
-
originalClick.
|
|
4533
|
+
originalClick.call(annotation, event);
|
|
814
4534
|
}
|
|
815
4535
|
if (prevAnnotation !== annotation) {
|
|
816
4536
|
// Select current:
|
|
@@ -859,15 +4579,17 @@
|
|
|
859
4579
|
}
|
|
860
4580
|
if (H.Annotation) {
|
|
861
4581
|
// Basic shapes:
|
|
862
|
-
selectableAnnotation(
|
|
4582
|
+
selectableAnnotation(Annotation);
|
|
863
4583
|
// Advanced annotations:
|
|
864
|
-
objectEach(
|
|
4584
|
+
objectEach(Annotation.types, function (annotationType) {
|
|
865
4585
|
selectableAnnotation(annotationType);
|
|
866
4586
|
});
|
|
867
4587
|
}
|
|
868
|
-
|
|
4588
|
+
setOptions({
|
|
869
4589
|
/**
|
|
870
4590
|
* @optionparent lang
|
|
4591
|
+
*
|
|
4592
|
+
* @private
|
|
871
4593
|
*/
|
|
872
4594
|
lang: {
|
|
873
4595
|
/**
|
|
@@ -917,6 +4639,8 @@
|
|
|
917
4639
|
/**
|
|
918
4640
|
* @optionparent navigation
|
|
919
4641
|
* @product highcharts highstock
|
|
4642
|
+
*
|
|
4643
|
+
* @private
|
|
920
4644
|
*/
|
|
921
4645
|
navigation: {
|
|
922
4646
|
/**
|
|
@@ -1115,7 +4839,7 @@
|
|
|
1115
4839
|
* from a different server.
|
|
1116
4840
|
*
|
|
1117
4841
|
* @type {string}
|
|
1118
|
-
* @default https://code.highcharts.com/8.
|
|
4842
|
+
* @default https://code.highcharts.com/8.2.2/gfx/stock-icons/
|
|
1119
4843
|
* @since 7.1.3
|
|
1120
4844
|
* @apioption navigation.iconsURL
|
|
1121
4845
|
*/
|
|
@@ -1173,13 +4897,17 @@
|
|
|
1173
4897
|
* measure, pitchfork, tunnel, verticalLine, basicAnnotation
|
|
1174
4898
|
* @apioption navigation.annotationsOptions
|
|
1175
4899
|
*/
|
|
1176
|
-
annotationsOptions: {
|
|
4900
|
+
annotationsOptions: {
|
|
4901
|
+
animation: {
|
|
4902
|
+
defer: 0
|
|
4903
|
+
}
|
|
4904
|
+
}
|
|
1177
4905
|
}
|
|
1178
4906
|
});
|
|
1179
4907
|
|
|
1180
4908
|
return NavigationBindings;
|
|
1181
4909
|
});
|
|
1182
|
-
_registerModule(_modules, '
|
|
4910
|
+
_registerModule(_modules, 'Stock/StockToolsBindings.js', [_modules['Core/Globals.js'], _modules['Extensions/Annotations/NavigationBindings.js'], _modules['Core/Utilities.js']], function (H, NavigationBindings, U) {
|
|
1183
4911
|
/**
|
|
1184
4912
|
*
|
|
1185
4913
|
* Events generator for Stock tools
|
|
@@ -1195,9 +4923,11 @@
|
|
|
1195
4923
|
defined = U.defined,
|
|
1196
4924
|
extend = U.extend,
|
|
1197
4925
|
fireEvent = U.fireEvent,
|
|
4926
|
+
getOptions = U.getOptions,
|
|
1198
4927
|
isNumber = U.isNumber,
|
|
1199
4928
|
merge = U.merge,
|
|
1200
4929
|
pick = U.pick,
|
|
4930
|
+
setOptions = U.setOptions,
|
|
1201
4931
|
uniqueKey = U.uniqueKey;
|
|
1202
4932
|
var bindingsUtils = NavigationBindings.prototype.utils,
|
|
1203
4933
|
PREFIX = 'highcharts-';
|
|
@@ -1290,6 +5020,7 @@
|
|
|
1290
5020
|
};
|
|
1291
5021
|
};
|
|
1292
5022
|
bindingsUtils.manageIndicators = function (data) {
|
|
5023
|
+
var _a;
|
|
1293
5024
|
var navigation = this,
|
|
1294
5025
|
chart = navigation.chart,
|
|
1295
5026
|
seriesConfig = {
|
|
@@ -1329,6 +5060,8 @@
|
|
|
1329
5060
|
'linearRegressionAngle'
|
|
1330
5061
|
],
|
|
1331
5062
|
yAxis,
|
|
5063
|
+
parentSeries,
|
|
5064
|
+
defaultOptions,
|
|
1332
5065
|
series;
|
|
1333
5066
|
if (data.actionType === 'edit') {
|
|
1334
5067
|
navigation.fieldsToOptions(data.fields, seriesConfig);
|
|
@@ -1356,6 +5089,19 @@
|
|
|
1356
5089
|
else {
|
|
1357
5090
|
seriesConfig.id = uniqueKey();
|
|
1358
5091
|
navigation.fieldsToOptions(data.fields, seriesConfig);
|
|
5092
|
+
parentSeries = chart.get(seriesConfig.linkedTo);
|
|
5093
|
+
defaultOptions = getOptions().plotOptions;
|
|
5094
|
+
// Make sure that indicator uses the SUM approx if SUM approx is used
|
|
5095
|
+
// by parent series (#13950).
|
|
5096
|
+
if (typeof parentSeries !== 'undefined' &&
|
|
5097
|
+
parentSeries instanceof Highcharts.Series &&
|
|
5098
|
+
parentSeries.getDGApproximation() === 'sum' &&
|
|
5099
|
+
// If indicator has defined approx type, use it (e.g. "ranges")
|
|
5100
|
+
!defined(defaultOptions && defaultOptions[seriesConfig.type] && ((_a = defaultOptions.dataGrouping) === null || _a === void 0 ? void 0 : _a.approximation))) {
|
|
5101
|
+
seriesConfig.dataGrouping = {
|
|
5102
|
+
approximation: 'sum'
|
|
5103
|
+
};
|
|
5104
|
+
}
|
|
1359
5105
|
if (indicatorsWithAxes.indexOf(data.type) >= 0) {
|
|
1360
5106
|
yAxis = chart.addAxis({
|
|
1361
5107
|
id: uniqueKey(),
|
|
@@ -1593,7 +5339,6 @@
|
|
|
1593
5339
|
* @function Highcharts.NavigationBindings#resizeYAxes
|
|
1594
5340
|
* @param {number} [defaultHeight]
|
|
1595
5341
|
* Default height for yAxis
|
|
1596
|
-
* @return {void}
|
|
1597
5342
|
*/
|
|
1598
5343
|
resizeYAxes: function (defaultHeight) {
|
|
1599
5344
|
defaultHeight = defaultHeight || 20; // in %, but as a number
|
|
@@ -2826,6 +6571,8 @@
|
|
|
2826
6571
|
/**
|
|
2827
6572
|
* Displays chart in fullscreen.
|
|
2828
6573
|
*
|
|
6574
|
+
* **Note**: Fullscreen is not supported on iPhone due to iOS limitations.
|
|
6575
|
+
*
|
|
2829
6576
|
* @type {Highcharts.NavigationBindingsOptionsObject}
|
|
2830
6577
|
* @product highstock
|
|
2831
6578
|
* @default {"className": "highcharts-full-screen", "init": function() {}}
|
|
@@ -3005,7 +6752,7 @@
|
|
|
3005
6752
|
}
|
|
3006
6753
|
}
|
|
3007
6754
|
};
|
|
3008
|
-
|
|
6755
|
+
setOptions({
|
|
3009
6756
|
navigation: {
|
|
3010
6757
|
bindings: stockToolsBindings
|
|
3011
6758
|
}
|
|
@@ -3013,7 +6760,7 @@
|
|
|
3013
6760
|
NavigationBindings.prototype.utils = merge(bindingsUtils, NavigationBindings.prototype.utils);
|
|
3014
6761
|
|
|
3015
6762
|
});
|
|
3016
|
-
_registerModule(_modules, '
|
|
6763
|
+
_registerModule(_modules, 'Stock/StockToolsGui.js', [_modules['Core/Chart/Chart.js'], _modules['Core/Globals.js'], _modules['Extensions/Annotations/NavigationBindings.js'], _modules['Core/Utilities.js']], function (Chart, H, NavigationBindings, U) {
|
|
3017
6764
|
/* *
|
|
3018
6765
|
*
|
|
3019
6766
|
* GUI generator for Stock tools
|
|
@@ -3033,9 +6780,10 @@
|
|
|
3033
6780
|
getStyle = U.getStyle,
|
|
3034
6781
|
isArray = U.isArray,
|
|
3035
6782
|
merge = U.merge,
|
|
3036
|
-
pick = U.pick
|
|
3037
|
-
|
|
3038
|
-
|
|
6783
|
+
pick = U.pick,
|
|
6784
|
+
setOptions = U.setOptions;
|
|
6785
|
+
var DIV = 'div', SPAN = 'span', UL = 'ul', LI = 'li', PREFIX = 'highcharts-', activeClass = PREFIX + 'active';
|
|
6786
|
+
setOptions({
|
|
3039
6787
|
/**
|
|
3040
6788
|
* @optionparent lang
|
|
3041
6789
|
*/
|
|
@@ -3204,9 +6952,10 @@
|
|
|
3204
6952
|
toolbarClassName: 'stocktools-toolbar',
|
|
3205
6953
|
/**
|
|
3206
6954
|
* A collection of strings pointing to config options for the
|
|
3207
|
-
* toolbar items. Each name refers to unique key from
|
|
3208
|
-
* object.
|
|
6955
|
+
* toolbar items. Each name refers to a unique key from the
|
|
6956
|
+
* definitions object.
|
|
3209
6957
|
*
|
|
6958
|
+
* @type {Array<string>}
|
|
3210
6959
|
* @default [
|
|
3211
6960
|
* 'indicators',
|
|
3212
6961
|
* 'separator',
|
|
@@ -3761,10 +7510,10 @@
|
|
|
3761
7510
|
});
|
|
3762
7511
|
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
3763
7512
|
// Run HTML generator
|
|
3764
|
-
addEvent(
|
|
7513
|
+
addEvent(Chart, 'afterGetContainer', function () {
|
|
3765
7514
|
this.setStockTools();
|
|
3766
7515
|
});
|
|
3767
|
-
addEvent(
|
|
7516
|
+
addEvent(Chart, 'getMargins', function () {
|
|
3768
7517
|
var listWrapper = this.stockTools && this.stockTools.listWrapper,
|
|
3769
7518
|
offsetWidth = listWrapper && ((listWrapper.startWidth +
|
|
3770
7519
|
getStyle(listWrapper, 'padding-left') +
|
|
@@ -3773,12 +7522,12 @@
|
|
|
3773
7522
|
this.plotLeft += offsetWidth;
|
|
3774
7523
|
}
|
|
3775
7524
|
});
|
|
3776
|
-
addEvent(
|
|
7525
|
+
addEvent(Chart, 'destroy', function () {
|
|
3777
7526
|
if (this.stockTools) {
|
|
3778
7527
|
this.stockTools.destroy();
|
|
3779
7528
|
}
|
|
3780
7529
|
});
|
|
3781
|
-
addEvent(
|
|
7530
|
+
addEvent(Chart, 'redraw', function () {
|
|
3782
7531
|
if (this.stockTools && this.stockTools.guiEnabled) {
|
|
3783
7532
|
this.stockTools.redraw();
|
|
3784
7533
|
}
|
|
@@ -4269,7 +8018,7 @@
|
|
|
4269
8018
|
Toolbar.prototype.getIconsURL = function () {
|
|
4270
8019
|
return this.chart.options.navigation.iconsURL ||
|
|
4271
8020
|
this.options.iconsURL ||
|
|
4272
|
-
'https://code.highcharts.com/8.
|
|
8021
|
+
'https://code.highcharts.com/8.2.2/gfx/stock-icons/';
|
|
4273
8022
|
};
|
|
4274
8023
|
return Toolbar;
|
|
4275
8024
|
}());
|
|
@@ -4319,12 +8068,11 @@
|
|
|
4319
8068
|
saveChart: PREFIX + 'save-chart',
|
|
4320
8069
|
separator: PREFIX + 'separator'
|
|
4321
8070
|
};
|
|
4322
|
-
extend(
|
|
8071
|
+
extend(Chart.prototype, {
|
|
4323
8072
|
/**
|
|
4324
8073
|
* Verify if Toolbar should be added.
|
|
4325
8074
|
* @private
|
|
4326
8075
|
* @param {Highcharts.StockToolsOptions} - chart options
|
|
4327
|
-
* @return {void}
|
|
4328
8076
|
*/
|
|
4329
8077
|
setStockTools: function (options) {
|
|
4330
8078
|
var chartOptions = this.options,
|
|
@@ -4332,7 +8080,7 @@
|
|
|
4332
8080
|
guiOptions = merge(chartOptions.stockTools && chartOptions.stockTools.gui,
|
|
4333
8081
|
options && options.gui),
|
|
4334
8082
|
langOptions = lang.stockTools && lang.stockTools.gui;
|
|
4335
|
-
this.stockTools = new
|
|
8083
|
+
this.stockTools = new Toolbar(guiOptions, langOptions, this);
|
|
4336
8084
|
if (this.stockTools.guiEnabled) {
|
|
4337
8085
|
this.isDirtyBox = true;
|
|
4338
8086
|
}
|