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
|
@@ -4,34 +4,46 @@
|
|
|
4
4
|
*
|
|
5
5
|
* License: www.highcharts.com/license
|
|
6
6
|
*
|
|
7
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
8
|
+
*
|
|
7
9
|
* */
|
|
8
|
-
|
|
10
|
+
'use strict';
|
|
11
|
+
import H from './Globals.js';
|
|
9
12
|
/**
|
|
10
13
|
* An animation configuration. Animation configurations can also be defined as
|
|
11
14
|
* booleans, where `false` turns off animation and `true` defaults to a duration
|
|
12
15
|
* of 500ms.
|
|
13
16
|
*
|
|
14
17
|
* @interface Highcharts.AnimationOptionsObject
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
*/ /**
|
|
19
|
+
* A callback function to exectute when the animation finishes.
|
|
20
|
+
* @name Highcharts.AnimationOptionsObject#complete
|
|
21
|
+
* @type {Function|undefined}
|
|
22
|
+
*/ /**
|
|
23
|
+
* The animation duration in milliseconds.
|
|
24
|
+
* @name Highcharts.AnimationOptionsObject#duration
|
|
25
|
+
* @type {number|undefined}
|
|
26
|
+
*/ /**
|
|
27
|
+
* The name of an easing function as defined on the `Math` object.
|
|
28
|
+
* @name Highcharts.AnimationOptionsObject#easing
|
|
29
|
+
* @type {string|Function|undefined}
|
|
30
|
+
*/ /**
|
|
31
|
+
* A callback function to execute on each step of each attribute or CSS property
|
|
32
|
+
* that's being animated. The first argument contains information about the
|
|
33
|
+
* animation and progress.
|
|
34
|
+
* @name Highcharts.AnimationOptionsObject#step
|
|
35
|
+
* @type {Function|undefined}
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Creates a frame for the animated SVG element.
|
|
39
|
+
*
|
|
40
|
+
* @callback Highcharts.AnimationStepCallbackFunction
|
|
41
|
+
*
|
|
42
|
+
* @param {Highcharts.SVGElement} this
|
|
43
|
+
* The SVG element to animate.
|
|
44
|
+
*
|
|
45
|
+
* @return {void}
|
|
46
|
+
*/
|
|
35
47
|
/**
|
|
36
48
|
* A style object with camel case property names to define visual appearance of
|
|
37
49
|
* a SVG element or HTML element. The properties can be whatever styles are
|
|
@@ -44,128 +56,124 @@
|
|
|
44
56
|
* }
|
|
45
57
|
*
|
|
46
58
|
* @interface Highcharts.CSSObject
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
59
|
+
*/ /**
|
|
60
|
+
* @name Highcharts.CSSObject#[key:string]
|
|
61
|
+
* @type {boolean|number|string|undefined}
|
|
62
|
+
*/ /**
|
|
63
|
+
* Background style for the element.
|
|
64
|
+
* @name Highcharts.CSSObject#background
|
|
65
|
+
* @type {string|undefined}
|
|
66
|
+
*/ /**
|
|
67
|
+
* Background color of the element.
|
|
68
|
+
* @name Highcharts.CSSObject#backgroundColor
|
|
69
|
+
* @type {Highcharts.ColorString|undefined}
|
|
70
|
+
*/ /**
|
|
71
|
+
* Border style for the element.
|
|
72
|
+
* @name Highcharts.CSSObject#border
|
|
73
|
+
* @type {string|undefined}
|
|
74
|
+
*/ /**
|
|
75
|
+
* Radius of the element border.
|
|
76
|
+
* @name Highcharts.CSSObject#borderRadius
|
|
77
|
+
* @type {number|undefined}
|
|
78
|
+
*/ /**
|
|
79
|
+
* Color used in the element. The 'contrast' option is a Highcharts custom
|
|
80
|
+
* property that results in black or white, depending on the background of the
|
|
81
|
+
* element.
|
|
82
|
+
* @name Highcharts.CSSObject#color
|
|
83
|
+
* @type {'contrast'|Highcharts.ColorString|undefined}
|
|
84
|
+
*/ /**
|
|
85
|
+
* Style of the mouse cursor when resting over the element.
|
|
86
|
+
* @name Highcharts.CSSObject#cursor
|
|
87
|
+
* @type {Highcharts.CursorValue|undefined}
|
|
88
|
+
*/ /**
|
|
89
|
+
* Font family of the element text. Multiple values have to be in decreasing
|
|
90
|
+
* preference order and separated by comma.
|
|
91
|
+
* @name Highcharts.CSSObject#fontFamily
|
|
92
|
+
* @type {string|undefined}
|
|
93
|
+
*/ /**
|
|
94
|
+
* Font size of the element text.
|
|
95
|
+
* @name Highcharts.CSSObject#fontSize
|
|
96
|
+
* @type {string|undefined}
|
|
97
|
+
*/ /**
|
|
98
|
+
* Font weight of the element text.
|
|
99
|
+
* @name Highcharts.CSSObject#fontWeight
|
|
100
|
+
* @type {string|undefined}
|
|
101
|
+
*/ /**
|
|
102
|
+
* Height of the element.
|
|
103
|
+
* @name Highcharts.CSSObject#height
|
|
104
|
+
* @type {number|undefined}
|
|
105
|
+
*/ /**
|
|
106
|
+
* Width of the element border.
|
|
107
|
+
* @name Highcharts.CSSObject#lineWidth
|
|
108
|
+
* @type {number|undefined}
|
|
109
|
+
*/ /**
|
|
110
|
+
* Opacity of the element.
|
|
111
|
+
* @name Highcharts.CSSObject#opacity
|
|
112
|
+
* @type {number|undefined}
|
|
113
|
+
*/ /**
|
|
114
|
+
* Space around the element content.
|
|
115
|
+
* @name Highcharts.CSSObject#padding
|
|
116
|
+
* @type {string|undefined}
|
|
117
|
+
*/ /**
|
|
118
|
+
* Behaviour of the element when the mouse cursor rests over it.
|
|
119
|
+
* @name Highcharts.CSSObject#pointerEvents
|
|
120
|
+
* @type {string|undefined}
|
|
121
|
+
*/ /**
|
|
122
|
+
* Positioning of the element.
|
|
123
|
+
* @name Highcharts.CSSObject#position
|
|
124
|
+
* @type {string|undefined}
|
|
125
|
+
*/ /**
|
|
126
|
+
* Alignment of the element text.
|
|
127
|
+
* @name Highcharts.CSSObject#textAlign
|
|
128
|
+
* @type {string|undefined}
|
|
129
|
+
*/ /**
|
|
130
|
+
* Additional decoration of the element text.
|
|
131
|
+
* @name Highcharts.CSSObject#textDecoration
|
|
132
|
+
* @type {string|undefined}
|
|
133
|
+
*/ /**
|
|
134
|
+
* Outline style of the element text.
|
|
135
|
+
* @name Highcharts.CSSObject#textOutline
|
|
136
|
+
* @type {string|undefined}
|
|
137
|
+
*/ /**
|
|
138
|
+
* Line break style of the element text. Highcharts SVG elements support
|
|
139
|
+
* `ellipsis` when a `width` is set.
|
|
140
|
+
* @name Highcharts.CSSObject#textOverflow
|
|
141
|
+
* @type {string|undefined}
|
|
142
|
+
*/ /**
|
|
143
|
+
* Top spacing of the element relative to the parent element.
|
|
144
|
+
* @name Highcharts.CSSObject#top
|
|
145
|
+
* @type {string|undefined}
|
|
146
|
+
*/ /**
|
|
147
|
+
* Animated transition of selected element properties.
|
|
148
|
+
* @name Highcharts.CSSObject#transition
|
|
149
|
+
* @type {string|undefined}
|
|
150
|
+
*/ /**
|
|
151
|
+
* Line break style of the element text.
|
|
152
|
+
* @name Highcharts.CSSObject#whiteSpace
|
|
153
|
+
* @type {string|undefined}
|
|
154
|
+
*/ /**
|
|
155
|
+
* Width of the element.
|
|
156
|
+
* @name Highcharts.CSSObject#width
|
|
157
|
+
* @type {number|undefined}
|
|
158
|
+
*/
|
|
148
159
|
/**
|
|
149
160
|
* All possible cursor styles.
|
|
150
161
|
*
|
|
151
|
-
* @typedef {
|
|
162
|
+
* @typedef {'alias'|'all-scroll'|'auto'|'cell'|'col-resize'|'context-menu'|'copy'|'crosshair'|'default'|'e-resize'|'ew-resize'|'grab'|'grabbing'|'help'|'move'|'n-resize'|'ne-resize'|'nesw-resize'|'no-drop'|'none'|'not-allowed'|'ns-resize'|'nw-resize'|'nwse-resize'|'pointer'|'progress'|'row-resize'|'s-resize'|'se-resize'|'sw-resize'|'text'|'vertical-text'|'w-resize'|'wait'|'zoom-in'|'zoom-out'} Highcharts.CursorValue
|
|
152
163
|
*/
|
|
153
|
-
|
|
154
164
|
/**
|
|
155
165
|
* All possible dash styles.
|
|
156
166
|
*
|
|
157
|
-
* @typedef {
|
|
167
|
+
* @typedef {'Dash'|'DashDot'|'Dot'|'LongDash'|'LongDashDot'|'LongDashDotDot'|'ShortDash'|'ShortDashDot'|'ShortDashDotDot'|'ShortDot'|'Solid'} Highcharts.DashStyleValue
|
|
158
168
|
*/
|
|
159
|
-
|
|
160
169
|
/**
|
|
161
170
|
* Generic dictionary in TypeScript notation.
|
|
162
171
|
*
|
|
163
172
|
* @interface Highcharts.Dictionary<T>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
*/ /**
|
|
174
|
+
* @name Highcharts.Dictionary<T>#[key:string]
|
|
175
|
+
* @type {T}
|
|
176
|
+
*/
|
|
169
177
|
/**
|
|
170
178
|
* The function callback to execute when the event is fired. The `this` context
|
|
171
179
|
* contains the instance, that fired the event.
|
|
@@ -174,22 +182,22 @@
|
|
|
174
182
|
*
|
|
175
183
|
* @param {T} this
|
|
176
184
|
*
|
|
177
|
-
* @param {Highcharts.Dictionary
|
|
185
|
+
* @param {Highcharts.Dictionary<*>|Event} [eventArguments]
|
|
178
186
|
* Event arguments.
|
|
187
|
+
*
|
|
188
|
+
* @return {boolean|void}
|
|
179
189
|
*/
|
|
180
|
-
|
|
181
190
|
/**
|
|
182
191
|
* The event options for adding function callback.
|
|
183
192
|
*
|
|
184
193
|
* @interface Highcharts.EventOptionsObject
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
*/ /**
|
|
195
|
+
* The order the event handler should be called. This opens for having one
|
|
196
|
+
* handler be called before another, independent of in which order they were
|
|
197
|
+
* added.
|
|
198
|
+
* @name Highcharts.EventOptionsObject#order
|
|
199
|
+
* @type {number}
|
|
200
|
+
*/
|
|
193
201
|
/**
|
|
194
202
|
* Formats data as a string. Usually the data is accessible throught the `this`
|
|
195
203
|
* keyword.
|
|
@@ -202,13 +210,11 @@
|
|
|
202
210
|
* @return {string}
|
|
203
211
|
* Formatted text
|
|
204
212
|
*/
|
|
205
|
-
|
|
206
213
|
/**
|
|
207
214
|
* An object of key-value pairs for HTML attributes.
|
|
208
215
|
*
|
|
209
|
-
* @typedef {Highcharts.Dictionary<boolean|number|string>} Highcharts.HTMLAttributes
|
|
216
|
+
* @typedef {Highcharts.Dictionary<boolean|number|string|Function>} Highcharts.HTMLAttributes
|
|
210
217
|
*/
|
|
211
|
-
|
|
212
218
|
/**
|
|
213
219
|
* An HTML DOM element. The type is a reference to the regular HTMLElement in
|
|
214
220
|
* the global scope.
|
|
@@ -217,11 +223,13 @@
|
|
|
217
223
|
*
|
|
218
224
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
219
225
|
*/
|
|
220
|
-
|
|
221
226
|
/**
|
|
222
227
|
* The iterator callback.
|
|
223
228
|
*
|
|
224
|
-
* @callback Highcharts.ObjectEachCallbackFunction
|
|
229
|
+
* @callback Highcharts.ObjectEachCallbackFunction<T>
|
|
230
|
+
*
|
|
231
|
+
* @param {T} this
|
|
232
|
+
* The context.
|
|
225
233
|
*
|
|
226
234
|
* @param {*} value
|
|
227
235
|
* The property value.
|
|
@@ -232,22 +240,20 @@
|
|
|
232
240
|
* @param {*} obj
|
|
233
241
|
* The object that objectEach is being applied to.
|
|
234
242
|
*/
|
|
235
|
-
|
|
236
243
|
/**
|
|
237
244
|
* An object containing `left` and `top` properties for the position in the
|
|
238
245
|
* page.
|
|
239
246
|
*
|
|
240
247
|
* @interface Highcharts.OffsetObject
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
*/ /**
|
|
249
|
+
* Left distance to the page border.
|
|
250
|
+
* @name Highcharts.OffsetObject#left
|
|
251
|
+
* @type {number}
|
|
252
|
+
*/ /**
|
|
253
|
+
* Top distance to the page border.
|
|
254
|
+
* @name Highcharts.OffsetObject#top
|
|
255
|
+
* @type {number}
|
|
256
|
+
*/
|
|
251
257
|
/**
|
|
252
258
|
* If a number is given, it defines the pixel length. If a percentage string is
|
|
253
259
|
* given, like for example `'50%'`, the setting defines a length relative to a
|
|
@@ -255,7 +261,6 @@
|
|
|
255
261
|
*
|
|
256
262
|
* @typedef {number|string} Highcharts.RelativeSize
|
|
257
263
|
*/
|
|
258
|
-
|
|
259
264
|
/**
|
|
260
265
|
* Proceed function to call original (wrapped) function.
|
|
261
266
|
*
|
|
@@ -276,11 +281,6 @@
|
|
|
276
281
|
* @return {*}
|
|
277
282
|
* Return value of the original function.
|
|
278
283
|
*/
|
|
279
|
-
|
|
280
|
-
'use strict';
|
|
281
|
-
|
|
282
|
-
import H from './Globals.js';
|
|
283
|
-
|
|
284
284
|
/**
|
|
285
285
|
* The Highcharts object is the placeholder for all other members, and various
|
|
286
286
|
* utility functions. The most important member of the namespace would be the
|
|
@@ -291,13 +291,8 @@ import H from './Globals.js';
|
|
|
291
291
|
*
|
|
292
292
|
* @namespace Highcharts
|
|
293
293
|
*/
|
|
294
|
-
|
|
295
294
|
H.timers = [];
|
|
296
|
-
|
|
297
|
-
var charts = H.charts,
|
|
298
|
-
doc = H.doc,
|
|
299
|
-
win = H.win;
|
|
300
|
-
|
|
295
|
+
var charts = H.charts, doc = H.doc, win = H.win;
|
|
301
296
|
/**
|
|
302
297
|
* Provide error messages for debugging, with links to online explanation. This
|
|
303
298
|
* function can be overridden to provide custom error handling.
|
|
@@ -321,30 +316,30 @@ var charts = H.charts,
|
|
|
321
316
|
* module to display errors directly on the chart.
|
|
322
317
|
* Important note: This argument is undefined for errors that lack
|
|
323
318
|
* access to the Chart instance.
|
|
319
|
+
*
|
|
320
|
+
* @return {void}
|
|
324
321
|
*/
|
|
325
322
|
H.error = function (code, stop, chart) {
|
|
326
323
|
var msg = H.isNumber(code) ?
|
|
327
|
-
|
|
328
|
-
code :
|
|
329
|
-
defaultHandler = function () {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
324
|
+
'Highcharts error #' + code + ': www.highcharts.com/errors/' +
|
|
325
|
+
code :
|
|
326
|
+
code, defaultHandler = function () {
|
|
327
|
+
if (stop) {
|
|
328
|
+
throw new Error(msg);
|
|
329
|
+
}
|
|
330
|
+
// else ...
|
|
331
|
+
if (win.console) {
|
|
332
|
+
console.log(msg); // eslint-disable-line no-console
|
|
333
|
+
}
|
|
334
|
+
};
|
|
339
335
|
if (chart) {
|
|
340
|
-
H.fireEvent(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
} else {
|
|
336
|
+
H.fireEvent(chart, 'displayError', { code: code, message: msg }, defaultHandler);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
344
339
|
defaultHandler();
|
|
345
340
|
}
|
|
346
341
|
};
|
|
347
|
-
|
|
342
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
348
343
|
/**
|
|
349
344
|
* An animator object used internally. One instance applies to one property
|
|
350
345
|
* (attribute or style prop) on one element. Animation is always initiated
|
|
@@ -355,7 +350,8 @@ H.error = function (code, stop, chart) {
|
|
|
355
350
|
* rect.animate({ width: 100 });
|
|
356
351
|
*
|
|
357
352
|
* @private
|
|
358
|
-
* @class
|
|
353
|
+
* @class
|
|
354
|
+
* @name Highcharts.Fx
|
|
359
355
|
*
|
|
360
356
|
* @param {Highcharts.HTMLDOMElement|Highcharts.SVGElement} elem
|
|
361
357
|
* The element to animate.
|
|
@@ -370,74 +366,67 @@ H.Fx = function (elem, options, prop) {
|
|
|
370
366
|
this.options = options;
|
|
371
367
|
this.elem = elem;
|
|
372
368
|
this.prop = prop;
|
|
369
|
+
/* eslint-enable no-invalid-this, valid-jsdoc */
|
|
373
370
|
};
|
|
374
371
|
H.Fx.prototype = {
|
|
375
|
-
|
|
376
372
|
/**
|
|
377
373
|
* Set the current step of a path definition on SVGElement.
|
|
378
374
|
*
|
|
379
375
|
* @function Highcharts.Fx#dSetter
|
|
376
|
+
*
|
|
377
|
+
* @return {void}
|
|
380
378
|
*/
|
|
381
379
|
dSetter: function () {
|
|
382
|
-
var start = this.paths[0],
|
|
383
|
-
end = this.paths[1],
|
|
384
|
-
ret = [],
|
|
385
|
-
now = this.now,
|
|
386
|
-
i = start.length,
|
|
387
|
-
startVal;
|
|
388
|
-
|
|
380
|
+
var start = this.paths[0], end = this.paths[1], ret = [], now = this.now, i = start.length, startVal;
|
|
389
381
|
// Land on the final path without adjustment points appended in the ends
|
|
390
382
|
if (now === 1) {
|
|
391
383
|
ret = this.toD;
|
|
392
|
-
|
|
393
|
-
|
|
384
|
+
}
|
|
385
|
+
else if (i === end.length && now < 1) {
|
|
394
386
|
while (i--) {
|
|
395
387
|
startVal = parseFloat(start[i]);
|
|
396
388
|
ret[i] =
|
|
397
389
|
isNaN(startVal) ? // a letter instruction like M or L
|
|
398
390
|
end[i] :
|
|
399
|
-
now *
|
|
400
|
-
|
|
391
|
+
(now *
|
|
392
|
+
(parseFloat(end[i] - startVal)) +
|
|
393
|
+
startVal);
|
|
401
394
|
}
|
|
402
|
-
|
|
403
|
-
}
|
|
395
|
+
// If animation is finished or length not matching, land on right value
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
404
398
|
ret = end;
|
|
405
399
|
}
|
|
406
400
|
this.elem.attr('d', ret, null, true);
|
|
407
401
|
},
|
|
408
|
-
|
|
409
402
|
/**
|
|
410
403
|
* Update the element with the current animation step.
|
|
411
404
|
*
|
|
412
405
|
* @function Highcharts.Fx#update
|
|
406
|
+
*
|
|
407
|
+
* @return {void}
|
|
413
408
|
*/
|
|
414
409
|
update: function () {
|
|
415
|
-
var elem = this.elem,
|
|
416
|
-
|
|
417
|
-
now = this.now,
|
|
418
|
-
step = this.options.step;
|
|
419
|
-
|
|
410
|
+
var elem = this.elem, prop = this.prop, // if destroyed, it is null
|
|
411
|
+
now = this.now, step = this.options.step;
|
|
420
412
|
// Animation setter defined from outside
|
|
421
413
|
if (this[prop + 'Setter']) {
|
|
422
414
|
this[prop + 'Setter']();
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
415
|
+
// Other animations on SVGElement
|
|
416
|
+
}
|
|
417
|
+
else if (elem.attr) {
|
|
426
418
|
if (elem.element) {
|
|
427
419
|
elem.attr(prop, now, null, true);
|
|
428
420
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
421
|
+
// HTML styles, raw HTML content like container size
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
432
424
|
elem.style[prop] = now + this.unit;
|
|
433
425
|
}
|
|
434
|
-
|
|
435
426
|
if (step) {
|
|
436
427
|
step.call(elem, now, this);
|
|
437
428
|
}
|
|
438
|
-
|
|
439
429
|
},
|
|
440
|
-
|
|
441
430
|
/**
|
|
442
431
|
* Run an animation.
|
|
443
432
|
*
|
|
@@ -449,54 +438,47 @@ H.Fx.prototype = {
|
|
|
449
438
|
* @param {number} to
|
|
450
439
|
* The end value, value to land on.
|
|
451
440
|
*
|
|
452
|
-
* @param {string}
|
|
441
|
+
* @param {string} unit
|
|
453
442
|
* The property unit, for example `px`.
|
|
443
|
+
*
|
|
444
|
+
* @return {void}
|
|
454
445
|
*/
|
|
455
446
|
run: function (from, to, unit) {
|
|
456
|
-
var self = this,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
},
|
|
466
|
-
step = function () {
|
|
467
|
-
for (var i = 0; i < H.timers.length; i++) {
|
|
468
|
-
if (!H.timers[i]()) {
|
|
469
|
-
H.timers.splice(i--, 1);
|
|
470
|
-
}
|
|
447
|
+
var self = this, options = self.options, timer = function (gotoEnd) {
|
|
448
|
+
return timer.stopped ? false : self.step(gotoEnd);
|
|
449
|
+
}, requestAnimationFrame = win.requestAnimationFrame ||
|
|
450
|
+
function (step) {
|
|
451
|
+
setTimeout(step, 13);
|
|
452
|
+
}, step = function () {
|
|
453
|
+
for (var i = 0; i < H.timers.length; i++) {
|
|
454
|
+
if (!H.timers[i]()) {
|
|
455
|
+
H.timers.splice(i--, 1);
|
|
471
456
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
457
|
+
}
|
|
458
|
+
if (H.timers.length) {
|
|
459
|
+
requestAnimationFrame(step);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
478
462
|
if (from === to && !this.elem['forceAnimate:' + this.prop]) {
|
|
479
463
|
delete options.curAnim[this.prop];
|
|
480
464
|
if (options.complete && Object.keys(options.curAnim).length === 0) {
|
|
481
465
|
options.complete.call(this.elem);
|
|
482
466
|
}
|
|
483
|
-
}
|
|
467
|
+
}
|
|
468
|
+
else { // #7166
|
|
484
469
|
this.startTime = +new Date();
|
|
485
470
|
this.start = from;
|
|
486
471
|
this.end = to;
|
|
487
472
|
this.unit = unit;
|
|
488
473
|
this.now = this.start;
|
|
489
474
|
this.pos = 0;
|
|
490
|
-
|
|
491
475
|
timer.elem = this.elem;
|
|
492
476
|
timer.prop = this.prop;
|
|
493
|
-
|
|
494
477
|
if (timer() && H.timers.push(timer) === 1) {
|
|
495
478
|
requestAnimationFrame(step);
|
|
496
479
|
}
|
|
497
480
|
}
|
|
498
481
|
},
|
|
499
|
-
|
|
500
482
|
/**
|
|
501
483
|
* Run a single step in the animation.
|
|
502
484
|
*
|
|
@@ -509,39 +491,27 @@ H.Fx.prototype = {
|
|
|
509
491
|
* Returns `true` if animation continues.
|
|
510
492
|
*/
|
|
511
493
|
step: function (gotoEnd) {
|
|
512
|
-
var t = +new Date(),
|
|
513
|
-
ret,
|
|
514
|
-
done,
|
|
515
|
-
options = this.options,
|
|
516
|
-
elem = this.elem,
|
|
517
|
-
complete = options.complete,
|
|
518
|
-
duration = options.duration,
|
|
519
|
-
curAnim = options.curAnim;
|
|
520
|
-
|
|
494
|
+
var t = +new Date(), ret, done, options = this.options, elem = this.elem, complete = options.complete, duration = options.duration, curAnim = options.curAnim;
|
|
521
495
|
if (elem.attr && !elem.element) { // #2616, element is destroyed
|
|
522
496
|
ret = false;
|
|
523
|
-
|
|
524
|
-
|
|
497
|
+
}
|
|
498
|
+
else if (gotoEnd || t >= duration + this.startTime) {
|
|
525
499
|
this.now = this.end;
|
|
526
500
|
this.pos = 1;
|
|
527
501
|
this.update();
|
|
528
|
-
|
|
529
502
|
curAnim[this.prop] = true;
|
|
530
|
-
|
|
531
503
|
done = true;
|
|
532
|
-
|
|
533
504
|
H.objectEach(curAnim, function (val) {
|
|
534
505
|
if (val !== true) {
|
|
535
506
|
done = false;
|
|
536
507
|
}
|
|
537
508
|
});
|
|
538
|
-
|
|
539
509
|
if (done && complete) {
|
|
540
510
|
complete.call(elem);
|
|
541
511
|
}
|
|
542
512
|
ret = false;
|
|
543
|
-
|
|
544
|
-
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
545
515
|
this.pos = options.easing((t - this.startTime) / duration);
|
|
546
516
|
this.now = this.start + ((this.end - this.start) * this.pos);
|
|
547
517
|
this.update();
|
|
@@ -549,7 +519,6 @@ H.Fx.prototype = {
|
|
|
549
519
|
}
|
|
550
520
|
return ret;
|
|
551
521
|
},
|
|
552
|
-
|
|
553
522
|
/**
|
|
554
523
|
* Prepare start and end values so that the path can be animated one to one.
|
|
555
524
|
*
|
|
@@ -564,129 +533,103 @@ H.Fx.prototype = {
|
|
|
564
533
|
* @param {Highcharts.SVGPathArray} toD
|
|
565
534
|
* Ending path definition.
|
|
566
535
|
*
|
|
567
|
-
* @return {Array<Highcharts.SVGPathArray>}
|
|
536
|
+
* @return {Array<Highcharts.SVGPathArray,Highcharts.SVGPathArray>}
|
|
568
537
|
* An array containing start and end paths in array form so that
|
|
569
538
|
* they can be animated in parallel.
|
|
570
539
|
*/
|
|
571
540
|
initPath: function (elem, fromD, toD) {
|
|
572
541
|
fromD = fromD || '';
|
|
573
|
-
var shift,
|
|
574
|
-
|
|
575
|
-
endX = elem.endX,
|
|
576
|
-
bezier = fromD.indexOf('C') > -1,
|
|
577
|
-
numParams = bezier ? 7 : 3,
|
|
578
|
-
fullLength,
|
|
579
|
-
slice,
|
|
580
|
-
i,
|
|
581
|
-
start = fromD.split(' '),
|
|
582
|
-
end = toD.slice(), // copy
|
|
583
|
-
isArea = elem.isArea,
|
|
584
|
-
positionFactor = isArea ? 2 : 1,
|
|
585
|
-
reverse;
|
|
586
|
-
|
|
542
|
+
var shift, startX = elem.startX, endX = elem.endX, bezier = fromD.indexOf('C') > -1, numParams = bezier ? 7 : 3, fullLength, slice, i, start = fromD.split(' '), end = toD.slice(), // copy
|
|
543
|
+
isArea = elem.isArea, positionFactor = isArea ? 2 : 1, reverse;
|
|
587
544
|
/**
|
|
588
545
|
* In splines make moveTo and lineTo points have six parameters like
|
|
589
546
|
* bezier curves, to allow animation one-to-one.
|
|
547
|
+
* @private
|
|
548
|
+
* @param {Highcharts.SVGPathArray} arr - array
|
|
549
|
+
* @return {void}
|
|
590
550
|
*/
|
|
591
551
|
function sixify(arr) {
|
|
592
|
-
var isOperator,
|
|
593
|
-
nextIsOperator;
|
|
594
|
-
|
|
552
|
+
var isOperator, nextIsOperator;
|
|
595
553
|
i = arr.length;
|
|
596
554
|
while (i--) {
|
|
597
|
-
|
|
598
555
|
// Fill in dummy coordinates only if the next operator comes
|
|
599
556
|
// three places behind (#5788)
|
|
600
557
|
isOperator = arr[i] === 'M' || arr[i] === 'L';
|
|
601
558
|
nextIsOperator = /[a-zA-Z]/.test(arr[i + 3]);
|
|
602
559
|
if (isOperator && nextIsOperator) {
|
|
603
|
-
arr.splice(
|
|
604
|
-
i + 1, 0,
|
|
605
|
-
arr[i + 1], arr[i + 2],
|
|
606
|
-
arr[i + 1], arr[i + 2]
|
|
607
|
-
);
|
|
560
|
+
arr.splice(i + 1, 0, arr[i + 1], arr[i + 2], arr[i + 1], arr[i + 2]);
|
|
608
561
|
}
|
|
609
562
|
}
|
|
610
563
|
}
|
|
611
|
-
|
|
612
564
|
/**
|
|
613
565
|
* Insert an array at the given position of another array
|
|
566
|
+
* @private
|
|
567
|
+
* @param {Array<*>} arr - array
|
|
568
|
+
* @param {Array<*>} subArr - array
|
|
569
|
+
* @param {number} index - number
|
|
570
|
+
* @return {void}
|
|
614
571
|
*/
|
|
615
572
|
function insertSlice(arr, subArr, index) {
|
|
616
|
-
[].splice.apply(
|
|
617
|
-
arr,
|
|
618
|
-
[index, 0].concat(subArr)
|
|
619
|
-
);
|
|
573
|
+
[].splice.apply(arr, [index, 0].concat(subArr));
|
|
620
574
|
}
|
|
621
|
-
|
|
622
575
|
/**
|
|
623
576
|
* If shifting points, prepend a dummy point to the end path.
|
|
577
|
+
* @private
|
|
578
|
+
* @param {Highcharts.SVGPathArray} arr - array
|
|
579
|
+
* @param {Highcharts.SVGPathArray} other - array
|
|
580
|
+
* @return {void}
|
|
624
581
|
*/
|
|
625
582
|
function prepend(arr, other) {
|
|
626
583
|
while (arr.length < fullLength) {
|
|
627
|
-
|
|
628
584
|
// Move to, line to or curve to?
|
|
629
585
|
arr[0] = other[fullLength - arr.length];
|
|
630
|
-
|
|
631
586
|
// Prepend a copy of the first point
|
|
632
587
|
insertSlice(arr, arr.slice(0, numParams), 0);
|
|
633
|
-
|
|
634
588
|
// For areas, the bottom path goes back again to the left, so we
|
|
635
589
|
// need to append a copy of the last point.
|
|
636
590
|
if (isArea) {
|
|
637
|
-
insertSlice(
|
|
638
|
-
arr,
|
|
639
|
-
arr.slice(arr.length - numParams), arr.length
|
|
640
|
-
);
|
|
591
|
+
insertSlice(arr, arr.slice(arr.length - numParams), arr.length);
|
|
641
592
|
i--;
|
|
642
593
|
}
|
|
643
594
|
}
|
|
644
595
|
arr[0] = 'M';
|
|
645
596
|
}
|
|
646
|
-
|
|
647
597
|
/**
|
|
648
598
|
* Copy and append last point until the length matches the end length.
|
|
599
|
+
* @private
|
|
600
|
+
* @param {Highcharts.SVGPathArray} arr - array
|
|
601
|
+
* @param {Highcharts.SVGPathArray} other - array
|
|
602
|
+
* @return {void}
|
|
649
603
|
*/
|
|
650
604
|
function append(arr, other) {
|
|
651
605
|
var i = (fullLength - arr.length) / numParams;
|
|
652
|
-
|
|
653
606
|
while (i > 0 && i--) {
|
|
654
|
-
|
|
655
607
|
// Pull out the slice that is going to be appended or inserted.
|
|
656
608
|
// In a line graph, the positionFactor is 1, and the last point
|
|
657
609
|
// is sliced out. In an area graph, the positionFactor is 2,
|
|
658
610
|
// causing the middle two points to be sliced out, since an area
|
|
659
611
|
// path starts at left, follows the upper path then turns and
|
|
660
612
|
// follows the bottom back.
|
|
661
|
-
slice = arr.slice().splice(
|
|
662
|
-
(arr.length / positionFactor) - numParams,
|
|
663
|
-
numParams * positionFactor
|
|
664
|
-
);
|
|
665
|
-
|
|
613
|
+
slice = arr.slice().splice((arr.length / positionFactor) - numParams, numParams * positionFactor);
|
|
666
614
|
// Move to, line to or curve to?
|
|
667
615
|
slice[0] = other[fullLength - numParams - (i * numParams)];
|
|
668
|
-
|
|
669
616
|
// Disable first control point
|
|
670
617
|
if (bezier) {
|
|
671
618
|
slice[numParams - 6] = slice[numParams - 2];
|
|
672
619
|
slice[numParams - 5] = slice[numParams - 1];
|
|
673
620
|
}
|
|
674
|
-
|
|
675
621
|
// Now insert the slice, either in the middle (for areas) or at
|
|
676
622
|
// the end (for lines)
|
|
677
623
|
insertSlice(arr, slice, arr.length / positionFactor);
|
|
678
|
-
|
|
679
624
|
if (isArea) {
|
|
680
625
|
i--;
|
|
681
626
|
}
|
|
682
627
|
}
|
|
683
628
|
}
|
|
684
|
-
|
|
685
629
|
if (bezier) {
|
|
686
630
|
sixify(start);
|
|
687
631
|
sixify(end);
|
|
688
632
|
}
|
|
689
|
-
|
|
690
633
|
// For sideways animation, find out how much we need to shift to get the
|
|
691
634
|
// start path Xs to match the end path Xs.
|
|
692
635
|
if (startX && endX) {
|
|
@@ -695,147 +638,136 @@ H.Fx.prototype = {
|
|
|
695
638
|
if (startX[i] === endX[0]) {
|
|
696
639
|
shift = i;
|
|
697
640
|
break;
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
|
|
641
|
+
// Moving right
|
|
642
|
+
}
|
|
643
|
+
else if (startX[0] ===
|
|
644
|
+
endX[endX.length - startX.length + i]) {
|
|
701
645
|
shift = i;
|
|
702
646
|
reverse = true;
|
|
703
647
|
break;
|
|
648
|
+
// Fixed from the right side, "scaling" left
|
|
649
|
+
}
|
|
650
|
+
else if (startX[startX.length - 1] ===
|
|
651
|
+
endX[endX.length - startX.length + i]) {
|
|
652
|
+
shift = startX.length - i;
|
|
653
|
+
break;
|
|
704
654
|
}
|
|
705
655
|
}
|
|
706
|
-
if (shift === undefined) {
|
|
656
|
+
if (typeof shift === 'undefined') {
|
|
707
657
|
start = [];
|
|
708
658
|
}
|
|
709
659
|
}
|
|
710
|
-
|
|
711
660
|
if (start.length && H.isNumber(shift)) {
|
|
712
|
-
|
|
713
661
|
// The common target length for the start and end array, where both
|
|
714
662
|
// arrays are padded in opposite ends
|
|
715
|
-
fullLength = end.length + shift * positionFactor * numParams;
|
|
716
|
-
|
|
663
|
+
fullLength = (end.length + shift * positionFactor * numParams);
|
|
717
664
|
if (!reverse) {
|
|
718
665
|
prepend(end, start);
|
|
719
666
|
append(start, end);
|
|
720
|
-
}
|
|
667
|
+
}
|
|
668
|
+
else {
|
|
721
669
|
prepend(start, end);
|
|
722
670
|
append(end, start);
|
|
723
671
|
}
|
|
724
672
|
}
|
|
725
|
-
|
|
726
673
|
return [start, end];
|
|
727
674
|
},
|
|
728
|
-
|
|
729
675
|
/**
|
|
730
676
|
* Handle animation of the color attributes directly.
|
|
731
677
|
*
|
|
732
678
|
* @function Highcharts.Fx#fillSetter
|
|
679
|
+
*
|
|
680
|
+
* @return {void}
|
|
733
681
|
*/
|
|
734
682
|
fillSetter: function () {
|
|
735
683
|
H.Fx.prototype.strokeSetter.apply(this, arguments);
|
|
736
684
|
},
|
|
737
|
-
|
|
738
685
|
/**
|
|
739
686
|
* Handle animation of the color attributes directly.
|
|
740
687
|
*
|
|
741
688
|
* @function Highcharts.Fx#strokeSetter
|
|
689
|
+
*
|
|
690
|
+
* @return {void}
|
|
742
691
|
*/
|
|
743
692
|
strokeSetter: function () {
|
|
744
|
-
this.elem.attr(
|
|
745
|
-
this.prop,
|
|
746
|
-
H.color(this.start).tweenTo(H.color(this.end), this.pos),
|
|
747
|
-
null,
|
|
748
|
-
true
|
|
749
|
-
);
|
|
693
|
+
this.elem.attr(this.prop, H.color(this.start).tweenTo(H.color(this.end), this.pos), null, true);
|
|
750
694
|
}
|
|
751
|
-
|
|
752
695
|
}; // End of Fx prototype
|
|
753
|
-
|
|
754
|
-
|
|
696
|
+
/* eslint-disable valid-jsdoc */
|
|
755
697
|
/**
|
|
756
|
-
* Utility function to deep merge two or more objects and return a third object.
|
|
757
|
-
* The merge function can also be used with a single object argument to create a
|
|
758
|
-
* deep copy of an object.
|
|
759
|
-
*
|
|
760
|
-
* @function Highcharts.merge
|
|
761
|
-
*
|
|
762
|
-
* @param {*} a
|
|
763
|
-
* The first object to extend. When only this is given, the function
|
|
764
|
-
* returns a deep copy.
|
|
765
|
-
*
|
|
766
|
-
* @param {*} [n]
|
|
767
|
-
* An object to merge into the previous one.
|
|
768
|
-
*
|
|
769
|
-
* @return {*}
|
|
770
|
-
* The merged object. If the first argument is true, the return is the
|
|
771
|
-
* same as the second argument.
|
|
772
|
-
*//**
|
|
773
698
|
* Utility function to deep merge two or more objects and return a third object.
|
|
774
699
|
* If the first argument is true, the contents of the second object is copied
|
|
775
700
|
* into the first object. The merge function can also be used with a single
|
|
776
701
|
* object argument to create a deep copy of an object.
|
|
777
702
|
*
|
|
778
|
-
* @function Highcharts.merge
|
|
703
|
+
* @function Highcharts.merge<T>
|
|
779
704
|
*
|
|
780
705
|
* @param {boolean} extend
|
|
781
706
|
* Whether to extend the left-side object (a) or return a whole new
|
|
782
707
|
* object.
|
|
783
708
|
*
|
|
784
|
-
* @param {
|
|
709
|
+
* @param {T} a
|
|
785
710
|
* The first object to extend. When only this is given, the function
|
|
786
711
|
* returns a deep copy.
|
|
787
712
|
*
|
|
788
|
-
* @param {
|
|
713
|
+
* @param {Array<object|undefined>} [...n]
|
|
789
714
|
* An object to merge into the previous one.
|
|
790
715
|
*
|
|
791
|
-
* @return {
|
|
716
|
+
* @return {T}
|
|
792
717
|
* The merged object. If the first argument is true, the return is the
|
|
793
718
|
* same as the second argument.
|
|
794
|
-
*/
|
|
719
|
+
*/ /**
|
|
720
|
+
* Utility function to deep merge two or more objects and return a third object.
|
|
721
|
+
* The merge function can also be used with a single object argument to create a
|
|
722
|
+
* deep copy of an object.
|
|
723
|
+
*
|
|
724
|
+
* @function Highcharts.merge<T>
|
|
725
|
+
*
|
|
726
|
+
* @param {T} a
|
|
727
|
+
* The first object to extend. When only this is given, the function
|
|
728
|
+
* returns a deep copy.
|
|
729
|
+
*
|
|
730
|
+
* @param {Array<object|undefined>} [...n]
|
|
731
|
+
* An object to merge into the previous one.
|
|
732
|
+
*
|
|
733
|
+
* @return {T}
|
|
734
|
+
* The merged object. If the first argument is true, the return is the
|
|
735
|
+
* same as the second argument.
|
|
736
|
+
*/
|
|
795
737
|
H.merge = function () {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
// Copy the contents of objects, but not arrays or DOM nodes
|
|
809
|
-
if (H.isObject(value, true) &&
|
|
810
|
-
!H.isClass(value) &&
|
|
811
|
-
!H.isDOMElement(value)
|
|
812
|
-
) {
|
|
813
|
-
copy[key] = doCopy(copy[key] || {}, value);
|
|
814
|
-
|
|
738
|
+
/* eslint-enable valid-jsdoc */
|
|
739
|
+
var i, args = arguments, len, ret = {}, doCopy = function (copy, original) {
|
|
740
|
+
// An object is replacing a primitive
|
|
741
|
+
if (typeof copy !== 'object') {
|
|
742
|
+
copy = {};
|
|
743
|
+
}
|
|
744
|
+
H.objectEach(original, function (value, key) {
|
|
745
|
+
// Copy the contents of objects, but not arrays or DOM nodes
|
|
746
|
+
if (H.isObject(value, true) &&
|
|
747
|
+
!H.isClass(value) &&
|
|
748
|
+
!H.isDOMElement(value)) {
|
|
749
|
+
copy[key] = doCopy(copy[key] || {}, value);
|
|
815
750
|
// Primitives and arrays are copied over directly
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
copy[key] = original[key];
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
return copy;
|
|
757
|
+
};
|
|
823
758
|
// If first argument is true, copy into the existing object. Used in
|
|
824
759
|
// setOptions.
|
|
825
760
|
if (args[0] === true) {
|
|
826
761
|
ret = args[1];
|
|
827
762
|
args = Array.prototype.slice.call(args, 2);
|
|
828
763
|
}
|
|
829
|
-
|
|
830
764
|
// For each argument, extend the return
|
|
831
765
|
len = args.length;
|
|
832
766
|
for (i = 0; i < len; i++) {
|
|
833
767
|
ret = doCopy(ret, args[i]);
|
|
834
768
|
}
|
|
835
|
-
|
|
836
769
|
return ret;
|
|
837
770
|
};
|
|
838
|
-
|
|
839
771
|
/**
|
|
840
772
|
* Shortcut for parseInt
|
|
841
773
|
*
|
|
@@ -843,16 +775,17 @@ H.merge = function () {
|
|
|
843
775
|
* @function Highcharts.pInt
|
|
844
776
|
*
|
|
845
777
|
* @param {*} s
|
|
778
|
+
* any
|
|
846
779
|
*
|
|
847
|
-
* @param {number} mag
|
|
780
|
+
* @param {number} [mag]
|
|
848
781
|
* Magnitude
|
|
849
782
|
*
|
|
850
783
|
* @return {number}
|
|
784
|
+
* number
|
|
851
785
|
*/
|
|
852
786
|
H.pInt = function (s, mag) {
|
|
853
787
|
return parseInt(s, mag || 10);
|
|
854
788
|
};
|
|
855
|
-
|
|
856
789
|
/**
|
|
857
790
|
* Utility function to check for string type.
|
|
858
791
|
*
|
|
@@ -867,7 +800,6 @@ H.pInt = function (s, mag) {
|
|
|
867
800
|
H.isString = function (s) {
|
|
868
801
|
return typeof s === 'string';
|
|
869
802
|
};
|
|
870
|
-
|
|
871
803
|
/**
|
|
872
804
|
* Utility function to check if an item is an array.
|
|
873
805
|
*
|
|
@@ -881,10 +813,8 @@ H.isString = function (s) {
|
|
|
881
813
|
*/
|
|
882
814
|
H.isArray = function (obj) {
|
|
883
815
|
var str = Object.prototype.toString.call(obj);
|
|
884
|
-
|
|
885
816
|
return str === '[object Array]' || str === '[object Array Iterator]';
|
|
886
817
|
};
|
|
887
|
-
|
|
888
818
|
/**
|
|
889
819
|
* Utility function to check if an item is of type object.
|
|
890
820
|
*
|
|
@@ -902,7 +832,6 @@ H.isArray = function (obj) {
|
|
|
902
832
|
H.isObject = function (obj, strict) {
|
|
903
833
|
return !!obj && typeof obj === 'object' && (!strict || !H.isArray(obj));
|
|
904
834
|
};
|
|
905
|
-
|
|
906
835
|
/**
|
|
907
836
|
* Utility function to check if an Object is a HTML Element.
|
|
908
837
|
*
|
|
@@ -917,7 +846,6 @@ H.isObject = function (obj, strict) {
|
|
|
917
846
|
H.isDOMElement = function (obj) {
|
|
918
847
|
return H.isObject(obj) && typeof obj.nodeType === 'number';
|
|
919
848
|
};
|
|
920
|
-
|
|
921
849
|
/**
|
|
922
850
|
* Utility function to check if an Object is an class.
|
|
923
851
|
*
|
|
@@ -931,14 +859,10 @@ H.isDOMElement = function (obj) {
|
|
|
931
859
|
*/
|
|
932
860
|
H.isClass = function (obj) {
|
|
933
861
|
var c = obj && obj.constructor;
|
|
934
|
-
|
|
935
|
-
return !!(
|
|
936
|
-
H.isObject(obj, true) &&
|
|
862
|
+
return !!(H.isObject(obj, true) &&
|
|
937
863
|
!H.isDOMElement(obj) &&
|
|
938
|
-
(c && c.name && c.name !== 'Object')
|
|
939
|
-
);
|
|
864
|
+
(c && c.name && c.name !== 'Object'));
|
|
940
865
|
};
|
|
941
|
-
|
|
942
866
|
/**
|
|
943
867
|
* Utility function to check if an item is a number and it is finite (not NaN,
|
|
944
868
|
* Infinity or -Infinity).
|
|
@@ -954,21 +878,21 @@ H.isClass = function (obj) {
|
|
|
954
878
|
H.isNumber = function (n) {
|
|
955
879
|
return typeof n === 'number' && !isNaN(n) && n < Infinity && n > -Infinity;
|
|
956
880
|
};
|
|
957
|
-
|
|
958
881
|
/**
|
|
959
882
|
* Remove the last occurence of an item from an array.
|
|
960
883
|
*
|
|
961
884
|
* @function Highcharts.erase
|
|
962
885
|
*
|
|
963
|
-
* @param {Array} arr
|
|
886
|
+
* @param {Array<*>} arr
|
|
964
887
|
* The array.
|
|
965
888
|
*
|
|
966
889
|
* @param {*} item
|
|
967
890
|
* The item to remove.
|
|
891
|
+
*
|
|
892
|
+
* @return {void}
|
|
968
893
|
*/
|
|
969
894
|
H.erase = function (arr, item) {
|
|
970
895
|
var i = arr.length;
|
|
971
|
-
|
|
972
896
|
while (i--) {
|
|
973
897
|
if (arr[i] === item) {
|
|
974
898
|
arr.splice(i, 1);
|
|
@@ -976,7 +900,6 @@ H.erase = function (arr, item) {
|
|
|
976
900
|
}
|
|
977
901
|
}
|
|
978
902
|
};
|
|
979
|
-
|
|
980
903
|
/**
|
|
981
904
|
* Check if an object is null or undefined.
|
|
982
905
|
*
|
|
@@ -989,9 +912,8 @@ H.erase = function (arr, item) {
|
|
|
989
912
|
* False if the object is null or undefined, otherwise true.
|
|
990
913
|
*/
|
|
991
914
|
H.defined = function (obj) {
|
|
992
|
-
return obj !== undefined && obj !== null;
|
|
915
|
+
return typeof obj !== 'undefined' && obj !== null;
|
|
993
916
|
};
|
|
994
|
-
|
|
995
917
|
/**
|
|
996
918
|
* Set or get an attribute or an object of attributes. To use as a setter, pass
|
|
997
919
|
* a key and a value, or let the second argument be a collection of keys and
|
|
@@ -1005,7 +927,7 @@ H.defined = function (obj) {
|
|
|
1005
927
|
* @param {string|Highcharts.HTMLAttributes|Highcharts.SVGAttributes} [prop]
|
|
1006
928
|
* The property or an object of key-value pairs.
|
|
1007
929
|
*
|
|
1008
|
-
* @param {string} [value]
|
|
930
|
+
* @param {number|string} [value]
|
|
1009
931
|
* The value if a single property is set.
|
|
1010
932
|
*
|
|
1011
933
|
* @return {*}
|
|
@@ -1013,32 +935,29 @@ H.defined = function (obj) {
|
|
|
1013
935
|
*/
|
|
1014
936
|
H.attr = function (elem, prop, value) {
|
|
1015
937
|
var ret;
|
|
1016
|
-
|
|
1017
938
|
// if the prop is a string
|
|
1018
939
|
if (H.isString(prop)) {
|
|
1019
940
|
// set the value
|
|
1020
941
|
if (H.defined(value)) {
|
|
1021
942
|
elem.setAttribute(prop, value);
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
943
|
+
// get the value
|
|
944
|
+
}
|
|
945
|
+
else if (elem && elem.getAttribute) {
|
|
1025
946
|
ret = elem.getAttribute(prop);
|
|
1026
|
-
|
|
1027
947
|
// IE7 and below cannot get class through getAttribute (#7850)
|
|
1028
948
|
if (!ret && prop === 'class') {
|
|
1029
949
|
ret = elem.getAttribute(prop + 'Name');
|
|
1030
950
|
}
|
|
1031
951
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
952
|
+
// else if prop is defined, it is a hash of key/value pairs
|
|
953
|
+
}
|
|
954
|
+
else if (H.defined(prop) && H.isObject(prop)) {
|
|
1035
955
|
H.objectEach(prop, function (val, key) {
|
|
1036
956
|
elem.setAttribute(key, val);
|
|
1037
957
|
});
|
|
1038
958
|
}
|
|
1039
959
|
return ret;
|
|
1040
960
|
};
|
|
1041
|
-
|
|
1042
961
|
/**
|
|
1043
962
|
* Check if an element is an array, and if not, make it into an array.
|
|
1044
963
|
*
|
|
@@ -1053,7 +972,6 @@ H.attr = function (elem, prop, value) {
|
|
|
1053
972
|
H.splat = function (obj) {
|
|
1054
973
|
return H.isArray(obj) ? obj : [obj];
|
|
1055
974
|
};
|
|
1056
|
-
|
|
1057
975
|
/**
|
|
1058
976
|
* Set a timeout if the delay is given, otherwise perform the function
|
|
1059
977
|
* synchronously.
|
|
@@ -1063,13 +981,13 @@ H.splat = function (obj) {
|
|
|
1063
981
|
* @param {Function} fn
|
|
1064
982
|
* The function callback.
|
|
1065
983
|
*
|
|
1066
|
-
* @param {number} delay
|
|
984
|
+
* @param {number} [delay]
|
|
1067
985
|
* Delay in milliseconds.
|
|
1068
986
|
*
|
|
1069
|
-
* @param {*} [
|
|
1070
|
-
* An optional
|
|
987
|
+
* @param {*} [context]
|
|
988
|
+
* An optional context to send to the function callback.
|
|
1071
989
|
*
|
|
1072
|
-
* @return {number}
|
|
990
|
+
* @return {number|undefined}
|
|
1073
991
|
* An identifier for the timeout that can later be cleared with
|
|
1074
992
|
* Highcharts.clearTimeout.
|
|
1075
993
|
*/
|
|
@@ -1079,7 +997,6 @@ H.syncTimeout = function (fn, delay, context) {
|
|
|
1079
997
|
}
|
|
1080
998
|
fn.call(0, context);
|
|
1081
999
|
};
|
|
1082
|
-
|
|
1083
1000
|
/**
|
|
1084
1001
|
* Internal clear timeout. The function checks that the `id` was not removed
|
|
1085
1002
|
* (e.g. by `chart.destroy()`). For the details see
|
|
@@ -1089,40 +1006,40 @@ H.syncTimeout = function (fn, delay, context) {
|
|
|
1089
1006
|
*
|
|
1090
1007
|
* @param {number} id
|
|
1091
1008
|
* Id of a timeout.
|
|
1009
|
+
*
|
|
1010
|
+
* @return {void}
|
|
1092
1011
|
*/
|
|
1093
1012
|
H.clearTimeout = function (id) {
|
|
1094
1013
|
if (H.defined(id)) {
|
|
1095
1014
|
clearTimeout(id);
|
|
1096
1015
|
}
|
|
1097
1016
|
};
|
|
1098
|
-
|
|
1017
|
+
/* eslint-disable valid-jsdoc */
|
|
1099
1018
|
/**
|
|
1100
1019
|
* Utility function to extend an object with the members of another.
|
|
1101
1020
|
*
|
|
1102
|
-
* @function Highcharts.extend
|
|
1021
|
+
* @function Highcharts.extend<T>
|
|
1103
1022
|
*
|
|
1104
|
-
* @param {
|
|
1023
|
+
* @param {T} a
|
|
1105
1024
|
* The object to be extended.
|
|
1106
1025
|
*
|
|
1107
|
-
* @param {
|
|
1026
|
+
* @param {object} b
|
|
1108
1027
|
* The object to add to the first one.
|
|
1109
1028
|
*
|
|
1110
|
-
* @return {
|
|
1029
|
+
* @return {T}
|
|
1111
1030
|
* Object a, the original object.
|
|
1112
1031
|
*/
|
|
1113
1032
|
H.extend = function (a, b) {
|
|
1033
|
+
/* eslint-enable valid-jsdoc */
|
|
1114
1034
|
var n;
|
|
1115
|
-
|
|
1116
1035
|
if (!a) {
|
|
1117
1036
|
a = {};
|
|
1118
1037
|
}
|
|
1119
|
-
for (n in b) {
|
|
1038
|
+
for (n in b) { // eslint-disable-line guard-for-in
|
|
1120
1039
|
a[n] = b[n];
|
|
1121
1040
|
}
|
|
1122
1041
|
return a;
|
|
1123
1042
|
};
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
1043
|
/**
|
|
1127
1044
|
* Return the first value that is not null or undefined.
|
|
1128
1045
|
*
|
|
@@ -1135,39 +1052,36 @@ H.extend = function (a, b) {
|
|
|
1135
1052
|
* The value of the first argument that is not null or undefined.
|
|
1136
1053
|
*/
|
|
1137
1054
|
H.pick = function () {
|
|
1138
|
-
var args = arguments,
|
|
1139
|
-
i,
|
|
1140
|
-
arg,
|
|
1141
|
-
length = args.length;
|
|
1142
|
-
|
|
1055
|
+
var args = arguments, i, arg, length = args.length;
|
|
1143
1056
|
for (i = 0; i < length; i++) {
|
|
1144
1057
|
arg = args[i];
|
|
1145
|
-
if (arg !== undefined && arg !== null) {
|
|
1058
|
+
if (typeof arg !== 'undefined' && arg !== null) {
|
|
1146
1059
|
return arg;
|
|
1147
1060
|
}
|
|
1148
1061
|
}
|
|
1149
1062
|
};
|
|
1150
|
-
|
|
1151
1063
|
/**
|
|
1152
1064
|
* Set CSS on a given element.
|
|
1153
1065
|
*
|
|
1154
1066
|
* @function Highcharts.css
|
|
1155
1067
|
*
|
|
1156
|
-
* @param {Highcharts.HTMLDOMElement} el
|
|
1068
|
+
* @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} el
|
|
1157
1069
|
* An HTML DOM element.
|
|
1158
1070
|
*
|
|
1159
1071
|
* @param {Highcharts.CSSObject} styles
|
|
1160
1072
|
* Style object with camel case property names.
|
|
1073
|
+
*
|
|
1074
|
+
* @return {void}
|
|
1161
1075
|
*/
|
|
1162
1076
|
H.css = function (el, styles) {
|
|
1163
1077
|
if (H.isMS && !H.svg) { // #2686
|
|
1164
|
-
if (styles && styles.opacity !== undefined) {
|
|
1165
|
-
styles.filter =
|
|
1078
|
+
if (styles && typeof styles.opacity !== 'undefined') {
|
|
1079
|
+
styles.filter =
|
|
1080
|
+
'alpha(opacity=' + (styles.opacity * 100) + ')';
|
|
1166
1081
|
}
|
|
1167
1082
|
}
|
|
1168
1083
|
H.extend(el.style, styles);
|
|
1169
1084
|
};
|
|
1170
|
-
|
|
1171
1085
|
/**
|
|
1172
1086
|
* Utility function to create an HTML element with attributes and styles.
|
|
1173
1087
|
*
|
|
@@ -1192,14 +1106,12 @@ H.css = function (el, styles) {
|
|
|
1192
1106
|
* The created DOM element.
|
|
1193
1107
|
*/
|
|
1194
1108
|
H.createElement = function (tag, attribs, styles, parent, nopad) {
|
|
1195
|
-
var el = doc.createElement(tag),
|
|
1196
|
-
css = H.css;
|
|
1197
|
-
|
|
1109
|
+
var el = doc.createElement(tag), css = H.css;
|
|
1198
1110
|
if (attribs) {
|
|
1199
1111
|
H.extend(el, attribs);
|
|
1200
1112
|
}
|
|
1201
1113
|
if (nopad) {
|
|
1202
|
-
css(el, { padding: 0, border: 'none', margin: 0 });
|
|
1114
|
+
css(el, { padding: '0', border: 'none', margin: '0' });
|
|
1203
1115
|
}
|
|
1204
1116
|
if (styles) {
|
|
1205
1117
|
css(el, styles);
|
|
@@ -1209,7 +1121,6 @@ H.createElement = function (tag, attribs, styles, parent, nopad) {
|
|
|
1209
1121
|
}
|
|
1210
1122
|
return el;
|
|
1211
1123
|
};
|
|
1212
|
-
|
|
1213
1124
|
/**
|
|
1214
1125
|
* Extend a prototyped class by new members.
|
|
1215
1126
|
*
|
|
@@ -1226,13 +1137,11 @@ H.createElement = function (tag, attribs, styles, parent, nopad) {
|
|
|
1226
1137
|
* A new prototype.
|
|
1227
1138
|
*/
|
|
1228
1139
|
H.extendClass = function (parent, members) {
|
|
1229
|
-
var object = function () {};
|
|
1230
|
-
|
|
1140
|
+
var object = function () { };
|
|
1231
1141
|
object.prototype = new parent(); // eslint-disable-line new-cap
|
|
1232
1142
|
H.extend(object.prototype, members);
|
|
1233
1143
|
return object;
|
|
1234
1144
|
};
|
|
1235
|
-
|
|
1236
1145
|
/**
|
|
1237
1146
|
* Left-pad a string to a given length by adding a character repetetively.
|
|
1238
1147
|
*
|
|
@@ -1241,7 +1150,7 @@ H.extendClass = function (parent, members) {
|
|
|
1241
1150
|
* @param {number} number
|
|
1242
1151
|
* The input string or number.
|
|
1243
1152
|
*
|
|
1244
|
-
* @param {number} length
|
|
1153
|
+
* @param {number} [length]
|
|
1245
1154
|
* The desired string length.
|
|
1246
1155
|
*
|
|
1247
1156
|
* @param {string} [padder=0]
|
|
@@ -1251,15 +1160,12 @@ H.extendClass = function (parent, members) {
|
|
|
1251
1160
|
* The padded string.
|
|
1252
1161
|
*/
|
|
1253
1162
|
H.pad = function (number, length, padder) {
|
|
1254
|
-
return new Array(
|
|
1255
|
-
(length || 2) +
|
|
1163
|
+
return new Array((length || 2) +
|
|
1256
1164
|
1 -
|
|
1257
1165
|
String(number)
|
|
1258
1166
|
.replace('-', '')
|
|
1259
|
-
.length
|
|
1260
|
-
).join(padder || 0) + number;
|
|
1167
|
+
.length).join(padder || '0') + number;
|
|
1261
1168
|
};
|
|
1262
|
-
|
|
1263
1169
|
/**
|
|
1264
1170
|
* Return a length based on either the integer value, or a percentage of a base.
|
|
1265
1171
|
*
|
|
@@ -1283,7 +1189,6 @@ H.relativeLength = function (value, base, offset) {
|
|
|
1283
1189
|
(base * parseFloat(value) / 100) + (offset || 0) :
|
|
1284
1190
|
parseFloat(value);
|
|
1285
1191
|
};
|
|
1286
|
-
|
|
1287
1192
|
/**
|
|
1288
1193
|
* Wrap a method with extended functionality, preserving the original function.
|
|
1289
1194
|
*
|
|
@@ -1300,16 +1205,13 @@ H.relativeLength = function (value, base, offset) {
|
|
|
1300
1205
|
* A wrapper function callback. This function is called with the same
|
|
1301
1206
|
* arguments as the original function, except that the original function
|
|
1302
1207
|
* is unshifted and passed as the first argument.
|
|
1208
|
+
*
|
|
1209
|
+
* @return {void}
|
|
1303
1210
|
*/
|
|
1304
1211
|
H.wrap = function (obj, method, func) {
|
|
1305
1212
|
var proceed = obj[method];
|
|
1306
|
-
|
|
1307
1213
|
obj[method] = function () {
|
|
1308
|
-
var args = Array.prototype.slice.call(arguments),
|
|
1309
|
-
outerArgs = arguments,
|
|
1310
|
-
ctx = this,
|
|
1311
|
-
ret;
|
|
1312
|
-
|
|
1214
|
+
var args = Array.prototype.slice.call(arguments), outerArgs = arguments, ctx = this, ret;
|
|
1313
1215
|
ctx.proceed = function () {
|
|
1314
1216
|
proceed.apply(ctx, arguments.length ? arguments : outerArgs);
|
|
1315
1217
|
};
|
|
@@ -1319,23 +1221,26 @@ H.wrap = function (obj, method, func) {
|
|
|
1319
1221
|
return ret;
|
|
1320
1222
|
};
|
|
1321
1223
|
};
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
1224
|
/**
|
|
1325
1225
|
* Recursively converts all Date properties to timestamps.
|
|
1326
1226
|
*
|
|
1327
|
-
* @
|
|
1227
|
+
* @private
|
|
1228
|
+
* @function Highcharts.datePropsToTimestamps
|
|
1229
|
+
*
|
|
1230
|
+
* @param {any} object - any object to convert properties of
|
|
1231
|
+
*
|
|
1232
|
+
* @return {void}
|
|
1328
1233
|
*/
|
|
1329
1234
|
H.datePropsToTimestamps = function (object) {
|
|
1330
1235
|
H.objectEach(object, function (val, key) {
|
|
1331
1236
|
if (H.isObject(val) && typeof val.getTime === 'function') {
|
|
1332
1237
|
object[key] = val.getTime();
|
|
1333
|
-
}
|
|
1238
|
+
}
|
|
1239
|
+
else if (H.isObject(val) || H.isArray(val)) {
|
|
1334
1240
|
H.datePropsToTimestamps(val);
|
|
1335
1241
|
}
|
|
1336
1242
|
});
|
|
1337
1243
|
};
|
|
1338
|
-
|
|
1339
1244
|
/**
|
|
1340
1245
|
* Format a single variable. Similar to sprintf, without the % prefix.
|
|
1341
1246
|
*
|
|
@@ -1358,28 +1263,19 @@ H.datePropsToTimestamps = function (object) {
|
|
|
1358
1263
|
* The formatted representation of the value.
|
|
1359
1264
|
*/
|
|
1360
1265
|
H.formatSingle = function (format, val, time) {
|
|
1361
|
-
var floatRegex = /f$/,
|
|
1362
|
-
decRegex = /\.([0-9])/,
|
|
1363
|
-
lang = H.defaultOptions.lang,
|
|
1364
|
-
decimals;
|
|
1365
|
-
|
|
1266
|
+
var floatRegex = /f$/, decRegex = /\.([0-9])/, lang = H.defaultOptions.lang, decimals;
|
|
1366
1267
|
if (floatRegex.test(format)) { // float
|
|
1367
1268
|
decimals = format.match(decRegex);
|
|
1368
1269
|
decimals = decimals ? decimals[1] : -1;
|
|
1369
1270
|
if (val !== null) {
|
|
1370
|
-
val = H.numberFormat(
|
|
1371
|
-
val,
|
|
1372
|
-
decimals,
|
|
1373
|
-
lang.decimalPoint,
|
|
1374
|
-
format.indexOf(',') > -1 ? lang.thousandsSep : ''
|
|
1375
|
-
);
|
|
1271
|
+
val = H.numberFormat(val, decimals, lang.decimalPoint, format.indexOf(',') > -1 ? lang.thousandsSep : '');
|
|
1376
1272
|
}
|
|
1377
|
-
}
|
|
1273
|
+
}
|
|
1274
|
+
else {
|
|
1378
1275
|
val = (time || H.time).dateFormat(format, val);
|
|
1379
1276
|
}
|
|
1380
1277
|
return val;
|
|
1381
1278
|
};
|
|
1382
|
-
|
|
1383
1279
|
/**
|
|
1384
1280
|
* Format a string according to a subset of the rules of Python's String.format
|
|
1385
1281
|
* method.
|
|
@@ -1408,49 +1304,34 @@ H.formatSingle = function (format, val, time) {
|
|
|
1408
1304
|
* The formatted string.
|
|
1409
1305
|
*/
|
|
1410
1306
|
H.format = function (str, ctx, time) {
|
|
1411
|
-
var splitter = '{',
|
|
1412
|
-
isInside = false,
|
|
1413
|
-
segment,
|
|
1414
|
-
valueAndFormat,
|
|
1415
|
-
path,
|
|
1416
|
-
i,
|
|
1417
|
-
len,
|
|
1418
|
-
ret = [],
|
|
1419
|
-
val,
|
|
1420
|
-
index;
|
|
1421
|
-
|
|
1307
|
+
var splitter = '{', isInside = false, segment, valueAndFormat, path, i, len, ret = [], val, index;
|
|
1422
1308
|
while (str) {
|
|
1423
1309
|
index = str.indexOf(splitter);
|
|
1424
1310
|
if (index === -1) {
|
|
1425
1311
|
break;
|
|
1426
1312
|
}
|
|
1427
|
-
|
|
1428
1313
|
segment = str.slice(0, index);
|
|
1429
1314
|
if (isInside) { // we're on the closing bracket looking back
|
|
1430
|
-
|
|
1431
1315
|
valueAndFormat = segment.split(':');
|
|
1432
|
-
|
|
1316
|
+
// get first and leave
|
|
1317
|
+
path = valueAndFormat.shift().split('.');
|
|
1433
1318
|
len = path.length;
|
|
1434
1319
|
val = ctx;
|
|
1435
|
-
|
|
1436
1320
|
// Assign deeper paths
|
|
1437
1321
|
for (i = 0; i < len; i++) {
|
|
1438
1322
|
if (val) {
|
|
1439
1323
|
val = val[path[i]];
|
|
1440
1324
|
}
|
|
1441
1325
|
}
|
|
1442
|
-
|
|
1443
1326
|
// Format the replacement
|
|
1444
1327
|
if (valueAndFormat.length) {
|
|
1445
1328
|
val = H.formatSingle(valueAndFormat.join(':'), val, time);
|
|
1446
1329
|
}
|
|
1447
|
-
|
|
1448
1330
|
// Push the result and advance the cursor
|
|
1449
1331
|
ret.push(val);
|
|
1450
|
-
|
|
1451
|
-
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1452
1334
|
ret.push(segment);
|
|
1453
|
-
|
|
1454
1335
|
}
|
|
1455
1336
|
str = str.slice(index + 1); // the rest
|
|
1456
1337
|
isInside = !isInside; // toggle
|
|
@@ -1459,13 +1340,12 @@ H.format = function (str, ctx, time) {
|
|
|
1459
1340
|
ret.push(str);
|
|
1460
1341
|
return ret.join('');
|
|
1461
1342
|
};
|
|
1462
|
-
|
|
1463
1343
|
/**
|
|
1464
1344
|
* Get the magnitude of a number.
|
|
1465
1345
|
*
|
|
1466
1346
|
* @function Highcharts.getMagnitude
|
|
1467
1347
|
*
|
|
1468
|
-
* @param {number}
|
|
1348
|
+
* @param {number} num
|
|
1469
1349
|
* The number.
|
|
1470
1350
|
*
|
|
1471
1351
|
* @return {number}
|
|
@@ -1474,7 +1354,6 @@ H.format = function (str, ctx, time) {
|
|
|
1474
1354
|
H.getMagnitude = function (num) {
|
|
1475
1355
|
return Math.pow(10, Math.floor(Math.log(num) / Math.LN10));
|
|
1476
1356
|
};
|
|
1477
|
-
|
|
1478
1357
|
/**
|
|
1479
1358
|
* Take an interval and normalize it to multiples of round numbers.
|
|
1480
1359
|
*
|
|
@@ -1484,7 +1363,7 @@ H.getMagnitude = function (num) {
|
|
|
1484
1363
|
* @param {number} interval
|
|
1485
1364
|
* The raw, un-rounded interval.
|
|
1486
1365
|
*
|
|
1487
|
-
* @param {Array} [multiples]
|
|
1366
|
+
* @param {Array<*>} [multiples]
|
|
1488
1367
|
* Allowed multiples.
|
|
1489
1368
|
*
|
|
1490
1369
|
* @param {number} [magnitude]
|
|
@@ -1504,116 +1383,81 @@ H.getMagnitude = function (num) {
|
|
|
1504
1383
|
* Move this function to the Axis prototype. It is here only for historical
|
|
1505
1384
|
* reasons.
|
|
1506
1385
|
*/
|
|
1507
|
-
H.normalizeTickInterval = function (
|
|
1508
|
-
interval
|
|
1509
|
-
multiples,
|
|
1510
|
-
magnitude,
|
|
1511
|
-
allowDecimals,
|
|
1512
|
-
hasTickAmount
|
|
1513
|
-
) {
|
|
1514
|
-
var normalized,
|
|
1515
|
-
i,
|
|
1516
|
-
retInterval = interval;
|
|
1517
|
-
|
|
1386
|
+
H.normalizeTickInterval = function (interval, multiples, magnitude, allowDecimals, hasTickAmount) {
|
|
1387
|
+
var normalized, i, retInterval = interval;
|
|
1518
1388
|
// round to a tenfold of 1, 2, 2.5 or 5
|
|
1519
1389
|
magnitude = H.pick(magnitude, 1);
|
|
1520
1390
|
normalized = interval / magnitude;
|
|
1521
|
-
|
|
1522
1391
|
// multiples for a linear scale
|
|
1523
1392
|
if (!multiples) {
|
|
1524
1393
|
multiples = hasTickAmount ?
|
|
1525
1394
|
// Finer grained ticks when the tick amount is hard set, including
|
|
1526
1395
|
// when alignTicks is true on multiple axes (#4580).
|
|
1527
1396
|
[1, 1.2, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10] :
|
|
1528
|
-
|
|
1529
1397
|
// Else, let ticks fall on rounder numbers
|
|
1530
1398
|
[1, 2, 2.5, 5, 10];
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
1399
|
// the allowDecimals option
|
|
1534
1400
|
if (allowDecimals === false) {
|
|
1535
1401
|
if (magnitude === 1) {
|
|
1536
1402
|
multiples = multiples.filter(function (num) {
|
|
1537
1403
|
return num % 1 === 0;
|
|
1538
1404
|
});
|
|
1539
|
-
}
|
|
1405
|
+
}
|
|
1406
|
+
else if (magnitude <= 0.1) {
|
|
1540
1407
|
multiples = [1 / magnitude];
|
|
1541
1408
|
}
|
|
1542
1409
|
}
|
|
1543
1410
|
}
|
|
1544
|
-
|
|
1545
1411
|
// normalize the interval to the nearest multiple
|
|
1546
1412
|
for (i = 0; i < multiples.length; i++) {
|
|
1547
1413
|
retInterval = multiples[i];
|
|
1548
1414
|
// only allow tick amounts smaller than natural
|
|
1549
|
-
if (
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
!hasTickAmount &&
|
|
1556
|
-
(
|
|
1557
|
-
normalized <=
|
|
1558
|
-
(
|
|
1559
|
-
multiples[i] +
|
|
1560
|
-
(multiples[i + 1] || multiples[i])
|
|
1561
|
-
) / 2
|
|
1562
|
-
)
|
|
1563
|
-
)
|
|
1564
|
-
) {
|
|
1415
|
+
if ((hasTickAmount &&
|
|
1416
|
+
retInterval * magnitude >= interval) ||
|
|
1417
|
+
(!hasTickAmount &&
|
|
1418
|
+
(normalized <=
|
|
1419
|
+
(multiples[i] +
|
|
1420
|
+
(multiples[i + 1] || multiples[i])) / 2))) {
|
|
1565
1421
|
break;
|
|
1566
1422
|
}
|
|
1567
1423
|
}
|
|
1568
|
-
|
|
1569
1424
|
// Multiply back to the correct magnitude. Correct floats to appropriate
|
|
1570
1425
|
// precision (#6085).
|
|
1571
|
-
retInterval = H.correctFloat(
|
|
1572
|
-
retInterval * magnitude,
|
|
1573
|
-
-Math.round(Math.log(0.001) / Math.LN10)
|
|
1574
|
-
);
|
|
1575
|
-
|
|
1426
|
+
retInterval = H.correctFloat(retInterval * magnitude, -Math.round(Math.log(0.001) / Math.LN10));
|
|
1576
1427
|
return retInterval;
|
|
1577
1428
|
};
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
1429
|
/**
|
|
1581
1430
|
* Sort an object array and keep the order of equal items. The ECMAScript
|
|
1582
1431
|
* standard does not specify the behaviour when items are equal.
|
|
1583
1432
|
*
|
|
1584
1433
|
* @function Highcharts.stableSort
|
|
1585
1434
|
*
|
|
1586
|
-
* @param {Array} arr
|
|
1435
|
+
* @param {Array<*>} arr
|
|
1587
1436
|
* The array to sort.
|
|
1588
1437
|
*
|
|
1589
1438
|
* @param {Function} sortFunction
|
|
1590
1439
|
* The function to sort it with, like with regular Array.prototype.sort.
|
|
1440
|
+
*
|
|
1441
|
+
* @return {void}
|
|
1591
1442
|
*/
|
|
1592
1443
|
H.stableSort = function (arr, sortFunction) {
|
|
1593
|
-
|
|
1594
1444
|
// @todo It seems like Chrome since v70 sorts in a stable way internally,
|
|
1595
1445
|
// plus all other browsers do it, so over time we may be able to remove this
|
|
1596
1446
|
// function
|
|
1597
|
-
var length = arr.length,
|
|
1598
|
-
sortValue,
|
|
1599
|
-
i;
|
|
1600
|
-
|
|
1447
|
+
var length = arr.length, sortValue, i;
|
|
1601
1448
|
// Add index to each item
|
|
1602
1449
|
for (i = 0; i < length; i++) {
|
|
1603
1450
|
arr[i].safeI = i; // stable sort index
|
|
1604
1451
|
}
|
|
1605
|
-
|
|
1606
1452
|
arr.sort(function (a, b) {
|
|
1607
1453
|
sortValue = sortFunction(a, b);
|
|
1608
1454
|
return sortValue === 0 ? a.safeI - b.safeI : sortValue;
|
|
1609
1455
|
});
|
|
1610
|
-
|
|
1611
1456
|
// Remove index from items
|
|
1612
1457
|
for (i = 0; i < length; i++) {
|
|
1613
1458
|
delete arr[i].safeI; // stable sort index
|
|
1614
1459
|
}
|
|
1615
1460
|
};
|
|
1616
|
-
|
|
1617
1461
|
/**
|
|
1618
1462
|
* Non-recursive method to find the lowest member of an array. `Math.min` raises
|
|
1619
1463
|
* a maximum call stack size exceeded error in Chrome when trying to apply more
|
|
@@ -1621,16 +1465,14 @@ H.stableSort = function (arr, sortFunction) {
|
|
|
1621
1465
|
*
|
|
1622
1466
|
* @function Highcharts.arrayMin
|
|
1623
1467
|
*
|
|
1624
|
-
* @param {Array} data
|
|
1468
|
+
* @param {Array<*>} data
|
|
1625
1469
|
* An array of numbers.
|
|
1626
1470
|
*
|
|
1627
1471
|
* @return {number}
|
|
1628
1472
|
* The lowest number.
|
|
1629
1473
|
*/
|
|
1630
1474
|
H.arrayMin = function (data) {
|
|
1631
|
-
var i = data.length,
|
|
1632
|
-
min = data[0];
|
|
1633
|
-
|
|
1475
|
+
var i = data.length, min = data[0];
|
|
1634
1476
|
while (i--) {
|
|
1635
1477
|
if (data[i] < min) {
|
|
1636
1478
|
min = data[i];
|
|
@@ -1638,7 +1480,6 @@ H.arrayMin = function (data) {
|
|
|
1638
1480
|
}
|
|
1639
1481
|
return min;
|
|
1640
1482
|
};
|
|
1641
|
-
|
|
1642
1483
|
/**
|
|
1643
1484
|
* Non-recursive method to find the lowest member of an array. `Math.max` raises
|
|
1644
1485
|
* a maximum call stack size exceeded error in Chrome when trying to apply more
|
|
@@ -1646,16 +1487,14 @@ H.arrayMin = function (data) {
|
|
|
1646
1487
|
*
|
|
1647
1488
|
* @function Highcharts.arrayMax
|
|
1648
1489
|
*
|
|
1649
|
-
* @param {Array} data
|
|
1490
|
+
* @param {Array<*>} data
|
|
1650
1491
|
* An array of numbers.
|
|
1651
1492
|
*
|
|
1652
1493
|
* @return {number}
|
|
1653
1494
|
* The highest number.
|
|
1654
1495
|
*/
|
|
1655
1496
|
H.arrayMax = function (data) {
|
|
1656
|
-
var i = data.length,
|
|
1657
|
-
max = data[0];
|
|
1658
|
-
|
|
1497
|
+
var i = data.length, max = data[0];
|
|
1659
1498
|
while (i--) {
|
|
1660
1499
|
if (data[i] > max) {
|
|
1661
1500
|
max = data[i];
|
|
@@ -1663,7 +1502,6 @@ H.arrayMax = function (data) {
|
|
|
1663
1502
|
}
|
|
1664
1503
|
return max;
|
|
1665
1504
|
};
|
|
1666
|
-
|
|
1667
1505
|
/**
|
|
1668
1506
|
* Utility method that destroys any SVGElement instances that are properties on
|
|
1669
1507
|
* the given object. It loops all properties and invokes destroy if there is a
|
|
@@ -1676,6 +1514,8 @@ H.arrayMax = function (data) {
|
|
|
1676
1514
|
*
|
|
1677
1515
|
* @param {*} [except]
|
|
1678
1516
|
* Exception, do not destroy this property, only delete it.
|
|
1517
|
+
*
|
|
1518
|
+
* @return {void}
|
|
1679
1519
|
*/
|
|
1680
1520
|
H.destroyObjectProperties = function (obj, except) {
|
|
1681
1521
|
H.objectEach(obj, function (val, n) {
|
|
@@ -1684,13 +1524,10 @@ H.destroyObjectProperties = function (obj, except) {
|
|
|
1684
1524
|
// Invoke the destroy
|
|
1685
1525
|
val.destroy();
|
|
1686
1526
|
}
|
|
1687
|
-
|
|
1688
1527
|
// Delete the property from the object.
|
|
1689
1528
|
delete obj[n];
|
|
1690
1529
|
});
|
|
1691
1530
|
};
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
1531
|
/**
|
|
1695
1532
|
* Discard a HTML element by moving it to the bin and delete.
|
|
1696
1533
|
*
|
|
@@ -1698,22 +1535,21 @@ H.destroyObjectProperties = function (obj, except) {
|
|
|
1698
1535
|
*
|
|
1699
1536
|
* @param {Highcharts.HTMLDOMElement} element
|
|
1700
1537
|
* The HTML node to discard.
|
|
1538
|
+
*
|
|
1539
|
+
* @return {void}
|
|
1701
1540
|
*/
|
|
1702
1541
|
H.discardElement = function (element) {
|
|
1703
1542
|
var garbageBin = H.garbageBin;
|
|
1704
|
-
|
|
1705
1543
|
// create a garbage bin element, not part of the DOM
|
|
1706
1544
|
if (!garbageBin) {
|
|
1707
1545
|
garbageBin = H.createElement('div');
|
|
1708
1546
|
}
|
|
1709
|
-
|
|
1710
1547
|
// move the node and empty bin
|
|
1711
1548
|
if (element) {
|
|
1712
1549
|
garbageBin.appendChild(element);
|
|
1713
1550
|
}
|
|
1714
1551
|
garbageBin.innerHTML = '';
|
|
1715
1552
|
};
|
|
1716
|
-
|
|
1717
1553
|
/**
|
|
1718
1554
|
* Fix JS round off float errors.
|
|
1719
1555
|
*
|
|
@@ -1729,42 +1565,36 @@ H.discardElement = function (element) {
|
|
|
1729
1565
|
* The corrected float number.
|
|
1730
1566
|
*/
|
|
1731
1567
|
H.correctFloat = function (num, prec) {
|
|
1732
|
-
return parseFloat(
|
|
1733
|
-
num.toPrecision(prec || 14)
|
|
1734
|
-
);
|
|
1568
|
+
return parseFloat(num.toPrecision(prec || 14));
|
|
1735
1569
|
};
|
|
1736
|
-
|
|
1737
1570
|
/**
|
|
1738
1571
|
* Set the global animation to either a given value, or fall back to the given
|
|
1739
1572
|
* chart's animation option.
|
|
1740
1573
|
*
|
|
1741
1574
|
* @function Highcharts.setAnimation
|
|
1742
1575
|
*
|
|
1743
|
-
* @param {boolean|Highcharts.AnimationOptionsObject} animation
|
|
1576
|
+
* @param {boolean|Highcharts.AnimationOptionsObject|undefined} animation
|
|
1744
1577
|
* The animation object.
|
|
1745
1578
|
*
|
|
1746
1579
|
* @param {Highcharts.Chart} chart
|
|
1747
1580
|
* The chart instance.
|
|
1748
1581
|
*
|
|
1582
|
+
* @return {void}
|
|
1583
|
+
*
|
|
1749
1584
|
* @todo
|
|
1750
1585
|
* This function always relates to a chart, and sets a property on the renderer,
|
|
1751
1586
|
* so it should be moved to the SVGRenderer.
|
|
1752
1587
|
*/
|
|
1753
1588
|
H.setAnimation = function (animation, chart) {
|
|
1754
|
-
chart.renderer.globalAnimation = H.pick(
|
|
1755
|
-
animation,
|
|
1756
|
-
chart.options.chart.animation,
|
|
1757
|
-
true
|
|
1758
|
-
);
|
|
1589
|
+
chart.renderer.globalAnimation = H.pick(animation, chart.options.chart.animation, true);
|
|
1759
1590
|
};
|
|
1760
|
-
|
|
1761
1591
|
/**
|
|
1762
1592
|
* Get the animation in object form, where a disabled animation is always
|
|
1763
1593
|
* returned as `{ duration: 0 }`.
|
|
1764
1594
|
*
|
|
1765
1595
|
* @function Highcharts.animObject
|
|
1766
1596
|
*
|
|
1767
|
-
* @param {boolean|Highcharts.AnimationOptionsObject} animation
|
|
1597
|
+
* @param {boolean|Highcharts.AnimationOptionsObject} [animation=0]
|
|
1768
1598
|
* An animation setting. Can be an object with duration, complete and
|
|
1769
1599
|
* easing properties, or a boolean to enable or disable.
|
|
1770
1600
|
*
|
|
@@ -1776,7 +1606,6 @@ H.animObject = function (animation) {
|
|
|
1776
1606
|
H.merge(animation) :
|
|
1777
1607
|
{ duration: animation ? 500 : 0 };
|
|
1778
1608
|
};
|
|
1779
|
-
|
|
1780
1609
|
/**
|
|
1781
1610
|
* The time unit lookup
|
|
1782
1611
|
*
|
|
@@ -1792,7 +1621,6 @@ H.timeUnits = {
|
|
|
1792
1621
|
month: 28 * 24 * 3600000,
|
|
1793
1622
|
year: 364 * 24 * 3600000
|
|
1794
1623
|
};
|
|
1795
|
-
|
|
1796
1624
|
/**
|
|
1797
1625
|
* Format a number and return a string based on input settings.
|
|
1798
1626
|
*
|
|
@@ -1822,22 +1650,15 @@ H.timeUnits = {
|
|
|
1822
1650
|
H.numberFormat = function (number, decimals, decimalPoint, thousandsSep) {
|
|
1823
1651
|
number = +number || 0;
|
|
1824
1652
|
decimals = +decimals;
|
|
1825
|
-
|
|
1826
|
-
var lang = H.defaultOptions.lang,
|
|
1827
|
-
origDec = (number.toString().split('.')[1] || '').split('e')[0].length,
|
|
1828
|
-
strinteger,
|
|
1829
|
-
thousands,
|
|
1830
|
-
ret,
|
|
1831
|
-
roundedNumber,
|
|
1832
|
-
exponent = number.toString().split('e'),
|
|
1833
|
-
fractionDigits;
|
|
1834
|
-
|
|
1653
|
+
var lang = H.defaultOptions.lang, origDec = (number.toString().split('.')[1] || '').split('e')[0].length, strinteger, thousands, ret, roundedNumber, exponent = number.toString().split('e'), fractionDigits;
|
|
1835
1654
|
if (decimals === -1) {
|
|
1836
1655
|
// Preserve decimals. Not huge numbers (#3793).
|
|
1837
1656
|
decimals = Math.min(origDec, 20);
|
|
1838
|
-
}
|
|
1657
|
+
}
|
|
1658
|
+
else if (!H.isNumber(decimals)) {
|
|
1839
1659
|
decimals = 2;
|
|
1840
|
-
}
|
|
1660
|
+
}
|
|
1661
|
+
else if (decimals && exponent[1] && exponent[1] < 0) {
|
|
1841
1662
|
// Expose decimals from exponential notation (#7042)
|
|
1842
1663
|
fractionDigits = decimals + +exponent[1];
|
|
1843
1664
|
if (fractionDigits >= 0) {
|
|
@@ -1845,64 +1666,52 @@ H.numberFormat = function (number, decimals, decimalPoint, thousandsSep) {
|
|
|
1845
1666
|
exponent[0] = (+exponent[0]).toExponential(fractionDigits)
|
|
1846
1667
|
.split('e')[0];
|
|
1847
1668
|
decimals = fractionDigits;
|
|
1848
|
-
}
|
|
1669
|
+
}
|
|
1670
|
+
else {
|
|
1849
1671
|
// fractionDigits < 0
|
|
1850
1672
|
exponent[0] = exponent[0].split('.')[0] || 0;
|
|
1851
|
-
|
|
1852
1673
|
if (decimals < 20) {
|
|
1853
1674
|
// use number instead of exponential notation (#7405)
|
|
1854
1675
|
number = (exponent[0] * Math.pow(10, exponent[1]))
|
|
1855
1676
|
.toFixed(decimals);
|
|
1856
|
-
}
|
|
1677
|
+
}
|
|
1678
|
+
else {
|
|
1857
1679
|
// or zero
|
|
1858
1680
|
number = 0;
|
|
1859
1681
|
}
|
|
1860
1682
|
exponent[1] = 0;
|
|
1861
1683
|
}
|
|
1862
1684
|
}
|
|
1863
|
-
|
|
1864
1685
|
// Add another decimal to avoid rounding errors of float numbers. (#4573)
|
|
1865
1686
|
// Then use toFixed to handle rounding.
|
|
1866
|
-
roundedNumber = (
|
|
1867
|
-
Math.
|
|
1868
|
-
Math.pow(10, -Math.max(decimals, origDec) - 1)
|
|
1869
|
-
).toFixed(decimals);
|
|
1870
|
-
|
|
1687
|
+
roundedNumber = (Math.abs(exponent[1] ? exponent[0] : number) +
|
|
1688
|
+
Math.pow(10, -Math.max(decimals, origDec) - 1)).toFixed(decimals);
|
|
1871
1689
|
// A string containing the positive integer component of the number
|
|
1872
1690
|
strinteger = String(H.pInt(roundedNumber));
|
|
1873
|
-
|
|
1874
1691
|
// Leftover after grouping into thousands. Can be 0, 1 or 2.
|
|
1875
1692
|
thousands = strinteger.length > 3 ? strinteger.length % 3 : 0;
|
|
1876
|
-
|
|
1877
1693
|
// Language
|
|
1878
1694
|
decimalPoint = H.pick(decimalPoint, lang.decimalPoint);
|
|
1879
1695
|
thousandsSep = H.pick(thousandsSep, lang.thousandsSep);
|
|
1880
|
-
|
|
1881
1696
|
// Start building the return
|
|
1882
1697
|
ret = number < 0 ? '-' : '';
|
|
1883
|
-
|
|
1884
1698
|
// Add the leftover after grouping into thousands. For example, in the
|
|
1885
1699
|
// number 42 000 000, this line adds 42.
|
|
1886
1700
|
ret += thousands ? strinteger.substr(0, thousands) + thousandsSep : '';
|
|
1887
|
-
|
|
1888
1701
|
// Add the remaining thousands groups, joined by the thousands separator
|
|
1889
1702
|
ret += strinteger
|
|
1890
1703
|
.substr(thousands)
|
|
1891
1704
|
.replace(/(\d{3})(?=\d)/g, '$1' + thousandsSep);
|
|
1892
|
-
|
|
1893
1705
|
// Add the decimal point and the decimal component
|
|
1894
1706
|
if (decimals) {
|
|
1895
1707
|
// Get the decimal component
|
|
1896
1708
|
ret += decimalPoint + roundedNumber.slice(-decimals);
|
|
1897
1709
|
}
|
|
1898
|
-
|
|
1899
1710
|
if (exponent[1] && +ret !== 0) {
|
|
1900
1711
|
ret += 'e' + exponent[1];
|
|
1901
1712
|
}
|
|
1902
|
-
|
|
1903
1713
|
return ret;
|
|
1904
1714
|
};
|
|
1905
|
-
|
|
1906
1715
|
/**
|
|
1907
1716
|
* Easing definition
|
|
1908
1717
|
*
|
|
@@ -1913,11 +1722,11 @@ H.numberFormat = function (number, decimals, decimalPoint, thousandsSep) {
|
|
|
1913
1722
|
* Current position, ranging from 0 to 1.
|
|
1914
1723
|
*
|
|
1915
1724
|
* @return {number}
|
|
1725
|
+
* Ease result
|
|
1916
1726
|
*/
|
|
1917
1727
|
Math.easeInOutSine = function (pos) {
|
|
1918
1728
|
return -0.5 * (Math.cos(Math.PI * pos) - 1);
|
|
1919
1729
|
};
|
|
1920
|
-
|
|
1921
1730
|
/**
|
|
1922
1731
|
* Get the computed CSS value for given element and property, only for numerical
|
|
1923
1732
|
* properties. For width and height, the dimension of the inner box (excluding
|
|
@@ -1934,52 +1743,35 @@ Math.easeInOutSine = function (pos) {
|
|
|
1934
1743
|
* @param {boolean} [toInt=true]
|
|
1935
1744
|
* Parse to integer.
|
|
1936
1745
|
*
|
|
1937
|
-
* @return {number}
|
|
1746
|
+
* @return {number|string}
|
|
1938
1747
|
* The numeric value.
|
|
1939
1748
|
*/
|
|
1940
1749
|
H.getStyle = function (el, prop, toInt) {
|
|
1941
|
-
|
|
1942
1750
|
var style;
|
|
1943
|
-
|
|
1944
1751
|
// For width and height, return the actual inner pixel size (#4913)
|
|
1945
1752
|
if (prop === 'width') {
|
|
1946
|
-
return Math.max(
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
// transforms, so avoid that
|
|
1956
|
-
H.getStyle(el, 'transform', false) === 'none'
|
|
1957
|
-
) ?
|
|
1958
|
-
Math.floor(el.getBoundingClientRect().width) : // #6427
|
|
1959
|
-
Infinity
|
|
1960
|
-
) -
|
|
1961
|
-
H.getStyle(el, 'padding-left') -
|
|
1962
|
-
H.getStyle(el, 'padding-right')
|
|
1963
|
-
)
|
|
1964
|
-
);
|
|
1753
|
+
return Math.max(0, // #8377
|
|
1754
|
+
(Math.min(el.offsetWidth, el.scrollWidth, (el.getBoundingClientRect &&
|
|
1755
|
+
// #9871, getBoundingClientRect doesn't handle
|
|
1756
|
+
// transforms, so avoid that
|
|
1757
|
+
H.getStyle(el, 'transform', false) === 'none') ?
|
|
1758
|
+
Math.floor(el.getBoundingClientRect().width) : // #6427
|
|
1759
|
+
Infinity) -
|
|
1760
|
+
H.getStyle(el, 'padding-left') -
|
|
1761
|
+
H.getStyle(el, 'padding-right')));
|
|
1965
1762
|
}
|
|
1966
|
-
|
|
1967
1763
|
if (prop === 'height') {
|
|
1968
|
-
return Math.max(
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
H.getStyle(el, 'padding-bottom')
|
|
1973
|
-
);
|
|
1764
|
+
return Math.max(0, // #8377
|
|
1765
|
+
Math.min(el.offsetHeight, el.scrollHeight) -
|
|
1766
|
+
H.getStyle(el, 'padding-top') -
|
|
1767
|
+
H.getStyle(el, 'padding-bottom'));
|
|
1974
1768
|
}
|
|
1975
|
-
|
|
1976
1769
|
if (!win.getComputedStyle) {
|
|
1977
1770
|
// SVG not supported, forgot to load oldie.js?
|
|
1978
1771
|
H.error(27, true);
|
|
1979
1772
|
}
|
|
1980
|
-
|
|
1981
1773
|
// Otherwise, get the computed style
|
|
1982
|
-
style = win.getComputedStyle(el, undefined);
|
|
1774
|
+
style = win.getComputedStyle(el, undefined); // eslint-disable-line no-undefined
|
|
1983
1775
|
if (style) {
|
|
1984
1776
|
style = style.getPropertyValue(prop);
|
|
1985
1777
|
if (H.pick(toInt, prop !== 'opacity')) {
|
|
@@ -1988,7 +1780,6 @@ H.getStyle = function (el, prop, toInt) {
|
|
|
1988
1780
|
}
|
|
1989
1781
|
return style;
|
|
1990
1782
|
};
|
|
1991
|
-
|
|
1992
1783
|
/**
|
|
1993
1784
|
* Search for an item in an array.
|
|
1994
1785
|
*
|
|
@@ -1999,7 +1790,7 @@ H.getStyle = function (el, prop, toInt) {
|
|
|
1999
1790
|
* @param {*} item
|
|
2000
1791
|
* The item to search for.
|
|
2001
1792
|
*
|
|
2002
|
-
* @param {Array} arr
|
|
1793
|
+
* @param {Array<*>} arr
|
|
2003
1794
|
* The array or node collection to search in.
|
|
2004
1795
|
*
|
|
2005
1796
|
* @param {number} [fromIndex=0]
|
|
@@ -2011,14 +1802,13 @@ H.getStyle = function (el, prop, toInt) {
|
|
|
2011
1802
|
H.inArray = function (item, arr, fromIndex) {
|
|
2012
1803
|
return arr.indexOf(item, fromIndex);
|
|
2013
1804
|
};
|
|
2014
|
-
|
|
2015
1805
|
/**
|
|
2016
1806
|
* Return the value of the first element in the array that satisfies the
|
|
2017
1807
|
* provided testing function.
|
|
2018
1808
|
*
|
|
2019
1809
|
* @function Highcharts.find
|
|
2020
1810
|
*
|
|
2021
|
-
* @param {Array} arr
|
|
1811
|
+
* @param {Array<*>} arr
|
|
2022
1812
|
* The array to test.
|
|
2023
1813
|
*
|
|
2024
1814
|
* @param {Function} callback
|
|
@@ -2033,17 +1823,14 @@ H.find = Array.prototype.find ?
|
|
|
2033
1823
|
return arr.find(callback);
|
|
2034
1824
|
} :
|
|
2035
1825
|
// Legacy implementation. PhantomJS, IE <= 11 etc. #7223.
|
|
2036
|
-
function (arr,
|
|
2037
|
-
var i,
|
|
2038
|
-
length = arr.length;
|
|
2039
|
-
|
|
1826
|
+
function (arr, callback) {
|
|
1827
|
+
var i, length = arr.length;
|
|
2040
1828
|
for (i = 0; i < length; i++) {
|
|
2041
|
-
if (
|
|
1829
|
+
if (callback(arr[i], i)) { // eslint-disable-line callback-return
|
|
2042
1830
|
return arr[i];
|
|
2043
1831
|
}
|
|
2044
1832
|
}
|
|
2045
1833
|
};
|
|
2046
|
-
|
|
2047
1834
|
/**
|
|
2048
1835
|
* Returns an array of a given object's own properties.
|
|
2049
1836
|
*
|
|
@@ -2057,7 +1844,6 @@ H.find = Array.prototype.find ?
|
|
|
2057
1844
|
* An array of strings that represents all the properties.
|
|
2058
1845
|
*/
|
|
2059
1846
|
H.keys = Object.keys;
|
|
2060
|
-
|
|
2061
1847
|
/**
|
|
2062
1848
|
* Get the element's offset position, corrected for `overflow: auto`.
|
|
2063
1849
|
*
|
|
@@ -2071,11 +1857,9 @@ H.keys = Object.keys;
|
|
|
2071
1857
|
* the page.
|
|
2072
1858
|
*/
|
|
2073
1859
|
H.offset = function (el) {
|
|
2074
|
-
var docElem = doc.documentElement,
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
{ top: 0, left: 0 };
|
|
2078
|
-
|
|
1860
|
+
var docElem = doc.documentElement, box = (el.parentElement || el.parentNode) ?
|
|
1861
|
+
el.getBoundingClientRect() :
|
|
1862
|
+
{ top: 0, left: 0 };
|
|
2079
1863
|
return {
|
|
2080
1864
|
top: box.top + (win.pageYOffset || docElem.scrollTop) -
|
|
2081
1865
|
(docElem.clientTop || 0),
|
|
@@ -2083,7 +1867,6 @@ H.offset = function (el) {
|
|
|
2083
1867
|
(docElem.clientLeft || 0)
|
|
2084
1868
|
};
|
|
2085
1869
|
};
|
|
2086
|
-
|
|
2087
1870
|
/**
|
|
2088
1871
|
* Stop running animation.
|
|
2089
1872
|
*
|
|
@@ -2096,6 +1879,8 @@ H.offset = function (el) {
|
|
|
2096
1879
|
* The property to stop animating. If given, the stop method will stop a
|
|
2097
1880
|
* single property from animating, while others continue.
|
|
2098
1881
|
*
|
|
1882
|
+
* @return {void}
|
|
1883
|
+
*
|
|
2099
1884
|
* @todo
|
|
2100
1885
|
* A possible extension to this would be to stop a single property, when
|
|
2101
1886
|
* we want to continue animating others. Then assign the prop to the timer
|
|
@@ -2104,9 +1889,7 @@ H.offset = function (el) {
|
|
|
2104
1889
|
* stopping everything, we can just stop the actual attributes we're setting.
|
|
2105
1890
|
*/
|
|
2106
1891
|
H.stop = function (el, prop) {
|
|
2107
|
-
|
|
2108
1892
|
var i = H.timers.length;
|
|
2109
|
-
|
|
2110
1893
|
// Remove timers related to this element (#4519)
|
|
2111
1894
|
while (i--) {
|
|
2112
1895
|
if (H.timers[i].elem === el && (!prop || prop === H.timers[i].prop)) {
|
|
@@ -2114,32 +1897,34 @@ H.stop = function (el, prop) {
|
|
|
2114
1897
|
}
|
|
2115
1898
|
}
|
|
2116
1899
|
};
|
|
2117
|
-
|
|
1900
|
+
/* eslint-disable valid-jsdoc */
|
|
2118
1901
|
/**
|
|
2119
1902
|
* Iterate over object key pairs in an object.
|
|
2120
1903
|
*
|
|
2121
|
-
* @function Highcharts.objectEach
|
|
1904
|
+
* @function Highcharts.objectEach<T>
|
|
2122
1905
|
*
|
|
2123
1906
|
* @param {*} obj
|
|
2124
1907
|
* The object to iterate over.
|
|
2125
1908
|
*
|
|
2126
|
-
* @param {Highcharts.ObjectEachCallbackFunction} fn
|
|
1909
|
+
* @param {Highcharts.ObjectEachCallbackFunction<T>} fn
|
|
2127
1910
|
* The iterator callback. It passes three arguments:
|
|
2128
1911
|
* * value - The property value.
|
|
2129
1912
|
* * key - The property key.
|
|
2130
1913
|
* * obj - The object that objectEach is being applied to.
|
|
2131
1914
|
*
|
|
2132
|
-
* @param {
|
|
1915
|
+
* @param {T} [ctx]
|
|
2133
1916
|
* The context.
|
|
1917
|
+
*
|
|
1918
|
+
* @return {void}
|
|
2134
1919
|
*/
|
|
2135
1920
|
H.objectEach = function (obj, fn, ctx) {
|
|
1921
|
+
/* eslint-enable valid-jsdoc */
|
|
2136
1922
|
for (var key in obj) {
|
|
2137
1923
|
if (obj.hasOwnProperty(key)) {
|
|
2138
1924
|
fn.call(ctx || obj[key], obj[key], key, obj);
|
|
2139
1925
|
}
|
|
2140
1926
|
}
|
|
2141
1927
|
};
|
|
2142
|
-
|
|
2143
1928
|
/**
|
|
2144
1929
|
* Iterate over an array.
|
|
2145
1930
|
*
|
|
@@ -2157,8 +1942,9 @@ H.objectEach = function (obj, fn, ctx) {
|
|
|
2157
1942
|
*
|
|
2158
1943
|
* @param {*} [ctx]
|
|
2159
1944
|
* The context.
|
|
1945
|
+
*
|
|
1946
|
+
* @return {void}
|
|
2160
1947
|
*/
|
|
2161
|
-
|
|
2162
1948
|
/**
|
|
2163
1949
|
* Filter an array by a callback.
|
|
2164
1950
|
*
|
|
@@ -2175,7 +1961,6 @@ H.objectEach = function (obj, fn, ctx) {
|
|
|
2175
1961
|
* @return {Array<*>}
|
|
2176
1962
|
* A new, filtered array.
|
|
2177
1963
|
*/
|
|
2178
|
-
|
|
2179
1964
|
/**
|
|
2180
1965
|
* Map an array by a callback.
|
|
2181
1966
|
*
|
|
@@ -2191,14 +1976,13 @@ H.objectEach = function (obj, fn, ctx) {
|
|
|
2191
1976
|
* @return {Array<*>}
|
|
2192
1977
|
* A new array item with modified items.
|
|
2193
1978
|
*/
|
|
2194
|
-
|
|
2195
1979
|
/**
|
|
2196
1980
|
* Reduce an array to a single value.
|
|
2197
1981
|
*
|
|
2198
1982
|
* @deprecated
|
|
2199
1983
|
* @function Highcharts.reduce
|
|
2200
1984
|
*
|
|
2201
|
-
* @param {Array} arr
|
|
1985
|
+
* @param {Array<*>} arr
|
|
2202
1986
|
* The array to reduce.
|
|
2203
1987
|
*
|
|
2204
1988
|
* @param {Function} fn
|
|
@@ -2212,7 +1996,6 @@ H.objectEach = function (obj, fn, ctx) {
|
|
|
2212
1996
|
* @return {*}
|
|
2213
1997
|
* The reduced value.
|
|
2214
1998
|
*/
|
|
2215
|
-
|
|
2216
1999
|
/**
|
|
2217
2000
|
* Test whether at least one element in the array passes the test implemented by
|
|
2218
2001
|
* the provided function.
|
|
@@ -2240,13 +2023,10 @@ H.objectEach({
|
|
|
2240
2023
|
some: 'some'
|
|
2241
2024
|
}, function (val, key) {
|
|
2242
2025
|
H[key] = function (arr) {
|
|
2243
|
-
return Array.prototype[val].apply(
|
|
2244
|
-
arr,
|
|
2245
|
-
[].slice.call(arguments, 1)
|
|
2246
|
-
);
|
|
2026
|
+
return Array.prototype[val].apply(arr, [].slice.call(arguments, 1));
|
|
2247
2027
|
};
|
|
2248
2028
|
});
|
|
2249
|
-
|
|
2029
|
+
/* eslint-disable valid-jsdoc */
|
|
2250
2030
|
/**
|
|
2251
2031
|
* Add an event listener.
|
|
2252
2032
|
*
|
|
@@ -2259,7 +2039,7 @@ H.objectEach({
|
|
|
2259
2039
|
* @param {string} type
|
|
2260
2040
|
* The event type.
|
|
2261
2041
|
*
|
|
2262
|
-
* @param {Highcharts.EventCallbackFunction<T
|
|
2042
|
+
* @param {Highcharts.EventCallbackFunction<T>|Function} fn
|
|
2263
2043
|
* The function callback to execute when the event is fired.
|
|
2264
2044
|
*
|
|
2265
2045
|
* @param {Highcharts.EventOptionsObject} [options]
|
|
@@ -2269,50 +2049,48 @@ H.objectEach({
|
|
|
2269
2049
|
* A callback function to remove the added event.
|
|
2270
2050
|
*/
|
|
2271
2051
|
H.addEvent = function (el, type, fn, options) {
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2052
|
+
if (options === void 0) { options = {}; }
|
|
2053
|
+
/* eslint-enable valid-jsdoc */
|
|
2054
|
+
var events, addEventListener = (el.addEventListener || H.addEventListenerPolyfill);
|
|
2276
2055
|
// If we're setting events directly on the constructor, use a separate
|
|
2277
2056
|
// collection, `protoEvents` to distinguish it from the item events in
|
|
2278
2057
|
// `hcEvents`.
|
|
2279
2058
|
if (typeof el === 'function' && el.prototype) {
|
|
2280
2059
|
events = el.prototype.protoEvents = el.prototype.protoEvents || {};
|
|
2281
|
-
}
|
|
2060
|
+
}
|
|
2061
|
+
else {
|
|
2282
2062
|
events = el.hcEvents = el.hcEvents || {};
|
|
2283
2063
|
}
|
|
2284
|
-
|
|
2285
2064
|
// Allow click events added to points, otherwise they will be prevented by
|
|
2286
2065
|
// the TouchPointer.pinch function after a pinch zoom operation (#7091).
|
|
2287
|
-
if (H.Point &&
|
|
2066
|
+
if (H.Point &&
|
|
2067
|
+
el instanceof H.Point &&
|
|
2068
|
+
el.series &&
|
|
2069
|
+
el.series.chart) {
|
|
2288
2070
|
el.series.chart.runTrackerClick = true;
|
|
2289
2071
|
}
|
|
2290
|
-
|
|
2291
2072
|
// Handle DOM events
|
|
2292
2073
|
if (addEventListener) {
|
|
2293
2074
|
addEventListener.call(el, type, fn, false);
|
|
2294
2075
|
}
|
|
2295
|
-
|
|
2296
2076
|
if (!events[type]) {
|
|
2297
2077
|
events[type] = [];
|
|
2298
2078
|
}
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2079
|
+
var eventObject = {
|
|
2080
|
+
fn: fn,
|
|
2081
|
+
order: typeof options.order === 'number' ? options.order : Infinity
|
|
2082
|
+
};
|
|
2083
|
+
events[type].push(eventObject);
|
|
2302
2084
|
// Order the calls
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
return a.order - b.order;
|
|
2307
|
-
});
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2085
|
+
events[type].sort(function (a, b) {
|
|
2086
|
+
return a.order - b.order;
|
|
2087
|
+
});
|
|
2310
2088
|
// Return a function that can be called to remove this event.
|
|
2311
2089
|
return function () {
|
|
2312
2090
|
H.removeEvent(el, type, fn);
|
|
2313
2091
|
};
|
|
2314
2092
|
};
|
|
2315
|
-
|
|
2093
|
+
/* eslint-disable valid-jsdoc */
|
|
2316
2094
|
/**
|
|
2317
2095
|
* Remove an event that was added with {@link Highcharts#addEvent}.
|
|
2318
2096
|
*
|
|
@@ -2328,160 +2106,159 @@ H.addEvent = function (el, type, fn, options) {
|
|
|
2328
2106
|
* @param {Highcharts.EventCallbackFunction<T>} [fn]
|
|
2329
2107
|
* The specific callback to remove. If undefined, all events that match
|
|
2330
2108
|
* the element and optionally the type are removed.
|
|
2109
|
+
*
|
|
2110
|
+
* @return {void}
|
|
2331
2111
|
*/
|
|
2332
2112
|
H.removeEvent = function (el, type, fn) {
|
|
2333
|
-
|
|
2334
|
-
var events,
|
|
2335
|
-
|
|
2336
|
-
|
|
2113
|
+
/* eslint-enable valid-jsdoc */
|
|
2114
|
+
var events, index;
|
|
2115
|
+
/**
|
|
2116
|
+
* @private
|
|
2117
|
+
* @param {string} type - event type
|
|
2118
|
+
* @param {Highcharts.EventCallbackFunction<T>} fn - callback
|
|
2119
|
+
* @return {void}
|
|
2120
|
+
*/
|
|
2337
2121
|
function removeOneEvent(type, fn) {
|
|
2338
|
-
var removeEventListener =
|
|
2339
|
-
el.removeEventListener || H.removeEventListenerPolyfill;
|
|
2340
|
-
|
|
2122
|
+
var removeEventListener = (el.removeEventListener || H.removeEventListenerPolyfill);
|
|
2341
2123
|
if (removeEventListener) {
|
|
2342
2124
|
removeEventListener.call(el, type, fn, false);
|
|
2343
2125
|
}
|
|
2344
2126
|
}
|
|
2345
|
-
|
|
2127
|
+
/**
|
|
2128
|
+
* @private
|
|
2129
|
+
* @param {any} eventCollection - collection
|
|
2130
|
+
* @return {void}
|
|
2131
|
+
*/
|
|
2346
2132
|
function removeAllEvents(eventCollection) {
|
|
2347
|
-
var types,
|
|
2348
|
-
len;
|
|
2349
|
-
|
|
2133
|
+
var types, len;
|
|
2350
2134
|
if (!el.nodeName) {
|
|
2351
2135
|
return; // break on non-DOM events
|
|
2352
2136
|
}
|
|
2353
|
-
|
|
2354
2137
|
if (type) {
|
|
2355
2138
|
types = {};
|
|
2356
2139
|
types[type] = true;
|
|
2357
|
-
}
|
|
2140
|
+
}
|
|
2141
|
+
else {
|
|
2358
2142
|
types = eventCollection;
|
|
2359
2143
|
}
|
|
2360
|
-
|
|
2361
2144
|
H.objectEach(types, function (val, n) {
|
|
2362
2145
|
if (eventCollection[n]) {
|
|
2363
2146
|
len = eventCollection[n].length;
|
|
2364
2147
|
while (len--) {
|
|
2365
|
-
removeOneEvent(n, eventCollection[n][len]);
|
|
2148
|
+
removeOneEvent(n, eventCollection[n][len].fn);
|
|
2366
2149
|
}
|
|
2367
2150
|
}
|
|
2368
2151
|
});
|
|
2369
2152
|
}
|
|
2370
|
-
|
|
2371
2153
|
['protoEvents', 'hcEvents'].forEach(function (coll) {
|
|
2372
2154
|
var eventCollection = el[coll];
|
|
2373
|
-
|
|
2374
2155
|
if (eventCollection) {
|
|
2375
2156
|
if (type) {
|
|
2376
|
-
events = eventCollection[type] || [];
|
|
2157
|
+
events = (eventCollection[type] || []);
|
|
2377
2158
|
if (fn) {
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
eventCollection[type] = events;
|
|
2382
|
-
}
|
|
2159
|
+
eventCollection[type] = events.filter(function (obj) {
|
|
2160
|
+
return fn !== obj.fn;
|
|
2161
|
+
});
|
|
2383
2162
|
removeOneEvent(type, fn);
|
|
2384
|
-
|
|
2385
|
-
|
|
2163
|
+
}
|
|
2164
|
+
else {
|
|
2386
2165
|
removeAllEvents(eventCollection);
|
|
2387
2166
|
eventCollection[type] = [];
|
|
2388
2167
|
}
|
|
2389
|
-
}
|
|
2168
|
+
}
|
|
2169
|
+
else {
|
|
2390
2170
|
removeAllEvents(eventCollection);
|
|
2391
2171
|
el[coll] = {};
|
|
2392
2172
|
}
|
|
2393
2173
|
}
|
|
2394
2174
|
});
|
|
2395
2175
|
};
|
|
2396
|
-
|
|
2176
|
+
/* eslint-disable valid-jsdoc */
|
|
2397
2177
|
/**
|
|
2398
2178
|
* Fire an event that was registered with {@link Highcharts#addEvent}.
|
|
2399
2179
|
*
|
|
2400
|
-
* @function Highcharts.fireEvent
|
|
2180
|
+
* @function Highcharts.fireEvent<T>
|
|
2401
2181
|
*
|
|
2402
|
-
* @param {
|
|
2182
|
+
* @param {T} el
|
|
2403
2183
|
* The object to fire the event on. It can be a {@link HTMLDOMElement},
|
|
2404
2184
|
* an {@link SVGElement} or any other object.
|
|
2405
2185
|
*
|
|
2406
2186
|
* @param {string} type
|
|
2407
2187
|
* The type of event.
|
|
2408
2188
|
*
|
|
2409
|
-
* @param {Highcharts.Dictionary
|
|
2189
|
+
* @param {Highcharts.Dictionary<*>|Event} [eventArguments]
|
|
2410
2190
|
* Custom event arguments that are passed on as an argument to the event
|
|
2411
2191
|
* handler.
|
|
2412
2192
|
*
|
|
2413
|
-
* @param {Function} [defaultFunction]
|
|
2193
|
+
* @param {Highcharts.EventCallbackFunction<T>|Function} [defaultFunction]
|
|
2414
2194
|
* The default function to execute if the other listeners haven't
|
|
2415
2195
|
* returned false.
|
|
2196
|
+
*
|
|
2197
|
+
* @return {void}
|
|
2416
2198
|
*/
|
|
2417
2199
|
H.fireEvent = function (el, type, eventArguments, defaultFunction) {
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
len,
|
|
2421
|
-
i,
|
|
2422
|
-
fn;
|
|
2423
|
-
|
|
2200
|
+
/* eslint-enable valid-jsdoc */
|
|
2201
|
+
var e, events, len, i, fn;
|
|
2424
2202
|
eventArguments = eventArguments || {};
|
|
2425
|
-
|
|
2426
|
-
|
|
2203
|
+
if (doc.createEvent &&
|
|
2204
|
+
(el.dispatchEvent || el.fireEvent)) {
|
|
2427
2205
|
e = doc.createEvent('Events');
|
|
2428
2206
|
e.initEvent(type, true, true);
|
|
2429
|
-
|
|
2430
2207
|
H.extend(e, eventArguments);
|
|
2431
|
-
|
|
2432
2208
|
if (el.dispatchEvent) {
|
|
2433
2209
|
el.dispatchEvent(e);
|
|
2434
|
-
}
|
|
2210
|
+
}
|
|
2211
|
+
else {
|
|
2435
2212
|
el.fireEvent(type, e);
|
|
2436
2213
|
}
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2214
|
+
}
|
|
2215
|
+
else {
|
|
2216
|
+
if (!eventArguments.target) {
|
|
2217
|
+
// We're running a custom event
|
|
2218
|
+
H.extend(eventArguments, {
|
|
2219
|
+
// Attach a simple preventDefault function to skip
|
|
2220
|
+
// default handler if called. The built-in
|
|
2221
|
+
// defaultPrevented property is not overwritable (#5112)
|
|
2222
|
+
preventDefault: function () {
|
|
2223
|
+
eventArguments.defaultPrevented = true;
|
|
2224
|
+
},
|
|
2225
|
+
// Setting target to native events fails with clicking
|
|
2226
|
+
// the zoom-out button in Chrome.
|
|
2227
|
+
target: el,
|
|
2228
|
+
// If the type is not set, we're running a custom event
|
|
2229
|
+
// (#2297). If it is set, we're running a browser event,
|
|
2230
|
+
// and setting it will cause en error in IE8 (#2465).
|
|
2231
|
+
type: type
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
var fireInOrder = function (protoEvents, hcEvents) {
|
|
2235
|
+
if (protoEvents === void 0) { protoEvents = []; }
|
|
2236
|
+
if (hcEvents === void 0) { hcEvents = []; }
|
|
2237
|
+
var iA = 0;
|
|
2238
|
+
var iB = 0;
|
|
2239
|
+
var length = protoEvents.length + hcEvents.length;
|
|
2240
|
+
for (i = 0; i < length; i++) {
|
|
2241
|
+
var obj = (!protoEvents[iA] ?
|
|
2242
|
+
hcEvents[iB++] :
|
|
2243
|
+
!hcEvents[iB] ?
|
|
2244
|
+
protoEvents[iA++] :
|
|
2245
|
+
protoEvents[iA].order <= hcEvents[iB].order ?
|
|
2246
|
+
protoEvents[iA++] :
|
|
2247
|
+
hcEvents[iB++]);
|
|
2248
|
+
// If the event handler return false, prevent the default
|
|
2249
|
+
// handler from executing
|
|
2250
|
+
if (obj.fn.call(el, eventArguments) === false) {
|
|
2251
|
+
eventArguments.preventDefault();
|
|
2474
2252
|
}
|
|
2475
2253
|
}
|
|
2476
|
-
}
|
|
2254
|
+
};
|
|
2255
|
+
fireInOrder(el.protoEvents && el.protoEvents[type], el.hcEvents && el.hcEvents[type]);
|
|
2477
2256
|
}
|
|
2478
|
-
|
|
2479
2257
|
// Run the default if not prevented
|
|
2480
2258
|
if (defaultFunction && !eventArguments.defaultPrevented) {
|
|
2481
2259
|
defaultFunction.call(el, eventArguments);
|
|
2482
2260
|
}
|
|
2483
2261
|
};
|
|
2484
|
-
|
|
2485
2262
|
/**
|
|
2486
2263
|
* The global animate method, which uses Fx to create individual animators.
|
|
2487
2264
|
*
|
|
@@ -2490,21 +2267,18 @@ H.fireEvent = function (el, type, eventArguments, defaultFunction) {
|
|
|
2490
2267
|
* @param {Highcharts.HTMLDOMElement|Highcharts.SVGElement} el
|
|
2491
2268
|
* The element to animate.
|
|
2492
2269
|
*
|
|
2493
|
-
* @param {Highcharts.
|
|
2270
|
+
* @param {Highcharts.CSSObject|Highcharts.SVGAttributes} params
|
|
2494
2271
|
* An object containing key-value pairs of the properties to animate.
|
|
2495
2272
|
* Supports numeric as pixel-based CSS properties for HTML objects and
|
|
2496
2273
|
* attributes for SVGElements.
|
|
2497
2274
|
*
|
|
2498
2275
|
* @param {Highcharts.AnimationOptionsObject} [opt]
|
|
2499
2276
|
* Animation options.
|
|
2277
|
+
*
|
|
2278
|
+
* @return {void}
|
|
2500
2279
|
*/
|
|
2501
2280
|
H.animate = function (el, params, opt) {
|
|
2502
|
-
var start,
|
|
2503
|
-
unit = '',
|
|
2504
|
-
end,
|
|
2505
|
-
fx,
|
|
2506
|
-
args;
|
|
2507
|
-
|
|
2281
|
+
var start, unit = '', end, fx, args;
|
|
2508
2282
|
if (!H.isObject(opt)) { // Number or undefined/null
|
|
2509
2283
|
args = arguments;
|
|
2510
2284
|
opt = {
|
|
@@ -2520,32 +2294,26 @@ H.animate = function (el, params, opt) {
|
|
|
2520
2294
|
opt.easing :
|
|
2521
2295
|
(Math[opt.easing] || Math.easeInOutSine);
|
|
2522
2296
|
opt.curAnim = H.merge(params);
|
|
2523
|
-
|
|
2524
2297
|
H.objectEach(params, function (val, prop) {
|
|
2525
2298
|
// Stop current running animation of this property
|
|
2526
2299
|
H.stop(el, prop);
|
|
2527
|
-
|
|
2528
2300
|
fx = new H.Fx(el, opt, prop);
|
|
2529
2301
|
end = null;
|
|
2530
|
-
|
|
2531
2302
|
if (prop === 'd') {
|
|
2532
|
-
fx.paths = fx.initPath(
|
|
2533
|
-
el,
|
|
2534
|
-
el.d,
|
|
2535
|
-
params.d
|
|
2536
|
-
);
|
|
2303
|
+
fx.paths = fx.initPath(el, el.d, params.d);
|
|
2537
2304
|
fx.toD = params.d;
|
|
2538
2305
|
start = 0;
|
|
2539
2306
|
end = 1;
|
|
2540
|
-
}
|
|
2307
|
+
}
|
|
2308
|
+
else if (el.attr) {
|
|
2541
2309
|
start = el.attr(prop);
|
|
2542
|
-
}
|
|
2310
|
+
}
|
|
2311
|
+
else {
|
|
2543
2312
|
start = parseFloat(H.getStyle(el, prop)) || 0;
|
|
2544
2313
|
if (prop !== 'opacity') {
|
|
2545
2314
|
unit = 'px';
|
|
2546
2315
|
}
|
|
2547
2316
|
}
|
|
2548
|
-
|
|
2549
2317
|
if (!end) {
|
|
2550
2318
|
end = val;
|
|
2551
2319
|
}
|
|
@@ -2555,7 +2323,6 @@ H.animate = function (el, params, opt) {
|
|
|
2555
2323
|
fx.run(start, end, unit);
|
|
2556
2324
|
});
|
|
2557
2325
|
};
|
|
2558
|
-
|
|
2559
2326
|
/**
|
|
2560
2327
|
* Factory to create new series prototypes.
|
|
2561
2328
|
*
|
|
@@ -2586,29 +2353,20 @@ H.animate = function (el, params, opt) {
|
|
|
2586
2353
|
*/
|
|
2587
2354
|
// docs: add to API + extending Highcharts
|
|
2588
2355
|
H.seriesType = function (type, parent, options, props, pointProps) {
|
|
2589
|
-
var defaultOptions = H.getOptions(),
|
|
2590
|
-
seriesTypes = H.seriesTypes;
|
|
2591
|
-
|
|
2356
|
+
var defaultOptions = H.getOptions(), seriesTypes = H.seriesTypes;
|
|
2592
2357
|
// Merge the options
|
|
2593
|
-
defaultOptions.plotOptions[type] = H.merge(
|
|
2594
|
-
defaultOptions.plotOptions[parent],
|
|
2595
|
-
options
|
|
2596
|
-
);
|
|
2597
|
-
|
|
2358
|
+
defaultOptions.plotOptions[type] = H.merge(defaultOptions.plotOptions[parent], options);
|
|
2598
2359
|
// Create the class
|
|
2599
2360
|
seriesTypes[type] = H.extendClass(seriesTypes[parent] ||
|
|
2600
|
-
function () {}, props);
|
|
2361
|
+
function () { }, props);
|
|
2601
2362
|
seriesTypes[type].prototype.type = type;
|
|
2602
|
-
|
|
2603
2363
|
// Create the point class if needed
|
|
2604
2364
|
if (pointProps) {
|
|
2605
2365
|
seriesTypes[type].prototype.pointClass =
|
|
2606
2366
|
H.extendClass(H.Point, pointProps);
|
|
2607
2367
|
}
|
|
2608
|
-
|
|
2609
2368
|
return seriesTypes[type];
|
|
2610
2369
|
};
|
|
2611
|
-
|
|
2612
2370
|
/**
|
|
2613
2371
|
* Get a unique key for using in internal element id's and pointers. The key is
|
|
2614
2372
|
* composed of a random hash specific to this Highcharts instance, and a
|
|
@@ -2623,28 +2381,21 @@ H.seriesType = function (type, parent, options, props, pointProps) {
|
|
|
2623
2381
|
* A unique key.
|
|
2624
2382
|
*/
|
|
2625
2383
|
H.uniqueKey = (function () {
|
|
2626
|
-
|
|
2627
|
-
var uniqueKeyHash = Math.random().toString(36).substring(2, 9),
|
|
2628
|
-
idCounter = 0;
|
|
2629
|
-
|
|
2384
|
+
var uniqueKeyHash = Math.random().toString(36).substring(2, 9), idCounter = 0;
|
|
2630
2385
|
return function () {
|
|
2631
2386
|
return 'highcharts-' + uniqueKeyHash + '-' + idCounter++;
|
|
2632
2387
|
};
|
|
2633
2388
|
}());
|
|
2634
|
-
|
|
2635
2389
|
H.isFunction = function (obj) {
|
|
2636
2390
|
return typeof obj === 'function';
|
|
2637
2391
|
};
|
|
2638
|
-
|
|
2639
2392
|
// Register Highcharts as a plugin in jQuery
|
|
2640
2393
|
if (win.jQuery) {
|
|
2641
|
-
|
|
2642
2394
|
/**
|
|
2643
2395
|
* Highcharts-extended JQuery.
|
|
2644
2396
|
*
|
|
2645
2397
|
* @external JQuery
|
|
2646
2398
|
*/
|
|
2647
|
-
|
|
2648
2399
|
/**
|
|
2649
2400
|
* Helper function to return the chart of the current JQuery selector
|
|
2650
2401
|
* element.
|
|
@@ -2653,41 +2404,37 @@ if (win.jQuery) {
|
|
|
2653
2404
|
*
|
|
2654
2405
|
* @return {Highcharts.Chart}
|
|
2655
2406
|
* The chart that is linked to the JQuery selector element.
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2407
|
+
*/ /**
|
|
2408
|
+
* Factory function to create a chart in the current JQuery selector
|
|
2409
|
+
* element.
|
|
2410
|
+
*
|
|
2411
|
+
* @function external:JQuery#highcharts
|
|
2412
|
+
*
|
|
2413
|
+
* @param {'Chart'|'Map'|'StockChart'|string} [className]
|
|
2414
|
+
* Name of the factory class in the Highcharts namespace.
|
|
2415
|
+
*
|
|
2416
|
+
* @param {Highcharts.Options} [options]
|
|
2417
|
+
* The chart options structure.
|
|
2418
|
+
*
|
|
2419
|
+
* @param {Highcharts.ChartCallbackFunction} [callback]
|
|
2420
|
+
* Function to run when the chart has loaded and and all external
|
|
2421
|
+
* images are loaded. Defining a
|
|
2422
|
+
* [chart.events.load](https://api.highcharts.com/highcharts/chart.events.load)
|
|
2423
|
+
* handler is equivalent.
|
|
2424
|
+
*
|
|
2425
|
+
* @return {JQuery}
|
|
2426
|
+
* The current JQuery selector.
|
|
2427
|
+
*/
|
|
2677
2428
|
win.jQuery.fn.highcharts = function () {
|
|
2678
2429
|
var args = [].slice.call(arguments);
|
|
2679
|
-
|
|
2680
2430
|
if (this[0]) { // this[0] is the renderTo div
|
|
2681
|
-
|
|
2682
2431
|
// Create the chart
|
|
2683
2432
|
if (args[0]) {
|
|
2684
2433
|
new H[ // eslint-disable-line no-new
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
](this[0], args[0], args[1]);
|
|
2434
|
+
// Constructor defaults to Chart
|
|
2435
|
+
H.isString(args[0]) ? args.shift() : 'Chart'](this[0], args[0], args[1]);
|
|
2688
2436
|
return this;
|
|
2689
2437
|
}
|
|
2690
|
-
|
|
2691
2438
|
// When called without parameters or with the return argument,
|
|
2692
2439
|
// return an existing chart
|
|
2693
2440
|
return charts[H.attr(this[0], 'data-highcharts-chart')];
|