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
package/es-modules/parts/Time.js
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
/* *
|
|
2
|
-
* (c) 2010-2019 Torstein Honsi
|
|
3
2
|
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
* (c) 2010-2019 Torstein Honsi
|
|
4
|
+
*
|
|
5
|
+
* License: www.highcharts.com/license
|
|
6
|
+
*
|
|
7
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
8
|
+
*
|
|
9
|
+
* */
|
|
10
|
+
'use strict';
|
|
11
|
+
import Highcharts from './Globals.js';
|
|
7
12
|
/**
|
|
8
13
|
* Normalized interval.
|
|
9
14
|
*
|
|
10
15
|
* @interface Highcharts.NormalizedIntervalObject
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
*/ /**
|
|
17
|
+
* The count.
|
|
18
|
+
*
|
|
19
|
+
* @name Highcharts.NormalizedIntervalObject#count
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/ /**
|
|
22
|
+
* The interval in axis values (ms).
|
|
23
|
+
*
|
|
24
|
+
* @name Highcharts.NormalizedIntervalObject#unitRange
|
|
25
|
+
* @type {number}
|
|
26
|
+
*/
|
|
23
27
|
/**
|
|
24
28
|
* Function of an additional date format specifier.
|
|
25
29
|
*
|
|
@@ -31,42 +35,29 @@
|
|
|
31
35
|
* @return {string}
|
|
32
36
|
* The formatted portion of the date.
|
|
33
37
|
*/
|
|
34
|
-
|
|
35
38
|
/**
|
|
36
39
|
* Additonal time tick information.
|
|
37
40
|
*
|
|
38
41
|
* @interface Highcharts.TimeTicksInfoObject
|
|
39
42
|
* @augments Highcharts.NormalizedIntervalObject
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
*/ /**
|
|
44
|
+
* @name Highcharts.TimeTicksInfoObject#higherRanks
|
|
45
|
+
* @type {Array<string>}
|
|
46
|
+
*/ /**
|
|
47
|
+
* @name Highcharts.TimeTicksInfoObject#totalRange
|
|
48
|
+
* @type {number}
|
|
49
|
+
*/
|
|
48
50
|
/**
|
|
49
51
|
* Time ticks.
|
|
50
52
|
*
|
|
51
53
|
* @interface Highcharts.TimeTicksObject
|
|
52
54
|
* @augments Array<number>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
import Highcharts from './Globals.js';
|
|
61
|
-
|
|
62
|
-
var H = Highcharts,
|
|
63
|
-
defined = H.defined,
|
|
64
|
-
extend = H.extend,
|
|
65
|
-
merge = H.merge,
|
|
66
|
-
pick = H.pick,
|
|
67
|
-
timeUnits = H.timeUnits,
|
|
68
|
-
win = H.win;
|
|
69
|
-
|
|
55
|
+
*/ /**
|
|
56
|
+
* @name Highcharts.TimeTicksObject#info
|
|
57
|
+
* @type {Highcharts.TimeTicksInfoObject}
|
|
58
|
+
*/
|
|
59
|
+
var H = Highcharts, defined = H.defined, extend = H.extend, merge = H.merge, pick = H.pick, timeUnits = H.timeUnits, win = H.win;
|
|
60
|
+
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
70
61
|
/**
|
|
71
62
|
* The Time class. Time settings are applied in general for each page using
|
|
72
63
|
* `Highcharts.setOptions`, or individually for each Chart item through the
|
|
@@ -111,9 +102,7 @@ var H = Highcharts,
|
|
|
111
102
|
Highcharts.Time = function (options) {
|
|
112
103
|
this.update(options, false);
|
|
113
104
|
};
|
|
114
|
-
|
|
115
105
|
Highcharts.Time.prototype = {
|
|
116
|
-
|
|
117
106
|
/**
|
|
118
107
|
* Time options that can apply globally or to individual charts. These
|
|
119
108
|
* settings affect how `datetime` axes are laid out, how tooltips are
|
|
@@ -165,7 +154,6 @@ Highcharts.Time.prototype = {
|
|
|
165
154
|
* @since 6.0.5
|
|
166
155
|
* @apioption time
|
|
167
156
|
*/
|
|
168
|
-
|
|
169
157
|
/**
|
|
170
158
|
* Whether to use UTC time for axis scaling, tickmark placement and
|
|
171
159
|
* time display in `Highcharts.dateFormat`. Advantages of using UTC
|
|
@@ -183,7 +171,6 @@ Highcharts.Time.prototype = {
|
|
|
183
171
|
* @default true
|
|
184
172
|
* @apioption time.useUTC
|
|
185
173
|
*/
|
|
186
|
-
|
|
187
174
|
/**
|
|
188
175
|
* A custom `Date` class for advanced date handling. For example,
|
|
189
176
|
* [JDate](https://github.com/tahajahangir/jdate) can be hooked in to
|
|
@@ -194,7 +181,6 @@ Highcharts.Time.prototype = {
|
|
|
194
181
|
* @product highcharts highstock gantt
|
|
195
182
|
* @apioption time.Date
|
|
196
183
|
*/
|
|
197
|
-
|
|
198
184
|
/**
|
|
199
185
|
* A callback to return the time zone offset for a given datetime. It
|
|
200
186
|
* takes the timestamp in terms of milliseconds since January 1 1970,
|
|
@@ -212,7 +198,6 @@ Highcharts.Time.prototype = {
|
|
|
212
198
|
* @product highcharts highstock gantt
|
|
213
199
|
* @apioption time.getTimezoneOffset
|
|
214
200
|
*/
|
|
215
|
-
|
|
216
201
|
/**
|
|
217
202
|
* Requires [moment.js](http://momentjs.com/). If the timezone option
|
|
218
203
|
* is specified, it creates a default
|
|
@@ -231,7 +216,6 @@ Highcharts.Time.prototype = {
|
|
|
231
216
|
* @product highcharts highstock gantt
|
|
232
217
|
* @apioption time.timezone
|
|
233
218
|
*/
|
|
234
|
-
|
|
235
219
|
/**
|
|
236
220
|
* The timezone offset in minutes. Positive values are west, negative
|
|
237
221
|
* values are east of UTC, as in the ECMAScript
|
|
@@ -249,9 +233,7 @@ Highcharts.Time.prototype = {
|
|
|
249
233
|
* @product highcharts highstock gantt
|
|
250
234
|
* @apioption time.timezoneOffset
|
|
251
235
|
*/
|
|
252
|
-
|
|
253
236
|
defaultOptions: {},
|
|
254
|
-
|
|
255
237
|
/**
|
|
256
238
|
* Update the Time object with current options. It is called internally on
|
|
257
239
|
* initializing Highcharts, after running `Highcharts.setOptions` and on
|
|
@@ -261,19 +243,16 @@ Highcharts.Time.prototype = {
|
|
|
261
243
|
* @function Highcharts.Time#update
|
|
262
244
|
*
|
|
263
245
|
* @param {Highcharts.TimeOptions} options
|
|
246
|
+
*
|
|
247
|
+
* @return {void}
|
|
264
248
|
*/
|
|
265
249
|
update: function (options) {
|
|
266
|
-
var useUTC = pick(options && options.useUTC, true),
|
|
267
|
-
time = this;
|
|
268
|
-
|
|
250
|
+
var useUTC = pick(options && options.useUTC, true), time = this;
|
|
269
251
|
this.options = options = merge(true, this.options || {}, options);
|
|
270
|
-
|
|
271
252
|
// Allow using a different Date class
|
|
272
253
|
this.Date = options.Date || win.Date || Date;
|
|
273
|
-
|
|
274
254
|
this.useUTC = useUTC;
|
|
275
|
-
this.timezoneOffset = useUTC && options.timezoneOffset;
|
|
276
|
-
|
|
255
|
+
this.timezoneOffset = (useUTC && options.timezoneOffset);
|
|
277
256
|
/**
|
|
278
257
|
* Get the time zone offset based on the current timezone information as
|
|
279
258
|
* set in the global options.
|
|
@@ -287,78 +266,60 @@ Highcharts.Time.prototype = {
|
|
|
287
266
|
* The timezone offset in minutes compared to UTC.
|
|
288
267
|
*/
|
|
289
268
|
this.getTimezoneOffset = this.timezoneOffsetFunction();
|
|
290
|
-
|
|
291
269
|
/*
|
|
292
270
|
* The time object has options allowing for variable time zones, meaning
|
|
293
271
|
* the axis ticks or series data needs to consider this.
|
|
294
272
|
*/
|
|
295
|
-
this.variableTimezone = !!(
|
|
296
|
-
!useUTC ||
|
|
273
|
+
this.variableTimezone = !!(!useUTC ||
|
|
297
274
|
options.getTimezoneOffset ||
|
|
298
|
-
options.timezone
|
|
299
|
-
);
|
|
300
|
-
|
|
275
|
+
options.timezone);
|
|
301
276
|
// UTC time with timezone handling
|
|
302
277
|
if (this.variableTimezone || this.timezoneOffset) {
|
|
303
278
|
this.get = function (unit, date) {
|
|
304
|
-
var realMs = date.getTime(),
|
|
305
|
-
ms = realMs - time.getTimezoneOffset(date),
|
|
306
|
-
ret;
|
|
307
|
-
|
|
279
|
+
var realMs = date.getTime(), ms = realMs - time.getTimezoneOffset(date), ret;
|
|
308
280
|
date.setTime(ms); // Temporary adjust to timezone
|
|
309
281
|
ret = date['getUTC' + unit]();
|
|
310
282
|
date.setTime(realMs); // Reset
|
|
311
|
-
|
|
312
283
|
return ret;
|
|
313
284
|
};
|
|
314
285
|
this.set = function (unit, date, value) {
|
|
315
286
|
var ms, offset, newOffset;
|
|
316
|
-
|
|
317
287
|
// For lower order time units, just set it directly using local
|
|
318
288
|
// time
|
|
319
|
-
if (
|
|
320
|
-
unit === 'Milliseconds' ||
|
|
289
|
+
if (unit === 'Milliseconds' ||
|
|
321
290
|
unit === 'Seconds' ||
|
|
322
|
-
|
|
323
291
|
// If we're dealting with minutes, we only need to
|
|
324
292
|
// consider timezone if we're in Indian time zones with
|
|
325
293
|
// half-hour offsets (#8768).
|
|
326
|
-
(
|
|
327
|
-
|
|
328
|
-
date.getTimezoneOffset() % 60 === 0
|
|
329
|
-
)
|
|
330
|
-
) {
|
|
294
|
+
(unit === 'Minutes' &&
|
|
295
|
+
date.getTimezoneOffset() % 60 === 0)) {
|
|
331
296
|
date['set' + unit](value);
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
297
|
+
// Higher order time units need to take the time zone into
|
|
298
|
+
// account
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
337
301
|
// Adjust by timezone
|
|
338
302
|
offset = time.getTimezoneOffset(date);
|
|
339
303
|
ms = date.getTime() - offset;
|
|
340
304
|
date.setTime(ms);
|
|
341
|
-
|
|
342
305
|
date['setUTC' + unit](value);
|
|
343
306
|
newOffset = time.getTimezoneOffset(date);
|
|
344
|
-
|
|
345
307
|
ms = date.getTime() + newOffset;
|
|
346
308
|
date.setTime(ms);
|
|
347
309
|
}
|
|
348
|
-
|
|
349
310
|
};
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
311
|
+
// UTC time with no timezone handling
|
|
312
|
+
}
|
|
313
|
+
else if (useUTC) {
|
|
353
314
|
this.get = function (unit, date) {
|
|
354
315
|
return date['getUTC' + unit]();
|
|
355
316
|
};
|
|
356
317
|
this.set = function (unit, date, value) {
|
|
357
318
|
return date['setUTC' + unit](value);
|
|
358
319
|
};
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
320
|
+
// Local time
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
362
323
|
this.get = function (unit, date) {
|
|
363
324
|
return date['get' + unit]();
|
|
364
325
|
};
|
|
@@ -366,9 +327,7 @@ Highcharts.Time.prototype = {
|
|
|
366
327
|
return date['set' + unit](value);
|
|
367
328
|
};
|
|
368
329
|
}
|
|
369
|
-
|
|
370
330
|
},
|
|
371
|
-
|
|
372
331
|
/**
|
|
373
332
|
* Make a time and returns milliseconds. Interprets the inputs as UTC time,
|
|
374
333
|
* local time or a specific timezone time depending on the current time
|
|
@@ -399,40 +358,28 @@ Highcharts.Time.prototype = {
|
|
|
399
358
|
*/
|
|
400
359
|
makeTime: function (year, month, date, hours, minutes, seconds) {
|
|
401
360
|
var d, offset, newOffset;
|
|
402
|
-
|
|
403
361
|
if (this.useUTC) {
|
|
404
362
|
d = this.Date.UTC.apply(0, arguments);
|
|
405
363
|
offset = this.getTimezoneOffset(d);
|
|
406
364
|
d += offset;
|
|
407
365
|
newOffset = this.getTimezoneOffset(d);
|
|
408
|
-
|
|
409
366
|
if (offset !== newOffset) {
|
|
410
367
|
d += newOffset - offset;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
!H.isSafari
|
|
419
|
-
) {
|
|
368
|
+
// A special case for transitioning from summer time to winter time.
|
|
369
|
+
// When the clock is set back, the same time is repeated twice, i.e.
|
|
370
|
+
// 02:30 am is repeated since the clock is set back from 3 am to
|
|
371
|
+
// 2 am. We need to make the same time as local Date does.
|
|
372
|
+
}
|
|
373
|
+
else if (offset - 36e5 === this.getTimezoneOffset(d - 36e5) &&
|
|
374
|
+
!H.isSafari) {
|
|
420
375
|
d -= 36e5;
|
|
421
376
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
d = new this.Date(
|
|
425
|
-
year,
|
|
426
|
-
month,
|
|
427
|
-
pick(date, 1),
|
|
428
|
-
pick(hours, 0),
|
|
429
|
-
pick(minutes, 0),
|
|
430
|
-
pick(seconds, 0)
|
|
431
|
-
).getTime();
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
d = new this.Date(year, month, pick(date, 1), pick(hours, 0), pick(minutes, 0), pick(seconds, 0)).getTime();
|
|
432
380
|
}
|
|
433
381
|
return d;
|
|
434
382
|
},
|
|
435
|
-
|
|
436
383
|
/**
|
|
437
384
|
* Sets the getTimezoneOffset function. If the `timezone` option is set, a
|
|
438
385
|
* default getTimezoneOffset function with that timezone is returned. If
|
|
@@ -447,45 +394,35 @@ Highcharts.Time.prototype = {
|
|
|
447
394
|
* A getTimezoneOffset function
|
|
448
395
|
*/
|
|
449
396
|
timezoneOffsetFunction: function () {
|
|
450
|
-
var time = this,
|
|
451
|
-
options = this.options,
|
|
452
|
-
moment = win.moment;
|
|
453
|
-
|
|
397
|
+
var time = this, options = this.options, moment = win.moment;
|
|
454
398
|
if (!this.useUTC) {
|
|
455
399
|
return function (timestamp) {
|
|
456
400
|
return new Date(timestamp).getTimezoneOffset() * 60000;
|
|
457
401
|
};
|
|
458
402
|
}
|
|
459
|
-
|
|
460
403
|
if (options.timezone) {
|
|
461
404
|
if (!moment) {
|
|
462
405
|
// getTimezoneOffset-function stays undefined because it depends
|
|
463
406
|
// on Moment.js
|
|
464
407
|
H.error(25);
|
|
465
|
-
|
|
466
|
-
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
467
410
|
return function (timestamp) {
|
|
468
|
-
return -moment.tz(
|
|
469
|
-
timestamp,
|
|
470
|
-
options.timezone
|
|
471
|
-
).utcOffset() * 60000;
|
|
411
|
+
return -moment.tz(timestamp, options.timezone).utcOffset() * 60000;
|
|
472
412
|
};
|
|
473
413
|
}
|
|
474
414
|
}
|
|
475
|
-
|
|
476
415
|
// If not timezone is set, look for the getTimezoneOffset callback
|
|
477
416
|
if (this.useUTC && options.getTimezoneOffset) {
|
|
478
417
|
return function (timestamp) {
|
|
479
418
|
return options.getTimezoneOffset(timestamp) * 60000;
|
|
480
419
|
};
|
|
481
420
|
}
|
|
482
|
-
|
|
483
421
|
// Last, use the `timezoneOffset` option if set
|
|
484
422
|
return function () {
|
|
485
423
|
return (time.timezoneOffset || 0) * 60000;
|
|
486
424
|
};
|
|
487
425
|
},
|
|
488
|
-
|
|
489
426
|
/**
|
|
490
427
|
* Formats a JavaScript date timestamp (milliseconds since Jan 1st 1970)
|
|
491
428
|
* into a human readable date string. The format is a subset of the formats
|
|
@@ -513,105 +450,79 @@ Highcharts.Time.prototype = {
|
|
|
513
450
|
return H.defaultOptions.lang.invalidDate || '';
|
|
514
451
|
}
|
|
515
452
|
format = H.pick(format, '%Y-%m-%d %H:%M:%S');
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
//
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
// Hours in 24h format, 0 through 23
|
|
571
|
-
'k': hours,
|
|
572
|
-
// Two digits hours in 12h format, 00 through 11
|
|
573
|
-
'I': pad((hours % 12) || 12),
|
|
574
|
-
// Hours in 12h format, 1 through 12
|
|
575
|
-
'l': (hours % 12) || 12,
|
|
576
|
-
// Two digits minutes, 00 through 59
|
|
577
|
-
'M': pad(time.get('Minutes', date)),
|
|
578
|
-
// Upper case AM or PM
|
|
579
|
-
'p': hours < 12 ? 'AM' : 'PM',
|
|
580
|
-
// Lower case AM or PM
|
|
581
|
-
'P': hours < 12 ? 'am' : 'pm',
|
|
582
|
-
// Two digits seconds, 00 through 59
|
|
583
|
-
'S': pad(date.getSeconds()),
|
|
584
|
-
// Milliseconds (naming from Ruby)
|
|
585
|
-
'L': pad(Math.floor(timestamp % 1000), 3)
|
|
586
|
-
},
|
|
587
|
-
|
|
588
|
-
H.dateFormats
|
|
589
|
-
);
|
|
590
|
-
|
|
591
|
-
|
|
453
|
+
var time = this, date = new this.Date(timestamp),
|
|
454
|
+
// get the basic time values
|
|
455
|
+
hours = this.get('Hours', date), day = this.get('Day', date), dayOfMonth = this.get('Date', date), month = this.get('Month', date), fullYear = this.get('FullYear', date), lang = H.defaultOptions.lang, langWeekdays = lang.weekdays, shortWeekdays = lang.shortWeekdays, pad = H.pad,
|
|
456
|
+
// List all format keys. Custom formats can be added from the
|
|
457
|
+
// outside.
|
|
458
|
+
replacements = H.extend({
|
|
459
|
+
// Day
|
|
460
|
+
// Short weekday, like 'Mon'
|
|
461
|
+
a: shortWeekdays ?
|
|
462
|
+
shortWeekdays[day] :
|
|
463
|
+
langWeekdays[day].substr(0, 3),
|
|
464
|
+
// Long weekday, like 'Monday'
|
|
465
|
+
A: langWeekdays[day],
|
|
466
|
+
// Two digit day of the month, 01 to 31
|
|
467
|
+
d: pad(dayOfMonth),
|
|
468
|
+
// Day of the month, 1 through 31
|
|
469
|
+
e: pad(dayOfMonth, 2, ' '),
|
|
470
|
+
w: day,
|
|
471
|
+
// Week (none implemented)
|
|
472
|
+
// 'W': weekNumber(),
|
|
473
|
+
// Month
|
|
474
|
+
// Short month, like 'Jan'
|
|
475
|
+
b: lang.shortMonths[month],
|
|
476
|
+
// Long month, like 'January'
|
|
477
|
+
B: lang.months[month],
|
|
478
|
+
// Two digit month number, 01 through 12
|
|
479
|
+
m: pad(month + 1),
|
|
480
|
+
// Month number, 1 through 12 (#8150)
|
|
481
|
+
o: month + 1,
|
|
482
|
+
// Year
|
|
483
|
+
// Two digits year, like 09 for 2009
|
|
484
|
+
y: fullYear.toString().substr(2, 2),
|
|
485
|
+
// Four digits year, like 2009
|
|
486
|
+
Y: fullYear,
|
|
487
|
+
// Time
|
|
488
|
+
// Two digits hours in 24h format, 00 through 23
|
|
489
|
+
H: pad(hours),
|
|
490
|
+
// Hours in 24h format, 0 through 23
|
|
491
|
+
k: hours,
|
|
492
|
+
// Two digits hours in 12h format, 00 through 11
|
|
493
|
+
I: pad((hours % 12) || 12),
|
|
494
|
+
// Hours in 12h format, 1 through 12
|
|
495
|
+
l: (hours % 12) || 12,
|
|
496
|
+
// Two digits minutes, 00 through 59
|
|
497
|
+
M: pad(time.get('Minutes', date)),
|
|
498
|
+
// Upper case AM or PM
|
|
499
|
+
p: hours < 12 ? 'AM' : 'PM',
|
|
500
|
+
// Lower case AM or PM
|
|
501
|
+
P: hours < 12 ? 'am' : 'pm',
|
|
502
|
+
// Two digits seconds, 00 through 59
|
|
503
|
+
S: pad(date.getSeconds()),
|
|
504
|
+
// Milliseconds (naming from Ruby)
|
|
505
|
+
L: pad(Math.floor(timestamp % 1000), 3)
|
|
506
|
+
}, H.dateFormats);
|
|
592
507
|
// Do the replaces
|
|
593
508
|
H.objectEach(replacements, function (val, key) {
|
|
594
509
|
// Regex would do it in one line, but this is faster
|
|
595
510
|
while (format.indexOf('%' + key) !== -1) {
|
|
596
|
-
format = format.replace(
|
|
597
|
-
'%' + key,
|
|
598
|
-
typeof val === 'function' ? val.call(time, timestamp) : val
|
|
599
|
-
);
|
|
511
|
+
format = format.replace('%' + key, typeof val === 'function' ? val.call(time, timestamp) : val);
|
|
600
512
|
}
|
|
601
|
-
|
|
602
513
|
});
|
|
603
|
-
|
|
604
514
|
// Optionally capitalize the string and return
|
|
605
515
|
return capitalize ?
|
|
606
|
-
format.substr(0, 1).toUpperCase() +
|
|
516
|
+
(format.substr(0, 1).toUpperCase() +
|
|
517
|
+
format.substr(1)) :
|
|
607
518
|
format;
|
|
608
519
|
},
|
|
609
|
-
|
|
610
520
|
/**
|
|
611
521
|
* Resolve legacy formats of dateTimeLabelFormats (strings and arrays) into
|
|
612
522
|
* an object.
|
|
613
|
-
* @
|
|
614
|
-
* @
|
|
523
|
+
* @private
|
|
524
|
+
* @param {object|string} f - General format description
|
|
525
|
+
* @return {object} - The object definition
|
|
615
526
|
*/
|
|
616
527
|
resolveDTLFormat: function (f) {
|
|
617
528
|
if (!H.isObject(f, true)) {
|
|
@@ -624,7 +535,6 @@ Highcharts.Time.prototype = {
|
|
|
624
535
|
}
|
|
625
536
|
return f;
|
|
626
537
|
},
|
|
627
|
-
|
|
628
538
|
/**
|
|
629
539
|
* Return an array with time positions distributed on round time values
|
|
630
540
|
* right and right after min and max. Used in datetime axes as well as for
|
|
@@ -645,224 +555,130 @@ Highcharts.Time.prototype = {
|
|
|
645
555
|
*
|
|
646
556
|
* @return {Highcharts.TimeTicksObject}
|
|
647
557
|
*/
|
|
648
|
-
getTimeTicks: function (
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
startOfWeek
|
|
653
|
-
) {
|
|
654
|
-
var time = this,
|
|
655
|
-
Date = time.Date,
|
|
656
|
-
tickPositions = [],
|
|
657
|
-
i,
|
|
658
|
-
higherRanks = {},
|
|
659
|
-
minYear, // used in months and years as a basis for Date.UTC()
|
|
660
|
-
// When crossing DST, use the max. Resolves #6278.
|
|
661
|
-
minDate = new Date(min),
|
|
662
|
-
interval = normalizedInterval.unitRange,
|
|
663
|
-
count = normalizedInterval.count || 1,
|
|
664
|
-
variableDayLength,
|
|
665
|
-
minDay;
|
|
666
|
-
|
|
558
|
+
getTimeTicks: function (normalizedInterval, min, max, startOfWeek) {
|
|
559
|
+
var time = this, Date = time.Date, tickPositions = [], i, higherRanks = {}, minYear, // used in months and years as a basis for Date.UTC()
|
|
560
|
+
// When crossing DST, use the max. Resolves #6278.
|
|
561
|
+
minDate = new Date(min), interval = normalizedInterval.unitRange, count = normalizedInterval.count || 1, variableDayLength, minDay;
|
|
667
562
|
startOfWeek = pick(startOfWeek, 1);
|
|
668
|
-
|
|
669
563
|
if (defined(min)) { // #1300
|
|
670
|
-
time.set(
|
|
671
|
-
|
|
672
|
-
minDate,
|
|
673
|
-
interval >= timeUnits.second ?
|
|
674
|
-
0 : // #3935
|
|
675
|
-
count * Math.floor(
|
|
676
|
-
time.get('Milliseconds', minDate) / count
|
|
677
|
-
)
|
|
678
|
-
); // #3652, #3654
|
|
679
|
-
|
|
564
|
+
time.set('Milliseconds', minDate, interval >= timeUnits.second ?
|
|
565
|
+
0 : // #3935
|
|
566
|
+
count * Math.floor(time.get('Milliseconds', minDate) / count)); // #3652, #3654
|
|
680
567
|
if (interval >= timeUnits.second) { // second
|
|
681
|
-
time.set(
|
|
682
|
-
|
|
683
|
-
minDate
|
|
684
|
-
interval >= timeUnits.minute ?
|
|
685
|
-
0 : // #3935
|
|
686
|
-
count * Math.floor(time.get('Seconds', minDate) / count)
|
|
687
|
-
);
|
|
568
|
+
time.set('Seconds', minDate, interval >= timeUnits.minute ?
|
|
569
|
+
0 : // #3935
|
|
570
|
+
count * Math.floor(time.get('Seconds', minDate) / count));
|
|
688
571
|
}
|
|
689
|
-
|
|
690
572
|
if (interval >= timeUnits.minute) { // minute
|
|
691
|
-
time.set(
|
|
692
|
-
|
|
693
|
-
minDate
|
|
694
|
-
interval >= timeUnits.hour ?
|
|
695
|
-
0 :
|
|
696
|
-
count * Math.floor(time.get('Minutes', minDate) / count)
|
|
697
|
-
);
|
|
573
|
+
time.set('Minutes', minDate, interval >= timeUnits.hour ?
|
|
574
|
+
0 :
|
|
575
|
+
count * Math.floor(time.get('Minutes', minDate) / count));
|
|
698
576
|
}
|
|
699
|
-
|
|
700
577
|
if (interval >= timeUnits.hour) { // hour
|
|
701
|
-
time.set(
|
|
702
|
-
|
|
703
|
-
minDate
|
|
704
|
-
interval >= timeUnits.day ?
|
|
705
|
-
0 :
|
|
706
|
-
count * Math.floor(
|
|
707
|
-
time.get('Hours', minDate) / count
|
|
708
|
-
)
|
|
709
|
-
);
|
|
578
|
+
time.set('Hours', minDate, interval >= timeUnits.day ?
|
|
579
|
+
0 :
|
|
580
|
+
count * Math.floor(time.get('Hours', minDate) / count));
|
|
710
581
|
}
|
|
711
|
-
|
|
712
582
|
if (interval >= timeUnits.day) { // day
|
|
713
|
-
time.set(
|
|
714
|
-
|
|
715
|
-
minDate
|
|
716
|
-
interval >= timeUnits.month ?
|
|
717
|
-
1 :
|
|
718
|
-
Math.max(
|
|
719
|
-
1,
|
|
720
|
-
count * Math.floor(
|
|
721
|
-
time.get('Date', minDate) / count
|
|
722
|
-
)
|
|
723
|
-
)
|
|
724
|
-
);
|
|
583
|
+
time.set('Date', minDate, interval >= timeUnits.month ?
|
|
584
|
+
1 :
|
|
585
|
+
Math.max(1, count * Math.floor(time.get('Date', minDate) / count)));
|
|
725
586
|
}
|
|
726
|
-
|
|
727
587
|
if (interval >= timeUnits.month) { // month
|
|
728
|
-
time.set(
|
|
729
|
-
'Month',
|
|
730
|
-
minDate,
|
|
731
|
-
interval >= timeUnits.year ? 0 :
|
|
732
|
-
count * Math.floor(time.get('Month', minDate) / count)
|
|
733
|
-
);
|
|
588
|
+
time.set('Month', minDate, interval >= timeUnits.year ? 0 :
|
|
589
|
+
count * Math.floor(time.get('Month', minDate) / count));
|
|
734
590
|
minYear = time.get('FullYear', minDate);
|
|
735
591
|
}
|
|
736
|
-
|
|
737
592
|
if (interval >= timeUnits.year) { // year
|
|
738
593
|
minYear -= minYear % count;
|
|
739
594
|
time.set('FullYear', minDate, minYear);
|
|
740
595
|
}
|
|
741
|
-
|
|
742
596
|
// week is a special case that runs outside the hierarchy
|
|
743
597
|
if (interval === timeUnits.week) {
|
|
744
598
|
// get start of current week, independent of count
|
|
745
599
|
minDay = time.get('Day', minDate);
|
|
746
|
-
time.set(
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
(
|
|
750
|
-
|
|
751
|
-
minDay + startOfWeek +
|
|
752
|
-
// We don't want to skip days that are before
|
|
753
|
-
// startOfWeek (#7051)
|
|
754
|
-
(minDay < startOfWeek ? -7 : 0)
|
|
755
|
-
)
|
|
756
|
-
);
|
|
600
|
+
time.set('Date', minDate, (time.get('Date', minDate) -
|
|
601
|
+
minDay + startOfWeek +
|
|
602
|
+
// We don't want to skip days that are before
|
|
603
|
+
// startOfWeek (#7051)
|
|
604
|
+
(minDay < startOfWeek ? -7 : 0)));
|
|
757
605
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
606
|
// Get basics for variable time spans
|
|
761
607
|
minYear = time.get('FullYear', minDate);
|
|
762
|
-
var minMonth = time.get('Month', minDate),
|
|
763
|
-
minDateDate = time.get('Date', minDate),
|
|
764
|
-
minHours = time.get('Hours', minDate);
|
|
765
|
-
|
|
608
|
+
var minMonth = time.get('Month', minDate), minDateDate = time.get('Date', minDate), minHours = time.get('Hours', minDate);
|
|
766
609
|
// Redefine min to the floored/rounded minimum time (#7432)
|
|
767
610
|
min = minDate.getTime();
|
|
768
|
-
|
|
769
611
|
// Handle local timezone offset
|
|
770
612
|
if (time.variableTimezone) {
|
|
771
|
-
|
|
772
613
|
// Detect whether we need to take the DST crossover into
|
|
773
614
|
// consideration. If we're crossing over DST, the day length may
|
|
774
615
|
// be 23h or 25h and we need to compute the exact clock time for
|
|
775
616
|
// each tick instead of just adding hours. This comes at a cost,
|
|
776
617
|
// so first we find out if it is needed (#4951).
|
|
777
618
|
variableDayLength = (
|
|
778
|
-
|
|
779
|
-
|
|
619
|
+
// Long range, assume we're crossing over.
|
|
620
|
+
max - min > 4 * timeUnits.month ||
|
|
780
621
|
// Short range, check if min and max are in different time
|
|
781
622
|
// zones.
|
|
782
|
-
time.getTimezoneOffset(min) !==
|
|
783
|
-
|
|
623
|
+
time.getTimezoneOffset(min) !==
|
|
624
|
+
time.getTimezoneOffset(max));
|
|
784
625
|
}
|
|
785
|
-
|
|
786
626
|
// Iterate and add tick positions at appropriate values
|
|
787
627
|
var t = minDate.getTime();
|
|
788
|
-
|
|
789
628
|
i = 1;
|
|
790
629
|
while (t < max) {
|
|
791
630
|
tickPositions.push(t);
|
|
792
|
-
|
|
793
631
|
// if the interval is years, use Date.UTC to increase years
|
|
794
632
|
if (interval === timeUnits.year) {
|
|
795
633
|
t = time.makeTime(minYear + i * count, 0);
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
634
|
+
// if the interval is months, use Date.UTC to increase months
|
|
635
|
+
}
|
|
636
|
+
else if (interval === timeUnits.month) {
|
|
799
637
|
t = time.makeTime(minYear, minMonth + i * count);
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
minMonth,
|
|
810
|
-
minDateDate +
|
|
811
|
-
i * count * (interval === timeUnits.day ? 1 : 7)
|
|
812
|
-
);
|
|
813
|
-
|
|
814
|
-
} else if (
|
|
815
|
-
variableDayLength &&
|
|
638
|
+
// if we're using global time, the interval is not fixed as it
|
|
639
|
+
// jumps one hour at the DST crossover
|
|
640
|
+
}
|
|
641
|
+
else if (variableDayLength &&
|
|
642
|
+
(interval === timeUnits.day || interval === timeUnits.week)) {
|
|
643
|
+
t = time.makeTime(minYear, minMonth, minDateDate +
|
|
644
|
+
i * count * (interval === timeUnits.day ? 1 : 7));
|
|
645
|
+
}
|
|
646
|
+
else if (variableDayLength &&
|
|
816
647
|
interval === timeUnits.hour &&
|
|
817
|
-
count > 1
|
|
818
|
-
) {
|
|
648
|
+
count > 1) {
|
|
819
649
|
// make sure higher ranks are preserved across DST (#6797,
|
|
820
650
|
// #7621)
|
|
821
|
-
t = time.makeTime(
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
minHours + i * count
|
|
826
|
-
);
|
|
827
|
-
|
|
828
|
-
// else, the interval is fixed and we use simple addition
|
|
829
|
-
} else {
|
|
651
|
+
t = time.makeTime(minYear, minMonth, minDateDate, minHours + i * count);
|
|
652
|
+
// else, the interval is fixed and we use simple addition
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
830
655
|
t += interval * count;
|
|
831
656
|
}
|
|
832
|
-
|
|
833
657
|
i++;
|
|
834
658
|
}
|
|
835
|
-
|
|
836
659
|
// push the last time
|
|
837
660
|
tickPositions.push(t);
|
|
838
|
-
|
|
839
|
-
|
|
840
661
|
// Handle higher ranks. Mark new days if the time is on midnight
|
|
841
662
|
// (#950, #1649, #1760, #3349). Use a reasonable dropout threshold
|
|
842
663
|
// to prevent looping over dense data grouping (#6156).
|
|
843
664
|
if (interval <= timeUnits.hour && tickPositions.length < 10000) {
|
|
844
665
|
tickPositions.forEach(function (t) {
|
|
845
666
|
if (
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
667
|
+
// Speed optimization, no need to run dateFormat unless
|
|
668
|
+
// we're on a full or half hour
|
|
669
|
+
t % 1800000 === 0 &&
|
|
849
670
|
// Check for local or global midnight
|
|
850
|
-
time.dateFormat('%H%M%S%L', t) === '000000000'
|
|
851
|
-
) {
|
|
671
|
+
time.dateFormat('%H%M%S%L', t) === '000000000') {
|
|
852
672
|
higherRanks[t] = 'day';
|
|
853
673
|
}
|
|
854
674
|
});
|
|
855
675
|
}
|
|
856
676
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
677
|
// record information on the chosen unit - for dynamic label formatter
|
|
860
678
|
tickPositions.info = extend(normalizedInterval, {
|
|
861
679
|
higherRanks: higherRanks,
|
|
862
680
|
totalRange: interval * count
|
|
863
681
|
});
|
|
864
|
-
|
|
865
682
|
return tickPositions;
|
|
866
683
|
}
|
|
867
|
-
|
|
868
684
|
}; // end of Time
|