highcharts 10.0.0 → 10.2.1
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 +10 -20
- package/css/themes/dark-unica.css +10 -20
- package/css/themes/grid-light.css +10 -20
- package/css/themes/sand-signika.css +10 -20
- package/es-modules/Accessibility/A11yI18n.js +4 -4
- package/es-modules/Accessibility/Accessibility.js +8 -3
- package/es-modules/Accessibility/Components/AnnotationsA11y.js +3 -3
- package/es-modules/Accessibility/Components/ContainerComponent.js +11 -10
- package/es-modules/Accessibility/Components/InfoRegionsComponent.js +18 -11
- package/es-modules/Accessibility/Components/LegendComponent.js +11 -11
- package/es-modules/Accessibility/Components/MenuComponent.js +3 -1
- package/es-modules/Accessibility/Components/RangeSelectorComponent.js +3 -1
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js +3 -1
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +34 -17
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +35 -10
- package/es-modules/Accessibility/Components/ZoomComponent.js +30 -70
- package/es-modules/Accessibility/FocusBorder.js +6 -5
- package/es-modules/Accessibility/HighContrastMode.js +1 -1
- package/es-modules/Accessibility/KeyboardNavigation.js +2 -2
- package/es-modules/Accessibility/Options/{Options.js → A11yDefaults.js} +73 -5
- package/es-modules/Accessibility/Options/DeprecatedOptions.js +12 -2
- package/es-modules/Accessibility/Options/{LangOptions.js → LangDefaults.js} +46 -31
- package/es-modules/Accessibility/Utils/ChartUtilities.js +10 -5
- package/es-modules/Core/Animation/Fx.js +1 -1
- package/es-modules/Core/Axis/Axis.js +51 -46
- package/es-modules/Core/Axis/Axis3D.js +1 -1
- package/es-modules/Core/Axis/AxisDefaults.js +9 -9
- package/es-modules/Core/Axis/BrokenAxis.js +1 -1
- package/es-modules/Core/Axis/Color/ColorAxis.js +4 -2
- package/es-modules/Core/Axis/Color/ColorAxisDefaults.js +7 -3
- package/es-modules/Core/Axis/DateTimeAxis.js +5 -3
- package/es-modules/Core/Axis/GridAxis.js +821 -822
- package/es-modules/Core/Axis/LogarithmicAxis.js +1 -1
- package/es-modules/Core/Axis/NavigatorAxis.js +2 -2
- package/es-modules/Core/Axis/OrdinalAxis.js +26 -3
- package/es-modules/Core/Axis/PlotLineOrBand/PlotLineOrBand.js +3 -3
- package/es-modules/Core/Axis/RadialAxis.js +1 -1
- package/es-modules/Core/Axis/Stacking/StackItem.js +262 -0
- package/es-modules/Core/Axis/Stacking/StackingAxis.js +468 -0
- package/es-modules/Core/Axis/Tick.js +22 -18
- package/es-modules/Core/Axis/TreeGrid/TreeGridAxis.js +732 -0
- package/es-modules/Core/Axis/TreeGrid/TreeGridTick.js +313 -0
- package/es-modules/Core/Axis/WaterfallAxis.js +1 -1
- package/es-modules/Core/Axis/ZAxis.js +76 -71
- package/es-modules/Core/Chart/Chart.js +42 -9
- package/es-modules/Core/Chart/Chart3D.js +2 -2
- package/es-modules/Core/Chart/ChartDefaults.js +165 -5
- package/es-modules/Core/Chart/GanttChart.js +3 -1
- package/es-modules/Core/Chart/MapChart.js +3 -1
- package/es-modules/Core/Chart/StockChart.js +12 -8
- package/es-modules/Core/Color/Color.js +1 -1
- package/es-modules/Core/DefaultOptions.js +19 -16
- package/es-modules/Core/Geometry/CircleUtilities.js +4 -4
- package/es-modules/Core/Globals.js +2 -1
- package/es-modules/Core/HttpUtilities.js +39 -37
- package/es-modules/Core/Legend/Legend.js +4 -4
- package/es-modules/Core/MSPointer.js +3 -1
- package/es-modules/{Extensions → Core}/Math3D.js +48 -43
- package/es-modules/Core/Navigator.js +31 -14
- package/es-modules/Core/Pointer.js +8 -10
- package/es-modules/Core/Renderer/HTML/AST.js +13 -7
- package/es-modules/Core/Renderer/HTML/HTMLElement.js +3 -1
- package/es-modules/Core/Renderer/HTML/HTMLRenderer.js +3 -1
- package/es-modules/Core/Renderer/SVG/SVGElement.js +132 -192
- package/es-modules/Core/Renderer/SVG/SVGLabel.js +32 -28
- package/es-modules/Core/Renderer/SVG/SVGRenderer.js +50 -45
- package/es-modules/Core/Renderer/SVG/SVGRenderer3D.js +5 -3
- package/es-modules/Core/Renderer/SVG/TextBuilder.js +5 -3
- package/es-modules/Core/Scrollbar.js +12 -6
- package/es-modules/Core/ScrollbarDefaults.js +8 -8
- package/es-modules/Core/Series/DataLabel.js +63 -40
- package/es-modules/Core/Series/Point.js +11 -2
- package/es-modules/Core/Series/Series.js +60 -43
- package/es-modules/Core/Series/Series3D.js +4 -2
- package/es-modules/Core/Series/SeriesDefaults.js +11 -6
- package/es-modules/Core/Series/SeriesRegistry.js +6 -29
- package/es-modules/Core/Time.js +6 -7
- package/es-modules/Core/Tooltip.js +17 -6
- package/es-modules/Core/Utilities.js +7 -9
- package/es-modules/Data/DataConverter.js +6 -1
- package/es-modules/Data/DataPromise.js +1 -1
- package/es-modules/Data/DataSeriesComposition.js +288 -0
- package/es-modules/Data/DataSeriesConverter.js +1 -1
- package/es-modules/Data/DataTable.js +14 -12
- package/es-modules/Data/Modifiers/ChainModifier.js +4 -2
- package/es-modules/Data/Modifiers/DataModifier.js +1 -1
- package/es-modules/Data/Modifiers/GroupModifier.js +4 -2
- package/es-modules/Data/Modifiers/InvertModifier.js +10 -8
- package/es-modules/Data/Modifiers/RangeModifier.js +4 -2
- package/es-modules/Data/Modifiers/SeriesPointsModifier.js +4 -2
- package/es-modules/Data/Modifiers/SortModifier.js +4 -2
- package/es-modules/Data/Parsers/CSVParser.js +3 -1
- package/es-modules/Data/Parsers/DataParser.js +2 -2
- package/es-modules/Data/Parsers/GoogleSheetsParser.js +3 -2
- package/es-modules/Data/Parsers/HTMLTableParser.js +3 -1
- package/es-modules/Data/Stores/CSVStore.js +8 -5
- package/es-modules/Data/Stores/DataStore.js +1 -1
- package/es-modules/Data/Stores/GoogleSheetsStore.js +3 -1
- package/es-modules/Data/Stores/HTMLTableStore.js +3 -1
- package/es-modules/Extensions/Annotations/Annotation.js +652 -0
- package/es-modules/Extensions/Annotations/AnnotationChart.js +291 -0
- package/es-modules/Extensions/Annotations/AnnotationDefaults.js +624 -0
- package/es-modules/Extensions/Annotations/ControlPoint.js +89 -64
- package/es-modules/Extensions/Annotations/{Mixins/ControllableMixin.js → Controllables/Controllable.js} +300 -241
- package/es-modules/Extensions/Annotations/Controllables/ControllableCircle.js +63 -50
- package/es-modules/Extensions/Annotations/Controllables/ControllableDefaults.js +95 -0
- package/es-modules/Extensions/Annotations/Controllables/ControllableEllipse.js +95 -63
- package/es-modules/Extensions/Annotations/Controllables/ControllableImage.js +50 -44
- package/es-modules/Extensions/Annotations/Controllables/ControllableLabel.js +95 -78
- package/es-modules/Extensions/Annotations/Controllables/ControllablePath.js +167 -51
- package/es-modules/Extensions/Annotations/Controllables/ControllableRect.js +53 -52
- package/es-modules/Extensions/Annotations/{Mixins/EventEmitterMixin.js → EventEmitter.js} +136 -116
- package/es-modules/Extensions/Annotations/MockPoint.js +210 -145
- package/es-modules/Extensions/Annotations/NavigationBindings.js +272 -663
- package/es-modules/Extensions/Annotations/NavigationBindingsDefaults.js +396 -0
- package/es-modules/Extensions/Annotations/NavigationBindingsUtilities.js +98 -0
- package/es-modules/Extensions/Annotations/Popup/Popup.js +295 -0
- package/es-modules/Extensions/Annotations/Popup/PopupAnnotations.js +177 -0
- package/es-modules/Extensions/Annotations/Popup/PopupComposition.js +81 -0
- package/es-modules/Extensions/Annotations/Popup/PopupIndicators.js +609 -0
- package/es-modules/Extensions/Annotations/Popup/PopupTabs.js +134 -0
- package/es-modules/Extensions/Annotations/Types/BasicAnnotation.js +23 -23
- package/es-modules/Extensions/Annotations/Types/CrookedLine.js +15 -21
- package/es-modules/Extensions/Annotations/Types/ElliottWave.js +14 -12
- package/es-modules/Extensions/Annotations/Types/Fibonacci.js +33 -23
- package/es-modules/Extensions/Annotations/Types/FibonacciTimeZones.js +67 -65
- package/es-modules/Extensions/Annotations/Types/InfinityLine.js +14 -21
- package/es-modules/Extensions/Annotations/Types/Measure.js +259 -251
- package/es-modules/Extensions/Annotations/Types/Pitchfork.js +15 -19
- package/es-modules/Extensions/Annotations/Types/TimeCycles.js +24 -19
- package/es-modules/Extensions/Annotations/Types/Tunnel.js +17 -15
- package/es-modules/Extensions/Annotations/Types/VerticalLine.js +15 -17
- package/es-modules/Extensions/Boost/Boost.js +320 -15
- package/es-modules/Extensions/Boost/BoostChart.js +245 -0
- package/es-modules/Extensions/Boost/BoostSeries.js +927 -0
- package/es-modules/Extensions/Boost/BoostableMap.js +21 -5
- package/es-modules/Extensions/Boost/Boostables.js +13 -2
- package/es-modules/Extensions/Boost/NamedColors.js +15 -6
- package/es-modules/Extensions/Boost/WGLDrawMode.js +36 -0
- package/es-modules/Extensions/Boost/WGLRenderer.js +288 -295
- package/es-modules/Extensions/Boost/WGLShader.js +370 -376
- package/es-modules/Extensions/Boost/WGLVertexBuffer.js +192 -0
- package/es-modules/Extensions/BoostCanvas.js +70 -48
- package/es-modules/Extensions/Breadcrumbs.js +37 -9
- package/es-modules/Extensions/CurrentDateIndication.js +1 -1
- package/es-modules/Extensions/Data.js +638 -602
- package/es-modules/Extensions/DataGrouping.js +68 -28
- package/es-modules/Extensions/Debugger/Debugger.js +60 -22
- package/es-modules/Extensions/Debugger/ErrorMessages.js +4 -0
- package/es-modules/Extensions/DownloadURL.js +3 -3
- package/es-modules/Extensions/DragPanes.js +1 -1
- package/es-modules/Extensions/DraggablePoints.js +4 -3
- package/es-modules/Extensions/Drilldown.js +15 -14
- package/es-modules/Extensions/{ExportData.js → ExportData/ExportData.js} +358 -498
- package/es-modules/Extensions/ExportData/ExportDataDefaults.js +272 -0
- package/es-modules/Extensions/Exporting/Exporting.js +30 -17
- package/es-modules/Extensions/Exporting/ExportingDefaults.js +10 -8
- package/es-modules/Extensions/Exporting/Fullscreen.js +352 -0
- package/es-modules/Extensions/GeoJSON.js +3 -4
- package/es-modules/Extensions/MarkerClusters.js +5 -3
- package/es-modules/Extensions/NoDataToDisplay.js +1 -1
- package/es-modules/Extensions/OfflineExporting/OfflineExportingDefaults.js +1 -1
- package/es-modules/Extensions/Oldie/Oldie.js +2 -2
- package/es-modules/Extensions/OverlappingDataLabels.js +5 -4
- package/es-modules/Extensions/Pane.js +3 -3
- package/es-modules/Extensions/ParallelCoordinates.js +12 -8
- package/es-modules/Extensions/PatternFill.js +14 -2
- package/es-modules/Extensions/RangeSelector.js +29 -18
- package/es-modules/Extensions/ScrollablePlotArea.js +4 -4
- package/es-modules/Extensions/{SeriesLabel.js → SeriesLabel/SeriesLabel.js} +264 -386
- package/es-modules/Extensions/SeriesLabel/SeriesLabelDefaults.js +124 -0
- package/es-modules/Extensions/SeriesLabel/SeriesLabelUtilities.js +67 -0
- package/es-modules/Extensions/Sonification/ChartSonify.js +1 -1
- package/es-modules/Extensions/Sonification/Earcon.js +1 -1
- package/es-modules/Extensions/Themes/HighContrastDark.js +10 -10
- package/es-modules/Extensions/Themes/HighContrastLight.js +9 -9
- package/es-modules/Maps/MapNavigation.js +3 -7
- package/es-modules/Maps/MapPointer.js +1 -1
- package/es-modules/Maps/MapView.js +31 -19
- package/es-modules/Maps/MapViewInsetsOptionsDefault.js +1 -1
- package/es-modules/Maps/MapViewOptionsDefault.js +3 -1
- package/es-modules/Maps/Projection.js +13 -11
- package/es-modules/Series/ArcDiagram/ArcDiagramPoint.js +3 -1
- package/es-modules/Series/ArcDiagram/ArcDiagramSeries.js +12 -2
- package/es-modules/Series/Area/AreaSeries.js +21 -14
- package/es-modules/Series/{Area3DSeries.js → Area3D/Area3DSeries.js} +42 -20
- package/es-modules/Series/AreaRange/AreaRangePoint.js +24 -11
- package/es-modules/Series/AreaRange/AreaRangeSeries.js +162 -149
- package/es-modules/Series/AreaSpline/AreaSplineSeries.js +45 -41
- package/es-modules/Series/AreaSplineRange/AreaSplineRangeSeries.js +43 -43
- package/es-modules/Series/Bar/BarSeries.js +3 -1
- package/es-modules/Series/Bellcurve/BellcurveSeries.js +3 -1
- package/es-modules/Series/BoxPlot/BoxPlotSeries.js +4 -2
- package/es-modules/Series/Bubble/BubbleLegendComposition.js +223 -231
- package/es-modules/Series/Bubble/BubbleLegendDefaults.js +1 -1
- package/es-modules/Series/Bubble/BubbleLegendItem.js +46 -45
- package/es-modules/Series/Bubble/BubblePoint.js +3 -1
- package/es-modules/Series/Bubble/BubbleSeries.js +96 -68
- package/es-modules/Series/Bullet/BulletPoint.js +3 -1
- package/es-modules/Series/Bullet/BulletSeries.js +4 -3
- package/es-modules/Series/Candlestick/CandlestickSeries.js +5 -3
- package/es-modules/Series/CenteredUtilities.js +8 -2
- package/es-modules/Series/ColorMapComposition.js +111 -0
- package/es-modules/Series/Column/ColumnSeries.js +8 -4
- package/es-modules/Series/Column3D/Column3DComposition.js +2 -2
- package/es-modules/Series/ColumnPyramid/ColumnPyramidSeries.js +4 -2
- package/es-modules/Series/ColumnRange/ColumnRangePoint.js +17 -13
- package/es-modules/Series/ColumnRange/ColumnRangeSeries.js +60 -57
- package/es-modules/Series/Cylinder/CylinderComposition.js +1 -1
- package/es-modules/Series/Cylinder/CylinderPoint.js +3 -1
- package/es-modules/Series/Cylinder/CylinderSeries.js +3 -1
- package/es-modules/Series/DependencyWheel/DependencyWheelPoint.js +27 -12
- package/es-modules/Series/DependencyWheel/DependencyWheelSeries.js +19 -3
- package/es-modules/Series/DotPlot/DotPlotSeries.js +3 -1
- package/es-modules/Series/DragNodesComposition.js +166 -0
- package/es-modules/Series/DrawPointUtilities.js +87 -0
- package/es-modules/Series/Dumbbell/DumbbellPoint.js +3 -1
- package/es-modules/Series/Dumbbell/DumbbellSeries.js +4 -2
- package/es-modules/Series/ErrorBar/ErrorBarSeries.js +4 -2
- package/es-modules/Series/Flags/FlagsPoint.js +4 -1
- package/es-modules/Series/Flags/FlagsSeries.js +13 -16
- package/es-modules/Series/Funnel/FunnelSeries.js +5 -3
- package/es-modules/Series/Funnel3D/Funnel3DPoint.js +3 -1
- package/es-modules/Series/Funnel3D/Funnel3DSeries.js +4 -2
- package/es-modules/Series/Gantt/GanttPoint.js +3 -1
- package/es-modules/Series/Gantt/GanttSeries.js +4 -2
- package/es-modules/Series/Gauge/GaugePoint.js +3 -1
- package/es-modules/Series/Gauge/GaugeSeries.js +196 -174
- package/es-modules/Series/GraphLayoutComposition.js +130 -0
- package/es-modules/Series/HLC/HLCPoint.js +3 -1
- package/es-modules/Series/HLC/HLCSeries.js +4 -2
- package/es-modules/Series/Heatmap/HeatmapPoint.js +7 -5
- package/es-modules/Series/Heatmap/HeatmapSeries.js +34 -34
- package/es-modules/Series/HeikinAshi/HeikinAshiPoint.js +3 -1
- package/es-modules/Series/HeikinAshi/HeikinAshiSeries.js +3 -1
- package/es-modules/Series/Histogram/HistogramSeries.js +3 -1
- package/es-modules/Series/HollowCandlestick/HollowCandlestickPoint.js +3 -1
- package/es-modules/Series/HollowCandlestick/HollowCandlestickSeries.js +11 -9
- package/es-modules/Series/Item/ItemPoint.js +3 -1
- package/es-modules/Series/Item/ItemSeries.js +3 -1
- package/es-modules/Series/Line/LineSeries.js +4 -2
- package/es-modules/Series/Lollipop/LollipopPoint.js +24 -12
- package/es-modules/Series/Lollipop/LollipopSeries.js +18 -11
- package/es-modules/Series/Map/MapPoint.js +8 -6
- package/es-modules/Series/Map/MapSeries.js +115 -28
- package/es-modules/Series/MapBubble/MapBubblePoint.js +18 -18
- package/es-modules/Series/MapBubble/MapBubbleSeries.js +69 -21
- package/es-modules/Series/MapLine/MapLineSeries.js +18 -1
- package/es-modules/Series/MapPoint/MapPointPoint.js +4 -2
- package/es-modules/Series/MapPoint/MapPointSeries.js +14 -2
- package/es-modules/Series/Networkgraph/EulerIntegration.js +199 -0
- package/es-modules/Series/Networkgraph/NetworkgraphPoint.js +290 -0
- package/es-modules/Series/Networkgraph/NetworkgraphSeries.js +401 -0
- package/es-modules/Series/Networkgraph/NetworkgraphSeriesDefaults.js +545 -0
- package/es-modules/Series/Networkgraph/QuadTree.js +66 -272
- package/es-modules/Series/Networkgraph/QuadTreeNode.js +271 -0
- package/es-modules/Series/Networkgraph/{Layouts.js → ReingoldFruchtermanLayout.js} +240 -259
- package/es-modules/Series/Networkgraph/VerletIntegration.js +193 -0
- package/es-modules/Series/NodesComposition.js +45 -40
- package/es-modules/Series/OHLC/OHLCPoint.js +3 -1
- package/es-modules/Series/OHLC/OHLCSeries.js +3 -1
- package/es-modules/Series/Organization/OrganizationPoint.js +3 -1
- package/es-modules/Series/Organization/OrganizationSeries.js +14 -4
- package/es-modules/Series/PackedBubble/PackedBubbleIntegration.js +81 -0
- package/es-modules/Series/PackedBubble/{PackedBubbleComposition.js → PackedBubbleLayout.js} +114 -79
- package/es-modules/Series/PackedBubble/PackedBubblePoint.js +5 -3
- package/es-modules/Series/PackedBubble/PackedBubbleSeries.js +200 -571
- package/es-modules/Series/PackedBubble/PackedBubbleSeriesDefaults.js +394 -0
- package/es-modules/Series/ParetoSeries/ParetoSeries.js +3 -1
- package/es-modules/Series/Pie/PieDataLabel.js +4 -2
- package/es-modules/Series/Pie/PiePoint.js +3 -1
- package/es-modules/Series/Pie/PieSeries.js +54 -38
- package/es-modules/Series/Pie3D/Pie3DPoint.js +3 -1
- package/es-modules/Series/Pie3D/Pie3DSeries.js +3 -1
- package/es-modules/Series/PolarComposition.js +819 -0
- package/es-modules/Series/Polygon/PolygonSeries.js +3 -1
- package/es-modules/Series/Pyramid/PyramidSeries.js +3 -1
- package/es-modules/Series/Pyramid3D/Pyramid3DSeries.js +3 -1
- package/es-modules/Series/Sankey/SankeyPoint.js +3 -1
- package/es-modules/Series/Sankey/SankeySeries.js +38 -10
- package/es-modules/Series/Scatter/ScatterSeries.js +14 -6
- package/es-modules/Series/Scatter3D/Scatter3DPoint.js +3 -1
- package/es-modules/Series/Scatter3D/Scatter3DSeries.js +4 -2
- package/es-modules/Series/SeriesOnPointComposition.js +395 -0
- package/es-modules/Series/SolidGauge/SolidGaugeSeries.js +6 -4
- package/es-modules/Series/Spline/SplineSeries.js +13 -4
- package/es-modules/Series/Streamgraph/StreamgraphSeries.js +3 -1
- package/es-modules/Series/Sunburst/SunburstPoint.js +8 -9
- package/es-modules/Series/Sunburst/SunburstSeries.js +32 -5
- package/es-modules/Series/Tilemap/TilemapPoint.js +3 -1
- package/es-modules/Series/Tilemap/TilemapSeries.js +3 -1
- package/es-modules/Series/Timeline/TimelinePoint.js +3 -1
- package/es-modules/Series/Timeline/TimelineSeries.js +8 -4
- package/es-modules/Series/Treemap/TreemapPoint.js +8 -4
- package/es-modules/Series/Treemap/TreemapSeries.js +12 -10
- package/es-modules/Series/VariablePie/VariablePieSeries.js +3 -1
- package/es-modules/Series/Variwide/VariwidePoint.js +3 -1
- package/es-modules/Series/Variwide/VariwideSeries.js +3 -1
- package/es-modules/Series/Vector/VectorSeries.js +5 -5
- package/es-modules/Series/Venn/VennPoint.js +5 -5
- package/es-modules/Series/Venn/VennSeries.js +9 -6
- package/es-modules/Series/Waterfall/WaterfallPoint.js +3 -1
- package/es-modules/Series/Waterfall/WaterfallSeries.js +14 -12
- package/es-modules/Series/Windbarb/WindbarbPoint.js +3 -1
- package/es-modules/Series/Windbarb/WindbarbSeries.js +3 -1
- package/es-modules/Series/Wordcloud/WordcloudPoint.js +6 -6
- package/es-modules/Series/Wordcloud/WordcloudSeries.js +12 -9
- package/es-modules/Series/Wordcloud/WordcloudUtils.js +1 -1
- package/es-modules/Series/XRange/XRangePoint.js +57 -46
- package/es-modules/Series/XRange/XRangeSeries.js +124 -274
- package/es-modules/Series/XRange/XRangeSeriesDefaults.js +211 -0
- package/es-modules/Stock/Indicators/ABands/ABandsIndicator.js +13 -3
- package/es-modules/Stock/Indicators/AD/ADIndicator.js +8 -1
- package/es-modules/Stock/Indicators/AO/AOIndicator.js +27 -14
- package/es-modules/Stock/Indicators/APO/APOIndicator.js +9 -2
- package/es-modules/Stock/Indicators/ATR/ATRIndicator.js +19 -4
- package/es-modules/Stock/Indicators/Aroon/AroonIndicator.js +18 -3
- package/es-modules/Stock/Indicators/AroonOscillator/AroonOscillatorIndicator.js +9 -3
- package/es-modules/Stock/Indicators/BB/BBIndicator.js +11 -5
- package/es-modules/Stock/Indicators/CCI/CCIIndicator.js +19 -4
- package/es-modules/Stock/Indicators/CMF/CMFIndicator.js +23 -1
- package/es-modules/Stock/Indicators/CMO/CMOIndicator.js +18 -2
- package/es-modules/Stock/Indicators/Chaikin/ChaikinIndicator.js +10 -3
- package/es-modules/Stock/Indicators/DEMA/DEMAIndicator.js +28 -1
- package/es-modules/Stock/Indicators/DMI/DMIIndicator.js +18 -7
- package/es-modules/Stock/Indicators/DPO/DPOIndicator.js +22 -9
- package/es-modules/Stock/Indicators/DisparityIndex/DisparityIndexIndicator.js +3 -1
- package/es-modules/Stock/Indicators/EMA/EMAIndicator.js +13 -1
- package/es-modules/Stock/Indicators/IKH/IKHIndicator.js +37 -16
- package/es-modules/Stock/Indicators/KeltnerChannels/KeltnerChannelsIndicator.js +28 -1
- package/es-modules/Stock/Indicators/Klinger/KlingerIndicator.js +15 -2
- package/es-modules/Stock/Indicators/LinearRegression/{LinearRegression.js → LinearRegressionIndicator.js} +14 -2
- package/es-modules/Stock/Indicators/LinearRegressionAngle/{LinearRegressionAngle.js → LinearRegressionAngleIndicator.js} +15 -8
- package/es-modules/Stock/Indicators/LinearRegressionIntercept/{LinearRegressionIntercept.js → LinearRegressionInterceptIndicator.js} +14 -2
- package/es-modules/Stock/Indicators/LinearRegressionSlopes/{LinearRegressionSlopes.js → LinearRegressionSlopesIndicator.js} +14 -2
- package/es-modules/Stock/Indicators/MACD/MACDIndicator.js +47 -23
- package/es-modules/Stock/Indicators/MFI/MFIIndicator.js +26 -11
- package/es-modules/Stock/Indicators/Momentum/MomentumIndicator.js +33 -3
- package/es-modules/Stock/Indicators/MultipleLinesComposition.js +85 -95
- package/es-modules/Stock/Indicators/NATR/NATRIndicator.js +19 -2
- package/es-modules/Stock/Indicators/OBV/OBVIndicator.js +13 -1
- package/es-modules/Stock/Indicators/PC/PCIndicator.js +16 -9
- package/es-modules/Stock/Indicators/PPO/PPOIndicator.js +17 -5
- package/es-modules/Stock/Indicators/PSAR/PSARIndicator.js +19 -4
- package/es-modules/Stock/Indicators/PivotPoints/PivotPointsIndicator.js +19 -7
- package/es-modules/Stock/Indicators/PivotPoints/PivotPointsPoint.js +19 -13
- package/es-modules/Stock/Indicators/PriceEnvelopes/PriceEnvelopesIndicator.js +28 -1
- package/es-modules/Stock/Indicators/ROC/ROCIndicator.js +18 -3
- package/es-modules/Stock/Indicators/RSI/RSIIndicator.js +23 -3
- package/es-modules/Stock/Indicators/SMA/SMAIndicator.js +4 -2
- package/es-modules/Stock/Indicators/SlowStochastic/SlowStochasticIndicator.js +28 -1
- package/es-modules/Stock/Indicators/Stochastic/StochasticIndicator.js +18 -1
- package/es-modules/Stock/Indicators/Supertrend/SupertrendIndicator.js +23 -7
- package/es-modules/Stock/Indicators/TEMA/TEMAIndicator.js +3 -1
- package/es-modules/Stock/Indicators/TRIX/TRIXIndicator.js +28 -1
- package/es-modules/Stock/Indicators/TrendLine/TrendLineIndicator.js +17 -5
- package/es-modules/Stock/Indicators/VBP/VBPIndicator.js +35 -4
- package/es-modules/Stock/Indicators/VBP/VBPPoint.js +9 -7
- package/es-modules/Stock/Indicators/VWAP/VWAPIndicator.js +14 -2
- package/es-modules/Stock/Indicators/WMA/WMAIndicator.js +33 -3
- package/es-modules/Stock/Indicators/WilliamsR/WilliamsRIndicator.js +13 -1
- package/es-modules/Stock/Indicators/Zigzag/ZigzagIndicator.js +14 -2
- package/es-modules/Stock/StockToolbar.js +568 -0
- package/es-modules/Stock/StockTools.js +256 -0
- package/es-modules/Stock/StockToolsBindings.js +140 -647
- package/es-modules/Stock/StockToolsDefaults.js +1190 -0
- package/es-modules/Stock/StockToolsGui.js +150 -1771
- package/es-modules/Stock/StockToolsUtilities.js +423 -0
- package/es-modules/masters/highcharts-3d.src.js +5 -4
- package/es-modules/masters/highcharts-gantt.src.js +1 -1
- package/es-modules/masters/highcharts-more.src.js +7 -6
- package/es-modules/masters/highcharts.src.js +5 -2
- package/es-modules/masters/highmaps.src.js +1 -1
- package/es-modules/masters/highstock.src.js +1 -1
- package/es-modules/masters/indicators/acceleration-bands.src.js +1 -1
- package/es-modules/masters/indicators/accumulation-distribution.src.js +1 -1
- package/es-modules/masters/indicators/ao.src.js +1 -1
- package/es-modules/masters/indicators/apo.src.js +1 -1
- package/es-modules/masters/indicators/aroon-oscillator.src.js +1 -1
- package/es-modules/masters/indicators/aroon.src.js +1 -1
- package/es-modules/masters/indicators/atr.src.js +1 -1
- package/es-modules/masters/indicators/bollinger-bands.src.js +1 -1
- package/es-modules/masters/indicators/cci.src.js +1 -1
- package/es-modules/masters/indicators/chaikin.src.js +1 -1
- package/es-modules/masters/indicators/cmf.src.js +1 -1
- package/es-modules/masters/indicators/cmo.src.js +1 -1
- package/es-modules/masters/indicators/dema.src.js +1 -1
- package/es-modules/masters/indicators/disparity-index.src.js +1 -1
- package/es-modules/masters/indicators/dmi.src.js +1 -1
- package/es-modules/masters/indicators/dpo.src.js +1 -1
- package/es-modules/masters/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/es-modules/masters/indicators/indicators-all.src.js +5 -7
- package/es-modules/masters/indicators/indicators.src.js +1 -1
- package/es-modules/masters/indicators/keltner-channels.src.js +1 -1
- package/es-modules/masters/indicators/klinger.src.js +1 -1
- package/es-modules/masters/indicators/macd.src.js +1 -1
- package/es-modules/masters/indicators/mfi.src.js +1 -1
- package/es-modules/masters/indicators/momentum.src.js +1 -1
- package/es-modules/masters/indicators/natr.src.js +1 -1
- package/es-modules/masters/indicators/obv.src.js +1 -1
- package/es-modules/masters/indicators/pivot-points.src.js +1 -1
- package/es-modules/masters/indicators/ppo.src.js +1 -1
- package/es-modules/masters/indicators/price-channel.src.js +1 -1
- package/es-modules/masters/indicators/price-envelopes.src.js +1 -1
- package/es-modules/masters/indicators/psar.src.js +1 -1
- package/es-modules/masters/indicators/regressions.src.js +5 -5
- package/es-modules/masters/indicators/roc.src.js +1 -1
- package/es-modules/masters/indicators/rsi.src.js +1 -1
- package/es-modules/masters/indicators/slow-stochastic.src.js +1 -1
- package/es-modules/masters/indicators/stochastic.src.js +1 -1
- package/es-modules/masters/indicators/supertrend.src.js +1 -1
- package/es-modules/masters/indicators/tema.src.js +1 -1
- package/es-modules/masters/indicators/trendline.src.js +1 -1
- package/es-modules/masters/indicators/trix.src.js +1 -1
- package/es-modules/masters/indicators/volume-by-price.src.js +1 -1
- package/es-modules/masters/indicators/vwap.src.js +1 -1
- package/es-modules/masters/indicators/williams-r.src.js +1 -1
- package/es-modules/masters/indicators/wma.src.js +1 -1
- package/es-modules/masters/indicators/zigzag.src.js +1 -1
- package/es-modules/masters/modules/accessibility.src.js +1 -1
- package/es-modules/masters/modules/annotations-advanced.src.js +6 -4
- package/es-modules/masters/modules/annotations.src.js +6 -4
- package/es-modules/masters/modules/arc-diagram.src.js +1 -1
- package/es-modules/masters/modules/arrow-symbols.src.js +1 -1
- package/es-modules/masters/modules/boost-canvas.src.js +1 -1
- package/es-modules/masters/modules/boost.src.js +6 -2
- package/es-modules/masters/modules/broken-axis.src.js +1 -1
- package/es-modules/masters/modules/bullet.src.js +1 -1
- package/es-modules/masters/modules/coloraxis.src.js +1 -1
- package/es-modules/masters/modules/current-date-indicator.src.js +1 -1
- package/es-modules/masters/modules/cylinder.src.js +1 -1
- package/es-modules/masters/modules/data.src.js +2 -1
- package/es-modules/masters/modules/datagrouping.src.js +1 -1
- package/es-modules/masters/modules/debugger.src.js +5 -3
- package/es-modules/masters/modules/dependency-wheel.src.js +1 -1
- package/es-modules/masters/modules/dotplot.src.js +1 -1
- package/es-modules/masters/modules/drag-panes.src.js +1 -1
- package/es-modules/masters/modules/draggable-points.src.js +1 -1
- package/es-modules/masters/modules/drilldown.src.js +1 -1
- package/es-modules/masters/modules/dumbbell.src.js +1 -1
- package/es-modules/masters/modules/export-data.src.js +5 -2
- package/es-modules/masters/modules/exporting.src.js +1 -2
- package/es-modules/masters/modules/full-screen.src.js +6 -2
- package/es-modules/masters/modules/funnel.src.js +1 -1
- package/es-modules/masters/modules/funnel3d.src.js +1 -1
- package/es-modules/masters/modules/gantt.src.js +3 -2
- package/es-modules/masters/modules/grid-axis.src.js +1 -1
- package/es-modules/masters/modules/heatmap.src.js +1 -1
- package/es-modules/masters/modules/heikinashi.src.js +1 -1
- package/es-modules/masters/modules/histogram-bellcurve.src.js +1 -1
- package/es-modules/masters/modules/hollowcandlestick.src.js +1 -1
- package/es-modules/masters/modules/item-series.src.js +1 -1
- package/es-modules/masters/modules/lollipop.src.js +1 -1
- package/es-modules/masters/modules/map.src.js +2 -2
- package/es-modules/masters/modules/marker-clusters.src.js +1 -1
- package/es-modules/masters/modules/networkgraph.src.js +5 -2
- package/es-modules/masters/modules/no-data-to-display.src.js +1 -1
- package/es-modules/masters/modules/offline-exporting.src.js +1 -1
- package/es-modules/masters/modules/oldie-polyfills.src.js +1 -1
- package/es-modules/masters/modules/oldie.src.js +1 -1
- package/es-modules/masters/modules/organization.src.js +1 -1
- package/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
- package/es-modules/masters/modules/parallel-coordinates.src.js +1 -1
- package/es-modules/masters/modules/pareto.src.js +1 -1
- package/es-modules/masters/modules/pathfinder.src.js +1 -1
- package/es-modules/masters/modules/pattern-fill.src.js +1 -1
- package/es-modules/masters/modules/price-indicator.src.js +1 -1
- package/es-modules/masters/modules/pyramid3d.src.js +1 -1
- package/es-modules/masters/modules/sankey.src.js +1 -1
- package/es-modules/masters/modules/series-label.src.js +5 -2
- package/es-modules/masters/modules/series-on-point.src.js +16 -0
- package/es-modules/masters/modules/solid-gauge.src.js +1 -1
- package/es-modules/masters/modules/sonification.src.js +2 -6
- package/es-modules/masters/modules/static-scale.src.js +1 -1
- package/es-modules/masters/modules/stock-tools.src.js +10 -3
- package/es-modules/masters/modules/stock.src.js +1 -1
- package/es-modules/masters/modules/streamgraph.src.js +1 -1
- package/es-modules/masters/modules/sunburst.src.js +1 -1
- package/es-modules/masters/modules/tilemap.src.js +1 -1
- package/es-modules/masters/modules/timeline.src.js +1 -1
- package/es-modules/masters/modules/treegrid.src.js +2 -2
- package/es-modules/masters/modules/treemap.src.js +1 -1
- package/es-modules/masters/modules/variable-pie.src.js +1 -1
- package/es-modules/masters/modules/variwide.src.js +1 -1
- package/es-modules/masters/modules/vector.src.js +1 -1
- package/es-modules/masters/modules/venn.src.js +1 -1
- package/es-modules/masters/modules/windbarb.src.js +1 -1
- package/es-modules/masters/modules/wordcloud.src.js +1 -1
- package/es-modules/masters/modules/xrange.src.js +5 -2
- package/es-modules/masters/themes/avocado.src.js +1 -1
- package/es-modules/masters/themes/brand-dark.src.js +1 -1
- package/es-modules/masters/themes/brand-light.src.js +1 -1
- package/es-modules/masters/themes/dark-blue.src.js +1 -1
- package/es-modules/masters/themes/dark-green.src.js +1 -1
- package/es-modules/masters/themes/dark-unica.src.js +1 -1
- package/es-modules/masters/themes/gray.src.js +1 -1
- package/es-modules/masters/themes/grid-light.src.js +1 -1
- package/es-modules/masters/themes/grid.src.js +1 -1
- package/es-modules/masters/themes/high-contrast-dark.src.js +1 -1
- package/es-modules/masters/themes/high-contrast-light.src.js +1 -1
- package/es-modules/masters/themes/sand-signika.src.js +1 -1
- package/es-modules/masters/themes/skies.src.js +1 -1
- package/es-modules/masters/themes/sunset.src.js +1 -1
- package/highcharts-3d.js +98 -99
- package/highcharts-3d.js.map +1 -1
- package/highcharts-3d.src.js +233 -212
- package/highcharts-gantt.js +809 -805
- package/highcharts-gantt.js.map +1 -1
- package/highcharts-gantt.src.js +3817 -3470
- package/highcharts-more.d.ts +15 -8
- package/highcharts-more.js +201 -195
- package/highcharts-more.js.map +1 -1
- package/highcharts-more.src.d.ts +15 -8
- package/highcharts-more.src.js +7994 -7461
- package/highcharts.d.ts +11364 -1136
- package/highcharts.js +593 -591
- package/highcharts.js.map +1 -1
- package/highcharts.src.d.ts +11364 -1136
- package/highcharts.src.js +1408 -1117
- package/highmaps.js +762 -758
- package/highmaps.js.map +1 -1
- package/highmaps.src.js +2237 -1721
- package/highstock.js +796 -792
- package/highstock.js.map +1 -1
- package/highstock.src.js +1617 -1224
- package/indicators/acceleration-bands.d.ts +1 -17
- package/indicators/acceleration-bands.js +11 -12
- package/indicators/acceleration-bands.js.map +1 -1
- package/indicators/acceleration-bands.src.d.ts +1 -17
- package/indicators/acceleration-bands.src.js +99 -101
- package/indicators/accumulation-distribution.js +1 -1
- package/indicators/accumulation-distribution.js.map +1 -1
- package/indicators/accumulation-distribution.src.js +6 -1
- package/indicators/ao.js +6 -6
- package/indicators/ao.js.map +1 -1
- package/indicators/ao.src.js +25 -16
- package/indicators/apo.js +1 -1
- package/indicators/apo.js.map +1 -1
- package/indicators/apo.src.js +6 -1
- package/indicators/aroon-oscillator.d.ts +1 -17
- package/indicators/aroon-oscillator.js +10 -10
- package/indicators/aroon-oscillator.js.map +1 -1
- package/indicators/aroon-oscillator.src.d.ts +1 -17
- package/indicators/aroon-oscillator.src.js +95 -101
- package/indicators/aroon.d.ts +1 -17
- package/indicators/aroon.js +11 -11
- package/indicators/aroon.js.map +1 -1
- package/indicators/aroon.src.d.ts +1 -17
- package/indicators/aroon.src.js +104 -101
- package/indicators/atr.js +1 -1
- package/indicators/atr.js.map +1 -1
- package/indicators/atr.src.js +17 -4
- package/indicators/bollinger-bands.d.ts +1 -17
- package/indicators/bollinger-bands.js +11 -12
- package/indicators/bollinger-bands.js.map +1 -1
- package/indicators/bollinger-bands.src.d.ts +1 -17
- package/indicators/bollinger-bands.src.js +97 -103
- package/indicators/cci.js +1 -1
- package/indicators/cci.js.map +1 -1
- package/indicators/cci.src.js +17 -4
- package/indicators/chaikin.js +8 -8
- package/indicators/chaikin.js.map +1 -1
- package/indicators/chaikin.src.js +13 -5
- package/indicators/cmf.js +1 -1
- package/indicators/cmf.js.map +1 -1
- package/indicators/cmf.src.js +21 -1
- package/indicators/cmo.js +1 -1
- package/indicators/cmo.js.map +1 -1
- package/indicators/cmo.src.js +16 -2
- package/indicators/dema.js +1 -1
- package/indicators/dema.js.map +1 -1
- package/indicators/dema.src.js +26 -1
- package/indicators/disparity-index.js +1 -1
- package/indicators/disparity-index.src.js +1 -1
- package/indicators/dmi.js +12 -12
- package/indicators/dmi.js.map +1 -1
- package/indicators/dmi.src.js +104 -105
- package/indicators/dpo.js +1 -1
- package/indicators/dpo.js.map +1 -1
- package/indicators/dpo.src.js +20 -9
- package/indicators/ichimoku-kinko-hyo.js +1 -1
- package/indicators/ichimoku-kinko-hyo.js.map +1 -1
- package/indicators/ichimoku-kinko-hyo.src.js +35 -16
- package/indicators/indicators-all.d.ts +1 -17
- package/indicators/indicators-all.js +200 -199
- package/indicators/indicators-all.js.map +1 -1
- package/indicators/indicators-all.src.d.ts +1 -17
- package/indicators/indicators-all.src.js +882 -284
- package/indicators/indicators.js +1 -1
- package/indicators/indicators.js.map +1 -1
- package/indicators/indicators.src.js +12 -2
- package/indicators/keltner-channels.d.ts +1 -17
- package/indicators/keltner-channels.js +11 -12
- package/indicators/keltner-channels.js.map +1 -1
- package/indicators/keltner-channels.src.d.ts +1 -17
- package/indicators/keltner-channels.src.js +114 -99
- package/indicators/klinger.js +14 -14
- package/indicators/klinger.js.map +1 -1
- package/indicators/klinger.src.js +101 -102
- package/indicators/macd.js +10 -9
- package/indicators/macd.js.map +1 -1
- package/indicators/macd.src.js +46 -25
- package/indicators/mfi.js +1 -1
- package/indicators/mfi.js.map +1 -1
- package/indicators/mfi.src.js +24 -11
- package/indicators/momentum.js +1 -1
- package/indicators/momentum.js.map +1 -1
- package/indicators/momentum.src.js +31 -3
- package/indicators/natr.js +1 -1
- package/indicators/natr.js.map +1 -1
- package/indicators/natr.src.js +17 -3
- package/indicators/obv.js +1 -1
- package/indicators/obv.js.map +1 -1
- package/indicators/obv.src.js +11 -1
- package/indicators/pivot-points.js +1 -1
- package/indicators/pivot-points.js.map +1 -1
- package/indicators/pivot-points.src.js +32 -19
- package/indicators/ppo.js +1 -1
- package/indicators/ppo.js.map +1 -1
- package/indicators/ppo.src.js +15 -5
- package/indicators/price-channel.d.ts +1 -17
- package/indicators/price-channel.js +11 -11
- package/indicators/price-channel.js.map +1 -1
- package/indicators/price-channel.src.d.ts +1 -17
- package/indicators/price-channel.src.js +102 -107
- package/indicators/price-envelopes.js +1 -1
- package/indicators/price-envelopes.js.map +1 -1
- package/indicators/price-envelopes.src.js +26 -1
- package/indicators/psar.js +1 -1
- package/indicators/psar.js.map +1 -1
- package/indicators/psar.src.js +17 -4
- package/indicators/regressions.js +12 -11
- package/indicators/regressions.js.map +1 -1
- package/indicators/regressions.src.js +50 -15
- package/indicators/roc.js +1 -1
- package/indicators/roc.js.map +1 -1
- package/indicators/roc.src.js +16 -3
- package/indicators/rsi.js +1 -1
- package/indicators/rsi.js.map +1 -1
- package/indicators/rsi.src.js +21 -3
- package/indicators/slow-stochastic.js +1 -1
- package/indicators/slow-stochastic.js.map +1 -1
- package/indicators/slow-stochastic.src.js +26 -1
- package/indicators/stochastic.d.ts +1 -17
- package/indicators/stochastic.js +12 -12
- package/indicators/stochastic.js.map +1 -1
- package/indicators/stochastic.src.d.ts +1 -17
- package/indicators/stochastic.src.js +104 -99
- package/indicators/supertrend.js +7 -7
- package/indicators/supertrend.js.map +1 -1
- package/indicators/supertrend.src.js +21 -9
- package/indicators/tema.js +1 -1
- package/indicators/tema.src.js +1 -1
- package/indicators/trendline.js +1 -1
- package/indicators/trendline.js.map +1 -1
- package/indicators/trendline.src.js +15 -5
- package/indicators/trix.js +1 -1
- package/indicators/trix.js.map +1 -1
- package/indicators/trix.src.js +26 -1
- package/indicators/volume-by-price.js +17 -17
- package/indicators/volume-by-price.js.map +1 -1
- package/indicators/volume-by-price.src.js +38 -10
- package/indicators/vwap.js +1 -1
- package/indicators/vwap.js.map +1 -1
- package/indicators/vwap.src.js +12 -2
- package/indicators/williams-r.js +1 -1
- package/indicators/williams-r.js.map +1 -1
- package/indicators/williams-r.src.js +11 -1
- package/indicators/wma.js +1 -1
- package/indicators/wma.js.map +1 -1
- package/indicators/wma.src.js +31 -3
- package/indicators/zigzag.js +1 -1
- package/indicators/zigzag.js.map +1 -1
- package/indicators/zigzag.src.js +12 -2
- package/modules/accessibility.js +246 -242
- package/modules/accessibility.js.map +1 -1
- package/modules/accessibility.src.js +797 -664
- package/modules/annotations-advanced.d.ts +1 -1
- package/modules/annotations-advanced.js +193 -192
- package/modules/annotations-advanced.js.map +1 -1
- package/modules/annotations-advanced.src.d.ts +1 -1
- package/modules/annotations-advanced.src.js +9229 -8589
- package/modules/annotations.d.ts +1 -1
- package/modules/annotations.js +128 -126
- package/modules/annotations.js.map +1 -1
- package/modules/annotations.src.d.ts +1 -1
- package/modules/annotations.src.js +6190 -5528
- package/modules/arc-diagram.js +7 -7
- package/modules/arc-diagram.js.map +1 -1
- package/modules/arc-diagram.src.js +10 -2
- package/modules/arrow-symbols.js +1 -1
- package/modules/arrow-symbols.src.js +1 -1
- package/modules/boost-canvas.d.ts +19 -0
- package/modules/boost-canvas.js +81 -15
- package/modules/boost-canvas.js.map +1 -1
- package/modules/boost-canvas.src.d.ts +19 -0
- package/modules/boost-canvas.src.js +3342 -52
- package/modules/boost.d.ts +8 -26
- package/modules/boost.js +88 -80
- package/modules/boost.js.map +1 -1
- package/modules/boost.src.d.ts +8 -26
- package/modules/boost.src.js +2435 -1889
- package/modules/broken-axis.js +2 -2
- package/modules/broken-axis.js.map +1 -1
- package/modules/broken-axis.src.js +2 -2
- package/modules/bullet.js +1 -1
- package/modules/bullet.js.map +1 -1
- package/modules/bullet.src.js +2 -5
- package/modules/coloraxis.js +2 -2
- package/modules/coloraxis.js.map +1 -1
- package/modules/coloraxis.src.js +9 -5
- package/modules/current-date-indicator.js +1 -1
- package/modules/current-date-indicator.src.js +2 -2
- package/modules/cylinder.js +9 -9
- package/modules/cylinder.js.map +1 -1
- package/modules/cylinder.src.js +2 -2
- package/modules/data.d.ts +12 -12
- package/modules/data.js +33 -34
- package/modules/data.js.map +1 -1
- package/modules/data.src.d.ts +12 -12
- package/modules/data.src.js +862 -829
- package/modules/datagrouping.d.ts +22 -0
- package/modules/datagrouping.js +9 -9
- package/modules/datagrouping.js.map +1 -1
- package/modules/datagrouping.src.d.ts +22 -0
- package/modules/datagrouping.src.js +69 -29
- package/modules/debugger.js +8 -6
- package/modules/debugger.js.map +1 -1
- package/modules/debugger.src.js +85 -40
- package/modules/dependency-wheel.js +12 -12
- package/modules/dependency-wheel.js.map +1 -1
- package/modules/dependency-wheel.src.js +41 -14
- package/modules/dotplot.js +1 -1
- package/modules/dotplot.src.js +1 -1
- package/modules/drag-panes.js +1 -1
- package/modules/drag-panes.src.js +2 -2
- package/modules/draggable-points.js +5 -5
- package/modules/draggable-points.js.map +1 -1
- package/modules/draggable-points.src.js +5 -4
- package/modules/drilldown.d.ts +0 -10
- package/modules/drilldown.js +37 -37
- package/modules/drilldown.js.map +1 -1
- package/modules/drilldown.src.d.ts +0 -10
- package/modules/drilldown.src.js +59 -25
- package/modules/dumbbell.d.ts +4 -0
- package/modules/dumbbell.js +17 -17
- package/modules/dumbbell.js.map +1 -1
- package/modules/dumbbell.src.d.ts +4 -0
- package/modules/dumbbell.src.js +24 -12
- package/modules/export-data.js +25 -22
- package/modules/export-data.js.map +1 -1
- package/modules/export-data.src.js +641 -469
- package/modules/exporting.d.ts +8 -8
- package/modules/exporting.js +39 -39
- package/modules/exporting.js.map +1 -1
- package/modules/exporting.src.d.ts +8 -8
- package/modules/exporting.src.js +442 -319
- package/modules/full-screen.js +8 -8
- package/modules/full-screen.js.map +1 -1
- package/modules/full-screen.src.js +196 -78
- package/modules/funnel.js +1 -1
- package/modules/funnel.src.js +3 -3
- package/modules/funnel3d.js +2 -2
- package/modules/funnel3d.js.map +1 -1
- package/modules/funnel3d.src.js +2 -2
- package/modules/gantt.js +219 -217
- package/modules/gantt.js.map +1 -1
- package/modules/gantt.src.js +2420 -2364
- package/modules/grid-axis.js +23 -23
- package/modules/grid-axis.js.map +1 -1
- package/modules/grid-axis.src.js +890 -891
- package/modules/heatmap.js +40 -40
- package/modules/heatmap.js.map +1 -1
- package/modules/heatmap.src.js +137 -108
- package/modules/heikinashi.js +1 -1
- package/modules/heikinashi.src.js +1 -1
- package/modules/histogram-bellcurve.js +1 -1
- package/modules/histogram-bellcurve.src.js +1 -1
- package/modules/hollowcandlestick.js +1 -1
- package/modules/hollowcandlestick.src.js +9 -9
- package/modules/item-series.js +1 -1
- package/modules/item-series.src.js +1 -1
- package/modules/lollipop.js +6 -6
- package/modules/lollipop.js.map +1 -1
- package/modules/lollipop.src.js +37 -22
- package/modules/map.d.ts +3 -3
- package/modules/map.js +171 -169
- package/modules/map.js.map +1 -1
- package/modules/map.src.d.ts +3 -3
- package/modules/map.src.js +830 -605
- package/modules/marker-clusters.js +1 -1
- package/modules/marker-clusters.js.map +1 -1
- package/modules/marker-clusters.src.js +4 -6
- package/modules/networkgraph.d.ts +1 -17
- package/modules/networkgraph.js +55 -50
- package/modules/networkgraph.js.map +1 -1
- package/modules/networkgraph.src.d.ts +1 -17
- package/modules/networkgraph.src.js +2339 -2008
- package/modules/no-data-to-display.js +1 -1
- package/modules/no-data-to-display.src.js +2 -2
- package/modules/offline-exporting.js +3 -3
- package/modules/offline-exporting.js.map +1 -1
- package/modules/offline-exporting.src.js +5 -5
- package/modules/oldie-polyfills.js +1 -1
- package/modules/oldie-polyfills.src.js +1 -1
- package/modules/oldie.js +2 -2
- package/modules/oldie.src.js +3 -3
- package/modules/organization.js +15 -15
- package/modules/organization.js.map +1 -1
- package/modules/organization.src.js +12 -4
- 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 +14 -9
- package/modules/pareto.js +1 -1
- package/modules/pareto.src.js +1 -1
- package/modules/pathfinder.js +1 -1
- package/modules/pathfinder.src.js +1 -1
- package/modules/pattern-fill.js +15 -14
- package/modules/pattern-fill.js.map +1 -1
- package/modules/pattern-fill.src.js +15 -2
- package/modules/price-indicator.js +1 -1
- package/modules/price-indicator.src.js +1 -1
- package/modules/pyramid3d.js +1 -1
- package/modules/pyramid3d.src.js +1 -1
- package/modules/sankey.d.ts +1 -17
- package/modules/sankey.js +32 -32
- package/modules/sankey.js.map +1 -1
- package/modules/sankey.src.d.ts +1 -17
- package/modules/sankey.src.js +102 -57
- package/modules/series-label.js +18 -18
- package/modules/series-label.js.map +1 -1
- package/modules/series-label.src.js +474 -387
- package/modules/series-on-point.js +18 -0
- package/modules/series-on-point.js.map +1 -0
- package/modules/series-on-point.src.js +468 -0
- package/modules/solid-gauge.js +4 -4
- package/modules/solid-gauge.js.map +1 -1
- package/modules/solid-gauge.src.js +6 -6
- package/modules/sonification.d.ts +2 -2
- package/modules/sonification.js +1 -1
- package/modules/sonification.js.map +1 -1
- package/modules/sonification.src.d.ts +2 -2
- package/modules/sonification.src.js +4 -8
- package/modules/static-scale.js +1 -1
- package/modules/static-scale.src.js +1 -1
- package/modules/stock-tools.d.ts +1 -23
- package/modules/stock-tools.js +109 -179
- package/modules/stock-tools.js.map +1 -1
- package/modules/stock-tools.src.d.ts +1 -23
- package/modules/stock-tools.src.js +2652 -6347
- package/modules/stock.d.ts +8 -0
- package/modules/stock.js +205 -204
- package/modules/stock.js.map +1 -1
- package/modules/stock.src.d.ts +8 -0
- package/modules/stock.src.js +208 -106
- package/modules/streamgraph.js +1 -1
- package/modules/streamgraph.src.js +1 -1
- package/modules/sunburst.js +73 -73
- package/modules/sunburst.js.map +1 -1
- package/modules/sunburst.src.js +251 -193
- package/modules/tilemap.js +1 -1
- package/modules/tilemap.src.js +1 -1
- package/modules/timeline.js +1 -1
- package/modules/timeline.js.map +1 -1
- package/modules/timeline.src.js +6 -4
- package/modules/treegrid.js +57 -57
- package/modules/treegrid.js.map +1 -1
- package/modules/treegrid.src.js +1908 -1901
- package/modules/treemap.js +54 -53
- package/modules/treemap.js.map +1 -1
- package/modules/treemap.src.js +217 -183
- package/modules/variable-pie.js +1 -1
- package/modules/variable-pie.src.js +1 -1
- package/modules/variwide.js +1 -1
- package/modules/variwide.src.js +1 -1
- package/modules/vector.js +2 -2
- package/modules/vector.js.map +1 -1
- package/modules/vector.src.js +3 -5
- package/modules/venn.js +31 -31
- package/modules/venn.js.map +1 -1
- package/modules/venn.src.js +82 -111
- package/modules/windbarb.js +1 -1
- package/modules/windbarb.src.js +1 -1
- package/modules/wordcloud.js +23 -23
- package/modules/wordcloud.js.map +1 -1
- package/modules/wordcloud.src.js +84 -113
- package/modules/xrange.js +17 -17
- package/modules/xrange.js.map +1 -1
- package/modules/xrange.src.js +411 -397
- package/package.json +1 -1
- package/themes/avocado.js +1 -1
- package/themes/avocado.src.js +1 -1
- package/themes/brand-dark.js +1 -1
- package/themes/brand-dark.src.js +1 -1
- package/themes/brand-light.js +1 -1
- package/themes/brand-light.src.js +1 -1
- package/themes/dark-blue.js +1 -1
- package/themes/dark-blue.src.js +1 -1
- package/themes/dark-green.js +1 -1
- package/themes/dark-green.src.js +1 -1
- package/themes/dark-unica.js +1 -1
- package/themes/dark-unica.src.js +1 -1
- package/themes/gray.js +1 -1
- package/themes/gray.src.js +1 -1
- package/themes/grid-light.js +1 -1
- package/themes/grid-light.src.js +1 -1
- package/themes/grid.js +1 -1
- package/themes/grid.src.js +1 -1
- package/themes/high-contrast-dark.js +2 -2
- package/themes/high-contrast-dark.src.js +11 -11
- package/themes/high-contrast-light.js +2 -2
- package/themes/high-contrast-light.src.js +10 -10
- package/themes/sand-signika.js +1 -1
- package/themes/sand-signika.src.js +1 -1
- package/themes/skies.js +1 -1
- package/themes/skies.src.js +1 -1
- package/themes/sunset.js +1 -1
- package/themes/sunset.src.js +1 -1
- package/es-modules/Core/Axis/StackingAxis.js +0 -216
- package/es-modules/Core/Axis/TreeGridAxis.js +0 -720
- package/es-modules/Core/Axis/TreeGridTick.js +0 -317
- package/es-modules/Extensions/Annotations/Annotations.js +0 -1449
- package/es-modules/Extensions/Annotations/Mixins/MarkerMixin.js +0 -179
- package/es-modules/Extensions/Annotations/Popup.js +0 -1123
- package/es-modules/Extensions/Boost/BoostAttach.js +0 -150
- package/es-modules/Extensions/Boost/BoostInit.js +0 -323
- package/es-modules/Extensions/Boost/BoostOptions.js +0 -245
- package/es-modules/Extensions/Boost/BoostOverrides.js +0 -386
- package/es-modules/Extensions/Boost/BoostUtils.js +0 -255
- package/es-modules/Extensions/Boost/WGLVBuffer.js +0 -153
- package/es-modules/Extensions/FullScreen.js +0 -240
- package/es-modules/Extensions/Polar.js +0 -740
- package/es-modules/Extensions/Stacking.js +0 -517
- package/es-modules/Series/ColorMapMixin.js +0 -84
- package/es-modules/Series/DrawPointComposition.js +0 -114
- package/es-modules/Series/Networkgraph/DraggableNodes.js +0 -132
- package/es-modules/Series/Networkgraph/Integrations.js +0 -348
- package/es-modules/Series/Networkgraph/Networkgraph.js +0 -1178
- package/es-modules/Series/XRange/XRangeComposition.js +0 -49
package/modules/treegrid.src.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Highcharts Gantt JS v10.
|
|
2
|
+
* @license Highcharts Gantt JS v10.2.1 (2022-08-29)
|
|
3
3
|
*
|
|
4
4
|
* Tree Grid
|
|
5
5
|
*
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
_registerModule(_modules, 'Core/Axis/BrokenAxis.js', [_modules['
|
|
40
|
+
_registerModule(_modules, 'Core/Axis/BrokenAxis.js', [_modules['Core/Axis/Stacking/StackItem.js'], _modules['Core/Utilities.js']], function (StackItem, U) {
|
|
41
41
|
/* *
|
|
42
42
|
*
|
|
43
43
|
* (c) 2009-2021 Torstein Honsi
|
|
@@ -705,19 +705,49 @@
|
|
|
705
705
|
pick = U.pick,
|
|
706
706
|
timeUnits = U.timeUnits,
|
|
707
707
|
wrap = U.wrap;
|
|
708
|
+
/* *
|
|
709
|
+
*
|
|
710
|
+
* Enums
|
|
711
|
+
*
|
|
712
|
+
* */
|
|
713
|
+
/**
|
|
714
|
+
* Enum for which side the axis is on. Maps to axis.side.
|
|
715
|
+
* @private
|
|
716
|
+
*/
|
|
717
|
+
var GridAxisSide;
|
|
718
|
+
(function (GridAxisSide) {
|
|
719
|
+
GridAxisSide[GridAxisSide["top"] = 0] = "top";
|
|
720
|
+
GridAxisSide[GridAxisSide["right"] = 1] = "right";
|
|
721
|
+
GridAxisSide[GridAxisSide["bottom"] = 2] = "bottom";
|
|
722
|
+
GridAxisSide[GridAxisSide["left"] = 3] = "left";
|
|
723
|
+
})(GridAxisSide || (GridAxisSide = {}));
|
|
724
|
+
/* *
|
|
725
|
+
*
|
|
726
|
+
* Constants
|
|
727
|
+
*
|
|
728
|
+
* */
|
|
729
|
+
var composedClasses = [];
|
|
708
730
|
/* *
|
|
709
731
|
*
|
|
710
732
|
* Functions
|
|
711
733
|
*
|
|
712
734
|
* */
|
|
713
|
-
|
|
735
|
+
/**
|
|
736
|
+
* @private
|
|
737
|
+
*/
|
|
714
738
|
function argsToArray(args) {
|
|
715
739
|
return Array.prototype.slice.call(args, 1);
|
|
716
740
|
}
|
|
741
|
+
/**
|
|
742
|
+
* @private
|
|
743
|
+
*/
|
|
717
744
|
function isObject(x) {
|
|
718
745
|
// Always use strict mode
|
|
719
746
|
return U.isObject(x, true);
|
|
720
747
|
}
|
|
748
|
+
/**
|
|
749
|
+
* @private
|
|
750
|
+
*/
|
|
721
751
|
function applyGridOptions(axis) {
|
|
722
752
|
var options = axis.options;
|
|
723
753
|
// Center-align by default
|
|
@@ -742,962 +772,925 @@
|
|
|
742
772
|
options.labels.rotation = 0;
|
|
743
773
|
}
|
|
744
774
|
/**
|
|
745
|
-
*
|
|
775
|
+
* Extends axis class with grid support.
|
|
746
776
|
* @private
|
|
747
777
|
*/
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
*
|
|
770
|
-
* */
|
|
771
|
-
/* eslint-disable valid-jsdoc */
|
|
772
|
-
/**
|
|
773
|
-
* Extends axis class with grid support.
|
|
774
|
-
* @private
|
|
775
|
-
*/
|
|
776
|
-
function compose(AxisClass, ChartClass, TickClass) {
|
|
777
|
-
if (AxisClass.keepProps.indexOf('grid') === -1) {
|
|
778
|
-
AxisClass.keepProps.push('grid');
|
|
779
|
-
AxisClass.prototype.getMaxLabelDimensions = getMaxLabelDimensions;
|
|
780
|
-
wrap(AxisClass.prototype, 'unsquish', wrapUnsquish);
|
|
781
|
-
// Add event handlers
|
|
782
|
-
addEvent(AxisClass, 'init', onInit);
|
|
783
|
-
addEvent(AxisClass, 'afterGetOffset', onAfterGetOffset);
|
|
784
|
-
addEvent(AxisClass, 'afterGetTitlePosition', onAfterGetTitlePosition);
|
|
785
|
-
addEvent(AxisClass, 'afterInit', onAfterInit);
|
|
786
|
-
addEvent(AxisClass, 'afterRender', onAfterRender);
|
|
787
|
-
addEvent(AxisClass, 'afterSetAxisTranslation', onAfterSetAxisTranslation);
|
|
788
|
-
addEvent(AxisClass, 'afterSetOptions', onAfterSetOptions);
|
|
789
|
-
addEvent(AxisClass, 'afterSetOptions', onAfterSetOptions2);
|
|
790
|
-
addEvent(AxisClass, 'afterSetScale', onAfterSetScale);
|
|
791
|
-
addEvent(AxisClass, 'afterTickSize', onAfterTickSize);
|
|
792
|
-
addEvent(AxisClass, 'trimTicks', onTrimTicks);
|
|
793
|
-
addEvent(AxisClass, 'destroy', onDestroy);
|
|
794
|
-
}
|
|
778
|
+
function compose(AxisClass, ChartClass, TickClass) {
|
|
779
|
+
if (composedClasses.indexOf(AxisClass) === -1) {
|
|
780
|
+
composedClasses.push(AxisClass);
|
|
781
|
+
AxisClass.keepProps.push('grid');
|
|
782
|
+
AxisClass.prototype.getMaxLabelDimensions = getMaxLabelDimensions;
|
|
783
|
+
wrap(AxisClass.prototype, 'unsquish', wrapUnsquish);
|
|
784
|
+
// Add event handlers
|
|
785
|
+
addEvent(AxisClass, 'init', onInit);
|
|
786
|
+
addEvent(AxisClass, 'afterGetOffset', onAfterGetOffset);
|
|
787
|
+
addEvent(AxisClass, 'afterGetTitlePosition', onAfterGetTitlePosition);
|
|
788
|
+
addEvent(AxisClass, 'afterInit', onAfterInit);
|
|
789
|
+
addEvent(AxisClass, 'afterRender', onAfterRender);
|
|
790
|
+
addEvent(AxisClass, 'afterSetAxisTranslation', onAfterSetAxisTranslation);
|
|
791
|
+
addEvent(AxisClass, 'afterSetOptions', onAfterSetOptions);
|
|
792
|
+
addEvent(AxisClass, 'afterSetOptions', onAfterSetOptions2);
|
|
793
|
+
addEvent(AxisClass, 'afterSetScale', onAfterSetScale);
|
|
794
|
+
addEvent(AxisClass, 'afterTickSize', onAfterTickSize);
|
|
795
|
+
addEvent(AxisClass, 'trimTicks', onTrimTicks);
|
|
796
|
+
addEvent(AxisClass, 'destroy', onDestroy);
|
|
797
|
+
}
|
|
798
|
+
if (composedClasses.indexOf(ChartClass) === -1) {
|
|
795
799
|
addEvent(ChartClass, 'afterSetChartSize', onChartAfterSetChartSize);
|
|
800
|
+
}
|
|
801
|
+
if (composedClasses.indexOf(TickClass) === -1) {
|
|
796
802
|
addEvent(TickClass, 'afterGetLabelPosition', onTickAfterGetLabelPosition);
|
|
797
803
|
addEvent(TickClass, 'labelFormat', onTickLabelFormat);
|
|
798
|
-
return AxisClass;
|
|
799
804
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
labelWidth = isNumber(label.textPxLength) ?
|
|
836
|
-
// Math.round ensures crisp lines
|
|
837
|
-
Math.round(label.textPxLength) :
|
|
838
|
-
0;
|
|
839
|
-
if (label.textStr) {
|
|
840
|
-
// Set the tickWidth same as the label width after ellipsis
|
|
841
|
-
// applied #10281
|
|
842
|
-
labelWidth = Math.round(label.getBBox().width);
|
|
843
|
-
}
|
|
844
|
-
// Update the result if width and/or height are larger
|
|
845
|
-
dimensions.height = Math.max(labelHeight, dimensions.height);
|
|
846
|
-
dimensions.width = Math.max(labelWidth, dimensions.width);
|
|
805
|
+
return AxisClass;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Get the largest label width and height.
|
|
809
|
+
*
|
|
810
|
+
* @private
|
|
811
|
+
* @function Highcharts.Axis#getMaxLabelDimensions
|
|
812
|
+
*
|
|
813
|
+
* @param {Highcharts.Dictionary<Highcharts.Tick>} ticks
|
|
814
|
+
* All the ticks on one axis.
|
|
815
|
+
*
|
|
816
|
+
* @param {Array<number|string>} tickPositions
|
|
817
|
+
* All the tick positions on one axis.
|
|
818
|
+
*
|
|
819
|
+
* @return {Highcharts.SizeObject}
|
|
820
|
+
* Object containing the properties height and width.
|
|
821
|
+
*
|
|
822
|
+
* @todo Move this to the generic axis implementation, as it is used there.
|
|
823
|
+
*/
|
|
824
|
+
function getMaxLabelDimensions(ticks, tickPositions) {
|
|
825
|
+
var dimensions = {
|
|
826
|
+
width: 0,
|
|
827
|
+
height: 0
|
|
828
|
+
};
|
|
829
|
+
tickPositions.forEach(function (pos) {
|
|
830
|
+
var tick = ticks[pos];
|
|
831
|
+
var labelHeight = 0,
|
|
832
|
+
labelWidth = 0,
|
|
833
|
+
label;
|
|
834
|
+
if (isObject(tick)) {
|
|
835
|
+
label = isObject(tick.label) ? tick.label : {};
|
|
836
|
+
// Find width and height of label
|
|
837
|
+
labelHeight = label.getBBox ? label.getBBox().height : 0;
|
|
838
|
+
if (label.textStr && !isNumber(label.textPxLength)) {
|
|
839
|
+
label.textPxLength = label.getBBox().width;
|
|
847
840
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
841
|
+
labelWidth = isNumber(label.textPxLength) ?
|
|
842
|
+
// Math.round ensures crisp lines
|
|
843
|
+
Math.round(label.textPxLength) :
|
|
844
|
+
0;
|
|
845
|
+
if (label.textStr) {
|
|
846
|
+
// Set the tickWidth same as the label width after ellipsis
|
|
847
|
+
// applied #10281
|
|
848
|
+
labelWidth = Math.round(label.getBBox().width);
|
|
849
|
+
}
|
|
850
|
+
// Update the result if width and/or height are larger
|
|
851
|
+
dimensions.height = Math.max(labelHeight, dimensions.height);
|
|
852
|
+
dimensions.width = Math.max(labelWidth, dimensions.width);
|
|
856
853
|
}
|
|
857
|
-
|
|
854
|
+
});
|
|
855
|
+
// For tree grid, add indentation
|
|
856
|
+
if (this.options.type === 'treegrid' &&
|
|
857
|
+
this.treeGrid &&
|
|
858
|
+
this.treeGrid.mapOfPosToGridNode) {
|
|
859
|
+
var treeDepth = this.treeGrid.mapOfPosToGridNode[-1].height || 0;
|
|
860
|
+
dimensions.width += (this.options.labels.indentation *
|
|
861
|
+
(treeDepth - 1));
|
|
858
862
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
863
|
+
return dimensions;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Handle columns and getOffset.
|
|
867
|
+
* @private
|
|
868
|
+
*/
|
|
869
|
+
function onAfterGetOffset() {
|
|
870
|
+
var grid = this.grid;
|
|
871
|
+
(grid && grid.columns || []).forEach(function (column) {
|
|
872
|
+
column.getOffset();
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* @private
|
|
877
|
+
*/
|
|
878
|
+
function onAfterGetTitlePosition(e) {
|
|
879
|
+
var axis = this;
|
|
880
|
+
var options = axis.options;
|
|
881
|
+
var gridOptions = options.grid || {};
|
|
882
|
+
if (gridOptions.enabled === true) {
|
|
883
|
+
// compute anchor points for each of the title align options
|
|
884
|
+
var axisTitle = axis.axisTitle,
|
|
885
|
+
axisHeight = axis.height,
|
|
886
|
+
horiz = axis.horiz,
|
|
887
|
+
axisLeft = axis.left,
|
|
888
|
+
offset = axis.offset,
|
|
889
|
+
opposite = axis.opposite,
|
|
890
|
+
options_1 = axis.options,
|
|
891
|
+
axisTop = axis.top,
|
|
892
|
+
axisWidth = axis.width;
|
|
893
|
+
var tickSize = axis.tickSize();
|
|
894
|
+
var titleWidth = axisTitle && axisTitle.getBBox().width;
|
|
895
|
+
var xOption = options_1.title.x;
|
|
896
|
+
var yOption = options_1.title.y;
|
|
897
|
+
var titleMargin = pick(options_1.title.margin,
|
|
898
|
+
horiz ? 5 : 10);
|
|
899
|
+
var titleFontSize = axis.chart.renderer.fontMetrics(options_1.title.style.fontSize,
|
|
900
|
+
axisTitle).f;
|
|
901
|
+
var crispCorr = tickSize ? tickSize[0] / 2 : 0;
|
|
902
|
+
// TODO account for alignment
|
|
903
|
+
// the position in the perpendicular direction of the axis
|
|
904
|
+
var offAxis = ((horiz ? axisTop + axisHeight : axisLeft) +
|
|
905
|
+
(horiz ? 1 : -1) * // horizontal axis reverses the margin
|
|
906
|
+
(opposite ? -1 : 1) * // so does opposite axes
|
|
907
|
+
crispCorr +
|
|
908
|
+
(axis.side === GridAxisSide.bottom ? titleFontSize : 0));
|
|
909
|
+
e.titlePosition.x = horiz ?
|
|
910
|
+
axisLeft - (titleWidth || 0) / 2 - titleMargin + xOption :
|
|
911
|
+
offAxis + (opposite ? axisWidth : 0) + offset + xOption;
|
|
912
|
+
e.titlePosition.y = horiz ?
|
|
913
|
+
(offAxis -
|
|
914
|
+
(opposite ? axisHeight : 0) +
|
|
915
|
+
(opposite ? titleFontSize : -titleFontSize) / 2 +
|
|
916
|
+
offset +
|
|
917
|
+
yOption) :
|
|
918
|
+
axisTop - titleMargin + yOption;
|
|
868
919
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
axisLeft = axis.left,
|
|
882
|
-
offset = axis.offset,
|
|
883
|
-
opposite = axis.opposite,
|
|
884
|
-
options_1 = axis.options,
|
|
885
|
-
axisTop = axis.top,
|
|
886
|
-
axisWidth = axis.width;
|
|
887
|
-
var tickSize = axis.tickSize();
|
|
888
|
-
var titleWidth = axisTitle && axisTitle.getBBox().width;
|
|
889
|
-
var xOption = options_1.title.x;
|
|
890
|
-
var yOption = options_1.title.y;
|
|
891
|
-
var titleMargin = pick(options_1.title.margin,
|
|
892
|
-
horiz ? 5 : 10);
|
|
893
|
-
var titleFontSize = axis.chart.renderer.fontMetrics(options_1.title.style.fontSize,
|
|
894
|
-
axisTitle).f;
|
|
895
|
-
var crispCorr = tickSize ? tickSize[0] / 2 : 0;
|
|
896
|
-
// TODO account for alignment
|
|
897
|
-
// the position in the perpendicular direction of the axis
|
|
898
|
-
var offAxis = ((horiz ? axisTop + axisHeight : axisLeft) +
|
|
899
|
-
(horiz ? 1 : -1) * // horizontal axis reverses the margin
|
|
900
|
-
(opposite ? -1 : 1) * // so does opposite axes
|
|
901
|
-
crispCorr +
|
|
902
|
-
(axis.side === GridAxis.Side.bottom ? titleFontSize : 0));
|
|
903
|
-
e.titlePosition.x = horiz ?
|
|
904
|
-
axisLeft - (titleWidth || 0) / 2 - titleMargin + xOption :
|
|
905
|
-
offAxis + (opposite ? axisWidth : 0) + offset + xOption;
|
|
906
|
-
e.titlePosition.y = horiz ?
|
|
907
|
-
(offAxis -
|
|
908
|
-
(opposite ? axisHeight : 0) +
|
|
909
|
-
(opposite ? titleFontSize : -titleFontSize) / 2 +
|
|
910
|
-
offset +
|
|
911
|
-
yOption) :
|
|
912
|
-
axisTop - titleMargin + yOption;
|
|
913
|
-
}
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* @private
|
|
923
|
+
*/
|
|
924
|
+
function onAfterInit() {
|
|
925
|
+
var axis = this;
|
|
926
|
+
var chart = axis.chart,
|
|
927
|
+
_a = axis.options.grid,
|
|
928
|
+
gridOptions = _a === void 0 ? {} : _a,
|
|
929
|
+
userOptions = axis.userOptions;
|
|
930
|
+
if (gridOptions.enabled) {
|
|
931
|
+
applyGridOptions(axis);
|
|
914
932
|
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
delete columnOptions.grid.columns; // Prevent recursion
|
|
943
|
-
var column = new Axis(axis.chart,
|
|
944
|
-
columnOptions);
|
|
945
|
-
column.grid.isColumn = true;
|
|
946
|
-
column.grid.columnIndex = columnIndex;
|
|
947
|
-
// Remove column axis from chart axes array, and place it
|
|
948
|
-
// in the columns array.
|
|
949
|
-
erase(chart.axes, column);
|
|
950
|
-
erase(chart[axis.coll], column);
|
|
951
|
-
columns.push(column);
|
|
952
|
-
}
|
|
933
|
+
if (gridOptions.columns) {
|
|
934
|
+
var columns = axis.grid.columns = [];
|
|
935
|
+
var columnIndex = axis.grid.columnIndex = 0;
|
|
936
|
+
// Handle columns, each column is a grid axis
|
|
937
|
+
while (++columnIndex < gridOptions.columns.length) {
|
|
938
|
+
var columnOptions = merge(userOptions,
|
|
939
|
+
gridOptions.columns[gridOptions.columns.length - columnIndex - 1], {
|
|
940
|
+
linkedTo: 0,
|
|
941
|
+
// Force to behave like category axis
|
|
942
|
+
type: 'category',
|
|
943
|
+
// Disable by default the scrollbar on the grid axis
|
|
944
|
+
scrollbar: {
|
|
945
|
+
enabled: false
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
delete columnOptions.grid.columns; // Prevent recursion
|
|
949
|
+
var column = new Axis(axis.chart,
|
|
950
|
+
columnOptions);
|
|
951
|
+
column.grid.isColumn = true;
|
|
952
|
+
column.grid.columnIndex = columnIndex;
|
|
953
|
+
// Remove column axis from chart axes array, and place it
|
|
954
|
+
// in the columns array.
|
|
955
|
+
erase(chart.axes, column);
|
|
956
|
+
erase(chart[axis.coll], column);
|
|
957
|
+
columns.push(column);
|
|
953
958
|
}
|
|
954
959
|
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Draw an extra line on the far side of the outermost axis,
|
|
963
|
+
* creating floor/roof/wall of a grid. And some padding.
|
|
964
|
+
* ```
|
|
965
|
+
* Make this:
|
|
966
|
+
* (axis.min) __________________________ (axis.max)
|
|
967
|
+
* | | | | |
|
|
968
|
+
* Into this:
|
|
969
|
+
* (axis.min) __________________________ (axis.max)
|
|
970
|
+
* ___|____|____|____|____|__
|
|
971
|
+
* ```
|
|
972
|
+
* @private
|
|
973
|
+
*/
|
|
974
|
+
function onAfterRender() {
|
|
975
|
+
var axis = this,
|
|
976
|
+
grid = axis.grid,
|
|
977
|
+
options = axis.options,
|
|
978
|
+
gridOptions = options.grid || {};
|
|
979
|
+
if (gridOptions.enabled === true) {
|
|
980
|
+
var min = axis.min || 0,
|
|
981
|
+
max = axis.max || 0;
|
|
982
|
+
// @todo acutual label padding (top, bottom, left, right)
|
|
983
|
+
axis.maxLabelDimensions = axis.getMaxLabelDimensions(axis.ticks, axis.tickPositions);
|
|
984
|
+
// Remove right wall before rendering if updating
|
|
985
|
+
if (axis.rightWall) {
|
|
986
|
+
axis.rightWall.destroy();
|
|
987
|
+
}
|
|
988
|
+
/*
|
|
989
|
+
Draw an extra axis line on outer axes
|
|
990
|
+
>
|
|
991
|
+
Make this: |______|______|______|___
|
|
986
992
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
}
|
|
1007
|
-
else {
|
|
1008
|
-
startPoint[1] += distance;
|
|
1009
|
-
endPoint[1] += distance;
|
|
1010
|
-
}
|
|
993
|
+
> _________________________
|
|
994
|
+
Into this: |______|______|______|__|
|
|
995
|
+
*/
|
|
996
|
+
if (axis.grid && axis.grid.isOuterAxis() && axis.axisLine) {
|
|
997
|
+
var lineWidth = options.lineWidth;
|
|
998
|
+
if (lineWidth) {
|
|
999
|
+
var linePath = axis.getLinePath(lineWidth),
|
|
1000
|
+
startPoint = linePath[0],
|
|
1001
|
+
endPoint = linePath[1],
|
|
1002
|
+
// Negate distance if top or left axis
|
|
1003
|
+
// Subtract 1px to draw the line at the end of the tick
|
|
1004
|
+
tickLength = (axis.tickSize('tick') || [1])[0],
|
|
1005
|
+
distance = (tickLength - 1) * ((axis.side === GridAxisSide.top ||
|
|
1006
|
+
axis.side === GridAxisSide.left) ? -1 : 1);
|
|
1007
|
+
// If axis is horizontal, reposition line path vertically
|
|
1008
|
+
if (startPoint[0] === 'M' && endPoint[0] === 'L') {
|
|
1009
|
+
if (axis.horiz) {
|
|
1010
|
+
startPoint[2] += distance;
|
|
1011
|
+
endPoint[2] += distance;
|
|
1011
1012
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
var upperBorderStartPoint = startPoint,
|
|
1016
|
-
upperBorderEndPoint = [
|
|
1017
|
-
'L',
|
|
1018
|
-
axis.left,
|
|
1019
|
-
startPoint[2] || 0
|
|
1020
|
-
],
|
|
1021
|
-
upperBorderPath = [
|
|
1022
|
-
upperBorderStartPoint,
|
|
1023
|
-
upperBorderEndPoint
|
|
1024
|
-
],
|
|
1025
|
-
lowerBorderEndPoint = [
|
|
1026
|
-
'L',
|
|
1027
|
-
axis.chart.chartWidth - axis.chart.marginRight,
|
|
1028
|
-
axis.toPixels(max + axis.tickmarkOffset)
|
|
1029
|
-
],
|
|
1030
|
-
lowerBorderStartPoint = [
|
|
1031
|
-
'M',
|
|
1032
|
-
endPoint[1] || 0,
|
|
1033
|
-
axis.toPixels(max + axis.tickmarkOffset)
|
|
1034
|
-
],
|
|
1035
|
-
lowerBorderPath = [
|
|
1036
|
-
lowerBorderStartPoint,
|
|
1037
|
-
lowerBorderEndPoint
|
|
1038
|
-
];
|
|
1039
|
-
if (!axis.grid.upperBorder && min % 1 !== 0) {
|
|
1040
|
-
axis.grid.upperBorder = axis.grid.renderBorder(upperBorderPath);
|
|
1041
|
-
}
|
|
1042
|
-
if (axis.grid.upperBorder) {
|
|
1043
|
-
axis.grid.upperBorder.attr({
|
|
1044
|
-
stroke: options.lineColor,
|
|
1045
|
-
'stroke-width': options.lineWidth
|
|
1046
|
-
});
|
|
1047
|
-
axis.grid.upperBorder.animate({
|
|
1048
|
-
d: upperBorderPath
|
|
1049
|
-
});
|
|
1050
|
-
}
|
|
1051
|
-
if (!axis.grid.lowerBorder && max % 1 !== 0) {
|
|
1052
|
-
axis.grid.lowerBorder = axis.grid.renderBorder(lowerBorderPath);
|
|
1053
|
-
}
|
|
1054
|
-
if (axis.grid.lowerBorder) {
|
|
1055
|
-
axis.grid.lowerBorder.attr({
|
|
1056
|
-
stroke: options.lineColor,
|
|
1057
|
-
'stroke-width': options.lineWidth
|
|
1058
|
-
});
|
|
1059
|
-
axis.grid.lowerBorder.animate({
|
|
1060
|
-
d: lowerBorderPath
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1013
|
+
else {
|
|
1014
|
+
startPoint[1] += distance;
|
|
1015
|
+
endPoint[1] += distance;
|
|
1063
1016
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1017
|
+
}
|
|
1018
|
+
// If it doesn't exist, add an upper and lower border
|
|
1019
|
+
// for the vertical grid axis.
|
|
1020
|
+
if (!axis.horiz && axis.chart.marginRight) {
|
|
1021
|
+
var upperBorderStartPoint = startPoint,
|
|
1022
|
+
upperBorderEndPoint = [
|
|
1023
|
+
'L',
|
|
1024
|
+
axis.left,
|
|
1025
|
+
startPoint[2] || 0
|
|
1026
|
+
],
|
|
1027
|
+
upperBorderPath = [
|
|
1028
|
+
upperBorderStartPoint,
|
|
1029
|
+
upperBorderEndPoint
|
|
1030
|
+
],
|
|
1031
|
+
lowerBorderEndPoint = [
|
|
1032
|
+
'L',
|
|
1033
|
+
axis.chart.chartWidth - axis.chart.marginRight,
|
|
1034
|
+
axis.toPixels(max + axis.tickmarkOffset)
|
|
1035
|
+
],
|
|
1036
|
+
lowerBorderStartPoint = [
|
|
1037
|
+
'M',
|
|
1038
|
+
endPoint[1] || 0,
|
|
1039
|
+
axis.toPixels(max + axis.tickmarkOffset)
|
|
1040
|
+
],
|
|
1041
|
+
lowerBorderPath = [
|
|
1042
|
+
lowerBorderStartPoint,
|
|
1043
|
+
lowerBorderEndPoint
|
|
1044
|
+
];
|
|
1045
|
+
if (!axis.grid.upperBorder && min % 1 !== 0) {
|
|
1046
|
+
axis.grid.upperBorder = axis.grid.renderBorder(upperBorderPath);
|
|
1068
1047
|
}
|
|
1069
|
-
|
|
1070
|
-
axis.grid.
|
|
1048
|
+
if (axis.grid.upperBorder) {
|
|
1049
|
+
axis.grid.upperBorder.attr({
|
|
1071
1050
|
stroke: options.lineColor,
|
|
1072
1051
|
'stroke-width': options.lineWidth
|
|
1073
1052
|
});
|
|
1074
|
-
axis.grid.
|
|
1075
|
-
d:
|
|
1053
|
+
axis.grid.upperBorder.animate({
|
|
1054
|
+
d: upperBorderPath
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
if (!axis.grid.lowerBorder && max % 1 !== 0) {
|
|
1058
|
+
axis.grid.lowerBorder = axis.grid.renderBorder(lowerBorderPath);
|
|
1059
|
+
}
|
|
1060
|
+
if (axis.grid.lowerBorder) {
|
|
1061
|
+
axis.grid.lowerBorder.attr({
|
|
1062
|
+
stroke: options.lineColor,
|
|
1063
|
+
'stroke-width': options.lineWidth
|
|
1064
|
+
});
|
|
1065
|
+
axis.grid.lowerBorder.animate({
|
|
1066
|
+
d: lowerBorderPath
|
|
1076
1067
|
});
|
|
1077
1068
|
}
|
|
1078
|
-
// show or hide the line depending on options.showEmpty
|
|
1079
|
-
axis.axisLine[axis.showAxis ? 'show' : 'hide'](true);
|
|
1080
1069
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
// Manipulate the tick mark visibility
|
|
1086
|
-
// based on the axis.max- allows smooth scrolling.
|
|
1087
|
-
if (!axis.horiz &&
|
|
1088
|
-
axis.chart.hasRendered &&
|
|
1089
|
-
(axis.scrollbar ||
|
|
1090
|
-
(axis.linkedParent && axis.linkedParent.scrollbar))) {
|
|
1091
|
-
var tickmarkOffset = axis.tickmarkOffset,
|
|
1092
|
-
lastTick = axis.tickPositions[axis.tickPositions.length - 1],
|
|
1093
|
-
firstTick = axis.tickPositions[0];
|
|
1094
|
-
var label = void 0,
|
|
1095
|
-
tickMark = void 0;
|
|
1096
|
-
while ((label = axis.hiddenLabels.pop()) && label.element) {
|
|
1097
|
-
label.show(); // #15453
|
|
1070
|
+
// Render an extra line parallel to the existing axes, to
|
|
1071
|
+
// close the grid.
|
|
1072
|
+
if (!axis.grid.axisLineExtra) {
|
|
1073
|
+
axis.grid.axisLineExtra = axis.grid.renderBorder(linePath);
|
|
1098
1074
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1075
|
+
else {
|
|
1076
|
+
axis.grid.axisLineExtra.attr({
|
|
1077
|
+
stroke: options.lineColor,
|
|
1078
|
+
'stroke-width': options.lineWidth
|
|
1079
|
+
});
|
|
1080
|
+
axis.grid.axisLineExtra.animate({
|
|
1081
|
+
d: linePath
|
|
1082
|
+
});
|
|
1102
1083
|
}
|
|
1103
|
-
//
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1084
|
+
// show or hide the line depending on options.showEmpty
|
|
1085
|
+
axis.axisLine[axis.showAxis ? 'show' : 'hide']();
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
(grid && grid.columns || []).forEach(function (column) { return column.render(); });
|
|
1089
|
+
// Manipulate the tick mark visibility
|
|
1090
|
+
// based on the axis.max- allows smooth scrolling.
|
|
1091
|
+
if (!axis.horiz &&
|
|
1092
|
+
axis.chart.hasRendered &&
|
|
1093
|
+
(axis.scrollbar ||
|
|
1094
|
+
(axis.linkedParent && axis.linkedParent.scrollbar))) {
|
|
1095
|
+
var tickmarkOffset = axis.tickmarkOffset,
|
|
1096
|
+
lastTick = axis.tickPositions[axis.tickPositions.length - 1],
|
|
1097
|
+
firstTick = axis.tickPositions[0];
|
|
1098
|
+
var label = void 0,
|
|
1099
|
+
tickMark = void 0;
|
|
1100
|
+
while ((label = axis.hiddenLabels.pop()) && label.element) {
|
|
1101
|
+
label.show(); // #15453
|
|
1102
|
+
}
|
|
1103
|
+
while ((tickMark = axis.hiddenMarks.pop()) &&
|
|
1104
|
+
tickMark.element) {
|
|
1105
|
+
tickMark.show(); // #16439
|
|
1106
|
+
}
|
|
1107
|
+
// Hide/show firts tick label.
|
|
1108
|
+
label = axis.ticks[firstTick].label;
|
|
1109
|
+
if (label) {
|
|
1110
|
+
if (min - firstTick > tickmarkOffset) {
|
|
1111
|
+
axis.hiddenLabels.push(label.hide());
|
|
1112
1112
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1113
|
+
else {
|
|
1114
|
+
label.show();
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
// Hide/show last tick mark/label.
|
|
1118
|
+
label = axis.ticks[lastTick].label;
|
|
1119
|
+
if (label) {
|
|
1120
|
+
if (lastTick - max > tickmarkOffset) {
|
|
1121
|
+
axis.hiddenLabels.push(label.hide());
|
|
1122
1122
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
lastTick - max < tickmarkOffset &&
|
|
1126
|
-
lastTick - max > 0 && axis.ticks[lastTick].isLast) {
|
|
1127
|
-
axis.hiddenMarks.push(mark.hide());
|
|
1123
|
+
else {
|
|
1124
|
+
label.show();
|
|
1128
1125
|
}
|
|
1129
1126
|
}
|
|
1127
|
+
var mark = axis.ticks[lastTick].mark;
|
|
1128
|
+
if (mark &&
|
|
1129
|
+
lastTick - max < tickmarkOffset &&
|
|
1130
|
+
lastTick - max > 0 && axis.ticks[lastTick].isLast) {
|
|
1131
|
+
axis.hiddenMarks.push(mark.hide());
|
|
1132
|
+
}
|
|
1130
1133
|
}
|
|
1131
1134
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1137
|
+
* @private
|
|
1138
|
+
*/
|
|
1139
|
+
function onAfterSetAxisTranslation() {
|
|
1140
|
+
var axis = this;
|
|
1141
|
+
var tickInfo = axis.tickPositions && axis.tickPositions.info;
|
|
1142
|
+
var options = axis.options;
|
|
1143
|
+
var gridOptions = options.grid || {};
|
|
1144
|
+
var userLabels = axis.userOptions.labels || {};
|
|
1145
|
+
// Fire this only for the Gantt type chart, #14868.
|
|
1146
|
+
if (gridOptions.enabled) {
|
|
1147
|
+
if (axis.horiz) {
|
|
1148
|
+
axis.series.forEach(function (series) {
|
|
1149
|
+
series.options.pointRange = 0;
|
|
1150
|
+
});
|
|
1151
|
+
// Lower level time ticks, like hours or minutes, represent
|
|
1152
|
+
// points in time and not ranges. These should be aligned
|
|
1153
|
+
// left in the grid cell by default. The same applies to
|
|
1154
|
+
// years of higher order.
|
|
1155
|
+
if (tickInfo &&
|
|
1156
|
+
options.dateTimeLabelFormats &&
|
|
1157
|
+
options.labels &&
|
|
1158
|
+
!defined(userLabels.align) &&
|
|
1159
|
+
(options.dateTimeLabelFormats[tickInfo.unitName]
|
|
1160
|
+
.range === false ||
|
|
1161
|
+
tickInfo.count > 1 // years
|
|
1162
|
+
)) {
|
|
1163
|
+
options.labels.align = 'left';
|
|
1164
|
+
if (!defined(userLabels.x)) {
|
|
1165
|
+
options.labels.x = 3;
|
|
1163
1166
|
}
|
|
1164
1167
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1168
|
+
}
|
|
1169
|
+
else {
|
|
1170
|
+
// Don't trim ticks which not in min/max range but
|
|
1171
|
+
// they are still in the min/max plus tickInterval.
|
|
1172
|
+
if (this.options.type !== 'treegrid' &&
|
|
1173
|
+
axis.grid &&
|
|
1174
|
+
axis.grid.columns) {
|
|
1175
|
+
this.minPointOffset = this.tickInterval;
|
|
1173
1176
|
}
|
|
1174
1177
|
}
|
|
1175
1178
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
day: {
|
|
1199
|
-
list: ['%A, %e. %B', '%a, %e. %b', '%E']
|
|
1200
|
-
},
|
|
1201
|
-
week: {
|
|
1202
|
-
list: ['Week %W', 'W%W']
|
|
1203
|
-
},
|
|
1204
|
-
month: {
|
|
1205
|
-
list: ['%B', '%b', '%o']
|
|
1206
|
-
}
|
|
1207
|
-
},
|
|
1208
|
-
grid: {
|
|
1209
|
-
borderWidth: 1
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Creates a left and right wall on horizontal axes:
|
|
1182
|
+
* - Places leftmost tick at the start of the axis, to create a left
|
|
1183
|
+
* wall
|
|
1184
|
+
* - Ensures that the rightmost tick is at the end of the axis, to
|
|
1185
|
+
* create a right wall.
|
|
1186
|
+
* @private
|
|
1187
|
+
*/
|
|
1188
|
+
function onAfterSetOptions(e) {
|
|
1189
|
+
var options = this.options,
|
|
1190
|
+
userOptions = e.userOptions,
|
|
1191
|
+
gridOptions = ((options && isObject(options.grid)) ? options.grid : {});
|
|
1192
|
+
var gridAxisOptions;
|
|
1193
|
+
if (gridOptions.enabled === true) {
|
|
1194
|
+
// Merge the user options into default grid axis options so
|
|
1195
|
+
// that when a user option is set, it takes presedence.
|
|
1196
|
+
gridAxisOptions = merge(true, {
|
|
1197
|
+
className: ('highcharts-grid-axis ' + (userOptions.className || '')),
|
|
1198
|
+
dateTimeLabelFormats: {
|
|
1199
|
+
hour: {
|
|
1200
|
+
list: ['%H:%M', '%H']
|
|
1210
1201
|
},
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
style: {
|
|
1214
|
-
fontSize: '13px'
|
|
1215
|
-
}
|
|
1202
|
+
day: {
|
|
1203
|
+
list: ['%A, %e. %B', '%a, %e. %b', '%E']
|
|
1216
1204
|
},
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
text: null,
|
|
1220
|
-
reserveSpace: false,
|
|
1221
|
-
rotation: 0
|
|
1205
|
+
week: {
|
|
1206
|
+
list: ['Week %W', 'W%W']
|
|
1222
1207
|
},
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
// two days.
|
|
1226
|
-
units: [[
|
|
1227
|
-
'millisecond',
|
|
1228
|
-
[1, 10, 100]
|
|
1229
|
-
], [
|
|
1230
|
-
'second',
|
|
1231
|
-
[1, 10]
|
|
1232
|
-
], [
|
|
1233
|
-
'minute',
|
|
1234
|
-
[1, 5, 15]
|
|
1235
|
-
], [
|
|
1236
|
-
'hour',
|
|
1237
|
-
[1, 6]
|
|
1238
|
-
], [
|
|
1239
|
-
'day',
|
|
1240
|
-
[1]
|
|
1241
|
-
], [
|
|
1242
|
-
'week',
|
|
1243
|
-
[1]
|
|
1244
|
-
], [
|
|
1245
|
-
'month',
|
|
1246
|
-
[1]
|
|
1247
|
-
], [
|
|
1248
|
-
'year',
|
|
1249
|
-
null
|
|
1250
|
-
]]
|
|
1251
|
-
}, userOptions);
|
|
1252
|
-
// X-axis specific options
|
|
1253
|
-
if (this.coll === 'xAxis') {
|
|
1254
|
-
// For linked axes, tickPixelInterval is used only if
|
|
1255
|
-
// the tickPositioner below doesn't run or returns
|
|
1256
|
-
// undefined (like multiple years)
|
|
1257
|
-
if (defined(userOptions.linkedTo) &&
|
|
1258
|
-
!defined(userOptions.tickPixelInterval)) {
|
|
1259
|
-
gridAxisOptions.tickPixelInterval = 350;
|
|
1208
|
+
month: {
|
|
1209
|
+
list: ['%B', '%b', '%o']
|
|
1260
1210
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
!defined(userOptions.tickInterval)) {
|
|
1270
|
-
gridAxisOptions.tickPositioner = function (min, max) {
|
|
1271
|
-
var parentInfo = (this.linkedParent &&
|
|
1272
|
-
this.linkedParent.tickPositions &&
|
|
1273
|
-
this.linkedParent.tickPositions.info);
|
|
1274
|
-
if (parentInfo) {
|
|
1275
|
-
var units = (gridAxisOptions.units || []);
|
|
1276
|
-
var unitIdx = void 0,
|
|
1277
|
-
count = void 0,
|
|
1278
|
-
unitName = void 0;
|
|
1279
|
-
for (var i = 0; i < units.length; i++) {
|
|
1280
|
-
if (units[i][0] ===
|
|
1281
|
-
parentInfo.unitName) {
|
|
1282
|
-
unitIdx = i;
|
|
1283
|
-
break;
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
// Get the first allowed count on the next
|
|
1287
|
-
// unit.
|
|
1288
|
-
if (units[unitIdx + 1]) {
|
|
1289
|
-
unitName = units[unitIdx + 1][0];
|
|
1290
|
-
count =
|
|
1291
|
-
(units[unitIdx + 1][1] || [1])[0];
|
|
1292
|
-
// In case the base X axis shows years, make
|
|
1293
|
-
// the secondary axis show ten times the
|
|
1294
|
-
// years (#11427)
|
|
1295
|
-
}
|
|
1296
|
-
else if (parentInfo.unitName === 'year') {
|
|
1297
|
-
unitName = 'year';
|
|
1298
|
-
count = parentInfo.count * 10;
|
|
1299
|
-
}
|
|
1300
|
-
var unitRange = timeUnits[unitName];
|
|
1301
|
-
this.tickInterval = unitRange * count;
|
|
1302
|
-
return this.getTimeTicks({
|
|
1303
|
-
unitRange: unitRange,
|
|
1304
|
-
count: count,
|
|
1305
|
-
unitName: unitName
|
|
1306
|
-
}, min, max, this.options.startOfWeek);
|
|
1307
|
-
}
|
|
1308
|
-
};
|
|
1211
|
+
},
|
|
1212
|
+
grid: {
|
|
1213
|
+
borderWidth: 1
|
|
1214
|
+
},
|
|
1215
|
+
labels: {
|
|
1216
|
+
padding: 2,
|
|
1217
|
+
style: {
|
|
1218
|
+
fontSize: '13px'
|
|
1309
1219
|
}
|
|
1220
|
+
},
|
|
1221
|
+
margin: 0,
|
|
1222
|
+
title: {
|
|
1223
|
+
text: null,
|
|
1224
|
+
reserveSpace: false,
|
|
1225
|
+
rotation: 0
|
|
1226
|
+
},
|
|
1227
|
+
// In a grid axis, only allow one unit of certain types,
|
|
1228
|
+
// for example we shouln't have one grid cell spanning
|
|
1229
|
+
// two days.
|
|
1230
|
+
units: [[
|
|
1231
|
+
'millisecond',
|
|
1232
|
+
[1, 10, 100]
|
|
1233
|
+
], [
|
|
1234
|
+
'second',
|
|
1235
|
+
[1, 10]
|
|
1236
|
+
], [
|
|
1237
|
+
'minute',
|
|
1238
|
+
[1, 5, 15]
|
|
1239
|
+
], [
|
|
1240
|
+
'hour',
|
|
1241
|
+
[1, 6]
|
|
1242
|
+
], [
|
|
1243
|
+
'day',
|
|
1244
|
+
[1]
|
|
1245
|
+
], [
|
|
1246
|
+
'week',
|
|
1247
|
+
[1]
|
|
1248
|
+
], [
|
|
1249
|
+
'month',
|
|
1250
|
+
[1]
|
|
1251
|
+
], [
|
|
1252
|
+
'year',
|
|
1253
|
+
null
|
|
1254
|
+
]]
|
|
1255
|
+
}, userOptions);
|
|
1256
|
+
// X-axis specific options
|
|
1257
|
+
if (this.coll === 'xAxis') {
|
|
1258
|
+
// For linked axes, tickPixelInterval is used only if
|
|
1259
|
+
// the tickPositioner below doesn't run or returns
|
|
1260
|
+
// undefined (like multiple years)
|
|
1261
|
+
if (defined(userOptions.linkedTo) &&
|
|
1262
|
+
!defined(userOptions.tickPixelInterval)) {
|
|
1263
|
+
gridAxisOptions.tickPixelInterval = 350;
|
|
1310
1264
|
}
|
|
1311
|
-
//
|
|
1312
|
-
|
|
1313
|
-
if (
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1265
|
+
// For the secondary grid axis, use the primary axis'
|
|
1266
|
+
// tick intervals and return ticks one level higher.
|
|
1267
|
+
if (
|
|
1268
|
+
// Check for tick pixel interval in options
|
|
1269
|
+
!defined(userOptions.tickPixelInterval) &&
|
|
1270
|
+
// Only for linked axes
|
|
1271
|
+
defined(userOptions.linkedTo) &&
|
|
1272
|
+
!defined(userOptions.tickPositioner) &&
|
|
1273
|
+
!defined(userOptions.tickInterval)) {
|
|
1274
|
+
gridAxisOptions.tickPositioner = function (min, max) {
|
|
1275
|
+
var parentInfo = (this.linkedParent &&
|
|
1276
|
+
this.linkedParent.tickPositions &&
|
|
1277
|
+
this.linkedParent.tickPositions.info);
|
|
1278
|
+
if (parentInfo) {
|
|
1279
|
+
var units = (gridAxisOptions.units || []);
|
|
1280
|
+
var unitIdx = void 0,
|
|
1281
|
+
count = 1,
|
|
1282
|
+
unitName = 'year';
|
|
1283
|
+
for (var i = 0; i < units.length; i++) {
|
|
1284
|
+
var unit_1 = units[i];
|
|
1285
|
+
if (unit_1 && unit_1[0] === parentInfo.unitName) {
|
|
1286
|
+
unitIdx = i;
|
|
1287
|
+
break;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
// Get the first allowed count on the next unit.
|
|
1291
|
+
var unit = (isNumber(unitIdx) && units[unitIdx + 1]);
|
|
1292
|
+
if (unit) {
|
|
1293
|
+
unitName = unit[0] || 'year';
|
|
1294
|
+
var counts = unit[1];
|
|
1295
|
+
count = counts && counts[0] || 1;
|
|
1296
|
+
// In case the base X axis shows years, make the
|
|
1297
|
+
// secondary axis show ten times the years (#11427)
|
|
1298
|
+
}
|
|
1299
|
+
else if (parentInfo.unitName === 'year') {
|
|
1300
|
+
// unitName is 'year'
|
|
1301
|
+
count = parentInfo.count * 10;
|
|
1302
|
+
}
|
|
1303
|
+
var unitRange = timeUnits[unitName];
|
|
1304
|
+
this.tickInterval = unitRange * count;
|
|
1305
|
+
return this.chart.time.getTimeTicks({ unitRange: unitRange, count: count, unitName: unitName }, min, max, this.options.startOfWeek);
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1328
1308
|
}
|
|
1329
1309
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1310
|
+
// Now merge the combined options into the axis options
|
|
1311
|
+
merge(true, this.options, gridAxisOptions);
|
|
1312
|
+
if (this.horiz) {
|
|
1313
|
+
/* _________________________
|
|
1314
|
+
Make this: ___|_____|_____|_____|__|
|
|
1315
|
+
^ ^
|
|
1316
|
+
_________________________
|
|
1317
|
+
Into this: |_____|_____|_____|_____|
|
|
1318
|
+
^ ^ */
|
|
1319
|
+
options.minPadding = pick(userOptions.minPadding, 0);
|
|
1320
|
+
options.maxPadding = pick(userOptions.maxPadding, 0);
|
|
1321
|
+
}
|
|
1322
|
+
// If borderWidth is set, then use its value for tick and
|
|
1323
|
+
// line width.
|
|
1324
|
+
if (isNumber(options.grid.borderWidth)) {
|
|
1325
|
+
options.tickWidth = options.lineWidth =
|
|
1326
|
+
gridOptions.borderWidth;
|
|
1343
1327
|
}
|
|
1344
1328
|
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* @private
|
|
1332
|
+
*/
|
|
1333
|
+
function onAfterSetOptions2(e) {
|
|
1334
|
+
var axis = this;
|
|
1335
|
+
var userOptions = e.userOptions;
|
|
1336
|
+
var gridOptions = userOptions && userOptions.grid || {};
|
|
1337
|
+
var columns = gridOptions.columns;
|
|
1338
|
+
// Add column options to the parent axis. Children has their column
|
|
1339
|
+
// options set on init in onGridAxisAfterInit.
|
|
1340
|
+
if (gridOptions.enabled && columns) {
|
|
1341
|
+
merge(true, axis.options, columns[columns.length - 1]);
|
|
1354
1342
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* Handle columns and setScale.
|
|
1346
|
+
* @private
|
|
1347
|
+
*/
|
|
1348
|
+
function onAfterSetScale() {
|
|
1349
|
+
var axis = this;
|
|
1350
|
+
(axis.grid.columns || []).forEach(function (column) { return column.setScale(); });
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Draw vertical axis ticks extra long to create cell floors and roofs.
|
|
1354
|
+
* Overrides the tickLength for vertical axes.
|
|
1355
|
+
* @private
|
|
1356
|
+
*/
|
|
1357
|
+
function onAfterTickSize(e) {
|
|
1358
|
+
var defaultLeftAxisOptions = AxisDefaults.defaultLeftAxisOptions;
|
|
1359
|
+
var _a = this,
|
|
1360
|
+
horiz = _a.horiz,
|
|
1361
|
+
maxLabelDimensions = _a.maxLabelDimensions,
|
|
1362
|
+
_b = _a.options.grid,
|
|
1363
|
+
gridOptions = _b === void 0 ? {} : _b;
|
|
1364
|
+
if (gridOptions.enabled && maxLabelDimensions) {
|
|
1365
|
+
var labelPadding = (Math.abs(defaultLeftAxisOptions.labels.x) * 2);
|
|
1366
|
+
var distance = horiz ?
|
|
1367
|
+
(gridOptions.cellHeight ||
|
|
1368
|
+
labelPadding + maxLabelDimensions.height) :
|
|
1369
|
+
labelPadding + maxLabelDimensions.width;
|
|
1370
|
+
if (isArray(e.tickSize)) {
|
|
1371
|
+
e.tickSize[0] = distance;
|
|
1372
|
+
}
|
|
1373
|
+
else {
|
|
1374
|
+
e.tickSize = [distance, 0];
|
|
1379
1375
|
}
|
|
1380
1376
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* @private
|
|
1380
|
+
*/
|
|
1381
|
+
function onChartAfterSetChartSize() {
|
|
1382
|
+
this.axes.forEach(function (axis) {
|
|
1383
|
+
(axis.grid && axis.grid.columns || []).forEach(function (column) {
|
|
1384
|
+
column.setAxisSize();
|
|
1385
|
+
column.setAxisTranslation();
|
|
1390
1386
|
});
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* @private
|
|
1391
|
+
*/
|
|
1392
|
+
function onDestroy(e) {
|
|
1393
|
+
var grid = this.grid;
|
|
1394
|
+
(grid.columns || []).forEach(function (column) { return column.destroy(e.keepEvents); });
|
|
1395
|
+
grid.columns = void 0;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Wraps axis init to draw cell walls on vertical axes.
|
|
1399
|
+
* @private
|
|
1400
|
+
*/
|
|
1401
|
+
function onInit(e) {
|
|
1402
|
+
var axis = this;
|
|
1403
|
+
var userOptions = e.userOptions || {};
|
|
1404
|
+
var gridOptions = userOptions.grid || {};
|
|
1405
|
+
if (gridOptions.enabled && defined(gridOptions.borderColor)) {
|
|
1406
|
+
userOptions.tickColor = userOptions.lineColor = (gridOptions.borderColor);
|
|
1391
1407
|
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
*/
|
|
1395
|
-
function onDestroy(e) {
|
|
1396
|
-
var grid = this.grid;
|
|
1397
|
-
(grid.columns || []).forEach(function (column) {
|
|
1398
|
-
column.destroy(e.keepEvents);
|
|
1399
|
-
});
|
|
1400
|
-
grid.columns = void 0;
|
|
1408
|
+
if (!axis.grid) {
|
|
1409
|
+
axis.grid = new GridAxisAdditions(axis);
|
|
1401
1410
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1411
|
+
axis.hiddenLabels = [];
|
|
1412
|
+
axis.hiddenMarks = [];
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Center tick labels in cells.
|
|
1416
|
+
* @private
|
|
1417
|
+
*/
|
|
1418
|
+
function onTickAfterGetLabelPosition(e) {
|
|
1419
|
+
var tick = this,
|
|
1420
|
+
label = tick.label,
|
|
1421
|
+
axis = tick.axis,
|
|
1422
|
+
reversed = axis.reversed,
|
|
1423
|
+
chart = axis.chart,
|
|
1424
|
+
options = axis.options,
|
|
1425
|
+
gridOptions = options.grid || {},
|
|
1426
|
+
labelOpts = axis.options.labels,
|
|
1427
|
+
align = labelOpts.align,
|
|
1428
|
+
// verticalAlign is currently not supported for axis.labels.
|
|
1429
|
+
verticalAlign = 'middle', // labelOpts.verticalAlign,
|
|
1430
|
+
side = GridAxisSide[axis.side],
|
|
1431
|
+
tickmarkOffset = e.tickmarkOffset,
|
|
1432
|
+
tickPositions = axis.tickPositions,
|
|
1433
|
+
tickPos = tick.pos - tickmarkOffset,
|
|
1434
|
+
nextTickPos = (isNumber(tickPositions[e.index + 1]) ?
|
|
1435
|
+
tickPositions[e.index + 1] - tickmarkOffset :
|
|
1436
|
+
(axis.max || 0) + tickmarkOffset),
|
|
1437
|
+
tickSize = axis.tickSize('tick'),
|
|
1438
|
+
tickWidth = tickSize ? tickSize[0] : 0,
|
|
1439
|
+
crispCorr = tickSize ? tickSize[1] / 2 : 0;
|
|
1440
|
+
var labelHeight,
|
|
1441
|
+
lblMetrics,
|
|
1442
|
+
lines,
|
|
1443
|
+
bottom,
|
|
1444
|
+
top,
|
|
1445
|
+
left,
|
|
1446
|
+
right;
|
|
1447
|
+
// Only center tick labels in grid axes
|
|
1448
|
+
if (gridOptions.enabled === true) {
|
|
1449
|
+
// Calculate top and bottom positions of the cell.
|
|
1450
|
+
if (side === 'top') {
|
|
1451
|
+
bottom = axis.top + axis.offset;
|
|
1452
|
+
top = bottom - tickWidth;
|
|
1412
1453
|
}
|
|
1413
|
-
if (
|
|
1414
|
-
|
|
1454
|
+
else if (side === 'bottom') {
|
|
1455
|
+
top = chart.chartHeight - axis.bottom + axis.offset;
|
|
1456
|
+
bottom = top + tickWidth;
|
|
1415
1457
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
/**
|
|
1420
|
-
* Center tick labels in cells.
|
|
1421
|
-
* @private
|
|
1422
|
-
*/
|
|
1423
|
-
function onTickAfterGetLabelPosition(e) {
|
|
1424
|
-
var tick = this,
|
|
1425
|
-
label = tick.label,
|
|
1426
|
-
axis = tick.axis,
|
|
1427
|
-
reversed = axis.reversed,
|
|
1428
|
-
chart = axis.chart,
|
|
1429
|
-
options = axis.options,
|
|
1430
|
-
gridOptions = options.grid || {},
|
|
1431
|
-
labelOpts = axis.options.labels,
|
|
1432
|
-
align = labelOpts.align,
|
|
1433
|
-
// verticalAlign is currently not supported for axis.labels.
|
|
1434
|
-
verticalAlign = 'middle', // labelOpts.verticalAlign,
|
|
1435
|
-
side = GridAxis.Side[axis.side],
|
|
1436
|
-
tickmarkOffset = e.tickmarkOffset,
|
|
1437
|
-
tickPositions = axis.tickPositions,
|
|
1438
|
-
tickPos = tick.pos - tickmarkOffset,
|
|
1439
|
-
nextTickPos = (isNumber(tickPositions[e.index + 1]) ?
|
|
1440
|
-
tickPositions[e.index + 1] - tickmarkOffset :
|
|
1441
|
-
(axis.max || 0) + tickmarkOffset),
|
|
1442
|
-
tickSize = axis.tickSize('tick'),
|
|
1443
|
-
tickWidth = tickSize ? tickSize[0] : 0,
|
|
1444
|
-
crispCorr = tickSize ? tickSize[1] / 2 : 0;
|
|
1445
|
-
var labelHeight,
|
|
1446
|
-
lblMetrics,
|
|
1447
|
-
lines,
|
|
1448
|
-
bottom,
|
|
1449
|
-
top,
|
|
1450
|
-
left,
|
|
1451
|
-
right;
|
|
1452
|
-
// Only center tick labels in grid axes
|
|
1453
|
-
if (gridOptions.enabled === true) {
|
|
1454
|
-
// Calculate top and bottom positions of the cell.
|
|
1455
|
-
if (side === 'top') {
|
|
1456
|
-
bottom = axis.top + axis.offset;
|
|
1457
|
-
top = bottom - tickWidth;
|
|
1458
|
-
}
|
|
1459
|
-
else if (side === 'bottom') {
|
|
1460
|
-
top = chart.chartHeight - axis.bottom + axis.offset;
|
|
1461
|
-
bottom = top + tickWidth;
|
|
1462
|
-
}
|
|
1463
|
-
else {
|
|
1464
|
-
bottom = axis.top + axis.len - (axis.translate(reversed ? nextTickPos : tickPos) || 0);
|
|
1465
|
-
top = axis.top + axis.len - (axis.translate(reversed ? tickPos : nextTickPos) || 0);
|
|
1466
|
-
}
|
|
1467
|
-
// Calculate left and right positions of the cell.
|
|
1468
|
-
if (side === 'right') {
|
|
1469
|
-
left = chart.chartWidth - axis.right + axis.offset;
|
|
1470
|
-
right = left + tickWidth;
|
|
1471
|
-
}
|
|
1472
|
-
else if (side === 'left') {
|
|
1473
|
-
right = axis.left + axis.offset;
|
|
1474
|
-
left = right - tickWidth;
|
|
1475
|
-
}
|
|
1476
|
-
else {
|
|
1477
|
-
left = Math.round(axis.left + (axis.translate(reversed ? nextTickPos : tickPos) || 0)) - crispCorr;
|
|
1478
|
-
right = Math.min(// #15742
|
|
1479
|
-
Math.round(axis.left + (axis.translate(reversed ? tickPos : nextTickPos) || 0)) - crispCorr, axis.left + axis.len);
|
|
1480
|
-
}
|
|
1481
|
-
tick.slotWidth = right - left;
|
|
1482
|
-
// Calculate the positioning of the label based on
|
|
1483
|
-
// alignment.
|
|
1484
|
-
e.pos.x = (align === 'left' ?
|
|
1485
|
-
left :
|
|
1486
|
-
align === 'right' ?
|
|
1487
|
-
right :
|
|
1488
|
-
left + ((right - left) / 2) // default to center
|
|
1489
|
-
);
|
|
1490
|
-
e.pos.y = (verticalAlign === 'top' ?
|
|
1491
|
-
top :
|
|
1492
|
-
verticalAlign === 'bottom' ?
|
|
1493
|
-
bottom :
|
|
1494
|
-
top + ((bottom - top) / 2) // default to middle
|
|
1495
|
-
);
|
|
1496
|
-
lblMetrics = chart.renderer.fontMetrics(labelOpts.style.fontSize, label && label.element);
|
|
1497
|
-
labelHeight = label ? label.getBBox().height : 0;
|
|
1498
|
-
// Adjustment to y position to align the label correctly.
|
|
1499
|
-
// Would be better to have a setter or similar for this.
|
|
1500
|
-
if (!labelOpts.useHTML) {
|
|
1501
|
-
lines = Math.round(labelHeight / lblMetrics.h);
|
|
1502
|
-
e.pos.y += (
|
|
1503
|
-
// Center the label
|
|
1504
|
-
// TODO: why does this actually center the label?
|
|
1505
|
-
((lblMetrics.b - (lblMetrics.h - lblMetrics.f)) / 2) +
|
|
1506
|
-
// Adjust for height of additional lines.
|
|
1507
|
-
-(((lines - 1) * lblMetrics.h) / 2));
|
|
1508
|
-
}
|
|
1509
|
-
else {
|
|
1510
|
-
e.pos.y += (
|
|
1511
|
-
// Readjust yCorr in htmlUpdateTransform
|
|
1512
|
-
lblMetrics.b +
|
|
1513
|
-
// Adjust for height of html label
|
|
1514
|
-
-(labelHeight / 2));
|
|
1515
|
-
}
|
|
1516
|
-
e.pos.x += (axis.horiz && labelOpts.x) || 0;
|
|
1458
|
+
else {
|
|
1459
|
+
bottom = axis.top + axis.len - (axis.translate(reversed ? nextTickPos : tickPos) || 0);
|
|
1460
|
+
top = axis.top + axis.len - (axis.translate(reversed ? tickPos : nextTickPos) || 0);
|
|
1517
1461
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1462
|
+
// Calculate left and right positions of the cell.
|
|
1463
|
+
if (side === 'right') {
|
|
1464
|
+
left = chart.chartWidth - axis.right + axis.offset;
|
|
1465
|
+
right = left + tickWidth;
|
|
1466
|
+
}
|
|
1467
|
+
else if (side === 'left') {
|
|
1468
|
+
right = axis.left + axis.offset;
|
|
1469
|
+
left = right - tickWidth;
|
|
1470
|
+
}
|
|
1471
|
+
else {
|
|
1472
|
+
left = Math.round(axis.left + (axis.translate(reversed ? nextTickPos : tickPos) || 0)) - crispCorr;
|
|
1473
|
+
right = Math.min(// #15742
|
|
1474
|
+
Math.round(axis.left + (axis.translate(reversed ? tickPos : nextTickPos) || 0)) - crispCorr, axis.left + axis.len);
|
|
1475
|
+
}
|
|
1476
|
+
tick.slotWidth = right - left;
|
|
1477
|
+
// Calculate the positioning of the label based on
|
|
1478
|
+
// alignment.
|
|
1479
|
+
e.pos.x = (align === 'left' ?
|
|
1480
|
+
left :
|
|
1481
|
+
align === 'right' ?
|
|
1482
|
+
right :
|
|
1483
|
+
left + ((right - left) / 2) // default to center
|
|
1484
|
+
);
|
|
1485
|
+
e.pos.y = (verticalAlign === 'top' ?
|
|
1486
|
+
top :
|
|
1487
|
+
verticalAlign === 'bottom' ?
|
|
1488
|
+
bottom :
|
|
1489
|
+
top + ((bottom - top) / 2) // default to middle
|
|
1490
|
+
);
|
|
1491
|
+
lblMetrics = chart.renderer.fontMetrics(labelOpts.style.fontSize, label && label.element);
|
|
1492
|
+
labelHeight = label ? label.getBBox().height : 0;
|
|
1493
|
+
// Adjustment to y position to align the label correctly.
|
|
1494
|
+
// Would be better to have a setter or similar for this.
|
|
1495
|
+
if (!labelOpts.useHTML) {
|
|
1496
|
+
lines = Math.round(labelHeight / lblMetrics.h);
|
|
1497
|
+
e.pos.y += (
|
|
1498
|
+
// Center the label
|
|
1499
|
+
// TODO: why does this actually center the label?
|
|
1500
|
+
((lblMetrics.b - (lblMetrics.h - lblMetrics.f)) / 2) +
|
|
1501
|
+
// Adjust for height of additional lines.
|
|
1502
|
+
-(((lines - 1) * lblMetrics.h) / 2));
|
|
1548
1503
|
}
|
|
1504
|
+
else {
|
|
1505
|
+
e.pos.y += (
|
|
1506
|
+
// Readjust yCorr in htmlUpdateTransform
|
|
1507
|
+
lblMetrics.b +
|
|
1508
|
+
// Adjust for height of html label
|
|
1509
|
+
-(labelHeight / 2));
|
|
1510
|
+
}
|
|
1511
|
+
e.pos.x += (axis.horiz && labelOpts.x) || 0;
|
|
1549
1512
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
var tickPositions = axis.tickPositions;
|
|
1575
|
-
var firstPos = tickPositions[0];
|
|
1576
|
-
var lastPos = tickPositions[tickPositions.length - 1];
|
|
1577
|
-
var linkedMin = axis.linkedParent && axis.linkedParent.min;
|
|
1578
|
-
var linkedMax = axis.linkedParent && axis.linkedParent.max;
|
|
1579
|
-
var min = linkedMin || axis.min;
|
|
1580
|
-
var max = linkedMax || axis.max;
|
|
1581
|
-
var tickInterval = axis.tickInterval;
|
|
1582
|
-
var endMoreThanMin = (firstPos < min &&
|
|
1583
|
-
firstPos + tickInterval > min);
|
|
1584
|
-
var startLessThanMax = (lastPos > max &&
|
|
1585
|
-
lastPos - tickInterval < max);
|
|
1586
|
-
if (gridOptions.enabled === true &&
|
|
1587
|
-
!categoryAxis &&
|
|
1588
|
-
(axis.horiz || axis.isLinked)) {
|
|
1589
|
-
if (endMoreThanMin && !options.startOnTick) {
|
|
1590
|
-
tickPositions[0] = min;
|
|
1591
|
-
}
|
|
1592
|
-
if (startLessThanMax && !options.endOnTick) {
|
|
1593
|
-
tickPositions[tickPositions.length - 1] = max;
|
|
1594
|
-
}
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* @private
|
|
1516
|
+
*/
|
|
1517
|
+
function onTickLabelFormat(ctx) {
|
|
1518
|
+
var axis = ctx.axis,
|
|
1519
|
+
value = ctx.value;
|
|
1520
|
+
if (axis.options.grid &&
|
|
1521
|
+
axis.options.grid.enabled) {
|
|
1522
|
+
var tickPos = axis.tickPositions;
|
|
1523
|
+
var series = (axis.linkedParent || axis).series[0];
|
|
1524
|
+
var isFirst = value === tickPos[0];
|
|
1525
|
+
var isLast = value === tickPos[tickPos.length - 1];
|
|
1526
|
+
var point = series && find(series.options.data,
|
|
1527
|
+
function (p) {
|
|
1528
|
+
return p[axis.isXAxis ? 'x' : 'y'] === value;
|
|
1529
|
+
});
|
|
1530
|
+
var pointCopy = void 0;
|
|
1531
|
+
if (point && series.is('gantt')) {
|
|
1532
|
+
// For the Gantt set point aliases to the pointCopy
|
|
1533
|
+
// to do not change the original point
|
|
1534
|
+
pointCopy = merge(point);
|
|
1535
|
+
H.seriesTypes.gantt.prototype.pointClass
|
|
1536
|
+
.setGanttPointAliases(pointCopy);
|
|
1595
1537
|
}
|
|
1538
|
+
// Make additional properties available for the
|
|
1539
|
+
// formatter
|
|
1540
|
+
ctx.isFirst = isFirst;
|
|
1541
|
+
ctx.isLast = isLast;
|
|
1542
|
+
ctx.point = pointCopy;
|
|
1596
1543
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Makes tick labels which are usually ignored in a linked axis
|
|
1547
|
+
* displayed if they are within range of linkedParent.min.
|
|
1548
|
+
* ```
|
|
1549
|
+
* _____________________________
|
|
1550
|
+
* | | | | |
|
|
1551
|
+
* Make this: | | 2 | 3 | 4 |
|
|
1552
|
+
* |___|_______|_______|_______|
|
|
1553
|
+
* ^
|
|
1554
|
+
* _____________________________
|
|
1555
|
+
* | | | | |
|
|
1556
|
+
* Into this: | 1 | 2 | 3 | 4 |
|
|
1557
|
+
* |___|_______|_______|_______|
|
|
1558
|
+
* ^
|
|
1559
|
+
* ```
|
|
1560
|
+
* @private
|
|
1561
|
+
* @todo Does this function do what the drawing says? Seems to affect
|
|
1562
|
+
* ticks and not the labels directly?
|
|
1563
|
+
*/
|
|
1564
|
+
function onTrimTicks() {
|
|
1565
|
+
var axis = this;
|
|
1566
|
+
var options = axis.options;
|
|
1567
|
+
var gridOptions = options.grid || {};
|
|
1568
|
+
var categoryAxis = axis.categories;
|
|
1569
|
+
var tickPositions = axis.tickPositions;
|
|
1570
|
+
var firstPos = tickPositions[0];
|
|
1571
|
+
var lastPos = tickPositions[tickPositions.length - 1];
|
|
1572
|
+
var linkedMin = axis.linkedParent && axis.linkedParent.min;
|
|
1573
|
+
var linkedMax = axis.linkedParent && axis.linkedParent.max;
|
|
1574
|
+
var min = linkedMin || axis.min;
|
|
1575
|
+
var max = linkedMax || axis.max;
|
|
1576
|
+
var tickInterval = axis.tickInterval;
|
|
1577
|
+
var endMoreThanMin = (firstPos < min &&
|
|
1578
|
+
firstPos + tickInterval > min);
|
|
1579
|
+
var startLessThanMax = (lastPos > max &&
|
|
1580
|
+
lastPos - tickInterval < max);
|
|
1581
|
+
if (gridOptions.enabled === true &&
|
|
1582
|
+
!categoryAxis &&
|
|
1583
|
+
(axis.horiz || axis.isLinked)) {
|
|
1584
|
+
if (endMoreThanMin && !options.startOnTick) {
|
|
1585
|
+
tickPositions[0] = min;
|
|
1607
1586
|
}
|
|
1608
|
-
|
|
1587
|
+
if (startLessThanMax && !options.endOnTick) {
|
|
1588
|
+
tickPositions[tickPositions.length - 1] = max;
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Avoid altering tickInterval when reserving space.
|
|
1594
|
+
* @private
|
|
1595
|
+
*/
|
|
1596
|
+
function wrapUnsquish(proceed) {
|
|
1597
|
+
var axis = this;
|
|
1598
|
+
var _a = axis.options.grid,
|
|
1599
|
+
gridOptions = _a === void 0 ? {} : _a;
|
|
1600
|
+
if (gridOptions.enabled === true && axis.categories) {
|
|
1601
|
+
return axis.tickInterval;
|
|
1602
|
+
}
|
|
1603
|
+
return proceed.apply(axis, argsToArray(arguments));
|
|
1604
|
+
}
|
|
1605
|
+
/* *
|
|
1606
|
+
*
|
|
1607
|
+
* Class
|
|
1608
|
+
*
|
|
1609
|
+
* */
|
|
1610
|
+
/**
|
|
1611
|
+
* Additions for grid axes.
|
|
1612
|
+
* @private
|
|
1613
|
+
* @class
|
|
1614
|
+
*/
|
|
1615
|
+
var GridAxisAdditions = /** @class */ (function () {
|
|
1616
|
+
/* *
|
|
1617
|
+
*
|
|
1618
|
+
* Constructors
|
|
1619
|
+
*
|
|
1620
|
+
* */
|
|
1621
|
+
function GridAxisAdditions(axis) {
|
|
1622
|
+
this.axis = axis;
|
|
1609
1623
|
}
|
|
1610
1624
|
/* *
|
|
1625
|
+
*
|
|
1626
|
+
* Functions
|
|
1627
|
+
*
|
|
1628
|
+
* */
|
|
1629
|
+
/**
|
|
1630
|
+
* Checks if an axis is the outer axis in its dimension. Since
|
|
1631
|
+
* axes are placed outwards in order, the axis with the highest
|
|
1632
|
+
* index is the outermost axis.
|
|
1611
1633
|
*
|
|
1612
|
-
*
|
|
1634
|
+
* Example: If there are multiple x-axes at the top of the chart,
|
|
1635
|
+
* this function returns true if the axis supplied is the last
|
|
1636
|
+
* of the x-axes.
|
|
1613
1637
|
*
|
|
1614
|
-
* */
|
|
1615
|
-
/**
|
|
1616
|
-
* Additions for grid axes.
|
|
1617
1638
|
* @private
|
|
1618
|
-
*
|
|
1639
|
+
*
|
|
1640
|
+
* @return {boolean}
|
|
1641
|
+
* True if the axis is the outermost axis in its dimension; false if
|
|
1642
|
+
* not.
|
|
1619
1643
|
*/
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
* axes are placed outwards in order, the axis with the highest
|
|
1637
|
-
* index is the outermost axis.
|
|
1638
|
-
*
|
|
1639
|
-
* Example: If there are multiple x-axes at the top of the chart,
|
|
1640
|
-
* this function returns true if the axis supplied is the last
|
|
1641
|
-
* of the x-axes.
|
|
1642
|
-
*
|
|
1643
|
-
* @private
|
|
1644
|
-
*
|
|
1645
|
-
* @return {boolean}
|
|
1646
|
-
* True if the axis is the outermost axis in its dimension; false if
|
|
1647
|
-
* not.
|
|
1648
|
-
*/
|
|
1649
|
-
Additions.prototype.isOuterAxis = function () {
|
|
1650
|
-
var axis = this.axis;
|
|
1651
|
-
var chart = axis.chart;
|
|
1652
|
-
var columnIndex = axis.grid.columnIndex;
|
|
1653
|
-
var columns = (axis.linkedParent && axis.linkedParent.grid.columns ||
|
|
1654
|
-
axis.grid.columns);
|
|
1655
|
-
var parentAxis = columnIndex ? axis.linkedParent : axis;
|
|
1656
|
-
var thisIndex = -1,
|
|
1657
|
-
lastIndex = 0;
|
|
1658
|
-
chart[axis.coll].forEach(function (otherAxis, index) {
|
|
1659
|
-
if (otherAxis.side === axis.side &&
|
|
1660
|
-
!otherAxis.options.isInternal) {
|
|
1661
|
-
lastIndex = index;
|
|
1662
|
-
if (otherAxis === parentAxis) {
|
|
1663
|
-
// Get the index of the axis in question
|
|
1664
|
-
thisIndex = index;
|
|
1665
|
-
}
|
|
1644
|
+
GridAxisAdditions.prototype.isOuterAxis = function () {
|
|
1645
|
+
var axis = this.axis;
|
|
1646
|
+
var chart = axis.chart;
|
|
1647
|
+
var columnIndex = axis.grid.columnIndex;
|
|
1648
|
+
var columns = (axis.linkedParent && axis.linkedParent.grid.columns ||
|
|
1649
|
+
axis.grid.columns);
|
|
1650
|
+
var parentAxis = columnIndex ? axis.linkedParent : axis;
|
|
1651
|
+
var thisIndex = -1,
|
|
1652
|
+
lastIndex = 0;
|
|
1653
|
+
(chart[axis.coll] || []).forEach(function (otherAxis, index) {
|
|
1654
|
+
if (otherAxis.side === axis.side &&
|
|
1655
|
+
!otherAxis.options.isInternal) {
|
|
1656
|
+
lastIndex = index;
|
|
1657
|
+
if (otherAxis === parentAxis) {
|
|
1658
|
+
// Get the index of the axis in question
|
|
1659
|
+
thisIndex = index;
|
|
1666
1660
|
}
|
|
1667
|
-
});
|
|
1668
|
-
return (lastIndex === thisIndex &&
|
|
1669
|
-
(isNumber(columnIndex) ?
|
|
1670
|
-
columns.length === columnIndex :
|
|
1671
|
-
true));
|
|
1672
|
-
};
|
|
1673
|
-
/**
|
|
1674
|
-
* Add extra border based on the provided path.
|
|
1675
|
-
* @private
|
|
1676
|
-
* @param {SVGPath} path
|
|
1677
|
-
* The path of the border.
|
|
1678
|
-
* @return {Highcharts.SVGElement}
|
|
1679
|
-
* Border
|
|
1680
|
-
*/
|
|
1681
|
-
Additions.prototype.renderBorder = function (path) {
|
|
1682
|
-
var axis = this.axis,
|
|
1683
|
-
renderer = axis.chart.renderer,
|
|
1684
|
-
options = axis.options,
|
|
1685
|
-
extraBorderLine = renderer.path(path)
|
|
1686
|
-
.addClass('highcharts-axis-line')
|
|
1687
|
-
.add(axis.axisBorder);
|
|
1688
|
-
if (!renderer.styledMode) {
|
|
1689
|
-
extraBorderLine.attr({
|
|
1690
|
-
stroke: options.lineColor,
|
|
1691
|
-
'stroke-width': options.lineWidth,
|
|
1692
|
-
zIndex: 7
|
|
1693
|
-
});
|
|
1694
1661
|
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1662
|
+
});
|
|
1663
|
+
return (lastIndex === thisIndex &&
|
|
1664
|
+
(isNumber(columnIndex) ?
|
|
1665
|
+
columns.length === columnIndex :
|
|
1666
|
+
true));
|
|
1667
|
+
};
|
|
1668
|
+
/**
|
|
1669
|
+
* Add extra border based on the provided path.
|
|
1670
|
+
* @private
|
|
1671
|
+
* @param {SVGPath} path
|
|
1672
|
+
* The path of the border.
|
|
1673
|
+
* @return {Highcharts.SVGElement}
|
|
1674
|
+
* Border
|
|
1675
|
+
*/
|
|
1676
|
+
GridAxisAdditions.prototype.renderBorder = function (path) {
|
|
1677
|
+
var axis = this.axis,
|
|
1678
|
+
renderer = axis.chart.renderer,
|
|
1679
|
+
options = axis.options,
|
|
1680
|
+
extraBorderLine = renderer.path(path)
|
|
1681
|
+
.addClass('highcharts-axis-line')
|
|
1682
|
+
.add(axis.axisBorder);
|
|
1683
|
+
if (!renderer.styledMode) {
|
|
1684
|
+
extraBorderLine.attr({
|
|
1685
|
+
stroke: options.lineColor,
|
|
1686
|
+
'stroke-width': options.lineWidth,
|
|
1687
|
+
zIndex: 7
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
return extraBorderLine;
|
|
1691
|
+
};
|
|
1692
|
+
return GridAxisAdditions;
|
|
1693
|
+
}());
|
|
1701
1694
|
/* *
|
|
1702
1695
|
*
|
|
1703
1696
|
* Registry
|
|
@@ -1709,7 +1702,10 @@
|
|
|
1709
1702
|
};
|
|
1710
1703
|
// Adds week date format
|
|
1711
1704
|
dateFormats.W = function (timestamp) {
|
|
1712
|
-
var d = new this.Date(timestamp);
|
|
1705
|
+
var time = this, d = new this.Date(timestamp), unitsToOmit = ['Hours', 'Milliseconds', 'Minutes', 'Seconds'];
|
|
1706
|
+
unitsToOmit.forEach(function (format) {
|
|
1707
|
+
time.set(format, d, 0);
|
|
1708
|
+
});
|
|
1713
1709
|
var firstDay = (this.get('Day',
|
|
1714
1710
|
d) + 6) % 7;
|
|
1715
1711
|
var thursday = new this.Date(d.valueOf());
|
|
@@ -1728,6 +1724,9 @@
|
|
|
1728
1724
|
* Default Export
|
|
1729
1725
|
*
|
|
1730
1726
|
* */
|
|
1727
|
+
var GridAxis = {
|
|
1728
|
+
compose: compose
|
|
1729
|
+
};
|
|
1731
1730
|
/* *
|
|
1732
1731
|
*
|
|
1733
1732
|
* API Options
|
|
@@ -1941,7 +1940,7 @@
|
|
|
1941
1940
|
|
|
1942
1941
|
return Tree;
|
|
1943
1942
|
});
|
|
1944
|
-
_registerModule(_modules, 'Core/Axis/TreeGridTick.js', [_modules['Core/Utilities.js']], function (U) {
|
|
1943
|
+
_registerModule(_modules, 'Core/Axis/TreeGrid/TreeGridTick.js', [_modules['Core/Utilities.js']], function (U) {
|
|
1945
1944
|
/* *
|
|
1946
1945
|
*
|
|
1947
1946
|
* (c) 2016 Highsoft AS
|
|
@@ -1957,34 +1956,237 @@
|
|
|
1957
1956
|
isNumber = U.isNumber,
|
|
1958
1957
|
pick = U.pick,
|
|
1959
1958
|
wrap = U.wrap;
|
|
1960
|
-
/*
|
|
1959
|
+
/* *
|
|
1960
|
+
*
|
|
1961
|
+
* Constants
|
|
1962
|
+
*
|
|
1963
|
+
* */
|
|
1964
|
+
var composedClasses = [];
|
|
1965
|
+
/* *
|
|
1966
|
+
*
|
|
1967
|
+
* Functions
|
|
1968
|
+
*
|
|
1969
|
+
* */
|
|
1961
1970
|
/**
|
|
1962
1971
|
* @private
|
|
1963
1972
|
*/
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1973
|
+
function onTickInit() {
|
|
1974
|
+
var tick = this;
|
|
1975
|
+
if (!tick.treeGrid) {
|
|
1976
|
+
tick.treeGrid = new TreeGridTickAdditions(tick);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* @private
|
|
1981
|
+
*/
|
|
1982
|
+
function onTickHover(label) {
|
|
1983
|
+
label.addClass('highcharts-treegrid-node-active');
|
|
1984
|
+
if (!label.renderer.styledMode) {
|
|
1985
|
+
label.css({
|
|
1986
|
+
textDecoration: 'underline'
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* @private
|
|
1992
|
+
*/
|
|
1993
|
+
function onTickHoverExit(label, options) {
|
|
1994
|
+
var css = isObject(options.style) ? options.style : {};
|
|
1995
|
+
label.removeClass('highcharts-treegrid-node-active');
|
|
1996
|
+
if (!label.renderer.styledMode) {
|
|
1997
|
+
label.css({ textDecoration: css.textDecoration });
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
/**
|
|
2001
|
+
* @private
|
|
2002
|
+
*/
|
|
2003
|
+
function renderLabelIcon(tick, params) {
|
|
2004
|
+
var treeGrid = tick.treeGrid,
|
|
2005
|
+
isNew = !treeGrid.labelIcon,
|
|
2006
|
+
renderer = params.renderer,
|
|
2007
|
+
labelBox = params.xy,
|
|
2008
|
+
options = params.options,
|
|
2009
|
+
width = options.width || 0,
|
|
2010
|
+
height = options.height || 0,
|
|
2011
|
+
iconCenter = {
|
|
2012
|
+
x: labelBox.x - (width / 2) - (options.padding || 0),
|
|
2013
|
+
y: labelBox.y - (height / 2)
|
|
2014
|
+
},
|
|
2015
|
+
rotation = params.collapsed ? 90 : 180,
|
|
2016
|
+
shouldRender = params.show && isNumber(iconCenter.y);
|
|
2017
|
+
var icon = treeGrid.labelIcon;
|
|
2018
|
+
if (!icon) {
|
|
2019
|
+
treeGrid.labelIcon = icon = renderer
|
|
2020
|
+
.path(renderer.symbols[options.type](options.x || 0, options.y || 0, width, height))
|
|
2021
|
+
.addClass('highcharts-label-icon')
|
|
2022
|
+
.add(params.group);
|
|
2023
|
+
}
|
|
2024
|
+
// Set the new position, and show or hide
|
|
2025
|
+
icon[shouldRender ? 'show' : 'hide'](); // #14904, #1338
|
|
2026
|
+
// Presentational attributes
|
|
2027
|
+
if (!renderer.styledMode) {
|
|
2028
|
+
icon
|
|
2029
|
+
.attr({
|
|
2030
|
+
cursor: 'pointer',
|
|
2031
|
+
'fill': pick(params.color, "#666666" /* Palette.neutralColor60 */),
|
|
2032
|
+
'stroke-width': 1,
|
|
2033
|
+
stroke: options.lineColor,
|
|
2034
|
+
strokeWidth: options.lineWidth || 0
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
// Update the icon positions
|
|
2038
|
+
icon[isNew ? 'attr' : 'animate']({
|
|
2039
|
+
translateX: iconCenter.x,
|
|
2040
|
+
translateY: iconCenter.y,
|
|
2041
|
+
rotation: rotation
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
/**
|
|
2045
|
+
* @private
|
|
2046
|
+
*/
|
|
2047
|
+
function wrapGetLabelPosition(proceed, x, y, label, horiz, labelOptions, tickmarkOffset, index, step) {
|
|
2048
|
+
var tick = this,
|
|
2049
|
+
lbOptions = pick(tick.options && tick.options.labels,
|
|
2050
|
+
labelOptions),
|
|
2051
|
+
pos = tick.pos,
|
|
2052
|
+
axis = tick.axis,
|
|
2053
|
+
options = axis.options,
|
|
2054
|
+
isTreeGrid = options.type === 'treegrid',
|
|
2055
|
+
result = proceed.apply(tick,
|
|
2056
|
+
[x,
|
|
2057
|
+
y,
|
|
2058
|
+
label,
|
|
2059
|
+
horiz,
|
|
2060
|
+
lbOptions,
|
|
2061
|
+
tickmarkOffset,
|
|
2062
|
+
index,
|
|
2063
|
+
step]);
|
|
2064
|
+
var symbolOptions,
|
|
2065
|
+
indentation,
|
|
2066
|
+
mapOfPosToGridNode,
|
|
2067
|
+
node,
|
|
2068
|
+
level;
|
|
2069
|
+
if (isTreeGrid) {
|
|
2070
|
+
symbolOptions = (lbOptions && isObject(lbOptions.symbol, true) ?
|
|
2071
|
+
lbOptions.symbol :
|
|
2072
|
+
{});
|
|
2073
|
+
indentation = (lbOptions && isNumber(lbOptions.indentation) ?
|
|
2074
|
+
lbOptions.indentation :
|
|
2075
|
+
0);
|
|
2076
|
+
mapOfPosToGridNode = axis.treeGrid.mapOfPosToGridNode;
|
|
2077
|
+
node = mapOfPosToGridNode && mapOfPosToGridNode[pos];
|
|
2078
|
+
level = (node && node.depth) || 1;
|
|
2079
|
+
result.x += (
|
|
2080
|
+
// Add space for symbols
|
|
2081
|
+
((symbolOptions.width || 0) +
|
|
2082
|
+
((symbolOptions.padding || 0) * 2)) +
|
|
2083
|
+
// Apply indentation
|
|
2084
|
+
((level - 1) * indentation));
|
|
2085
|
+
}
|
|
2086
|
+
return result;
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* @private
|
|
2090
|
+
*/
|
|
2091
|
+
function wrapRenderLabel(proceed) {
|
|
2092
|
+
var tick = this, pos = tick.pos, axis = tick.axis, label = tick.label, mapOfPosToGridNode = axis.treeGrid.mapOfPosToGridNode, options = axis.options, labelOptions = pick(tick.options && tick.options.labels, options && options.labels), symbolOptions = (labelOptions && isObject(labelOptions.symbol, true) ?
|
|
2093
|
+
labelOptions.symbol :
|
|
2094
|
+
{}), node = mapOfPosToGridNode && mapOfPosToGridNode[pos], level = node && node.depth, isTreeGrid = options.type === 'treegrid', shouldRender = axis.tickPositions.indexOf(pos) > -1, prefixClassName = 'highcharts-treegrid-node-', styledMode = axis.chart.styledMode;
|
|
2095
|
+
var collapsed,
|
|
2096
|
+
addClassName,
|
|
2097
|
+
removeClassName;
|
|
2098
|
+
if (isTreeGrid && node) {
|
|
2099
|
+
// Add class name for hierarchical styling.
|
|
2100
|
+
if (label &&
|
|
2101
|
+
label.element) {
|
|
2102
|
+
label.addClass(prefixClassName + 'level-' + level);
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
proceed.apply(tick, Array.prototype.slice.call(arguments, 1));
|
|
2106
|
+
if (isTreeGrid &&
|
|
2107
|
+
label &&
|
|
2108
|
+
label.element &&
|
|
2109
|
+
node &&
|
|
2110
|
+
node.descendants &&
|
|
2111
|
+
node.descendants > 0) {
|
|
2112
|
+
collapsed = axis.treeGrid.isCollapsed(node);
|
|
2113
|
+
renderLabelIcon(tick, {
|
|
2114
|
+
color: (!styledMode &&
|
|
2115
|
+
label.styles &&
|
|
2116
|
+
label.styles.color ||
|
|
2117
|
+
''),
|
|
2118
|
+
collapsed: collapsed,
|
|
2119
|
+
group: label.parentGroup,
|
|
2120
|
+
options: symbolOptions,
|
|
2121
|
+
renderer: label.renderer,
|
|
2122
|
+
show: shouldRender,
|
|
2123
|
+
xy: label.xy
|
|
2124
|
+
});
|
|
2125
|
+
// Add class name for the node.
|
|
2126
|
+
addClassName = prefixClassName +
|
|
2127
|
+
(collapsed ? 'collapsed' : 'expanded');
|
|
2128
|
+
removeClassName = prefixClassName +
|
|
2129
|
+
(collapsed ? 'expanded' : 'collapsed');
|
|
2130
|
+
label
|
|
2131
|
+
.addClass(addClassName)
|
|
2132
|
+
.removeClass(removeClassName);
|
|
2133
|
+
if (!styledMode) {
|
|
2134
|
+
label.css({
|
|
2135
|
+
cursor: 'pointer'
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
// Add events to both label text and icon
|
|
2139
|
+
[label, tick.treeGrid.labelIcon].forEach(function (object) {
|
|
2140
|
+
if (object && !object.attachedTreeGridEvents) {
|
|
2141
|
+
// On hover
|
|
2142
|
+
addEvent(object.element, 'mouseover', function () {
|
|
2143
|
+
onTickHover(label);
|
|
2144
|
+
});
|
|
2145
|
+
// On hover out
|
|
2146
|
+
addEvent(object.element, 'mouseout', function () {
|
|
2147
|
+
onTickHoverExit(label, labelOptions);
|
|
2148
|
+
});
|
|
2149
|
+
addEvent(object.element, 'click', function () {
|
|
2150
|
+
tick.treeGrid.toggleCollapse();
|
|
2151
|
+
});
|
|
2152
|
+
object.attachedTreeGridEvents = true;
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
/* *
|
|
2158
|
+
*
|
|
2159
|
+
* Classes
|
|
2160
|
+
*
|
|
2161
|
+
* */
|
|
2162
|
+
/**
|
|
2163
|
+
* @private
|
|
2164
|
+
* @class
|
|
2165
|
+
*/
|
|
2166
|
+
var TreeGridTickAdditions = /** @class */ (function () {
|
|
2167
|
+
/* *
|
|
2168
|
+
*
|
|
2169
|
+
* Constructors
|
|
2170
|
+
*
|
|
2171
|
+
* */
|
|
2172
|
+
/**
|
|
2173
|
+
* @private
|
|
2174
|
+
*/
|
|
2175
|
+
function TreeGridTickAdditions(tick) {
|
|
2176
|
+
this.tick = tick;
|
|
2177
|
+
}
|
|
1977
2178
|
/* *
|
|
1978
2179
|
*
|
|
1979
|
-
* Functions
|
|
2180
|
+
* Static Functions
|
|
1980
2181
|
*
|
|
1981
2182
|
* */
|
|
1982
2183
|
/**
|
|
1983
2184
|
* @private
|
|
1984
2185
|
*/
|
|
1985
|
-
function
|
|
1986
|
-
if (
|
|
1987
|
-
|
|
2186
|
+
TreeGridTickAdditions.compose = function (TickClass) {
|
|
2187
|
+
if (composedClasses.indexOf(TickClass) === -1) {
|
|
2188
|
+
composedClasses.push(TickClass);
|
|
2189
|
+
addEvent(TickClass, 'init', onTickInit);
|
|
1988
2190
|
wrap(TickClass.prototype, 'getLabelPosition', wrapGetLabelPosition);
|
|
1989
2191
|
wrap(TickClass.prototype, 'renderLabel', wrapRenderLabel);
|
|
1990
2192
|
// backwards compatibility
|
|
@@ -1997,313 +2199,106 @@
|
|
|
1997
2199
|
TickClass.prototype.toggleCollapse = function (redraw) {
|
|
1998
2200
|
this.treeGrid.toggleCollapse(redraw);
|
|
1999
2201
|
};
|
|
2000
|
-
applied = true;
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
TreeGridTick.compose = compose;
|
|
2004
|
-
/**
|
|
2005
|
-
* @private
|
|
2006
|
-
*/
|
|
2007
|
-
function onInit() {
|
|
2008
|
-
var tick = this;
|
|
2009
|
-
if (!tick.treeGrid) {
|
|
2010
|
-
tick.treeGrid = new Additions(tick);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
/**
|
|
2014
|
-
* @private
|
|
2015
|
-
*/
|
|
2016
|
-
function onTickHover(label) {
|
|
2017
|
-
label.addClass('highcharts-treegrid-node-active');
|
|
2018
|
-
if (!label.renderer.styledMode) {
|
|
2019
|
-
label.css({
|
|
2020
|
-
textDecoration: 'underline'
|
|
2021
|
-
});
|
|
2022
2202
|
}
|
|
2023
|
-
}
|
|
2203
|
+
};
|
|
2204
|
+
/* *
|
|
2205
|
+
*
|
|
2206
|
+
* Functions
|
|
2207
|
+
*
|
|
2208
|
+
* */
|
|
2024
2209
|
/**
|
|
2210
|
+
* Collapse the grid cell. Used when axis is of type treegrid.
|
|
2211
|
+
*
|
|
2212
|
+
* @see gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2213
|
+
*
|
|
2025
2214
|
* @private
|
|
2215
|
+
* @function Highcharts.Tick#collapse
|
|
2216
|
+
*
|
|
2217
|
+
* @param {boolean} [redraw=true]
|
|
2218
|
+
* Whether to redraw the chart or wait for an explicit call to
|
|
2219
|
+
* {@link Highcharts.Chart#redraw}
|
|
2026
2220
|
*/
|
|
2027
|
-
function
|
|
2028
|
-
var
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2221
|
+
TreeGridTickAdditions.prototype.collapse = function (redraw) {
|
|
2222
|
+
var tick = this.tick,
|
|
2223
|
+
axis = tick.axis,
|
|
2224
|
+
brokenAxis = axis.brokenAxis;
|
|
2225
|
+
if (brokenAxis &&
|
|
2226
|
+
axis.treeGrid.mapOfPosToGridNode) {
|
|
2227
|
+
var pos = tick.pos,
|
|
2228
|
+
node = axis.treeGrid.mapOfPosToGridNode[pos],
|
|
2229
|
+
breaks = axis.treeGrid.collapse(node);
|
|
2230
|
+
brokenAxis.setBreaks(breaks, pick(redraw, true));
|
|
2032
2231
|
}
|
|
2033
|
-
}
|
|
2232
|
+
};
|
|
2034
2233
|
/**
|
|
2234
|
+
* Destroy remaining labelIcon if exist.
|
|
2235
|
+
*
|
|
2035
2236
|
* @private
|
|
2237
|
+
* @function Highcharts.Tick#destroy
|
|
2036
2238
|
*/
|
|
2037
|
-
function
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
renderer = params.renderer,
|
|
2041
|
-
labelBox = params.xy,
|
|
2042
|
-
options = params.options,
|
|
2043
|
-
width = options.width || 0,
|
|
2044
|
-
height = options.height || 0,
|
|
2045
|
-
iconCenter = {
|
|
2046
|
-
x: labelBox.x - (width / 2) - (options.padding || 0),
|
|
2047
|
-
y: labelBox.y - (height / 2)
|
|
2048
|
-
},
|
|
2049
|
-
rotation = params.collapsed ? 90 : 180,
|
|
2050
|
-
shouldRender = params.show && isNumber(iconCenter.y);
|
|
2051
|
-
var icon = treeGrid.labelIcon;
|
|
2052
|
-
if (!icon) {
|
|
2053
|
-
treeGrid.labelIcon = icon = renderer
|
|
2054
|
-
.path(renderer.symbols[options.type](options.x || 0, options.y || 0, width, height))
|
|
2055
|
-
.addClass('highcharts-label-icon')
|
|
2056
|
-
.add(params.group);
|
|
2057
|
-
}
|
|
2058
|
-
// Set the new position, and show or hide
|
|
2059
|
-
icon.attr({ y: shouldRender ? 0 : -9999 }); // #14904, #1338
|
|
2060
|
-
// Presentational attributes
|
|
2061
|
-
if (!renderer.styledMode) {
|
|
2062
|
-
icon
|
|
2063
|
-
.attr({
|
|
2064
|
-
cursor: 'pointer',
|
|
2065
|
-
'fill': pick(params.color, "#666666" /* neutralColor60 */),
|
|
2066
|
-
'stroke-width': 1,
|
|
2067
|
-
stroke: options.lineColor,
|
|
2068
|
-
strokeWidth: options.lineWidth || 0
|
|
2069
|
-
});
|
|
2239
|
+
TreeGridTickAdditions.prototype.destroy = function () {
|
|
2240
|
+
if (this.labelIcon) {
|
|
2241
|
+
this.labelIcon.destroy();
|
|
2070
2242
|
}
|
|
2071
|
-
|
|
2072
|
-
icon[isNew ? 'attr' : 'animate']({
|
|
2073
|
-
translateX: iconCenter.x,
|
|
2074
|
-
translateY: iconCenter.y,
|
|
2075
|
-
rotation: rotation
|
|
2076
|
-
});
|
|
2077
|
-
}
|
|
2243
|
+
};
|
|
2078
2244
|
/**
|
|
2245
|
+
* Expand the grid cell. Used when axis is of type treegrid.
|
|
2246
|
+
*
|
|
2247
|
+
* @see gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2248
|
+
*
|
|
2079
2249
|
* @private
|
|
2250
|
+
* @function Highcharts.Tick#expand
|
|
2251
|
+
*
|
|
2252
|
+
* @param {boolean} [redraw=true]
|
|
2253
|
+
* Whether to redraw the chart or wait for an explicit call to
|
|
2254
|
+
* {@link Highcharts.Chart#redraw}
|
|
2080
2255
|
*/
|
|
2081
|
-
function
|
|
2082
|
-
var tick = this,
|
|
2083
|
-
lbOptions = pick(tick.options && tick.options.labels,
|
|
2084
|
-
labelOptions),
|
|
2085
|
-
pos = tick.pos,
|
|
2256
|
+
TreeGridTickAdditions.prototype.expand = function (redraw) {
|
|
2257
|
+
var tick = this.tick,
|
|
2086
2258
|
axis = tick.axis,
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
lbOptions,
|
|
2095
|
-
tickmarkOffset,
|
|
2096
|
-
index,
|
|
2097
|
-
step]);
|
|
2098
|
-
var symbolOptions,
|
|
2099
|
-
indentation,
|
|
2100
|
-
mapOfPosToGridNode,
|
|
2101
|
-
node,
|
|
2102
|
-
level;
|
|
2103
|
-
if (isTreeGrid) {
|
|
2104
|
-
symbolOptions = (lbOptions && isObject(lbOptions.symbol, true) ?
|
|
2105
|
-
lbOptions.symbol :
|
|
2106
|
-
{});
|
|
2107
|
-
indentation = (lbOptions && isNumber(lbOptions.indentation) ?
|
|
2108
|
-
lbOptions.indentation :
|
|
2109
|
-
0);
|
|
2110
|
-
mapOfPosToGridNode = axis.treeGrid.mapOfPosToGridNode;
|
|
2111
|
-
node = mapOfPosToGridNode && mapOfPosToGridNode[pos];
|
|
2112
|
-
level = (node && node.depth) || 1;
|
|
2113
|
-
result.x += (
|
|
2114
|
-
// Add space for symbols
|
|
2115
|
-
((symbolOptions.width || 0) +
|
|
2116
|
-
((symbolOptions.padding || 0) * 2)) +
|
|
2117
|
-
// Apply indentation
|
|
2118
|
-
((level - 1) * indentation));
|
|
2259
|
+
brokenAxis = axis.brokenAxis;
|
|
2260
|
+
if (brokenAxis &&
|
|
2261
|
+
axis.treeGrid.mapOfPosToGridNode) {
|
|
2262
|
+
var pos = tick.pos,
|
|
2263
|
+
node = axis.treeGrid.mapOfPosToGridNode[pos],
|
|
2264
|
+
breaks = axis.treeGrid.expand(node);
|
|
2265
|
+
brokenAxis.setBreaks(breaks, pick(redraw, true));
|
|
2119
2266
|
}
|
|
2120
|
-
|
|
2121
|
-
}
|
|
2267
|
+
};
|
|
2122
2268
|
/**
|
|
2123
|
-
*
|
|
2124
|
-
|
|
2125
|
-
function wrapRenderLabel(proceed) {
|
|
2126
|
-
var tick = this, pos = tick.pos, axis = tick.axis, label = tick.label, mapOfPosToGridNode = axis.treeGrid.mapOfPosToGridNode, options = axis.options, labelOptions = pick(tick.options && tick.options.labels, options && options.labels), symbolOptions = (labelOptions && isObject(labelOptions.symbol, true) ?
|
|
2127
|
-
labelOptions.symbol :
|
|
2128
|
-
{}), node = mapOfPosToGridNode && mapOfPosToGridNode[pos], level = node && node.depth, isTreeGrid = options.type === 'treegrid', shouldRender = axis.tickPositions.indexOf(pos) > -1, prefixClassName = 'highcharts-treegrid-node-', styledMode = axis.chart.styledMode;
|
|
2129
|
-
var collapsed,
|
|
2130
|
-
addClassName,
|
|
2131
|
-
removeClassName;
|
|
2132
|
-
if (isTreeGrid && node) {
|
|
2133
|
-
// Add class name for hierarchical styling.
|
|
2134
|
-
if (label &&
|
|
2135
|
-
label.element) {
|
|
2136
|
-
label.addClass(prefixClassName + 'level-' + level);
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
proceed.apply(tick, Array.prototype.slice.call(arguments, 1));
|
|
2140
|
-
if (isTreeGrid &&
|
|
2141
|
-
label &&
|
|
2142
|
-
label.element &&
|
|
2143
|
-
node &&
|
|
2144
|
-
node.descendants &&
|
|
2145
|
-
node.descendants > 0) {
|
|
2146
|
-
collapsed = axis.treeGrid.isCollapsed(node);
|
|
2147
|
-
renderLabelIcon(tick, {
|
|
2148
|
-
color: (!styledMode &&
|
|
2149
|
-
label.styles &&
|
|
2150
|
-
label.styles.color ||
|
|
2151
|
-
''),
|
|
2152
|
-
collapsed: collapsed,
|
|
2153
|
-
group: label.parentGroup,
|
|
2154
|
-
options: symbolOptions,
|
|
2155
|
-
renderer: label.renderer,
|
|
2156
|
-
show: shouldRender,
|
|
2157
|
-
xy: label.xy
|
|
2158
|
-
});
|
|
2159
|
-
// Add class name for the node.
|
|
2160
|
-
addClassName = prefixClassName +
|
|
2161
|
-
(collapsed ? 'collapsed' : 'expanded');
|
|
2162
|
-
removeClassName = prefixClassName +
|
|
2163
|
-
(collapsed ? 'expanded' : 'collapsed');
|
|
2164
|
-
label
|
|
2165
|
-
.addClass(addClassName)
|
|
2166
|
-
.removeClass(removeClassName);
|
|
2167
|
-
if (!styledMode) {
|
|
2168
|
-
label.css({
|
|
2169
|
-
cursor: 'pointer'
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
// Add events to both label text and icon
|
|
2173
|
-
[label, tick.treeGrid.labelIcon].forEach(function (object) {
|
|
2174
|
-
if (object && !object.attachedTreeGridEvents) {
|
|
2175
|
-
// On hover
|
|
2176
|
-
addEvent(object.element, 'mouseover', function () {
|
|
2177
|
-
onTickHover(label);
|
|
2178
|
-
});
|
|
2179
|
-
// On hover out
|
|
2180
|
-
addEvent(object.element, 'mouseout', function () {
|
|
2181
|
-
onTickHoverExit(label, labelOptions);
|
|
2182
|
-
});
|
|
2183
|
-
addEvent(object.element, 'click', function () {
|
|
2184
|
-
tick.treeGrid.toggleCollapse();
|
|
2185
|
-
});
|
|
2186
|
-
object.attachedTreeGridEvents = true;
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
/* *
|
|
2269
|
+
* Toggle the collapse/expand state of the grid cell. Used when axis is
|
|
2270
|
+
* of type treegrid.
|
|
2192
2271
|
*
|
|
2193
|
-
*
|
|
2272
|
+
* @see gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2194
2273
|
*
|
|
2195
|
-
* */
|
|
2196
|
-
/**
|
|
2197
2274
|
* @private
|
|
2198
|
-
* @
|
|
2275
|
+
* @function Highcharts.Tick#toggleCollapse
|
|
2276
|
+
*
|
|
2277
|
+
* @param {boolean} [redraw=true]
|
|
2278
|
+
* Whether to redraw the chart or wait for an explicit call to
|
|
2279
|
+
* {@link Highcharts.Chart#redraw}
|
|
2199
2280
|
*/
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
this.tick = tick;
|
|
2281
|
+
TreeGridTickAdditions.prototype.toggleCollapse = function (redraw) {
|
|
2282
|
+
var tick = this.tick,
|
|
2283
|
+
axis = tick.axis,
|
|
2284
|
+
brokenAxis = axis.brokenAxis;
|
|
2285
|
+
if (brokenAxis &&
|
|
2286
|
+
axis.treeGrid.mapOfPosToGridNode) {
|
|
2287
|
+
var pos = tick.pos,
|
|
2288
|
+
node = axis.treeGrid.mapOfPosToGridNode[pos],
|
|
2289
|
+
breaks = axis.treeGrid.toggleCollapse(node);
|
|
2290
|
+
brokenAxis.setBreaks(breaks, pick(redraw, true));
|
|
2211
2291
|
}
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
* @see gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2221
|
-
*
|
|
2222
|
-
* @private
|
|
2223
|
-
* @function Highcharts.Tick#collapse
|
|
2224
|
-
*
|
|
2225
|
-
* @param {boolean} [redraw=true]
|
|
2226
|
-
* Whether to redraw the chart or wait for an explicit call to
|
|
2227
|
-
* {@link Highcharts.Chart#redraw}
|
|
2228
|
-
*/
|
|
2229
|
-
Additions.prototype.collapse = function (redraw) {
|
|
2230
|
-
var tick = this.tick,
|
|
2231
|
-
axis = tick.axis,
|
|
2232
|
-
brokenAxis = axis.brokenAxis;
|
|
2233
|
-
if (brokenAxis &&
|
|
2234
|
-
axis.treeGrid.mapOfPosToGridNode) {
|
|
2235
|
-
var pos = tick.pos,
|
|
2236
|
-
node = axis.treeGrid.mapOfPosToGridNode[pos],
|
|
2237
|
-
breaks = axis.treeGrid.collapse(node);
|
|
2238
|
-
brokenAxis.setBreaks(breaks, pick(redraw, true));
|
|
2239
|
-
}
|
|
2240
|
-
};
|
|
2241
|
-
/**
|
|
2242
|
-
* Destroy remaining labelIcon if exist.
|
|
2243
|
-
*
|
|
2244
|
-
* @private
|
|
2245
|
-
* @function Highcharts.Tick#destroy
|
|
2246
|
-
*/
|
|
2247
|
-
Additions.prototype.destroy = function () {
|
|
2248
|
-
if (this.labelIcon) {
|
|
2249
|
-
this.labelIcon.destroy();
|
|
2250
|
-
}
|
|
2251
|
-
};
|
|
2252
|
-
/**
|
|
2253
|
-
* Expand the grid cell. Used when axis is of type treegrid.
|
|
2254
|
-
*
|
|
2255
|
-
* @see gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2256
|
-
*
|
|
2257
|
-
* @private
|
|
2258
|
-
* @function Highcharts.Tick#expand
|
|
2259
|
-
*
|
|
2260
|
-
* @param {boolean} [redraw=true]
|
|
2261
|
-
* Whether to redraw the chart or wait for an explicit call to
|
|
2262
|
-
* {@link Highcharts.Chart#redraw}
|
|
2263
|
-
*/
|
|
2264
|
-
Additions.prototype.expand = function (redraw) {
|
|
2265
|
-
var tick = this.tick,
|
|
2266
|
-
axis = tick.axis,
|
|
2267
|
-
brokenAxis = axis.brokenAxis;
|
|
2268
|
-
if (brokenAxis &&
|
|
2269
|
-
axis.treeGrid.mapOfPosToGridNode) {
|
|
2270
|
-
var pos = tick.pos,
|
|
2271
|
-
node = axis.treeGrid.mapOfPosToGridNode[pos],
|
|
2272
|
-
breaks = axis.treeGrid.expand(node);
|
|
2273
|
-
brokenAxis.setBreaks(breaks, pick(redraw, true));
|
|
2274
|
-
}
|
|
2275
|
-
};
|
|
2276
|
-
/**
|
|
2277
|
-
* Toggle the collapse/expand state of the grid cell. Used when axis is
|
|
2278
|
-
* of type treegrid.
|
|
2279
|
-
*
|
|
2280
|
-
* @see gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2281
|
-
*
|
|
2282
|
-
* @private
|
|
2283
|
-
* @function Highcharts.Tick#toggleCollapse
|
|
2284
|
-
*
|
|
2285
|
-
* @param {boolean} [redraw=true]
|
|
2286
|
-
* Whether to redraw the chart or wait for an explicit call to
|
|
2287
|
-
* {@link Highcharts.Chart#redraw}
|
|
2288
|
-
*/
|
|
2289
|
-
Additions.prototype.toggleCollapse = function (redraw) {
|
|
2290
|
-
var tick = this.tick,
|
|
2291
|
-
axis = tick.axis,
|
|
2292
|
-
brokenAxis = axis.brokenAxis;
|
|
2293
|
-
if (brokenAxis &&
|
|
2294
|
-
axis.treeGrid.mapOfPosToGridNode) {
|
|
2295
|
-
var pos = tick.pos,
|
|
2296
|
-
node = axis.treeGrid.mapOfPosToGridNode[pos],
|
|
2297
|
-
breaks = axis.treeGrid.toggleCollapse(node);
|
|
2298
|
-
brokenAxis.setBreaks(breaks, pick(redraw, true));
|
|
2299
|
-
}
|
|
2300
|
-
};
|
|
2301
|
-
return Additions;
|
|
2302
|
-
}());
|
|
2303
|
-
TreeGridTick.Additions = Additions;
|
|
2304
|
-
})(TreeGridTick || (TreeGridTick = {}));
|
|
2292
|
+
};
|
|
2293
|
+
return TreeGridTickAdditions;
|
|
2294
|
+
}());
|
|
2295
|
+
/* *
|
|
2296
|
+
*
|
|
2297
|
+
* Default Export
|
|
2298
|
+
*
|
|
2299
|
+
* */
|
|
2305
2300
|
|
|
2306
|
-
return
|
|
2301
|
+
return TreeGridTickAdditions;
|
|
2307
2302
|
});
|
|
2308
2303
|
_registerModule(_modules, 'Series/TreeUtilities.js', [_modules['Core/Color/Color.js'], _modules['Core/Utilities.js']], function (Color, U) {
|
|
2309
2304
|
/* *
|
|
@@ -2535,7 +2530,7 @@
|
|
|
2535
2530
|
|
|
2536
2531
|
return TreeUtilities;
|
|
2537
2532
|
});
|
|
2538
|
-
_registerModule(_modules, 'Core/Axis/TreeGridAxis.js', [_modules['Core/Axis/BrokenAxis.js'], _modules['Core/Axis/GridAxis.js'], _modules['Gantt/Tree.js'], _modules['Core/Axis/TreeGridTick.js'], _modules['Series/TreeUtilities.js'], _modules['Core/Utilities.js']], function (BrokenAxis, GridAxis, Tree, TreeGridTick, TU, U) {
|
|
2533
|
+
_registerModule(_modules, 'Core/Axis/TreeGrid/TreeGridAxis.js', [_modules['Core/Axis/BrokenAxis.js'], _modules['Core/Axis/GridAxis.js'], _modules['Gantt/Tree.js'], _modules['Core/Axis/TreeGrid/TreeGridTick.js'], _modules['Series/TreeUtilities.js'], _modules['Core/Utilities.js']], function (BrokenAxis, GridAxis, Tree, TreeGridTick, TU, U) {
|
|
2539
2534
|
/* *
|
|
2540
2535
|
*
|
|
2541
2536
|
* (c) 2016 Highsoft AS
|
|
@@ -2556,757 +2551,769 @@
|
|
|
2556
2551
|
merge = U.merge,
|
|
2557
2552
|
pick = U.pick,
|
|
2558
2553
|
wrap = U.wrap;
|
|
2554
|
+
/* *
|
|
2555
|
+
*
|
|
2556
|
+
* Constants
|
|
2557
|
+
*
|
|
2558
|
+
* */
|
|
2559
|
+
var composedClasses = [];
|
|
2560
|
+
/* *
|
|
2561
|
+
*
|
|
2562
|
+
* Variables
|
|
2563
|
+
*
|
|
2564
|
+
* */
|
|
2565
|
+
var TickConstructor;
|
|
2566
|
+
/* *
|
|
2567
|
+
*
|
|
2568
|
+
* Functions
|
|
2569
|
+
*
|
|
2570
|
+
* */
|
|
2559
2571
|
/**
|
|
2560
2572
|
* @private
|
|
2561
2573
|
*/
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2574
|
+
function getBreakFromNode(node, max) {
|
|
2575
|
+
var to = node.collapseEnd || 0;
|
|
2576
|
+
var from = node.collapseStart || 0;
|
|
2577
|
+
// In broken-axis, the axis.max is minimized until it is not within a
|
|
2578
|
+
// break. Therefore, if break.to is larger than axis.max, the axis.to
|
|
2579
|
+
// should not add the 0.5 axis.tickMarkOffset, to avoid adding a break
|
|
2580
|
+
// larger than axis.max.
|
|
2581
|
+
// TODO consider simplifying broken-axis and this might solve itself
|
|
2582
|
+
if (to >= max) {
|
|
2583
|
+
from -= 0.5;
|
|
2584
|
+
}
|
|
2585
|
+
return {
|
|
2586
|
+
from: from,
|
|
2587
|
+
to: to,
|
|
2588
|
+
showPoints: false
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Creates a tree structure of the data, and the treegrid. Calculates
|
|
2593
|
+
* categories, and y-values of points based on the tree.
|
|
2594
|
+
*
|
|
2595
|
+
* @private
|
|
2596
|
+
* @function getTreeGridFromData
|
|
2597
|
+
*
|
|
2598
|
+
* @param {Array<Highcharts.GanttPointOptions>} data
|
|
2599
|
+
* All the data points to display in the axis.
|
|
2600
|
+
*
|
|
2601
|
+
* @param {boolean} uniqueNames
|
|
2602
|
+
* Whether or not the data node with the same name should share grid cell. If
|
|
2603
|
+
* true they do share cell. False by default.
|
|
2604
|
+
*
|
|
2605
|
+
* @param {number} numberOfSeries
|
|
2606
|
+
*
|
|
2607
|
+
* @return {Object}
|
|
2608
|
+
* Returns an object containing categories, mapOfIdToNode,
|
|
2609
|
+
* mapOfPosToGridNode, and tree.
|
|
2610
|
+
*
|
|
2611
|
+
* @todo There should be only one point per line.
|
|
2612
|
+
* @todo It should be optional to have one category per point, or merge
|
|
2613
|
+
* cells
|
|
2614
|
+
* @todo Add unit-tests.
|
|
2615
|
+
*/
|
|
2616
|
+
function getTreeGridFromData(data, uniqueNames, numberOfSeries) {
|
|
2617
|
+
var categories = [],
|
|
2618
|
+
collapsedNodes = [],
|
|
2619
|
+
mapOfIdToNode = {},
|
|
2620
|
+
uniqueNamesEnabled = typeof uniqueNames === 'boolean' ?
|
|
2621
|
+
uniqueNames : false;
|
|
2622
|
+
var mapOfPosToGridNode = {},
|
|
2623
|
+
posIterator = -1;
|
|
2624
|
+
// Build the tree from the series data.
|
|
2625
|
+
var treeParams = {
|
|
2626
|
+
// After the children has been created.
|
|
2627
|
+
after: function (node) {
|
|
2628
|
+
var gridNode = mapOfPosToGridNode[node.pos];
|
|
2629
|
+
var height = 0,
|
|
2630
|
+
descendants = 0;
|
|
2631
|
+
gridNode.children.forEach(function (child) {
|
|
2632
|
+
descendants += (child.descendants || 0) + 1;
|
|
2633
|
+
height = Math.max((child.height || 0) + 1, height);
|
|
2634
|
+
});
|
|
2635
|
+
gridNode.descendants = descendants;
|
|
2636
|
+
gridNode.height = height;
|
|
2637
|
+
if (gridNode.collapsed) {
|
|
2638
|
+
collapsedNodes.push(gridNode);
|
|
2639
|
+
}
|
|
2640
|
+
},
|
|
2641
|
+
// Before the children has been created.
|
|
2642
|
+
before: function (node) {
|
|
2643
|
+
var data = isObject(node.data,
|
|
2644
|
+
true) ?
|
|
2645
|
+
node.data :
|
|
2646
|
+
{},
|
|
2647
|
+
name = isString(data.name) ? data.name : '',
|
|
2648
|
+
parentNode = mapOfIdToNode[node.parent],
|
|
2649
|
+
parentGridNode = (isObject(parentNode,
|
|
2650
|
+
true) ?
|
|
2651
|
+
mapOfPosToGridNode[parentNode.pos] :
|
|
2652
|
+
null),
|
|
2653
|
+
hasSameName = function (x) {
|
|
2654
|
+
return x.name === name;
|
|
2655
|
+
};
|
|
2656
|
+
var gridNode,
|
|
2657
|
+
pos;
|
|
2658
|
+
// If not unique names, look for sibling node with the same name
|
|
2659
|
+
if (uniqueNamesEnabled &&
|
|
2660
|
+
isObject(parentGridNode, true) &&
|
|
2661
|
+
!!(gridNode = find(parentGridNode.children, hasSameName))) {
|
|
2662
|
+
// If there is a gridNode with the same name, reuse position
|
|
2663
|
+
pos = gridNode.pos;
|
|
2664
|
+
// Add data node to list of nodes in the grid node.
|
|
2665
|
+
gridNode.nodes.push(node);
|
|
2666
|
+
}
|
|
2667
|
+
else {
|
|
2668
|
+
// If it is a new grid node, increment position.
|
|
2669
|
+
pos = posIterator++;
|
|
2670
|
+
}
|
|
2671
|
+
// Add new grid node to map.
|
|
2672
|
+
if (!mapOfPosToGridNode[pos]) {
|
|
2673
|
+
mapOfPosToGridNode[pos] = gridNode = {
|
|
2674
|
+
depth: parentGridNode ? parentGridNode.depth + 1 : 0,
|
|
2675
|
+
name: name,
|
|
2676
|
+
id: data.id,
|
|
2677
|
+
nodes: [node],
|
|
2678
|
+
children: [],
|
|
2679
|
+
pos: pos
|
|
2680
|
+
};
|
|
2681
|
+
// If not root, then add name to categories.
|
|
2682
|
+
if (pos !== -1) {
|
|
2683
|
+
categories.push(name);
|
|
2684
|
+
}
|
|
2685
|
+
// Add name to list of children.
|
|
2686
|
+
if (isObject(parentGridNode, true)) {
|
|
2687
|
+
parentGridNode.children.push(gridNode);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
// Add data node to map
|
|
2691
|
+
if (isString(node.id)) {
|
|
2692
|
+
mapOfIdToNode[node.id] = node;
|
|
2693
|
+
}
|
|
2694
|
+
// If one of the points are collapsed, then start the grid node
|
|
2695
|
+
// in collapsed state.
|
|
2696
|
+
if (gridNode &&
|
|
2697
|
+
data.collapsed === true) {
|
|
2698
|
+
gridNode.collapsed = true;
|
|
2699
|
+
}
|
|
2700
|
+
// Assign pos to data node
|
|
2701
|
+
node.pos = pos;
|
|
2702
|
+
}
|
|
2703
|
+
};
|
|
2704
|
+
var updateYValuesAndTickPos = function (map,
|
|
2705
|
+
numberOfSeries) {
|
|
2706
|
+
var setValues = function (gridNode,
|
|
2707
|
+
start,
|
|
2708
|
+
result) {
|
|
2709
|
+
var nodes = gridNode.nodes,
|
|
2710
|
+
padding = 0.5;
|
|
2711
|
+
var end = start + (start === -1 ? 0 : numberOfSeries - 1);
|
|
2712
|
+
var diff = (end - start) / 2,
|
|
2713
|
+
pos = start + diff;
|
|
2714
|
+
nodes.forEach(function (node) {
|
|
2715
|
+
var data = node.data;
|
|
2716
|
+
if (isObject(data, true)) {
|
|
2717
|
+
// Update point
|
|
2718
|
+
data.y = start + (data.seriesIndex || 0);
|
|
2719
|
+
// Remove the property once used
|
|
2720
|
+
delete data.seriesIndex;
|
|
2721
|
+
}
|
|
2722
|
+
node.pos = pos;
|
|
2723
|
+
});
|
|
2724
|
+
result[pos] = gridNode;
|
|
2725
|
+
gridNode.pos = pos;
|
|
2726
|
+
gridNode.tickmarkOffset = diff + padding;
|
|
2727
|
+
gridNode.collapseStart = end + padding;
|
|
2728
|
+
gridNode.children.forEach(function (child) {
|
|
2729
|
+
setValues(child, end + 1, result);
|
|
2730
|
+
end = (child.collapseEnd || 0) - padding;
|
|
2731
|
+
});
|
|
2732
|
+
// Set collapseEnd to the end of the last child node.
|
|
2733
|
+
gridNode.collapseEnd = end + padding;
|
|
2734
|
+
return result;
|
|
2735
|
+
};
|
|
2736
|
+
return setValues(map['-1'], -1, {});
|
|
2737
|
+
};
|
|
2738
|
+
// Create tree from data
|
|
2739
|
+
var tree = Tree.getTree(data,
|
|
2740
|
+
treeParams);
|
|
2741
|
+
// Update y values of data, and set calculate tick positions.
|
|
2742
|
+
mapOfPosToGridNode = updateYValuesAndTickPos(mapOfPosToGridNode, numberOfSeries);
|
|
2743
|
+
// Return the resulting data.
|
|
2744
|
+
return {
|
|
2745
|
+
categories: categories,
|
|
2746
|
+
mapOfIdToNode: mapOfIdToNode,
|
|
2747
|
+
mapOfPosToGridNode: mapOfPosToGridNode,
|
|
2748
|
+
collapsedNodes: collapsedNodes,
|
|
2749
|
+
tree: tree
|
|
2750
|
+
};
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* Builds the tree of categories and calculates its positions.
|
|
2754
|
+
* @private
|
|
2755
|
+
* @param {Object} e Event object
|
|
2756
|
+
* @param {Object} e.target The chart instance which the event was fired on.
|
|
2757
|
+
* @param {object[]} e.target.axes The axes of the chart.
|
|
2758
|
+
*/
|
|
2759
|
+
function onBeforeRender(e) {
|
|
2760
|
+
var chart = e.target,
|
|
2761
|
+
axes = chart.axes;
|
|
2762
|
+
axes.filter(function (axis) {
|
|
2763
|
+
return axis.options.type === 'treegrid';
|
|
2764
|
+
}).forEach(function (axis) {
|
|
2765
|
+
var options = axis.options || {},
|
|
2766
|
+
labelOptions = options.labels,
|
|
2767
|
+
uniqueNames = options.uniqueNames,
|
|
2768
|
+
max = options.max,
|
|
2769
|
+
// Check whether any of series is rendering for the first
|
|
2770
|
+
// time, visibility has changed, or its data is dirty, and
|
|
2771
|
+
// only then update. #10570, #10580. Also check if
|
|
2772
|
+
// mapOfPosToGridNode exists. #10887
|
|
2773
|
+
isDirty = (!axis.treeGrid.mapOfPosToGridNode ||
|
|
2774
|
+
axis.series.some(function (series) {
|
|
2775
|
+
return !series.hasRendered ||
|
|
2776
|
+
series.isDirtyData ||
|
|
2777
|
+
series.isDirty;
|
|
2778
|
+
}));
|
|
2779
|
+
var numberOfSeries = 0,
|
|
2780
|
+
data,
|
|
2781
|
+
treeGrid;
|
|
2782
|
+
if (isDirty) {
|
|
2783
|
+
// Concatenate data from all series assigned to this axis.
|
|
2784
|
+
data = axis.series.reduce(function (arr, s) {
|
|
2785
|
+
if (s.visible) {
|
|
2786
|
+
// Push all data to array
|
|
2787
|
+
(s.options.data || []).forEach(function (data) {
|
|
2788
|
+
// For using keys - rebuild the data structure
|
|
2789
|
+
if (s.options.keys && s.options.keys.length) {
|
|
2790
|
+
data = s.pointClass.prototype
|
|
2791
|
+
.optionsToObject
|
|
2792
|
+
.call({ series: s }, data);
|
|
2793
|
+
s.pointClass.setGanttPointAliases(data);
|
|
2794
|
+
}
|
|
2795
|
+
if (isObject(data, true)) {
|
|
2796
|
+
// Set series index on data. Removed again
|
|
2797
|
+
// after use.
|
|
2798
|
+
data.seriesIndex = (numberOfSeries);
|
|
2799
|
+
arr.push(data);
|
|
2800
|
+
}
|
|
2801
|
+
});
|
|
2802
|
+
// Increment series index
|
|
2803
|
+
if (uniqueNames === true) {
|
|
2804
|
+
numberOfSeries++;
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
return arr;
|
|
2808
|
+
}, []);
|
|
2809
|
+
// If max is higher than set data - add a
|
|
2810
|
+
// dummy data to render categories #10779
|
|
2811
|
+
if (max && data.length < max) {
|
|
2812
|
+
for (var i = data.length; i <= max; i++) {
|
|
2813
|
+
data.push({
|
|
2814
|
+
// Use the zero-width character
|
|
2815
|
+
// to avoid conflict with uniqueNames
|
|
2816
|
+
name: i + '\u200B'
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
// setScale is fired after all the series is initialized,
|
|
2821
|
+
// which is an ideal time to update the axis.categories.
|
|
2822
|
+
treeGrid = getTreeGridFromData(data, uniqueNames || false, (uniqueNames === true) ? numberOfSeries : 1);
|
|
2823
|
+
// Assign values to the axis.
|
|
2824
|
+
axis.categories = treeGrid.categories;
|
|
2825
|
+
axis.treeGrid.mapOfPosToGridNode = (treeGrid.mapOfPosToGridNode);
|
|
2826
|
+
axis.hasNames = true;
|
|
2827
|
+
axis.treeGrid.tree = treeGrid.tree;
|
|
2828
|
+
// Update yData now that we have calculated the y values
|
|
2829
|
+
axis.series.forEach(function (series) {
|
|
2830
|
+
var axisData = (series.options.data || []).map(function (d) {
|
|
2831
|
+
if (isArray(d) &&
|
|
2832
|
+
series.options.keys &&
|
|
2833
|
+
series.options.keys.length) {
|
|
2834
|
+
// Get the axisData from the data array used to
|
|
2835
|
+
// build the treeGrid where has been modified
|
|
2836
|
+
data.forEach(function (point) {
|
|
2837
|
+
if (d.indexOf(point.x) >= 0 &&
|
|
2838
|
+
d.indexOf(point.x2) >= 0) {
|
|
2839
|
+
d = point;
|
|
2840
|
+
}
|
|
2841
|
+
});
|
|
2842
|
+
}
|
|
2843
|
+
return isObject(d, true) ? merge(d) : d;
|
|
2844
|
+
});
|
|
2845
|
+
// Avoid destroying points when series is not visible
|
|
2846
|
+
if (series.visible) {
|
|
2847
|
+
series.setData(axisData, false);
|
|
2848
|
+
}
|
|
2849
|
+
});
|
|
2850
|
+
// Calculate the label options for each level in the tree.
|
|
2851
|
+
axis.treeGrid.mapOptionsToLevel =
|
|
2852
|
+
getLevelOptions({
|
|
2853
|
+
defaults: labelOptions,
|
|
2854
|
+
from: 1,
|
|
2855
|
+
levels: labelOptions && labelOptions.levels,
|
|
2856
|
+
to: axis.treeGrid.tree && axis.treeGrid.tree.height
|
|
2857
|
+
});
|
|
2858
|
+
// Setting initial collapsed nodes
|
|
2859
|
+
if (e.type === 'beforeRender') {
|
|
2860
|
+
axis.treeGrid.collapsedNodes = treeGrid.collapsedNodes;
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* Generates a tick for initial positioning.
|
|
2867
|
+
*
|
|
2868
|
+
* @private
|
|
2869
|
+
* @function Highcharts.GridAxis#generateTick
|
|
2870
|
+
*
|
|
2871
|
+
* @param {Function} proceed
|
|
2872
|
+
* The original generateTick function.
|
|
2873
|
+
*
|
|
2874
|
+
* @param {number} pos
|
|
2875
|
+
* The tick position in axis values.
|
|
2876
|
+
*/
|
|
2877
|
+
function wrapGenerateTick(proceed, pos) {
|
|
2878
|
+
var axis = this,
|
|
2879
|
+
mapOptionsToLevel = axis.treeGrid.mapOptionsToLevel || {},
|
|
2880
|
+
isTreeGrid = axis.options.type === 'treegrid',
|
|
2881
|
+
ticks = axis.ticks;
|
|
2882
|
+
var tick = ticks[pos],
|
|
2883
|
+
levelOptions,
|
|
2884
|
+
options,
|
|
2885
|
+
gridNode;
|
|
2886
|
+
if (isTreeGrid &&
|
|
2887
|
+
axis.treeGrid.mapOfPosToGridNode) {
|
|
2888
|
+
gridNode = axis.treeGrid.mapOfPosToGridNode[pos];
|
|
2889
|
+
levelOptions = mapOptionsToLevel[gridNode.depth];
|
|
2890
|
+
if (levelOptions) {
|
|
2891
|
+
options = {
|
|
2892
|
+
labels: levelOptions
|
|
2893
|
+
};
|
|
2894
|
+
}
|
|
2895
|
+
if (!tick &&
|
|
2896
|
+
TickConstructor) {
|
|
2897
|
+
ticks[pos] = tick =
|
|
2898
|
+
new TickConstructor(axis, pos, void 0, void 0, {
|
|
2899
|
+
category: gridNode.name,
|
|
2900
|
+
tickmarkOffset: gridNode.tickmarkOffset,
|
|
2901
|
+
options: options
|
|
2902
|
+
});
|
|
2903
|
+
}
|
|
2904
|
+
else {
|
|
2905
|
+
// update labels depending on tick interval
|
|
2906
|
+
tick.parameters.category = gridNode.name;
|
|
2907
|
+
tick.options = options;
|
|
2908
|
+
tick.addLabel();
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
else {
|
|
2912
|
+
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
/**
|
|
2916
|
+
* @private
|
|
2917
|
+
*/
|
|
2918
|
+
function wrapInit(proceed, chart, userOptions) {
|
|
2919
|
+
var axis = this,
|
|
2920
|
+
isTreeGrid = userOptions.type === 'treegrid';
|
|
2921
|
+
if (!axis.treeGrid) {
|
|
2922
|
+
axis.treeGrid = new TreeGridAxisAdditions(axis);
|
|
2923
|
+
}
|
|
2924
|
+
// Set default and forced options for TreeGrid
|
|
2925
|
+
if (isTreeGrid) {
|
|
2926
|
+
// Add event for updating the categories of a treegrid.
|
|
2927
|
+
// NOTE Preferably these events should be set on the axis.
|
|
2928
|
+
addEvent(chart, 'beforeRender', onBeforeRender);
|
|
2929
|
+
addEvent(chart, 'beforeRedraw', onBeforeRender);
|
|
2930
|
+
// Add new collapsed nodes on addseries
|
|
2931
|
+
addEvent(chart, 'addSeries', function (e) {
|
|
2932
|
+
if (e.options.data) {
|
|
2933
|
+
var treeGrid = getTreeGridFromData(e.options.data,
|
|
2934
|
+
userOptions.uniqueNames || false, 1);
|
|
2935
|
+
axis.treeGrid.collapsedNodes = (axis.treeGrid.collapsedNodes || []).concat(treeGrid.collapsedNodes);
|
|
2936
|
+
}
|
|
2937
|
+
});
|
|
2938
|
+
// Collapse all nodes in axis.treegrid.collapsednodes
|
|
2939
|
+
// where collapsed equals true.
|
|
2940
|
+
addEvent(axis, 'foundExtremes', function () {
|
|
2941
|
+
if (axis.treeGrid.collapsedNodes) {
|
|
2942
|
+
axis.treeGrid.collapsedNodes.forEach(function (node) {
|
|
2943
|
+
var breaks = axis.treeGrid.collapse(node);
|
|
2944
|
+
if (axis.brokenAxis) {
|
|
2945
|
+
axis.brokenAxis.setBreaks(breaks, false);
|
|
2946
|
+
// remove the node from the axis collapsedNodes
|
|
2947
|
+
if (axis.treeGrid.collapsedNodes) {
|
|
2948
|
+
axis.treeGrid.collapsedNodes = axis.treeGrid
|
|
2949
|
+
.collapsedNodes
|
|
2950
|
+
.filter(function (n) { return ((node.collapseStart !==
|
|
2951
|
+
n.collapseStart) ||
|
|
2952
|
+
node.collapseEnd !== n.collapseEnd); });
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2957
|
+
});
|
|
2958
|
+
// If staticScale is not defined on the yAxis
|
|
2959
|
+
// and chart height is set, set axis.isDirty
|
|
2960
|
+
// to ensure collapsing works (#12012)
|
|
2961
|
+
addEvent(axis, 'afterBreaks', function () {
|
|
2962
|
+
if (axis.coll === 'yAxis' &&
|
|
2963
|
+
!axis.staticScale &&
|
|
2964
|
+
axis.chart.options.chart.height) {
|
|
2965
|
+
axis.isDirty = true;
|
|
2966
|
+
}
|
|
2967
|
+
});
|
|
2968
|
+
userOptions = merge({
|
|
2969
|
+
// Default options
|
|
2970
|
+
grid: {
|
|
2971
|
+
enabled: true
|
|
2972
|
+
},
|
|
2973
|
+
// TODO: add support for align in treegrid.
|
|
2974
|
+
labels: {
|
|
2975
|
+
align: 'left',
|
|
2976
|
+
/**
|
|
2977
|
+
* Set options on specific levels in a tree grid axis. Takes
|
|
2978
|
+
* precedence over labels options.
|
|
2979
|
+
*
|
|
2980
|
+
* @sample {gantt} gantt/treegrid-axis/labels-levels
|
|
2981
|
+
* Levels on TreeGrid Labels
|
|
2982
|
+
*
|
|
2983
|
+
* @type {Array<*>}
|
|
2984
|
+
* @product gantt
|
|
2985
|
+
* @apioption yAxis.labels.levels
|
|
2986
|
+
*
|
|
2987
|
+
* @private
|
|
2988
|
+
*/
|
|
2989
|
+
levels: [{
|
|
2990
|
+
/**
|
|
2991
|
+
* Specify the level which the options within this object
|
|
2992
|
+
* applies to.
|
|
2993
|
+
*
|
|
2994
|
+
* @type {number}
|
|
2995
|
+
* @product gantt
|
|
2996
|
+
* @apioption yAxis.labels.levels.level
|
|
2997
|
+
*
|
|
2998
|
+
* @private
|
|
2999
|
+
*/
|
|
3000
|
+
level: void 0
|
|
3001
|
+
}, {
|
|
3002
|
+
level: 1,
|
|
3003
|
+
/**
|
|
3004
|
+
* @type {Highcharts.CSSObject}
|
|
3005
|
+
* @product gantt
|
|
3006
|
+
* @apioption yAxis.labels.levels.style
|
|
3007
|
+
*
|
|
3008
|
+
* @private
|
|
3009
|
+
*/
|
|
3010
|
+
style: {
|
|
3011
|
+
/** @ignore-option */
|
|
3012
|
+
fontWeight: 'bold'
|
|
3013
|
+
}
|
|
3014
|
+
}],
|
|
3015
|
+
/**
|
|
3016
|
+
* The symbol for the collapse and expand icon in a
|
|
3017
|
+
* treegrid.
|
|
3018
|
+
*
|
|
3019
|
+
* @product gantt
|
|
3020
|
+
* @optionparent yAxis.labels.symbol
|
|
3021
|
+
*
|
|
3022
|
+
* @private
|
|
3023
|
+
*/
|
|
3024
|
+
symbol: {
|
|
3025
|
+
/**
|
|
3026
|
+
* The symbol type. Points to a definition function in
|
|
3027
|
+
* the `Highcharts.Renderer.symbols` collection.
|
|
3028
|
+
*
|
|
3029
|
+
* @type {Highcharts.SymbolKeyValue}
|
|
3030
|
+
*
|
|
3031
|
+
* @private
|
|
3032
|
+
*/
|
|
3033
|
+
type: 'triangle',
|
|
3034
|
+
x: -5,
|
|
3035
|
+
y: -5,
|
|
3036
|
+
height: 10,
|
|
3037
|
+
width: 10,
|
|
3038
|
+
padding: 5
|
|
3039
|
+
}
|
|
3040
|
+
},
|
|
3041
|
+
uniqueNames: false
|
|
3042
|
+
}, userOptions, {
|
|
3043
|
+
// Forced options
|
|
3044
|
+
reversed: true,
|
|
3045
|
+
// grid.columns is not supported in treegrid
|
|
3046
|
+
grid: {
|
|
3047
|
+
columns: void 0
|
|
3048
|
+
}
|
|
3049
|
+
});
|
|
3050
|
+
}
|
|
3051
|
+
// Now apply the original function with the original arguments,
|
|
3052
|
+
// which are sliced off this function's arguments
|
|
3053
|
+
proceed.apply(axis, [chart, userOptions]);
|
|
3054
|
+
if (isTreeGrid) {
|
|
3055
|
+
axis.hasNames = true;
|
|
3056
|
+
axis.options.showLastLabel = true;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
/**
|
|
3060
|
+
* Set the tick positions, tickInterval, axis min and max.
|
|
3061
|
+
*
|
|
3062
|
+
* @private
|
|
3063
|
+
* @function Highcharts.GridAxis#setTickInterval
|
|
3064
|
+
*
|
|
3065
|
+
* @param {Function} proceed
|
|
3066
|
+
* The original setTickInterval function.
|
|
3067
|
+
*/
|
|
3068
|
+
function wrapSetTickInterval(proceed) {
|
|
3069
|
+
var axis = this,
|
|
3070
|
+
options = axis.options,
|
|
3071
|
+
isTreeGrid = options.type === 'treegrid';
|
|
3072
|
+
if (isTreeGrid) {
|
|
3073
|
+
axis.min = pick(axis.userMin, options.min, axis.dataMin);
|
|
3074
|
+
axis.max = pick(axis.userMax, options.max, axis.dataMax);
|
|
3075
|
+
fireEvent(axis, 'foundExtremes');
|
|
3076
|
+
// setAxisTranslation modifies the min and max according to
|
|
3077
|
+
// axis breaks.
|
|
3078
|
+
axis.setAxisTranslation();
|
|
3079
|
+
axis.tickmarkOffset = 0.5;
|
|
3080
|
+
axis.tickInterval = 1;
|
|
3081
|
+
axis.tickPositions = axis.treeGrid.mapOfPosToGridNode ?
|
|
3082
|
+
axis.treeGrid.getTickPositions() :
|
|
3083
|
+
[];
|
|
3084
|
+
}
|
|
3085
|
+
else {
|
|
3086
|
+
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
/* *
|
|
3090
|
+
*
|
|
3091
|
+
* Classes
|
|
3092
|
+
*
|
|
3093
|
+
* */
|
|
3094
|
+
/**
|
|
3095
|
+
* @private
|
|
3096
|
+
* @class
|
|
3097
|
+
*/
|
|
3098
|
+
var TreeGridAxisAdditions = /** @class */ (function () {
|
|
3099
|
+
/* *
|
|
3100
|
+
*
|
|
3101
|
+
* Constructors
|
|
3102
|
+
*
|
|
3103
|
+
* */
|
|
3104
|
+
/**
|
|
3105
|
+
* @private
|
|
3106
|
+
*/
|
|
3107
|
+
function TreeGridAxisAdditions(axis) {
|
|
3108
|
+
this.axis = axis;
|
|
3109
|
+
}
|
|
2575
3110
|
/* *
|
|
2576
3111
|
*
|
|
2577
|
-
* Functions
|
|
3112
|
+
* Static Functions
|
|
2578
3113
|
*
|
|
2579
3114
|
* */
|
|
2580
3115
|
/**
|
|
2581
3116
|
* @private
|
|
2582
3117
|
*/
|
|
2583
|
-
function
|
|
2584
|
-
if (
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
3118
|
+
TreeGridAxisAdditions.compose = function (AxisClass, ChartClass, SeriesClass, TickClass) {
|
|
3119
|
+
if (composedClasses.indexOf(AxisClass) === -1) {
|
|
3120
|
+
composedClasses.push(AxisClass);
|
|
3121
|
+
if (AxisClass.keepProps.indexOf('treeGrid') === -1) {
|
|
3122
|
+
AxisClass.keepProps.push('treeGrid');
|
|
3123
|
+
}
|
|
3124
|
+
var axisProps = AxisClass.prototype;
|
|
3125
|
+
wrap(axisProps, 'generateTick', wrapGenerateTick);
|
|
3126
|
+
wrap(axisProps, 'init', wrapInit);
|
|
3127
|
+
wrap(axisProps, 'setTickInterval', wrapSetTickInterval);
|
|
2590
3128
|
// Make utility functions available for testing.
|
|
2591
|
-
|
|
3129
|
+
axisProps.utils = {
|
|
2592
3130
|
getNode: Tree.getNode
|
|
2593
3131
|
};
|
|
2594
|
-
GridAxis.compose(AxisClass, ChartClass, TickClass);
|
|
2595
|
-
BrokenAxis.compose(AxisClass, SeriesClass);
|
|
2596
|
-
TreeGridTick.compose(TickClass);
|
|
2597
3132
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
*/
|
|
2604
|
-
function getBreakFromNode(node, max) {
|
|
2605
|
-
var to = node.collapseEnd || 0;
|
|
2606
|
-
var from = node.collapseStart || 0;
|
|
2607
|
-
// In broken-axis, the axis.max is minimized until it is not within a
|
|
2608
|
-
// break. Therefore, if break.to is larger than axis.max, the axis.to
|
|
2609
|
-
// should not add the 0.5 axis.tickMarkOffset, to avoid adding a break
|
|
2610
|
-
// larger than axis.max.
|
|
2611
|
-
// TODO consider simplifying broken-axis and this might solve itself
|
|
2612
|
-
if (to >= max) {
|
|
2613
|
-
from -= 0.5;
|
|
3133
|
+
if (composedClasses.indexOf(TickClass) === -1) {
|
|
3134
|
+
composedClasses.push(TickClass);
|
|
3135
|
+
if (!TickConstructor) {
|
|
3136
|
+
TickConstructor = TickClass;
|
|
3137
|
+
}
|
|
2614
3138
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
/**
|
|
2622
|
-
* Creates a tree structure of the data, and the treegrid. Calculates
|
|
2623
|
-
* categories, and y-values of points based on the tree.
|
|
2624
|
-
*
|
|
2625
|
-
* @private
|
|
2626
|
-
* @function getTreeGridFromData
|
|
3139
|
+
GridAxis.compose(AxisClass, ChartClass, TickClass);
|
|
3140
|
+
BrokenAxis.compose(AxisClass, SeriesClass);
|
|
3141
|
+
TreeGridTick.compose(TickClass);
|
|
3142
|
+
return AxisClass;
|
|
3143
|
+
};
|
|
3144
|
+
/* *
|
|
2627
3145
|
*
|
|
2628
|
-
*
|
|
2629
|
-
* All the data points to display in the axis.
|
|
3146
|
+
* Functions
|
|
2630
3147
|
*
|
|
2631
|
-
*
|
|
2632
|
-
|
|
2633
|
-
*
|
|
3148
|
+
* */
|
|
3149
|
+
/**
|
|
3150
|
+
* Set the collapse status.
|
|
2634
3151
|
*
|
|
2635
|
-
* @
|
|
3152
|
+
* @private
|
|
2636
3153
|
*
|
|
2637
|
-
* @
|
|
2638
|
-
*
|
|
2639
|
-
* mapOfPosToGridNode, and tree.
|
|
3154
|
+
* @param {Highcharts.Axis} axis
|
|
3155
|
+
* The axis to check against.
|
|
2640
3156
|
*
|
|
2641
|
-
* @
|
|
2642
|
-
*
|
|
2643
|
-
* cells
|
|
2644
|
-
* @todo Add unit-tests.
|
|
3157
|
+
* @param {Highcharts.GridNode} node
|
|
3158
|
+
* The node to collapse.
|
|
2645
3159
|
*/
|
|
2646
|
-
function
|
|
2647
|
-
var
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
after: function (node) {
|
|
2658
|
-
var gridNode = mapOfPosToGridNode[node.pos];
|
|
2659
|
-
var height = 0,
|
|
2660
|
-
descendants = 0;
|
|
2661
|
-
gridNode.children.forEach(function (child) {
|
|
2662
|
-
descendants += (child.descendants || 0) + 1;
|
|
2663
|
-
height = Math.max((child.height || 0) + 1, height);
|
|
2664
|
-
});
|
|
2665
|
-
gridNode.descendants = descendants;
|
|
2666
|
-
gridNode.height = height;
|
|
2667
|
-
if (gridNode.collapsed) {
|
|
2668
|
-
collapsedNodes.push(gridNode);
|
|
2669
|
-
}
|
|
2670
|
-
},
|
|
2671
|
-
// Before the children has been created.
|
|
2672
|
-
before: function (node) {
|
|
2673
|
-
var data = isObject(node.data,
|
|
2674
|
-
true) ?
|
|
2675
|
-
node.data :
|
|
2676
|
-
{},
|
|
2677
|
-
name = isString(data.name) ? data.name : '',
|
|
2678
|
-
parentNode = mapOfIdToNode[node.parent],
|
|
2679
|
-
parentGridNode = (isObject(parentNode,
|
|
2680
|
-
true) ?
|
|
2681
|
-
mapOfPosToGridNode[parentNode.pos] :
|
|
2682
|
-
null),
|
|
2683
|
-
hasSameName = function (x) {
|
|
2684
|
-
return x.name === name;
|
|
2685
|
-
};
|
|
2686
|
-
var gridNode,
|
|
2687
|
-
pos;
|
|
2688
|
-
// If not unique names, look for sibling node with the same name
|
|
2689
|
-
if (uniqueNamesEnabled &&
|
|
2690
|
-
isObject(parentGridNode, true) &&
|
|
2691
|
-
!!(gridNode = find(parentGridNode.children, hasSameName))) {
|
|
2692
|
-
// If there is a gridNode with the same name, reuse position
|
|
2693
|
-
pos = gridNode.pos;
|
|
2694
|
-
// Add data node to list of nodes in the grid node.
|
|
2695
|
-
gridNode.nodes.push(node);
|
|
2696
|
-
}
|
|
2697
|
-
else {
|
|
2698
|
-
// If it is a new grid node, increment position.
|
|
2699
|
-
pos = posIterator++;
|
|
2700
|
-
}
|
|
2701
|
-
// Add new grid node to map.
|
|
2702
|
-
if (!mapOfPosToGridNode[pos]) {
|
|
2703
|
-
mapOfPosToGridNode[pos] = gridNode = {
|
|
2704
|
-
depth: parentGridNode ? parentGridNode.depth + 1 : 0,
|
|
2705
|
-
name: name,
|
|
2706
|
-
id: data.id,
|
|
2707
|
-
nodes: [node],
|
|
2708
|
-
children: [],
|
|
2709
|
-
pos: pos
|
|
2710
|
-
};
|
|
2711
|
-
// If not root, then add name to categories.
|
|
2712
|
-
if (pos !== -1) {
|
|
2713
|
-
categories.push(name);
|
|
2714
|
-
}
|
|
2715
|
-
// Add name to list of children.
|
|
2716
|
-
if (isObject(parentGridNode, true)) {
|
|
2717
|
-
parentGridNode.children.push(gridNode);
|
|
2718
|
-
}
|
|
3160
|
+
TreeGridAxisAdditions.prototype.setCollapsedStatus = function (node) {
|
|
3161
|
+
var axis = this.axis,
|
|
3162
|
+
chart = axis.chart;
|
|
3163
|
+
axis.series.forEach(function (series) {
|
|
3164
|
+
var data = series.options.data;
|
|
3165
|
+
if (node.id && data) {
|
|
3166
|
+
var point = chart.get(node.id),
|
|
3167
|
+
dataPoint = data[series.data.indexOf(point)];
|
|
3168
|
+
if (point && dataPoint) {
|
|
3169
|
+
point.collapsed = node.collapsed;
|
|
3170
|
+
dataPoint.collapsed = node.collapsed;
|
|
2719
3171
|
}
|
|
2720
|
-
// Add data node to map
|
|
2721
|
-
if (isString(node.id)) {
|
|
2722
|
-
mapOfIdToNode[node.id] = node;
|
|
2723
|
-
}
|
|
2724
|
-
// If one of the points are collapsed, then start the grid node
|
|
2725
|
-
// in collapsed state.
|
|
2726
|
-
if (gridNode &&
|
|
2727
|
-
data.collapsed === true) {
|
|
2728
|
-
gridNode.collapsed = true;
|
|
2729
|
-
}
|
|
2730
|
-
// Assign pos to data node
|
|
2731
|
-
node.pos = pos;
|
|
2732
3172
|
}
|
|
2733
|
-
};
|
|
2734
|
-
|
|
2735
|
-
numberOfSeries) {
|
|
2736
|
-
var setValues = function (gridNode,
|
|
2737
|
-
start,
|
|
2738
|
-
result) {
|
|
2739
|
-
var nodes = gridNode.nodes,
|
|
2740
|
-
padding = 0.5;
|
|
2741
|
-
var end = start + (start === -1 ? 0 : numberOfSeries - 1);
|
|
2742
|
-
var diff = (end - start) / 2,
|
|
2743
|
-
pos = start + diff;
|
|
2744
|
-
nodes.forEach(function (node) {
|
|
2745
|
-
var data = node.data;
|
|
2746
|
-
if (isObject(data, true)) {
|
|
2747
|
-
// Update point
|
|
2748
|
-
data.y = start + (data.seriesIndex || 0);
|
|
2749
|
-
// Remove the property once used
|
|
2750
|
-
delete data.seriesIndex;
|
|
2751
|
-
}
|
|
2752
|
-
node.pos = pos;
|
|
2753
|
-
});
|
|
2754
|
-
result[pos] = gridNode;
|
|
2755
|
-
gridNode.pos = pos;
|
|
2756
|
-
gridNode.tickmarkOffset = diff + padding;
|
|
2757
|
-
gridNode.collapseStart = end + padding;
|
|
2758
|
-
gridNode.children.forEach(function (child) {
|
|
2759
|
-
setValues(child, end + 1, result);
|
|
2760
|
-
end = (child.collapseEnd || 0) - padding;
|
|
2761
|
-
});
|
|
2762
|
-
// Set collapseEnd to the end of the last child node.
|
|
2763
|
-
gridNode.collapseEnd = end + padding;
|
|
2764
|
-
return result;
|
|
2765
|
-
};
|
|
2766
|
-
return setValues(map['-1'], -1, {});
|
|
2767
|
-
};
|
|
2768
|
-
// Create tree from data
|
|
2769
|
-
var tree = Tree.getTree(data,
|
|
2770
|
-
treeParams);
|
|
2771
|
-
// Update y values of data, and set calculate tick positions.
|
|
2772
|
-
mapOfPosToGridNode = updateYValuesAndTickPos(mapOfPosToGridNode, numberOfSeries);
|
|
2773
|
-
// Return the resulting data.
|
|
2774
|
-
return {
|
|
2775
|
-
categories: categories,
|
|
2776
|
-
mapOfIdToNode: mapOfIdToNode,
|
|
2777
|
-
mapOfPosToGridNode: mapOfPosToGridNode,
|
|
2778
|
-
collapsedNodes: collapsedNodes,
|
|
2779
|
-
tree: tree
|
|
2780
|
-
};
|
|
2781
|
-
}
|
|
3173
|
+
});
|
|
3174
|
+
};
|
|
2782
3175
|
/**
|
|
2783
|
-
*
|
|
3176
|
+
* Calculates the new axis breaks to collapse a node.
|
|
3177
|
+
*
|
|
2784
3178
|
* @private
|
|
2785
|
-
*
|
|
2786
|
-
* @param {
|
|
2787
|
-
*
|
|
3179
|
+
*
|
|
3180
|
+
* @param {Highcharts.Axis} axis
|
|
3181
|
+
* The axis to check against.
|
|
3182
|
+
*
|
|
3183
|
+
* @param {Highcharts.GridNode} node
|
|
3184
|
+
* The node to collapse.
|
|
3185
|
+
*
|
|
3186
|
+
* @param {number} pos
|
|
3187
|
+
* The tick position to collapse.
|
|
3188
|
+
*
|
|
3189
|
+
* @return {Array<object>}
|
|
3190
|
+
* Returns an array of the new breaks for the axis.
|
|
2788
3191
|
*/
|
|
2789
|
-
function
|
|
2790
|
-
var
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
// time, visibility has changed, or its data is dirty, and
|
|
2801
|
-
// only then update. #10570, #10580. Also check if
|
|
2802
|
-
// mapOfPosToGridNode exists. #10887
|
|
2803
|
-
isDirty = (!axis.treeGrid.mapOfPosToGridNode ||
|
|
2804
|
-
axis.series.some(function (series) {
|
|
2805
|
-
return !series.hasRendered ||
|
|
2806
|
-
series.isDirtyData ||
|
|
2807
|
-
series.isDirty;
|
|
2808
|
-
}));
|
|
2809
|
-
var numberOfSeries = 0,
|
|
2810
|
-
data,
|
|
2811
|
-
treeGrid;
|
|
2812
|
-
if (isDirty) {
|
|
2813
|
-
// Concatenate data from all series assigned to this axis.
|
|
2814
|
-
data = axis.series.reduce(function (arr, s) {
|
|
2815
|
-
if (s.visible) {
|
|
2816
|
-
// Push all data to array
|
|
2817
|
-
(s.options.data || []).forEach(function (data) {
|
|
2818
|
-
// For using keys - rebuild the data structure
|
|
2819
|
-
if (s.options.keys && s.options.keys.length) {
|
|
2820
|
-
data = s.pointClass.prototype
|
|
2821
|
-
.optionsToObject
|
|
2822
|
-
.call({ series: s }, data);
|
|
2823
|
-
s.pointClass.setGanttPointAliases(data);
|
|
2824
|
-
}
|
|
2825
|
-
if (isObject(data, true)) {
|
|
2826
|
-
// Set series index on data. Removed again
|
|
2827
|
-
// after use.
|
|
2828
|
-
data.seriesIndex = (numberOfSeries);
|
|
2829
|
-
arr.push(data);
|
|
2830
|
-
}
|
|
2831
|
-
});
|
|
2832
|
-
// Increment series index
|
|
2833
|
-
if (uniqueNames === true) {
|
|
2834
|
-
numberOfSeries++;
|
|
2835
|
-
}
|
|
2836
|
-
}
|
|
2837
|
-
return arr;
|
|
2838
|
-
}, []);
|
|
2839
|
-
// If max is higher than set data - add a
|
|
2840
|
-
// dummy data to render categories #10779
|
|
2841
|
-
if (max && data.length < max) {
|
|
2842
|
-
for (var i = data.length; i <= max; i++) {
|
|
2843
|
-
data.push({
|
|
2844
|
-
// Use the zero-width character
|
|
2845
|
-
// to avoid conflict with uniqueNames
|
|
2846
|
-
name: i + '\u200B'
|
|
2847
|
-
});
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
// setScale is fired after all the series is initialized,
|
|
2851
|
-
// which is an ideal time to update the axis.categories.
|
|
2852
|
-
treeGrid = getTreeGridFromData(data, uniqueNames || false, (uniqueNames === true) ? numberOfSeries : 1);
|
|
2853
|
-
// Assign values to the axis.
|
|
2854
|
-
axis.categories = treeGrid.categories;
|
|
2855
|
-
axis.treeGrid.mapOfPosToGridNode = (treeGrid.mapOfPosToGridNode);
|
|
2856
|
-
axis.hasNames = true;
|
|
2857
|
-
axis.treeGrid.tree = treeGrid.tree;
|
|
2858
|
-
// Update yData now that we have calculated the y values
|
|
2859
|
-
axis.series.forEach(function (series) {
|
|
2860
|
-
var axisData = (series.options.data || []).map(function (d) {
|
|
2861
|
-
if (isArray(d) &&
|
|
2862
|
-
series.options.keys &&
|
|
2863
|
-
series.options.keys.length) {
|
|
2864
|
-
// Get the axisData from the data array used to
|
|
2865
|
-
// build the treeGrid where has been modified
|
|
2866
|
-
data.forEach(function (point) {
|
|
2867
|
-
if (d.indexOf(point.x) >= 0 &&
|
|
2868
|
-
d.indexOf(point.x2) >= 0) {
|
|
2869
|
-
d = point;
|
|
2870
|
-
}
|
|
2871
|
-
});
|
|
2872
|
-
}
|
|
2873
|
-
return isObject(d, true) ? merge(d) : d;
|
|
2874
|
-
});
|
|
2875
|
-
// Avoid destroying points when series is not visible
|
|
2876
|
-
if (series.visible) {
|
|
2877
|
-
series.setData(axisData, false);
|
|
2878
|
-
}
|
|
2879
|
-
});
|
|
2880
|
-
// Calculate the label options for each level in the tree.
|
|
2881
|
-
axis.treeGrid.mapOptionsToLevel =
|
|
2882
|
-
getLevelOptions({
|
|
2883
|
-
defaults: labelOptions,
|
|
2884
|
-
from: 1,
|
|
2885
|
-
levels: labelOptions && labelOptions.levels,
|
|
2886
|
-
to: axis.treeGrid.tree && axis.treeGrid.tree.height
|
|
2887
|
-
});
|
|
2888
|
-
// Setting initial collapsed nodes
|
|
2889
|
-
if (e.type === 'beforeRender') {
|
|
2890
|
-
axis.treeGrid.collapsedNodes = treeGrid.collapsedNodes;
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
});
|
|
2894
|
-
}
|
|
3192
|
+
TreeGridAxisAdditions.prototype.collapse = function (node) {
|
|
3193
|
+
var axis = this.axis,
|
|
3194
|
+
breaks = (axis.options.breaks || []),
|
|
3195
|
+
obj = getBreakFromNode(node,
|
|
3196
|
+
axis.max);
|
|
3197
|
+
breaks.push(obj);
|
|
3198
|
+
// Change the collapsed flag #13838
|
|
3199
|
+
node.collapsed = true;
|
|
3200
|
+
axis.treeGrid.setCollapsedStatus(node);
|
|
3201
|
+
return breaks;
|
|
3202
|
+
};
|
|
2895
3203
|
/**
|
|
2896
|
-
*
|
|
3204
|
+
* Calculates the new axis breaks to expand a node.
|
|
2897
3205
|
*
|
|
2898
3206
|
* @private
|
|
2899
|
-
* @function Highcharts.GridAxis#generateTick
|
|
2900
3207
|
*
|
|
2901
|
-
* @param {
|
|
2902
|
-
* The
|
|
3208
|
+
* @param {Highcharts.Axis} axis
|
|
3209
|
+
* The axis to check against.
|
|
3210
|
+
*
|
|
3211
|
+
* @param {Highcharts.GridNode} node
|
|
3212
|
+
* The node to expand.
|
|
2903
3213
|
*
|
|
2904
3214
|
* @param {number} pos
|
|
2905
|
-
* The tick position
|
|
3215
|
+
* The tick position to expand.
|
|
3216
|
+
*
|
|
3217
|
+
* @return {Array<object>}
|
|
3218
|
+
* Returns an array of the new breaks for the axis.
|
|
2906
3219
|
*/
|
|
2907
|
-
function
|
|
2908
|
-
var axis = this,
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
levelOptions = mapOptionsToLevel[gridNode.depth];
|
|
2920
|
-
if (levelOptions) {
|
|
2921
|
-
options = {
|
|
2922
|
-
labels: levelOptions
|
|
2923
|
-
};
|
|
2924
|
-
}
|
|
2925
|
-
if (!tick &&
|
|
2926
|
-
TickConstructor) {
|
|
2927
|
-
ticks[pos] = tick =
|
|
2928
|
-
new TickConstructor(axis, pos, void 0, void 0, {
|
|
2929
|
-
category: gridNode.name,
|
|
2930
|
-
tickmarkOffset: gridNode.tickmarkOffset,
|
|
2931
|
-
options: options
|
|
2932
|
-
});
|
|
3220
|
+
TreeGridAxisAdditions.prototype.expand = function (node) {
|
|
3221
|
+
var axis = this.axis,
|
|
3222
|
+
breaks = (axis.options.breaks || []),
|
|
3223
|
+
obj = getBreakFromNode(node,
|
|
3224
|
+
axis.max);
|
|
3225
|
+
// Change the collapsed flag #13838
|
|
3226
|
+
node.collapsed = false;
|
|
3227
|
+
axis.treeGrid.setCollapsedStatus(node);
|
|
3228
|
+
// Remove the break from the axis breaks array.
|
|
3229
|
+
return breaks.reduce(function (arr, b) {
|
|
3230
|
+
if (b.to !== obj.to || b.from !== obj.from) {
|
|
3231
|
+
arr.push(b);
|
|
2933
3232
|
}
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
tick.options = options;
|
|
2938
|
-
tick.addLabel();
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
else {
|
|
2942
|
-
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
3233
|
+
return arr;
|
|
3234
|
+
}, []);
|
|
3235
|
+
};
|
|
2945
3236
|
/**
|
|
3237
|
+
* Creates a list of positions for the ticks on the axis. Filters out
|
|
3238
|
+
* positions that are outside min and max, or is inside an axis break.
|
|
3239
|
+
*
|
|
2946
3240
|
* @private
|
|
3241
|
+
*
|
|
3242
|
+
* @return {Array<number>}
|
|
3243
|
+
* List of positions.
|
|
2947
3244
|
*/
|
|
2948
|
-
function
|
|
2949
|
-
var axis = this,
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
if (e.options.data) {
|
|
2963
|
-
var treeGrid = getTreeGridFromData(e.options.data,
|
|
2964
|
-
userOptions.uniqueNames || false, 1);
|
|
2965
|
-
axis.treeGrid.collapsedNodes = (axis.treeGrid.collapsedNodes || []).concat(treeGrid.collapsedNodes);
|
|
2966
|
-
}
|
|
2967
|
-
});
|
|
2968
|
-
// Collapse all nodes in axis.treegrid.collapsednodes
|
|
2969
|
-
// where collapsed equals true.
|
|
2970
|
-
addEvent(axis, 'foundExtremes', function () {
|
|
2971
|
-
if (axis.treeGrid.collapsedNodes) {
|
|
2972
|
-
axis.treeGrid.collapsedNodes.forEach(function (node) {
|
|
2973
|
-
var breaks = axis.treeGrid.collapse(node);
|
|
2974
|
-
if (axis.brokenAxis) {
|
|
2975
|
-
axis.brokenAxis.setBreaks(breaks, false);
|
|
2976
|
-
// remove the node from the axis collapsedNodes
|
|
2977
|
-
if (axis.treeGrid.collapsedNodes) {
|
|
2978
|
-
axis.treeGrid.collapsedNodes = axis.treeGrid
|
|
2979
|
-
.collapsedNodes
|
|
2980
|
-
.filter(function (n) { return ((node.collapseStart !==
|
|
2981
|
-
n.collapseStart) ||
|
|
2982
|
-
node.collapseEnd !== n.collapseEnd); });
|
|
2983
|
-
}
|
|
2984
|
-
}
|
|
2985
|
-
});
|
|
2986
|
-
}
|
|
2987
|
-
});
|
|
2988
|
-
// If staticScale is not defined on the yAxis
|
|
2989
|
-
// and chart height is set, set axis.isDirty
|
|
2990
|
-
// to ensure collapsing works (#12012)
|
|
2991
|
-
addEvent(axis, 'afterBreaks', function () {
|
|
2992
|
-
if (axis.coll === 'yAxis' &&
|
|
2993
|
-
!axis.staticScale &&
|
|
2994
|
-
axis.chart.options.chart.height) {
|
|
2995
|
-
axis.isDirty = true;
|
|
2996
|
-
}
|
|
2997
|
-
});
|
|
2998
|
-
userOptions = merge({
|
|
2999
|
-
// Default options
|
|
3000
|
-
grid: {
|
|
3001
|
-
enabled: true
|
|
3002
|
-
},
|
|
3003
|
-
// TODO: add support for align in treegrid.
|
|
3004
|
-
labels: {
|
|
3005
|
-
align: 'left',
|
|
3006
|
-
/**
|
|
3007
|
-
* Set options on specific levels in a tree grid axis. Takes
|
|
3008
|
-
* precedence over labels options.
|
|
3009
|
-
*
|
|
3010
|
-
* @sample {gantt} gantt/treegrid-axis/labels-levels
|
|
3011
|
-
* Levels on TreeGrid Labels
|
|
3012
|
-
*
|
|
3013
|
-
* @type {Array<*>}
|
|
3014
|
-
* @product gantt
|
|
3015
|
-
* @apioption yAxis.labels.levels
|
|
3016
|
-
*
|
|
3017
|
-
* @private
|
|
3018
|
-
*/
|
|
3019
|
-
levels: [{
|
|
3020
|
-
/**
|
|
3021
|
-
* Specify the level which the options within this object
|
|
3022
|
-
* applies to.
|
|
3023
|
-
*
|
|
3024
|
-
* @type {number}
|
|
3025
|
-
* @product gantt
|
|
3026
|
-
* @apioption yAxis.labels.levels.level
|
|
3027
|
-
*
|
|
3028
|
-
* @private
|
|
3029
|
-
*/
|
|
3030
|
-
level: void 0
|
|
3031
|
-
}, {
|
|
3032
|
-
level: 1,
|
|
3033
|
-
/**
|
|
3034
|
-
* @type {Highcharts.CSSObject}
|
|
3035
|
-
* @product gantt
|
|
3036
|
-
* @apioption yAxis.labels.levels.style
|
|
3037
|
-
*
|
|
3038
|
-
* @private
|
|
3039
|
-
*/
|
|
3040
|
-
style: {
|
|
3041
|
-
/** @ignore-option */
|
|
3042
|
-
fontWeight: 'bold'
|
|
3043
|
-
}
|
|
3044
|
-
}],
|
|
3045
|
-
/**
|
|
3046
|
-
* The symbol for the collapse and expand icon in a
|
|
3047
|
-
* treegrid.
|
|
3048
|
-
*
|
|
3049
|
-
* @product gantt
|
|
3050
|
-
* @optionparent yAxis.labels.symbol
|
|
3051
|
-
*
|
|
3052
|
-
* @private
|
|
3053
|
-
*/
|
|
3054
|
-
symbol: {
|
|
3055
|
-
/**
|
|
3056
|
-
* The symbol type. Points to a definition function in
|
|
3057
|
-
* the `Highcharts.Renderer.symbols` collection.
|
|
3058
|
-
*
|
|
3059
|
-
* @type {Highcharts.SymbolKeyValue}
|
|
3060
|
-
*
|
|
3061
|
-
* @private
|
|
3062
|
-
*/
|
|
3063
|
-
type: 'triangle',
|
|
3064
|
-
x: -5,
|
|
3065
|
-
y: -5,
|
|
3066
|
-
height: 10,
|
|
3067
|
-
width: 10,
|
|
3068
|
-
padding: 5
|
|
3069
|
-
}
|
|
3070
|
-
},
|
|
3071
|
-
uniqueNames: false
|
|
3072
|
-
}, userOptions, {
|
|
3073
|
-
// Forced options
|
|
3074
|
-
reversed: true,
|
|
3075
|
-
// grid.columns is not supported in treegrid
|
|
3076
|
-
grid: {
|
|
3077
|
-
columns: void 0
|
|
3078
|
-
}
|
|
3079
|
-
});
|
|
3080
|
-
}
|
|
3081
|
-
// Now apply the original function with the original arguments,
|
|
3082
|
-
// which are sliced off this function's arguments
|
|
3083
|
-
proceed.apply(axis, [chart, userOptions]);
|
|
3084
|
-
if (isTreeGrid) {
|
|
3085
|
-
axis.hasNames = true;
|
|
3086
|
-
axis.options.showLastLabel = true;
|
|
3087
|
-
}
|
|
3088
|
-
}
|
|
3245
|
+
TreeGridAxisAdditions.prototype.getTickPositions = function () {
|
|
3246
|
+
var axis = this.axis,
|
|
3247
|
+
roundedMin = Math.floor(axis.min / axis.tickInterval) * axis.tickInterval,
|
|
3248
|
+
roundedMax = Math.ceil(axis.max / axis.tickInterval) * axis.tickInterval;
|
|
3249
|
+
return Object.keys(axis.treeGrid.mapOfPosToGridNode || {}).reduce(function (arr, key) {
|
|
3250
|
+
var pos = +key;
|
|
3251
|
+
if (pos >= roundedMin &&
|
|
3252
|
+
pos <= roundedMax &&
|
|
3253
|
+
!(axis.brokenAxis && axis.brokenAxis.isInAnyBreak(pos))) {
|
|
3254
|
+
arr.push(pos);
|
|
3255
|
+
}
|
|
3256
|
+
return arr;
|
|
3257
|
+
}, []);
|
|
3258
|
+
};
|
|
3089
3259
|
/**
|
|
3090
|
-
*
|
|
3260
|
+
* Check if a node is collapsed.
|
|
3091
3261
|
*
|
|
3092
3262
|
* @private
|
|
3093
|
-
* @function Highcharts.GridAxis#setTickInterval
|
|
3094
3263
|
*
|
|
3095
|
-
* @param {
|
|
3096
|
-
* The
|
|
3097
|
-
*/
|
|
3098
|
-
function wrapSetTickInterval(proceed) {
|
|
3099
|
-
var axis = this,
|
|
3100
|
-
options = axis.options,
|
|
3101
|
-
isTreeGrid = options.type === 'treegrid';
|
|
3102
|
-
if (isTreeGrid) {
|
|
3103
|
-
axis.min = pick(axis.userMin, options.min, axis.dataMin);
|
|
3104
|
-
axis.max = pick(axis.userMax, options.max, axis.dataMax);
|
|
3105
|
-
fireEvent(axis, 'foundExtremes');
|
|
3106
|
-
// setAxisTranslation modifies the min and max according to
|
|
3107
|
-
// axis breaks.
|
|
3108
|
-
axis.setAxisTranslation();
|
|
3109
|
-
axis.tickmarkOffset = 0.5;
|
|
3110
|
-
axis.tickInterval = 1;
|
|
3111
|
-
axis.tickPositions = axis.treeGrid.mapOfPosToGridNode ?
|
|
3112
|
-
axis.treeGrid.getTickPositions() :
|
|
3113
|
-
[];
|
|
3114
|
-
}
|
|
3115
|
-
else {
|
|
3116
|
-
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
|
3117
|
-
}
|
|
3118
|
-
}
|
|
3119
|
-
/* *
|
|
3264
|
+
* @param {Highcharts.Axis} axis
|
|
3265
|
+
* The axis to check against.
|
|
3120
3266
|
*
|
|
3121
|
-
*
|
|
3267
|
+
* @param {Object} node
|
|
3268
|
+
* The node to check if is collapsed.
|
|
3122
3269
|
*
|
|
3123
|
-
*
|
|
3270
|
+
* @param {number} pos
|
|
3271
|
+
* The tick position to collapse.
|
|
3272
|
+
*
|
|
3273
|
+
* @return {boolean}
|
|
3274
|
+
* Returns true if collapsed, false if expanded.
|
|
3275
|
+
*/
|
|
3276
|
+
TreeGridAxisAdditions.prototype.isCollapsed = function (node) {
|
|
3277
|
+
var axis = this.axis,
|
|
3278
|
+
breaks = (axis.options.breaks || []),
|
|
3279
|
+
obj = getBreakFromNode(node,
|
|
3280
|
+
axis.max);
|
|
3281
|
+
return breaks.some(function (b) {
|
|
3282
|
+
return b.from === obj.from && b.to === obj.to;
|
|
3283
|
+
});
|
|
3284
|
+
};
|
|
3124
3285
|
/**
|
|
3286
|
+
* Calculates the new axis breaks after toggling the collapse/expand
|
|
3287
|
+
* state of a node. If it is collapsed it will be expanded, and if it is
|
|
3288
|
+
* exapended it will be collapsed.
|
|
3289
|
+
*
|
|
3125
3290
|
* @private
|
|
3126
|
-
*
|
|
3291
|
+
*
|
|
3292
|
+
* @param {Highcharts.Axis} axis
|
|
3293
|
+
* The axis to check against.
|
|
3294
|
+
*
|
|
3295
|
+
* @param {Highcharts.GridNode} node
|
|
3296
|
+
* The node to toggle.
|
|
3297
|
+
*
|
|
3298
|
+
* @return {Array<object>}
|
|
3299
|
+
* Returns an array of the new breaks for the axis.
|
|
3127
3300
|
*/
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
/* *
|
|
3141
|
-
*
|
|
3142
|
-
* Functions
|
|
3143
|
-
*
|
|
3144
|
-
* */
|
|
3145
|
-
/**
|
|
3146
|
-
* Set the collapse status.
|
|
3147
|
-
*
|
|
3148
|
-
* @private
|
|
3149
|
-
*
|
|
3150
|
-
* @param {Highcharts.Axis} axis
|
|
3151
|
-
* The axis to check against.
|
|
3152
|
-
*
|
|
3153
|
-
* @param {Highcharts.GridNode} node
|
|
3154
|
-
* The node to collapse.
|
|
3155
|
-
*/
|
|
3156
|
-
Additions.prototype.setCollapsedStatus = function (node) {
|
|
3157
|
-
var axis = this.axis,
|
|
3158
|
-
chart = axis.chart;
|
|
3159
|
-
axis.series.forEach(function (series) {
|
|
3160
|
-
var data = series.options.data;
|
|
3161
|
-
if (node.id && data) {
|
|
3162
|
-
var point = chart.get(node.id),
|
|
3163
|
-
dataPoint = data[series.data.indexOf(point)];
|
|
3164
|
-
if (point && dataPoint) {
|
|
3165
|
-
point.collapsed = node.collapsed;
|
|
3166
|
-
dataPoint.collapsed = node.collapsed;
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3169
|
-
});
|
|
3170
|
-
};
|
|
3171
|
-
/**
|
|
3172
|
-
* Calculates the new axis breaks to collapse a node.
|
|
3173
|
-
*
|
|
3174
|
-
* @private
|
|
3175
|
-
*
|
|
3176
|
-
* @param {Highcharts.Axis} axis
|
|
3177
|
-
* The axis to check against.
|
|
3178
|
-
*
|
|
3179
|
-
* @param {Highcharts.GridNode} node
|
|
3180
|
-
* The node to collapse.
|
|
3181
|
-
*
|
|
3182
|
-
* @param {number} pos
|
|
3183
|
-
* The tick position to collapse.
|
|
3184
|
-
*
|
|
3185
|
-
* @return {Array<object>}
|
|
3186
|
-
* Returns an array of the new breaks for the axis.
|
|
3187
|
-
*/
|
|
3188
|
-
Additions.prototype.collapse = function (node) {
|
|
3189
|
-
var axis = this.axis,
|
|
3190
|
-
breaks = (axis.options.breaks || []),
|
|
3191
|
-
obj = getBreakFromNode(node,
|
|
3192
|
-
axis.max);
|
|
3193
|
-
breaks.push(obj);
|
|
3194
|
-
// Change the collapsed flag #13838
|
|
3195
|
-
node.collapsed = true;
|
|
3196
|
-
axis.treeGrid.setCollapsedStatus(node);
|
|
3197
|
-
return breaks;
|
|
3198
|
-
};
|
|
3199
|
-
/**
|
|
3200
|
-
* Calculates the new axis breaks to expand a node.
|
|
3201
|
-
*
|
|
3202
|
-
* @private
|
|
3203
|
-
*
|
|
3204
|
-
* @param {Highcharts.Axis} axis
|
|
3205
|
-
* The axis to check against.
|
|
3206
|
-
*
|
|
3207
|
-
* @param {Highcharts.GridNode} node
|
|
3208
|
-
* The node to expand.
|
|
3209
|
-
*
|
|
3210
|
-
* @param {number} pos
|
|
3211
|
-
* The tick position to expand.
|
|
3212
|
-
*
|
|
3213
|
-
* @return {Array<object>}
|
|
3214
|
-
* Returns an array of the new breaks for the axis.
|
|
3215
|
-
*/
|
|
3216
|
-
Additions.prototype.expand = function (node) {
|
|
3217
|
-
var axis = this.axis,
|
|
3218
|
-
breaks = (axis.options.breaks || []),
|
|
3219
|
-
obj = getBreakFromNode(node,
|
|
3220
|
-
axis.max);
|
|
3221
|
-
// Change the collapsed flag #13838
|
|
3222
|
-
node.collapsed = false;
|
|
3223
|
-
axis.treeGrid.setCollapsedStatus(node);
|
|
3224
|
-
// Remove the break from the axis breaks array.
|
|
3225
|
-
return breaks.reduce(function (arr, b) {
|
|
3226
|
-
if (b.to !== obj.to || b.from !== obj.from) {
|
|
3227
|
-
arr.push(b);
|
|
3228
|
-
}
|
|
3229
|
-
return arr;
|
|
3230
|
-
}, []);
|
|
3231
|
-
};
|
|
3232
|
-
/**
|
|
3233
|
-
* Creates a list of positions for the ticks on the axis. Filters out
|
|
3234
|
-
* positions that are outside min and max, or is inside an axis break.
|
|
3235
|
-
*
|
|
3236
|
-
* @private
|
|
3237
|
-
*
|
|
3238
|
-
* @return {Array<number>}
|
|
3239
|
-
* List of positions.
|
|
3240
|
-
*/
|
|
3241
|
-
Additions.prototype.getTickPositions = function () {
|
|
3242
|
-
var axis = this.axis,
|
|
3243
|
-
roundedMin = Math.floor(axis.min / axis.tickInterval) * axis.tickInterval,
|
|
3244
|
-
roundedMax = Math.ceil(axis.max / axis.tickInterval) * axis.tickInterval;
|
|
3245
|
-
return Object.keys(axis.treeGrid.mapOfPosToGridNode || {}).reduce(function (arr, key) {
|
|
3246
|
-
var pos = +key;
|
|
3247
|
-
if (pos >= roundedMin &&
|
|
3248
|
-
pos <= roundedMax &&
|
|
3249
|
-
!(axis.brokenAxis && axis.brokenAxis.isInAnyBreak(pos))) {
|
|
3250
|
-
arr.push(pos);
|
|
3251
|
-
}
|
|
3252
|
-
return arr;
|
|
3253
|
-
}, []);
|
|
3254
|
-
};
|
|
3255
|
-
/**
|
|
3256
|
-
* Check if a node is collapsed.
|
|
3257
|
-
*
|
|
3258
|
-
* @private
|
|
3259
|
-
*
|
|
3260
|
-
* @param {Highcharts.Axis} axis
|
|
3261
|
-
* The axis to check against.
|
|
3262
|
-
*
|
|
3263
|
-
* @param {Object} node
|
|
3264
|
-
* The node to check if is collapsed.
|
|
3265
|
-
*
|
|
3266
|
-
* @param {number} pos
|
|
3267
|
-
* The tick position to collapse.
|
|
3268
|
-
*
|
|
3269
|
-
* @return {boolean}
|
|
3270
|
-
* Returns true if collapsed, false if expanded.
|
|
3271
|
-
*/
|
|
3272
|
-
Additions.prototype.isCollapsed = function (node) {
|
|
3273
|
-
var axis = this.axis,
|
|
3274
|
-
breaks = (axis.options.breaks || []),
|
|
3275
|
-
obj = getBreakFromNode(node,
|
|
3276
|
-
axis.max);
|
|
3277
|
-
return breaks.some(function (b) {
|
|
3278
|
-
return b.from === obj.from && b.to === obj.to;
|
|
3279
|
-
});
|
|
3280
|
-
};
|
|
3281
|
-
/**
|
|
3282
|
-
* Calculates the new axis breaks after toggling the collapse/expand
|
|
3283
|
-
* state of a node. If it is collapsed it will be expanded, and if it is
|
|
3284
|
-
* exapended it will be collapsed.
|
|
3285
|
-
*
|
|
3286
|
-
* @private
|
|
3287
|
-
*
|
|
3288
|
-
* @param {Highcharts.Axis} axis
|
|
3289
|
-
* The axis to check against.
|
|
3290
|
-
*
|
|
3291
|
-
* @param {Highcharts.GridNode} node
|
|
3292
|
-
* The node to toggle.
|
|
3293
|
-
*
|
|
3294
|
-
* @return {Array<object>}
|
|
3295
|
-
* Returns an array of the new breaks for the axis.
|
|
3296
|
-
*/
|
|
3297
|
-
Additions.prototype.toggleCollapse = function (node) {
|
|
3298
|
-
return (this.isCollapsed(node) ?
|
|
3299
|
-
this.expand(node) :
|
|
3300
|
-
this.collapse(node));
|
|
3301
|
-
};
|
|
3302
|
-
return Additions;
|
|
3303
|
-
}());
|
|
3304
|
-
TreeGridAxis.Additions = Additions;
|
|
3305
|
-
})(TreeGridAxis || (TreeGridAxis = {}));
|
|
3301
|
+
TreeGridAxisAdditions.prototype.toggleCollapse = function (node) {
|
|
3302
|
+
return (this.isCollapsed(node) ?
|
|
3303
|
+
this.expand(node) :
|
|
3304
|
+
this.collapse(node));
|
|
3305
|
+
};
|
|
3306
|
+
return TreeGridAxisAdditions;
|
|
3307
|
+
}());
|
|
3308
|
+
/* *
|
|
3309
|
+
*
|
|
3310
|
+
* Default Export
|
|
3311
|
+
*
|
|
3312
|
+
* */
|
|
3306
3313
|
|
|
3307
|
-
return
|
|
3314
|
+
return TreeGridAxisAdditions;
|
|
3308
3315
|
});
|
|
3309
|
-
_registerModule(_modules, 'masters/modules/treegrid.src.js', [_modules['Core/Globals.js'], _modules['Core/Axis/TreeGridAxis.js']], function (Highcharts, TreeGridAxis) {
|
|
3316
|
+
_registerModule(_modules, 'masters/modules/treegrid.src.js', [_modules['Core/Globals.js'], _modules['Core/Axis/TreeGrid/TreeGridAxis.js']], function (Highcharts, TreeGridAxis) {
|
|
3310
3317
|
|
|
3311
3318
|
var G = Highcharts;
|
|
3312
3319
|
// Compositions
|