highcharts 7.1.1 → 7.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bower.json +1 -1
- package/css/annotations/popup.css +3 -3
- package/css/annotations/popup.scss +1 -1
- package/css/stocktools/gui.css +5 -5
- package/css/stocktools/gui.scss +1 -1
- package/es-modules/annotations/ControlPoint.js +1 -1
- package/es-modules/annotations/MockPoint.js +45 -12
- package/es-modules/annotations/annotations.src.js +203 -166
- package/es-modules/annotations/controllable/ControllableCircle.js +2 -10
- package/es-modules/annotations/controllable/ControllableImage.js +2 -10
- package/es-modules/annotations/controllable/ControllableLabel.js +54 -9
- package/es-modules/annotations/controllable/ControllableRect.js +2 -10
- package/es-modules/annotations/controllable/controllableMixin.js +32 -4
- package/es-modules/annotations/controllable/markerMixin.js +1 -0
- package/es-modules/annotations/eventEmitterMixin.js +1 -0
- package/es-modules/annotations/navigationBindings.js +15 -11
- package/es-modules/annotations/popup.js +59 -81
- package/es-modules/annotations/types/CrookedLine.js +19 -7
- package/es-modules/annotations/types/ElliottWave.js +7 -6
- package/es-modules/annotations/types/Fibonacci.js +14 -14
- package/es-modules/annotations/types/InfinityLine.js +4 -4
- package/es-modules/annotations/types/Measure.js +41 -41
- package/es-modules/annotations/types/Pitchfork.js +5 -4
- package/es-modules/annotations/types/VerticalLine.js +6 -5
- package/es-modules/error-messages.js +6 -1
- package/es-modules/indicators/indicators.src.js +5 -3
- package/es-modules/mixins/nodes.js +16 -8
- package/es-modules/modules/accessibility/AccessibilityComponent.js +4 -4
- package/es-modules/modules/accessibility/KeyboardNavigation.js +17 -4
- package/es-modules/modules/accessibility/components/RangeSelectorComponent.js +3 -2
- package/es-modules/modules/accessibility/components/SeriesComponent.js +110 -2
- package/es-modules/modules/accessibility/components/ZoomComponent.js +1 -1
- package/es-modules/modules/accessibility/options.js +2 -1
- package/es-modules/modules/bellcurve.src.js +27 -29
- package/es-modules/modules/boost/boost-init.js +14 -0
- package/es-modules/modules/boost/boost-overrides.js +13 -3
- package/es-modules/modules/boost/wgl-renderer.js +30 -15
- package/es-modules/modules/boost/wgl-shader.js +33 -16
- package/es-modules/modules/boost/wgl-vbuffer.js +8 -4
- package/es-modules/modules/broken-axis.src.js +1 -1
- package/es-modules/modules/bullet.src.js +68 -68
- package/es-modules/modules/cylinder.src.js +3 -1
- package/es-modules/modules/data.src.js +9 -5
- package/es-modules/modules/draggable-points.src.js +1 -1
- package/es-modules/modules/drilldown.src.js +1 -1
- package/es-modules/modules/export-data.src.js +7 -8
- package/es-modules/modules/exporting.src.js +9 -1
- package/es-modules/modules/full-screen.src.js +1 -1
- package/es-modules/modules/funnel3d.src.js +10 -3
- package/es-modules/modules/histogram.src.js +162 -164
- package/es-modules/modules/item-series.src.js +10 -10
- package/es-modules/modules/networkgraph/layouts.js +16 -12
- package/es-modules/modules/networkgraph/networkgraph.src.js +147 -51
- package/es-modules/modules/offline-exporting.src.js +15 -2
- package/es-modules/modules/oldie-polyfills.src.js +1 -1
- package/es-modules/modules/organization.src.js +65 -20
- package/es-modules/modules/pareto.src.js +52 -51
- package/es-modules/modules/pattern-fill.src.js +1 -1
- package/es-modules/modules/price-indicator.src.js +1 -1
- package/es-modules/modules/pyramid3d.src.js +1 -1
- package/es-modules/modules/sankey.src.js +22 -10
- package/es-modules/modules/series-label.src.js +16 -8
- package/es-modules/modules/solid-gauge.src.js +128 -79
- package/es-modules/modules/static-scale.src.js +8 -1
- package/es-modules/modules/stock-tools-gui.js +1 -1
- package/es-modules/modules/streamgraph.src.js +11 -11
- package/es-modules/modules/sunburst.src.js +23 -2
- package/es-modules/modules/tilemap.src.js +58 -57
- package/es-modules/modules/timeline.src.js +17 -12
- package/es-modules/modules/treemap.src.js +6 -6
- package/es-modules/modules/variwide.src.js +39 -39
- package/es-modules/modules/vector.src.js +108 -107
- package/es-modules/modules/venn.src.js +4 -2
- package/es-modules/modules/windbarb.src.js +43 -43
- package/es-modules/modules/wordcloud.src.js +1 -0
- package/es-modules/modules/xrange.src.js +112 -104
- package/es-modules/parts/AreaSeries.js +4 -1
- package/es-modules/parts/Axis.js +809 -1870
- package/es-modules/parts/Chart.js +254 -743
- package/es-modules/parts/Color.js +160 -113
- package/es-modules/parts/ColumnSeries.js +9 -3
- package/es-modules/parts/DataLabels.js +31 -2
- package/es-modules/parts/Dynamics.js +73 -26
- package/es-modules/parts/FlagsSeries.js +6 -4
- package/es-modules/parts/Globals.js +20 -36
- package/es-modules/parts/Html.js +116 -235
- package/es-modules/parts/Interaction.js +17 -7
- package/es-modules/parts/Legend.js +277 -632
- package/es-modules/parts/MSPointer.js +62 -106
- package/es-modules/parts/Options.js +128 -367
- package/es-modules/parts/OrdinalAxis.js +12 -0
- package/es-modules/parts/PieSeries.js +61 -44
- package/es-modules/parts/PlotLineOrBand.js +38 -3
- package/es-modules/parts/Point.js +117 -227
- package/es-modules/parts/Pointer.js +273 -558
- package/es-modules/parts/RangeSelector.js +5 -3
- package/es-modules/parts/Responsive.js +8 -4
- package/es-modules/parts/ScrollablePlotArea.js +215 -81
- package/es-modules/parts/Scrollbar.js +38 -23
- package/es-modules/parts/Series.js +151 -47
- package/es-modules/parts/Stacking.js +8 -3
- package/es-modules/parts/StockChart.js +42 -29
- package/es-modules/parts/SvgRenderer.js +1080 -2100
- package/es-modules/parts/Tick.js +11 -4
- package/es-modules/parts/Time.js +179 -363
- package/es-modules/parts/Tooltip.js +23 -12
- package/es-modules/parts/TouchPointer.js +69 -187
- package/es-modules/parts/Utilities.js +593 -846
- package/es-modules/parts-3d/Axis.js +2 -2
- package/es-modules/parts-3d/Column.js +18 -8
- package/es-modules/parts-gantt/GanttSeries.js +17 -21
- package/es-modules/parts-gantt/GridAxis.js +183 -101
- package/es-modules/parts-gantt/PathfinderAlgorithms.js +2 -2
- package/es-modules/parts-gantt/TreeGrid.js +53 -36
- package/es-modules/parts-map/ColorAxis.js +35 -14
- package/es-modules/parts-map/MapBubbleSeries.js +2 -1
- package/es-modules/parts-map/MapSeries.js +29 -18
- package/es-modules/parts-more/AreaRangeSeries.js +13 -12
- package/es-modules/parts-more/ColumnRangeSeries.js +8 -2
- package/es-modules/parts-more/GaugeSeries.js +9 -9
- package/es-modules/parts-more/PackedBubbleSeries.js +152 -115
- package/es-modules/parts-more/RadialAxis.js +102 -8
- package/es-modules/parts-more/WaterfallSeries.js +148 -35
- package/highcharts-3d.js +68 -67
- package/highcharts-3d.js.map +1 -1
- package/highcharts-3d.src.js +21 -11
- package/highcharts-gantt.d.ts +5 -3
- package/highcharts-gantt.js +618 -610
- package/highcharts-gantt.js.map +1 -1
- package/highcharts-gantt.src.d.ts +5 -3
- package/highcharts-gantt.src.js +5185 -8892
- package/highcharts-more.js +144 -140
- package/highcharts-more.js.map +1 -1
- package/highcharts-more.src.js +449 -194
- package/highcharts.d.ts +3943 -5236
- package/highcharts.js +454 -449
- package/highcharts.js.map +1 -1
- package/highcharts.src.d.ts +3943 -5236
- package/highcharts.src.js +4767 -8601
- package/highmaps.d.ts +5 -3
- package/highmaps.js +498 -494
- package/highmaps.js.map +1 -1
- package/highmaps.src.d.ts +5 -3
- package/highmaps.src.js +4547 -8507
- package/highstock.d.ts +5 -3
- package/highstock.js +597 -590
- package/highstock.js.map +1 -1
- package/highstock.src.d.ts +5 -3
- package/highstock.src.js +4871 -8661
- package/indicators/acceleration-bands.js +1 -1
- package/indicators/acceleration-bands.src.js +1 -1
- package/indicators/accumulation-distribution.js +1 -1
- package/indicators/accumulation-distribution.src.js +1 -1
- package/indicators/ao.js +1 -1
- package/indicators/ao.src.js +1 -1
- package/indicators/apo.js +1 -1
- package/indicators/apo.src.js +1 -1
- package/indicators/aroon-oscillator.js +1 -1
- package/indicators/aroon-oscillator.src.js +1 -1
- package/indicators/aroon.js +1 -1
- package/indicators/aroon.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/chaikin.js +1 -1
- package/indicators/chaikin.src.js +1 -1
- package/indicators/cmf.js +1 -1
- package/indicators/cmf.src.js +1 -1
- package/indicators/dema.js +1 -1
- package/indicators/dema.src.js +1 -1
- package/indicators/dpo.js +1 -1
- package/indicators/dpo.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-all.js +105 -105
- package/indicators/indicators-all.js.map +1 -1
- package/indicators/indicators-all.src.js +6 -4
- package/indicators/indicators.js +9 -9
- package/indicators/indicators.js.map +1 -1
- package/indicators/indicators.src.js +6 -4
- package/indicators/keltner-channels.js +1 -1
- package/indicators/keltner-channels.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 +1 -1
- package/indicators/natr.js +1 -1
- package/indicators/natr.src.js +1 -1
- package/indicators/pivot-points.js +1 -1
- package/indicators/pivot-points.src.js +1 -1
- package/indicators/ppo.js +1 -1
- package/indicators/ppo.src.js +1 -1
- package/indicators/price-channel.js +1 -1
- package/indicators/price-channel.src.js +1 -1
- package/indicators/price-envelopes.js +1 -1
- package/indicators/price-envelopes.src.js +1 -1
- package/indicators/psar.js +1 -1
- package/indicators/psar.src.js +1 -1
- package/indicators/regressions.js +1 -1
- package/indicators/regressions.src.js +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/supertrend.js +1 -1
- package/indicators/supertrend.src.js +1 -1
- package/indicators/tema.js +1 -1
- package/indicators/tema.src.js +1 -1
- package/indicators/trix.js +1 -1
- package/indicators/trix.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/williams-r.js +1 -1
- package/indicators/williams-r.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/modules/accessibility.js +92 -89
- package/modules/accessibility.js.map +1 -1
- package/modules/accessibility.src.js +138 -15
- package/modules/annotations-advanced.js +128 -127
- package/modules/annotations-advanced.js.map +1 -1
- package/modules/annotations-advanced.src.js +514 -396
- package/modules/annotations.d.ts +36 -0
- package/modules/annotations.js +81 -81
- package/modules/annotations.js.map +1 -1
- package/modules/annotations.src.d.ts +36 -0
- package/modules/annotations.src.js +418 -315
- package/modules/arrow-symbols.js +1 -1
- package/modules/arrow-symbols.src.js +1 -1
- package/modules/boost-canvas.js +1 -1
- package/modules/boost-canvas.src.js +1 -1
- package/modules/boost.js +63 -63
- package/modules/boost.js.map +1 -1
- package/modules/boost.src.js +99 -39
- package/modules/broken-axis.js +1 -1
- package/modules/broken-axis.src.js +2 -2
- package/modules/bullet.js +1 -1
- package/modules/bullet.src.js +69 -69
- package/modules/current-date-indicator.js +1 -1
- package/modules/current-date-indicator.src.js +1 -1
- package/modules/cylinder.js +1 -1
- package/modules/cylinder.js.map +1 -1
- package/modules/cylinder.src.js +4 -2
- package/modules/data.js +4 -4
- package/modules/data.js.map +1 -1
- package/modules/data.src.js +10 -6
- package/modules/datagrouping.js +1 -1
- package/modules/datagrouping.src.js +1 -1
- package/modules/debugger.js +4 -4
- package/modules/debugger.js.map +1 -1
- package/modules/debugger.src.js +7 -2
- package/modules/dependency-wheel.js +1 -1
- package/modules/dependency-wheel.src.js +1 -1
- package/modules/dotplot.js +1 -1
- package/modules/dotplot.src.js +1 -1
- package/modules/drag-panes.js +1 -1
- package/modules/drag-panes.src.js +1 -1
- package/modules/draggable-points.js +1 -1
- package/modules/draggable-points.src.js +2 -2
- package/modules/drilldown.js +1 -1
- package/modules/drilldown.src.js +2 -2
- package/modules/export-data.js +2 -2
- package/modules/export-data.js.map +1 -1
- package/modules/export-data.src.js +8 -9
- package/modules/exporting.js +25 -25
- package/modules/exporting.js.map +1 -1
- package/modules/exporting.src.js +11 -3
- package/modules/full-screen.js +1 -1
- package/modules/full-screen.src.js +2 -2
- package/modules/funnel.js +1 -1
- package/modules/funnel.src.js +1 -1
- package/modules/funnel3d.js +2 -2
- package/modules/funnel3d.js.map +1 -1
- package/modules/funnel3d.src.js +11 -4
- package/modules/gantt.js +166 -164
- package/modules/gantt.js.map +1 -1
- package/modules/gantt.src.js +422 -295
- package/modules/grid-axis.js +18 -16
- package/modules/grid-axis.js.map +1 -1
- package/modules/grid-axis.src.js +184 -102
- package/modules/heatmap.js +22 -22
- package/modules/heatmap.js.map +1 -1
- package/modules/heatmap.src.js +36 -15
- package/modules/histogram-bellcurve.js +1 -1
- package/modules/histogram-bellcurve.js.map +1 -1
- package/modules/histogram-bellcurve.src.js +186 -183
- package/modules/item-series.js +1 -1
- package/modules/item-series.src.js +11 -11
- package/modules/map-parser.js +1 -1
- package/modules/map-parser.src.js +1 -1
- package/modules/map.js +83 -83
- package/modules/map.js.map +1 -1
- package/modules/map.src.js +67 -34
- package/modules/networkgraph.js +10 -9
- package/modules/networkgraph.js.map +1 -1
- package/modules/networkgraph.src.js +180 -72
- package/modules/no-data-to-display.js +1 -1
- package/modules/no-data-to-display.src.js +1 -1
- package/modules/offline-exporting.js +15 -15
- package/modules/offline-exporting.js.map +1 -1
- package/modules/offline-exporting.src.js +17 -4
- package/modules/oldie-polyfills.js +1 -1
- package/modules/oldie-polyfills.src.js +2 -2
- package/modules/oldie.js +2 -2
- package/modules/oldie.src.js +2 -2
- package/modules/organization.js +1 -1
- package/modules/organization.js.map +1 -1
- package/modules/organization.src.js +66 -21
- package/modules/overlapping-datalabels.js +1 -1
- package/modules/overlapping-datalabels.src.js +1 -1
- package/modules/parallel-coordinates.js +1 -1
- package/modules/parallel-coordinates.src.js +1 -1
- package/modules/pareto.js +1 -1
- package/modules/pareto.js.map +1 -1
- package/modules/pareto.src.js +53 -52
- package/modules/pathfinder.js +3 -3
- package/modules/pathfinder.js.map +1 -1
- package/modules/pathfinder.src.js +3 -3
- package/modules/pattern-fill.js +1 -1
- package/modules/pattern-fill.src.js +2 -2
- package/modules/price-indicator.js +1 -1
- package/modules/price-indicator.src.js +2 -2
- package/modules/pyramid3d.js +1 -1
- package/modules/pyramid3d.src.js +2 -2
- package/modules/sankey.js +14 -14
- package/modules/sankey.js.map +1 -1
- package/modules/sankey.src.js +39 -19
- package/modules/series-label.js +16 -16
- package/modules/series-label.js.map +1 -1
- package/modules/series-label.src.js +17 -9
- package/modules/solid-gauge.js +5 -5
- package/modules/solid-gauge.js.map +1 -1
- package/modules/solid-gauge.src.js +129 -80
- package/modules/sonification.js +1 -1
- package/modules/sonification.src.js +1 -1
- package/modules/static-scale.js +4 -4
- package/modules/static-scale.js.map +1 -1
- package/modules/static-scale.src.js +9 -2
- package/modules/stock-tools.js +2 -2
- package/modules/stock-tools.src.js +3 -3
- package/modules/stock.js +146 -145
- package/modules/stock.js.map +1 -1
- package/modules/stock.src.js +105 -61
- package/modules/streamgraph.js +1 -1
- package/modules/streamgraph.src.js +12 -12
- package/modules/sunburst.js +40 -40
- package/modules/sunburst.js.map +1 -1
- package/modules/sunburst.src.js +30 -9
- package/modules/tilemap.js +1 -1
- package/modules/tilemap.js.map +1 -1
- package/modules/tilemap.src.js +59 -58
- package/modules/timeline.js +12 -11
- package/modules/timeline.js.map +1 -1
- package/modules/timeline.src.js +18 -13
- package/modules/treegrid.js +45 -43
- package/modules/treegrid.js.map +1 -1
- package/modules/treegrid.src.js +238 -139
- package/modules/treemap.js +1 -1
- package/modules/treemap.src.js +7 -7
- package/modules/variable-pie.js +1 -1
- package/modules/variable-pie.src.js +1 -1
- package/modules/variwide.js +1 -1
- package/modules/variwide.src.js +40 -40
- package/modules/vector.js +1 -1
- package/modules/vector.js.map +1 -1
- package/modules/vector.src.js +109 -108
- package/modules/venn.js +23 -23
- package/modules/venn.js.map +1 -1
- package/modules/venn.src.js +5 -3
- package/modules/windbarb.js +1 -1
- package/modules/windbarb.src.js +44 -44
- package/modules/wordcloud.js +10 -10
- package/modules/wordcloud.js.map +1 -1
- package/modules/wordcloud.src.js +2 -1
- package/modules/xrange.js +12 -12
- package/modules/xrange.js.map +1 -1
- package/modules/xrange.src.js +113 -105
- package/package.json +1 -1
- package/themes/avocado.js +21 -37
- package/themes/avocado.src.js +1 -1
- package/themes/dark-blue.js +1 -1
- package/themes/dark-blue.src.js +1 -1
- package/themes/dark-green.js +1 -1
- package/themes/dark-green.src.js +1 -1
- package/themes/dark-unica.js +1 -1
- package/themes/dark-unica.src.js +1 -1
- package/themes/gray.js +1 -1
- package/themes/gray.src.js +1 -1
- package/themes/grid-light.js +1 -1
- package/themes/grid-light.src.js +1 -1
- package/themes/grid.js +1 -1
- package/themes/grid.src.js +1 -1
- package/themes/sand-signika.js +1 -1
- package/themes/sand-signika.src.js +1 -1
- package/themes/skies.js +1 -1
- package/themes/skies.src.js +1 -1
- package/themes/sunset.js +21 -37
- package/themes/sunset.src.js +1 -1
- package/.DS_Store +0 -0
- package/es-modules/.DS_Store +0 -0
- package/es-modules/modules/annotations-legacy.src.js +0 -1977
- package/js/.DS_Store +0 -0
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/* *
|
|
2
|
-
* (c) 2010-2019 Torstein Honsi
|
|
3
2
|
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
* (c) 2010-2019 Torstein Honsi
|
|
4
|
+
*
|
|
5
|
+
* License: www.highcharts.com/license
|
|
6
|
+
*
|
|
7
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
8
|
+
*
|
|
9
|
+
* */
|
|
10
|
+
'use strict';
|
|
11
|
+
import H from './Globals.js';
|
|
7
12
|
/**
|
|
8
13
|
* Callback for chart constructors.
|
|
9
14
|
*
|
|
@@ -12,27 +17,25 @@
|
|
|
12
17
|
* @param {Highcharts.Chart} chart
|
|
13
18
|
* Created chart.
|
|
14
19
|
*/
|
|
15
|
-
|
|
16
20
|
/**
|
|
17
21
|
* The chart title. The title has an `update` method that allows modifying the
|
|
18
22
|
* options directly or indirectly via `chart.update`.
|
|
19
23
|
*
|
|
20
24
|
* @interface Highcharts.TitleObject
|
|
21
25
|
* @extends Highcharts.SVGElement
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
*/ /**
|
|
27
|
+
* Modify options for the title.
|
|
28
|
+
*
|
|
29
|
+
* @function Highcharts.TitleObject#update
|
|
30
|
+
*
|
|
31
|
+
* @param {Highcharts.TitleOptions} titleOptions
|
|
32
|
+
* Options to modify.
|
|
33
|
+
*
|
|
34
|
+
* @param {boolean} [redraw=true]
|
|
35
|
+
* Whether to redraw the chart after the title is altered. If doing more
|
|
36
|
+
* operations on the chart, it is a good idea to set redraw to false and
|
|
37
|
+
* call {@link Chart#redraw} after.
|
|
38
|
+
*/
|
|
36
39
|
/**
|
|
37
40
|
* The chart subtitle. The subtitle has an `update` method that
|
|
38
41
|
* allows modifying the options directly or indirectly via
|
|
@@ -40,60 +43,29 @@
|
|
|
40
43
|
*
|
|
41
44
|
* @interface Highcharts.SubtitleObject
|
|
42
45
|
* @extends Highcharts.SVGElement
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'use strict';
|
|
58
|
-
|
|
59
|
-
import H from './Globals.js';
|
|
46
|
+
*/ /**
|
|
47
|
+
* Modify options for the subtitle.
|
|
48
|
+
*
|
|
49
|
+
* @function Highcharts.SubtitleObject#update
|
|
50
|
+
*
|
|
51
|
+
* @param {Highcharts.SubtitleOptions} subtitleOptions
|
|
52
|
+
* Options to modify.
|
|
53
|
+
*
|
|
54
|
+
* @param {boolean} [redraw=true]
|
|
55
|
+
* Whether to redraw the chart after the subtitle is altered. If doing
|
|
56
|
+
* more operations on the chart, it is a good idea to set redraw to false
|
|
57
|
+
* and call {@link Chart#redraw} after.
|
|
58
|
+
*/
|
|
60
59
|
import './Utilities.js';
|
|
61
60
|
import './Axis.js';
|
|
62
61
|
import './Legend.js';
|
|
63
62
|
import './Options.js';
|
|
64
63
|
import './Pointer.js';
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
doc = H.doc,
|
|
71
|
-
Axis = H.Axis, // @todo add as requirement
|
|
72
|
-
createElement = H.createElement,
|
|
73
|
-
defaultOptions = H.defaultOptions,
|
|
74
|
-
discardElement = H.discardElement,
|
|
75
|
-
charts = H.charts,
|
|
76
|
-
css = H.css,
|
|
77
|
-
defined = H.defined,
|
|
78
|
-
extend = H.extend,
|
|
79
|
-
find = H.find,
|
|
80
|
-
fireEvent = H.fireEvent,
|
|
81
|
-
isNumber = H.isNumber,
|
|
82
|
-
isObject = H.isObject,
|
|
83
|
-
isString = H.isString,
|
|
84
|
-
Legend = H.Legend, // @todo add as requirement
|
|
85
|
-
marginNames = H.marginNames,
|
|
86
|
-
merge = H.merge,
|
|
87
|
-
objectEach = H.objectEach,
|
|
88
|
-
Pointer = H.Pointer, // @todo add as requirement
|
|
89
|
-
pick = H.pick,
|
|
90
|
-
pInt = H.pInt,
|
|
91
|
-
removeEvent = H.removeEvent,
|
|
92
|
-
seriesTypes = H.seriesTypes,
|
|
93
|
-
splat = H.splat,
|
|
94
|
-
syncTimeout = H.syncTimeout,
|
|
95
|
-
win = H.win;
|
|
96
|
-
|
|
64
|
+
var addEvent = H.addEvent, animate = H.animate, animObject = H.animObject, attr = H.attr, doc = H.doc, Axis = H.Axis, // @todo add as requirement
|
|
65
|
+
createElement = H.createElement, defaultOptions = H.defaultOptions, discardElement = H.discardElement, charts = H.charts, css = H.css, defined = H.defined, extend = H.extend, find = H.find, fireEvent = H.fireEvent, isNumber = H.isNumber, isObject = H.isObject, isString = H.isString, Legend = H.Legend, // @todo add as requirement
|
|
66
|
+
marginNames = H.marginNames, merge = H.merge, objectEach = H.objectEach, Pointer = H.Pointer, // @todo add as requirement
|
|
67
|
+
pick = H.pick, pInt = H.pInt, removeEvent = H.removeEvent, seriesTypes = H.seriesTypes, splat = H.splat, syncTimeout = H.syncTimeout, win = H.win;
|
|
68
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
97
69
|
/**
|
|
98
70
|
* The Chart class. The recommended constructor is {@link Highcharts#chart}.
|
|
99
71
|
*
|
|
@@ -125,7 +97,6 @@ var addEvent = H.addEvent,
|
|
|
125
97
|
var Chart = H.Chart = function () {
|
|
126
98
|
this.getArgs.apply(this, arguments);
|
|
127
99
|
};
|
|
128
|
-
|
|
129
100
|
/**
|
|
130
101
|
* Factory function for basic charts.
|
|
131
102
|
*
|
|
@@ -160,12 +131,9 @@ var Chart = H.Chart = function () {
|
|
|
160
131
|
H.chart = function (a, b, c) {
|
|
161
132
|
return new Chart(a, b, c);
|
|
162
133
|
};
|
|
163
|
-
|
|
164
134
|
extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
165
|
-
|
|
166
135
|
// Hook for adding callbacks in modules
|
|
167
136
|
callbacks: [],
|
|
168
|
-
|
|
169
137
|
/**
|
|
170
138
|
* Handle the arguments passed to the constructor.
|
|
171
139
|
*
|
|
@@ -183,7 +151,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
183
151
|
*/
|
|
184
152
|
getArgs: function () {
|
|
185
153
|
var args = [].slice.call(arguments);
|
|
186
|
-
|
|
187
154
|
// Remove the optional first argument, renderTo, and
|
|
188
155
|
// set it on this.
|
|
189
156
|
if (isString(args[0]) || args[0].nodeName) {
|
|
@@ -191,7 +158,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
191
158
|
}
|
|
192
159
|
this.init(args[0], args[1]);
|
|
193
160
|
},
|
|
194
|
-
|
|
195
161
|
/**
|
|
196
162
|
* Overridable function that initializes the chart. The constructor's
|
|
197
163
|
* arguments are passed on directly.
|
|
@@ -205,45 +171,36 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
205
171
|
* Function to run when the chart has loaded and and all external
|
|
206
172
|
* images are loaded.
|
|
207
173
|
*
|
|
174
|
+
* @return {void}
|
|
175
|
+
*
|
|
208
176
|
* @fires Highcharts.Chart#event:init
|
|
209
177
|
* @fires Highcharts.Chart#event:afterInit
|
|
210
178
|
*/
|
|
211
179
|
init: function (userOptions, callback) {
|
|
212
|
-
|
|
213
180
|
// Handle regular options
|
|
214
|
-
var options,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
userPlotOptions = userOptions.plotOptions || {};
|
|
218
|
-
|
|
181
|
+
var options,
|
|
182
|
+
// skip merging data points to increase performance
|
|
183
|
+
seriesOptions = userOptions.series, userPlotOptions = userOptions.plotOptions || {};
|
|
219
184
|
// Fire the event with a default function
|
|
220
185
|
fireEvent(this, 'init', { args: arguments }, function () {
|
|
221
|
-
|
|
222
186
|
userOptions.series = null;
|
|
223
187
|
options = merge(defaultOptions, userOptions); // do the merge
|
|
224
|
-
|
|
225
188
|
// Override (by copy of user options) or clear tooltip options
|
|
226
189
|
// in chart.options.plotOptions (#6218)
|
|
227
190
|
objectEach(options.plotOptions, function (typeOptions, type) {
|
|
228
191
|
if (isObject(typeOptions)) { // #8766
|
|
229
|
-
typeOptions.tooltip = (
|
|
230
|
-
userPlotOptions[type] &&
|
|
192
|
+
typeOptions.tooltip = (userPlotOptions[type] &&
|
|
231
193
|
merge(userPlotOptions[type].tooltip) // override by copy
|
|
232
194
|
) || undefined; // or clear
|
|
233
195
|
}
|
|
234
196
|
});
|
|
235
|
-
|
|
236
197
|
// User options have higher priority than default options
|
|
237
198
|
// (#6218). In case of exporting: path is changed
|
|
238
|
-
options.tooltip.userOptions = (
|
|
239
|
-
userOptions.chart &&
|
|
199
|
+
options.tooltip.userOptions = (userOptions.chart &&
|
|
240
200
|
userOptions.chart.forExport &&
|
|
241
|
-
userOptions.tooltip.userOptions
|
|
242
|
-
) || userOptions.tooltip;
|
|
243
|
-
|
|
201
|
+
userOptions.tooltip.userOptions) || userOptions.tooltip;
|
|
244
202
|
// set back the series data
|
|
245
203
|
options.series = userOptions.series = seriesOptions;
|
|
246
|
-
|
|
247
204
|
/**
|
|
248
205
|
* The original options given to the constructor or a chart factory
|
|
249
206
|
* like {@link Highcharts.chart} and {@link Highcharts.stockChart}.
|
|
@@ -252,24 +209,17 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
252
209
|
* @type {Highcharts.Options}
|
|
253
210
|
*/
|
|
254
211
|
this.userOptions = userOptions;
|
|
255
|
-
|
|
256
212
|
var optionsChart = options.chart;
|
|
257
|
-
|
|
258
213
|
var chartEvents = optionsChart.events;
|
|
259
|
-
|
|
260
214
|
this.margin = [];
|
|
261
215
|
this.spacing = [];
|
|
262
|
-
|
|
263
216
|
// Pixel data bounds for touch zoom
|
|
264
217
|
this.bounds = { h: {}, v: {} };
|
|
265
|
-
|
|
266
218
|
// An array of functions that returns labels that should be
|
|
267
219
|
// considered for anti-collision
|
|
268
220
|
this.labelCollectors = [];
|
|
269
|
-
|
|
270
221
|
this.callback = callback;
|
|
271
222
|
this.isResizing = 0;
|
|
272
|
-
|
|
273
223
|
/**
|
|
274
224
|
* The options structure for the chart after merging
|
|
275
225
|
* {@link #defaultOptions} and {@link #userOptions}. It contains
|
|
@@ -279,7 +229,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
279
229
|
* @type {Highcharts.Options}
|
|
280
230
|
*/
|
|
281
231
|
this.options = options;
|
|
282
|
-
|
|
283
232
|
/**
|
|
284
233
|
* All the axes in the chart.
|
|
285
234
|
*
|
|
@@ -290,7 +239,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
290
239
|
* @type {Array<Highcharts.Axis>}
|
|
291
240
|
*/
|
|
292
241
|
this.axes = [];
|
|
293
|
-
|
|
294
242
|
/**
|
|
295
243
|
* All the current series in the chart.
|
|
296
244
|
*
|
|
@@ -298,7 +246,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
298
246
|
* @type {Array<Highcharts.Series>}
|
|
299
247
|
*/
|
|
300
248
|
this.series = [];
|
|
301
|
-
|
|
302
249
|
/**
|
|
303
250
|
* The `Time` object associated with the chart. Since v6.0.5,
|
|
304
251
|
* time settings can be applied individually for each chart. If
|
|
@@ -312,7 +259,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
312
259
|
userOptions.time && Object.keys(userOptions.time).length ?
|
|
313
260
|
new H.Time(userOptions.time) :
|
|
314
261
|
H.time;
|
|
315
|
-
|
|
316
262
|
/**
|
|
317
263
|
* Whether the chart is in styled mode, meaning all presentatinoal
|
|
318
264
|
* attributes are avoided.
|
|
@@ -322,9 +268,7 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
322
268
|
*/
|
|
323
269
|
this.styledMode = optionsChart.styledMode;
|
|
324
270
|
this.hasCartesianSeries = optionsChart.showAxes;
|
|
325
|
-
|
|
326
271
|
var chart = this;
|
|
327
|
-
|
|
328
272
|
/**
|
|
329
273
|
* Index position of the chart in the {@link Highcharts#charts}
|
|
330
274
|
* property.
|
|
@@ -333,17 +277,16 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
333
277
|
* @type {number}
|
|
334
278
|
*/
|
|
335
279
|
chart.index = charts.length; // Add the chart to the global lookup
|
|
336
|
-
|
|
337
280
|
charts.push(chart);
|
|
338
281
|
H.chartCount++;
|
|
339
|
-
|
|
340
282
|
// Chart event handlers
|
|
341
283
|
if (chartEvents) {
|
|
342
284
|
objectEach(chartEvents, function (event, eventType) {
|
|
343
|
-
|
|
285
|
+
if (H.isFunction(event)) {
|
|
286
|
+
addEvent(chart, eventType, event);
|
|
287
|
+
}
|
|
344
288
|
});
|
|
345
289
|
}
|
|
346
|
-
|
|
347
290
|
/**
|
|
348
291
|
* A collection of the X axes in the chart.
|
|
349
292
|
*
|
|
@@ -351,7 +294,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
351
294
|
* @type {Array<Highcharts.Axis>}
|
|
352
295
|
*/
|
|
353
296
|
chart.xAxis = [];
|
|
354
|
-
|
|
355
297
|
/**
|
|
356
298
|
* A collection of the Y axes in the chart.
|
|
357
299
|
*
|
|
@@ -362,48 +304,35 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
362
304
|
* Make events official: Fire the event `afterInit`.
|
|
363
305
|
*/
|
|
364
306
|
chart.yAxis = [];
|
|
365
|
-
|
|
366
307
|
chart.pointCount = chart.colorCounter = chart.symbolCounter = 0;
|
|
367
|
-
|
|
368
308
|
// Fire after init but before first render, before axes and series
|
|
369
309
|
// have been initialized.
|
|
370
310
|
fireEvent(chart, 'afterInit');
|
|
371
|
-
|
|
372
311
|
chart.firstRender();
|
|
373
312
|
});
|
|
374
313
|
},
|
|
375
|
-
|
|
376
314
|
/**
|
|
377
315
|
* Internal function to unitialize an individual series.
|
|
378
316
|
*
|
|
379
317
|
* @private
|
|
380
318
|
* @function Highcharts.Chart#initSeries
|
|
381
319
|
*
|
|
382
|
-
* @param {Highcharts.
|
|
320
|
+
* @param {Highcharts.SeriesOptions} options
|
|
383
321
|
*
|
|
384
322
|
* @return {Highcharts.Series}
|
|
385
323
|
*/
|
|
386
324
|
initSeries: function (options) {
|
|
387
|
-
var chart = this,
|
|
388
|
-
optionsChart
|
|
389
|
-
|
|
390
|
-
options.type ||
|
|
391
|
-
optionsChart.type ||
|
|
392
|
-
optionsChart.defaultSeriesType
|
|
393
|
-
),
|
|
394
|
-
series,
|
|
395
|
-
Constr = seriesTypes[type];
|
|
396
|
-
|
|
325
|
+
var chart = this, optionsChart = chart.options.chart, type = (options.type ||
|
|
326
|
+
optionsChart.type ||
|
|
327
|
+
optionsChart.defaultSeriesType), series, Constr = seriesTypes[type];
|
|
397
328
|
// No such series type
|
|
398
329
|
if (!Constr) {
|
|
399
330
|
H.error(17, true, chart);
|
|
400
331
|
}
|
|
401
|
-
|
|
402
332
|
series = new Constr();
|
|
403
333
|
series.init(this, options);
|
|
404
334
|
return series;
|
|
405
335
|
},
|
|
406
|
-
|
|
407
336
|
/**
|
|
408
337
|
* Order all series above a given index. When series are added and ordered
|
|
409
338
|
* by configuration, only the last series is handled (#248, #1123, #2456,
|
|
@@ -414,11 +343,11 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
414
343
|
*
|
|
415
344
|
* @param {number} fromIndex
|
|
416
345
|
* If this is given, only the series above this index are handled.
|
|
346
|
+
*
|
|
347
|
+
* @return {void}
|
|
417
348
|
*/
|
|
418
349
|
orderSeries: function (fromIndex) {
|
|
419
|
-
var series = this.series,
|
|
420
|
-
i = fromIndex || 0;
|
|
421
|
-
|
|
350
|
+
var series = this.series, i = fromIndex || 0;
|
|
422
351
|
for (; i < series.length; i++) {
|
|
423
352
|
if (series[i]) {
|
|
424
353
|
series[i].index = i;
|
|
@@ -426,7 +355,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
426
355
|
}
|
|
427
356
|
}
|
|
428
357
|
},
|
|
429
|
-
|
|
430
358
|
/**
|
|
431
359
|
* Check whether a given point is within the plot area.
|
|
432
360
|
*
|
|
@@ -445,15 +373,12 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
445
373
|
* Returns true if the given point is inside the plot area.
|
|
446
374
|
*/
|
|
447
375
|
isInsidePlot: function (plotX, plotY, inverted) {
|
|
448
|
-
var x = inverted ? plotY : plotX,
|
|
449
|
-
y = inverted ? plotX : plotY;
|
|
450
|
-
|
|
376
|
+
var x = inverted ? plotY : plotX, y = inverted ? plotX : plotY;
|
|
451
377
|
return x >= 0 &&
|
|
452
378
|
x <= this.plotWidth &&
|
|
453
379
|
y >= 0 &&
|
|
454
380
|
y <= this.plotHeight;
|
|
455
381
|
},
|
|
456
|
-
|
|
457
382
|
/**
|
|
458
383
|
* Redraw the chart after changes have been done to the data, axis extremes
|
|
459
384
|
* chart size or chart elements. All methods for updating axes, series or
|
|
@@ -468,6 +393,8 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
468
393
|
* @param {boolean|Highcharts.AnimationOptionsObject} [animation]
|
|
469
394
|
* If or how to apply animation to the redraw.
|
|
470
395
|
*
|
|
396
|
+
* @return {void}
|
|
397
|
+
*
|
|
471
398
|
* @fires Highcharts.Chart#event:afterSetExtremes
|
|
472
399
|
* @fires Highcharts.Chart#event:beforeRedraw
|
|
473
400
|
* @fires Highcharts.Chart#event:predraw
|
|
@@ -476,48 +403,24 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
476
403
|
* @fires Highcharts.Chart#event:updatedData
|
|
477
404
|
*/
|
|
478
405
|
redraw: function (animation) {
|
|
479
|
-
|
|
480
406
|
fireEvent(this, 'beforeRedraw');
|
|
481
|
-
|
|
482
|
-
var chart = this,
|
|
483
|
-
axes = chart.axes,
|
|
484
|
-
series = chart.series,
|
|
485
|
-
pointer = chart.pointer,
|
|
486
|
-
legend = chart.legend,
|
|
487
|
-
legendUserOptions = chart.userOptions.legend,
|
|
488
|
-
redrawLegend = chart.isDirtyLegend,
|
|
489
|
-
hasStackedSeries,
|
|
490
|
-
hasDirtyStacks,
|
|
491
|
-
hasCartesianSeries = chart.hasCartesianSeries,
|
|
492
|
-
isDirtyBox = chart.isDirtyBox,
|
|
493
|
-
i,
|
|
494
|
-
serie,
|
|
495
|
-
renderer = chart.renderer,
|
|
496
|
-
isHiddenChart = renderer.isHidden(),
|
|
497
|
-
afterRedraw = [];
|
|
498
|
-
|
|
407
|
+
var chart = this, axes = chart.axes, series = chart.series, pointer = chart.pointer, legend = chart.legend, legendUserOptions = chart.userOptions.legend, redrawLegend = chart.isDirtyLegend, hasStackedSeries, hasDirtyStacks, hasCartesianSeries = chart.hasCartesianSeries, isDirtyBox = chart.isDirtyBox, i, serie, renderer = chart.renderer, isHiddenChart = renderer.isHidden(), afterRedraw = [];
|
|
499
408
|
// Handle responsive rules, not only on resize (#6130)
|
|
500
409
|
if (chart.setResponsive) {
|
|
501
410
|
chart.setResponsive(false);
|
|
502
411
|
}
|
|
503
|
-
|
|
504
412
|
H.setAnimation(animation, chart);
|
|
505
|
-
|
|
506
413
|
if (isHiddenChart) {
|
|
507
414
|
chart.temporaryDisplay();
|
|
508
415
|
}
|
|
509
|
-
|
|
510
416
|
// Adjust title layout (reflow multiline text)
|
|
511
417
|
chart.layOutTitles();
|
|
512
|
-
|
|
513
418
|
// link stacked series
|
|
514
419
|
i = series.length;
|
|
515
420
|
while (i--) {
|
|
516
421
|
serie = series[i];
|
|
517
|
-
|
|
518
422
|
if (serie.options.stacking) {
|
|
519
423
|
hasStackedSeries = true;
|
|
520
|
-
|
|
521
424
|
if (serie.isDirty) {
|
|
522
425
|
hasDirtyStacks = true;
|
|
523
426
|
break;
|
|
@@ -533,7 +436,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
533
436
|
}
|
|
534
437
|
}
|
|
535
438
|
}
|
|
536
|
-
|
|
537
439
|
// Handle updated data in the series
|
|
538
440
|
series.forEach(function (serie) {
|
|
539
441
|
if (serie.isDirty) {
|
|
@@ -542,13 +444,10 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
542
444
|
serie.updateTotals();
|
|
543
445
|
}
|
|
544
446
|
redrawLegend = true;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
(
|
|
548
|
-
legendUserOptions.
|
|
549
|
-
legendUserOptions.labelFormat
|
|
550
|
-
)
|
|
551
|
-
) {
|
|
447
|
+
}
|
|
448
|
+
else if (legendUserOptions &&
|
|
449
|
+
(legendUserOptions.labelFormatter ||
|
|
450
|
+
legendUserOptions.labelFormat)) {
|
|
552
451
|
redrawLegend = true; // #2165
|
|
553
452
|
}
|
|
554
453
|
}
|
|
@@ -556,21 +455,16 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
556
455
|
fireEvent(serie, 'updatedData');
|
|
557
456
|
}
|
|
558
457
|
});
|
|
559
|
-
|
|
560
458
|
// handle added or removed series
|
|
561
459
|
if (redrawLegend && legend && legend.options.enabled) {
|
|
562
460
|
// draw legend graphics
|
|
563
461
|
legend.render();
|
|
564
|
-
|
|
565
462
|
chart.isDirtyLegend = false;
|
|
566
463
|
}
|
|
567
|
-
|
|
568
464
|
// reset stacks
|
|
569
465
|
if (hasStackedSeries) {
|
|
570
466
|
chart.getStacks();
|
|
571
467
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
468
|
if (hasCartesianSeries) {
|
|
575
469
|
// set axes scales
|
|
576
470
|
axes.forEach(function (axis) {
|
|
@@ -578,9 +472,7 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
578
472
|
axis.setScale();
|
|
579
473
|
});
|
|
580
474
|
}
|
|
581
|
-
|
|
582
475
|
chart.getMargins(); // #3098
|
|
583
|
-
|
|
584
476
|
if (hasCartesianSeries) {
|
|
585
477
|
// If one axis is dirty, all axes must be redrawn (#792, #2169)
|
|
586
478
|
axes.forEach(function (axis) {
|
|
@@ -588,23 +480,15 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
588
480
|
isDirtyBox = true;
|
|
589
481
|
}
|
|
590
482
|
});
|
|
591
|
-
|
|
592
483
|
// redraw axes
|
|
593
484
|
axes.forEach(function (axis) {
|
|
594
|
-
|
|
595
485
|
// Fire 'afterSetExtremes' only if extremes are set
|
|
596
486
|
var key = axis.min + ',' + axis.max;
|
|
597
|
-
|
|
598
487
|
if (axis.extKey !== key) { // #821, #4452
|
|
599
488
|
axis.extKey = key;
|
|
600
|
-
|
|
601
489
|
// prevent a recursive call to chart.redraw() (#1119)
|
|
602
490
|
afterRedraw.push(function () {
|
|
603
|
-
fireEvent(
|
|
604
|
-
axis,
|
|
605
|
-
'afterSetExtremes',
|
|
606
|
-
extend(axis.eventArgs, axis.getExtremes())
|
|
607
|
-
); // #747, #751
|
|
491
|
+
fireEvent(axis, 'afterSetExtremes', extend(axis.eventArgs, axis.getExtremes())); // #747, #751
|
|
608
492
|
delete axis.eventArgs;
|
|
609
493
|
});
|
|
610
494
|
}
|
|
@@ -613,16 +497,13 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
613
497
|
}
|
|
614
498
|
});
|
|
615
499
|
}
|
|
616
|
-
|
|
617
500
|
// the plot areas size has changed
|
|
618
501
|
if (isDirtyBox) {
|
|
619
502
|
chart.drawChartBox();
|
|
620
503
|
}
|
|
621
|
-
|
|
622
504
|
// Fire an event before redrawing series, used by the boost module to
|
|
623
505
|
// clear previous series renderings.
|
|
624
506
|
fireEvent(chart, 'predraw');
|
|
625
|
-
|
|
626
507
|
// redraw affected series
|
|
627
508
|
series.forEach(function (serie) {
|
|
628
509
|
if ((isDirtyBox || serie.isDirty) && serie.visible) {
|
|
@@ -632,29 +513,23 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
632
513
|
// for a hidden series after setData(). Fixes #6012
|
|
633
514
|
serie.isDirtyData = false;
|
|
634
515
|
});
|
|
635
|
-
|
|
636
516
|
// move tooltip or reset
|
|
637
517
|
if (pointer) {
|
|
638
518
|
pointer.reset(true);
|
|
639
519
|
}
|
|
640
|
-
|
|
641
520
|
// redraw if canvas
|
|
642
521
|
renderer.draw();
|
|
643
|
-
|
|
644
522
|
// Fire the events
|
|
645
523
|
fireEvent(chart, 'redraw');
|
|
646
524
|
fireEvent(chart, 'render');
|
|
647
|
-
|
|
648
525
|
if (isHiddenChart) {
|
|
649
526
|
chart.temporaryDisplay(true);
|
|
650
527
|
}
|
|
651
|
-
|
|
652
528
|
// Fire callbacks that are put on hold until after the redraw
|
|
653
529
|
afterRedraw.forEach(function (callback) {
|
|
654
530
|
callback.call();
|
|
655
531
|
});
|
|
656
532
|
},
|
|
657
|
-
|
|
658
533
|
/**
|
|
659
534
|
* Get an axis, series or point object by `id` as given in the configuration
|
|
660
535
|
* options. Returns `undefined` if no item is found.
|
|
@@ -671,69 +546,55 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
671
546
|
* The retrieved item.
|
|
672
547
|
*/
|
|
673
548
|
get: function (id) {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
549
|
+
var ret, series = this.series, i;
|
|
550
|
+
/**
|
|
551
|
+
* @private
|
|
552
|
+
* @param {Highcharts.Axis|Highcharts.Series} item
|
|
553
|
+
* @return {boolean}
|
|
554
|
+
*/
|
|
679
555
|
function itemById(item) {
|
|
680
556
|
return item.id === id || (item.options && item.options.id === id);
|
|
681
557
|
}
|
|
682
|
-
|
|
683
558
|
ret =
|
|
684
559
|
// Search axes
|
|
685
560
|
find(this.axes, itemById) ||
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
find(this.series, itemById);
|
|
689
|
-
|
|
561
|
+
// Search series
|
|
562
|
+
find(this.series, itemById);
|
|
690
563
|
// Search points
|
|
691
564
|
for (i = 0; !ret && i < series.length; i++) {
|
|
692
565
|
ret = find(series[i].points || [], itemById);
|
|
693
566
|
}
|
|
694
|
-
|
|
695
567
|
return ret;
|
|
696
568
|
},
|
|
697
|
-
|
|
698
569
|
/**
|
|
699
570
|
* Create the Axis instances based on the config options.
|
|
700
571
|
*
|
|
701
572
|
* @private
|
|
702
573
|
* @function Highcharts.Chart#getAxes
|
|
703
574
|
*
|
|
575
|
+
* @return {void}
|
|
576
|
+
*
|
|
704
577
|
* @fires Highcharts.Chart#event:afterGetAxes
|
|
705
578
|
* @fires Highcharts.Chart#event:getAxes
|
|
706
579
|
*/
|
|
707
580
|
getAxes: function () {
|
|
708
|
-
var chart = this,
|
|
709
|
-
options = this.options,
|
|
710
|
-
xAxisOptions = options.xAxis = splat(options.xAxis || {}),
|
|
711
|
-
yAxisOptions = options.yAxis = splat(options.yAxis || {}),
|
|
712
|
-
optionsArray;
|
|
713
|
-
|
|
581
|
+
var chart = this, options = this.options, xAxisOptions = options.xAxis = splat(options.xAxis || {}), yAxisOptions = options.yAxis = splat(options.yAxis || {}), optionsArray;
|
|
714
582
|
fireEvent(this, 'getAxes');
|
|
715
|
-
|
|
716
583
|
// make sure the options are arrays and add some members
|
|
717
584
|
xAxisOptions.forEach(function (axis, i) {
|
|
718
585
|
axis.index = i;
|
|
719
586
|
axis.isX = true;
|
|
720
587
|
});
|
|
721
|
-
|
|
722
588
|
yAxisOptions.forEach(function (axis, i) {
|
|
723
589
|
axis.index = i;
|
|
724
590
|
});
|
|
725
|
-
|
|
726
591
|
// concatenate all axis options into one array
|
|
727
592
|
optionsArray = xAxisOptions.concat(yAxisOptions);
|
|
728
|
-
|
|
729
593
|
optionsArray.forEach(function (axisOptions) {
|
|
730
594
|
new Axis(chart, axisOptions); // eslint-disable-line no-new
|
|
731
595
|
});
|
|
732
|
-
|
|
733
596
|
fireEvent(this, 'afterGetAxes');
|
|
734
597
|
},
|
|
735
|
-
|
|
736
|
-
|
|
737
598
|
/**
|
|
738
599
|
* Returns an array of all currently selected points in the chart. Points
|
|
739
600
|
* can be selected by clicking or programmatically by the
|
|
@@ -750,22 +611,16 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
750
611
|
*/
|
|
751
612
|
getSelectedPoints: function () {
|
|
752
613
|
var points = [];
|
|
753
|
-
|
|
754
614
|
this.series.forEach(function (serie) {
|
|
755
615
|
// For one-to-one points inspect series.data in order to retrieve
|
|
756
616
|
// points outside the visible range (#6445). For grouped data,
|
|
757
617
|
// inspect the generated series.points.
|
|
758
|
-
points = points.concat(
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
return point.selected;
|
|
762
|
-
}
|
|
763
|
-
)
|
|
764
|
-
);
|
|
618
|
+
points = points.concat((serie[serie.hasGroupedData ? 'points' : 'data'] || []).filter(function (point) {
|
|
619
|
+
return point.selected;
|
|
620
|
+
}));
|
|
765
621
|
});
|
|
766
622
|
return points;
|
|
767
623
|
},
|
|
768
|
-
|
|
769
624
|
/**
|
|
770
625
|
* Returns an array of all currently selected series in the chart. Series
|
|
771
626
|
* can be selected either programmatically by the
|
|
@@ -787,7 +642,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
787
642
|
return serie.selected;
|
|
788
643
|
});
|
|
789
644
|
},
|
|
790
|
-
|
|
791
645
|
/**
|
|
792
646
|
* Set a new title or subtitle for the chart.
|
|
793
647
|
*
|
|
@@ -796,50 +650,38 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
796
650
|
*
|
|
797
651
|
* @function Highcharts.Chart#setTitle
|
|
798
652
|
*
|
|
799
|
-
* @param {Highcharts.TitleOptions} titleOptions
|
|
653
|
+
* @param {Highcharts.TitleOptions} [titleOptions]
|
|
800
654
|
* New title options. The title text itself is set by the
|
|
801
655
|
* `titleOptions.text` property.
|
|
802
656
|
*
|
|
803
|
-
* @param {Highcharts.SubtitleOptions} subtitleOptions
|
|
657
|
+
* @param {Highcharts.SubtitleOptions} [subtitleOptions]
|
|
804
658
|
* New subtitle options. The subtitle text itself is set by the
|
|
805
659
|
* `subtitleOptions.text` property.
|
|
806
660
|
*
|
|
807
|
-
* @param {boolean} redraw
|
|
661
|
+
* @param {boolean} [redraw]
|
|
808
662
|
* Whether to redraw the chart or wait for a later call to
|
|
809
663
|
* `chart.redraw()`.
|
|
664
|
+
*
|
|
665
|
+
* @return {void}
|
|
810
666
|
*/
|
|
811
667
|
setTitle: function (titleOptions, subtitleOptions, redraw) {
|
|
812
|
-
var chart = this,
|
|
813
|
-
options = chart.options,
|
|
814
|
-
styledMode = chart.styledMode,
|
|
815
|
-
chartTitleOptions,
|
|
816
|
-
chartSubtitleOptions;
|
|
817
|
-
|
|
668
|
+
var chart = this, options = chart.options, styledMode = chart.styledMode, chartTitleOptions, chartSubtitleOptions;
|
|
818
669
|
chartTitleOptions = options.title = merge(
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
options.title,
|
|
827
|
-
titleOptions
|
|
828
|
-
);
|
|
670
|
+
// Default styles
|
|
671
|
+
(!styledMode && {
|
|
672
|
+
style: {
|
|
673
|
+
color: '#333333',
|
|
674
|
+
fontSize: options.isStock ? '16px' : '18px' // #2944
|
|
675
|
+
}
|
|
676
|
+
}), options.title, titleOptions);
|
|
829
677
|
chartSubtitleOptions = options.subtitle = merge(
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
options.subtitle,
|
|
837
|
-
subtitleOptions
|
|
838
|
-
);
|
|
839
|
-
|
|
840
|
-
|
|
678
|
+
// Default styles
|
|
679
|
+
(!styledMode && {
|
|
680
|
+
style: {
|
|
681
|
+
color: '#666666'
|
|
682
|
+
}
|
|
683
|
+
}), options.subtitle, subtitleOptions);
|
|
841
684
|
// add title and subtitle
|
|
842
|
-
|
|
843
685
|
/**
|
|
844
686
|
* The chart title. The title has an `update` method that allows
|
|
845
687
|
* modifying the options directly or indirectly via
|
|
@@ -851,7 +693,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
851
693
|
* @name Highcharts.Chart#title
|
|
852
694
|
* @type {Highcharts.TitleObject}
|
|
853
695
|
*/
|
|
854
|
-
|
|
855
696
|
/**
|
|
856
697
|
* The chart subtitle. The subtitle has an `update` method that
|
|
857
698
|
* allows modifying the options directly or indirectly via
|
|
@@ -860,49 +701,34 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
860
701
|
* @name Highcharts.Chart#subtitle
|
|
861
702
|
* @type {Highcharts.SubtitleObject}
|
|
862
703
|
*/
|
|
863
|
-
|
|
864
704
|
[
|
|
865
705
|
['title', titleOptions, chartTitleOptions],
|
|
866
706
|
['subtitle', subtitleOptions, chartSubtitleOptions]
|
|
867
707
|
].forEach(function (arr, i) {
|
|
868
|
-
var name = arr[0],
|
|
869
|
-
title = chart[name],
|
|
870
|
-
titleOptions = arr[1],
|
|
871
|
-
chartTitleOptions = arr[2];
|
|
872
|
-
|
|
708
|
+
var name = arr[0], title = chart[name], titleOptions = arr[1], chartTitleOptions = arr[2];
|
|
873
709
|
if (title && titleOptions) {
|
|
874
710
|
chart[name] = title = title.destroy(); // remove old
|
|
875
711
|
}
|
|
876
|
-
|
|
877
712
|
if (chartTitleOptions && !title) {
|
|
878
|
-
chart[name] = chart.renderer.text(
|
|
879
|
-
chartTitleOptions.text,
|
|
880
|
-
0,
|
|
881
|
-
0,
|
|
882
|
-
chartTitleOptions.useHTML
|
|
883
|
-
)
|
|
713
|
+
chart[name] = chart.renderer.text(chartTitleOptions.text, 0, 0, chartTitleOptions.useHTML)
|
|
884
714
|
.attr({
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
715
|
+
align: chartTitleOptions.align,
|
|
716
|
+
'class': 'highcharts-' + name,
|
|
717
|
+
zIndex: chartTitleOptions.zIndex || 4
|
|
718
|
+
})
|
|
889
719
|
.add();
|
|
890
|
-
|
|
891
720
|
// Update methods, shortcut to Chart.setTitle
|
|
892
721
|
chart[name].update = function (o) {
|
|
893
|
-
chart.setTitle(!i && o, i && o);
|
|
722
|
+
chart.setTitle((!i && o), (i && o));
|
|
894
723
|
};
|
|
895
|
-
|
|
896
724
|
// Presentational
|
|
897
725
|
if (!styledMode) {
|
|
898
726
|
chart[name].css(chartTitleOptions.style);
|
|
899
727
|
}
|
|
900
|
-
|
|
901
728
|
}
|
|
902
729
|
});
|
|
903
730
|
chart.layOutTitles(redraw);
|
|
904
731
|
},
|
|
905
|
-
|
|
906
732
|
/**
|
|
907
733
|
* Internal function to lay out the chart titles and cache the full offset
|
|
908
734
|
* height for use in `getMargins`. The result is stored in
|
|
@@ -912,50 +738,38 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
912
738
|
* @function Highcharts.Chart#layOutTitles
|
|
913
739
|
*
|
|
914
740
|
* @param {boolean} [redraw=true]
|
|
741
|
+
*
|
|
742
|
+
* @return {void}
|
|
915
743
|
*/
|
|
916
744
|
layOutTitles: function (redraw) {
|
|
917
|
-
var titleOffset = 0,
|
|
918
|
-
requiresDirtyBox,
|
|
919
|
-
renderer = this.renderer,
|
|
920
|
-
spacingBox = this.spacingBox;
|
|
921
|
-
|
|
745
|
+
var titleOffset = 0, requiresDirtyBox, renderer = this.renderer, spacingBox = this.spacingBox;
|
|
922
746
|
// Lay out the title and the subtitle respectively
|
|
923
747
|
['title', 'subtitle'].forEach(function (key) {
|
|
924
|
-
var title = this[key],
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
// Floating subtitle (#6574)
|
|
928
|
-
titleOptions.verticalAlign ? 0 : titleOffset + 2,
|
|
929
|
-
titleSize;
|
|
930
|
-
|
|
748
|
+
var title = this[key], titleOptions = this.options[key], offset = key === 'title' ? -3 :
|
|
749
|
+
// Floating subtitle (#6574)
|
|
750
|
+
titleOptions.verticalAlign ? 0 : titleOffset + 2, titleSize;
|
|
931
751
|
if (title) {
|
|
932
|
-
|
|
933
752
|
if (!this.styledMode) {
|
|
934
753
|
titleSize = titleOptions.style.fontSize;
|
|
935
754
|
}
|
|
936
755
|
titleSize = renderer.fontMetrics(titleSize, title).b;
|
|
937
756
|
title
|
|
938
757
|
.css({
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
758
|
+
width: (titleOptions.width ||
|
|
759
|
+
spacingBox.width + titleOptions.widthAdjust) + 'px'
|
|
760
|
+
})
|
|
942
761
|
.align(extend({
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
762
|
+
y: offset + titleSize
|
|
763
|
+
}, titleOptions), false, 'spacingBox');
|
|
946
764
|
if (!titleOptions.floating && !titleOptions.verticalAlign) {
|
|
947
|
-
titleOffset = Math.ceil(
|
|
948
|
-
titleOffset +
|
|
765
|
+
titleOffset = Math.ceil(titleOffset +
|
|
949
766
|
// Skip the cache for HTML (#3481)
|
|
950
|
-
title.getBBox(titleOptions.useHTML).height
|
|
951
|
-
);
|
|
767
|
+
title.getBBox(titleOptions.useHTML).height);
|
|
952
768
|
}
|
|
953
769
|
}
|
|
954
770
|
}, this);
|
|
955
|
-
|
|
956
771
|
requiresDirtyBox = this.titleOffset !== titleOffset;
|
|
957
772
|
this.titleOffset = titleOffset; // used in getMargins
|
|
958
|
-
|
|
959
773
|
if (!this.isDirtyBox && requiresDirtyBox) {
|
|
960
774
|
this.isDirtyBox = this.isDirtyLegend = requiresDirtyBox;
|
|
961
775
|
// Redraw if necessary (#2719, #2744)
|
|
@@ -964,7 +778,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
964
778
|
}
|
|
965
779
|
}
|
|
966
780
|
},
|
|
967
|
-
|
|
968
781
|
/**
|
|
969
782
|
* Internal function to get the chart width and height according to options
|
|
970
783
|
* and container size. Sets {@link Chart.chartWidth} and
|
|
@@ -972,14 +785,11 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
972
785
|
*
|
|
973
786
|
* @private
|
|
974
787
|
* @function Highcharts.Chart#getChartSize
|
|
788
|
+
*
|
|
789
|
+
* @return {void}
|
|
975
790
|
*/
|
|
976
791
|
getChartSize: function () {
|
|
977
|
-
var chart = this,
|
|
978
|
-
optionsChart = chart.options.chart,
|
|
979
|
-
widthOption = optionsChart.width,
|
|
980
|
-
heightOption = optionsChart.height,
|
|
981
|
-
renderTo = chart.renderTo;
|
|
982
|
-
|
|
792
|
+
var chart = this, optionsChart = chart.options.chart, widthOption = optionsChart.width, heightOption = optionsChart.height, renderTo = chart.renderTo;
|
|
983
793
|
// Get inner width and height
|
|
984
794
|
if (!defined(widthOption)) {
|
|
985
795
|
chart.containerWidth = H.getStyle(renderTo, 'width');
|
|
@@ -987,16 +797,14 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
987
797
|
if (!defined(heightOption)) {
|
|
988
798
|
chart.containerHeight = H.getStyle(renderTo, 'height');
|
|
989
799
|
}
|
|
990
|
-
|
|
991
800
|
/**
|
|
992
801
|
* The current pixel width of the chart.
|
|
993
802
|
*
|
|
994
803
|
* @name Highcharts.Chart#chartWidth
|
|
995
804
|
* @type {number}
|
|
996
805
|
*/
|
|
997
|
-
chart.chartWidth = Math.max(
|
|
998
|
-
|
|
999
|
-
widthOption || chart.containerWidth || 600 // #1460
|
|
806
|
+
chart.chartWidth = Math.max(// #1393
|
|
807
|
+
0, widthOption || chart.containerWidth || 600 // #1460
|
|
1000
808
|
);
|
|
1001
809
|
/**
|
|
1002
810
|
* The current pixel height of the chart.
|
|
@@ -1004,16 +812,11 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1004
812
|
* @name Highcharts.Chart#chartHeight
|
|
1005
813
|
* @type {number}
|
|
1006
814
|
*/
|
|
1007
|
-
chart.chartHeight = Math.max(
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
chart.chartWidth
|
|
1012
|
-
) ||
|
|
1013
|
-
(chart.containerHeight > 1 ? chart.containerHeight : 400)
|
|
1014
|
-
);
|
|
815
|
+
chart.chartHeight = Math.max(0, H.relativeLength(heightOption, chart.chartWidth) ||
|
|
816
|
+
(chart.containerHeight > 1 ?
|
|
817
|
+
chart.containerHeight :
|
|
818
|
+
400));
|
|
1015
819
|
},
|
|
1016
|
-
|
|
1017
820
|
/**
|
|
1018
821
|
* If the renderTo element has no offsetWidth, most likely one or more of
|
|
1019
822
|
* its parents are hidden. Loop up the DOM tree to temporarily display the
|
|
@@ -1023,16 +826,15 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1023
826
|
* @private
|
|
1024
827
|
* @function Highcharts.Chart#temporaryDisplay
|
|
1025
828
|
*
|
|
1026
|
-
* @param {boolean} revert
|
|
829
|
+
* @param {boolean} [revert]
|
|
1027
830
|
* Revert to the saved original styles.
|
|
831
|
+
*
|
|
832
|
+
* @return {void}
|
|
1028
833
|
*/
|
|
1029
834
|
temporaryDisplay: function (revert) {
|
|
1030
|
-
var node = this.renderTo,
|
|
1031
|
-
tempStyle;
|
|
1032
|
-
|
|
835
|
+
var node = this.renderTo, tempStyle;
|
|
1033
836
|
if (!revert) {
|
|
1034
837
|
while (node && node.style) {
|
|
1035
|
-
|
|
1036
838
|
// When rendering to a detached node, it needs to be temporarily
|
|
1037
839
|
// attached in order to read styling and bounding boxes (#5783,
|
|
1038
840
|
// #7024).
|
|
@@ -1040,10 +842,8 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1040
842
|
node.hcOrigDetached = true;
|
|
1041
843
|
doc.body.appendChild(node);
|
|
1042
844
|
}
|
|
1043
|
-
if (
|
|
1044
|
-
|
|
1045
|
-
node.hcOricDetached
|
|
1046
|
-
) {
|
|
845
|
+
if (H.getStyle(node, 'display', false) === 'none' ||
|
|
846
|
+
node.hcOricDetached) {
|
|
1047
847
|
node.hcOrigStyle = {
|
|
1048
848
|
display: node.style.display,
|
|
1049
849
|
height: node.style.height,
|
|
@@ -1056,9 +856,7 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1056
856
|
if (node !== this.renderTo) {
|
|
1057
857
|
tempStyle.height = 0;
|
|
1058
858
|
}
|
|
1059
|
-
|
|
1060
859
|
H.css(node, tempStyle);
|
|
1061
|
-
|
|
1062
860
|
// If it still doesn't have an offset width after setting
|
|
1063
861
|
// display to block, it probably has an !important priority
|
|
1064
862
|
// #2631, 6803
|
|
@@ -1067,12 +865,12 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1067
865
|
}
|
|
1068
866
|
}
|
|
1069
867
|
node = node.parentNode;
|
|
1070
|
-
|
|
1071
868
|
if (node === doc.body) {
|
|
1072
869
|
break;
|
|
1073
870
|
}
|
|
1074
871
|
}
|
|
1075
|
-
}
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
1076
874
|
while (node && node.style) {
|
|
1077
875
|
if (node.hcOrigStyle) {
|
|
1078
876
|
H.css(node, node.hcOrigStyle);
|
|
@@ -1086,19 +884,19 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1086
884
|
}
|
|
1087
885
|
}
|
|
1088
886
|
},
|
|
1089
|
-
|
|
1090
887
|
/**
|
|
1091
888
|
* Set the {@link Chart.container|chart container's} class name, in
|
|
1092
889
|
* addition to `highcharts-container`.
|
|
1093
890
|
*
|
|
1094
891
|
* @function Highcharts.Chart#setClassName
|
|
1095
892
|
*
|
|
1096
|
-
* @param {string} className
|
|
893
|
+
* @param {string} [className]
|
|
894
|
+
*
|
|
895
|
+
* @return {void}
|
|
1097
896
|
*/
|
|
1098
897
|
setClassName: function (className) {
|
|
1099
898
|
this.container.className = 'highcharts-container ' + (className || '');
|
|
1100
899
|
},
|
|
1101
|
-
|
|
1102
900
|
/**
|
|
1103
901
|
* Get the containing element, determine the size and create the inner
|
|
1104
902
|
* container div to hold the chart.
|
|
@@ -1106,56 +904,39 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1106
904
|
* @private
|
|
1107
905
|
* @function Highcharts.Chart#afterGetContainer
|
|
1108
906
|
*
|
|
907
|
+
* @return {void}
|
|
908
|
+
*
|
|
1109
909
|
* @fires Highcharts.Chart#event:afterGetContainer
|
|
1110
910
|
*/
|
|
1111
911
|
getContainer: function () {
|
|
1112
|
-
var chart = this,
|
|
1113
|
-
container,
|
|
1114
|
-
options = chart.options,
|
|
1115
|
-
optionsChart = options.chart,
|
|
1116
|
-
chartWidth,
|
|
1117
|
-
chartHeight,
|
|
1118
|
-
renderTo = chart.renderTo,
|
|
1119
|
-
indexAttrName = 'data-highcharts-chart',
|
|
1120
|
-
oldChartIndex,
|
|
1121
|
-
Ren,
|
|
1122
|
-
containerId = H.uniqueKey(),
|
|
1123
|
-
containerStyle,
|
|
1124
|
-
key;
|
|
1125
|
-
|
|
912
|
+
var chart = this, container, options = chart.options, optionsChart = options.chart, chartWidth, chartHeight, renderTo = chart.renderTo, indexAttrName = 'data-highcharts-chart', oldChartIndex, Ren, containerId = H.uniqueKey(), containerStyle, key;
|
|
1126
913
|
if (!renderTo) {
|
|
1127
|
-
chart.renderTo = renderTo =
|
|
914
|
+
chart.renderTo = renderTo =
|
|
915
|
+
optionsChart.renderTo;
|
|
1128
916
|
}
|
|
1129
|
-
|
|
1130
917
|
if (isString(renderTo)) {
|
|
1131
|
-
chart.renderTo = renderTo =
|
|
918
|
+
chart.renderTo = renderTo =
|
|
919
|
+
doc.getElementById(renderTo);
|
|
1132
920
|
}
|
|
1133
|
-
|
|
1134
921
|
// Display an error if the renderTo is wrong
|
|
1135
922
|
if (!renderTo) {
|
|
1136
923
|
H.error(13, true, chart);
|
|
1137
924
|
}
|
|
1138
|
-
|
|
1139
925
|
// If the container already holds a chart, destroy it. The check for
|
|
1140
926
|
// hasRendered is there because web pages that are saved to disk from
|
|
1141
927
|
// the browser, will preserve the data-highcharts-chart attribute and
|
|
1142
928
|
// the SVG contents, but not an interactive chart. So in this case,
|
|
1143
929
|
// charts[oldChartIndex] will point to the wrong chart if any (#2609).
|
|
1144
930
|
oldChartIndex = pInt(attr(renderTo, indexAttrName));
|
|
1145
|
-
if (
|
|
1146
|
-
isNumber(oldChartIndex) &&
|
|
931
|
+
if (isNumber(oldChartIndex) &&
|
|
1147
932
|
charts[oldChartIndex] &&
|
|
1148
|
-
charts[oldChartIndex].hasRendered
|
|
1149
|
-
) {
|
|
933
|
+
charts[oldChartIndex].hasRendered) {
|
|
1150
934
|
charts[oldChartIndex].destroy();
|
|
1151
935
|
}
|
|
1152
|
-
|
|
1153
936
|
// Make a reference to the chart from the div
|
|
1154
937
|
attr(renderTo, indexAttrName, chart.index);
|
|
1155
|
-
|
|
1156
938
|
// remove previous chart
|
|
1157
939
|
renderTo.innerHTML = '';
|
|
1158
|
-
|
|
1159
940
|
// If the container doesn't have an offsetWidth, it has or is a child of
|
|
1160
941
|
// a node that has display:none. We need to temporarily move it out to a
|
|
1161
942
|
// visible state to determine the size, else the legend and tooltips
|
|
@@ -1164,16 +945,13 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1164
945
|
if (!optionsChart.skipClone && !renderTo.offsetWidth) {
|
|
1165
946
|
chart.temporaryDisplay();
|
|
1166
947
|
}
|
|
1167
|
-
|
|
1168
948
|
// get the width and height
|
|
1169
949
|
chart.getChartSize();
|
|
1170
950
|
chartWidth = chart.chartWidth;
|
|
1171
951
|
chartHeight = chart.chartHeight;
|
|
1172
|
-
|
|
1173
952
|
// Allow table cells and flex-boxes to shrink without the chart blocking
|
|
1174
953
|
// them out (#6427)
|
|
1175
954
|
css(renderTo, { overflow: 'hidden' });
|
|
1176
|
-
|
|
1177
955
|
// Create the inner container
|
|
1178
956
|
if (!chart.styledMode) {
|
|
1179
957
|
containerStyle = extend({
|
|
@@ -1184,12 +962,11 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1184
962
|
width: chartWidth + 'px',
|
|
1185
963
|
height: chartHeight + 'px',
|
|
1186
964
|
textAlign: 'left',
|
|
1187
|
-
lineHeight: 'normal',
|
|
1188
|
-
zIndex: 0,
|
|
965
|
+
lineHeight: 'normal',
|
|
966
|
+
zIndex: 0,
|
|
1189
967
|
'-webkit-tap-highlight-color': 'rgba(0,0,0,0)'
|
|
1190
968
|
}, optionsChart.style);
|
|
1191
969
|
}
|
|
1192
|
-
|
|
1193
970
|
/**
|
|
1194
971
|
* The containing HTML element of the chart. The container is
|
|
1195
972
|
* dynamically inserted into the element given as the `renderTo`
|
|
@@ -1198,22 +975,14 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1198
975
|
* @name Highcharts.Chart#container
|
|
1199
976
|
* @type {Highcharts.HTMLDOMElement}
|
|
1200
977
|
*/
|
|
1201
|
-
container = createElement(
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
id: containerId
|
|
1205
|
-
},
|
|
1206
|
-
containerStyle,
|
|
1207
|
-
renderTo
|
|
1208
|
-
);
|
|
978
|
+
container = createElement('div', {
|
|
979
|
+
id: containerId
|
|
980
|
+
}, containerStyle, renderTo);
|
|
1209
981
|
chart.container = container;
|
|
1210
|
-
|
|
1211
982
|
// cache the cursor (#1650)
|
|
1212
983
|
chart._cursor = container.style.cursor;
|
|
1213
|
-
|
|
1214
984
|
// Initialize the renderer
|
|
1215
985
|
Ren = H[optionsChart.renderer] || H.Renderer;
|
|
1216
|
-
|
|
1217
986
|
/**
|
|
1218
987
|
* The renderer instance of the chart. Each chart instance has only one
|
|
1219
988
|
* associated renderer.
|
|
@@ -1221,33 +990,21 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1221
990
|
* @name Highcharts.Chart#renderer
|
|
1222
991
|
* @type {Highcharts.SVGRenderer}
|
|
1223
992
|
*/
|
|
1224
|
-
chart.renderer = new Ren(
|
|
1225
|
-
container,
|
|
1226
|
-
chartWidth,
|
|
1227
|
-
chartHeight,
|
|
1228
|
-
null,
|
|
1229
|
-
optionsChart.forExport,
|
|
1230
|
-
options.exporting && options.exporting.allowHTML,
|
|
1231
|
-
chart.styledMode
|
|
1232
|
-
);
|
|
1233
|
-
|
|
1234
|
-
|
|
993
|
+
chart.renderer = new Ren(container, chartWidth, chartHeight, null, optionsChart.forExport, options.exporting && options.exporting.allowHTML, chart.styledMode);
|
|
1235
994
|
chart.setClassName(optionsChart.className);
|
|
1236
995
|
if (!chart.styledMode) {
|
|
1237
996
|
chart.renderer.setStyle(optionsChart.style);
|
|
1238
|
-
}
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
1239
999
|
// Initialize definitions
|
|
1240
|
-
for (key in options.defs) {
|
|
1000
|
+
for (key in options.defs) { // eslint-disable-line guard-for-in
|
|
1241
1001
|
this.renderer.definition(options.defs[key]);
|
|
1242
1002
|
}
|
|
1243
1003
|
}
|
|
1244
|
-
|
|
1245
1004
|
// Add a reference to the charts index
|
|
1246
1005
|
chart.renderer.chartIndex = chart.index;
|
|
1247
|
-
|
|
1248
1006
|
fireEvent(this, 'afterGetContainer');
|
|
1249
1007
|
},
|
|
1250
|
-
|
|
1251
1008
|
/**
|
|
1252
1009
|
* Calculate margins by rendering axis labels in a preliminary position.
|
|
1253
1010
|
* Title, subtitle and legend have already been rendered at this stage, but
|
|
@@ -1255,50 +1012,35 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1255
1012
|
*
|
|
1256
1013
|
* @private
|
|
1257
1014
|
* @function Highcharts.Chart#getMargins
|
|
1258
|
-
*
|
|
1259
1015
|
* @param {boolean} skipAxes
|
|
1260
|
-
*
|
|
1016
|
+
* @return {void}
|
|
1261
1017
|
* @fires Highcharts.Chart#event:getMargins
|
|
1262
1018
|
*/
|
|
1263
1019
|
getMargins: function (skipAxes) {
|
|
1264
|
-
var chart = this,
|
|
1265
|
-
spacing = chart.spacing,
|
|
1266
|
-
margin = chart.margin,
|
|
1267
|
-
titleOffset = chart.titleOffset;
|
|
1268
|
-
|
|
1020
|
+
var chart = this, spacing = chart.spacing, margin = chart.margin, titleOffset = chart.titleOffset;
|
|
1269
1021
|
chart.resetMargins();
|
|
1270
|
-
|
|
1271
1022
|
// Adjust for title and subtitle
|
|
1272
1023
|
if (titleOffset && !defined(margin[0])) {
|
|
1273
|
-
chart.plotTop = Math.max(
|
|
1274
|
-
chart.plotTop,
|
|
1275
|
-
titleOffset + chart.options.title.margin + spacing[0]
|
|
1276
|
-
);
|
|
1024
|
+
chart.plotTop = Math.max(chart.plotTop, titleOffset + chart.options.title.margin + spacing[0]);
|
|
1277
1025
|
}
|
|
1278
|
-
|
|
1279
1026
|
// Adjust for legend
|
|
1280
1027
|
if (chart.legend && chart.legend.display) {
|
|
1281
1028
|
chart.legend.adjustMargins(margin, spacing);
|
|
1282
1029
|
}
|
|
1283
|
-
|
|
1284
1030
|
fireEvent(this, 'getMargins');
|
|
1285
|
-
|
|
1286
1031
|
if (!skipAxes) {
|
|
1287
1032
|
this.getAxisMargins();
|
|
1288
1033
|
}
|
|
1289
1034
|
},
|
|
1290
|
-
|
|
1291
1035
|
/**
|
|
1292
1036
|
* @private
|
|
1293
1037
|
* @function Highcharts.Chart#getAxisMargins
|
|
1038
|
+
* @return {void}
|
|
1294
1039
|
*/
|
|
1295
1040
|
getAxisMargins: function () {
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
axisOffset = chart.axisOffset = [0, 0, 0, 0],
|
|
1300
|
-
margin = chart.margin;
|
|
1301
|
-
|
|
1041
|
+
var chart = this,
|
|
1042
|
+
// [top, right, bottom, left]
|
|
1043
|
+
axisOffset = chart.axisOffset = [0, 0, 0, 0], margin = chart.margin;
|
|
1302
1044
|
// pre-render axes to get labels offset width
|
|
1303
1045
|
if (chart.hasCartesianSeries) {
|
|
1304
1046
|
chart.axes.forEach(function (axis) {
|
|
@@ -1307,18 +1049,14 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1307
1049
|
}
|
|
1308
1050
|
});
|
|
1309
1051
|
}
|
|
1310
|
-
|
|
1311
1052
|
// Add the axis offsets
|
|
1312
1053
|
marginNames.forEach(function (m, side) {
|
|
1313
1054
|
if (!defined(margin[side])) {
|
|
1314
1055
|
chart[m] += axisOffset[side];
|
|
1315
1056
|
}
|
|
1316
1057
|
});
|
|
1317
|
-
|
|
1318
1058
|
chart.setChartSize();
|
|
1319
|
-
|
|
1320
1059
|
},
|
|
1321
|
-
|
|
1322
1060
|
/**
|
|
1323
1061
|
* Reflows the chart to its container. By default, the chart reflows
|
|
1324
1062
|
* automatically to its container following a `window.resize` event, as per
|
|
@@ -1339,30 +1077,17 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1339
1077
|
* internally as a response to window resize.
|
|
1340
1078
|
*/
|
|
1341
1079
|
reflow: function (e) {
|
|
1342
|
-
var chart = this,
|
|
1343
|
-
optionsChart =
|
|
1344
|
-
renderTo = chart.renderTo,
|
|
1345
|
-
hasUserSize = (
|
|
1346
|
-
defined(optionsChart.width) &&
|
|
1347
|
-
defined(optionsChart.height)
|
|
1348
|
-
),
|
|
1349
|
-
width = optionsChart.width || H.getStyle(renderTo, 'width'),
|
|
1350
|
-
height = optionsChart.height || H.getStyle(renderTo, 'height'),
|
|
1351
|
-
target = e ? e.target : win;
|
|
1352
|
-
|
|
1080
|
+
var chart = this, optionsChart = chart.options.chart, renderTo = chart.renderTo, hasUserSize = (defined(optionsChart.width) &&
|
|
1081
|
+
defined(optionsChart.height)), width = optionsChart.width || H.getStyle(renderTo, 'width'), height = optionsChart.height || H.getStyle(renderTo, 'height'), target = e ? e.target : win;
|
|
1353
1082
|
// Width and height checks for display:none. Target is doc in IE8 and
|
|
1354
1083
|
// Opera, win in Firefox, Chrome and IE9.
|
|
1355
|
-
if (
|
|
1356
|
-
!hasUserSize &&
|
|
1084
|
+
if (!hasUserSize &&
|
|
1357
1085
|
!chart.isPrinting &&
|
|
1358
1086
|
width &&
|
|
1359
1087
|
height &&
|
|
1360
|
-
(target === win || target === doc)
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
width !== chart.containerWidth ||
|
|
1364
|
-
height !== chart.containerHeight
|
|
1365
|
-
) {
|
|
1088
|
+
(target === win || target === doc)) {
|
|
1089
|
+
if (width !== chart.containerWidth ||
|
|
1090
|
+
height !== chart.containerHeight) {
|
|
1366
1091
|
H.clearTimeout(chart.reflowTimeout);
|
|
1367
1092
|
// When called from window.resize, e is set, else it's called
|
|
1368
1093
|
// directly (#2224)
|
|
@@ -1378,32 +1103,27 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1378
1103
|
chart.containerHeight = height;
|
|
1379
1104
|
}
|
|
1380
1105
|
},
|
|
1381
|
-
|
|
1382
1106
|
/**
|
|
1383
1107
|
* Toggle the event handlers necessary for auto resizing, depending on the
|
|
1384
1108
|
* `chart.reflow` option.
|
|
1385
1109
|
*
|
|
1386
1110
|
* @private
|
|
1387
1111
|
* @function Highcharts.Chart#setReflow
|
|
1388
|
-
*
|
|
1389
|
-
* @
|
|
1112
|
+
* @param {boolean} [reflow]
|
|
1113
|
+
* @return {void}
|
|
1390
1114
|
*/
|
|
1391
1115
|
setReflow: function (reflow) {
|
|
1392
|
-
|
|
1393
1116
|
var chart = this;
|
|
1394
|
-
|
|
1395
1117
|
if (reflow !== false && !this.unbindReflow) {
|
|
1396
1118
|
this.unbindReflow = addEvent(win, 'resize', function (e) {
|
|
1397
1119
|
chart.reflow(e);
|
|
1398
1120
|
});
|
|
1399
1121
|
addEvent(this, 'destroy', this.unbindReflow);
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1122
|
+
}
|
|
1123
|
+
else if (reflow === false && this.unbindReflow) {
|
|
1403
1124
|
// Unbind and unset
|
|
1404
1125
|
this.unbindReflow = this.unbindReflow();
|
|
1405
1126
|
}
|
|
1406
|
-
|
|
1407
1127
|
// The following will add listeners to re-fit the chart before and after
|
|
1408
1128
|
// printing (#2284). However it only works in WebKit. Should have worked
|
|
1409
1129
|
// in Firefox, but not supported in IE.
|
|
@@ -1415,7 +1135,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1415
1135
|
}
|
|
1416
1136
|
//*/
|
|
1417
1137
|
},
|
|
1418
|
-
|
|
1419
1138
|
/**
|
|
1420
1139
|
* Resize the chart to a given width and height. In order to set the width
|
|
1421
1140
|
* only, the height argument may be skipped. To set the height only, pass
|
|
@@ -1441,23 +1160,20 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1441
1160
|
* be `undefined` in order to preserve the current value, or `null`
|
|
1442
1161
|
* in order to adapt to the height of the containing element.
|
|
1443
1162
|
*
|
|
1444
|
-
* @param {Highcharts.AnimationOptionsObject} [animation=true]
|
|
1163
|
+
* @param {boolean|Highcharts.AnimationOptionsObject} [animation=true]
|
|
1445
1164
|
* Whether and how to apply animation.
|
|
1446
1165
|
*
|
|
1166
|
+
* @return {void}
|
|
1167
|
+
*
|
|
1447
1168
|
* @fires Highcharts.Chart#event:endResize
|
|
1448
1169
|
* @fires Highcharts.Chart#event:resize
|
|
1449
1170
|
*/
|
|
1450
1171
|
setSize: function (width, height, animation) {
|
|
1451
|
-
var chart = this,
|
|
1452
|
-
renderer = chart.renderer,
|
|
1453
|
-
globalAnimation;
|
|
1454
|
-
|
|
1172
|
+
var chart = this, renderer = chart.renderer, globalAnimation;
|
|
1455
1173
|
// Handle the isResizing counter
|
|
1456
1174
|
chart.isResizing += 1;
|
|
1457
|
-
|
|
1458
1175
|
// set the animation for the current process
|
|
1459
1176
|
H.setAnimation(animation, chart);
|
|
1460
|
-
|
|
1461
1177
|
chart.oldChartHeight = chart.chartHeight;
|
|
1462
1178
|
chart.oldChartWidth = chart.chartWidth;
|
|
1463
1179
|
if (width !== undefined) {
|
|
@@ -1467,7 +1183,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1467
1183
|
chart.options.chart.height = height;
|
|
1468
1184
|
}
|
|
1469
1185
|
chart.getChartSize();
|
|
1470
|
-
|
|
1471
1186
|
// Resize the container with the global animation applied if enabled
|
|
1472
1187
|
// (#2503)
|
|
1473
1188
|
if (!chart.styledMode) {
|
|
@@ -1477,28 +1192,20 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1477
1192
|
height: chart.chartHeight + 'px'
|
|
1478
1193
|
}, globalAnimation);
|
|
1479
1194
|
}
|
|
1480
|
-
|
|
1481
1195
|
chart.setChartSize(true);
|
|
1482
1196
|
renderer.setSize(chart.chartWidth, chart.chartHeight, animation);
|
|
1483
|
-
|
|
1484
1197
|
// handle axes
|
|
1485
1198
|
chart.axes.forEach(function (axis) {
|
|
1486
1199
|
axis.isDirty = true;
|
|
1487
1200
|
axis.setScale();
|
|
1488
1201
|
});
|
|
1489
|
-
|
|
1490
1202
|
chart.isDirtyLegend = true; // force legend redraw
|
|
1491
1203
|
chart.isDirtyBox = true; // force redraw of plot and chart border
|
|
1492
|
-
|
|
1493
1204
|
chart.layOutTitles(); // #2857
|
|
1494
1205
|
chart.getMargins();
|
|
1495
|
-
|
|
1496
1206
|
chart.redraw(animation);
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
1207
|
chart.oldChartHeight = null;
|
|
1500
1208
|
fireEvent(chart, 'resize');
|
|
1501
|
-
|
|
1502
1209
|
// Fire endResize and set isResizing back. If animation is disabled,
|
|
1503
1210
|
// fire without delay
|
|
1504
1211
|
syncTimeout(function () {
|
|
@@ -1509,7 +1216,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1509
1216
|
}
|
|
1510
1217
|
}, animObject(globalAnimation).duration);
|
|
1511
1218
|
},
|
|
1512
|
-
|
|
1513
1219
|
/**
|
|
1514
1220
|
* Set the public chart properties. This is done before and after the
|
|
1515
1221
|
* pre-render to determine margin sizes.
|
|
@@ -1519,25 +1225,12 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1519
1225
|
*
|
|
1520
1226
|
* @param {boolean} skipAxes
|
|
1521
1227
|
*
|
|
1228
|
+
* @return {void}
|
|
1229
|
+
*
|
|
1522
1230
|
* @fires Highcharts.Chart#event:afterSetChartSize
|
|
1523
1231
|
*/
|
|
1524
1232
|
setChartSize: function (skipAxes) {
|
|
1525
|
-
var chart = this,
|
|
1526
|
-
inverted = chart.inverted,
|
|
1527
|
-
renderer = chart.renderer,
|
|
1528
|
-
chartWidth = chart.chartWidth,
|
|
1529
|
-
chartHeight = chart.chartHeight,
|
|
1530
|
-
optionsChart = chart.options.chart,
|
|
1531
|
-
spacing = chart.spacing,
|
|
1532
|
-
clipOffset = chart.clipOffset,
|
|
1533
|
-
clipX,
|
|
1534
|
-
clipY,
|
|
1535
|
-
plotLeft,
|
|
1536
|
-
plotTop,
|
|
1537
|
-
plotWidth,
|
|
1538
|
-
plotHeight,
|
|
1539
|
-
plotBorderWidth;
|
|
1540
|
-
|
|
1233
|
+
var chart = this, inverted = chart.inverted, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, optionsChart = chart.options.chart, spacing = chart.spacing, clipOffset = chart.clipOffset, clipX, clipY, plotLeft, plotTop, plotWidth, plotHeight, plotBorderWidth;
|
|
1541
1234
|
/**
|
|
1542
1235
|
* The current left position of the plot area in pixels.
|
|
1543
1236
|
*
|
|
@@ -1545,7 +1238,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1545
1238
|
* @type {number}
|
|
1546
1239
|
*/
|
|
1547
1240
|
chart.plotLeft = plotLeft = Math.round(chart.plotLeft);
|
|
1548
|
-
|
|
1549
1241
|
/**
|
|
1550
1242
|
* The current top position of the plot area in pixels.
|
|
1551
1243
|
*
|
|
@@ -1553,34 +1245,23 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1553
1245
|
* @type {number}
|
|
1554
1246
|
*/
|
|
1555
1247
|
chart.plotTop = plotTop = Math.round(chart.plotTop);
|
|
1556
|
-
|
|
1557
1248
|
/**
|
|
1558
1249
|
* The current width of the plot area in pixels.
|
|
1559
1250
|
*
|
|
1560
1251
|
* @name Highcharts.Chart#plotWidth
|
|
1561
1252
|
* @type {number}
|
|
1562
1253
|
*/
|
|
1563
|
-
chart.plotWidth = plotWidth = Math.max(
|
|
1564
|
-
0,
|
|
1565
|
-
Math.round(chartWidth - plotLeft - chart.marginRight)
|
|
1566
|
-
);
|
|
1567
|
-
|
|
1254
|
+
chart.plotWidth = plotWidth = Math.max(0, Math.round(chartWidth - plotLeft - chart.marginRight));
|
|
1568
1255
|
/**
|
|
1569
1256
|
* The current height of the plot area in pixels.
|
|
1570
1257
|
*
|
|
1571
1258
|
* @name Highcharts.Chart#plotHeight
|
|
1572
1259
|
* @type {number}
|
|
1573
1260
|
*/
|
|
1574
|
-
chart.plotHeight = plotHeight = Math.max(
|
|
1575
|
-
0,
|
|
1576
|
-
Math.round(chartHeight - plotTop - chart.marginBottom)
|
|
1577
|
-
);
|
|
1578
|
-
|
|
1261
|
+
chart.plotHeight = plotHeight = Math.max(0, Math.round(chartHeight - plotTop - chart.marginBottom));
|
|
1579
1262
|
chart.plotSizeX = inverted ? plotHeight : plotWidth;
|
|
1580
1263
|
chart.plotSizeY = inverted ? plotWidth : plotHeight;
|
|
1581
|
-
|
|
1582
1264
|
chart.plotBorderWidth = optionsChart.plotBorderWidth || 0;
|
|
1583
|
-
|
|
1584
1265
|
// Set boxes used for alignment
|
|
1585
1266
|
chart.spacingBox = renderer.spacingBox = {
|
|
1586
1267
|
x: spacing[3],
|
|
@@ -1594,69 +1275,49 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1594
1275
|
width: plotWidth,
|
|
1595
1276
|
height: plotHeight
|
|
1596
1277
|
};
|
|
1597
|
-
|
|
1598
1278
|
plotBorderWidth = 2 * Math.floor(chart.plotBorderWidth / 2);
|
|
1599
1279
|
clipX = Math.ceil(Math.max(plotBorderWidth, clipOffset[3]) / 2);
|
|
1600
1280
|
clipY = Math.ceil(Math.max(plotBorderWidth, clipOffset[0]) / 2);
|
|
1601
1281
|
chart.clipBox = {
|
|
1602
1282
|
x: clipX,
|
|
1603
1283
|
y: clipY,
|
|
1604
|
-
width: Math.floor(
|
|
1605
|
-
chart.plotSizeX -
|
|
1284
|
+
width: Math.floor(chart.plotSizeX -
|
|
1606
1285
|
Math.max(plotBorderWidth, clipOffset[1]) / 2 -
|
|
1607
|
-
clipX
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
Math.floor(
|
|
1612
|
-
chart.plotSizeY -
|
|
1613
|
-
Math.max(plotBorderWidth, clipOffset[2]) / 2 -
|
|
1614
|
-
clipY
|
|
1615
|
-
)
|
|
1616
|
-
)
|
|
1286
|
+
clipX),
|
|
1287
|
+
height: Math.max(0, Math.floor(chart.plotSizeY -
|
|
1288
|
+
Math.max(plotBorderWidth, clipOffset[2]) / 2 -
|
|
1289
|
+
clipY))
|
|
1617
1290
|
};
|
|
1618
|
-
|
|
1619
1291
|
if (!skipAxes) {
|
|
1620
1292
|
chart.axes.forEach(function (axis) {
|
|
1621
1293
|
axis.setAxisSize();
|
|
1622
1294
|
axis.setAxisTranslation();
|
|
1623
1295
|
});
|
|
1624
1296
|
}
|
|
1625
|
-
|
|
1626
1297
|
fireEvent(chart, 'afterSetChartSize', { skipAxes: skipAxes });
|
|
1627
1298
|
},
|
|
1628
|
-
|
|
1629
1299
|
/**
|
|
1630
1300
|
* Initial margins before auto size margins are applied.
|
|
1631
1301
|
*
|
|
1632
1302
|
* @private
|
|
1633
1303
|
* @function Highcharts.Chart#resetMargins
|
|
1304
|
+
* @return {void}
|
|
1634
1305
|
*/
|
|
1635
1306
|
resetMargins: function () {
|
|
1636
|
-
|
|
1637
1307
|
fireEvent(this, 'resetMargins');
|
|
1638
|
-
|
|
1639
|
-
var chart = this,
|
|
1640
|
-
chartOptions = chart.options.chart;
|
|
1641
|
-
|
|
1308
|
+
var chart = this, chartOptions = chart.options.chart;
|
|
1642
1309
|
// Create margin and spacing array
|
|
1643
1310
|
['margin', 'spacing'].forEach(function splashArrays(target) {
|
|
1644
|
-
var value = chartOptions[target],
|
|
1645
|
-
values = isObject(value) ? value : [value, value, value, value];
|
|
1646
|
-
|
|
1311
|
+
var value = chartOptions[target], values = isObject(value) ? value : [value, value, value, value];
|
|
1647
1312
|
[
|
|
1648
1313
|
'Top',
|
|
1649
1314
|
'Right',
|
|
1650
1315
|
'Bottom',
|
|
1651
1316
|
'Left'
|
|
1652
1317
|
].forEach(function (sideName, side) {
|
|
1653
|
-
chart[target][side] = pick(
|
|
1654
|
-
chartOptions[target + sideName],
|
|
1655
|
-
values[side]
|
|
1656
|
-
);
|
|
1318
|
+
chart[target][side] = pick(chartOptions[target + sideName], values[side]);
|
|
1657
1319
|
});
|
|
1658
1320
|
});
|
|
1659
|
-
|
|
1660
1321
|
// Set margin names like chart.plotTop, chart.plotLeft,
|
|
1661
1322
|
// chart.marginRight, chart.marginBottom.
|
|
1662
1323
|
marginNames.forEach(function (m, side) {
|
|
@@ -1665,42 +1326,17 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1665
1326
|
chart.axisOffset = [0, 0, 0, 0]; // top, right, bottom, left
|
|
1666
1327
|
chart.clipOffset = [0, 0, 0, 0];
|
|
1667
1328
|
},
|
|
1668
|
-
|
|
1669
1329
|
/**
|
|
1670
1330
|
* Internal function to draw or redraw the borders and backgrounds for chart
|
|
1671
1331
|
* and plot area.
|
|
1672
1332
|
*
|
|
1673
1333
|
* @private
|
|
1674
1334
|
* @function Highcharts.Chart#drawChartBox
|
|
1675
|
-
*
|
|
1335
|
+
* @return {void}
|
|
1676
1336
|
* @fires Highcharts.Chart#event:afterDrawChartBox
|
|
1677
1337
|
*/
|
|
1678
1338
|
drawChartBox: function () {
|
|
1679
|
-
var chart = this,
|
|
1680
|
-
optionsChart = chart.options.chart,
|
|
1681
|
-
renderer = chart.renderer,
|
|
1682
|
-
chartWidth = chart.chartWidth,
|
|
1683
|
-
chartHeight = chart.chartHeight,
|
|
1684
|
-
chartBackground = chart.chartBackground,
|
|
1685
|
-
plotBackground = chart.plotBackground,
|
|
1686
|
-
plotBorder = chart.plotBorder,
|
|
1687
|
-
chartBorderWidth,
|
|
1688
|
-
styledMode = chart.styledMode,
|
|
1689
|
-
plotBGImage = chart.plotBGImage,
|
|
1690
|
-
chartBackgroundColor = optionsChart.backgroundColor,
|
|
1691
|
-
plotBackgroundColor = optionsChart.plotBackgroundColor,
|
|
1692
|
-
plotBackgroundImage = optionsChart.plotBackgroundImage,
|
|
1693
|
-
mgn,
|
|
1694
|
-
bgAttr,
|
|
1695
|
-
plotLeft = chart.plotLeft,
|
|
1696
|
-
plotTop = chart.plotTop,
|
|
1697
|
-
plotWidth = chart.plotWidth,
|
|
1698
|
-
plotHeight = chart.plotHeight,
|
|
1699
|
-
plotBox = chart.plotBox,
|
|
1700
|
-
clipRect = chart.clipRect,
|
|
1701
|
-
clipBox = chart.clipBox,
|
|
1702
|
-
verb = 'animate';
|
|
1703
|
-
|
|
1339
|
+
var chart = this, optionsChart = chart.options.chart, renderer = chart.renderer, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, chartBackground = chart.chartBackground, plotBackground = chart.plotBackground, plotBorder = chart.plotBorder, chartBorderWidth, styledMode = chart.styledMode, plotBGImage = chart.plotBGImage, chartBackgroundColor = optionsChart.backgroundColor, plotBackgroundColor = optionsChart.plotBackgroundColor, plotBackgroundImage = optionsChart.plotBackgroundImage, mgn, bgAttr, plotLeft = chart.plotLeft, plotTop = chart.plotTop, plotWidth = chart.plotWidth, plotHeight = chart.plotHeight, plotBox = chart.plotBox, clipRect = chart.clipRect, clipBox = chart.clipBox, verb = 'animate';
|
|
1704
1340
|
// Chart area
|
|
1705
1341
|
if (!chartBackground) {
|
|
1706
1342
|
chart.chartBackground = chartBackground = renderer.rect()
|
|
@@ -1708,16 +1344,13 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1708
1344
|
.add();
|
|
1709
1345
|
verb = 'attr';
|
|
1710
1346
|
}
|
|
1711
|
-
|
|
1712
1347
|
if (!styledMode) {
|
|
1713
1348
|
// Presentational
|
|
1714
1349
|
chartBorderWidth = optionsChart.borderWidth || 0;
|
|
1715
1350
|
mgn = chartBorderWidth + (optionsChart.shadow ? 8 : 0);
|
|
1716
|
-
|
|
1717
1351
|
bgAttr = {
|
|
1718
1352
|
fill: chartBackgroundColor || 'none'
|
|
1719
1353
|
};
|
|
1720
|
-
|
|
1721
1354
|
if (chartBorderWidth || chartBackground['stroke-width']) { // #980
|
|
1722
1355
|
bgAttr.stroke = optionsChart.borderColor;
|
|
1723
1356
|
bgAttr['stroke-width'] = chartBorderWidth;
|
|
@@ -1725,11 +1358,10 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1725
1358
|
chartBackground
|
|
1726
1359
|
.attr(bgAttr)
|
|
1727
1360
|
.shadow(optionsChart.shadow);
|
|
1728
|
-
}
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1729
1363
|
chartBorderWidth = mgn = chartBackground.strokeWidth();
|
|
1730
1364
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
1365
|
chartBackground[verb]({
|
|
1734
1366
|
x: mgn / 2,
|
|
1735
1367
|
y: mgn / 2,
|
|
@@ -1737,7 +1369,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1737
1369
|
height: chartHeight - mgn - chartBorderWidth % 2,
|
|
1738
1370
|
r: optionsChart.borderRadius
|
|
1739
1371
|
});
|
|
1740
|
-
|
|
1741
1372
|
// Plot background
|
|
1742
1373
|
verb = 'animate';
|
|
1743
1374
|
if (!plotBackground) {
|
|
@@ -1747,41 +1378,33 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1747
1378
|
.add();
|
|
1748
1379
|
}
|
|
1749
1380
|
plotBackground[verb](plotBox);
|
|
1750
|
-
|
|
1751
1381
|
if (!styledMode) {
|
|
1752
1382
|
// Presentational attributes for the background
|
|
1753
1383
|
plotBackground
|
|
1754
1384
|
.attr({
|
|
1755
|
-
|
|
1756
|
-
|
|
1385
|
+
fill: plotBackgroundColor || 'none'
|
|
1386
|
+
})
|
|
1757
1387
|
.shadow(optionsChart.plotShadow);
|
|
1758
|
-
|
|
1759
1388
|
// Create the background image
|
|
1760
1389
|
if (plotBackgroundImage) {
|
|
1761
1390
|
if (!plotBGImage) {
|
|
1762
|
-
chart.plotBGImage = renderer.image(
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
plotTop,
|
|
1766
|
-
plotWidth,
|
|
1767
|
-
plotHeight
|
|
1768
|
-
).add();
|
|
1769
|
-
} else {
|
|
1391
|
+
chart.plotBGImage = renderer.image(plotBackgroundImage, plotLeft, plotTop, plotWidth, plotHeight).add();
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1770
1394
|
plotBGImage.animate(plotBox);
|
|
1771
1395
|
}
|
|
1772
1396
|
}
|
|
1773
1397
|
}
|
|
1774
|
-
|
|
1775
1398
|
// Plot clip
|
|
1776
1399
|
if (!clipRect) {
|
|
1777
1400
|
chart.clipRect = renderer.clipRect(clipBox);
|
|
1778
|
-
}
|
|
1401
|
+
}
|
|
1402
|
+
else {
|
|
1779
1403
|
clipRect.animate({
|
|
1780
1404
|
width: clipBox.width,
|
|
1781
1405
|
height: clipBox.height
|
|
1782
1406
|
});
|
|
1783
1407
|
}
|
|
1784
|
-
|
|
1785
1408
|
// Plot area border
|
|
1786
1409
|
verb = 'animate';
|
|
1787
1410
|
if (!plotBorder) {
|
|
@@ -1789,11 +1412,10 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1789
1412
|
chart.plotBorder = plotBorder = renderer.rect()
|
|
1790
1413
|
.addClass('highcharts-plot-border')
|
|
1791
1414
|
.attr({
|
|
1792
|
-
|
|
1793
|
-
|
|
1415
|
+
zIndex: 1 // Above the grid
|
|
1416
|
+
})
|
|
1794
1417
|
.add();
|
|
1795
1418
|
}
|
|
1796
|
-
|
|
1797
1419
|
if (!styledMode) {
|
|
1798
1420
|
// Presentational
|
|
1799
1421
|
plotBorder.attr({
|
|
@@ -1802,20 +1424,16 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1802
1424
|
fill: 'none'
|
|
1803
1425
|
});
|
|
1804
1426
|
}
|
|
1805
|
-
|
|
1806
1427
|
plotBorder[verb](plotBorder.crisp({
|
|
1807
1428
|
x: plotLeft,
|
|
1808
1429
|
y: plotTop,
|
|
1809
1430
|
width: plotWidth,
|
|
1810
1431
|
height: plotHeight
|
|
1811
1432
|
}, -plotBorder.strokeWidth())); // #3282 plotBorder should be negative;
|
|
1812
|
-
|
|
1813
1433
|
// reset
|
|
1814
1434
|
chart.isDirtyBox = false;
|
|
1815
|
-
|
|
1816
1435
|
fireEvent(this, 'afterDrawChartBox');
|
|
1817
1436
|
},
|
|
1818
|
-
|
|
1819
1437
|
/**
|
|
1820
1438
|
* Detect whether a certain chart property is needed based on inspecting its
|
|
1821
1439
|
* options and series. This mainly applies to the chart.inverted property,
|
|
@@ -1823,15 +1441,10 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1823
1441
|
*
|
|
1824
1442
|
* @private
|
|
1825
1443
|
* @function Highcharts.Chart#propFromSeries
|
|
1444
|
+
* @return {void}
|
|
1826
1445
|
*/
|
|
1827
1446
|
propFromSeries: function () {
|
|
1828
|
-
var chart = this,
|
|
1829
|
-
optionsChart = chart.options.chart,
|
|
1830
|
-
klass,
|
|
1831
|
-
seriesOptions = chart.options.series,
|
|
1832
|
-
i,
|
|
1833
|
-
value;
|
|
1834
|
-
|
|
1447
|
+
var chart = this, optionsChart = chart.options.chart, klass, seriesOptions = chart.options.series, i, value;
|
|
1835
1448
|
/**
|
|
1836
1449
|
* The flag is set to `true` if a series of the chart is inverted.
|
|
1837
1450
|
*
|
|
@@ -1839,17 +1452,14 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1839
1452
|
* @type {boolean|undefined}
|
|
1840
1453
|
*/
|
|
1841
1454
|
['inverted', 'angular', 'polar'].forEach(function (key) {
|
|
1842
|
-
|
|
1843
1455
|
// The default series type's class
|
|
1844
|
-
klass = seriesTypes[optionsChart.type ||
|
|
1845
|
-
optionsChart.defaultSeriesType];
|
|
1846
|
-
|
|
1456
|
+
klass = seriesTypes[(optionsChart.type ||
|
|
1457
|
+
optionsChart.defaultSeriesType)];
|
|
1847
1458
|
// Get the value from available chart-wide properties
|
|
1848
1459
|
value =
|
|
1849
1460
|
optionsChart[key] || // It is set in the options
|
|
1850
|
-
|
|
1461
|
+
(klass && klass.prototype[key]); // The default series class
|
|
1851
1462
|
// requires it
|
|
1852
|
-
|
|
1853
1463
|
// 4. Check if any the chart's series require it
|
|
1854
1464
|
i = seriesOptions && seriesOptions.length;
|
|
1855
1465
|
while (!value && i--) {
|
|
@@ -1858,13 +1468,10 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1858
1468
|
value = true;
|
|
1859
1469
|
}
|
|
1860
1470
|
}
|
|
1861
|
-
|
|
1862
1471
|
// Set the chart property
|
|
1863
1472
|
chart[key] = value;
|
|
1864
1473
|
});
|
|
1865
|
-
|
|
1866
1474
|
},
|
|
1867
|
-
|
|
1868
1475
|
/**
|
|
1869
1476
|
* Internal function to link two or more series together, based on the
|
|
1870
1477
|
* `linkedTo` option. This is done from `Chart.render`, and after
|
|
@@ -1872,49 +1479,41 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1872
1479
|
*
|
|
1873
1480
|
* @private
|
|
1874
1481
|
* @function Highcharts.Chart#linkSeries
|
|
1875
|
-
*
|
|
1482
|
+
* @return {void}
|
|
1876
1483
|
* @fires Highcharts.Chart#event:afterLinkSeries
|
|
1877
1484
|
*/
|
|
1878
1485
|
linkSeries: function () {
|
|
1879
|
-
var chart = this,
|
|
1880
|
-
chartSeries = chart.series;
|
|
1881
|
-
|
|
1486
|
+
var chart = this, chartSeries = chart.series;
|
|
1882
1487
|
// Reset links
|
|
1883
1488
|
chartSeries.forEach(function (series) {
|
|
1884
1489
|
series.linkedSeries.length = 0;
|
|
1885
1490
|
});
|
|
1886
|
-
|
|
1887
1491
|
// Apply new links
|
|
1888
1492
|
chartSeries.forEach(function (series) {
|
|
1889
1493
|
var linkedTo = series.options.linkedTo;
|
|
1890
|
-
|
|
1891
1494
|
if (isString(linkedTo)) {
|
|
1892
1495
|
if (linkedTo === ':previous') {
|
|
1893
1496
|
linkedTo = chart.series[series.index - 1];
|
|
1894
|
-
}
|
|
1497
|
+
}
|
|
1498
|
+
else {
|
|
1895
1499
|
linkedTo = chart.get(linkedTo);
|
|
1896
1500
|
}
|
|
1897
1501
|
// #3341 avoid mutual linking
|
|
1898
1502
|
if (linkedTo && linkedTo.linkedParent !== series) {
|
|
1899
1503
|
linkedTo.linkedSeries.push(series);
|
|
1900
1504
|
series.linkedParent = linkedTo;
|
|
1901
|
-
series.visible = pick(
|
|
1902
|
-
series.options.visible,
|
|
1903
|
-
linkedTo.options.visible,
|
|
1904
|
-
series.visible
|
|
1905
|
-
); // #3879
|
|
1505
|
+
series.visible = pick(series.options.visible, linkedTo.options.visible, series.visible); // #3879
|
|
1906
1506
|
}
|
|
1907
1507
|
}
|
|
1908
1508
|
});
|
|
1909
|
-
|
|
1910
1509
|
fireEvent(this, 'afterLinkSeries');
|
|
1911
1510
|
},
|
|
1912
|
-
|
|
1913
1511
|
/**
|
|
1914
1512
|
* Render series for the chart.
|
|
1915
1513
|
*
|
|
1916
1514
|
* @private
|
|
1917
1515
|
* @function Highcharts.Chart#renderSeries
|
|
1516
|
+
* @return {void}
|
|
1918
1517
|
*/
|
|
1919
1518
|
renderSeries: function () {
|
|
1920
1519
|
this.series.forEach(function (serie) {
|
|
@@ -1922,60 +1521,40 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1922
1521
|
serie.render();
|
|
1923
1522
|
});
|
|
1924
1523
|
},
|
|
1925
|
-
|
|
1926
1524
|
/**
|
|
1927
1525
|
* Render labels for the chart.
|
|
1928
1526
|
*
|
|
1929
1527
|
* @private
|
|
1930
1528
|
* @function Highcharts.Chart#renderLabels
|
|
1529
|
+
* @return {void}
|
|
1931
1530
|
*/
|
|
1932
1531
|
renderLabels: function () {
|
|
1933
|
-
var chart = this,
|
|
1934
|
-
labels = chart.options.labels;
|
|
1935
|
-
|
|
1532
|
+
var chart = this, labels = chart.options.labels;
|
|
1936
1533
|
if (labels.items) {
|
|
1937
1534
|
labels.items.forEach(function (label) {
|
|
1938
|
-
var style = extend(labels.style, label.style),
|
|
1939
|
-
x = pInt(style.left) + chart.plotLeft,
|
|
1940
|
-
y = pInt(style.top) + chart.plotTop + 12;
|
|
1941
|
-
|
|
1535
|
+
var style = extend(labels.style, label.style), x = pInt(style.left) + chart.plotLeft, y = pInt(style.top) + chart.plotTop + 12;
|
|
1942
1536
|
// delete to prevent rewriting in IE
|
|
1943
1537
|
delete style.left;
|
|
1944
1538
|
delete style.top;
|
|
1945
|
-
|
|
1946
|
-
chart.renderer.text(
|
|
1947
|
-
label.html,
|
|
1948
|
-
x,
|
|
1949
|
-
y
|
|
1950
|
-
)
|
|
1539
|
+
chart.renderer.text(label.html, x, y)
|
|
1951
1540
|
.attr({ zIndex: 2 })
|
|
1952
1541
|
.css(style)
|
|
1953
1542
|
.add();
|
|
1954
|
-
|
|
1955
1543
|
});
|
|
1956
1544
|
}
|
|
1957
1545
|
},
|
|
1958
|
-
|
|
1959
1546
|
/**
|
|
1960
1547
|
* Render all graphics for the chart. Runs internally on initialization.
|
|
1961
1548
|
*
|
|
1962
1549
|
* @private
|
|
1963
1550
|
* @function Highcharts.Chart#render
|
|
1551
|
+
* @return {void}
|
|
1964
1552
|
*/
|
|
1965
1553
|
render: function () {
|
|
1966
|
-
var chart = this,
|
|
1967
|
-
|
|
1968
|
-
renderer = chart.renderer,
|
|
1969
|
-
options = chart.options,
|
|
1970
|
-
correction = 0, // correction for X axis labels
|
|
1971
|
-
tempWidth,
|
|
1972
|
-
tempHeight,
|
|
1973
|
-
redoHorizontal,
|
|
1974
|
-
redoVertical;
|
|
1975
|
-
|
|
1554
|
+
var chart = this, axes = chart.axes, renderer = chart.renderer, options = chart.options, correction = 0, // correction for X axis labels
|
|
1555
|
+
tempWidth, tempHeight, redoHorizontal, redoVertical;
|
|
1976
1556
|
// Title
|
|
1977
1557
|
chart.setTitle();
|
|
1978
|
-
|
|
1979
1558
|
/**
|
|
1980
1559
|
* The overview of the chart's series.
|
|
1981
1560
|
*
|
|
@@ -1983,66 +1562,50 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
1983
1562
|
* @type {Highcharts.Legend}
|
|
1984
1563
|
*/
|
|
1985
1564
|
chart.legend = new Legend(chart, options.legend);
|
|
1986
|
-
|
|
1987
1565
|
// Get stacks
|
|
1988
1566
|
if (chart.getStacks) {
|
|
1989
1567
|
chart.getStacks();
|
|
1990
1568
|
}
|
|
1991
|
-
|
|
1992
1569
|
// Get chart margins
|
|
1993
1570
|
chart.getMargins(true);
|
|
1994
1571
|
chart.setChartSize();
|
|
1995
|
-
|
|
1996
1572
|
// Record preliminary dimensions for later comparison
|
|
1997
1573
|
tempWidth = chart.plotWidth;
|
|
1998
|
-
|
|
1999
1574
|
axes.some(function (axis) {
|
|
2000
|
-
if (
|
|
2001
|
-
axis.horiz &&
|
|
1575
|
+
if (axis.horiz &&
|
|
2002
1576
|
axis.visible &&
|
|
2003
1577
|
axis.options.labels.enabled &&
|
|
2004
|
-
axis.series.length
|
|
2005
|
-
) {
|
|
1578
|
+
axis.series.length) {
|
|
2006
1579
|
// 21 is the most common correction for X axis labels
|
|
2007
1580
|
correction = 21;
|
|
2008
1581
|
return true;
|
|
2009
1582
|
}
|
|
2010
1583
|
});
|
|
2011
|
-
|
|
2012
1584
|
// use Math.max to prevent negative plotHeight
|
|
2013
1585
|
chart.plotHeight = Math.max(chart.plotHeight - correction, 0);
|
|
2014
1586
|
tempHeight = chart.plotHeight;
|
|
2015
|
-
|
|
2016
1587
|
// Get margins by pre-rendering axes
|
|
2017
1588
|
axes.forEach(function (axis) {
|
|
2018
1589
|
axis.setScale();
|
|
2019
1590
|
});
|
|
2020
1591
|
chart.getAxisMargins();
|
|
2021
|
-
|
|
2022
1592
|
// If the plot area size has changed significantly, calculate tick
|
|
2023
1593
|
// positions again
|
|
2024
1594
|
redoHorizontal = tempWidth / chart.plotWidth > 1.1;
|
|
2025
1595
|
// Height is more sensitive, use lower threshold
|
|
2026
1596
|
redoVertical = tempHeight / chart.plotHeight > 1.05;
|
|
2027
|
-
|
|
2028
1597
|
if (redoHorizontal || redoVertical) {
|
|
2029
|
-
|
|
2030
1598
|
axes.forEach(function (axis) {
|
|
2031
|
-
if (
|
|
2032
|
-
(axis.horiz &&
|
|
2033
|
-
(!axis.horiz && redoVertical)
|
|
2034
|
-
) {
|
|
1599
|
+
if ((axis.horiz && redoHorizontal) ||
|
|
1600
|
+
(!axis.horiz && redoVertical)) {
|
|
2035
1601
|
// update to reflect the new margins
|
|
2036
1602
|
axis.setTickInterval(true);
|
|
2037
1603
|
}
|
|
2038
1604
|
});
|
|
2039
1605
|
chart.getMargins(); // second pass to check for new labels
|
|
2040
1606
|
}
|
|
2041
|
-
|
|
2042
1607
|
// Draw the borders and backgrounds
|
|
2043
1608
|
chart.drawChartBox();
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
1609
|
// Axes
|
|
2047
1610
|
if (chart.hasCartesianSeries) {
|
|
2048
1611
|
axes.forEach(function (axis) {
|
|
@@ -2051,7 +1614,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2051
1614
|
}
|
|
2052
1615
|
});
|
|
2053
1616
|
}
|
|
2054
|
-
|
|
2055
1617
|
// The series
|
|
2056
1618
|
if (!chart.seriesGroup) {
|
|
2057
1619
|
chart.seriesGroup = renderer.g('series-group')
|
|
@@ -2059,23 +1621,17 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2059
1621
|
.add();
|
|
2060
1622
|
}
|
|
2061
1623
|
chart.renderSeries();
|
|
2062
|
-
|
|
2063
1624
|
// Labels
|
|
2064
1625
|
chart.renderLabels();
|
|
2065
|
-
|
|
2066
1626
|
// Credits
|
|
2067
1627
|
chart.addCredits();
|
|
2068
|
-
|
|
2069
1628
|
// Handle responsiveness
|
|
2070
1629
|
if (chart.setResponsive) {
|
|
2071
1630
|
chart.setResponsive();
|
|
2072
1631
|
}
|
|
2073
|
-
|
|
2074
1632
|
// Set flag
|
|
2075
1633
|
chart.hasRendered = true;
|
|
2076
|
-
|
|
2077
1634
|
},
|
|
2078
|
-
|
|
2079
1635
|
/**
|
|
2080
1636
|
* Set a new credits label for the chart.
|
|
2081
1637
|
*
|
|
@@ -2084,15 +1640,15 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2084
1640
|
*
|
|
2085
1641
|
* @function Highcharts.Chart#addCredits
|
|
2086
1642
|
*
|
|
2087
|
-
* @param {Highcharts.CreditsOptions}
|
|
1643
|
+
* @param {Highcharts.CreditsOptions} credits
|
|
2088
1644
|
* A configuration object for the new credits.
|
|
1645
|
+
*
|
|
1646
|
+
* @return {void}
|
|
2089
1647
|
*/
|
|
2090
1648
|
addCredits: function (credits) {
|
|
2091
1649
|
var chart = this;
|
|
2092
|
-
|
|
2093
1650
|
credits = merge(true, this.options.credits, credits);
|
|
2094
1651
|
if (credits.enabled && !this.credits) {
|
|
2095
|
-
|
|
2096
1652
|
/**
|
|
2097
1653
|
* The chart's credits label. The label has an `update` method that
|
|
2098
1654
|
* allows setting new options as per the
|
|
@@ -2101,31 +1657,23 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2101
1657
|
* @name Highcharts.Chart#credits
|
|
2102
1658
|
* @type {Highcharts.SVGElement}
|
|
2103
1659
|
*/
|
|
2104
|
-
this.credits = this.renderer.text(
|
|
2105
|
-
credits.text + (this.mapCredits || ''),
|
|
2106
|
-
0,
|
|
2107
|
-
0
|
|
2108
|
-
)
|
|
1660
|
+
this.credits = this.renderer.text(credits.text + (this.mapCredits || ''), 0, 0)
|
|
2109
1661
|
.addClass('highcharts-credits')
|
|
2110
1662
|
.on('click', function () {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
1663
|
+
if (credits.href) {
|
|
1664
|
+
win.location.href = credits.href;
|
|
1665
|
+
}
|
|
1666
|
+
})
|
|
2115
1667
|
.attr({
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
1668
|
+
align: credits.position.align,
|
|
1669
|
+
zIndex: 8
|
|
1670
|
+
});
|
|
2121
1671
|
if (!chart.styledMode) {
|
|
2122
1672
|
this.credits.css(credits.style);
|
|
2123
1673
|
}
|
|
2124
|
-
|
|
2125
1674
|
this.credits
|
|
2126
1675
|
.add()
|
|
2127
1676
|
.align(credits.position);
|
|
2128
|
-
|
|
2129
1677
|
// Dynamically update
|
|
2130
1678
|
this.credits.update = function (options) {
|
|
2131
1679
|
chart.credits = chart.credits.destroy();
|
|
@@ -2133,7 +1681,6 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2133
1681
|
};
|
|
2134
1682
|
}
|
|
2135
1683
|
},
|
|
2136
|
-
|
|
2137
1684
|
/**
|
|
2138
1685
|
* Remove the chart and purge memory. This method is called internally
|
|
2139
1686
|
* before adding a second chart into the same container, as well as on
|
|
@@ -2146,49 +1693,40 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2146
1693
|
*
|
|
2147
1694
|
* @function Highcharts.Chart#destroy
|
|
2148
1695
|
*
|
|
1696
|
+
* @return {void}
|
|
1697
|
+
*
|
|
2149
1698
|
* @fires Highcharts.Chart#event:destroy
|
|
2150
1699
|
*/
|
|
2151
1700
|
destroy: function () {
|
|
2152
|
-
var chart = this,
|
|
2153
|
-
axes = chart.axes,
|
|
2154
|
-
series = chart.series,
|
|
2155
|
-
container = chart.container,
|
|
2156
|
-
i,
|
|
2157
|
-
parentNode = container && container.parentNode;
|
|
2158
|
-
|
|
1701
|
+
var chart = this, axes = chart.axes, series = chart.series, container = chart.container, i, parentNode = container && container.parentNode;
|
|
2159
1702
|
// fire the chart.destoy event
|
|
2160
1703
|
fireEvent(chart, 'destroy');
|
|
2161
|
-
|
|
2162
1704
|
// Delete the chart from charts lookup array
|
|
2163
1705
|
if (chart.renderer.forExport) {
|
|
2164
1706
|
H.erase(charts, chart); // #6569
|
|
2165
|
-
}
|
|
1707
|
+
}
|
|
1708
|
+
else {
|
|
2166
1709
|
charts[chart.index] = undefined;
|
|
2167
1710
|
}
|
|
2168
1711
|
H.chartCount--;
|
|
2169
1712
|
chart.renderTo.removeAttribute('data-highcharts-chart');
|
|
2170
|
-
|
|
2171
1713
|
// remove events
|
|
2172
1714
|
removeEvent(chart);
|
|
2173
|
-
|
|
2174
1715
|
// ==== Destroy collections:
|
|
2175
1716
|
// Destroy axes
|
|
2176
1717
|
i = axes.length;
|
|
2177
1718
|
while (i--) {
|
|
2178
1719
|
axes[i] = axes[i].destroy();
|
|
2179
1720
|
}
|
|
2180
|
-
|
|
2181
1721
|
// Destroy scroller & scroller series before destroying base series
|
|
2182
1722
|
if (this.scroller && this.scroller.destroy) {
|
|
2183
1723
|
this.scroller.destroy();
|
|
2184
1724
|
}
|
|
2185
|
-
|
|
2186
1725
|
// Destroy each series
|
|
2187
1726
|
i = series.length;
|
|
2188
1727
|
while (i--) {
|
|
2189
1728
|
series[i] = series[i].destroy();
|
|
2190
1729
|
}
|
|
2191
|
-
|
|
2192
1730
|
// ==== Destroy chart properties:
|
|
2193
1731
|
[
|
|
2194
1732
|
'title', 'subtitle', 'chartBackground', 'plotBackground',
|
|
@@ -2197,12 +1735,10 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2197
1735
|
'renderer'
|
|
2198
1736
|
].forEach(function (name) {
|
|
2199
1737
|
var prop = chart[name];
|
|
2200
|
-
|
|
2201
1738
|
if (prop && prop.destroy) {
|
|
2202
1739
|
chart[name] = prop.destroy();
|
|
2203
1740
|
}
|
|
2204
1741
|
});
|
|
2205
|
-
|
|
2206
1742
|
// Remove container and all SVG, check container as it can break in IE
|
|
2207
1743
|
// when destroyed before finished loading
|
|
2208
1744
|
if (container) {
|
|
@@ -2211,63 +1747,49 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2211
1747
|
if (parentNode) {
|
|
2212
1748
|
discardElement(container);
|
|
2213
1749
|
}
|
|
2214
|
-
|
|
2215
1750
|
}
|
|
2216
|
-
|
|
2217
1751
|
// clean it all up
|
|
2218
1752
|
objectEach(chart, function (val, key) {
|
|
2219
1753
|
delete chart[key];
|
|
2220
1754
|
});
|
|
2221
|
-
|
|
2222
1755
|
},
|
|
2223
|
-
|
|
2224
1756
|
/**
|
|
2225
1757
|
* Prepare for first rendering after all data are loaded.
|
|
2226
1758
|
*
|
|
2227
1759
|
* @private
|
|
2228
1760
|
* @function Highcharts.Chart#firstRender
|
|
1761
|
+
* @return {void}
|
|
2229
1762
|
*
|
|
2230
1763
|
* @fires Highcharts.Chart#event:beforeRender
|
|
2231
1764
|
*/
|
|
2232
1765
|
firstRender: function () {
|
|
2233
|
-
var chart = this,
|
|
2234
|
-
options = chart.options;
|
|
2235
|
-
|
|
1766
|
+
var chart = this, options = chart.options;
|
|
2236
1767
|
// Hook for oldIE to check whether the chart is ready to render
|
|
2237
1768
|
if (chart.isReadyToRender && !chart.isReadyToRender()) {
|
|
2238
1769
|
return;
|
|
2239
1770
|
}
|
|
2240
|
-
|
|
2241
1771
|
// Create the container
|
|
2242
1772
|
chart.getContainer();
|
|
2243
|
-
|
|
2244
1773
|
chart.resetMargins();
|
|
2245
1774
|
chart.setChartSize();
|
|
2246
|
-
|
|
2247
1775
|
// Set the common chart properties (mainly invert) from the given series
|
|
2248
1776
|
chart.propFromSeries();
|
|
2249
|
-
|
|
2250
1777
|
// get axes
|
|
2251
1778
|
chart.getAxes();
|
|
2252
|
-
|
|
2253
1779
|
// Initialize the series
|
|
2254
|
-
(H.isArray(options.series) ? options.series : []).forEach(
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
);
|
|
2259
|
-
|
|
1780
|
+
(H.isArray(options.series) ? options.series : []).forEach(
|
|
1781
|
+
// #9680
|
|
1782
|
+
function (serieOptions) {
|
|
1783
|
+
chart.initSeries(serieOptions);
|
|
1784
|
+
});
|
|
2260
1785
|
chart.linkSeries();
|
|
2261
|
-
|
|
2262
1786
|
// Run an event after axes and series are initialized, but before
|
|
2263
1787
|
// render. At this stage, the series data is indexed and cached in the
|
|
2264
1788
|
// xData and yData arrays, so we can access those before rendering. Used
|
|
2265
1789
|
// in Highstock.
|
|
2266
1790
|
fireEvent(chart, 'beforeRender');
|
|
2267
|
-
|
|
2268
1791
|
// depends on inverted and on margins being set
|
|
2269
1792
|
if (Pointer) {
|
|
2270
|
-
|
|
2271
1793
|
/**
|
|
2272
1794
|
* The Pointer that keeps track of mouse and touch interaction.
|
|
2273
1795
|
*
|
|
@@ -2278,20 +1800,15 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2278
1800
|
*/
|
|
2279
1801
|
chart.pointer = new Pointer(chart, options);
|
|
2280
1802
|
}
|
|
2281
|
-
|
|
2282
1803
|
chart.render();
|
|
2283
|
-
|
|
2284
1804
|
// Fire the load event if there are no external images
|
|
2285
1805
|
if (!chart.renderer.imgCount && chart.onload) {
|
|
2286
1806
|
chart.onload();
|
|
2287
1807
|
}
|
|
2288
|
-
|
|
2289
1808
|
// If the chart was rendered outside the top container, put it back in
|
|
2290
1809
|
// (#3679)
|
|
2291
1810
|
chart.temporaryDisplay(true);
|
|
2292
|
-
|
|
2293
1811
|
},
|
|
2294
|
-
|
|
2295
1812
|
/**
|
|
2296
1813
|
* Internal function that runs on chart load, async if any images are loaded
|
|
2297
1814
|
* in the chart. Runs the callbacks and triggers the `load` and `render`
|
|
@@ -2299,31 +1816,25 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
|
|
|
2299
1816
|
*
|
|
2300
1817
|
* @private
|
|
2301
1818
|
* @function Highcharts.Chart#onload
|
|
2302
|
-
*
|
|
1819
|
+
* @return {void}
|
|
2303
1820
|
* @fires Highcharts.Chart#event:load
|
|
2304
1821
|
* @fires Highcharts.Chart#event:render
|
|
2305
1822
|
*/
|
|
2306
1823
|
onload: function () {
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
[this.callback].concat(this.callbacks).forEach(function (fn) {
|
|
1824
|
+
// Run callbacks, first the ones registered by modules, then user's one
|
|
1825
|
+
this.callbacks.concat([this.callback]).forEach(function (fn) {
|
|
2310
1826
|
// Chart destroyed in its own callback (#3600)
|
|
2311
1827
|
if (fn && this.index !== undefined) {
|
|
2312
1828
|
fn.apply(this, [this]);
|
|
2313
1829
|
}
|
|
2314
1830
|
}, this);
|
|
2315
|
-
|
|
2316
1831
|
fireEvent(this, 'load');
|
|
2317
1832
|
fireEvent(this, 'render');
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
1833
|
// Set up auto resize, check for not destroyed (#6068)
|
|
2321
1834
|
if (defined(this.index)) {
|
|
2322
1835
|
this.setReflow(this.options.chart.reflow);
|
|
2323
1836
|
}
|
|
2324
|
-
|
|
2325
1837
|
// Don't run again
|
|
2326
1838
|
this.onload = null;
|
|
2327
1839
|
}
|
|
2328
|
-
|
|
2329
1840
|
}); // end Chart
|