highcharts 6.1.4 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bower.json +1 -1
- package/css/highcharts.css +17 -0
- package/css/highcharts.scss +14 -0
- package/css/themes/dark-unica.css +17 -0
- package/css/themes/grid-light.css +17 -0
- package/css/themes/sand-signika.css +17 -0
- package/es-modules/indicators/momentum.src.js +1 -1
- package/es-modules/indicators/pivot-points.src.js +6 -1
- package/es-modules/masters/highcharts-gantt.src.js +11 -0
- package/es-modules/masters/modules/annotations.src.js +1 -1
- package/es-modules/masters/modules/arrow-symbols.src.js +12 -0
- package/es-modules/masters/modules/broken-axis.src.js +1 -1
- package/es-modules/masters/modules/current-date-indicator.src.js +12 -0
- package/es-modules/masters/modules/data.src.js +1 -1
- package/es-modules/masters/modules/draggable-points.src.js +9 -0
- package/es-modules/masters/modules/export-data.src.js +1 -1
- package/es-modules/masters/modules/exporting.src.js +1 -1
- package/es-modules/masters/modules/funnel.src.js +1 -1
- package/es-modules/masters/modules/gantt.src.js +2 -1
- 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/item-series.src.js +1 -1
- package/es-modules/masters/modules/map.src.js +1 -1
- package/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
- package/es-modules/masters/modules/pathfinder.src.js +12 -0
- package/es-modules/masters/modules/sankey.src.js +1 -1
- package/es-modules/masters/modules/series-label.src.js +1 -1
- package/es-modules/masters/modules/solid-gauge.src.js +1 -1
- package/es-modules/masters/modules/stock.src.js +1 -1
- package/es-modules/masters/modules/streamgraph.src.js +1 -1
- package/es-modules/masters/modules/treegrid.src.js +12 -0
- 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/windbarb.src.js +1 -1
- package/es-modules/masters/modules/xrange.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/sand-signika.src.js +1 -1
- package/es-modules/masters/themes/skies.src.js +1 -1
- package/es-modules/mixins/centered-series.js +1 -1
- package/es-modules/mixins/on-series.js +1 -1
- package/es-modules/modules/boost.src.js +22 -14
- package/es-modules/modules/broken-axis.src.js +169 -134
- package/es-modules/modules/data.src.js +2 -2
- package/es-modules/modules/draggable-points.src.js +2257 -0
- package/es-modules/modules/drilldown.src.js +1 -0
- package/es-modules/modules/export-data.src.js +1 -1
- package/es-modules/modules/exporting.src.js +1 -1
- package/es-modules/modules/funnel.src.js +1 -1
- package/es-modules/modules/item-series.src.js +1 -1
- package/es-modules/modules/no-data-to-display.src.js +5 -5
- package/es-modules/modules/oldie.src.js +1 -1
- package/es-modules/modules/overlapping-datalabels.src.js +38 -22
- package/es-modules/modules/parallel-coordinates.src.js +3 -2
- package/es-modules/modules/sankey.src.js +1 -1
- package/es-modules/modules/series-label.src.js +2 -2
- package/es-modules/modules/solid-gauge.src.js +1 -1
- package/es-modules/modules/static-scale.src.js +67 -28
- package/es-modules/modules/streamgraph.src.js +1 -1
- package/es-modules/modules/tilemap.src.js +231 -134
- package/es-modules/modules/variwide.src.js +1 -1
- package/es-modules/modules/vector.src.js +92 -22
- package/es-modules/modules/windbarb.src.js +1 -1
- package/es-modules/modules/xrange.src.js +257 -77
- package/es-modules/parts/AreaSeries.js +77 -77
- package/es-modules/parts/AreaSplineSeries.js +64 -27
- package/es-modules/parts/Axis.js +160 -67
- package/es-modules/parts/BarSeries.js +68 -51
- package/es-modules/parts/CandlestickSeries.js +1 -1
- package/es-modules/parts/Chart.js +31 -55
- package/es-modules/parts/Color.js +29 -18
- package/es-modules/parts/ColumnSeries.js +264 -142
- package/es-modules/parts/DataGrouping.js +9 -6
- package/es-modules/parts/DataLabels.js +261 -210
- package/es-modules/parts/DateTimeAxis.js +26 -7
- package/es-modules/parts/Dynamics.js +5 -2
- package/es-modules/parts/FlagsSeries.js +1 -1
- package/es-modules/parts/Globals.js +1 -1
- package/es-modules/parts/Html.js +64 -12
- package/es-modules/parts/Interaction.js +187 -63
- package/es-modules/parts/Legend.js +7 -3
- package/es-modules/parts/LogarithmicAxis.js +35 -4
- package/es-modules/parts/MSPointer.js +1 -1
- package/es-modules/parts/Navigator.js +27 -5
- package/es-modules/parts/OHLCSeries.js +1 -1
- package/es-modules/parts/Options.js +15 -13
- package/es-modules/parts/OrdinalAxis.js +1 -1
- package/es-modules/parts/PieSeries.js +256 -140
- package/es-modules/parts/PlotBandSeries.experimental.js +1 -1
- package/es-modules/parts/PlotLineOrBand.js +7 -40
- package/es-modules/parts/Point.js +28 -4
- package/es-modules/parts/Pointer.js +8 -6
- package/es-modules/parts/RangeSelector.js +1 -1
- package/es-modules/parts/Responsive.js +82 -36
- package/es-modules/parts/ScatterSeries.js +57 -25
- package/es-modules/parts/ScrollablePlotArea.js +17 -7
- package/es-modules/parts/Scrollbar.js +9 -2
- package/es-modules/parts/Series.js +22 -9
- package/es-modules/parts/SplineSeries.js +51 -29
- package/es-modules/parts/Stacking.js +100 -6
- package/es-modules/parts/StockChart.js +9 -3
- package/es-modules/parts/SvgRenderer.js +15 -10
- package/es-modules/parts/Tick.js +150 -30
- package/es-modules/parts/Time.js +23 -5
- package/es-modules/parts/Tooltip.js +2 -2
- package/es-modules/parts/TouchPointer.js +1 -1
- package/es-modules/parts/Utilities.js +16 -1
- package/es-modules/parts-3d/Axis.js +1 -1
- package/es-modules/parts-3d/Chart.js +1 -1
- package/es-modules/parts-3d/Column.js +1 -1
- package/es-modules/parts-3d/Math.js +1 -1
- package/es-modules/parts-3d/Pie.js +1 -1
- package/es-modules/parts-3d/SVGRenderer.js +1 -1
- package/es-modules/parts-3d/Scatter.js +1 -1
- package/es-modules/parts-3d/Series.js +1 -1
- package/es-modules/parts-3d/VMLRenderer.js +1 -1
- package/es-modules/parts-gantt/ArrowSymbols.js +110 -0
- package/es-modules/parts-gantt/CurrentDateIndicator.js +92 -0
- package/es-modules/parts-gantt/GanttChart.js +111 -0
- package/es-modules/parts-gantt/GanttSeries.js +376 -0
- package/es-modules/parts-gantt/GridAxis.js +965 -0
- package/es-modules/parts-gantt/Pathfinder.js +1247 -0
- package/es-modules/parts-gantt/PathfinderAlgorithms.js +746 -0
- package/es-modules/parts-gantt/Tree.js +146 -0
- package/es-modules/parts-gantt/TreeGrid.js +917 -0
- package/es-modules/parts-map/ColorAxis.js +1 -1
- package/es-modules/parts-map/ColorSeriesMixin.js +1 -1
- package/es-modules/parts-map/GeoJSON.js +1 -1
- package/es-modules/parts-map/HeatmapSeries.js +124 -53
- package/es-modules/parts-map/Map.js +1 -1
- package/es-modules/parts-map/MapAxis.js +1 -1
- package/es-modules/parts-map/MapBubbleSeries.js +1 -1
- package/es-modules/parts-map/MapLineSeries.js +1 -1
- package/es-modules/parts-map/MapNavigation.js +1 -1
- package/es-modules/parts-map/MapPointSeries.js +1 -1
- package/es-modules/parts-map/MapPointer.js +1 -1
- package/es-modules/parts-map/MapSeries.js +2 -2
- package/es-modules/parts-more/AreaRangeSeries.js +80 -38
- package/es-modules/parts-more/AreaSplineRangeSeries.js +1 -1
- package/es-modules/parts-more/BoxPlotSeries.js +1 -1
- package/es-modules/parts-more/BubbleSeries.js +1 -1
- package/es-modules/parts-more/ColumnRangeSeries.js +1 -1
- package/es-modules/parts-more/ErrorBarSeries.js +1 -1
- package/es-modules/parts-more/GaugeSeries.js +1 -1
- package/es-modules/parts-more/Pane.js +2 -1
- package/es-modules/parts-more/Polar.js +1 -1
- package/es-modules/parts-more/PolygonSeries.js +1 -1
- package/es-modules/parts-more/RadialAxis.js +5 -4
- package/es-modules/parts-more/WaterfallSeries.js +1 -1
- package/es-modules/supplemental.docs.js +0 -1955
- package/es-modules/themes/dark-blue.js +1 -1
- package/es-modules/themes/dark-green.js +1 -1
- package/es-modules/themes/dark-unica.js +1 -1
- package/es-modules/themes/gray.js +1 -1
- package/es-modules/themes/grid-light.js +1 -1
- package/es-modules/themes/grid.js +1 -1
- package/es-modules/themes/sand-signika.js +1 -1
- package/es-modules/themes/skies.js +1 -1
- package/highcharts-3d.js +1 -1
- package/highcharts-3d.src.js +10 -10
- package/highcharts-gantt.js +503 -0
- package/highcharts-gantt.js.map +1 -0
- package/highcharts-gantt.src.js +49289 -0
- package/highcharts-more.js +65 -64
- package/highcharts-more.js.map +1 -1
- package/highcharts-more.src.js +97 -53
- package/highcharts.js +415 -410
- package/highcharts.js.map +1 -1
- package/highcharts.src.js +2170 -1128
- package/highmaps.js +443 -438
- package/highmaps.js.map +1 -1
- package/highmaps.src.js +1647 -849
- package/highstock.js +553 -548
- package/highstock.js.map +1 -1
- package/highstock.src.js +2398 -1283
- package/indicators/accumulation-distribution.js +1 -1
- package/indicators/accumulation-distribution.src.js +1 -1
- package/indicators/atr.js +1 -1
- package/indicators/atr.src.js +1 -1
- package/indicators/bollinger-bands.js +1 -1
- package/indicators/bollinger-bands.src.js +1 -1
- package/indicators/cci.js +1 -1
- package/indicators/cci.src.js +1 -1
- package/indicators/cmf.js +1 -1
- package/indicators/cmf.src.js +1 -1
- package/indicators/ema.js +1 -1
- package/indicators/ema.src.js +1 -1
- package/indicators/ichimoku-kinko-hyo.js +1 -1
- package/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/indicators/indicators.js +1 -1
- package/indicators/indicators.src.js +1 -1
- package/indicators/macd.js +1 -1
- package/indicators/macd.src.js +1 -1
- package/indicators/mfi.js +1 -1
- package/indicators/mfi.src.js +1 -1
- package/indicators/momentum.js +1 -1
- package/indicators/momentum.src.js +2 -2
- package/indicators/pivot-points.js +4 -4
- package/indicators/pivot-points.js.map +1 -1
- package/indicators/pivot-points.src.js +7 -2
- package/indicators/price-envelopes.js +1 -1
- package/indicators/price-envelopes.src.js +1 -1
- package/indicators/psar.js +1 -1
- package/indicators/psar.src.js +1 -1
- package/indicators/roc.js +1 -1
- package/indicators/roc.src.js +1 -1
- package/indicators/rsi.js +1 -1
- package/indicators/rsi.src.js +1 -1
- package/indicators/stochastic.js +1 -1
- package/indicators/stochastic.src.js +1 -1
- package/indicators/volume-by-price.js +1 -1
- package/indicators/volume-by-price.src.js +1 -1
- package/indicators/vwap.js +1 -1
- package/indicators/vwap.src.js +1 -1
- package/indicators/wma.js +1 -1
- package/indicators/wma.src.js +1 -1
- package/indicators/zigzag.js +1 -1
- package/indicators/zigzag.src.js +1 -1
- package/js/es-modules/indicators/momentum.src.js +1 -1
- package/js/es-modules/indicators/pivot-points.src.js +6 -1
- package/js/es-modules/masters/highcharts-gantt.src.js +11 -0
- package/js/es-modules/masters/modules/annotations.src.js +1 -1
- package/js/es-modules/masters/modules/arrow-symbols.src.js +12 -0
- package/js/es-modules/masters/modules/broken-axis.src.js +1 -1
- package/js/es-modules/masters/modules/current-date-indicator.src.js +12 -0
- package/js/es-modules/masters/modules/data.src.js +1 -1
- package/js/es-modules/masters/modules/draggable-points.src.js +9 -0
- package/js/es-modules/masters/modules/export-data.src.js +1 -1
- package/js/es-modules/masters/modules/exporting.src.js +1 -1
- package/js/es-modules/masters/modules/funnel.src.js +1 -1
- package/js/es-modules/masters/modules/gantt.src.js +2 -1
- package/js/es-modules/masters/modules/grid-axis.src.js +1 -1
- package/js/es-modules/masters/modules/heatmap.src.js +1 -1
- package/js/es-modules/masters/modules/item-series.src.js +1 -1
- package/js/es-modules/masters/modules/map.src.js +1 -1
- package/js/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
- package/js/es-modules/masters/modules/pathfinder.src.js +12 -0
- package/js/es-modules/masters/modules/sankey.src.js +1 -1
- package/js/es-modules/masters/modules/series-label.src.js +1 -1
- package/js/es-modules/masters/modules/solid-gauge.src.js +1 -1
- package/js/es-modules/masters/modules/stock.src.js +1 -1
- package/js/es-modules/masters/modules/streamgraph.src.js +1 -1
- package/js/es-modules/masters/modules/treegrid.src.js +12 -0
- package/js/es-modules/masters/modules/variwide.src.js +1 -1
- package/js/es-modules/masters/modules/vector.src.js +1 -1
- package/js/es-modules/masters/modules/windbarb.src.js +1 -1
- package/js/es-modules/masters/modules/xrange.src.js +1 -1
- package/js/es-modules/masters/themes/dark-blue.src.js +1 -1
- package/js/es-modules/masters/themes/dark-green.src.js +1 -1
- package/js/es-modules/masters/themes/dark-unica.src.js +1 -1
- package/js/es-modules/masters/themes/gray.src.js +1 -1
- package/js/es-modules/masters/themes/grid-light.src.js +1 -1
- package/js/es-modules/masters/themes/grid.src.js +1 -1
- package/js/es-modules/masters/themes/sand-signika.src.js +1 -1
- package/js/es-modules/masters/themes/skies.src.js +1 -1
- package/js/es-modules/mixins/centered-series.js +1 -1
- package/js/es-modules/mixins/on-series.js +1 -1
- package/js/es-modules/modules/boost.src.js +22 -14
- package/js/es-modules/modules/broken-axis.src.js +169 -134
- package/js/es-modules/modules/data.src.js +2 -2
- package/js/es-modules/modules/draggable-points.src.js +2257 -0
- package/js/es-modules/modules/drilldown.src.js +1 -0
- package/js/es-modules/modules/export-data.src.js +1 -1
- package/js/es-modules/modules/exporting.src.js +1 -1
- package/js/es-modules/modules/funnel.src.js +1 -1
- package/js/es-modules/modules/item-series.src.js +1 -1
- package/js/es-modules/modules/no-data-to-display.src.js +5 -5
- package/js/es-modules/modules/oldie.src.js +1 -1
- package/js/es-modules/modules/overlapping-datalabels.src.js +38 -22
- package/js/es-modules/modules/parallel-coordinates.src.js +3 -2
- package/js/es-modules/modules/sankey.src.js +1 -1
- package/js/es-modules/modules/series-label.src.js +2 -2
- package/js/es-modules/modules/solid-gauge.src.js +1 -1
- package/js/es-modules/modules/static-scale.src.js +67 -28
- package/js/es-modules/modules/streamgraph.src.js +1 -1
- package/js/es-modules/modules/tilemap.src.js +231 -134
- package/js/es-modules/modules/variwide.src.js +1 -1
- package/js/es-modules/modules/vector.src.js +92 -22
- package/js/es-modules/modules/windbarb.src.js +1 -1
- package/js/es-modules/modules/xrange.src.js +255 -68
- package/js/es-modules/parts/AreaSeries.js +77 -77
- package/js/es-modules/parts/AreaSplineSeries.js +64 -27
- package/js/es-modules/parts/Axis.js +160 -67
- package/js/es-modules/parts/BarSeries.js +68 -51
- package/js/es-modules/parts/CandlestickSeries.js +1 -1
- package/js/es-modules/parts/Chart.js +31 -55
- package/js/es-modules/parts/Color.js +29 -18
- package/js/es-modules/parts/ColumnSeries.js +231 -123
- package/js/es-modules/parts/DataGrouping.js +9 -6
- package/js/es-modules/parts/DataLabels.js +230 -182
- package/js/es-modules/parts/DateTimeAxis.js +26 -7
- package/js/es-modules/parts/Dynamics.js +5 -2
- package/js/es-modules/parts/FlagsSeries.js +1 -1
- package/js/es-modules/parts/Globals.js +1 -1
- package/js/es-modules/parts/Html.js +64 -12
- package/js/es-modules/parts/Interaction.js +178 -61
- package/js/es-modules/parts/Legend.js +7 -3
- package/js/es-modules/parts/LogarithmicAxis.js +35 -4
- package/js/es-modules/parts/MSPointer.js +1 -1
- package/js/es-modules/parts/Navigator.js +27 -5
- package/js/es-modules/parts/OHLCSeries.js +1 -1
- package/js/es-modules/parts/Options.js +13 -12
- package/js/es-modules/parts/OrdinalAxis.js +1 -1
- package/js/es-modules/parts/PieSeries.js +245 -132
- package/js/es-modules/parts/PlotBandSeries.experimental.js +1 -1
- package/js/es-modules/parts/PlotLineOrBand.js +7 -40
- package/js/es-modules/parts/Point.js +28 -4
- package/js/es-modules/parts/Pointer.js +8 -6
- package/js/es-modules/parts/RangeSelector.js +1 -1
- package/js/es-modules/parts/Responsive.js +82 -36
- package/js/es-modules/parts/ScatterSeries.js +56 -25
- package/js/es-modules/parts/ScrollablePlotArea.js +17 -7
- package/js/es-modules/parts/Scrollbar.js +9 -2
- package/js/es-modules/parts/Series.js +22 -9
- package/js/es-modules/parts/SplineSeries.js +51 -29
- package/js/es-modules/parts/Stacking.js +100 -6
- package/js/es-modules/parts/StockChart.js +9 -3
- package/js/es-modules/parts/SvgRenderer.js +15 -10
- package/js/es-modules/parts/Tick.js +150 -30
- package/js/es-modules/parts/Time.js +23 -5
- package/js/es-modules/parts/Tooltip.js +2 -2
- package/js/es-modules/parts/TouchPointer.js +1 -1
- package/js/es-modules/parts/Utilities.js +16 -1
- package/js/es-modules/parts-3d/Axis.js +1 -1
- package/js/es-modules/parts-3d/Chart.js +1 -1
- package/js/es-modules/parts-3d/Column.js +1 -1
- package/js/es-modules/parts-3d/Math.js +1 -1
- package/js/es-modules/parts-3d/Pie.js +1 -1
- package/js/es-modules/parts-3d/SVGRenderer.js +1 -1
- package/js/es-modules/parts-3d/Scatter.js +1 -1
- package/js/es-modules/parts-3d/Series.js +1 -1
- package/js/es-modules/parts-3d/VMLRenderer.js +1 -1
- package/js/es-modules/parts-gantt/ArrowSymbols.js +110 -0
- package/js/es-modules/parts-gantt/CurrentDateIndicator.js +92 -0
- package/js/es-modules/parts-gantt/GanttChart.js +111 -0
- package/js/es-modules/parts-gantt/GanttSeries.js +371 -0
- package/js/es-modules/parts-gantt/GridAxis.js +962 -0
- package/js/es-modules/parts-gantt/Pathfinder.js +1225 -0
- package/js/es-modules/parts-gantt/PathfinderAlgorithms.js +746 -0
- package/js/es-modules/parts-gantt/Tree.js +146 -0
- package/js/es-modules/parts-gantt/TreeGrid.js +891 -0
- package/js/es-modules/parts-map/ColorAxis.js +1 -1
- package/js/es-modules/parts-map/ColorSeriesMixin.js +1 -1
- package/js/es-modules/parts-map/GeoJSON.js +1 -1
- package/js/es-modules/parts-map/HeatmapSeries.js +122 -52
- package/js/es-modules/parts-map/Map.js +1 -1
- package/js/es-modules/parts-map/MapAxis.js +1 -1
- package/js/es-modules/parts-map/MapBubbleSeries.js +1 -1
- package/js/es-modules/parts-map/MapLineSeries.js +1 -1
- package/js/es-modules/parts-map/MapNavigation.js +1 -1
- package/js/es-modules/parts-map/MapPointSeries.js +1 -1
- package/js/es-modules/parts-map/MapPointer.js +1 -1
- package/js/es-modules/parts-map/MapSeries.js +2 -2
- package/js/es-modules/parts-more/AreaRangeSeries.js +80 -38
- package/js/es-modules/parts-more/AreaSplineRangeSeries.js +1 -1
- package/js/es-modules/parts-more/BoxPlotSeries.js +1 -1
- package/js/es-modules/parts-more/BubbleSeries.js +1 -1
- package/js/es-modules/parts-more/ColumnRangeSeries.js +1 -1
- package/js/es-modules/parts-more/ErrorBarSeries.js +1 -1
- package/js/es-modules/parts-more/GaugeSeries.js +1 -1
- package/js/es-modules/parts-more/Pane.js +2 -1
- package/js/es-modules/parts-more/Polar.js +1 -1
- package/js/es-modules/parts-more/PolygonSeries.js +1 -1
- package/js/es-modules/parts-more/RadialAxis.js +5 -4
- package/js/es-modules/parts-more/WaterfallSeries.js +1 -1
- package/js/es-modules/supplemental.docs.js +0 -1955
- package/js/es-modules/themes/dark-blue.js +1 -1
- package/js/es-modules/themes/dark-green.js +1 -1
- package/js/es-modules/themes/dark-unica.js +1 -1
- package/js/es-modules/themes/gray.js +1 -1
- package/js/es-modules/themes/grid-light.js +1 -1
- package/js/es-modules/themes/grid.js +1 -1
- package/js/es-modules/themes/sand-signika.js +1 -1
- package/js/es-modules/themes/skies.js +1 -1
- package/js/highcharts-3d.js +1 -1
- package/js/highcharts-3d.src.js +10 -10
- package/js/highcharts-gantt.js +480 -0
- package/js/highcharts-gantt.js.map +1 -0
- package/js/highcharts-gantt.src.js +47011 -0
- package/js/highcharts-more.js +62 -61
- package/js/highcharts-more.js.map +1 -1
- package/js/highcharts-more.src.js +97 -53
- package/js/highcharts.js +394 -390
- package/js/highcharts.js.map +1 -1
- package/js/highcharts.src.js +2083 -1070
- package/js/highmaps.js +420 -416
- package/js/highmaps.js.map +1 -1
- package/js/highmaps.src.js +1569 -798
- package/js/highstock.js +526 -520
- package/js/highstock.js.map +1 -1
- package/js/highstock.src.js +2311 -1225
- package/js/indicators/accumulation-distribution.js +1 -1
- package/js/indicators/accumulation-distribution.src.js +1 -1
- package/js/indicators/atr.js +1 -1
- package/js/indicators/atr.src.js +1 -1
- package/js/indicators/bollinger-bands.js +1 -1
- package/js/indicators/bollinger-bands.src.js +1 -1
- package/js/indicators/cci.js +1 -1
- package/js/indicators/cci.src.js +1 -1
- package/js/indicators/cmf.js +1 -1
- package/js/indicators/cmf.src.js +1 -1
- package/js/indicators/ema.js +1 -1
- package/js/indicators/ema.src.js +1 -1
- package/js/indicators/ichimoku-kinko-hyo.js +1 -1
- package/js/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/js/indicators/indicators.js +1 -1
- package/js/indicators/indicators.src.js +1 -1
- package/js/indicators/macd.js +1 -1
- package/js/indicators/macd.src.js +1 -1
- package/js/indicators/mfi.js +1 -1
- package/js/indicators/mfi.src.js +1 -1
- package/js/indicators/momentum.js +1 -1
- package/js/indicators/momentum.src.js +2 -2
- package/js/indicators/pivot-points.js +4 -4
- package/js/indicators/pivot-points.js.map +1 -1
- package/js/indicators/pivot-points.src.js +7 -2
- package/js/indicators/price-envelopes.js +1 -1
- package/js/indicators/price-envelopes.src.js +1 -1
- package/js/indicators/psar.js +1 -1
- package/js/indicators/psar.src.js +1 -1
- package/js/indicators/roc.js +1 -1
- package/js/indicators/roc.src.js +1 -1
- package/js/indicators/rsi.js +1 -1
- package/js/indicators/rsi.src.js +1 -1
- package/js/indicators/stochastic.js +1 -1
- package/js/indicators/stochastic.src.js +1 -1
- package/js/indicators/volume-by-price.js +1 -1
- package/js/indicators/volume-by-price.src.js +1 -1
- package/js/indicators/vwap.js +1 -1
- package/js/indicators/vwap.src.js +1 -1
- package/js/indicators/wma.js +1 -1
- package/js/indicators/wma.src.js +1 -1
- package/js/indicators/zigzag.js +1 -1
- package/js/indicators/zigzag.src.js +1 -1
- package/js/modules/accessibility.js +1 -1
- package/js/modules/accessibility.src.js +1 -1
- package/js/modules/annotations.js +2 -2
- package/js/modules/annotations.src.js +2 -2
- package/js/modules/arrow-symbols.js +13 -0
- package/js/modules/arrow-symbols.js.map +1 -0
- package/js/modules/arrow-symbols.src.js +138 -0
- package/js/modules/boost-canvas.js +1 -1
- package/js/modules/boost-canvas.src.js +1 -1
- package/js/modules/boost.js +43 -43
- package/js/modules/boost.js.map +1 -1
- package/js/modules/boost.src.js +23 -15
- package/js/modules/broken-axis.js +11 -10
- package/js/modules/broken-axis.js.map +1 -1
- package/js/modules/broken-axis.src.js +171 -136
- package/js/modules/bullet.js +1 -1
- package/js/modules/bullet.src.js +1 -1
- package/js/modules/current-date-indicator.js +13 -0
- package/js/modules/current-date-indicator.js.map +1 -0
- package/js/modules/current-date-indicator.src.js +120 -0
- package/js/modules/data.js +2 -2
- package/js/modules/data.src.js +4 -4
- package/js/modules/drag-panes.js +1 -1
- package/js/modules/drag-panes.src.js +1 -1
- package/js/modules/draggable-points.js +38 -0
- package/js/modules/draggable-points.js.map +1 -0
- package/js/modules/draggable-points.src.js +2281 -0
- package/js/modules/drilldown.js +1 -1
- package/js/modules/drilldown.js.map +1 -1
- package/js/modules/drilldown.src.js +2 -1
- package/js/modules/export-data.js +2 -2
- package/js/modules/export-data.src.js +3 -3
- package/js/modules/exporting.js +2 -2
- package/js/modules/exporting.src.js +3 -3
- package/js/modules/funnel.js +2 -2
- package/js/modules/funnel.src.js +3 -3
- package/js/modules/gantt.js +80 -18
- package/js/modules/gantt.js.map +1 -1
- package/js/modules/gantt.src.js +5490 -372
- package/js/modules/grid-axis.js +15 -11
- package/js/modules/grid-axis.js.map +1 -1
- package/js/modules/grid-axis.src.js +731 -293
- package/js/modules/heatmap.js +2 -2
- package/js/modules/heatmap.js.map +1 -1
- package/js/modules/heatmap.src.js +126 -56
- package/js/modules/histogram-bellcurve.js +1 -1
- package/js/modules/histogram-bellcurve.src.js +1 -1
- package/js/modules/item-series.js +2 -2
- package/js/modules/item-series.src.js +3 -3
- package/js/modules/map.js +2 -2
- package/js/modules/map.js.map +1 -1
- package/js/modules/map.src.js +137 -67
- package/js/modules/no-data-to-display.js +1 -1
- package/js/modules/no-data-to-display.src.js +6 -6
- package/js/modules/offline-exporting.js +2 -2
- package/js/modules/offline-exporting.src.js +2 -2
- package/js/modules/oldie.js +2 -2
- package/js/modules/oldie.src.js +3 -3
- package/js/modules/overlapping-datalabels.js +2 -2
- package/js/modules/overlapping-datalabels.src.js +2 -2
- package/js/modules/parallel-coordinates.js +9 -9
- package/js/modules/parallel-coordinates.js.map +1 -1
- package/js/modules/parallel-coordinates.src.js +4 -3
- package/js/modules/pareto.js +1 -1
- package/js/modules/pareto.src.js +1 -1
- package/js/modules/pathfinder.js +34 -0
- package/js/modules/pathfinder.js.map +1 -0
- package/js/modules/pathfinder.src.js +2106 -0
- package/js/modules/pattern-fill.js +1 -1
- package/js/modules/pattern-fill.src.js +1 -1
- package/js/modules/sankey.js +2 -2
- package/js/modules/sankey.src.js +3 -3
- package/js/modules/series-label.js +2 -2
- package/js/modules/series-label.src.js +4 -4
- package/js/modules/solid-gauge.js +2 -2
- package/js/modules/solid-gauge.src.js +3 -3
- package/js/modules/static-scale.js +3 -3
- package/js/modules/static-scale.js.map +1 -1
- package/js/modules/static-scale.src.js +65 -26
- package/js/modules/stock.js +135 -134
- package/js/modules/stock.js.map +1 -1
- package/js/modules/stock.src.js +230 -157
- package/js/modules/streamgraph.js +2 -2
- package/js/modules/streamgraph.src.js +3 -3
- package/js/modules/sunburst.js +1 -1
- package/js/modules/sunburst.src.js +1 -1
- package/js/modules/tilemap.js +1 -1
- package/js/modules/tilemap.js.map +1 -1
- package/js/modules/tilemap.src.js +355 -188
- package/js/modules/treegrid.js +51 -0
- package/js/modules/treegrid.js.map +1 -0
- package/js/modules/treegrid.src.js +2759 -0
- package/js/modules/treemap.js +1 -1
- package/js/modules/treemap.src.js +1 -1
- package/js/modules/variable-pie.js +1 -1
- package/js/modules/variable-pie.src.js +1 -1
- package/js/modules/variwide.js +2 -2
- package/js/modules/variwide.src.js +3 -3
- package/js/modules/vector.js +2 -2
- package/js/modules/vector.js.map +1 -1
- package/js/modules/vector.src.js +94 -24
- package/js/modules/windbarb.js +2 -2
- package/js/modules/windbarb.src.js +4 -4
- package/js/modules/wordcloud.js +1 -1
- package/js/modules/wordcloud.src.js +1 -1
- package/js/modules/xrange.js +11 -10
- package/js/modules/xrange.js.map +1 -1
- package/js/modules/xrange.src.js +257 -70
- package/js/themes/avocado.js +1 -1
- package/js/themes/avocado.src.js +1 -1
- package/js/themes/dark-blue.js +2 -2
- package/js/themes/dark-blue.src.js +3 -3
- package/js/themes/dark-green.js +2 -2
- package/js/themes/dark-green.src.js +3 -3
- package/js/themes/dark-unica.js +2 -2
- package/js/themes/dark-unica.src.js +3 -3
- package/js/themes/gray.js +2 -2
- package/js/themes/gray.src.js +3 -3
- package/js/themes/grid-light.js +2 -2
- package/js/themes/grid-light.src.js +3 -3
- package/js/themes/grid.js +2 -2
- package/js/themes/grid.src.js +3 -3
- package/js/themes/sand-signika.js +2 -2
- package/js/themes/sand-signika.src.js +3 -3
- package/js/themes/skies.js +2 -2
- package/js/themes/skies.src.js +3 -3
- package/js/themes/sunset.js +1 -1
- package/js/themes/sunset.src.js +1 -1
- package/modules/accessibility.js +1 -1
- package/modules/accessibility.src.js +1 -1
- package/modules/annotations.js +2 -2
- package/modules/annotations.src.js +2 -2
- package/modules/arrow-symbols.js +13 -0
- package/modules/arrow-symbols.js.map +1 -0
- package/modules/arrow-symbols.src.js +138 -0
- package/modules/boost-canvas.js +1 -1
- package/modules/boost-canvas.src.js +1 -1
- package/modules/boost.js +36 -36
- package/modules/boost.js.map +1 -1
- package/modules/boost.src.js +23 -15
- package/modules/broken-axis.js +11 -10
- package/modules/broken-axis.js.map +1 -1
- package/modules/broken-axis.src.js +171 -136
- package/modules/bullet.js +1 -1
- package/modules/bullet.src.js +1 -1
- package/modules/current-date-indicator.js +13 -0
- package/modules/current-date-indicator.js.map +1 -0
- package/modules/current-date-indicator.src.js +120 -0
- package/modules/data.js +2 -2
- package/modules/data.src.js +4 -4
- package/modules/drag-panes.js +1 -1
- package/modules/drag-panes.src.js +1 -1
- package/modules/draggable-points.js +38 -0
- package/modules/draggable-points.js.map +1 -0
- package/modules/draggable-points.src.js +2281 -0
- package/modules/drilldown.js +1 -1
- package/modules/drilldown.js.map +1 -1
- package/modules/drilldown.src.js +2 -1
- package/modules/export-data.js +2 -2
- package/modules/export-data.src.js +3 -3
- package/modules/exporting.js +2 -2
- package/modules/exporting.src.js +3 -3
- package/modules/funnel.js +2 -2
- package/modules/funnel.src.js +3 -3
- package/modules/gantt.js +83 -19
- package/modules/gantt.js.map +1 -1
- package/modules/gantt.src.js +5553 -379
- package/modules/grid-axis.js +16 -11
- package/modules/grid-axis.js.map +1 -1
- package/modules/grid-axis.src.js +732 -293
- package/modules/heatmap.js +2 -2
- package/modules/heatmap.js.map +1 -1
- package/modules/heatmap.src.js +128 -57
- package/modules/histogram-bellcurve.js +1 -1
- package/modules/histogram-bellcurve.src.js +1 -1
- package/modules/item-series.js +2 -2
- package/modules/item-series.src.js +3 -3
- package/modules/map.js +2 -2
- package/modules/map.js.map +1 -1
- package/modules/map.src.js +139 -68
- package/modules/no-data-to-display.js +1 -1
- package/modules/no-data-to-display.src.js +6 -6
- package/modules/offline-exporting.js +2 -2
- package/modules/offline-exporting.src.js +2 -2
- package/modules/oldie.js +2 -2
- package/modules/oldie.src.js +3 -3
- package/modules/overlapping-datalabels.js +2 -2
- package/modules/overlapping-datalabels.src.js +2 -2
- package/modules/parallel-coordinates.js +8 -8
- package/modules/parallel-coordinates.js.map +1 -1
- package/modules/parallel-coordinates.src.js +4 -3
- package/modules/pareto.js +1 -1
- package/modules/pareto.src.js +1 -1
- package/modules/pathfinder.js +35 -0
- package/modules/pathfinder.js.map +1 -0
- package/modules/pathfinder.src.js +2128 -0
- package/modules/pattern-fill.js +1 -1
- package/modules/pattern-fill.src.js +1 -1
- package/modules/sankey.js +2 -2
- package/modules/sankey.src.js +3 -3
- package/modules/series-label.js +2 -2
- package/modules/series-label.src.js +4 -4
- package/modules/solid-gauge.js +2 -2
- package/modules/solid-gauge.src.js +3 -3
- package/modules/static-scale.js +3 -3
- package/modules/static-scale.js.map +1 -1
- package/modules/static-scale.src.js +65 -26
- package/modules/stock.js +142 -142
- package/modules/stock.js.map +1 -1
- package/modules/stock.src.js +230 -157
- package/modules/streamgraph.js +2 -2
- package/modules/streamgraph.src.js +3 -3
- package/modules/sunburst.js +1 -1
- package/modules/sunburst.src.js +1 -1
- package/modules/tilemap.js +1 -1
- package/modules/tilemap.js.map +1 -1
- package/modules/tilemap.src.js +357 -189
- package/modules/treegrid.js +52 -0
- package/modules/treegrid.js.map +1 -0
- package/modules/treegrid.src.js +2797 -0
- package/modules/treemap.js +1 -1
- package/modules/treemap.src.js +1 -1
- package/modules/variable-pie.js +1 -1
- package/modules/variable-pie.src.js +1 -1
- package/modules/variwide.js +2 -2
- package/modules/variwide.src.js +3 -3
- package/modules/vector.js +2 -2
- package/modules/vector.js.map +1 -1
- package/modules/vector.src.js +94 -24
- package/modules/windbarb.js +2 -2
- package/modules/windbarb.src.js +4 -4
- package/modules/wordcloud.js +1 -1
- package/modules/wordcloud.src.js +1 -1
- package/modules/xrange.js +12 -11
- package/modules/xrange.js.map +1 -1
- package/modules/xrange.src.js +259 -79
- package/package.json +1 -1
- package/themes/avocado.js +1 -1
- package/themes/avocado.src.js +1 -1
- package/themes/dark-blue.js +2 -2
- package/themes/dark-blue.src.js +3 -3
- package/themes/dark-green.js +2 -2
- package/themes/dark-green.src.js +3 -3
- package/themes/dark-unica.js +2 -2
- package/themes/dark-unica.src.js +3 -3
- package/themes/gray.js +2 -2
- package/themes/gray.src.js +3 -3
- package/themes/grid-light.js +2 -2
- package/themes/grid-light.src.js +3 -3
- package/themes/grid.js +2 -2
- package/themes/grid.src.js +3 -3
- package/themes/sand-signika.js +2 -2
- package/themes/sand-signika.src.js +3 -3
- package/themes/skies.js +2 -2
- package/themes/skies.src.js +3 -3
- package/themes/sunset.js +1 -1
- package/themes/sunset.src.js +1 -1
|
@@ -0,0 +1,2797 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Highcharts JS v6.2.0 (2018-10-17)
|
|
3
|
+
* Tree Grid
|
|
4
|
+
*
|
|
5
|
+
* (c) 2016 Jon Arild Nygard
|
|
6
|
+
*
|
|
7
|
+
* --- WORK IN PROGRESS ---
|
|
8
|
+
*
|
|
9
|
+
* License: www.highcharts.com/license
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
(function (factory) {
|
|
13
|
+
if (typeof module === 'object' && module.exports) {
|
|
14
|
+
module.exports = factory;
|
|
15
|
+
} else if (typeof define === 'function' && define.amd) {
|
|
16
|
+
define(function () {
|
|
17
|
+
return factory;
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
factory(Highcharts);
|
|
21
|
+
}
|
|
22
|
+
}(function (Highcharts) {
|
|
23
|
+
(function (H) {
|
|
24
|
+
/**
|
|
25
|
+
* (c) 2016 Highsoft AS
|
|
26
|
+
* Authors: Lars A. V. Cabrera
|
|
27
|
+
*
|
|
28
|
+
* License: www.highcharts.com/license
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
var argsToArray = function (args) {
|
|
32
|
+
return Array.prototype.slice.call(args, 1);
|
|
33
|
+
},
|
|
34
|
+
dateFormat = H.dateFormat,
|
|
35
|
+
defined = H.defined,
|
|
36
|
+
each = H.each,
|
|
37
|
+
isArray = H.isArray,
|
|
38
|
+
isNumber = H.isNumber,
|
|
39
|
+
isObject = function (x) {
|
|
40
|
+
// Always use strict mode
|
|
41
|
+
return H.isObject(x, true);
|
|
42
|
+
},
|
|
43
|
+
merge = H.merge,
|
|
44
|
+
pick = H.pick,
|
|
45
|
+
wrap = H.wrap,
|
|
46
|
+
Axis = H.Axis,
|
|
47
|
+
Tick = H.Tick;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Set grid options for the axis labels. Requires Highcharts Gantt.
|
|
51
|
+
*
|
|
52
|
+
* @type {object}
|
|
53
|
+
* @since 6.2.0
|
|
54
|
+
* @product gantt
|
|
55
|
+
* @apioption xAxis.grid
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Enable grid on the axis labels. Defaults to true for Gantt charts.
|
|
60
|
+
*
|
|
61
|
+
* @type {boolean}
|
|
62
|
+
* @since 6.2.0
|
|
63
|
+
* @default true
|
|
64
|
+
* @product gantt
|
|
65
|
+
* @apioption xAxis.grid.enabled
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Set specific options for each column (or row for horizontal axes) in the
|
|
70
|
+
* grid. Each extra column/row is its own axis, and the axis options can be set
|
|
71
|
+
* here.
|
|
72
|
+
*
|
|
73
|
+
* @type {Array<object>}
|
|
74
|
+
* @sample gantt/demo/left-axis-table
|
|
75
|
+
* Left axis as a table
|
|
76
|
+
* @apioption xAxis.grid.columns
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Set border color for the label grid lines.
|
|
81
|
+
*
|
|
82
|
+
* @type {Highcharts.ColorString}
|
|
83
|
+
* @apioption xAxis.grid.borderColor
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Set border width of the label grid lines.
|
|
88
|
+
*
|
|
89
|
+
* @type {number}
|
|
90
|
+
* @default 1
|
|
91
|
+
* @apioption xAxis.grid.borderWidth
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Set cell height for grid axis labels. By default this is calculated from font
|
|
96
|
+
* size.
|
|
97
|
+
*
|
|
98
|
+
* @type {number}
|
|
99
|
+
* @default null
|
|
100
|
+
* @apioption xAxis.grid.cellHeight
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
// Enum for which side the axis is on.
|
|
105
|
+
// Maps to axis.side
|
|
106
|
+
var axisSide = {
|
|
107
|
+
top: 0,
|
|
108
|
+
right: 1,
|
|
109
|
+
bottom: 2,
|
|
110
|
+
left: 3,
|
|
111
|
+
0: 'top',
|
|
112
|
+
1: 'right',
|
|
113
|
+
2: 'bottom',
|
|
114
|
+
3: 'left'
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Checks if an axis is a navigator axis.
|
|
119
|
+
* @return {Boolean} true if axis is found in axis.chart.navigator
|
|
120
|
+
*/
|
|
121
|
+
Axis.prototype.isNavigatorAxis = function () {
|
|
122
|
+
return /highcharts-navigator-[xy]axis/.test(this.options.className);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Checks if an axis is the outer axis in its dimension. Since
|
|
127
|
+
* axes are placed outwards in order, the axis with the highest
|
|
128
|
+
* index is the outermost axis.
|
|
129
|
+
*
|
|
130
|
+
* Example: If there are multiple x-axes at the top of the chart,
|
|
131
|
+
* this function returns true if the axis supplied is the last
|
|
132
|
+
* of the x-axes.
|
|
133
|
+
*
|
|
134
|
+
* @return true if the axis is the outermost axis in its dimension;
|
|
135
|
+
* false if not
|
|
136
|
+
*/
|
|
137
|
+
Axis.prototype.isOuterAxis = function () {
|
|
138
|
+
var axis = this,
|
|
139
|
+
chart = axis.chart,
|
|
140
|
+
thisIndex = -1,
|
|
141
|
+
isOuter = true;
|
|
142
|
+
|
|
143
|
+
each(chart.axes, function (otherAxis, index) {
|
|
144
|
+
if (otherAxis.side === axis.side && !otherAxis.isNavigatorAxis()) {
|
|
145
|
+
if (otherAxis === axis) {
|
|
146
|
+
// Get the index of the axis in question
|
|
147
|
+
thisIndex = index;
|
|
148
|
+
|
|
149
|
+
// Check thisIndex >= 0 in case thisIndex has
|
|
150
|
+
// not been found yet
|
|
151
|
+
} else if (thisIndex >= 0 && index > thisIndex) {
|
|
152
|
+
// There was an axis on the same side with a
|
|
153
|
+
// higher index.
|
|
154
|
+
isOuter = false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
// There were either no other axes on the same side,
|
|
159
|
+
// or the other axes were not farther from the chart
|
|
160
|
+
return isOuter;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Get the largest label width and height.
|
|
165
|
+
* @param {object} ticks All the ticks on one axis.
|
|
166
|
+
* @param {array} tickPositions All the tick positions on one axis.
|
|
167
|
+
* @return {object} object containing the properties height and width.
|
|
168
|
+
*/
|
|
169
|
+
Axis.prototype.getMaxLabelDimensions = function (ticks, tickPositions) {
|
|
170
|
+
var dimensions = {
|
|
171
|
+
width: 0,
|
|
172
|
+
height: 0
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
each(tickPositions, function (pos) {
|
|
176
|
+
var tick = ticks[pos],
|
|
177
|
+
tickHeight = 0,
|
|
178
|
+
tickWidth = 0,
|
|
179
|
+
label;
|
|
180
|
+
|
|
181
|
+
if (isObject(tick)) {
|
|
182
|
+
label = isObject(tick.label) ? tick.label : {};
|
|
183
|
+
|
|
184
|
+
// Find width and height of tick
|
|
185
|
+
tickHeight = label.getBBox ? label.getBBox().height : 0;
|
|
186
|
+
tickWidth = isNumber(label.textPxLength) ? label.textPxLength : 0;
|
|
187
|
+
|
|
188
|
+
// Update the result if width and/or height are larger
|
|
189
|
+
dimensions.height = Math.max(tickHeight, dimensions.height);
|
|
190
|
+
dimensions.width = Math.max(tickWidth, dimensions.width);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
return dimensions;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Add custom date formats
|
|
199
|
+
*/
|
|
200
|
+
H.dateFormats = {
|
|
201
|
+
// Week number
|
|
202
|
+
W: function (timestamp) {
|
|
203
|
+
var d = new Date(timestamp),
|
|
204
|
+
yearStart,
|
|
205
|
+
weekNo;
|
|
206
|
+
d.setHours(0, 0, 0, 0);
|
|
207
|
+
d.setDate(d.getDate() - (d.getDay() || 7));
|
|
208
|
+
yearStart = new Date(d.getFullYear(), 0, 1);
|
|
209
|
+
weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
|
|
210
|
+
return weekNo;
|
|
211
|
+
},
|
|
212
|
+
// First letter of the day of the week, e.g. 'M' for 'Monday'.
|
|
213
|
+
E: function (timestamp) {
|
|
214
|
+
return dateFormat('%a', timestamp, true).charAt(0);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* If chart is stockChart, always return 'left' to avoid labels being placed
|
|
220
|
+
* inside chart. Stock charts place yAxis labels inside by default.
|
|
221
|
+
* @param {function} proceed - the original function
|
|
222
|
+
* @return {string} 'left' if stockChart, or auto calculated alignment
|
|
223
|
+
*/
|
|
224
|
+
wrap(Axis.prototype, 'autoLabelAlign', function (proceed) {
|
|
225
|
+
var axis = this,
|
|
226
|
+
retVal;
|
|
227
|
+
if (axis.chart.isStock) {
|
|
228
|
+
retVal = 'left';
|
|
229
|
+
} else {
|
|
230
|
+
retVal = proceed.apply(axis, argsToArray(arguments));
|
|
231
|
+
}
|
|
232
|
+
return retVal;
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Center tick labels in cells.
|
|
237
|
+
*
|
|
238
|
+
* @param {function} proceed - the original function
|
|
239
|
+
*
|
|
240
|
+
* @return {object} object - an object containing x and y positions
|
|
241
|
+
* for the tick
|
|
242
|
+
*/
|
|
243
|
+
wrap(Tick.prototype, 'getLabelPosition', function (proceed, x, y, label, horiz,
|
|
244
|
+
labelOpts, tickmarkOffset, index) {
|
|
245
|
+
var tick = this,
|
|
246
|
+
axis = tick.axis,
|
|
247
|
+
reversed = axis.reversed,
|
|
248
|
+
chart = axis.chart,
|
|
249
|
+
options = axis.options,
|
|
250
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {},
|
|
251
|
+
align = labelOpts.align,
|
|
252
|
+
// verticalAlign is currently not supported for axis.labels.
|
|
253
|
+
verticalAlign = 'middle', // labelOpts.verticalAlign,
|
|
254
|
+
side = axisSide[axis.side],
|
|
255
|
+
tickPositions = axis.tickPositions,
|
|
256
|
+
tickPos = tick.pos - tickmarkOffset,
|
|
257
|
+
nextTickPos = (
|
|
258
|
+
isNumber(tickPositions[index + 1]) ?
|
|
259
|
+
tickPositions[index + 1] - tickmarkOffset :
|
|
260
|
+
axis.max + tickmarkOffset
|
|
261
|
+
),
|
|
262
|
+
tickSize = axis.tickSize('tick', true),
|
|
263
|
+
tickWidth = isArray(tickSize) ? tickSize[0] : 0,
|
|
264
|
+
crispCorr = tickSize && tickSize[1] / 2,
|
|
265
|
+
labelHeight,
|
|
266
|
+
lblMetrics,
|
|
267
|
+
lines,
|
|
268
|
+
result,
|
|
269
|
+
bottom,
|
|
270
|
+
top,
|
|
271
|
+
left,
|
|
272
|
+
right;
|
|
273
|
+
|
|
274
|
+
// Only center tick labels in grid axes
|
|
275
|
+
if (gridOptions.enabled === true) {
|
|
276
|
+
/**
|
|
277
|
+
* Calculate top and bottom positions of the cell.
|
|
278
|
+
*/
|
|
279
|
+
if (side === 'top') {
|
|
280
|
+
bottom = axis.top + axis.offset;
|
|
281
|
+
top = bottom - tickWidth;
|
|
282
|
+
} else if (side === 'bottom') {
|
|
283
|
+
top = chart.chartHeight - axis.bottom + axis.offset;
|
|
284
|
+
bottom = top + tickWidth;
|
|
285
|
+
} else {
|
|
286
|
+
bottom = axis.top + axis.len - axis.translate(
|
|
287
|
+
reversed ? nextTickPos : tickPos
|
|
288
|
+
);
|
|
289
|
+
top = axis.top + axis.len - axis.translate(
|
|
290
|
+
reversed ? tickPos : nextTickPos
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Calculate left and right positions of the cell.
|
|
296
|
+
*/
|
|
297
|
+
if (side === 'right') {
|
|
298
|
+
left = chart.chartWidth - axis.right + axis.offset;
|
|
299
|
+
right = left + tickWidth;
|
|
300
|
+
} else if (side === 'left') {
|
|
301
|
+
right = axis.left + axis.offset;
|
|
302
|
+
left = right - tickWidth;
|
|
303
|
+
} else {
|
|
304
|
+
left = Math.round(axis.left + axis.translate(
|
|
305
|
+
reversed ? nextTickPos : tickPos
|
|
306
|
+
)) - crispCorr;
|
|
307
|
+
right = Math.round(axis.left + axis.translate(
|
|
308
|
+
reversed ? tickPos : nextTickPos
|
|
309
|
+
)) - crispCorr;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
tick.slotWidth = right - left;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Calculate the positioning of the label based on alignment.
|
|
316
|
+
*/
|
|
317
|
+
result = {
|
|
318
|
+
x: (
|
|
319
|
+
align === 'left' ?
|
|
320
|
+
left :
|
|
321
|
+
align === 'right' ?
|
|
322
|
+
right :
|
|
323
|
+
left + ((right - left) / 2) // default to center
|
|
324
|
+
),
|
|
325
|
+
y: (
|
|
326
|
+
verticalAlign === 'top' ?
|
|
327
|
+
top :
|
|
328
|
+
verticalAlign === 'bottom' ?
|
|
329
|
+
bottom :
|
|
330
|
+
top + ((bottom - top) / 2) // default to middle
|
|
331
|
+
)
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
lblMetrics = chart.renderer.fontMetrics(
|
|
335
|
+
labelOpts.style.fontSize,
|
|
336
|
+
label.element
|
|
337
|
+
);
|
|
338
|
+
labelHeight = label.getBBox().height;
|
|
339
|
+
|
|
340
|
+
// Adjustment to y position to align the label correctly.
|
|
341
|
+
// Would be better to have a setter or similar for this.
|
|
342
|
+
if (!labelOpts.useHTML) {
|
|
343
|
+
lines = Math.round(labelHeight / lblMetrics.h);
|
|
344
|
+
result.y += (
|
|
345
|
+
// Center the label
|
|
346
|
+
// TODO: why does this actually center the label?
|
|
347
|
+
((lblMetrics.b - (lblMetrics.h - lblMetrics.f)) / 2) +
|
|
348
|
+
// Adjust for height of additional lines.
|
|
349
|
+
-(((lines - 1) * lblMetrics.h) / 2)
|
|
350
|
+
);
|
|
351
|
+
} else {
|
|
352
|
+
result.y += (
|
|
353
|
+
// Readjust yCorr in htmlUpdateTransform
|
|
354
|
+
lblMetrics.b +
|
|
355
|
+
// Adjust for height of html label
|
|
356
|
+
-(labelHeight / 2)
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
result.x += (axis.horiz && labelOpts.x || 0);
|
|
361
|
+
} else {
|
|
362
|
+
result = proceed.apply(tick, argsToArray(arguments));
|
|
363
|
+
}
|
|
364
|
+
return result;
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Draw vertical axis ticks extra long to create cell floors and roofs.
|
|
369
|
+
* Overrides the tickLength for vertical axes.
|
|
370
|
+
*
|
|
371
|
+
* @param {function} proceed - the original function
|
|
372
|
+
* @returns {array} retVal -
|
|
373
|
+
*/
|
|
374
|
+
wrap(Axis.prototype, 'tickSize', function (proceed) {
|
|
375
|
+
var axis = this,
|
|
376
|
+
dimensions = axis.maxLabelDimensions,
|
|
377
|
+
options = axis.options,
|
|
378
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {},
|
|
379
|
+
retVal = proceed.apply(axis, argsToArray(arguments)),
|
|
380
|
+
labelPadding,
|
|
381
|
+
distance;
|
|
382
|
+
|
|
383
|
+
if (gridOptions.enabled === true) {
|
|
384
|
+
labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
|
|
385
|
+
distance = labelPadding +
|
|
386
|
+
(axis.horiz ? dimensions.height : dimensions.width);
|
|
387
|
+
|
|
388
|
+
if (isArray(retVal)) {
|
|
389
|
+
retVal[0] = distance;
|
|
390
|
+
} else {
|
|
391
|
+
retVal = [distance];
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return retVal;
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
wrap(Axis.prototype, 'getTitlePosition', function (proceed) {
|
|
398
|
+
var axis = this,
|
|
399
|
+
options = axis.options,
|
|
400
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {};
|
|
401
|
+
|
|
402
|
+
if (gridOptions.enabled === true) {
|
|
403
|
+
// compute anchor points for each of the title align options
|
|
404
|
+
var title = axis.axisTitle,
|
|
405
|
+
titleWidth = title && title.getBBox().width,
|
|
406
|
+
horiz = axis.horiz,
|
|
407
|
+
axisLeft = axis.left,
|
|
408
|
+
axisTop = axis.top,
|
|
409
|
+
axisWidth = axis.width,
|
|
410
|
+
axisHeight = axis.height,
|
|
411
|
+
axisTitleOptions = options.title,
|
|
412
|
+
opposite = axis.opposite,
|
|
413
|
+
offset = axis.offset,
|
|
414
|
+
tickSize = axis.tickSize() || [0],
|
|
415
|
+
xOption = axisTitleOptions.x || 0,
|
|
416
|
+
yOption = axisTitleOptions.y || 0,
|
|
417
|
+
titleMargin = pick(axisTitleOptions.margin, horiz ? 5 : 10),
|
|
418
|
+
titleFontSize = axis.chart.renderer.fontMetrics(
|
|
419
|
+
axisTitleOptions.style && axisTitleOptions.style.fontSize,
|
|
420
|
+
title
|
|
421
|
+
).f,
|
|
422
|
+
// TODO account for alignment
|
|
423
|
+
// the position in the perpendicular direction of the axis
|
|
424
|
+
offAxis = (horiz ? axisTop + axisHeight : axisLeft) +
|
|
425
|
+
(horiz ? 1 : -1) * // horizontal axis reverses the margin
|
|
426
|
+
(opposite ? -1 : 1) * // so does opposite axes
|
|
427
|
+
(tickSize[0] / 2) +
|
|
428
|
+
(axis.side === axisSide.bottom ? titleFontSize : 0);
|
|
429
|
+
|
|
430
|
+
return {
|
|
431
|
+
x: horiz ?
|
|
432
|
+
axisLeft - titleWidth / 2 - titleMargin + xOption :
|
|
433
|
+
offAxis + (opposite ? axisWidth : 0) + offset + xOption,
|
|
434
|
+
y: horiz ?
|
|
435
|
+
(
|
|
436
|
+
offAxis -
|
|
437
|
+
(opposite ? axisHeight : 0) +
|
|
438
|
+
(opposite ? titleFontSize : -titleFontSize) / 2 +
|
|
439
|
+
offset +
|
|
440
|
+
yOption
|
|
441
|
+
) :
|
|
442
|
+
axisTop - titleMargin + yOption
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return proceed.apply(this, argsToArray(arguments));
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Avoid altering tickInterval when reserving space.
|
|
451
|
+
*/
|
|
452
|
+
wrap(Axis.prototype, 'unsquish', function (proceed) {
|
|
453
|
+
var axis = this,
|
|
454
|
+
options = axis.options,
|
|
455
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {};
|
|
456
|
+
|
|
457
|
+
if (gridOptions.enabled === true && this.categories) {
|
|
458
|
+
return this.tickInterval;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
return proceed.apply(this, argsToArray(arguments));
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Creates a left and right wall on horizontal axes:
|
|
466
|
+
* - Places leftmost tick at the start of the axis, to create a left wall
|
|
467
|
+
* - Ensures that the rightmost tick is at the end of the axis, to create a
|
|
468
|
+
* right wall.
|
|
469
|
+
*
|
|
470
|
+
* @param {function} proceed - the original function
|
|
471
|
+
* @param {object} options - the pure axis options as input by the user
|
|
472
|
+
*/
|
|
473
|
+
H.addEvent(Axis, 'afterSetOptions', function (e) {
|
|
474
|
+
var options = this.options,
|
|
475
|
+
userOptions = e.userOptions,
|
|
476
|
+
gridAxisOptions,
|
|
477
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {};
|
|
478
|
+
|
|
479
|
+
if (gridOptions.enabled === true) {
|
|
480
|
+
|
|
481
|
+
// Merge the user options into default grid axis options so that when a
|
|
482
|
+
// user option is set, it takes presedence.
|
|
483
|
+
gridAxisOptions = merge(true, {
|
|
484
|
+
|
|
485
|
+
className: 'highcharts-grid-axis ' + (userOptions.className || ''),
|
|
486
|
+
|
|
487
|
+
dateTimeLabelFormats: {
|
|
488
|
+
hour: {
|
|
489
|
+
list: ['%H:%M', '%H']
|
|
490
|
+
},
|
|
491
|
+
day: {
|
|
492
|
+
list: ['%A, %e. %B', '%a, %e. %b', '%E']
|
|
493
|
+
},
|
|
494
|
+
week: {
|
|
495
|
+
list: ['Week %W', 'W%W']
|
|
496
|
+
},
|
|
497
|
+
month: {
|
|
498
|
+
list: ['%B', '%b', '%o']
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
|
|
502
|
+
grid: {
|
|
503
|
+
borderWidth: 1
|
|
504
|
+
},
|
|
505
|
+
|
|
506
|
+
labels: {
|
|
507
|
+
padding: 2,
|
|
508
|
+
style: {
|
|
509
|
+
fontSize: '13px'
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
title: {
|
|
514
|
+
text: null,
|
|
515
|
+
reserveSpace: false,
|
|
516
|
+
rotation: 0
|
|
517
|
+
},
|
|
518
|
+
|
|
519
|
+
// In a grid axis, only allow one unit of certain types, for example
|
|
520
|
+
// we shouln't have one grid cell spanning two days.
|
|
521
|
+
units: [[
|
|
522
|
+
'millisecond', // unit name
|
|
523
|
+
[1, 10, 100]
|
|
524
|
+
], [
|
|
525
|
+
'second',
|
|
526
|
+
[1, 10]
|
|
527
|
+
], [
|
|
528
|
+
'minute',
|
|
529
|
+
[1, 5, 15]
|
|
530
|
+
], [
|
|
531
|
+
'hour',
|
|
532
|
+
[1, 6]
|
|
533
|
+
], [
|
|
534
|
+
'day',
|
|
535
|
+
[1]
|
|
536
|
+
], [
|
|
537
|
+
'week',
|
|
538
|
+
[1]
|
|
539
|
+
], [
|
|
540
|
+
'month',
|
|
541
|
+
[1]
|
|
542
|
+
], [
|
|
543
|
+
'year',
|
|
544
|
+
null
|
|
545
|
+
]]
|
|
546
|
+
}, userOptions);
|
|
547
|
+
|
|
548
|
+
// X-axis specific options
|
|
549
|
+
if (this.coll === 'xAxis') {
|
|
550
|
+
|
|
551
|
+
// For linked axes, tickPixelInterval is used only if the
|
|
552
|
+
// tickPositioner below doesn't run or returns undefined (like
|
|
553
|
+
// multiple years)
|
|
554
|
+
if (
|
|
555
|
+
defined(userOptions.linkedTo) &&
|
|
556
|
+
!defined(userOptions.tickPixelInterval)
|
|
557
|
+
) {
|
|
558
|
+
gridAxisOptions.tickPixelInterval = 350;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// For the secondary grid axis, use the primary axis' tick intervals
|
|
562
|
+
// and return ticks one level higher.
|
|
563
|
+
if (
|
|
564
|
+
// Check for tick pixel interval in options
|
|
565
|
+
!defined(userOptions.tickPixelInterval) &&
|
|
566
|
+
|
|
567
|
+
// Only for linked axes
|
|
568
|
+
defined(userOptions.linkedTo) &&
|
|
569
|
+
|
|
570
|
+
!defined(userOptions.tickPositioner) &&
|
|
571
|
+
!defined(userOptions.tickInterval)
|
|
572
|
+
) {
|
|
573
|
+
gridAxisOptions.tickPositioner = function (min, max) {
|
|
574
|
+
|
|
575
|
+
var parentInfo = (
|
|
576
|
+
this.linkedParent &&
|
|
577
|
+
this.linkedParent.tickPositions &&
|
|
578
|
+
this.linkedParent.tickPositions.info
|
|
579
|
+
);
|
|
580
|
+
|
|
581
|
+
if (parentInfo) {
|
|
582
|
+
|
|
583
|
+
var unitIdx,
|
|
584
|
+
count,
|
|
585
|
+
unitName,
|
|
586
|
+
i,
|
|
587
|
+
units = gridAxisOptions.units,
|
|
588
|
+
unitRange;
|
|
589
|
+
|
|
590
|
+
for (i = 0; i < units.length; i++) {
|
|
591
|
+
if (units[i][0] === parentInfo.unitName) {
|
|
592
|
+
unitIdx = i;
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// Spanning multiple years, go default
|
|
598
|
+
if (!units[unitIdx][1]) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// Get the first allowed count on the next unit.
|
|
603
|
+
if (units[unitIdx + 1]) {
|
|
604
|
+
unitName = units[unitIdx + 1][0];
|
|
605
|
+
count = (units[unitIdx + 1][1] || [1])[0];
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
unitRange = H.timeUnits[unitName];
|
|
609
|
+
this.tickInterval = unitRange * count;
|
|
610
|
+
return this.getTimeTicks(
|
|
611
|
+
{
|
|
612
|
+
unitRange: unitRange,
|
|
613
|
+
count: count,
|
|
614
|
+
unitName: unitName
|
|
615
|
+
},
|
|
616
|
+
min,
|
|
617
|
+
max,
|
|
618
|
+
this.options.startOfWeek
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// Now merge the combined options into the axis options
|
|
627
|
+
merge(true, this.options, gridAxisOptions);
|
|
628
|
+
|
|
629
|
+
if (this.horiz) {
|
|
630
|
+
/** _________________________
|
|
631
|
+
* Make this: ___|_____|_____|_____|__|
|
|
632
|
+
* ^ ^
|
|
633
|
+
* _________________________
|
|
634
|
+
* Into this: |_____|_____|_____|_____|
|
|
635
|
+
* ^ ^
|
|
636
|
+
*/
|
|
637
|
+
options.minPadding = pick(userOptions.minPadding, 0);
|
|
638
|
+
options.maxPadding = pick(userOptions.maxPadding, 0);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// If borderWidth is set, then use its value for tick and line width.
|
|
642
|
+
if (isNumber(options.grid.borderWidth)) {
|
|
643
|
+
options.tickWidth = options.lineWidth = gridOptions.borderWidth;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Ensures a left wall on horizontal axes with series inheriting from column.
|
|
651
|
+
* ColumnSeries normally sets pointRange to null, resulting in Axis to select
|
|
652
|
+
* other values for point ranges. This enforces the above Axis.setOptions()
|
|
653
|
+
* override.
|
|
654
|
+
* _________________________
|
|
655
|
+
* Enforce this: ___|_____|_____|_____|__|
|
|
656
|
+
* ^
|
|
657
|
+
* _________________________
|
|
658
|
+
* To be this: |_____|_____|_____|_____|
|
|
659
|
+
* ^
|
|
660
|
+
*
|
|
661
|
+
* @param {function} proceed - the original function
|
|
662
|
+
* @param {object} options - the pure axis options as input by the user
|
|
663
|
+
*/
|
|
664
|
+
wrap(Axis.prototype, 'setAxisTranslation', function (proceed) {
|
|
665
|
+
var axis = this,
|
|
666
|
+
options = axis.options,
|
|
667
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {},
|
|
668
|
+
tickInfo = this.tickPositions && this.tickPositions.info,
|
|
669
|
+
userLabels = this.userOptions.labels || {};
|
|
670
|
+
|
|
671
|
+
if (this.horiz) {
|
|
672
|
+
if (gridOptions.enabled === true) {
|
|
673
|
+
each(axis.series, function (series) {
|
|
674
|
+
series.options.pointRange = 0;
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// Lower level time ticks, like hours or minutes, represent points in
|
|
679
|
+
// time and not ranges. These should be aligned left in the grid cell
|
|
680
|
+
// by default. The same applies to years of higher order.
|
|
681
|
+
if (
|
|
682
|
+
tickInfo &&
|
|
683
|
+
(
|
|
684
|
+
options.dateTimeLabelFormats[tickInfo.unitName]
|
|
685
|
+
.range === false ||
|
|
686
|
+
tickInfo.count > 1 // years
|
|
687
|
+
) &&
|
|
688
|
+
!defined(userLabels.align)
|
|
689
|
+
) {
|
|
690
|
+
options.labels.align = 'left';
|
|
691
|
+
|
|
692
|
+
if (!defined(userLabels.x)) {
|
|
693
|
+
options.labels.x = 3;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
proceed.apply(axis, argsToArray(arguments));
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
// TODO: Does this function do what the drawing says? Seems to affect ticks and
|
|
702
|
+
// not the labels directly?
|
|
703
|
+
/**
|
|
704
|
+
* Makes tick labels which are usually ignored in a linked axis displayed if
|
|
705
|
+
* they are within range of linkedParent.min.
|
|
706
|
+
* _____________________________
|
|
707
|
+
* | | | | |
|
|
708
|
+
* Make this: | | 2 | 3 | 4 |
|
|
709
|
+
* |___|_______|_______|_______|
|
|
710
|
+
* ^
|
|
711
|
+
* _____________________________
|
|
712
|
+
* | | | | |
|
|
713
|
+
* Into this: | 1 | 2 | 3 | 4 |
|
|
714
|
+
* |___|_______|_______|_______|
|
|
715
|
+
* ^
|
|
716
|
+
* @param {function} proceed - the original function
|
|
717
|
+
*/
|
|
718
|
+
wrap(Axis.prototype, 'trimTicks', function (proceed) {
|
|
719
|
+
var axis = this,
|
|
720
|
+
options = axis.options,
|
|
721
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {},
|
|
722
|
+
categoryAxis = axis.categories,
|
|
723
|
+
tickPositions = axis.tickPositions,
|
|
724
|
+
firstPos = tickPositions[0],
|
|
725
|
+
lastPos = tickPositions[tickPositions.length - 1],
|
|
726
|
+
linkedMin = axis.linkedParent && axis.linkedParent.min,
|
|
727
|
+
linkedMax = axis.linkedParent && axis.linkedParent.max,
|
|
728
|
+
min = linkedMin || axis.min,
|
|
729
|
+
max = linkedMax || axis.max,
|
|
730
|
+
tickInterval = axis.tickInterval,
|
|
731
|
+
moreThanMin = firstPos > min,
|
|
732
|
+
lessThanMax = lastPos < max,
|
|
733
|
+
endMoreThanMin = firstPos < min && firstPos + tickInterval > min,
|
|
734
|
+
startLessThanMax = lastPos > max && lastPos - tickInterval < max;
|
|
735
|
+
|
|
736
|
+
if (
|
|
737
|
+
gridOptions.enabled === true &&
|
|
738
|
+
!categoryAxis &&
|
|
739
|
+
(axis.horiz || axis.isLinked)
|
|
740
|
+
) {
|
|
741
|
+
if ((moreThanMin || endMoreThanMin) && !options.startOnTick) {
|
|
742
|
+
tickPositions[0] = min;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
if ((lessThanMax || startLessThanMax) && !options.endOnTick) {
|
|
746
|
+
tickPositions[tickPositions.length - 1] = max;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
proceed.apply(axis, argsToArray(arguments));
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Draw an extra line on the far side of the outermost axis,
|
|
755
|
+
* creating floor/roof/wall of a grid. And some padding.
|
|
756
|
+
*
|
|
757
|
+
* Make this:
|
|
758
|
+
* (axis.min) __________________________ (axis.max)
|
|
759
|
+
* | | | | |
|
|
760
|
+
* Into this:
|
|
761
|
+
* (axis.min) __________________________ (axis.max)
|
|
762
|
+
* ___|____|____|____|____|__
|
|
763
|
+
*
|
|
764
|
+
* @param {function} proceed - the original function
|
|
765
|
+
*/
|
|
766
|
+
wrap(Axis.prototype, 'render', function (proceed) {
|
|
767
|
+
var axis = this,
|
|
768
|
+
options = axis.options,
|
|
769
|
+
gridOptions = (options && isObject(options.grid)) ? options.grid : {},
|
|
770
|
+
labelPadding,
|
|
771
|
+
distance,
|
|
772
|
+
lineWidth,
|
|
773
|
+
linePath,
|
|
774
|
+
yStartIndex,
|
|
775
|
+
yEndIndex,
|
|
776
|
+
xStartIndex,
|
|
777
|
+
xEndIndex,
|
|
778
|
+
renderer = axis.chart.renderer,
|
|
779
|
+
horiz = axis.horiz,
|
|
780
|
+
axisGroupBox;
|
|
781
|
+
|
|
782
|
+
if (gridOptions.enabled === true) {
|
|
783
|
+
// TODO acutual label padding (top, bottom, left, right)
|
|
784
|
+
// Label padding is needed to figure out where to draw the outer line.
|
|
785
|
+
labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
|
|
786
|
+
axis.maxLabelDimensions = axis.getMaxLabelDimensions(
|
|
787
|
+
axis.ticks,
|
|
788
|
+
axis.tickPositions
|
|
789
|
+
);
|
|
790
|
+
distance = axis.maxLabelDimensions.width + labelPadding;
|
|
791
|
+
lineWidth = options.lineWidth;
|
|
792
|
+
|
|
793
|
+
// Remove right wall before rendering if updating
|
|
794
|
+
if (axis.rightWall) {
|
|
795
|
+
axis.rightWall.destroy();
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// Call original Axis.render() to obtain axis.axisLine and
|
|
799
|
+
// axis.axisGroup
|
|
800
|
+
proceed.apply(axis);
|
|
801
|
+
|
|
802
|
+
axisGroupBox = axis.axisGroup.getBBox();
|
|
803
|
+
|
|
804
|
+
/*
|
|
805
|
+
* Draw an extra axis line on outer axes
|
|
806
|
+
* >
|
|
807
|
+
* Make this: |______|______|______|___
|
|
808
|
+
*
|
|
809
|
+
* > _________________________
|
|
810
|
+
* Into this: |______|______|______|__|
|
|
811
|
+
*
|
|
812
|
+
*/
|
|
813
|
+
if (axis.isOuterAxis() && axis.axisLine) {
|
|
814
|
+
if (horiz) {
|
|
815
|
+
// -1 to avoid adding distance each time the chart updates
|
|
816
|
+
distance = axisGroupBox.height - 1;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
if (lineWidth) {
|
|
820
|
+
linePath = axis.getLinePath(lineWidth);
|
|
821
|
+
xStartIndex = linePath.indexOf('M') + 1;
|
|
822
|
+
xEndIndex = linePath.indexOf('L') + 1;
|
|
823
|
+
yStartIndex = linePath.indexOf('M') + 2;
|
|
824
|
+
yEndIndex = linePath.indexOf('L') + 2;
|
|
825
|
+
|
|
826
|
+
// Negate distance if top or left axis
|
|
827
|
+
if (axis.side === axisSide.top || axis.side === axisSide.left) {
|
|
828
|
+
distance = -distance;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// If axis is horizontal, reposition line path vertically
|
|
832
|
+
if (horiz) {
|
|
833
|
+
linePath[yStartIndex] = linePath[yStartIndex] + distance;
|
|
834
|
+
linePath[yEndIndex] = linePath[yEndIndex] + distance;
|
|
835
|
+
} else {
|
|
836
|
+
// If axis is vertical, reposition line path horizontally
|
|
837
|
+
linePath[xStartIndex] = linePath[xStartIndex] + distance;
|
|
838
|
+
linePath[xEndIndex] = linePath[xEndIndex] + distance;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
if (!axis.axisLineExtra) {
|
|
842
|
+
axis.axisLineExtra = renderer.path(linePath)
|
|
843
|
+
.attr({
|
|
844
|
+
|
|
845
|
+
stroke: options.lineColor,
|
|
846
|
+
'stroke-width': lineWidth,
|
|
847
|
+
|
|
848
|
+
zIndex: 7
|
|
849
|
+
})
|
|
850
|
+
.addClass('highcharts-axis-line')
|
|
851
|
+
.add(axis.axisGroup);
|
|
852
|
+
} else {
|
|
853
|
+
axis.axisLineExtra.animate({
|
|
854
|
+
d: linePath
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// show or hide the line depending on options.showEmpty
|
|
859
|
+
axis.axisLine[axis.showAxis ? 'show' : 'hide'](true);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
} else {
|
|
864
|
+
proceed.apply(axis);
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Wraps axis init to draw cell walls on vertical axes.
|
|
870
|
+
*
|
|
871
|
+
* @param {function} proceed - the original function
|
|
872
|
+
*/
|
|
873
|
+
wrap(Axis.prototype, 'init', function (proceed, chart, userOptions) {
|
|
874
|
+
var axis = this,
|
|
875
|
+
gridOptions = (
|
|
876
|
+
(userOptions && isObject(userOptions.grid)) ?
|
|
877
|
+
userOptions.grid :
|
|
878
|
+
{}
|
|
879
|
+
),
|
|
880
|
+
columnOptions,
|
|
881
|
+
column,
|
|
882
|
+
columnIndex,
|
|
883
|
+
i;
|
|
884
|
+
function applyGridOptions(axis) {
|
|
885
|
+
var options = axis.options,
|
|
886
|
+
// TODO: Consider using cell margins defined in % of font size?
|
|
887
|
+
// 25 is optimal height for default fontSize (11px)
|
|
888
|
+
// 25 / 11 ≈ 2.28
|
|
889
|
+
fontSizeToCellHeightRatio = 25 / 11,
|
|
890
|
+
fontSize = options.labels.style.fontSize,
|
|
891
|
+
fontMetrics = axis.chart.renderer.fontMetrics(fontSize);
|
|
892
|
+
|
|
893
|
+
// Center-align by default
|
|
894
|
+
if (!options.labels) {
|
|
895
|
+
options.labels = {};
|
|
896
|
+
}
|
|
897
|
+
options.labels.align = pick(options.labels.align, 'center');
|
|
898
|
+
|
|
899
|
+
// TODO: Check against tickLabelPlacement between/on etc
|
|
900
|
+
/**
|
|
901
|
+
* Prevents adding the last tick label if the axis is not a category
|
|
902
|
+
* axis.
|
|
903
|
+
*
|
|
904
|
+
* Since numeric labels are normally placed at starts and ends of a
|
|
905
|
+
* range of value, and this module makes the label point at the value,
|
|
906
|
+
* an "extra" label would appear.
|
|
907
|
+
*/
|
|
908
|
+
if (!axis.categories) {
|
|
909
|
+
options.showLastLabel = false;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Make tick marks taller, creating cell walls of a grid.
|
|
914
|
+
* Use cellHeight axis option if set
|
|
915
|
+
*/
|
|
916
|
+
if (axis.horiz) {
|
|
917
|
+
options.tickLength = gridOptions.cellHeight ||
|
|
918
|
+
fontMetrics.h * fontSizeToCellHeightRatio;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Prevents rotation of labels when squished, as rotating them would not
|
|
923
|
+
* help.
|
|
924
|
+
*/
|
|
925
|
+
axis.labelRotation = 0;
|
|
926
|
+
options.labels.rotation = 0;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
if (gridOptions.enabled) {
|
|
930
|
+
if (defined(gridOptions.borderColor)) {
|
|
931
|
+
userOptions.tickColor =
|
|
932
|
+
userOptions.lineColor = gridOptions.borderColor;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// Handle columns, each column is a grid axis
|
|
936
|
+
if (isArray(gridOptions.columns)) {
|
|
937
|
+
columnIndex = 0;
|
|
938
|
+
i = gridOptions.columns.length;
|
|
939
|
+
while (i--) {
|
|
940
|
+
columnOptions = merge(
|
|
941
|
+
userOptions,
|
|
942
|
+
gridOptions.columns[i],
|
|
943
|
+
{
|
|
944
|
+
// Force to behave like category axis
|
|
945
|
+
type: 'category'
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
|
|
949
|
+
delete columnOptions.grid.columns; // Prevent recursion
|
|
950
|
+
|
|
951
|
+
column = new Axis(chart, columnOptions);
|
|
952
|
+
column.isColumn = true;
|
|
953
|
+
column.columnIndex = columnIndex;
|
|
954
|
+
|
|
955
|
+
wrap(column, 'labelFormatter', function (proceed) {
|
|
956
|
+
var axis = this.axis,
|
|
957
|
+
tickPos = axis.tickPositions,
|
|
958
|
+
value = this.value,
|
|
959
|
+
series = axis.series[0],
|
|
960
|
+
isFirst = value === tickPos[0],
|
|
961
|
+
isLast = value === tickPos[tickPos.length - 1],
|
|
962
|
+
point = H.find(series.options.data, function (p) {
|
|
963
|
+
return p[axis.isXAxis ? 'x' : 'y'] === value;
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
// Make additional properties available for the formatter
|
|
967
|
+
this.isFirst = isFirst;
|
|
968
|
+
this.isLast = isLast;
|
|
969
|
+
this.point = point;
|
|
970
|
+
|
|
971
|
+
// Call original labelFormatter
|
|
972
|
+
return proceed.call(this);
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
columnIndex++;
|
|
976
|
+
}
|
|
977
|
+
} else {
|
|
978
|
+
// Call original Axis.init()
|
|
979
|
+
proceed.apply(axis, argsToArray(arguments));
|
|
980
|
+
applyGridOptions(axis);
|
|
981
|
+
}
|
|
982
|
+
} else {
|
|
983
|
+
// Call original Axis.init()
|
|
984
|
+
proceed.apply(axis, argsToArray(arguments));
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
|
|
988
|
+
}(Highcharts));
|
|
989
|
+
var Tree = (function (H) {
|
|
990
|
+
/**
|
|
991
|
+
* (c) 2016 Highsoft AS
|
|
992
|
+
* Authors: Jon Arild Nygard
|
|
993
|
+
*
|
|
994
|
+
* License: www.highcharts.com/license
|
|
995
|
+
*/
|
|
996
|
+
/* eslint no-console: 0 */
|
|
997
|
+
var each = H.each,
|
|
998
|
+
extend = H.extend,
|
|
999
|
+
isNumber = H.isNumber,
|
|
1000
|
+
keys = H.keys,
|
|
1001
|
+
map = H.map,
|
|
1002
|
+
pick = H.pick,
|
|
1003
|
+
reduce = H.reduce,
|
|
1004
|
+
isFunction = function (x) {
|
|
1005
|
+
return typeof x === 'function';
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* Creates an object map from parent id to childrens index.
|
|
1010
|
+
* @param {Array} data List of points set in options.
|
|
1011
|
+
* @param {string} data[].parent Parent id of point.
|
|
1012
|
+
* @param {Array} ids List of all point ids.
|
|
1013
|
+
* @returns {Object} Map from parent id to children index in data
|
|
1014
|
+
*/
|
|
1015
|
+
var getListOfParents = function (data, ids) {
|
|
1016
|
+
var listOfParents = reduce(data, function (prev, curr) {
|
|
1017
|
+
var parent = pick(curr.parent, '');
|
|
1018
|
+
if (prev[parent] === undefined) {
|
|
1019
|
+
prev[parent] = [];
|
|
1020
|
+
}
|
|
1021
|
+
prev[parent].push(curr);
|
|
1022
|
+
return prev;
|
|
1023
|
+
}, {}),
|
|
1024
|
+
parents = keys(listOfParents);
|
|
1025
|
+
|
|
1026
|
+
// If parent does not exist, hoist parent to root of tree.
|
|
1027
|
+
each(parents, function (parent, list) {
|
|
1028
|
+
var children = listOfParents[parent];
|
|
1029
|
+
if ((parent !== '') && (H.inArray(parent, ids) === -1)) {
|
|
1030
|
+
each(children, function (child) {
|
|
1031
|
+
list[''].push(child);
|
|
1032
|
+
});
|
|
1033
|
+
delete list[parent];
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
return listOfParents;
|
|
1037
|
+
};
|
|
1038
|
+
var getNode = function (id, parent, level, data, mapOfIdToChildren, options) {
|
|
1039
|
+
var descendants = 0,
|
|
1040
|
+
height = 0,
|
|
1041
|
+
after = options && options.after,
|
|
1042
|
+
before = options && options.before,
|
|
1043
|
+
node = {
|
|
1044
|
+
data: data,
|
|
1045
|
+
depth: level - 1,
|
|
1046
|
+
id: id,
|
|
1047
|
+
level: level,
|
|
1048
|
+
parent: parent
|
|
1049
|
+
},
|
|
1050
|
+
start,
|
|
1051
|
+
end,
|
|
1052
|
+
children;
|
|
1053
|
+
|
|
1054
|
+
// Allow custom logic before the children has been created.
|
|
1055
|
+
if (isFunction(before)) {
|
|
1056
|
+
before(node, options);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* Call getNode recursively on the children. Calulate the height of the
|
|
1061
|
+
* node, and the number of descendants.
|
|
1062
|
+
*/
|
|
1063
|
+
children = map((mapOfIdToChildren[id] || []), function (child) {
|
|
1064
|
+
var node = getNode(
|
|
1065
|
+
child.id,
|
|
1066
|
+
id,
|
|
1067
|
+
(level + 1),
|
|
1068
|
+
child,
|
|
1069
|
+
mapOfIdToChildren,
|
|
1070
|
+
options
|
|
1071
|
+
),
|
|
1072
|
+
childStart = child.start,
|
|
1073
|
+
childEnd = (
|
|
1074
|
+
child.milestone === true ?
|
|
1075
|
+
childStart :
|
|
1076
|
+
child.end
|
|
1077
|
+
);
|
|
1078
|
+
|
|
1079
|
+
// Start should be the lowest child.start.
|
|
1080
|
+
start = (
|
|
1081
|
+
(!isNumber(start) || childStart < start) ?
|
|
1082
|
+
childStart :
|
|
1083
|
+
start
|
|
1084
|
+
);
|
|
1085
|
+
|
|
1086
|
+
// End should be the largest child.end.
|
|
1087
|
+
// If child is milestone, then use start as end.
|
|
1088
|
+
end = (
|
|
1089
|
+
(!isNumber(end) || childEnd > end) ?
|
|
1090
|
+
childEnd :
|
|
1091
|
+
end
|
|
1092
|
+
);
|
|
1093
|
+
|
|
1094
|
+
descendants = descendants + 1 + node.descendants;
|
|
1095
|
+
height = Math.max(node.height + 1, height);
|
|
1096
|
+
return node;
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
// Calculate start and end for point if it is not already explicitly set.
|
|
1100
|
+
if (data) {
|
|
1101
|
+
data.start = pick(data.start, start);
|
|
1102
|
+
data.end = pick(data.end, end);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
extend(node, {
|
|
1106
|
+
children: children,
|
|
1107
|
+
descendants: descendants,
|
|
1108
|
+
height: height
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
// Allow custom logic after the children has been created.
|
|
1112
|
+
if (isFunction(after)) {
|
|
1113
|
+
after(node, options);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
return node;
|
|
1117
|
+
};
|
|
1118
|
+
var getTree = function (data, options) {
|
|
1119
|
+
var ids = map(data, function (d) {
|
|
1120
|
+
return d.id;
|
|
1121
|
+
}),
|
|
1122
|
+
mapOfIdToChildren = getListOfParents(data, ids);
|
|
1123
|
+
return getNode('', null, 1, null, mapOfIdToChildren, options);
|
|
1124
|
+
};
|
|
1125
|
+
|
|
1126
|
+
var Tree = {
|
|
1127
|
+
getListOfParents: getListOfParents,
|
|
1128
|
+
getNode: getNode,
|
|
1129
|
+
getTree: getTree
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
return Tree;
|
|
1134
|
+
}(Highcharts));
|
|
1135
|
+
var result = (function (H) {
|
|
1136
|
+
var each = H.each,
|
|
1137
|
+
extend = H.extend,
|
|
1138
|
+
isArray = H.isArray,
|
|
1139
|
+
isBoolean = function (x) {
|
|
1140
|
+
return typeof x === 'boolean';
|
|
1141
|
+
},
|
|
1142
|
+
isFn = function (x) {
|
|
1143
|
+
return typeof x === 'function';
|
|
1144
|
+
},
|
|
1145
|
+
isObject = H.isObject,
|
|
1146
|
+
isNumber = H.isNumber,
|
|
1147
|
+
merge = H.merge,
|
|
1148
|
+
pick = H.pick,
|
|
1149
|
+
reduce = H.reduce;
|
|
1150
|
+
// TODO Combine buildTree and buildNode with setTreeValues
|
|
1151
|
+
// TODO Remove logic from Treemap and make it utilize this mixin.
|
|
1152
|
+
var setTreeValues = function setTreeValues(tree, options) {
|
|
1153
|
+
var before = options.before,
|
|
1154
|
+
idRoot = options.idRoot,
|
|
1155
|
+
mapIdToNode = options.mapIdToNode,
|
|
1156
|
+
nodeRoot = mapIdToNode[idRoot],
|
|
1157
|
+
levelIsConstant = (
|
|
1158
|
+
isBoolean(options.levelIsConstant) ?
|
|
1159
|
+
options.levelIsConstant :
|
|
1160
|
+
true
|
|
1161
|
+
),
|
|
1162
|
+
points = options.points,
|
|
1163
|
+
point = points[tree.i],
|
|
1164
|
+
optionsPoint = point && point.options || {},
|
|
1165
|
+
childrenTotal = 0,
|
|
1166
|
+
children = [],
|
|
1167
|
+
value;
|
|
1168
|
+
extend(tree, {
|
|
1169
|
+
levelDynamic: tree.level - (levelIsConstant ? 0 : nodeRoot.level),
|
|
1170
|
+
name: pick(point && point.name, ''),
|
|
1171
|
+
visible: (
|
|
1172
|
+
idRoot === tree.id ||
|
|
1173
|
+
(isBoolean(options.visible) ? options.visible : false)
|
|
1174
|
+
)
|
|
1175
|
+
});
|
|
1176
|
+
if (isFn(before)) {
|
|
1177
|
+
tree = before(tree, options);
|
|
1178
|
+
}
|
|
1179
|
+
// First give the children some values
|
|
1180
|
+
each(tree.children, function (child, i) {
|
|
1181
|
+
var newOptions = extend({}, options);
|
|
1182
|
+
extend(newOptions, {
|
|
1183
|
+
index: i,
|
|
1184
|
+
siblings: tree.children.length,
|
|
1185
|
+
visible: tree.visible
|
|
1186
|
+
});
|
|
1187
|
+
child = setTreeValues(child, newOptions);
|
|
1188
|
+
children.push(child);
|
|
1189
|
+
if (child.visible) {
|
|
1190
|
+
childrenTotal += child.val;
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
tree.visible = childrenTotal > 0 || tree.visible;
|
|
1194
|
+
// Set the values
|
|
1195
|
+
value = pick(optionsPoint.value, childrenTotal);
|
|
1196
|
+
extend(tree, {
|
|
1197
|
+
children: children,
|
|
1198
|
+
childrenTotal: childrenTotal,
|
|
1199
|
+
isLeaf: tree.visible && !childrenTotal,
|
|
1200
|
+
val: value
|
|
1201
|
+
});
|
|
1202
|
+
return tree;
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
var getColor = function getColor(node, options) {
|
|
1206
|
+
var index = options.index,
|
|
1207
|
+
mapOptionsToLevel = options.mapOptionsToLevel,
|
|
1208
|
+
parentColor = options.parentColor,
|
|
1209
|
+
parentColorIndex = options.parentColorIndex,
|
|
1210
|
+
series = options.series,
|
|
1211
|
+
colors = options.colors,
|
|
1212
|
+
siblings = options.siblings,
|
|
1213
|
+
points = series.points,
|
|
1214
|
+
getColorByPoint,
|
|
1215
|
+
point,
|
|
1216
|
+
level,
|
|
1217
|
+
colorByPoint,
|
|
1218
|
+
colorIndexByPoint,
|
|
1219
|
+
color,
|
|
1220
|
+
colorIndex;
|
|
1221
|
+
function variation(color) {
|
|
1222
|
+
var colorVariation = level && level.colorVariation;
|
|
1223
|
+
if (colorVariation) {
|
|
1224
|
+
if (colorVariation.key === 'brightness') {
|
|
1225
|
+
return H.color(color).brighten(
|
|
1226
|
+
colorVariation.to * (index / siblings)
|
|
1227
|
+
).get();
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
return color;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
if (node) {
|
|
1235
|
+
point = points[node.i];
|
|
1236
|
+
level = mapOptionsToLevel[node.level] || {};
|
|
1237
|
+
getColorByPoint = point && level.colorByPoint;
|
|
1238
|
+
|
|
1239
|
+
if (getColorByPoint) {
|
|
1240
|
+
colorIndexByPoint = point.index % (colors ?
|
|
1241
|
+
colors.length :
|
|
1242
|
+
series.chart.options.chart.colorCount
|
|
1243
|
+
);
|
|
1244
|
+
colorByPoint = colors && colors[colorIndexByPoint];
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
// Select either point color, level color or inherited color.
|
|
1249
|
+
color = pick(
|
|
1250
|
+
point && point.options.color,
|
|
1251
|
+
level && level.color,
|
|
1252
|
+
colorByPoint,
|
|
1253
|
+
parentColor && variation(parentColor),
|
|
1254
|
+
series.color
|
|
1255
|
+
);
|
|
1256
|
+
|
|
1257
|
+
colorIndex = pick(
|
|
1258
|
+
point && point.options.colorIndex,
|
|
1259
|
+
level && level.colorIndex,
|
|
1260
|
+
colorIndexByPoint,
|
|
1261
|
+
parentColorIndex,
|
|
1262
|
+
options.colorIndex
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
return {
|
|
1266
|
+
color: color,
|
|
1267
|
+
colorIndex: colorIndex
|
|
1268
|
+
};
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1271
|
+
/**
|
|
1272
|
+
* getLevelOptions - Creates a map from level number to its given options.
|
|
1273
|
+
* @param {Object} params Object containing parameters.
|
|
1274
|
+
* @param {Object} params.defaults Object containing default options. The
|
|
1275
|
+
* default options are merged with the userOptions to get the final options for
|
|
1276
|
+
* a specific level.
|
|
1277
|
+
* @param {Number} params.from The lowest level number.
|
|
1278
|
+
* @param {Array} params.levels User options from series.levels.
|
|
1279
|
+
* @param {Number} params.to The highest level number.
|
|
1280
|
+
* @return {null|Object} Returns a map from level number to its given options.
|
|
1281
|
+
* Returns null if invalid input parameters.
|
|
1282
|
+
*/
|
|
1283
|
+
var getLevelOptions = function getLevelOptions(params) {
|
|
1284
|
+
var result = null,
|
|
1285
|
+
defaults,
|
|
1286
|
+
converted,
|
|
1287
|
+
i,
|
|
1288
|
+
from,
|
|
1289
|
+
to,
|
|
1290
|
+
levels;
|
|
1291
|
+
if (isObject(params)) {
|
|
1292
|
+
result = {};
|
|
1293
|
+
from = isNumber(params.from) ? params.from : 1;
|
|
1294
|
+
levels = params.levels;
|
|
1295
|
+
converted = {};
|
|
1296
|
+
defaults = isObject(params.defaults) ? params.defaults : {};
|
|
1297
|
+
if (isArray(levels)) {
|
|
1298
|
+
converted = reduce(levels, function (obj, item) {
|
|
1299
|
+
var level,
|
|
1300
|
+
levelIsConstant,
|
|
1301
|
+
options;
|
|
1302
|
+
if (isObject(item) && isNumber(item.level)) {
|
|
1303
|
+
options = merge({}, item);
|
|
1304
|
+
levelIsConstant = (
|
|
1305
|
+
isBoolean(options.levelIsConstant) ?
|
|
1306
|
+
options.levelIsConstant :
|
|
1307
|
+
defaults.levelIsConstant
|
|
1308
|
+
);
|
|
1309
|
+
// Delete redundant properties.
|
|
1310
|
+
delete options.levelIsConstant;
|
|
1311
|
+
delete options.level;
|
|
1312
|
+
// Calculate which level these options apply to.
|
|
1313
|
+
level = item.level + (levelIsConstant ? 0 : from - 1);
|
|
1314
|
+
if (isObject(obj[level])) {
|
|
1315
|
+
extend(obj[level], options);
|
|
1316
|
+
} else {
|
|
1317
|
+
obj[level] = options;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
return obj;
|
|
1321
|
+
}, {});
|
|
1322
|
+
}
|
|
1323
|
+
to = isNumber(params.to) ? params.to : 1;
|
|
1324
|
+
for (i = 0; i <= to; i++) {
|
|
1325
|
+
result[i] = merge(
|
|
1326
|
+
{},
|
|
1327
|
+
defaults,
|
|
1328
|
+
isObject(converted[i]) ? converted[i] : {}
|
|
1329
|
+
);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
return result;
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* Update the rootId property on the series. Also makes sure that it is
|
|
1337
|
+
* accessible to exporting.
|
|
1338
|
+
* @param {object} series The series to operate on.
|
|
1339
|
+
* @returns Returns the resulting rootId after update.
|
|
1340
|
+
*/
|
|
1341
|
+
var updateRootId = function (series) {
|
|
1342
|
+
var rootId,
|
|
1343
|
+
options;
|
|
1344
|
+
if (isObject(series)) {
|
|
1345
|
+
// Get the series options.
|
|
1346
|
+
options = isObject(series.options) ? series.options : {};
|
|
1347
|
+
|
|
1348
|
+
// Calculate the rootId.
|
|
1349
|
+
rootId = pick(series.rootNode, options.rootId, '');
|
|
1350
|
+
|
|
1351
|
+
// Set rootId on series.userOptions to pick it up in exporting.
|
|
1352
|
+
if (isObject(series.userOptions)) {
|
|
1353
|
+
series.userOptions.rootId = rootId;
|
|
1354
|
+
}
|
|
1355
|
+
// Set rootId on series to pick it up on next update.
|
|
1356
|
+
series.rootNode = rootId;
|
|
1357
|
+
}
|
|
1358
|
+
return rootId;
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1361
|
+
var result = {
|
|
1362
|
+
getColor: getColor,
|
|
1363
|
+
getLevelOptions: getLevelOptions,
|
|
1364
|
+
setTreeValues: setTreeValues,
|
|
1365
|
+
updateRootId: updateRootId
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
return result;
|
|
1369
|
+
}(Highcharts));
|
|
1370
|
+
(function (H) {
|
|
1371
|
+
/**
|
|
1372
|
+
* (c) 2009-2018 Torstein Honsi
|
|
1373
|
+
*
|
|
1374
|
+
* License: www.highcharts.com/license
|
|
1375
|
+
*/
|
|
1376
|
+
|
|
1377
|
+
var addEvent = H.addEvent,
|
|
1378
|
+
pick = H.pick,
|
|
1379
|
+
wrap = H.wrap,
|
|
1380
|
+
each = H.each,
|
|
1381
|
+
extend = H.extend,
|
|
1382
|
+
isArray = H.isArray,
|
|
1383
|
+
fireEvent = H.fireEvent,
|
|
1384
|
+
Axis = H.Axis,
|
|
1385
|
+
Series = H.Series;
|
|
1386
|
+
|
|
1387
|
+
function stripArguments() {
|
|
1388
|
+
return Array.prototype.slice.call(arguments, 1);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
extend(Axis.prototype, {
|
|
1392
|
+
isInBreak: function (brk, val) {
|
|
1393
|
+
var ret,
|
|
1394
|
+
repeat = brk.repeat || Infinity,
|
|
1395
|
+
from = brk.from,
|
|
1396
|
+
length = brk.to - brk.from,
|
|
1397
|
+
test = (
|
|
1398
|
+
val >= from ?
|
|
1399
|
+
(val - from) % repeat :
|
|
1400
|
+
repeat - ((from - val) % repeat)
|
|
1401
|
+
);
|
|
1402
|
+
|
|
1403
|
+
if (!brk.inclusive) {
|
|
1404
|
+
ret = test < length && test !== 0;
|
|
1405
|
+
} else {
|
|
1406
|
+
ret = test <= length;
|
|
1407
|
+
}
|
|
1408
|
+
return ret;
|
|
1409
|
+
},
|
|
1410
|
+
|
|
1411
|
+
isInAnyBreak: function (val, testKeep) {
|
|
1412
|
+
|
|
1413
|
+
var breaks = this.options.breaks,
|
|
1414
|
+
i = breaks && breaks.length,
|
|
1415
|
+
inbrk,
|
|
1416
|
+
keep,
|
|
1417
|
+
ret;
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
if (i) {
|
|
1421
|
+
|
|
1422
|
+
while (i--) {
|
|
1423
|
+
if (this.isInBreak(breaks[i], val)) {
|
|
1424
|
+
inbrk = true;
|
|
1425
|
+
if (!keep) {
|
|
1426
|
+
keep = pick(
|
|
1427
|
+
breaks[i].showPoints,
|
|
1428
|
+
this.isXAxis ? false : true
|
|
1429
|
+
);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
if (inbrk && testKeep) {
|
|
1435
|
+
ret = inbrk && !keep;
|
|
1436
|
+
} else {
|
|
1437
|
+
ret = inbrk;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
return ret;
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
addEvent(Axis, 'afterInit', function () {
|
|
1445
|
+
if (typeof this.setBreaks === 'function') {
|
|
1446
|
+
this.setBreaks(this.options.breaks, false);
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
|
|
1450
|
+
addEvent(Axis, 'afterSetTickPositions', function () {
|
|
1451
|
+
if (this.isBroken) {
|
|
1452
|
+
var axis = this,
|
|
1453
|
+
tickPositions = this.tickPositions,
|
|
1454
|
+
info = this.tickPositions.info,
|
|
1455
|
+
newPositions = [],
|
|
1456
|
+
i;
|
|
1457
|
+
|
|
1458
|
+
for (i = 0; i < tickPositions.length; i++) {
|
|
1459
|
+
if (!axis.isInAnyBreak(tickPositions[i])) {
|
|
1460
|
+
newPositions.push(tickPositions[i]);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
this.tickPositions = newPositions;
|
|
1465
|
+
this.tickPositions.info = info;
|
|
1466
|
+
}
|
|
1467
|
+
});
|
|
1468
|
+
|
|
1469
|
+
// Force Axis to be not-ordinal when breaks are defined
|
|
1470
|
+
addEvent(Axis, 'afterSetOptions', function () {
|
|
1471
|
+
if (this.isBroken) {
|
|
1472
|
+
this.options.ordinal = false;
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Dynamically set or unset breaks in an axis. This function in lighter than
|
|
1478
|
+
* usin Axis.update, and it also preserves animation.
|
|
1479
|
+
* @param {Array} [breaks]
|
|
1480
|
+
* The breaks to add. When `undefined` it removes existing breaks.
|
|
1481
|
+
* @param {Boolean} [redraw=true]
|
|
1482
|
+
* Whether to redraw the chart immediately.
|
|
1483
|
+
*/
|
|
1484
|
+
Axis.prototype.setBreaks = function (breaks, redraw) {
|
|
1485
|
+
var axis = this,
|
|
1486
|
+
isBroken = (isArray(breaks) && !!breaks.length);
|
|
1487
|
+
|
|
1488
|
+
function breakVal2Lin(val) {
|
|
1489
|
+
var nval = val,
|
|
1490
|
+
brk,
|
|
1491
|
+
i;
|
|
1492
|
+
|
|
1493
|
+
for (i = 0; i < axis.breakArray.length; i++) {
|
|
1494
|
+
brk = axis.breakArray[i];
|
|
1495
|
+
if (brk.to <= val) {
|
|
1496
|
+
nval -= brk.len;
|
|
1497
|
+
} else if (brk.from >= val) {
|
|
1498
|
+
break;
|
|
1499
|
+
} else if (axis.isInBreak(brk, val)) {
|
|
1500
|
+
nval -= (val - brk.from);
|
|
1501
|
+
break;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
return nval;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
function breakLin2Val(val) {
|
|
1509
|
+
var nval = val,
|
|
1510
|
+
brk,
|
|
1511
|
+
i;
|
|
1512
|
+
|
|
1513
|
+
for (i = 0; i < axis.breakArray.length; i++) {
|
|
1514
|
+
brk = axis.breakArray[i];
|
|
1515
|
+
if (brk.from >= nval) {
|
|
1516
|
+
break;
|
|
1517
|
+
} else if (brk.to < nval) {
|
|
1518
|
+
nval += brk.len;
|
|
1519
|
+
} else if (axis.isInBreak(brk, nval)) {
|
|
1520
|
+
nval += brk.len;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
return nval;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
|
|
1527
|
+
axis.isDirty = axis.isBroken !== isBroken;
|
|
1528
|
+
axis.isBroken = isBroken;
|
|
1529
|
+
axis.options.breaks = axis.userOptions.breaks = breaks;
|
|
1530
|
+
axis.forceRedraw = true; // Force recalculation in setScale
|
|
1531
|
+
|
|
1532
|
+
if (!isBroken && axis.val2lin === breakVal2Lin) {
|
|
1533
|
+
// Revert to prototype functions
|
|
1534
|
+
delete axis.val2lin;
|
|
1535
|
+
delete axis.lin2val;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
if (isBroken) {
|
|
1539
|
+
axis.userOptions.ordinal = false;
|
|
1540
|
+
axis.val2lin = breakVal2Lin;
|
|
1541
|
+
axis.lin2val = breakLin2Val;
|
|
1542
|
+
|
|
1543
|
+
axis.setExtremes = function (
|
|
1544
|
+
newMin,
|
|
1545
|
+
newMax,
|
|
1546
|
+
redraw,
|
|
1547
|
+
animation,
|
|
1548
|
+
eventArguments
|
|
1549
|
+
) {
|
|
1550
|
+
// If trying to set extremes inside a break, extend it to before and
|
|
1551
|
+
// after the break ( #3857 )
|
|
1552
|
+
if (this.isBroken) {
|
|
1553
|
+
while (this.isInAnyBreak(newMin)) {
|
|
1554
|
+
newMin -= this.closestPointRange;
|
|
1555
|
+
}
|
|
1556
|
+
while (this.isInAnyBreak(newMax)) {
|
|
1557
|
+
newMax -= this.closestPointRange;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
Axis.prototype.setExtremes.call(
|
|
1561
|
+
this,
|
|
1562
|
+
newMin,
|
|
1563
|
+
newMax,
|
|
1564
|
+
redraw,
|
|
1565
|
+
animation,
|
|
1566
|
+
eventArguments
|
|
1567
|
+
);
|
|
1568
|
+
};
|
|
1569
|
+
|
|
1570
|
+
axis.setAxisTranslation = function (saveOld) {
|
|
1571
|
+
Axis.prototype.setAxisTranslation.call(this, saveOld);
|
|
1572
|
+
|
|
1573
|
+
this.unitLength = null;
|
|
1574
|
+
if (this.isBroken) {
|
|
1575
|
+
var breaks = axis.options.breaks,
|
|
1576
|
+
breakArrayT = [], // Temporary one
|
|
1577
|
+
breakArray = [],
|
|
1578
|
+
length = 0,
|
|
1579
|
+
inBrk,
|
|
1580
|
+
repeat,
|
|
1581
|
+
min = axis.userMin || axis.min,
|
|
1582
|
+
max = axis.userMax || axis.max,
|
|
1583
|
+
pointRangePadding = pick(axis.pointRangePadding, 0),
|
|
1584
|
+
start,
|
|
1585
|
+
i;
|
|
1586
|
+
|
|
1587
|
+
// Min & max check (#4247)
|
|
1588
|
+
each(breaks, function (brk) {
|
|
1589
|
+
repeat = brk.repeat || Infinity;
|
|
1590
|
+
if (axis.isInBreak(brk, min)) {
|
|
1591
|
+
min += (brk.to % repeat) - (min % repeat);
|
|
1592
|
+
}
|
|
1593
|
+
if (axis.isInBreak(brk, max)) {
|
|
1594
|
+
max -= (max % repeat) - (brk.from % repeat);
|
|
1595
|
+
}
|
|
1596
|
+
});
|
|
1597
|
+
|
|
1598
|
+
// Construct an array holding all breaks in the axis
|
|
1599
|
+
each(breaks, function (brk) {
|
|
1600
|
+
start = brk.from;
|
|
1601
|
+
repeat = brk.repeat || Infinity;
|
|
1602
|
+
|
|
1603
|
+
while (start - repeat > min) {
|
|
1604
|
+
start -= repeat;
|
|
1605
|
+
}
|
|
1606
|
+
while (start < min) {
|
|
1607
|
+
start += repeat;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
for (i = start; i < max; i += repeat) {
|
|
1611
|
+
breakArrayT.push({
|
|
1612
|
+
value: i,
|
|
1613
|
+
move: 'in'
|
|
1614
|
+
});
|
|
1615
|
+
breakArrayT.push({
|
|
1616
|
+
value: i + (brk.to - brk.from),
|
|
1617
|
+
move: 'out',
|
|
1618
|
+
size: brk.breakSize
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
|
|
1623
|
+
breakArrayT.sort(function (a, b) {
|
|
1624
|
+
return (
|
|
1625
|
+
(a.value === b.value) ?
|
|
1626
|
+
(a.move === 'in' ? 0 : 1) - (b.move === 'in' ? 0 : 1) :
|
|
1627
|
+
a.value - b.value
|
|
1628
|
+
);
|
|
1629
|
+
});
|
|
1630
|
+
|
|
1631
|
+
// Simplify the breaks
|
|
1632
|
+
inBrk = 0;
|
|
1633
|
+
start = min;
|
|
1634
|
+
|
|
1635
|
+
each(breakArrayT, function (brk) {
|
|
1636
|
+
inBrk += (brk.move === 'in' ? 1 : -1);
|
|
1637
|
+
|
|
1638
|
+
if (inBrk === 1 && brk.move === 'in') {
|
|
1639
|
+
start = brk.value;
|
|
1640
|
+
}
|
|
1641
|
+
if (inBrk === 0) {
|
|
1642
|
+
breakArray.push({
|
|
1643
|
+
from: start,
|
|
1644
|
+
to: brk.value,
|
|
1645
|
+
len: brk.value - start - (brk.size || 0)
|
|
1646
|
+
});
|
|
1647
|
+
length += brk.value - start - (brk.size || 0);
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
1650
|
+
|
|
1651
|
+
axis.breakArray = breakArray;
|
|
1652
|
+
|
|
1653
|
+
// Used with staticScale, and below, the actual axis length when
|
|
1654
|
+
// breaks are substracted.
|
|
1655
|
+
axis.unitLength = max - min - length + pointRangePadding;
|
|
1656
|
+
|
|
1657
|
+
fireEvent(axis, 'afterBreaks');
|
|
1658
|
+
|
|
1659
|
+
if (axis.staticScale) {
|
|
1660
|
+
axis.transA = axis.staticScale;
|
|
1661
|
+
} else if (axis.unitLength) {
|
|
1662
|
+
axis.transA *= (max - axis.min + pointRangePadding) /
|
|
1663
|
+
axis.unitLength;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
if (pointRangePadding) {
|
|
1667
|
+
axis.minPixelPadding = axis.transA * axis.minPointOffset;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
axis.min = min;
|
|
1671
|
+
axis.max = max;
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
if (pick(redraw, true)) {
|
|
1677
|
+
this.chart.redraw();
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
|
|
1681
|
+
wrap(Series.prototype, 'generatePoints', function (proceed) {
|
|
1682
|
+
|
|
1683
|
+
proceed.apply(this, stripArguments(arguments));
|
|
1684
|
+
|
|
1685
|
+
var series = this,
|
|
1686
|
+
xAxis = series.xAxis,
|
|
1687
|
+
yAxis = series.yAxis,
|
|
1688
|
+
points = series.points,
|
|
1689
|
+
point,
|
|
1690
|
+
i = points.length,
|
|
1691
|
+
connectNulls = series.options.connectNulls,
|
|
1692
|
+
nullGap;
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
if (xAxis && yAxis && (xAxis.options.breaks || yAxis.options.breaks)) {
|
|
1696
|
+
while (i--) {
|
|
1697
|
+
point = points[i];
|
|
1698
|
+
|
|
1699
|
+
// Respect nulls inside the break (#4275)
|
|
1700
|
+
nullGap = point.y === null && connectNulls === false;
|
|
1701
|
+
if (
|
|
1702
|
+
!nullGap &&
|
|
1703
|
+
(
|
|
1704
|
+
xAxis.isInAnyBreak(point.x, true) ||
|
|
1705
|
+
yAxis.isInAnyBreak(point.y, true)
|
|
1706
|
+
)
|
|
1707
|
+
) {
|
|
1708
|
+
points.splice(i, 1);
|
|
1709
|
+
if (this.data[i]) {
|
|
1710
|
+
// Removes the graphics for this point if they exist
|
|
1711
|
+
this.data[i].destroyElements();
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
});
|
|
1718
|
+
|
|
1719
|
+
function drawPointsWrapped(proceed) {
|
|
1720
|
+
proceed.apply(this);
|
|
1721
|
+
this.drawBreaks(this.xAxis, ['x']);
|
|
1722
|
+
this.drawBreaks(this.yAxis, pick(this.pointArrayMap, ['y']));
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
H.Series.prototype.drawBreaks = function (axis, keys) {
|
|
1726
|
+
var series = this,
|
|
1727
|
+
points = series.points,
|
|
1728
|
+
breaks,
|
|
1729
|
+
threshold,
|
|
1730
|
+
eventName,
|
|
1731
|
+
y;
|
|
1732
|
+
|
|
1733
|
+
if (!axis) {
|
|
1734
|
+
return; // #5950
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
each(keys, function (key) {
|
|
1738
|
+
breaks = axis.breakArray || [];
|
|
1739
|
+
threshold = axis.isXAxis ?
|
|
1740
|
+
axis.min :
|
|
1741
|
+
pick(series.options.threshold, axis.min);
|
|
1742
|
+
each(points, function (point) {
|
|
1743
|
+
y = pick(point['stack' + key.toUpperCase()], point[key]);
|
|
1744
|
+
each(breaks, function (brk) {
|
|
1745
|
+
eventName = false;
|
|
1746
|
+
|
|
1747
|
+
if (
|
|
1748
|
+
(threshold < brk.from && y > brk.to) ||
|
|
1749
|
+
(threshold > brk.from && y < brk.from)
|
|
1750
|
+
) {
|
|
1751
|
+
eventName = 'pointBreak';
|
|
1752
|
+
|
|
1753
|
+
} else if (
|
|
1754
|
+
(threshold < brk.from && y > brk.from && y < brk.to) ||
|
|
1755
|
+
(threshold > brk.from && y > brk.to && y < brk.from)
|
|
1756
|
+
) {
|
|
1757
|
+
eventName = 'pointInBreak';
|
|
1758
|
+
}
|
|
1759
|
+
if (eventName) {
|
|
1760
|
+
fireEvent(axis, eventName, { point: point, brk: brk });
|
|
1761
|
+
}
|
|
1762
|
+
});
|
|
1763
|
+
});
|
|
1764
|
+
});
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* Extend getGraphPath by identifying gaps in the data so that we can draw a gap
|
|
1770
|
+
* in the line or area. This was moved from ordinal axis module to broken axis
|
|
1771
|
+
* module as of #5045.
|
|
1772
|
+
*/
|
|
1773
|
+
H.Series.prototype.gappedPath = function () {
|
|
1774
|
+
var currentDataGrouping = this.currentDataGrouping,
|
|
1775
|
+
groupingSize = currentDataGrouping && currentDataGrouping.totalRange,
|
|
1776
|
+
gapSize = this.options.gapSize,
|
|
1777
|
+
points = this.points.slice(),
|
|
1778
|
+
i = points.length - 1,
|
|
1779
|
+
yAxis = this.yAxis,
|
|
1780
|
+
xRange,
|
|
1781
|
+
stack;
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* Defines when to display a gap in the graph, together with the
|
|
1785
|
+
* [gapUnit](plotOptions.series.gapUnit) option.
|
|
1786
|
+
*
|
|
1787
|
+
* In case when `dataGrouping` is enabled, points can be grouped into a
|
|
1788
|
+
* larger time span. This can make the grouped points to have a greater
|
|
1789
|
+
* distance than the absolute value of `gapSize` property, which will result
|
|
1790
|
+
* in disappearing graph completely. To prevent this situation the mentioned
|
|
1791
|
+
* distance between grouped points is used instead of previously defined
|
|
1792
|
+
* `gapSize`.
|
|
1793
|
+
*
|
|
1794
|
+
* In practice, this option is most often used to visualize gaps in
|
|
1795
|
+
* time series. In a stock chart, intraday data is available for daytime
|
|
1796
|
+
* hours, while gaps will appear in nights and weekends.
|
|
1797
|
+
*
|
|
1798
|
+
* @type {Number}
|
|
1799
|
+
* @see [gapUnit](plotOptions.series.gapUnit) and
|
|
1800
|
+
* [xAxis.breaks](#xAxis.breaks)
|
|
1801
|
+
* @sample {highstock} stock/plotoptions/series-gapsize/
|
|
1802
|
+
* Setting the gap size to 2 introduces gaps for weekends in daily
|
|
1803
|
+
* datasets.
|
|
1804
|
+
* @default 0
|
|
1805
|
+
* @product highstock
|
|
1806
|
+
* @apioption plotOptions.series.gapSize
|
|
1807
|
+
*/
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* Together with [gapSize](plotOptions.series.gapSize), this option defines
|
|
1811
|
+
* where to draw gaps in the graph.
|
|
1812
|
+
*
|
|
1813
|
+
* When the `gapUnit` is `relative` (default), a gap size of 5 means
|
|
1814
|
+
* that if the distance between two points is greater than five times
|
|
1815
|
+
* that of the two closest points, the graph will be broken.
|
|
1816
|
+
*
|
|
1817
|
+
* When the `gapUnit` is `value`, the gap is based on absolute axis values,
|
|
1818
|
+
* which on a datetime axis is milliseconds. This also applies to the
|
|
1819
|
+
* navigator series that inherits gap options from the base series.
|
|
1820
|
+
*
|
|
1821
|
+
* @type {String}
|
|
1822
|
+
* @see [gapSize](plotOptions.series.gapSize)
|
|
1823
|
+
* @default relative
|
|
1824
|
+
* @validvalue ["relative", "value"]
|
|
1825
|
+
* @since 5.0.13
|
|
1826
|
+
* @product highstock
|
|
1827
|
+
* @apioption plotOptions.series.gapUnit
|
|
1828
|
+
*/
|
|
1829
|
+
|
|
1830
|
+
if (gapSize && i > 0) { // #5008
|
|
1831
|
+
|
|
1832
|
+
// Gap unit is relative
|
|
1833
|
+
if (this.options.gapUnit !== 'value') {
|
|
1834
|
+
gapSize *= this.closestPointRange;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
// Setting a new gapSize in case dataGrouping is enabled (#7686)
|
|
1838
|
+
if (groupingSize && groupingSize > gapSize) {
|
|
1839
|
+
gapSize = groupingSize;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
// extension for ordinal breaks
|
|
1843
|
+
while (i--) {
|
|
1844
|
+
if (points[i + 1].x - points[i].x > gapSize) {
|
|
1845
|
+
xRange = (points[i].x + points[i + 1].x) / 2;
|
|
1846
|
+
|
|
1847
|
+
points.splice( // insert after this one
|
|
1848
|
+
i + 1,
|
|
1849
|
+
0,
|
|
1850
|
+
{
|
|
1851
|
+
isNull: true,
|
|
1852
|
+
x: xRange
|
|
1853
|
+
}
|
|
1854
|
+
);
|
|
1855
|
+
|
|
1856
|
+
// For stacked chart generate empty stack items, #6546
|
|
1857
|
+
if (this.options.stacking) {
|
|
1858
|
+
stack = yAxis.stacks[this.stackKey][xRange] =
|
|
1859
|
+
new H.StackItem(
|
|
1860
|
+
yAxis,
|
|
1861
|
+
yAxis.options.stackLabels,
|
|
1862
|
+
false,
|
|
1863
|
+
xRange,
|
|
1864
|
+
this.stack
|
|
1865
|
+
);
|
|
1866
|
+
stack.total = 0;
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
// Call base method
|
|
1873
|
+
return this.getGraphPath(points);
|
|
1874
|
+
};
|
|
1875
|
+
|
|
1876
|
+
wrap(H.seriesTypes.column.prototype, 'drawPoints', drawPointsWrapped);
|
|
1877
|
+
wrap(H.Series.prototype, 'drawPoints', drawPointsWrapped);
|
|
1878
|
+
|
|
1879
|
+
}(Highcharts));
|
|
1880
|
+
(function (H, Tree, mixinTreeSeries) {
|
|
1881
|
+
/**
|
|
1882
|
+
* (c) 2016 Highsoft AS
|
|
1883
|
+
* Authors: Jon Arild Nygard
|
|
1884
|
+
*
|
|
1885
|
+
* License: www.highcharts.com/license
|
|
1886
|
+
*/
|
|
1887
|
+
/* eslint no-console: 0 */
|
|
1888
|
+
var argsToArray = function (args) {
|
|
1889
|
+
return Array.prototype.slice.call(args, 1);
|
|
1890
|
+
},
|
|
1891
|
+
defined = H.defined,
|
|
1892
|
+
each = H.each,
|
|
1893
|
+
extend = H.extend,
|
|
1894
|
+
find = H.find,
|
|
1895
|
+
fireEvent = H.fireEvent,
|
|
1896
|
+
getLevelOptions = mixinTreeSeries.getLevelOptions,
|
|
1897
|
+
map = H.map,
|
|
1898
|
+
merge = H.merge,
|
|
1899
|
+
inArray = H.inArray,
|
|
1900
|
+
isBoolean = function (x) {
|
|
1901
|
+
return typeof x === 'boolean';
|
|
1902
|
+
},
|
|
1903
|
+
isNumber = H.isNumber,
|
|
1904
|
+
isObject = function (x) {
|
|
1905
|
+
// Always use strict mode.
|
|
1906
|
+
return H.isObject(x, true);
|
|
1907
|
+
},
|
|
1908
|
+
isString = H.isString,
|
|
1909
|
+
keys = H.keys,
|
|
1910
|
+
pick = H.pick,
|
|
1911
|
+
reduce = H.reduce,
|
|
1912
|
+
wrap = H.wrap,
|
|
1913
|
+
GridAxis = H.Axis,
|
|
1914
|
+
GridAxisTick = H.Tick;
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* some - Equivalent of Array.prototype.some
|
|
1918
|
+
*
|
|
1919
|
+
* @param {Array} arr Array to look for matching elements in.
|
|
1920
|
+
* @param {function} condition The condition to check against.
|
|
1921
|
+
* @return {boolean} Whether some elements pass the condition.
|
|
1922
|
+
*/
|
|
1923
|
+
var some = function (arr, condition) {
|
|
1924
|
+
var result = false;
|
|
1925
|
+
each(arr, function (element, index, array) {
|
|
1926
|
+
if (!result) {
|
|
1927
|
+
result = condition(element, index, array);
|
|
1928
|
+
}
|
|
1929
|
+
});
|
|
1930
|
+
return result;
|
|
1931
|
+
};
|
|
1932
|
+
|
|
1933
|
+
var override = function (obj, methods) {
|
|
1934
|
+
var method,
|
|
1935
|
+
func;
|
|
1936
|
+
for (method in methods) {
|
|
1937
|
+
if (methods.hasOwnProperty(method)) {
|
|
1938
|
+
func = methods[method];
|
|
1939
|
+
wrap(obj, method, func);
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* getCategoriesFromTree - getCategories based on a tree
|
|
1946
|
+
*
|
|
1947
|
+
* @param {object} tree Root of tree to collect categories from
|
|
1948
|
+
* @return {Array} Array of categories
|
|
1949
|
+
*/
|
|
1950
|
+
var getCategoriesFromTree = function (tree) {
|
|
1951
|
+
var categories = [];
|
|
1952
|
+
if (tree.data) {
|
|
1953
|
+
categories.push(tree.data.name);
|
|
1954
|
+
}
|
|
1955
|
+
each(tree.children, function (child) {
|
|
1956
|
+
categories = categories.concat(getCategoriesFromTree(child));
|
|
1957
|
+
});
|
|
1958
|
+
return categories;
|
|
1959
|
+
};
|
|
1960
|
+
|
|
1961
|
+
var mapTickPosToNode = function (node, categories) {
|
|
1962
|
+
var map = {},
|
|
1963
|
+
name = node.data && node.data.name,
|
|
1964
|
+
pos = inArray(name, categories);
|
|
1965
|
+
map[pos] = node;
|
|
1966
|
+
each(node.children, function (child) {
|
|
1967
|
+
extend(map, mapTickPosToNode(child, categories));
|
|
1968
|
+
});
|
|
1969
|
+
return map;
|
|
1970
|
+
};
|
|
1971
|
+
|
|
1972
|
+
var getBreakFromNode = function (node, max) {
|
|
1973
|
+
var from = node.collapseStart,
|
|
1974
|
+
to = node.collapseEnd;
|
|
1975
|
+
|
|
1976
|
+
// In broken-axis, the axis.max is minimized until it is not within a break.
|
|
1977
|
+
// Therefore, if break.to is larger than axis.max, the axis.to should not
|
|
1978
|
+
// add the 0.5 axis.tickMarkOffset, to avoid adding a break larger than
|
|
1979
|
+
// axis.max
|
|
1980
|
+
// TODO consider simplifying broken-axis and this might solve itself
|
|
1981
|
+
if (to >= max) {
|
|
1982
|
+
from -= 0.5;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
return {
|
|
1986
|
+
from: from,
|
|
1987
|
+
to: to,
|
|
1988
|
+
showPoints: false
|
|
1989
|
+
};
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* Creates a list of positions for the ticks on the axis. Filters out positions
|
|
1994
|
+
* that are outside min and max, or is inside an axis break.
|
|
1995
|
+
*
|
|
1996
|
+
* @param {Object} axis The Axis to get the tick positions from.
|
|
1997
|
+
* @param {number} axis.min The minimum value of the axis.
|
|
1998
|
+
* @param {number} axis.max The maximum value of the axis.
|
|
1999
|
+
* @param {function} axis.isInAnyBreak Function to determine if a position is
|
|
2000
|
+
* inside any breaks on the axis.
|
|
2001
|
+
* @returns {number[]} List of positions.
|
|
2002
|
+
*/
|
|
2003
|
+
var getTickPositions = function (axis) {
|
|
2004
|
+
return reduce(
|
|
2005
|
+
keys(axis.mapOfPosToGridNode),
|
|
2006
|
+
function (arr, key) {
|
|
2007
|
+
var pos = +key;
|
|
2008
|
+
if (
|
|
2009
|
+
axis.min <= pos &&
|
|
2010
|
+
axis.max >= pos &&
|
|
2011
|
+
!axis.isInAnyBreak(pos)
|
|
2012
|
+
) {
|
|
2013
|
+
arr.push(pos);
|
|
2014
|
+
}
|
|
2015
|
+
return arr;
|
|
2016
|
+
},
|
|
2017
|
+
[]
|
|
2018
|
+
);
|
|
2019
|
+
};
|
|
2020
|
+
/**
|
|
2021
|
+
* Check if a node is collapsed.
|
|
2022
|
+
* @param {object} axis The axis to check against.
|
|
2023
|
+
* @param {object} node The node to check if is collapsed.
|
|
2024
|
+
* @param {number} pos The tick position to collapse.
|
|
2025
|
+
* @returns {boolean} Returns true if collapsed, false if expanded.
|
|
2026
|
+
*/
|
|
2027
|
+
var isCollapsed = function (axis, node) {
|
|
2028
|
+
var breaks = (axis.options.breaks || []),
|
|
2029
|
+
obj = getBreakFromNode(node, axis.max);
|
|
2030
|
+
return some(breaks, function (b) {
|
|
2031
|
+
return b.from === obj.from && b.to === obj.to;
|
|
2032
|
+
});
|
|
2033
|
+
};
|
|
2034
|
+
|
|
2035
|
+
/**
|
|
2036
|
+
* Calculates the new axis breaks to collapse a node.
|
|
2037
|
+
* @param {object} axis The axis to check against.
|
|
2038
|
+
* @param {object} node The node to collapse.
|
|
2039
|
+
* @param {number} pos The tick position to collapse.
|
|
2040
|
+
* @returns {array} Returns an array of the new breaks for the axis.
|
|
2041
|
+
*/
|
|
2042
|
+
var collapse = function (axis, node) {
|
|
2043
|
+
var breaks = (axis.options.breaks || []),
|
|
2044
|
+
obj = getBreakFromNode(node, axis.max);
|
|
2045
|
+
breaks.push(obj);
|
|
2046
|
+
return breaks;
|
|
2047
|
+
};
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* Calculates the new axis breaks to expand a node.
|
|
2051
|
+
* @param {object} axis The axis to check against.
|
|
2052
|
+
* @param {object} node The node to expand.
|
|
2053
|
+
* @param {number} pos The tick position to expand.
|
|
2054
|
+
* @returns {array} Returns an array of the new breaks for the axis.
|
|
2055
|
+
*/
|
|
2056
|
+
var expand = function (axis, node) {
|
|
2057
|
+
var breaks = (axis.options.breaks || []),
|
|
2058
|
+
obj = getBreakFromNode(node, axis.max);
|
|
2059
|
+
// Remove the break from the axis breaks array.
|
|
2060
|
+
return reduce(breaks, function (arr, b) {
|
|
2061
|
+
if (b.to !== obj.to || b.from !== obj.from) {
|
|
2062
|
+
arr.push(b);
|
|
2063
|
+
}
|
|
2064
|
+
return arr;
|
|
2065
|
+
}, []);
|
|
2066
|
+
};
|
|
2067
|
+
|
|
2068
|
+
/**
|
|
2069
|
+
* Calculates the new axis breaks after toggling the collapse/expand state of a
|
|
2070
|
+
* node. If it is collapsed it will be expanded, and if it is exapended it will
|
|
2071
|
+
* be collapsed.
|
|
2072
|
+
* @param {object} axis The axis to check against.
|
|
2073
|
+
* @param {object} node The node to toggle.
|
|
2074
|
+
* @param {number} pos The tick position to toggle.
|
|
2075
|
+
* @returns {array} Returns an array of the new breaks for the axis.
|
|
2076
|
+
*/
|
|
2077
|
+
var toggleCollapse = function (axis, node) {
|
|
2078
|
+
return (
|
|
2079
|
+
isCollapsed(axis, node) ?
|
|
2080
|
+
expand(axis, node) :
|
|
2081
|
+
collapse(axis, node)
|
|
2082
|
+
);
|
|
2083
|
+
};
|
|
2084
|
+
var renderLabelIcon = function (tick, params) {
|
|
2085
|
+
var icon = tick.labelIcon,
|
|
2086
|
+
isNew = !icon,
|
|
2087
|
+
renderer = params.renderer,
|
|
2088
|
+
labelBox = params.xy,
|
|
2089
|
+
options = params.options,
|
|
2090
|
+
width = options.width,
|
|
2091
|
+
height = options.height,
|
|
2092
|
+
iconCenter = {
|
|
2093
|
+
x: labelBox.x - (width / 2) - options.padding,
|
|
2094
|
+
y: labelBox.y - (height / 2)
|
|
2095
|
+
},
|
|
2096
|
+
rotation = params.collapsed ? 90 : 180,
|
|
2097
|
+
shouldRender = params.show && H.isNumber(iconCenter.y);
|
|
2098
|
+
|
|
2099
|
+
if (isNew) {
|
|
2100
|
+
tick.labelIcon = icon = renderer.path(renderer.symbols[options.type](
|
|
2101
|
+
options.x,
|
|
2102
|
+
options.y,
|
|
2103
|
+
width,
|
|
2104
|
+
height
|
|
2105
|
+
))
|
|
2106
|
+
.addClass('highcharts-label-icon')
|
|
2107
|
+
.add(params.group);
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
// Set the new position, and show or hide
|
|
2111
|
+
if (!shouldRender) {
|
|
2112
|
+
icon.attr({ y: -9999 }); // #1338
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
// Presentational attributes
|
|
2117
|
+
icon
|
|
2118
|
+
.attr({
|
|
2119
|
+
'stroke-width': 1,
|
|
2120
|
+
'fill': pick(params.color, '#666666')
|
|
2121
|
+
})
|
|
2122
|
+
.css({
|
|
2123
|
+
cursor: 'pointer',
|
|
2124
|
+
stroke: options.lineColor,
|
|
2125
|
+
strokeWidth: options.lineWidth
|
|
2126
|
+
});
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
// Update the icon positions
|
|
2130
|
+
icon[isNew ? 'attr' : 'animate']({
|
|
2131
|
+
translateX: iconCenter.x,
|
|
2132
|
+
translateY: iconCenter.y,
|
|
2133
|
+
rotation: rotation
|
|
2134
|
+
});
|
|
2135
|
+
|
|
2136
|
+
};
|
|
2137
|
+
var onTickHover = function (label) {
|
|
2138
|
+
label.addClass('highcharts-treegrid-node-active');
|
|
2139
|
+
|
|
2140
|
+
label.css({
|
|
2141
|
+
textDecoration: 'underline'
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2144
|
+
};
|
|
2145
|
+
var onTickHoverExit = function (label, options) {
|
|
2146
|
+
var css = defined(options.style) ? options.style : {};
|
|
2147
|
+
label.removeClass('highcharts-treegrid-node-active');
|
|
2148
|
+
|
|
2149
|
+
label.css({
|
|
2150
|
+
textDecoration: css.textDecoration
|
|
2151
|
+
});
|
|
2152
|
+
|
|
2153
|
+
};
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* Creates a tree structure of the data, and the treegrid. Calculates
|
|
2157
|
+
* categories, and y-values of points based on the tree.
|
|
2158
|
+
* @param {Array} data All the data points to display in the axis.
|
|
2159
|
+
* @param {boolean} uniqueNames Wether or not the data node with the same name
|
|
2160
|
+
* should share grid cell. If true they do share cell. False by default.
|
|
2161
|
+
* @returns {object} Returns an object containing categories, mapOfIdToNode,
|
|
2162
|
+
* mapOfPosToGridNode, and tree.
|
|
2163
|
+
* @todo There should be only one point per line.
|
|
2164
|
+
* @todo It should be optional to have one category per point, or merge cells
|
|
2165
|
+
* @todo Add unit-tests.
|
|
2166
|
+
*/
|
|
2167
|
+
var getTreeGridFromData = function (data, uniqueNames, numberOfSeries) {
|
|
2168
|
+
var categories = [],
|
|
2169
|
+
collapsedNodes = [],
|
|
2170
|
+
mapOfIdToNode = {},
|
|
2171
|
+
mapOfPosToGridNode = {},
|
|
2172
|
+
posIterator = -1,
|
|
2173
|
+
uniqueNamesEnabled = isBoolean(uniqueNames) ? uniqueNames : false,
|
|
2174
|
+
tree,
|
|
2175
|
+
treeParams,
|
|
2176
|
+
updateYValuesAndTickPos;
|
|
2177
|
+
|
|
2178
|
+
// Build the tree from the series data.
|
|
2179
|
+
treeParams = {
|
|
2180
|
+
// After the children has been created.
|
|
2181
|
+
after: function (node) {
|
|
2182
|
+
var gridNode = mapOfPosToGridNode[node.pos],
|
|
2183
|
+
height = 0,
|
|
2184
|
+
descendants = 0;
|
|
2185
|
+
each(gridNode.children, function (child) {
|
|
2186
|
+
descendants += child.descendants + 1;
|
|
2187
|
+
height = Math.max(child.height + 1, height);
|
|
2188
|
+
});
|
|
2189
|
+
gridNode.descendants = descendants;
|
|
2190
|
+
gridNode.height = height;
|
|
2191
|
+
if (gridNode.collapsed) {
|
|
2192
|
+
collapsedNodes.push(gridNode);
|
|
2193
|
+
}
|
|
2194
|
+
},
|
|
2195
|
+
// Before the children has been created.
|
|
2196
|
+
before: function (node) {
|
|
2197
|
+
var data = isObject(node.data) ? node.data : {},
|
|
2198
|
+
name = isString(data.name) ? data.name : '',
|
|
2199
|
+
parentNode = mapOfIdToNode[node.parent],
|
|
2200
|
+
parentGridNode = (
|
|
2201
|
+
isObject(parentNode) ?
|
|
2202
|
+
mapOfPosToGridNode[parentNode.pos] :
|
|
2203
|
+
null
|
|
2204
|
+
),
|
|
2205
|
+
hasSameName = function (x) {
|
|
2206
|
+
return x.name === name;
|
|
2207
|
+
},
|
|
2208
|
+
gridNode,
|
|
2209
|
+
pos;
|
|
2210
|
+
|
|
2211
|
+
// If not unique names, look for a sibling node with the same name.
|
|
2212
|
+
if (
|
|
2213
|
+
uniqueNamesEnabled &&
|
|
2214
|
+
isObject(parentGridNode) &&
|
|
2215
|
+
!!(gridNode = find(parentGridNode.children, hasSameName))
|
|
2216
|
+
) {
|
|
2217
|
+
// If if there is a gridNode with the same name, reuse position.
|
|
2218
|
+
pos = gridNode.pos;
|
|
2219
|
+
// Add data node to list of nodes in the grid node.
|
|
2220
|
+
gridNode.nodes.push(node);
|
|
2221
|
+
} else {
|
|
2222
|
+
// If it is a new grid node, increment position.
|
|
2223
|
+
pos = posIterator++;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
// Add new grid node to map.
|
|
2227
|
+
if (!mapOfPosToGridNode[pos]) {
|
|
2228
|
+
mapOfPosToGridNode[pos] = gridNode = {
|
|
2229
|
+
depth: parentGridNode ? parentGridNode.depth + 1 : 0,
|
|
2230
|
+
name: name,
|
|
2231
|
+
nodes: [node],
|
|
2232
|
+
children: [],
|
|
2233
|
+
pos: pos
|
|
2234
|
+
};
|
|
2235
|
+
|
|
2236
|
+
// If not root, then add name to categories.
|
|
2237
|
+
if (pos !== -1) {
|
|
2238
|
+
categories.push(name);
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
// Add name to list of children.
|
|
2242
|
+
if (isObject(parentGridNode)) {
|
|
2243
|
+
parentGridNode.children.push(gridNode);
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
// Add data node to map
|
|
2248
|
+
if (isString(node.id)) {
|
|
2249
|
+
mapOfIdToNode[node.id] = node;
|
|
2250
|
+
}
|
|
2251
|
+
|
|
2252
|
+
// If one of the points are collapsed, then start the grid node in
|
|
2253
|
+
// collapsed state.
|
|
2254
|
+
if (data.collapsed === true) {
|
|
2255
|
+
gridNode.collapsed = true;
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
// Assign pos to data node
|
|
2259
|
+
node.pos = pos;
|
|
2260
|
+
}
|
|
2261
|
+
};
|
|
2262
|
+
|
|
2263
|
+
updateYValuesAndTickPos = function (map, numberOfSeries) {
|
|
2264
|
+
var setValues = function (gridNode, start, result) {
|
|
2265
|
+
var nodes = gridNode.nodes,
|
|
2266
|
+
end = start + (start === -1 ? 0 : numberOfSeries - 1),
|
|
2267
|
+
diff = (end - start) / 2,
|
|
2268
|
+
padding = 0.5,
|
|
2269
|
+
pos = start + diff;
|
|
2270
|
+
|
|
2271
|
+
each(nodes, function (node) {
|
|
2272
|
+
var data = node.data;
|
|
2273
|
+
if (isObject(data)) {
|
|
2274
|
+
// Update point
|
|
2275
|
+
data.y = start + data.seriesIndex;
|
|
2276
|
+
// Remove the property once used
|
|
2277
|
+
delete data.seriesIndex;
|
|
2278
|
+
}
|
|
2279
|
+
node.pos = pos;
|
|
2280
|
+
});
|
|
2281
|
+
|
|
2282
|
+
result[pos] = gridNode;
|
|
2283
|
+
|
|
2284
|
+
gridNode.pos = pos;
|
|
2285
|
+
gridNode.tickmarkOffset = diff + padding;
|
|
2286
|
+
gridNode.collapseStart = end + padding;
|
|
2287
|
+
|
|
2288
|
+
|
|
2289
|
+
each(gridNode.children, function (child) {
|
|
2290
|
+
setValues(child, end + 1, result);
|
|
2291
|
+
end = child.collapseEnd - padding;
|
|
2292
|
+
});
|
|
2293
|
+
// Set collapseEnd to the end of the last child node.
|
|
2294
|
+
gridNode.collapseEnd = end + padding;
|
|
2295
|
+
|
|
2296
|
+
return result;
|
|
2297
|
+
};
|
|
2298
|
+
|
|
2299
|
+
return setValues(map['-1'], -1, {});
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2302
|
+
// Create tree from data
|
|
2303
|
+
tree = Tree.getTree(data, treeParams);
|
|
2304
|
+
|
|
2305
|
+
// Update y values of data, and set calculate tick positions.
|
|
2306
|
+
mapOfPosToGridNode = updateYValuesAndTickPos(
|
|
2307
|
+
mapOfPosToGridNode,
|
|
2308
|
+
numberOfSeries
|
|
2309
|
+
);
|
|
2310
|
+
|
|
2311
|
+
// Return the resulting data.
|
|
2312
|
+
return {
|
|
2313
|
+
categories: categories,
|
|
2314
|
+
mapOfIdToNode: mapOfIdToNode,
|
|
2315
|
+
mapOfPosToGridNode: mapOfPosToGridNode,
|
|
2316
|
+
collapsedNodes: collapsedNodes,
|
|
2317
|
+
tree: tree
|
|
2318
|
+
};
|
|
2319
|
+
};
|
|
2320
|
+
|
|
2321
|
+
override(GridAxis.prototype, {
|
|
2322
|
+
init: function (proceed, chart, userOptions) {
|
|
2323
|
+
var axis = this,
|
|
2324
|
+
removeFoundExtremesEvent,
|
|
2325
|
+
isTreeGrid = userOptions.type === 'treegrid';
|
|
2326
|
+
// Set default and forced options for TreeGrid
|
|
2327
|
+
if (isTreeGrid) {
|
|
2328
|
+
userOptions = merge({
|
|
2329
|
+
// Default options
|
|
2330
|
+
grid: {
|
|
2331
|
+
enabled: true
|
|
2332
|
+
},
|
|
2333
|
+
// TODO: add support for align in treegrid.
|
|
2334
|
+
labels: {
|
|
2335
|
+
align: 'left',
|
|
2336
|
+
|
|
2337
|
+
/**
|
|
2338
|
+
* Set options on specific levels in a tree grid axis. Takes
|
|
2339
|
+
* precedence over labels options.
|
|
2340
|
+
*
|
|
2341
|
+
* @product gantt
|
|
2342
|
+
* @sample {gantt} gantt/treegrid-axis/labels-levels
|
|
2343
|
+
* Levels on TreeGrid Labels
|
|
2344
|
+
* @type {Array<Object>}
|
|
2345
|
+
* @apioption yAxis.labels.levels
|
|
2346
|
+
*/
|
|
2347
|
+
levels: [{
|
|
2348
|
+
/**
|
|
2349
|
+
* Specify the level which the options within this object
|
|
2350
|
+
* applies to.
|
|
2351
|
+
*
|
|
2352
|
+
* @sample {gantt} gantt/treegrid-axis/labels-levels
|
|
2353
|
+
*/
|
|
2354
|
+
level: undefined
|
|
2355
|
+
}, {
|
|
2356
|
+
level: 1,
|
|
2357
|
+
style: {
|
|
2358
|
+
fontWeight: 'bold'
|
|
2359
|
+
}
|
|
2360
|
+
}],
|
|
2361
|
+
|
|
2362
|
+
/**
|
|
2363
|
+
* The symbol for the collapse and expand icon in a
|
|
2364
|
+
* treegrid.
|
|
2365
|
+
*
|
|
2366
|
+
* @product gantt
|
|
2367
|
+
* @optionparent yAxis.labels.symbol
|
|
2368
|
+
*/
|
|
2369
|
+
symbol: {
|
|
2370
|
+
/**
|
|
2371
|
+
* The symbol type. Points to a definition function in
|
|
2372
|
+
* the `Highcharts.Renderer.symbols` collection.
|
|
2373
|
+
*
|
|
2374
|
+
* @validvalue ['arc', 'circle', 'diamond', 'square', 'triangle', 'triangle-down']
|
|
2375
|
+
*/
|
|
2376
|
+
type: 'triangle',
|
|
2377
|
+
x: -5,
|
|
2378
|
+
y: -5,
|
|
2379
|
+
height: 10,
|
|
2380
|
+
width: 10,
|
|
2381
|
+
padding: 5
|
|
2382
|
+
}
|
|
2383
|
+
},
|
|
2384
|
+
uniqueNames: false
|
|
2385
|
+
|
|
2386
|
+
}, userOptions, { // User options
|
|
2387
|
+
// Forced options
|
|
2388
|
+
reversed: true,
|
|
2389
|
+
// grid.columns is not supported in treegrid
|
|
2390
|
+
grid: {
|
|
2391
|
+
columns: undefined
|
|
2392
|
+
}
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
// Now apply the original function with the original arguments,
|
|
2397
|
+
// which are sliced off this function's arguments
|
|
2398
|
+
proceed.apply(axis, [chart, userOptions]);
|
|
2399
|
+
if (isTreeGrid) {
|
|
2400
|
+
H.addEvent(axis.chart, 'beforeRender', function () {
|
|
2401
|
+
var labelOptions = axis.options && axis.options.labels;
|
|
2402
|
+
|
|
2403
|
+
// beforeRender is fired after all the series is initialized,
|
|
2404
|
+
// which is an ideal time to update the axis.categories.
|
|
2405
|
+
axis.updateYNames();
|
|
2406
|
+
|
|
2407
|
+
// Update yData now that we have calculated the y values
|
|
2408
|
+
// TODO: it would be better to be able to calculate y values
|
|
2409
|
+
// before Series.setData
|
|
2410
|
+
each(axis.series, function (series) {
|
|
2411
|
+
series.yData = map(series.options.data, function (data) {
|
|
2412
|
+
return data.y;
|
|
2413
|
+
});
|
|
2414
|
+
});
|
|
2415
|
+
|
|
2416
|
+
// Calculate the label options for each level in the tree.
|
|
2417
|
+
axis.mapOptionsToLevel = getLevelOptions({
|
|
2418
|
+
defaults: labelOptions,
|
|
2419
|
+
from: 1,
|
|
2420
|
+
levels: labelOptions.levels,
|
|
2421
|
+
to: axis.tree.height
|
|
2422
|
+
});
|
|
2423
|
+
|
|
2424
|
+
// Collapse all the nodes belonging to a point where collapsed
|
|
2425
|
+
// equals true.
|
|
2426
|
+
// Can be called from beforeRender, if getBreakFromNode removes
|
|
2427
|
+
// its dependency on axis.max.
|
|
2428
|
+
removeFoundExtremesEvent =
|
|
2429
|
+
H.addEvent(axis, 'foundExtremes', function () {
|
|
2430
|
+
each(axis.collapsedNodes, function (node) {
|
|
2431
|
+
var breaks = collapse(axis, node);
|
|
2432
|
+
axis.setBreaks(breaks, false);
|
|
2433
|
+
});
|
|
2434
|
+
removeFoundExtremesEvent();
|
|
2435
|
+
});
|
|
2436
|
+
});
|
|
2437
|
+
axis.hasNames = true;
|
|
2438
|
+
axis.options.showLastLabel = true;
|
|
2439
|
+
}
|
|
2440
|
+
},
|
|
2441
|
+
/**
|
|
2442
|
+
* Override to add indentation to axis.maxLabelDimensions.
|
|
2443
|
+
* @param {Function} proceed the original function
|
|
2444
|
+
* @returns {undefined}
|
|
2445
|
+
*/
|
|
2446
|
+
getMaxLabelDimensions: function (proceed) {
|
|
2447
|
+
var axis = this,
|
|
2448
|
+
options = axis.options,
|
|
2449
|
+
labelOptions = options && options.labels,
|
|
2450
|
+
indentation = (
|
|
2451
|
+
labelOptions && isNumber(labelOptions.indentation) ?
|
|
2452
|
+
options.labels.indentation :
|
|
2453
|
+
0
|
|
2454
|
+
),
|
|
2455
|
+
retVal = proceed.apply(axis, argsToArray(arguments)),
|
|
2456
|
+
isTreeGrid = axis.options.type === 'treegrid',
|
|
2457
|
+
treeDepth;
|
|
2458
|
+
|
|
2459
|
+
if (isTreeGrid) {
|
|
2460
|
+
treeDepth = axis.mapOfPosToGridNode[-1].height;
|
|
2461
|
+
retVal.width += indentation * (treeDepth - 1);
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
return retVal;
|
|
2465
|
+
},
|
|
2466
|
+
/**
|
|
2467
|
+
* Generates a tick for initial positioning.
|
|
2468
|
+
*
|
|
2469
|
+
* @private
|
|
2470
|
+
* @param {function} proceed The original generateTick function.
|
|
2471
|
+
* @param {number} pos The tick position in axis values.
|
|
2472
|
+
*/
|
|
2473
|
+
generateTick: function (proceed, pos) {
|
|
2474
|
+
var axis = this,
|
|
2475
|
+
mapOptionsToLevel = (
|
|
2476
|
+
isObject(axis.mapOptionsToLevel) ? axis.mapOptionsToLevel : {}
|
|
2477
|
+
),
|
|
2478
|
+
isTreeGrid = axis.options.type === 'treegrid',
|
|
2479
|
+
ticks = axis.ticks,
|
|
2480
|
+
tick = ticks[pos],
|
|
2481
|
+
levelOptions,
|
|
2482
|
+
options,
|
|
2483
|
+
gridNode;
|
|
2484
|
+
|
|
2485
|
+
if (isTreeGrid) {
|
|
2486
|
+
gridNode = axis.mapOfPosToGridNode[pos];
|
|
2487
|
+
levelOptions = mapOptionsToLevel[gridNode.depth];
|
|
2488
|
+
|
|
2489
|
+
if (levelOptions) {
|
|
2490
|
+
options = {
|
|
2491
|
+
labels: levelOptions
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
if (!tick) {
|
|
2496
|
+
ticks[pos] = tick =
|
|
2497
|
+
new GridAxisTick(axis, pos, null, undefined, {
|
|
2498
|
+
category: gridNode.name,
|
|
2499
|
+
tickmarkOffset: gridNode.tickmarkOffset,
|
|
2500
|
+
options: options
|
|
2501
|
+
});
|
|
2502
|
+
} else {
|
|
2503
|
+
// update labels depending on tick interval
|
|
2504
|
+
tick.parameters.category = gridNode.name;
|
|
2505
|
+
tick.options = options;
|
|
2506
|
+
tick.addLabel();
|
|
2507
|
+
}
|
|
2508
|
+
} else {
|
|
2509
|
+
proceed.apply(axis, argsToArray(arguments));
|
|
2510
|
+
}
|
|
2511
|
+
},
|
|
2512
|
+
/**
|
|
2513
|
+
* Set the tick positions, tickInterval, axis min and max.
|
|
2514
|
+
*
|
|
2515
|
+
* @private
|
|
2516
|
+
*/
|
|
2517
|
+
setTickInterval: function (proceed) {
|
|
2518
|
+
var axis = this,
|
|
2519
|
+
options = axis.options,
|
|
2520
|
+
isTreeGrid = options.type === 'treegrid';
|
|
2521
|
+
|
|
2522
|
+
if (isTreeGrid) {
|
|
2523
|
+
axis.min = pick(axis.userMin, options.min, axis.dataMin);
|
|
2524
|
+
axis.max = pick(axis.userMax, options.max, axis.dataMax);
|
|
2525
|
+
|
|
2526
|
+
fireEvent(axis, 'foundExtremes');
|
|
2527
|
+
|
|
2528
|
+
// setAxisTranslation modifies the min and max according to
|
|
2529
|
+
// axis breaks.
|
|
2530
|
+
axis.setAxisTranslation(true);
|
|
2531
|
+
|
|
2532
|
+
axis.tickmarkOffset = 0.5;
|
|
2533
|
+
axis.tickInterval = 1;
|
|
2534
|
+
axis.tickPositions = getTickPositions(axis);
|
|
2535
|
+
} else {
|
|
2536
|
+
proceed.apply(axis, argsToArray(arguments));
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
});
|
|
2540
|
+
override(GridAxisTick.prototype, {
|
|
2541
|
+
getLabelPosition: function (
|
|
2542
|
+
proceed,
|
|
2543
|
+
x,
|
|
2544
|
+
y,
|
|
2545
|
+
label,
|
|
2546
|
+
horiz,
|
|
2547
|
+
labelOptions,
|
|
2548
|
+
tickmarkOffset,
|
|
2549
|
+
index,
|
|
2550
|
+
step
|
|
2551
|
+
) {
|
|
2552
|
+
var tick = this,
|
|
2553
|
+
lbOptions = pick(
|
|
2554
|
+
tick.options && tick.options.labels,
|
|
2555
|
+
labelOptions
|
|
2556
|
+
),
|
|
2557
|
+
pos = tick.pos,
|
|
2558
|
+
axis = tick.axis,
|
|
2559
|
+
options = axis.options,
|
|
2560
|
+
isTreeGrid = options.type === 'treegrid',
|
|
2561
|
+
result = proceed.apply(
|
|
2562
|
+
tick,
|
|
2563
|
+
[x, y, label, horiz, lbOptions, tickmarkOffset, index, step]
|
|
2564
|
+
),
|
|
2565
|
+
symbolOptions,
|
|
2566
|
+
indentation,
|
|
2567
|
+
mapOfPosToGridNode,
|
|
2568
|
+
node,
|
|
2569
|
+
level;
|
|
2570
|
+
|
|
2571
|
+
if (isTreeGrid) {
|
|
2572
|
+
symbolOptions = (
|
|
2573
|
+
lbOptions && isObject(lbOptions.symbol) ?
|
|
2574
|
+
lbOptions.symbol :
|
|
2575
|
+
{}
|
|
2576
|
+
);
|
|
2577
|
+
indentation = (
|
|
2578
|
+
lbOptions && isNumber(lbOptions.indentation) ?
|
|
2579
|
+
lbOptions.indentation :
|
|
2580
|
+
0
|
|
2581
|
+
);
|
|
2582
|
+
mapOfPosToGridNode = axis.mapOfPosToGridNode;
|
|
2583
|
+
node = mapOfPosToGridNode && mapOfPosToGridNode[pos];
|
|
2584
|
+
level = (node && node.depth) || 1;
|
|
2585
|
+
result.x += (
|
|
2586
|
+
// Add space for symbols
|
|
2587
|
+
((symbolOptions.width) + (symbolOptions.padding * 2)) +
|
|
2588
|
+
// Apply indentation
|
|
2589
|
+
((level - 1) * indentation)
|
|
2590
|
+
);
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
return result;
|
|
2594
|
+
},
|
|
2595
|
+
renderLabel: function (proceed) {
|
|
2596
|
+
var tick = this,
|
|
2597
|
+
pos = tick.pos,
|
|
2598
|
+
axis = tick.axis,
|
|
2599
|
+
label = tick.label,
|
|
2600
|
+
mapOfPosToGridNode = axis.mapOfPosToGridNode,
|
|
2601
|
+
options = axis.options,
|
|
2602
|
+
labelOptions = pick(
|
|
2603
|
+
tick.options && tick.options.labels,
|
|
2604
|
+
options && options.labels
|
|
2605
|
+
),
|
|
2606
|
+
symbolOptions = (
|
|
2607
|
+
labelOptions && isObject(labelOptions.symbol) ?
|
|
2608
|
+
labelOptions.symbol :
|
|
2609
|
+
{}
|
|
2610
|
+
),
|
|
2611
|
+
node = mapOfPosToGridNode && mapOfPosToGridNode[pos],
|
|
2612
|
+
level = node && node.depth,
|
|
2613
|
+
isTreeGrid = options.type === 'treegrid',
|
|
2614
|
+
hasLabel = !!(label && label.element),
|
|
2615
|
+
shouldRender = inArray(pos, axis.tickPositions) > -1,
|
|
2616
|
+
prefixClassName = 'highcharts-treegrid-node-',
|
|
2617
|
+
collapsed,
|
|
2618
|
+
addClassName,
|
|
2619
|
+
removeClassName;
|
|
2620
|
+
|
|
2621
|
+
if (isTreeGrid && node) {
|
|
2622
|
+
// Add class name for hierarchical styling.
|
|
2623
|
+
if (hasLabel) {
|
|
2624
|
+
label.addClass(prefixClassName + 'level-' + level);
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
proceed.apply(tick, argsToArray(arguments));
|
|
2629
|
+
|
|
2630
|
+
if (isTreeGrid && node && hasLabel && node.descendants > 0) {
|
|
2631
|
+
collapsed = isCollapsed(axis, node);
|
|
2632
|
+
|
|
2633
|
+
renderLabelIcon(
|
|
2634
|
+
tick,
|
|
2635
|
+
{
|
|
2636
|
+
|
|
2637
|
+
color: label.styles.color,
|
|
2638
|
+
|
|
2639
|
+
collapsed: collapsed,
|
|
2640
|
+
group: label.parentGroup,
|
|
2641
|
+
options: symbolOptions,
|
|
2642
|
+
renderer: label.renderer,
|
|
2643
|
+
show: shouldRender,
|
|
2644
|
+
xy: label.xy
|
|
2645
|
+
}
|
|
2646
|
+
);
|
|
2647
|
+
|
|
2648
|
+
// Add class name for the node.
|
|
2649
|
+
addClassName = prefixClassName +
|
|
2650
|
+
(collapsed ? 'collapsed' : 'expanded');
|
|
2651
|
+
removeClassName = prefixClassName +
|
|
2652
|
+
(collapsed ? 'expanded' : 'collapsed');
|
|
2653
|
+
|
|
2654
|
+
label
|
|
2655
|
+
.addClass(addClassName)
|
|
2656
|
+
.removeClass(removeClassName);
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
label.css({
|
|
2660
|
+
cursor: 'pointer'
|
|
2661
|
+
});
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
// Add events to both label text and icon
|
|
2665
|
+
each([label, tick.labelIcon], function (object) {
|
|
2666
|
+
if (!object.attachedTreeGridEvents) {
|
|
2667
|
+
// On hover
|
|
2668
|
+
H.addEvent(object.element, 'mouseover', function () {
|
|
2669
|
+
onTickHover(label);
|
|
2670
|
+
});
|
|
2671
|
+
|
|
2672
|
+
// On hover out
|
|
2673
|
+
H.addEvent(object.element, 'mouseout', function () {
|
|
2674
|
+
onTickHoverExit(label, labelOptions);
|
|
2675
|
+
});
|
|
2676
|
+
|
|
2677
|
+
H.addEvent(object.element, 'click', function () {
|
|
2678
|
+
tick.toggleCollapse();
|
|
2679
|
+
});
|
|
2680
|
+
object.attachedTreeGridEvents = true;
|
|
2681
|
+
}
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
});
|
|
2686
|
+
|
|
2687
|
+
extend(GridAxisTick.prototype, /** @lends Highcharts.Tick.prototype */{
|
|
2688
|
+
/**
|
|
2689
|
+
* Collapse the grid cell. Used when axis is of type treegrid.
|
|
2690
|
+
* @param {boolean} [redraw=true] Whether to redraw the chart or wait for
|
|
2691
|
+
* an explicit call to {@link Highcharts.Chart#redraw}
|
|
2692
|
+
* @sample {gantt} gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2693
|
+
* Dynamically collapse
|
|
2694
|
+
*/
|
|
2695
|
+
collapse: function (redraw) {
|
|
2696
|
+
var tick = this,
|
|
2697
|
+
axis = tick.axis,
|
|
2698
|
+
pos = tick.pos,
|
|
2699
|
+
node = axis.mapOfPosToGridNode[pos],
|
|
2700
|
+
breaks = collapse(axis, node);
|
|
2701
|
+
axis.setBreaks(breaks, pick(redraw, true));
|
|
2702
|
+
},
|
|
2703
|
+
/**
|
|
2704
|
+
* Expand the grid cell. Used when axis is of type treegrid.
|
|
2705
|
+
*
|
|
2706
|
+
* @param {boolean} [redraw=true] Whether to redraw the chart or wait for
|
|
2707
|
+
* an explicit call to {@link Highcharts.Chart#redraw}
|
|
2708
|
+
* @sample {gantt} gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2709
|
+
* Dynamically collapse
|
|
2710
|
+
*/
|
|
2711
|
+
expand: function (redraw) {
|
|
2712
|
+
var tick = this,
|
|
2713
|
+
axis = tick.axis,
|
|
2714
|
+
pos = tick.pos,
|
|
2715
|
+
node = axis.mapOfPosToGridNode[pos],
|
|
2716
|
+
breaks = expand(axis, node);
|
|
2717
|
+
axis.setBreaks(breaks, pick(redraw, true));
|
|
2718
|
+
},
|
|
2719
|
+
/**
|
|
2720
|
+
* Toggle the collapse/expand state of the grid cell. Used when axis is of
|
|
2721
|
+
* type treegrid.
|
|
2722
|
+
*
|
|
2723
|
+
* @param {boolean} [redraw=true] Whether to redraw the chart or wait for
|
|
2724
|
+
* an explicit call to {@link Highcharts.Chart#redraw}
|
|
2725
|
+
* @sample {gantt} gantt/treegrid-axis/collapsed-dynamically/demo.js
|
|
2726
|
+
* Dynamically collapse
|
|
2727
|
+
*/
|
|
2728
|
+
toggleCollapse: function (redraw) {
|
|
2729
|
+
var tick = this,
|
|
2730
|
+
axis = tick.axis,
|
|
2731
|
+
pos = tick.pos,
|
|
2732
|
+
node = axis.mapOfPosToGridNode[pos],
|
|
2733
|
+
breaks = toggleCollapse(axis, node);
|
|
2734
|
+
axis.setBreaks(breaks, pick(redraw, true));
|
|
2735
|
+
}
|
|
2736
|
+
});
|
|
2737
|
+
|
|
2738
|
+
GridAxis.prototype.updateYNames = function () {
|
|
2739
|
+
var axis = this,
|
|
2740
|
+
options = axis.options,
|
|
2741
|
+
isTreeGrid = options.type === 'treegrid',
|
|
2742
|
+
uniqueNames = options.uniqueNames,
|
|
2743
|
+
isYAxis = !axis.isXAxis,
|
|
2744
|
+
series = axis.series,
|
|
2745
|
+
numberOfSeries = 0,
|
|
2746
|
+
treeGrid,
|
|
2747
|
+
data;
|
|
2748
|
+
|
|
2749
|
+
if (isTreeGrid && isYAxis) {
|
|
2750
|
+
// Concatenate data from all series assigned to this axis.
|
|
2751
|
+
data = reduce(series, function (arr, s) {
|
|
2752
|
+
if (s.visible) {
|
|
2753
|
+
// Push all data to array
|
|
2754
|
+
each(s.options.data, function (data) {
|
|
2755
|
+
if (isObject(data)) {
|
|
2756
|
+
// Set series index on data. Removed again after use.
|
|
2757
|
+
data.seriesIndex = numberOfSeries;
|
|
2758
|
+
arr.push(data);
|
|
2759
|
+
}
|
|
2760
|
+
});
|
|
2761
|
+
|
|
2762
|
+
// Increment series index
|
|
2763
|
+
if (uniqueNames === true) {
|
|
2764
|
+
numberOfSeries++;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
return arr;
|
|
2768
|
+
}, []);
|
|
2769
|
+
|
|
2770
|
+
// Calculate categories and the hierarchy for the grid.
|
|
2771
|
+
treeGrid = getTreeGridFromData(
|
|
2772
|
+
data,
|
|
2773
|
+
uniqueNames,
|
|
2774
|
+
(uniqueNames === true) ? numberOfSeries : 1
|
|
2775
|
+
);
|
|
2776
|
+
|
|
2777
|
+
// Assign values to the axis.
|
|
2778
|
+
axis.categories = treeGrid.categories;
|
|
2779
|
+
axis.mapOfPosToGridNode = treeGrid.mapOfPosToGridNode;
|
|
2780
|
+
// Used on init to start a node as collapsed
|
|
2781
|
+
axis.collapsedNodes = treeGrid.collapsedNodes;
|
|
2782
|
+
axis.hasNames = true;
|
|
2783
|
+
axis.tree = treeGrid.tree;
|
|
2784
|
+
}
|
|
2785
|
+
};
|
|
2786
|
+
|
|
2787
|
+
// Make utility functions available for testing.
|
|
2788
|
+
GridAxis.prototype.utils = {
|
|
2789
|
+
getNode: Tree.getNode
|
|
2790
|
+
};
|
|
2791
|
+
|
|
2792
|
+
}(Highcharts, Tree, result));
|
|
2793
|
+
return (function () {
|
|
2794
|
+
|
|
2795
|
+
|
|
2796
|
+
}());
|
|
2797
|
+
}));
|