highcharts 11.4.6 → 11.4.7
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/es-modules/Accessibility/Components/InfoRegionsComponent.js +12 -1
- package/es-modules/Core/Chart/Chart.js +1 -5
- package/es-modules/Core/Chart/StockChart.js +3 -5
- package/es-modules/Core/Defaults.js +1 -1
- package/es-modules/Core/Pointer.js +3 -2
- package/es-modules/Core/Renderer/SVG/Symbols.js +2 -2
- package/es-modules/Core/Tooltip.js +5 -4
- package/es-modules/Data/Connectors/GoogleSheetsConnector.js +18 -13
- package/es-modules/Data/Connectors/JSONConnector.js +0 -1
- package/es-modules/Data/Converters/DataConverter.js +0 -2
- package/es-modules/Data/DataTable.js +163 -252
- package/es-modules/Data/Modifiers/ChainModifier.js +17 -18
- package/es-modules/Data/Modifiers/MathModifier.js +4 -4
- package/es-modules/Data/Modifiers/RangeModifier.js +15 -4
- package/es-modules/Data/Modifiers/SortModifier.js +7 -1
- package/es-modules/Extensions/Annotations/Annotation.js +2 -2
- package/es-modules/Extensions/Boost/BoostSeries.js +3 -1
- package/es-modules/Extensions/Boost/WGLRenderer.js +0 -6
- package/es-modules/Series/Bubble/BubblePoint.js +9 -1
- package/es-modules/Series/Heatmap/HeatmapSeries.js +6 -1
- package/es-modules/Stock/Navigator/Navigator.js +1 -0
- package/es-modules/tsconfig.tsbuildinfo +1 -1
- package/highcharts-3d.js +1 -1
- package/highcharts-3d.src.js +1 -1
- package/highcharts-gantt.js +3 -3
- package/highcharts-gantt.src.js +17 -18
- package/highcharts-more.js +2 -2
- package/highcharts-more.src.js +10 -2
- package/highcharts.d.ts +2034 -452
- package/highcharts.js +3 -3
- package/highcharts.src.d.ts +2034 -452
- package/highcharts.src.js +16 -18
- package/highmaps.js +3 -3
- package/highmaps.src.js +31 -20
- package/highstock.js +3 -3
- package/highstock.src.js +20 -23
- 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/cmo.js +1 -1
- package/indicators/cmo.src.js +1 -1
- package/indicators/dema.js +1 -1
- package/indicators/dema.src.js +1 -1
- package/indicators/disparity-index.js +1 -1
- package/indicators/disparity-index.src.js +1 -1
- package/indicators/dmi.js +1 -1
- package/indicators/dmi.src.js +1 -1
- package/indicators/dpo.js +1 -1
- package/indicators/dpo.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 +1 -1
- package/indicators/indicators-all.src.js +1 -1
- package/indicators/indicators.js +1 -1
- package/indicators/indicators.src.js +1 -1
- package/indicators/keltner-channels.js +1 -1
- package/indicators/keltner-channels.src.js +1 -1
- package/indicators/klinger.js +1 -1
- package/indicators/klinger.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/obv.js +1 -1
- package/indicators/obv.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/slow-stochastic.js +1 -1
- package/indicators/slow-stochastic.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/trendline.js +1 -1
- package/indicators/trendline.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 +2 -2
- package/modules/accessibility.src.js +14 -2
- package/modules/annotations-advanced.js +2 -2
- package/modules/annotations-advanced.src.js +5 -5
- package/modules/annotations.js +2 -2
- package/modules/annotations.src.js +5 -5
- package/modules/arc-diagram.js +2 -2
- package/modules/arc-diagram.src.js +4 -4
- package/modules/arrow-symbols.js +1 -1
- package/modules/arrow-symbols.src.js +1 -1
- package/modules/boost-canvas.js +2 -2
- package/modules/boost-canvas.src.js +4 -8
- package/modules/boost.js +2 -2
- package/modules/boost.src.js +4 -8
- package/modules/broken-axis.js +1 -1
- package/modules/broken-axis.src.js +1 -1
- package/modules/bullet.js +1 -1
- package/modules/bullet.src.js +1 -1
- package/modules/coloraxis.js +1 -1
- package/modules/coloraxis.src.js +1 -1
- 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.src.js +1 -1
- package/modules/data-tools.js +2 -2
- package/modules/data-tools.src.js +225 -296
- package/modules/data.js +1 -1
- package/modules/data.src.js +1 -1
- package/modules/datagrouping.js +1 -1
- package/modules/datagrouping.src.js +1 -1
- package/modules/debugger.js +1 -1
- package/modules/debugger.src.js +1 -1
- 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 +1 -1
- package/modules/drilldown.js +1 -1
- package/modules/drilldown.src.js +1 -1
- package/modules/dumbbell.js +1 -1
- package/modules/dumbbell.src.js +1 -1
- package/modules/export-data.js +1 -1
- package/modules/export-data.src.js +1 -1
- package/modules/exporting.js +1 -1
- package/modules/exporting.src.js +1 -1
- package/modules/flowmap.js +1 -1
- package/modules/flowmap.src.js +1 -1
- package/modules/full-screen.js +1 -1
- package/modules/full-screen.src.js +1 -1
- package/modules/funnel.js +1 -1
- package/modules/funnel.src.js +1 -1
- package/modules/funnel3d.js +1 -1
- package/modules/funnel3d.src.js +1 -1
- package/modules/gantt.js +2 -2
- package/modules/gantt.src.js +2 -1
- package/modules/geoheatmap.js +1 -1
- package/modules/geoheatmap.src.js +1 -1
- package/modules/grid-axis.js +1 -1
- package/modules/grid-axis.src.js +1 -1
- package/modules/heatmap.js +2 -2
- package/modules/heatmap.src.js +7 -2
- package/modules/heikinashi.js +1 -1
- package/modules/heikinashi.src.js +1 -1
- package/modules/histogram-bellcurve.js +1 -1
- package/modules/histogram-bellcurve.src.js +1 -1
- package/modules/hollowcandlestick.js +1 -1
- package/modules/hollowcandlestick.src.js +1 -1
- package/modules/item-series.js +1 -1
- package/modules/item-series.src.js +1 -1
- package/modules/lollipop.js +1 -1
- package/modules/lollipop.src.js +1 -1
- package/modules/map.js +2 -2
- package/modules/map.src.js +16 -3
- package/modules/marker-clusters.js +1 -1
- package/modules/marker-clusters.src.js +1 -1
- package/modules/mouse-wheel-zoom.js +1 -1
- package/modules/mouse-wheel-zoom.src.js +1 -1
- package/modules/navigator.js +2 -2
- package/modules/navigator.src.js +2 -1
- package/modules/networkgraph.js +1 -1
- package/modules/networkgraph.src.js +1 -1
- package/modules/no-data-to-display.js +1 -1
- package/modules/no-data-to-display.src.js +1 -1
- package/modules/offline-exporting.js +2 -2
- package/modules/offline-exporting.src.js +2 -2
- package/modules/organization.js +1 -1
- package/modules/organization.src.js +1 -1
- 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.src.js +1 -1
- package/modules/pathfinder.js +1 -1
- package/modules/pathfinder.src.js +1 -1
- package/modules/pattern-fill.js +1 -1
- package/modules/pattern-fill.src.js +1 -1
- package/modules/pictorial.js +1 -1
- package/modules/pictorial.src.js +1 -1
- package/modules/price-indicator.js +1 -1
- package/modules/price-indicator.src.js +1 -1
- package/modules/pyramid3d.js +1 -1
- package/modules/pyramid3d.src.js +1 -1
- package/modules/sankey.js +1 -1
- package/modules/sankey.src.js +1 -1
- package/modules/series-label.js +1 -1
- package/modules/series-label.src.js +1 -1
- package/modules/series-on-point.js +1 -1
- package/modules/series-on-point.src.js +1 -1
- package/modules/solid-gauge.js +1 -1
- package/modules/solid-gauge.src.js +1 -1
- package/modules/sonification.js +1 -1
- package/modules/sonification.src.js +1 -1
- package/modules/static-scale.js +1 -1
- package/modules/static-scale.src.js +1 -1
- package/modules/stock-tools.js +2 -2
- package/modules/stock-tools.src.js +3 -3
- package/modules/stock.js +2 -2
- package/modules/stock.src.js +5 -6
- package/modules/streamgraph.js +1 -1
- package/modules/streamgraph.src.js +1 -1
- package/modules/sunburst.js +1 -1
- package/modules/sunburst.src.js +1 -1
- package/modules/textpath.js +1 -1
- package/modules/textpath.src.js +1 -1
- package/modules/tiledwebmap.js +1 -1
- package/modules/tiledwebmap.src.js +1 -1
- package/modules/tilemap.js +1 -1
- package/modules/tilemap.src.js +1 -1
- package/modules/timeline.js +1 -1
- package/modules/timeline.src.js +1 -1
- package/modules/treegraph.js +1 -1
- package/modules/treegraph.src.js +1 -1
- package/modules/treegrid.js +1 -1
- package/modules/treegrid.src.js +1 -1
- package/modules/treemap.js +1 -1
- package/modules/treemap.src.js +1 -1
- package/modules/variable-pie.js +1 -1
- package/modules/variable-pie.src.js +1 -1
- package/modules/variwide.js +1 -1
- package/modules/variwide.src.js +1 -1
- package/modules/vector.js +1 -1
- package/modules/vector.src.js +1 -1
- package/modules/venn.js +1 -1
- package/modules/venn.src.js +1 -1
- package/modules/windbarb.js +1 -1
- package/modules/windbarb.src.js +1 -1
- package/modules/wordcloud.js +1 -1
- package/modules/wordcloud.src.js +1 -1
- package/modules/xrange.js +1 -1
- package/modules/xrange.src.js +1 -1
- package/options/abands.d.ts +9 -2
- package/options/abands.src.d.ts +9 -2
- package/options/ad.d.ts +18 -4
- package/options/ad.src.d.ts +18 -4
- package/options/apo.d.ts +18 -4
- package/options/apo.src.d.ts +18 -4
- package/options/arearange.d.ts +18 -4
- package/options/arearange.src.d.ts +18 -4
- package/options/areaspline.d.ts +18 -4
- package/options/areaspline.src.d.ts +18 -4
- package/options/areasplinerange.d.ts +9 -2
- package/options/areasplinerange.src.d.ts +9 -2
- package/options/aroonoscillator.d.ts +9 -2
- package/options/aroonoscillator.src.d.ts +9 -2
- package/options/bar.d.ts +9 -2
- package/options/bar.src.d.ts +9 -2
- package/options/bb.d.ts +18 -4
- package/options/bb.src.d.ts +18 -4
- package/options/bubble.d.ts +9 -2
- package/options/bubble.src.d.ts +9 -2
- package/options/bullet.d.ts +9 -2
- package/options/bullet.src.d.ts +9 -2
- package/options/candlestick.d.ts +18 -4
- package/options/candlestick.src.d.ts +18 -4
- package/options/cci.d.ts +9 -2
- package/options/cci.src.d.ts +9 -2
- package/options/chaikin.d.ts +9 -2
- package/options/chaikin.src.d.ts +9 -2
- package/options/cmf.d.ts +9 -2
- package/options/cmf.src.d.ts +9 -2
- package/options/cmo.d.ts +9 -2
- package/options/cmo.src.d.ts +9 -2
- package/options/column.d.ts +18 -4
- package/options/column.src.d.ts +18 -4
- package/options/columnpyramid.d.ts +18 -4
- package/options/columnpyramid.src.d.ts +18 -4
- package/options/columnrange.d.ts +18 -4
- package/options/columnrange.src.d.ts +18 -4
- package/options/cylinder.d.ts +9 -2
- package/options/cylinder.src.d.ts +9 -2
- package/options/dema.d.ts +18 -4
- package/options/dema.src.d.ts +18 -4
- package/options/dependencywheel.d.ts +18 -4
- package/options/dependencywheel.src.d.ts +18 -4
- package/options/disparityindex.d.ts +9 -2
- package/options/disparityindex.src.d.ts +9 -2
- package/options/dmi.d.ts +9 -2
- package/options/dmi.src.d.ts +9 -2
- package/options/dpo.d.ts +9 -2
- package/options/dpo.src.d.ts +9 -2
- package/options/dumbbell.d.ts +9 -2
- package/options/dumbbell.src.d.ts +9 -2
- package/options/ema.d.ts +18 -4
- package/options/ema.src.d.ts +18 -4
- package/options/flags.d.ts +9 -2
- package/options/flags.src.d.ts +9 -2
- package/options/funnel.d.ts +18 -4
- package/options/funnel.src.d.ts +18 -4
- package/options/gantt.d.ts +18 -4
- package/options/gantt.src.d.ts +18 -4
- package/options/gauge.d.ts +9 -2
- package/options/gauge.src.d.ts +9 -2
- package/options/histogram.d.ts +9 -2
- package/options/histogram.src.d.ts +9 -2
- package/options/hlc.d.ts +9 -2
- package/options/hlc.src.d.ts +9 -2
- package/options/hollowcandlestick.d.ts +9 -2
- package/options/hollowcandlestick.src.d.ts +9 -2
- package/options/keltnerchannels.d.ts +9 -2
- package/options/keltnerchannels.src.d.ts +9 -2
- package/options/klinger.d.ts +9 -2
- package/options/klinger.src.d.ts +9 -2
- package/options/line.d.ts +9 -2
- package/options/line.src.d.ts +9 -2
- package/options/linearregression.d.ts +18 -4
- package/options/linearregression.src.d.ts +18 -4
- package/options/linearregressionangle.d.ts +9 -2
- package/options/linearregressionangle.src.d.ts +9 -2
- package/options/lollipop.d.ts +18 -4
- package/options/lollipop.src.d.ts +18 -4
- package/options/macd.d.ts +9 -2
- package/options/macd.src.d.ts +9 -2
- package/options/map.d.ts +18 -4
- package/options/map.src.d.ts +18 -4
- package/options/mapbubble.d.ts +9 -2
- package/options/mapbubble.src.d.ts +9 -2
- package/options/mapline.d.ts +9 -2
- package/options/mapline.src.d.ts +9 -2
- package/options/mfi.d.ts +9 -2
- package/options/mfi.src.d.ts +9 -2
- package/options/momentum.d.ts +9 -2
- package/options/momentum.src.d.ts +9 -2
- package/options/natr.d.ts +9 -2
- package/options/natr.src.d.ts +9 -2
- package/options/obv.d.ts +9 -2
- package/options/obv.src.d.ts +9 -2
- package/options/ohlc.d.ts +18 -4
- package/options/ohlc.src.d.ts +18 -4
- package/options/organization.d.ts +9 -2
- package/options/organization.src.d.ts +9 -2
- package/options/packedbubble.d.ts +9 -2
- package/options/packedbubble.src.d.ts +9 -2
- package/options/pareto.d.ts +18 -4
- package/options/pareto.src.d.ts +18 -4
- package/options/pc.d.ts +9 -2
- package/options/pc.src.d.ts +9 -2
- package/options/pie.d.ts +9 -2
- package/options/pie.src.d.ts +9 -2
- package/options/polygon.d.ts +9 -2
- package/options/polygon.src.d.ts +9 -2
- package/options/ppo.d.ts +18 -4
- package/options/ppo.src.d.ts +18 -4
- package/options/psar.d.ts +18 -4
- package/options/psar.src.d.ts +18 -4
- package/options/pyramid.d.ts +36 -8
- package/options/pyramid.src.d.ts +36 -8
- package/options/roc.d.ts +9 -2
- package/options/roc.src.d.ts +9 -2
- package/options/rsi.d.ts +9 -2
- package/options/rsi.src.d.ts +9 -2
- package/options/sankey.d.ts +18 -4
- package/options/sankey.src.d.ts +18 -4
- package/options/scatter.d.ts +9 -2
- package/options/scatter.src.d.ts +9 -2
- package/options/series.d.ts +9 -2
- package/options/series.src.d.ts +9 -2
- package/options/slowstochastic.d.ts +9 -2
- package/options/slowstochastic.src.d.ts +9 -2
- package/options/sma.d.ts +9 -2
- package/options/sma.src.d.ts +9 -2
- package/options/solidgauge.d.ts +9 -2
- package/options/solidgauge.src.d.ts +9 -2
- package/options/spline.d.ts +9 -2
- package/options/spline.src.d.ts +9 -2
- package/options/stochastic.d.ts +18 -4
- package/options/stochastic.src.d.ts +18 -4
- package/options/streamgraph.d.ts +9 -2
- package/options/streamgraph.src.d.ts +9 -2
- package/options/sunburst.d.ts +18 -4
- package/options/sunburst.src.d.ts +18 -4
- package/options/supertrend.d.ts +9 -2
- package/options/supertrend.src.d.ts +9 -2
- package/options/tema.d.ts +9 -2
- package/options/tema.src.d.ts +9 -2
- package/options/tiledwebmap.d.ts +9 -2
- package/options/tiledwebmap.src.d.ts +9 -2
- package/options/tilemap.d.ts +9 -2
- package/options/tilemap.src.d.ts +9 -2
- package/options/treegraph.d.ts +18 -4
- package/options/treegraph.src.d.ts +18 -4
- package/options/treemap.d.ts +18 -4
- package/options/treemap.src.d.ts +18 -4
- package/options/trendline.d.ts +9 -2
- package/options/trendline.src.d.ts +9 -2
- package/options/trix.d.ts +9 -2
- package/options/trix.src.d.ts +9 -2
- package/options/variablepie.d.ts +18 -4
- package/options/variablepie.src.d.ts +18 -4
- package/options/variwide.d.ts +18 -4
- package/options/variwide.src.d.ts +18 -4
- package/options/vbp.d.ts +9 -2
- package/options/vbp.src.d.ts +9 -2
- package/options/vector.d.ts +9 -2
- package/options/vector.src.d.ts +9 -2
- package/options/vwap.d.ts +9 -2
- package/options/vwap.src.d.ts +9 -2
- package/options/waterfall.d.ts +18 -4
- package/options/waterfall.src.d.ts +18 -4
- package/options/williamsr.d.ts +9 -2
- package/options/williamsr.src.d.ts +9 -2
- package/options/wma.d.ts +9 -2
- package/options/wma.src.d.ts +9 -2
- package/options/wordcloud.d.ts +9 -2
- package/options/wordcloud.src.d.ts +9 -2
- package/options/xrange.d.ts +18 -4
- package/options/xrange.src.d.ts +18 -4
- package/package.json +1 -1
- package/standalone-navigator.js +2 -2
- package/standalone-navigator.src.js +16 -17
- package/themes/avocado.js +1 -1
- package/themes/avocado.src.js +1 -1
- package/themes/brand-dark.js +1 -1
- package/themes/brand-dark.src.js +1 -1
- package/themes/brand-light.js +1 -1
- package/themes/brand-light.src.js +1 -1
- package/themes/dark-blue.js +1 -1
- package/themes/dark-blue.src.js +1 -1
- package/themes/dark-green.js +1 -1
- package/themes/dark-green.src.js +1 -1
- package/themes/dark-unica.js +1 -1
- package/themes/dark-unica.src.js +1 -1
- package/themes/gray.js +1 -1
- package/themes/gray.src.js +1 -1
- package/themes/grid-light.js +1 -1
- package/themes/grid-light.src.js +1 -1
- package/themes/grid.js +1 -1
- package/themes/grid.src.js +1 -1
- package/themes/high-contrast-dark.js +1 -1
- package/themes/high-contrast-dark.src.js +1 -1
- package/themes/high-contrast-light.js +1 -1
- package/themes/high-contrast-light.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 +1 -1
- package/themes/sunset.src.js +1 -1
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
* - Sophie Bremer
|
|
11
11
|
* - Gøran Slettemark
|
|
12
12
|
* - Jomar Hønsi
|
|
13
|
+
* - Dawid Dragula
|
|
13
14
|
*
|
|
14
15
|
* */
|
|
15
16
|
'use strict';
|
|
16
17
|
import U from '../Core/Utilities.js';
|
|
17
|
-
const { addEvent, fireEvent, uniqueKey } = U;
|
|
18
|
+
const { addEvent, defined, fireEvent, uniqueKey } = U;
|
|
18
19
|
/* *
|
|
19
20
|
*
|
|
20
21
|
* Class
|
|
@@ -95,17 +96,6 @@ class DataTable {
|
|
|
95
96
|
* Options to initialize the new DataTable instance.
|
|
96
97
|
*/
|
|
97
98
|
constructor(options = {}) {
|
|
98
|
-
/**
|
|
99
|
-
* Dictionary of all column aliases and their mapped column. If a column
|
|
100
|
-
* for one of the get-methods matches an column alias, this column will
|
|
101
|
-
* be replaced with the mapped column by the column alias.
|
|
102
|
-
*
|
|
103
|
-
* @name Highcharts.DataTable#aliases
|
|
104
|
-
* @type {Highcharts.Dictionary<string>}
|
|
105
|
-
*/
|
|
106
|
-
this.aliases = (options.aliases ?
|
|
107
|
-
JSON.parse(JSON.stringify(options.aliases)) :
|
|
108
|
-
{});
|
|
109
99
|
/**
|
|
110
100
|
* Whether the ID was automatic generated or given in the constructor.
|
|
111
101
|
*
|
|
@@ -124,7 +114,6 @@ class DataTable {
|
|
|
124
114
|
this.modified = this;
|
|
125
115
|
this.rowCount = 0;
|
|
126
116
|
this.versionTag = uniqueKey();
|
|
127
|
-
this.rowKeysId = options.rowKeysId;
|
|
128
117
|
const columns = options.columns || {}, columnNames = Object.keys(columns), thisColumns = this.columns;
|
|
129
118
|
let rowCount = 0;
|
|
130
119
|
for (let i = 0, iEnd = columnNames.length, column, columnName; i < iEnd; ++i) {
|
|
@@ -137,12 +126,6 @@ class DataTable {
|
|
|
137
126
|
thisColumns[columnNames[i]].length = rowCount;
|
|
138
127
|
}
|
|
139
128
|
this.rowCount = rowCount;
|
|
140
|
-
const aliases = options.aliases || {}, aliasKeys = Object.keys(aliases), thisAliases = this.aliases;
|
|
141
|
-
for (let i = 0, iEnd = aliasKeys.length, alias; i < iEnd; ++i) {
|
|
142
|
-
alias = aliasKeys[i];
|
|
143
|
-
thisAliases[alias] = aliases[alias];
|
|
144
|
-
}
|
|
145
|
-
this.setRowKeysColumn(rowCount);
|
|
146
129
|
}
|
|
147
130
|
/* *
|
|
148
131
|
*
|
|
@@ -172,18 +155,16 @@ class DataTable {
|
|
|
172
155
|
const table = this, tableOptions = {};
|
|
173
156
|
table.emit({ type: 'cloneTable', detail: eventDetail });
|
|
174
157
|
if (!skipColumns) {
|
|
175
|
-
tableOptions.aliases = table.aliases;
|
|
176
158
|
tableOptions.columns = table.columns;
|
|
177
159
|
}
|
|
178
160
|
if (!table.autoId) {
|
|
179
161
|
tableOptions.id = table.id;
|
|
180
162
|
}
|
|
181
|
-
if (table.rowKeysId) {
|
|
182
|
-
tableOptions.rowKeysId = table.rowKeysId;
|
|
183
|
-
}
|
|
184
163
|
const tableClone = new DataTable(tableOptions);
|
|
185
164
|
if (!skipColumns) {
|
|
186
165
|
tableClone.versionTag = table.versionTag;
|
|
166
|
+
tableClone.originalRowIndexes = table.originalRowIndexes;
|
|
167
|
+
tableClone.localRowIndexes = table.localRowIndexes;
|
|
187
168
|
}
|
|
188
169
|
table.emit({
|
|
189
170
|
type: 'afterCloneTable',
|
|
@@ -192,36 +173,13 @@ class DataTable {
|
|
|
192
173
|
});
|
|
193
174
|
return tableClone;
|
|
194
175
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Deletes a column alias and returns the original column name. If the alias
|
|
197
|
-
* is not found, the method returns `undefined`. Deleting an alias does not
|
|
198
|
-
* affect the data in the table, only the way columns are accessed.
|
|
199
|
-
*
|
|
200
|
-
* @function Highcharts.DataTable#deleteColumnAlias
|
|
201
|
-
*
|
|
202
|
-
* @param {string} alias
|
|
203
|
-
* The alias to delete.
|
|
204
|
-
*
|
|
205
|
-
* @return {string|undefined}
|
|
206
|
-
* Returns the original column name, if found.
|
|
207
|
-
*/
|
|
208
|
-
deleteColumnAlias(alias) {
|
|
209
|
-
const table = this, aliases = table.aliases, deletedAlias = aliases[alias], modifier = table.modifier;
|
|
210
|
-
if (deletedAlias) {
|
|
211
|
-
delete table.aliases[alias];
|
|
212
|
-
if (modifier) {
|
|
213
|
-
modifier.modifyColumns(table, { [deletedAlias]: new Array(table.rowCount) }, 0);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return deletedAlias;
|
|
217
|
-
}
|
|
218
176
|
/**
|
|
219
177
|
* Deletes columns from the table.
|
|
220
178
|
*
|
|
221
179
|
* @function Highcharts.DataTable#deleteColumns
|
|
222
180
|
*
|
|
223
181
|
* @param {Array<string>} [columnNames]
|
|
224
|
-
* Names
|
|
182
|
+
* Names of columns to delete. If no array is provided, all
|
|
225
183
|
* columns will be deleted.
|
|
226
184
|
*
|
|
227
185
|
* @param {Highcharts.DataTableEventDetail} [eventDetail]
|
|
@@ -251,14 +209,9 @@ class DataTable {
|
|
|
251
209
|
}
|
|
252
210
|
delete columns[columnName];
|
|
253
211
|
}
|
|
254
|
-
|
|
255
|
-
if (table.rowKeysId && nColumns === 1) {
|
|
256
|
-
// All columns deleted, remove row keys column
|
|
257
|
-
delete columns[table.rowKeysId];
|
|
258
|
-
nColumns = 0;
|
|
259
|
-
}
|
|
260
|
-
if (!nColumns) {
|
|
212
|
+
if (!Object.keys(columns).length) {
|
|
261
213
|
table.rowCount = 0;
|
|
214
|
+
this.deleteRowIndexReferences();
|
|
262
215
|
}
|
|
263
216
|
if (modifier) {
|
|
264
217
|
modifier.modifyColumns(table, modifiedColumns, 0, eventDetail);
|
|
@@ -272,6 +225,18 @@ class DataTable {
|
|
|
272
225
|
return deletedColumns;
|
|
273
226
|
}
|
|
274
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Deletes the row index references. This is useful when the original table
|
|
230
|
+
* is deleted, and the references are no longer needed. This table is
|
|
231
|
+
* then considered an original table or a table that has the same row's
|
|
232
|
+
* order as the original table.
|
|
233
|
+
*/
|
|
234
|
+
deleteRowIndexReferences() {
|
|
235
|
+
delete this.originalRowIndexes;
|
|
236
|
+
delete this.localRowIndexes;
|
|
237
|
+
// Here, in case of future need, can be implemented updating of the
|
|
238
|
+
// modified tables' row indexes references.
|
|
239
|
+
}
|
|
275
240
|
/**
|
|
276
241
|
* Deletes rows in this table.
|
|
277
242
|
*
|
|
@@ -359,8 +324,8 @@ class DataTable {
|
|
|
359
324
|
*
|
|
360
325
|
* @function Highcharts.DataTable#getCell
|
|
361
326
|
*
|
|
362
|
-
* @param {string}
|
|
363
|
-
* Column name
|
|
327
|
+
* @param {string} columnName
|
|
328
|
+
* Column name of the cell to retrieve.
|
|
364
329
|
*
|
|
365
330
|
* @param {number} rowIndex
|
|
366
331
|
* Row index of the cell to retrieve.
|
|
@@ -368,11 +333,9 @@ class DataTable {
|
|
|
368
333
|
* @return {Highcharts.DataTableCellType|undefined}
|
|
369
334
|
* Returns the cell value or `undefined`.
|
|
370
335
|
*/
|
|
371
|
-
getCell(
|
|
336
|
+
getCell(columnName, rowIndex) {
|
|
372
337
|
const table = this;
|
|
373
|
-
|
|
374
|
-
columnNameOrAlias);
|
|
375
|
-
const column = table.columns[columnNameOrAlias];
|
|
338
|
+
const column = table.columns[columnName];
|
|
376
339
|
if (column) {
|
|
377
340
|
return column[rowIndex];
|
|
378
341
|
}
|
|
@@ -382,8 +345,8 @@ class DataTable {
|
|
|
382
345
|
*
|
|
383
346
|
* @function Highcharts.DataTable#getCellAsBoolean
|
|
384
347
|
*
|
|
385
|
-
* @param {string}
|
|
386
|
-
* Column name
|
|
348
|
+
* @param {string} columnName
|
|
349
|
+
* Column name to fetch.
|
|
387
350
|
*
|
|
388
351
|
* @param {number} rowIndex
|
|
389
352
|
* Row index to fetch.
|
|
@@ -391,11 +354,9 @@ class DataTable {
|
|
|
391
354
|
* @return {boolean}
|
|
392
355
|
* Returns the cell value of the row as a boolean.
|
|
393
356
|
*/
|
|
394
|
-
getCellAsBoolean(
|
|
357
|
+
getCellAsBoolean(columnName, rowIndex) {
|
|
395
358
|
const table = this;
|
|
396
|
-
|
|
397
|
-
columnNameOrAlias);
|
|
398
|
-
const column = table.columns[columnNameOrAlias];
|
|
359
|
+
const column = table.columns[columnName];
|
|
399
360
|
return !!(column && column[rowIndex]);
|
|
400
361
|
}
|
|
401
362
|
/**
|
|
@@ -403,8 +364,8 @@ class DataTable {
|
|
|
403
364
|
*
|
|
404
365
|
* @function Highcharts.DataTable#getCellAsNumber
|
|
405
366
|
*
|
|
406
|
-
* @param {string}
|
|
407
|
-
* Column name or
|
|
367
|
+
* @param {string} columnName
|
|
368
|
+
* Column name or to fetch.
|
|
408
369
|
*
|
|
409
370
|
* @param {number} rowIndex
|
|
410
371
|
* Row index to fetch.
|
|
@@ -415,11 +376,9 @@ class DataTable {
|
|
|
415
376
|
* @return {number|null}
|
|
416
377
|
* Returns the cell value of the row as a number.
|
|
417
378
|
*/
|
|
418
|
-
getCellAsNumber(
|
|
379
|
+
getCellAsNumber(columnName, rowIndex, useNaN) {
|
|
419
380
|
const table = this;
|
|
420
|
-
|
|
421
|
-
columnNameOrAlias);
|
|
422
|
-
const column = table.columns[columnNameOrAlias];
|
|
381
|
+
const column = table.columns[columnName];
|
|
423
382
|
let cellValue = (column && column[rowIndex]);
|
|
424
383
|
switch (typeof cellValue) {
|
|
425
384
|
case 'boolean':
|
|
@@ -435,8 +394,8 @@ class DataTable {
|
|
|
435
394
|
*
|
|
436
395
|
* @function Highcharts.DataTable#getCellAsString
|
|
437
396
|
*
|
|
438
|
-
* @param {string}
|
|
439
|
-
* Column name
|
|
397
|
+
* @param {string} columnName
|
|
398
|
+
* Column name to fetch.
|
|
440
399
|
*
|
|
441
400
|
* @param {number} rowIndex
|
|
442
401
|
* Row index to fetch.
|
|
@@ -444,22 +403,20 @@ class DataTable {
|
|
|
444
403
|
* @return {string}
|
|
445
404
|
* Returns the cell value of the row as a string.
|
|
446
405
|
*/
|
|
447
|
-
getCellAsString(
|
|
406
|
+
getCellAsString(columnName, rowIndex) {
|
|
448
407
|
const table = this;
|
|
449
|
-
|
|
450
|
-
columnNameOrAlias);
|
|
451
|
-
const column = table.columns[columnNameOrAlias];
|
|
408
|
+
const column = table.columns[columnName];
|
|
452
409
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
453
410
|
return `${(column && column[rowIndex])}`;
|
|
454
411
|
}
|
|
455
412
|
/**
|
|
456
|
-
* Fetches the given column by the canonical column name
|
|
413
|
+
* Fetches the given column by the canonical column name.
|
|
457
414
|
* This function is a simplified wrap of {@link getColumns}.
|
|
458
415
|
*
|
|
459
416
|
* @function Highcharts.DataTable#getColumn
|
|
460
417
|
*
|
|
461
|
-
* @param {string}
|
|
462
|
-
* Name
|
|
418
|
+
* @param {string} columnName
|
|
419
|
+
* Name of the column to get.
|
|
463
420
|
*
|
|
464
421
|
* @param {boolean} [asReference]
|
|
465
422
|
* Whether to return the column as a readonly reference.
|
|
@@ -467,11 +424,11 @@ class DataTable {
|
|
|
467
424
|
* @return {Highcharts.DataTableColumn|undefined}
|
|
468
425
|
* A copy of the column, or `undefined` if not found.
|
|
469
426
|
*/
|
|
470
|
-
getColumn(
|
|
471
|
-
return this.getColumns([
|
|
427
|
+
getColumn(columnName, asReference) {
|
|
428
|
+
return this.getColumns([columnName], asReference)[columnName];
|
|
472
429
|
}
|
|
473
430
|
/**
|
|
474
|
-
* Fetches the given column by the canonical column name
|
|
431
|
+
* Fetches the given column by the canonical column name, and
|
|
475
432
|
* validates the type of the first few cells. If the first defined cell is
|
|
476
433
|
* of type number, it assumes for performance reasons, that all cells are of
|
|
477
434
|
* type number or `null`. Otherwise it will convert all cells to number
|
|
@@ -479,8 +436,8 @@ class DataTable {
|
|
|
479
436
|
*
|
|
480
437
|
* @function Highcharts.DataTable#getColumnAsNumbers
|
|
481
438
|
*
|
|
482
|
-
* @param {string}
|
|
483
|
-
* Name
|
|
439
|
+
* @param {string} columnName
|
|
440
|
+
* Name of the column to get.
|
|
484
441
|
*
|
|
485
442
|
* @param {boolean} [useNaN]
|
|
486
443
|
* Whether to use NaN instead of `null` and `undefined`.
|
|
@@ -488,16 +445,14 @@ class DataTable {
|
|
|
488
445
|
* @return {Array<(number|null)>}
|
|
489
446
|
* A copy of the column, or an empty array if not found.
|
|
490
447
|
*/
|
|
491
|
-
getColumnAsNumbers(
|
|
448
|
+
getColumnAsNumbers(columnName, useNaN) {
|
|
492
449
|
const table = this, columns = table.columns;
|
|
493
|
-
|
|
494
|
-
columnNameOrAlias);
|
|
495
|
-
const column = columns[columnNameOrAlias], columnAsNumber = [];
|
|
450
|
+
const column = columns[columnName], columnAsNumber = [];
|
|
496
451
|
if (column) {
|
|
497
452
|
const columnLength = column.length;
|
|
498
453
|
if (useNaN) {
|
|
499
454
|
for (let i = 0; i < columnLength; ++i) {
|
|
500
|
-
columnAsNumber.push(table.getCellAsNumber(
|
|
455
|
+
columnAsNumber.push(table.getCellAsNumber(columnName, i, true));
|
|
501
456
|
}
|
|
502
457
|
}
|
|
503
458
|
else {
|
|
@@ -513,7 +468,7 @@ class DataTable {
|
|
|
513
468
|
}
|
|
514
469
|
}
|
|
515
470
|
for (let i = 0; i < columnLength; ++i) {
|
|
516
|
-
columnAsNumber.push(table.getCellAsNumber(
|
|
471
|
+
columnAsNumber.push(table.getCellAsNumber(columnName, i));
|
|
517
472
|
}
|
|
518
473
|
}
|
|
519
474
|
}
|
|
@@ -529,7 +484,6 @@ class DataTable {
|
|
|
529
484
|
*/
|
|
530
485
|
getColumnNames() {
|
|
531
486
|
const table = this, columnNames = Object.keys(table.columns);
|
|
532
|
-
this.removeRowKeysColumn(columnNames);
|
|
533
487
|
return columnNames;
|
|
534
488
|
}
|
|
535
489
|
/**
|
|
@@ -537,8 +491,8 @@ class DataTable {
|
|
|
537
491
|
*
|
|
538
492
|
* @function Highcharts.DataTable#getColumns
|
|
539
493
|
*
|
|
540
|
-
* @param {Array<string>} [
|
|
541
|
-
* Column names
|
|
494
|
+
* @param {Array<string>} [columnNames]
|
|
495
|
+
* Column names to retrieve.
|
|
542
496
|
*
|
|
543
497
|
* @param {boolean} [asReference]
|
|
544
498
|
* Whether to return columns as a readonly reference.
|
|
@@ -547,19 +501,35 @@ class DataTable {
|
|
|
547
501
|
* Collection of columns. If a requested column was not found, it is
|
|
548
502
|
* `undefined`.
|
|
549
503
|
*/
|
|
550
|
-
getColumns(
|
|
551
|
-
const table = this,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
column = tableColumns[(tableAliasMap[columnName] || columnName)];
|
|
504
|
+
getColumns(columnNames, asReference) {
|
|
505
|
+
const table = this, tableColumns = table.columns, columns = {};
|
|
506
|
+
columnNames = (columnNames || Object.keys(tableColumns));
|
|
507
|
+
for (let i = 0, iEnd = columnNames.length, column, columnName; i < iEnd; ++i) {
|
|
508
|
+
columnName = columnNames[i];
|
|
509
|
+
column = tableColumns[columnName];
|
|
557
510
|
if (column) {
|
|
558
511
|
columns[columnName] = (asReference ? column : column.slice());
|
|
559
512
|
}
|
|
560
513
|
}
|
|
561
514
|
return columns;
|
|
562
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* Takes the original row index and returns the local row index in the
|
|
518
|
+
* modified table for which this function is called.
|
|
519
|
+
*
|
|
520
|
+
* @param {number} originalRowIndex
|
|
521
|
+
* Original row index to get the local row index for.
|
|
522
|
+
*
|
|
523
|
+
* @return {number|undefined}
|
|
524
|
+
* Returns the local row index or `undefined` if not found.
|
|
525
|
+
*/
|
|
526
|
+
getLocalRowIndex(originalRowIndex) {
|
|
527
|
+
const { localRowIndexes } = this;
|
|
528
|
+
if (localRowIndexes) {
|
|
529
|
+
return localRowIndexes[originalRowIndex];
|
|
530
|
+
}
|
|
531
|
+
return originalRowIndex;
|
|
532
|
+
}
|
|
563
533
|
/**
|
|
564
534
|
* Retrieves the modifier for the table.
|
|
565
535
|
* @private
|
|
@@ -570,6 +540,23 @@ class DataTable {
|
|
|
570
540
|
getModifier() {
|
|
571
541
|
return this.modifier;
|
|
572
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Takes the local row index and returns the index of the corresponding row
|
|
545
|
+
* in the original table.
|
|
546
|
+
*
|
|
547
|
+
* @param {number} rowIndex
|
|
548
|
+
* Local row index to get the original row index for.
|
|
549
|
+
*
|
|
550
|
+
* @return {number|undefined}
|
|
551
|
+
* Returns the original row index or `undefined` if not found.
|
|
552
|
+
*/
|
|
553
|
+
getOriginalRowIndex(rowIndex) {
|
|
554
|
+
const { originalRowIndexes } = this;
|
|
555
|
+
if (originalRowIndexes) {
|
|
556
|
+
return originalRowIndexes[rowIndex];
|
|
557
|
+
}
|
|
558
|
+
return rowIndex;
|
|
559
|
+
}
|
|
573
560
|
/**
|
|
574
561
|
* Retrieves the row at a given index. This function is a simplified wrap of
|
|
575
562
|
* {@link getRows}.
|
|
@@ -579,14 +566,14 @@ class DataTable {
|
|
|
579
566
|
* @param {number} rowIndex
|
|
580
567
|
* Row index to retrieve. First row has index 0.
|
|
581
568
|
*
|
|
582
|
-
* @param {Array<string>} [
|
|
583
|
-
* Column names
|
|
569
|
+
* @param {Array<string>} [columnNames]
|
|
570
|
+
* Column names in order to retrieve.
|
|
584
571
|
*
|
|
585
572
|
* @return {Highcharts.DataTableRow}
|
|
586
573
|
* Returns the row values, or `undefined` if not found.
|
|
587
574
|
*/
|
|
588
|
-
getRow(rowIndex,
|
|
589
|
-
return this.getRows(rowIndex, 1,
|
|
575
|
+
getRow(rowIndex, columnNames) {
|
|
576
|
+
return this.getRows(rowIndex, 1, columnNames)[0];
|
|
590
577
|
}
|
|
591
578
|
/**
|
|
592
579
|
* Returns the number of rows in this table.
|
|
@@ -605,7 +592,7 @@ class DataTable {
|
|
|
605
592
|
*
|
|
606
593
|
* @function Highcharts.DataTable#getRowIndexBy
|
|
607
594
|
*
|
|
608
|
-
* @param {string}
|
|
595
|
+
* @param {string} columnName
|
|
609
596
|
* Column to search in.
|
|
610
597
|
*
|
|
611
598
|
* @param {Highcharts.DataTableCellType} cellValue
|
|
@@ -617,11 +604,9 @@ class DataTable {
|
|
|
617
604
|
* @return {number|undefined}
|
|
618
605
|
* Index of the first row matching the cell value.
|
|
619
606
|
*/
|
|
620
|
-
getRowIndexBy(
|
|
607
|
+
getRowIndexBy(columnName, cellValue, rowIndexOffset) {
|
|
621
608
|
const table = this;
|
|
622
|
-
|
|
623
|
-
columnNameOrAlias);
|
|
624
|
-
const column = table.columns[columnNameOrAlias];
|
|
609
|
+
const column = table.columns[columnName];
|
|
625
610
|
if (column) {
|
|
626
611
|
const rowIndex = column.indexOf(cellValue, rowIndexOffset);
|
|
627
612
|
if (rowIndex !== -1) {
|
|
@@ -638,14 +623,14 @@ class DataTable {
|
|
|
638
623
|
* @param {number} rowIndex
|
|
639
624
|
* Row index.
|
|
640
625
|
*
|
|
641
|
-
* @param {Array<string>} [
|
|
642
|
-
* Column names
|
|
626
|
+
* @param {Array<string>} [columnNames]
|
|
627
|
+
* Column names and their order to retrieve.
|
|
643
628
|
*
|
|
644
629
|
* @return {Highcharts.DataTableRowObject}
|
|
645
630
|
* Returns the row values, or `undefined` if not found.
|
|
646
631
|
*/
|
|
647
|
-
getRowObject(rowIndex,
|
|
648
|
-
return this.getRowObjects(rowIndex, 1,
|
|
632
|
+
getRowObject(rowIndex, columnNames) {
|
|
633
|
+
return this.getRowObjects(rowIndex, 1, columnNames)[0];
|
|
649
634
|
}
|
|
650
635
|
/**
|
|
651
636
|
* Fetches all or a number of rows.
|
|
@@ -658,20 +643,19 @@ class DataTable {
|
|
|
658
643
|
* @param {number} [rowCount]
|
|
659
644
|
* Number of rows to fetch. Defaults to maximal number of rows.
|
|
660
645
|
*
|
|
661
|
-
* @param {Array<string>} [
|
|
662
|
-
* Column names
|
|
646
|
+
* @param {Array<string>} [columnNames]
|
|
647
|
+
* Column names and their order to retrieve.
|
|
663
648
|
*
|
|
664
649
|
* @return {Highcharts.DataTableRowObject}
|
|
665
650
|
* Returns retrieved rows.
|
|
666
651
|
*/
|
|
667
|
-
getRowObjects(rowIndex = 0, rowCount = (this.rowCount - rowIndex),
|
|
668
|
-
const table = this,
|
|
669
|
-
|
|
670
|
-
this.removeRowKeysColumn(columnNamesOrAliases);
|
|
652
|
+
getRowObjects(rowIndex = 0, rowCount = (this.rowCount - rowIndex), columnNames) {
|
|
653
|
+
const table = this, columns = table.columns, rows = new Array(rowCount);
|
|
654
|
+
columnNames = (columnNames || Object.keys(columns));
|
|
671
655
|
for (let i = rowIndex, i2 = 0, iEnd = Math.min(table.rowCount, (rowIndex + rowCount)), column, row; i < iEnd; ++i, ++i2) {
|
|
672
656
|
row = rows[i2] = {};
|
|
673
|
-
for (const columnName of
|
|
674
|
-
column = columns[
|
|
657
|
+
for (const columnName of columnNames) {
|
|
658
|
+
column = columns[columnName];
|
|
675
659
|
row[columnName] = (column ? column[i] : void 0);
|
|
676
660
|
}
|
|
677
661
|
}
|
|
@@ -688,19 +672,19 @@ class DataTable {
|
|
|
688
672
|
* @param {number} [rowCount]
|
|
689
673
|
* Number of rows to fetch. Defaults to maximal number of rows.
|
|
690
674
|
*
|
|
691
|
-
* @param {Array<string>} [
|
|
692
|
-
* Column names
|
|
675
|
+
* @param {Array<string>} [columnNames]
|
|
676
|
+
* Column names and their order to retrieve.
|
|
693
677
|
*
|
|
694
678
|
* @return {Highcharts.DataTableRow}
|
|
695
679
|
* Returns retrieved rows.
|
|
696
680
|
*/
|
|
697
|
-
getRows(rowIndex = 0, rowCount = (this.rowCount - rowIndex),
|
|
698
|
-
const table = this,
|
|
699
|
-
|
|
681
|
+
getRows(rowIndex = 0, rowCount = (this.rowCount - rowIndex), columnNames) {
|
|
682
|
+
const table = this, columns = table.columns, rows = new Array(rowCount);
|
|
683
|
+
columnNames = (columnNames || Object.keys(columns));
|
|
700
684
|
for (let i = rowIndex, i2 = 0, iEnd = Math.min(table.rowCount, (rowIndex + rowCount)), column, row; i < iEnd; ++i, ++i2) {
|
|
701
685
|
row = rows[i2] = [];
|
|
702
|
-
for (const columnName of
|
|
703
|
-
column = columns[
|
|
686
|
+
for (const columnName of columnNames) {
|
|
687
|
+
column = columns[columnName];
|
|
704
688
|
row.push(column ? column[i] : void 0);
|
|
705
689
|
}
|
|
706
690
|
}
|
|
@@ -718,21 +702,21 @@ class DataTable {
|
|
|
718
702
|
return this.versionTag;
|
|
719
703
|
}
|
|
720
704
|
/**
|
|
721
|
-
* Checks for given column names
|
|
705
|
+
* Checks for given column names.
|
|
722
706
|
*
|
|
723
707
|
* @function Highcharts.DataTable#hasColumns
|
|
724
708
|
*
|
|
725
|
-
* @param {Array<string>}
|
|
726
|
-
* Column names
|
|
709
|
+
* @param {Array<string>} columnNames
|
|
710
|
+
* Column names to check.
|
|
727
711
|
*
|
|
728
712
|
* @return {boolean}
|
|
729
713
|
* Returns `true` if all columns have been found, otherwise `false`.
|
|
730
714
|
*/
|
|
731
|
-
hasColumns(
|
|
732
|
-
const table = this,
|
|
733
|
-
for (let i = 0, iEnd =
|
|
734
|
-
columnName =
|
|
735
|
-
if (!columns[columnName]
|
|
715
|
+
hasColumns(columnNames) {
|
|
716
|
+
const table = this, columns = table.columns;
|
|
717
|
+
for (let i = 0, iEnd = columnNames.length, columnName; i < iEnd; ++i) {
|
|
718
|
+
columnName = columnNames[i];
|
|
719
|
+
if (!columns[columnName]) {
|
|
736
720
|
return false;
|
|
737
721
|
}
|
|
738
722
|
}
|
|
@@ -743,7 +727,7 @@ class DataTable {
|
|
|
743
727
|
*
|
|
744
728
|
* @function Highcharts.DataTable#hasRowWith
|
|
745
729
|
*
|
|
746
|
-
* @param {string}
|
|
730
|
+
* @param {string} columnName
|
|
747
731
|
* Column to search in.
|
|
748
732
|
*
|
|
749
733
|
* @param {Highcharts.DataTableCellType} cellValue
|
|
@@ -752,11 +736,9 @@ class DataTable {
|
|
|
752
736
|
* @return {boolean}
|
|
753
737
|
* True, if a row has been found, otherwise false.
|
|
754
738
|
*/
|
|
755
|
-
hasRowWith(
|
|
739
|
+
hasRowWith(columnName, cellValue) {
|
|
756
740
|
const table = this;
|
|
757
|
-
|
|
758
|
-
columnNameOrAlias);
|
|
759
|
-
const column = table.columns[columnNameOrAlias];
|
|
741
|
+
const column = table.columns[columnName];
|
|
760
742
|
if (column) {
|
|
761
743
|
return (column.indexOf(cellValue) !== -1);
|
|
762
744
|
}
|
|
@@ -798,29 +780,21 @@ class DataTable {
|
|
|
798
780
|
const table = this, columns = table.columns;
|
|
799
781
|
if (columns[columnName]) {
|
|
800
782
|
if (columnName !== newColumnName) {
|
|
801
|
-
const aliases = table.aliases;
|
|
802
|
-
if (aliases[newColumnName]) {
|
|
803
|
-
delete aliases[newColumnName];
|
|
804
|
-
}
|
|
805
783
|
columns[newColumnName] = columns[columnName];
|
|
806
784
|
delete columns[columnName];
|
|
807
|
-
if (table.rowKeysId) {
|
|
808
|
-
// Ensure that row keys column is last
|
|
809
|
-
this.moveRowKeysColumnToLast(columns, table.rowKeysId);
|
|
810
|
-
}
|
|
811
785
|
}
|
|
812
786
|
return true;
|
|
813
787
|
}
|
|
814
788
|
return false;
|
|
815
789
|
}
|
|
816
790
|
/**
|
|
817
|
-
* Sets a cell value based on the row index and column
|
|
791
|
+
* Sets a cell value based on the row index and column. Will
|
|
818
792
|
* insert a new column, if not found.
|
|
819
793
|
*
|
|
820
794
|
* @function Highcharts.DataTable#setCell
|
|
821
795
|
*
|
|
822
|
-
* @param {string}
|
|
823
|
-
* Column name
|
|
796
|
+
* @param {string} columnName
|
|
797
|
+
* Column name to set.
|
|
824
798
|
*
|
|
825
799
|
* @param {number|undefined} rowIndex
|
|
826
800
|
* Row index to set.
|
|
@@ -834,35 +808,33 @@ class DataTable {
|
|
|
834
808
|
* @emits #setCell
|
|
835
809
|
* @emits #afterSetCell
|
|
836
810
|
*/
|
|
837
|
-
setCell(
|
|
811
|
+
setCell(columnName, rowIndex, cellValue, eventDetail) {
|
|
838
812
|
const table = this, columns = table.columns, modifier = table.modifier;
|
|
839
|
-
|
|
840
|
-
columnNameOrAlias);
|
|
841
|
-
let column = columns[columnNameOrAlias];
|
|
813
|
+
let column = columns[columnName];
|
|
842
814
|
if (column && column[rowIndex] === cellValue) {
|
|
843
815
|
return;
|
|
844
816
|
}
|
|
845
817
|
table.emit({
|
|
846
818
|
type: 'setCell',
|
|
847
819
|
cellValue,
|
|
848
|
-
columnName:
|
|
820
|
+
columnName: columnName,
|
|
849
821
|
detail: eventDetail,
|
|
850
822
|
rowIndex
|
|
851
823
|
});
|
|
852
824
|
if (!column) {
|
|
853
|
-
column = columns[
|
|
825
|
+
column = columns[columnName] = new Array(table.rowCount);
|
|
854
826
|
}
|
|
855
827
|
if (rowIndex >= table.rowCount) {
|
|
856
828
|
table.rowCount = (rowIndex + 1);
|
|
857
829
|
}
|
|
858
830
|
column[rowIndex] = cellValue;
|
|
859
831
|
if (modifier) {
|
|
860
|
-
modifier.modifyCell(table,
|
|
832
|
+
modifier.modifyCell(table, columnName, rowIndex, cellValue);
|
|
861
833
|
}
|
|
862
834
|
table.emit({
|
|
863
835
|
type: 'afterSetCell',
|
|
864
836
|
cellValue,
|
|
865
|
-
columnName:
|
|
837
|
+
columnName: columnName,
|
|
866
838
|
detail: eventDetail,
|
|
867
839
|
rowIndex
|
|
868
840
|
});
|
|
@@ -872,8 +844,8 @@ class DataTable {
|
|
|
872
844
|
*
|
|
873
845
|
* @function Highcharts.DataTable#setColumn
|
|
874
846
|
*
|
|
875
|
-
* @param {string}
|
|
876
|
-
* Column name
|
|
847
|
+
* @param {string} columnName
|
|
848
|
+
* Column name to set.
|
|
877
849
|
*
|
|
878
850
|
* @param {Highcharts.DataTableColumn} [column]
|
|
879
851
|
* Values to set in the column.
|
|
@@ -887,8 +859,8 @@ class DataTable {
|
|
|
887
859
|
* @emits #setColumns
|
|
888
860
|
* @emits #afterSetColumns
|
|
889
861
|
*/
|
|
890
|
-
setColumn(
|
|
891
|
-
this.setColumns({ [
|
|
862
|
+
setColumn(columnName, column = [], rowIndex = 0, eventDetail) {
|
|
863
|
+
this.setColumns({ [columnName]: column }, rowIndex, eventDetail);
|
|
892
864
|
}
|
|
893
865
|
/**
|
|
894
866
|
* Sets cell values for multiple columns. Will insert new columns, if not
|
|
@@ -897,7 +869,7 @@ class DataTable {
|
|
|
897
869
|
* @function Highcharts.DataTable#setColumns
|
|
898
870
|
*
|
|
899
871
|
* @param {Highcharts.DataTableColumnCollection} columns
|
|
900
|
-
* Columns as a collection, where the keys are the column names
|
|
872
|
+
* Columns as a collection, where the keys are the column names.
|
|
901
873
|
*
|
|
902
874
|
* @param {number} [rowIndex]
|
|
903
875
|
* Index of the first row to change. Keep undefined to reset.
|
|
@@ -920,8 +892,6 @@ class DataTable {
|
|
|
920
892
|
for (let i = 0, iEnd = columnNames.length, column, columnName; i < iEnd; ++i) {
|
|
921
893
|
columnName = columnNames[i];
|
|
922
894
|
column = columns[columnName];
|
|
923
|
-
columnName = (table.aliases[columnName] ||
|
|
924
|
-
columnName);
|
|
925
895
|
if (reset) {
|
|
926
896
|
tableColumns[columnName] = column.slice();
|
|
927
897
|
table.rowCount = column.length;
|
|
@@ -943,10 +913,6 @@ class DataTable {
|
|
|
943
913
|
if (tableModifier) {
|
|
944
914
|
tableModifier.modifyColumns(table, columns, (rowIndex || 0));
|
|
945
915
|
}
|
|
946
|
-
if (table.rowKeysId) {
|
|
947
|
-
// Ensure that the row keys column is always last
|
|
948
|
-
this.moveRowKeysColumnToLast(tableColumns, table.rowKeysId);
|
|
949
|
-
}
|
|
950
916
|
table.emit({
|
|
951
917
|
type: 'afterSetColumns',
|
|
952
918
|
columns,
|
|
@@ -955,63 +921,6 @@ class DataTable {
|
|
|
955
921
|
rowIndex
|
|
956
922
|
});
|
|
957
923
|
}
|
|
958
|
-
/**
|
|
959
|
-
* Sets the row key column. This column is invisible and the cells
|
|
960
|
-
* serve as identifiers to the rows they are contained in. Accessing
|
|
961
|
-
* rows by keys instead of indexes is necessary in cases where rows
|
|
962
|
-
* are rearranged by a DataModifier (e.g. SortModifier or RangeModifier).
|
|
963
|
-
*
|
|
964
|
-
* @function Highcharts.DataTable#setRowKeysColumn
|
|
965
|
-
*
|
|
966
|
-
* @param {number} nRows
|
|
967
|
-
* Number of rows to add to the column.
|
|
968
|
-
*
|
|
969
|
-
*/
|
|
970
|
-
setRowKeysColumn(nRows) {
|
|
971
|
-
const id = this.rowKeysId;
|
|
972
|
-
if (!id) {
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
this.columns[id] = [];
|
|
976
|
-
const keysArray = this.columns[id];
|
|
977
|
-
for (let i = 0; i < nRows; i++) {
|
|
978
|
-
keysArray.push(id + '_' + i);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
/**
|
|
982
|
-
* Get the row key column.
|
|
983
|
-
*
|
|
984
|
-
* @function Highcharts.DataTable#getRowKeysColumn
|
|
985
|
-
* *
|
|
986
|
-
* @return {DataTable.Column|undefined}
|
|
987
|
-
* Returns row keys if rowKeysId is defined, else undefined.
|
|
988
|
-
*/
|
|
989
|
-
getRowKeysColumn() {
|
|
990
|
-
const id = this.rowKeysId;
|
|
991
|
-
if (id) {
|
|
992
|
-
return this.columns[id];
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
/**
|
|
996
|
-
* Get the row index in the original (unmodified) data table.
|
|
997
|
-
*
|
|
998
|
-
* @function Highcharts.DataTable#getRowIndexOriginal
|
|
999
|
-
*
|
|
1000
|
-
* @param {number} idx
|
|
1001
|
-
* Row index in the modified data table.
|
|
1002
|
-
*
|
|
1003
|
-
* @return {string}
|
|
1004
|
-
* Row index in the original data table.
|
|
1005
|
-
*/
|
|
1006
|
-
getRowIndexOriginal(idx) {
|
|
1007
|
-
const id = this.rowKeysId;
|
|
1008
|
-
if (id) {
|
|
1009
|
-
const rowKeyCol = this.columns[id];
|
|
1010
|
-
const idxOrig = '' + rowKeyCol[idx];
|
|
1011
|
-
return idxOrig.split('_')[1];
|
|
1012
|
-
}
|
|
1013
|
-
return String(idx);
|
|
1014
|
-
}
|
|
1015
924
|
/**
|
|
1016
925
|
* Sets or unsets the modifier for the table.
|
|
1017
926
|
*
|
|
@@ -1063,6 +972,29 @@ class DataTable {
|
|
|
1063
972
|
throw error;
|
|
1064
973
|
});
|
|
1065
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* Sets the original row indexes for the table. It is used to keep the
|
|
977
|
+
* reference to the original rows when modifying the table.
|
|
978
|
+
*
|
|
979
|
+
* @param {Array<number|undefined>} originalRowIndexes
|
|
980
|
+
* Original row indexes array.
|
|
981
|
+
*
|
|
982
|
+
* @param {boolean} omitLocalRowIndexes
|
|
983
|
+
* Whether to omit the local row indexes calculation. Defaults to `false`.
|
|
984
|
+
*/
|
|
985
|
+
setOriginalRowIndexes(originalRowIndexes, omitLocalRowIndexes = false) {
|
|
986
|
+
this.originalRowIndexes = originalRowIndexes;
|
|
987
|
+
if (omitLocalRowIndexes) {
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
const modifiedIndexes = this.localRowIndexes = [];
|
|
991
|
+
for (let i = 0, iEnd = originalRowIndexes.length, originalIndex; i < iEnd; ++i) {
|
|
992
|
+
originalIndex = originalRowIndexes[i];
|
|
993
|
+
if (defined(originalIndex)) {
|
|
994
|
+
modifiedIndexes[originalIndex] = i;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
1066
998
|
/**
|
|
1067
999
|
* Sets cell values of a row. Will insert a new row, if no index was
|
|
1068
1000
|
* provided, or if the index is higher than the total number of table rows.
|
|
@@ -1107,7 +1039,7 @@ class DataTable {
|
|
|
1107
1039
|
* @emits #afterSetRows
|
|
1108
1040
|
*/
|
|
1109
1041
|
setRows(rows, rowIndex = this.rowCount, eventDetail) {
|
|
1110
|
-
const table = this,
|
|
1042
|
+
const table = this, columns = table.columns, columnNames = Object.keys(columns), modifier = table.modifier, rowCount = rows.length;
|
|
1111
1043
|
table.emit({
|
|
1112
1044
|
type: 'setRows',
|
|
1113
1045
|
detail: eventDetail,
|
|
@@ -1131,7 +1063,6 @@ class DataTable {
|
|
|
1131
1063
|
const rowColumnNames = Object.keys(row);
|
|
1132
1064
|
for (let j = 0, jEnd = rowColumnNames.length, rowColumnName; j < jEnd; ++j) {
|
|
1133
1065
|
rowColumnName = rowColumnNames[j];
|
|
1134
|
-
rowColumnName = (aliases[rowColumnName] || rowColumnName);
|
|
1135
1066
|
if (!columns[rowColumnName]) {
|
|
1136
1067
|
columns[rowColumnName] = new Array(i2 + 1);
|
|
1137
1068
|
}
|
|
@@ -1146,9 +1077,6 @@ class DataTable {
|
|
|
1146
1077
|
columns[columnNames[i]].length = indexRowCount;
|
|
1147
1078
|
}
|
|
1148
1079
|
}
|
|
1149
|
-
if (this.rowKeysId && !columnNames.includes(this.rowKeysId)) {
|
|
1150
|
-
this.setRowKeysColumn(rowCount);
|
|
1151
|
-
}
|
|
1152
1080
|
if (modifier) {
|
|
1153
1081
|
modifier.modifyRows(table, rows, rowIndex);
|
|
1154
1082
|
}
|
|
@@ -1160,23 +1088,6 @@ class DataTable {
|
|
|
1160
1088
|
rows
|
|
1161
1089
|
});
|
|
1162
1090
|
}
|
|
1163
|
-
// The row keys column must always be the last column
|
|
1164
|
-
moveRowKeysColumnToLast(columns, id) {
|
|
1165
|
-
const rowKeyColumn = columns[id];
|
|
1166
|
-
delete columns[id];
|
|
1167
|
-
columns[id] = rowKeyColumn;
|
|
1168
|
-
}
|
|
1169
|
-
// The row keys column must be removed in some methods
|
|
1170
|
-
// (API backwards compatibility)
|
|
1171
|
-
removeRowKeysColumn(columnNamesOrAliases) {
|
|
1172
|
-
if (this.rowKeysId) {
|
|
1173
|
-
const pos = columnNamesOrAliases.indexOf(this.rowKeysId);
|
|
1174
|
-
if (pos !== -1) {
|
|
1175
|
-
// Always the last column
|
|
1176
|
-
columnNamesOrAliases.pop();
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
1091
|
}
|
|
1181
1092
|
/* *
|
|
1182
1093
|
*
|