stream-charts 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +809 -1022
- package/changes.md +40 -0
- package/dist/app/charts/Chart.d.ts +35 -139
- package/dist/app/charts/Chart.d.ts.map +1 -0
- package/dist/app/charts/Chart.js +74 -65
- package/dist/app/charts/Chart.js.map +1 -1
- package/dist/app/charts/axes/AxesState.d.ts +26 -18
- package/dist/app/charts/axes/AxesState.d.ts.map +1 -0
- package/dist/app/charts/axes/AxesState.js +26 -24
- package/dist/app/charts/axes/AxesState.js.map +1 -1
- package/dist/app/charts/axes/AxisInterval.d.ts +44 -26
- package/dist/app/charts/axes/AxisInterval.d.ts.map +1 -0
- package/dist/app/charts/axes/AxisInterval.js +48 -29
- package/dist/app/charts/axes/AxisInterval.js.map +1 -1
- package/dist/app/charts/axes/BaseAxisRange.d.ts +46 -22
- package/dist/app/charts/axes/BaseAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/BaseAxisRange.js +17 -12
- package/dist/app/charts/axes/BaseAxisRange.js.map +1 -1
- package/dist/app/charts/axes/ContinuousAxis.d.ts +47 -6
- package/dist/app/charts/axes/ContinuousAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/ContinuousAxis.js +160 -27
- package/dist/app/charts/axes/ContinuousAxis.js.map +1 -1
- package/dist/app/charts/axes/ContinuousAxisRange.d.ts +29 -10
- package/dist/app/charts/axes/ContinuousAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/ContinuousAxisRange.js +29 -11
- package/dist/app/charts/axes/ContinuousAxisRange.js.map +1 -1
- package/dist/app/charts/axes/EmptyAxis.d.ts +5 -2
- package/dist/app/charts/axes/EmptyAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/EmptyAxis.js +30 -9
- package/dist/app/charts/axes/EmptyAxis.js.map +1 -1
- package/dist/app/charts/axes/OrdinalAxis.d.ts +5 -3
- package/dist/app/charts/axes/OrdinalAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/OrdinalAxis.js +39 -16
- package/dist/app/charts/axes/OrdinalAxis.js.map +1 -1
- package/dist/app/charts/axes/OrdinalAxisRange.d.ts +76 -13
- package/dist/app/charts/axes/OrdinalAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/OrdinalAxisRange.js +95 -16
- package/dist/app/charts/axes/OrdinalAxisRange.js.map +1 -1
- package/dist/app/charts/axes/autoScale.d.ts +111 -0
- package/dist/app/charts/axes/autoScale.d.ts.map +1 -0
- package/dist/app/charts/axes/autoScale.js +188 -0
- package/dist/app/charts/axes/autoScale.js.map +1 -0
- package/dist/app/charts/axes/axes.d.ts +273 -150
- package/dist/app/charts/axes/axes.d.ts.map +1 -0
- package/dist/app/charts/axes/axes.js +808 -583
- package/dist/app/charts/axes/axes.js.map +1 -1
- package/dist/app/charts/d3types.d.ts +40 -11
- package/dist/app/charts/d3types.d.ts.map +1 -0
- package/dist/app/charts/d3types.js +3 -0
- package/dist/app/charts/d3types.js.map +1 -1
- package/dist/app/charts/datasources/StreamingDataSource.d.ts +149 -0
- package/dist/app/charts/datasources/StreamingDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/StreamingDataSource.js +110 -0
- package/dist/app/charts/datasources/StreamingDataSource.js.map +1 -0
- package/dist/app/charts/datasources/iteratesDataSource.d.ts +73 -0
- package/dist/app/charts/datasources/iteratesDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/iteratesDataSource.js +87 -0
- package/dist/app/charts/datasources/iteratesDataSource.js.map +1 -0
- package/dist/app/charts/datasources/ordinalDataSource.d.ts +75 -0
- package/dist/app/charts/datasources/ordinalDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/ordinalDataSource.js +135 -0
- package/dist/app/charts/datasources/ordinalDataSource.js.map +1 -0
- package/dist/app/charts/datasources/outlierDataSource.d.ts +53 -0
- package/dist/app/charts/datasources/outlierDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/outlierDataSource.js +57 -0
- package/dist/app/charts/datasources/outlierDataSource.js.map +1 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.d.ts +77 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.js +85 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.js.map +1 -0
- package/dist/app/charts/filters/regexFilter.d.ts +31 -4
- package/dist/app/charts/filters/regexFilter.d.ts.map +1 -0
- package/dist/app/charts/filters/regexFilter.js +38 -4
- package/dist/app/charts/filters/regexFilter.js.map +1 -1
- package/dist/app/charts/hooks/AxesProvider.d.ts +21 -0
- package/dist/app/charts/hooks/AxesProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/AxesProvider.js +213 -0
- package/dist/app/charts/hooks/AxesProvider.js.map +1 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts +25 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.js +76 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.js.map +1 -0
- package/dist/app/charts/hooks/ChartProvider.d.ts +40 -0
- package/dist/app/charts/hooks/ChartProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/ChartProvider.js +33 -0
- package/dist/app/charts/hooks/ChartProvider.js.map +1 -0
- package/dist/app/charts/hooks/InteractionProvider.d.ts +23 -0
- package/dist/app/charts/hooks/InteractionProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/InteractionProvider.js +60 -0
- package/dist/app/charts/hooks/InteractionProvider.js.map +1 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts +16 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.js +76 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.js.map +1 -0
- package/dist/app/charts/hooks/defaultAxesValues.d.ts +11 -0
- package/dist/app/charts/hooks/defaultAxesValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultAxesValues.js +36 -0
- package/dist/app/charts/hooks/defaultAxesValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultMouseValues.d.ts +9 -0
- package/dist/app/charts/hooks/defaultMouseValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultMouseValues.js +23 -0
- package/dist/app/charts/hooks/defaultMouseValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.d.ts +13 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.js +23 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.js.map +1 -0
- package/dist/app/charts/hooks/defaultTooltipValues.d.ts +9 -0
- package/dist/app/charts/hooks/defaultTooltipValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultTooltipValues.js +21 -0
- package/dist/app/charts/hooks/defaultTooltipValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultUseChartValues.d.ts +14 -0
- package/dist/app/charts/hooks/defaultUseChartValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultUseChartValues.js +30 -0
- package/dist/app/charts/hooks/defaultUseChartValues.js.map +1 -0
- package/dist/app/charts/hooks/useAxes.d.ts +49 -36
- package/dist/app/charts/hooks/useAxes.d.ts.map +1 -0
- package/dist/app/charts/hooks/useAxes.js +16 -176
- package/dist/app/charts/hooks/useAxes.js.map +1 -1
- package/dist/app/charts/hooks/useCanvasSurface.d.ts +25 -0
- package/dist/app/charts/hooks/useCanvasSurface.d.ts.map +1 -0
- package/dist/app/charts/hooks/useCanvasSurface.js +18 -0
- package/dist/app/charts/hooks/useCanvasSurface.js.map +1 -0
- package/dist/app/charts/hooks/useChart.d.ts +30 -44
- package/dist/app/charts/hooks/useChart.d.ts.map +1 -0
- package/dist/app/charts/hooks/useChart.js +26 -48
- package/dist/app/charts/hooks/useChart.js.map +1 -1
- package/dist/app/charts/hooks/useDataSource.d.ts +68 -0
- package/dist/app/charts/hooks/useDataSource.d.ts.map +1 -0
- package/dist/app/charts/hooks/useDataSource.js +63 -0
- package/dist/app/charts/hooks/useDataSource.js.map +1 -0
- package/dist/app/charts/hooks/useHoveredSeries.d.ts +25 -0
- package/dist/app/charts/hooks/useHoveredSeries.d.ts.map +1 -0
- package/dist/app/charts/hooks/useHoveredSeries.js +15 -0
- package/dist/app/charts/hooks/useHoveredSeries.js.map +1 -0
- package/dist/app/charts/hooks/useMouse.d.ts +46 -22
- package/dist/app/charts/hooks/useMouse.d.ts.map +1 -0
- package/dist/app/charts/hooks/useMouse.js +12 -56
- package/dist/app/charts/hooks/useMouse.js.map +1 -1
- package/dist/app/charts/hooks/usePlotDimensions.d.ts +25 -13
- package/dist/app/charts/hooks/usePlotDimensions.d.ts.map +1 -0
- package/dist/app/charts/hooks/usePlotDimensions.js +6 -62
- package/dist/app/charts/hooks/usePlotDimensions.js.map +1 -1
- package/dist/app/charts/hooks/useTooltip.d.ts +24 -26
- package/dist/app/charts/hooks/useTooltip.d.ts.map +1 -0
- package/dist/app/charts/hooks/useTooltip.js +12 -42
- package/dist/app/charts/hooks/useTooltip.js.map +1 -1
- package/dist/app/charts/index.d.ts +66 -0
- package/dist/app/charts/index.d.ts.map +1 -0
- package/dist/app/charts/index.js +87 -0
- package/dist/app/charts/index.js.map +1 -0
- package/dist/app/charts/legends/Legend.d.ts +33 -12
- package/dist/app/charts/legends/Legend.d.ts.map +1 -0
- package/dist/app/charts/legends/Legend.js +138 -379
- package/dist/app/charts/legends/Legend.js.map +1 -1
- package/dist/app/charts/legends/constants.d.ts +19 -0
- package/dist/app/charts/legends/constants.d.ts.map +1 -0
- package/dist/app/charts/legends/constants.js +34 -0
- package/dist/app/charts/legends/constants.js.map +1 -0
- package/dist/app/charts/observables/ChartData.d.ts +1 -0
- package/dist/app/charts/observables/ChartData.d.ts.map +1 -0
- package/dist/app/charts/observables/iterates.d.ts +13 -7
- package/dist/app/charts/observables/iterates.d.ts.map +1 -0
- package/dist/app/charts/observables/iterates.js +42 -9
- package/dist/app/charts/observables/iterates.js.map +1 -1
- package/dist/app/charts/observables/ordinals.d.ts +70 -12
- package/dist/app/charts/observables/ordinals.d.ts.map +1 -0
- package/dist/app/charts/observables/ordinals.js +127 -48
- package/dist/app/charts/observables/ordinals.js.map +1 -1
- package/dist/app/charts/observables/outliers.d.ts +18 -0
- package/dist/app/charts/observables/outliers.d.ts.map +1 -0
- package/dist/app/charts/observables/outliers.js +2 -0
- package/dist/app/charts/observables/outliers.js.map +1 -0
- package/dist/app/charts/plots/BarPlot.d.ts +87 -13
- package/dist/app/charts/plots/BarPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/BarPlot.js +603 -356
- package/dist/app/charts/plots/BarPlot.js.map +1 -1
- package/dist/app/charts/plots/OutlierPlot.d.ts +123 -0
- package/dist/app/charts/plots/OutlierPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/OutlierPlot.js +430 -0
- package/dist/app/charts/plots/OutlierPlot.js.map +1 -0
- package/dist/app/charts/plots/PoincarePlot.d.ts +92 -14
- package/dist/app/charts/plots/PoincarePlot.d.ts.map +1 -0
- package/dist/app/charts/plots/PoincarePlot.js +523 -364
- package/dist/app/charts/plots/PoincarePlot.js.map +1 -1
- package/dist/app/charts/plots/RasterPlot.d.ts +31 -10
- package/dist/app/charts/plots/RasterPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/RasterPlot.js +198 -306
- package/dist/app/charts/plots/RasterPlot.js.map +1 -1
- package/dist/app/charts/plots/ScatterPlot.d.ts +77 -21
- package/dist/app/charts/plots/ScatterPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/ScatterPlot.js +359 -302
- package/dist/app/charts/plots/ScatterPlot.js.map +1 -1
- package/dist/app/charts/plots/autoScaleYAxes.d.ts +43 -0
- package/dist/app/charts/plots/autoScaleYAxes.d.ts.map +1 -0
- package/dist/app/charts/plots/autoScaleYAxes.js +71 -0
- package/dist/app/charts/plots/autoScaleYAxes.js.map +1 -0
- package/dist/app/charts/plots/colorizedLine.d.ts +61 -0
- package/dist/app/charts/plots/colorizedLine.d.ts.map +1 -0
- package/dist/app/charts/plots/colorizedLine.js +157 -0
- package/dist/app/charts/plots/colorizedLine.js.map +1 -0
- package/dist/app/charts/plots/constants.d.ts +7 -0
- package/dist/app/charts/plots/constants.d.ts.map +1 -0
- package/dist/app/charts/plots/constants.js +11 -0
- package/dist/app/charts/plots/constants.js.map +1 -0
- package/dist/app/charts/plots/hitTesting.d.ts +88 -0
- package/dist/app/charts/plots/hitTesting.d.ts.map +1 -0
- package/dist/app/charts/plots/hitTesting.js +136 -0
- package/dist/app/charts/plots/hitTesting.js.map +1 -0
- package/dist/app/charts/plots/plot.d.ts +52 -16
- package/dist/app/charts/plots/plot.d.ts.map +1 -0
- package/dist/app/charts/plots/plot.js +108 -35
- package/dist/app/charts/plots/plot.js.map +1 -1
- package/dist/app/charts/plots/useCanvasZoomPan.d.ts +119 -0
- package/dist/app/charts/plots/useCanvasZoomPan.d.ts.map +1 -0
- package/dist/app/charts/plots/useCanvasZoomPan.js +113 -0
- package/dist/app/charts/plots/useCanvasZoomPan.js.map +1 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.d.ts +103 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.d.ts.map +1 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.js +257 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.js.map +1 -0
- package/dist/app/charts/series/baseSeries.d.ts +60 -8
- package/dist/app/charts/series/baseSeries.d.ts.map +1 -0
- package/dist/app/charts/series/baseSeries.js +53 -8
- package/dist/app/charts/series/baseSeries.js.map +1 -1
- package/dist/app/charts/series/iterateSeries.d.ts +9 -8
- package/dist/app/charts/series/iterateSeries.d.ts.map +1 -0
- package/dist/app/charts/series/iterateSeries.js +7 -7
- package/dist/app/charts/series/iterateSeries.js.map +1 -1
- package/dist/app/charts/series/ordinalSeries.d.ts +27 -13
- package/dist/app/charts/series/ordinalSeries.d.ts.map +1 -0
- package/dist/app/charts/series/ordinalSeries.js +29 -15
- package/dist/app/charts/series/ordinalSeries.js.map +1 -1
- package/dist/app/charts/series/outlierSeries.d.ts +142 -0
- package/dist/app/charts/series/outlierSeries.d.ts.map +1 -0
- package/dist/app/charts/series/outlierSeries.js +82 -0
- package/dist/app/charts/series/outlierSeries.js.map +1 -0
- package/dist/app/charts/series/timeSeries.d.ts +13 -9
- package/dist/app/charts/series/timeSeries.d.ts.map +1 -0
- package/dist/app/charts/series/timeSeries.js +6 -3
- package/dist/app/charts/series/timeSeries.js.map +1 -1
- package/dist/app/charts/series/timeSeriesChartData.d.ts +18 -10
- package/dist/app/charts/series/timeSeriesChartData.d.ts.map +1 -0
- package/dist/app/charts/series/timeSeriesChartData.js +28 -14
- package/dist/app/charts/series/timeSeriesChartData.js.map +1 -1
- package/dist/app/charts/styling/barPlotStyle.d.ts +46 -2
- package/dist/app/charts/styling/barPlotStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/barPlotStyle.js +37 -3
- package/dist/app/charts/styling/barPlotStyle.js.map +1 -1
- package/dist/app/charts/styling/canvasStyle.d.ts +53 -0
- package/dist/app/charts/styling/canvasStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/canvasStyle.js +71 -0
- package/dist/app/charts/styling/canvasStyle.js.map +1 -0
- package/dist/app/charts/styling/margins.d.ts +21 -2
- package/dist/app/charts/styling/margins.d.ts.map +1 -0
- package/dist/app/charts/styling/margins.js +25 -4
- package/dist/app/charts/styling/margins.js.map +1 -1
- package/dist/app/charts/styling/svgStyle.d.ts +10 -56
- package/dist/app/charts/styling/svgStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/svgStyle.js +3 -78
- package/dist/app/charts/styling/svgStyle.js.map +1 -1
- package/dist/app/charts/subscriptions/viewDrivers.d.ts +124 -0
- package/dist/app/charts/subscriptions/viewDrivers.d.ts.map +1 -0
- package/dist/app/charts/subscriptions/viewDrivers.js +338 -0
- package/dist/app/charts/subscriptions/viewDrivers.js.map +1 -0
- package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts +12 -78
- package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/BarPlotTooltipContent.js +65 -257
- package/dist/app/charts/tooltips/BarPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts +9 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js +16 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts +30 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js +26 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts +22 -72
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js +104 -171
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts +32 -8
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.js +62 -115
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts +39 -12
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js +162 -134
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/Tooltip.d.ts +27 -32
- package/dist/app/charts/tooltips/Tooltip.d.ts.map +1 -0
- package/dist/app/charts/tooltips/Tooltip.js +37 -81
- package/dist/app/charts/tooltips/Tooltip.js.map +1 -1
- package/dist/app/charts/tooltips/TooltipContent.d.ts +81 -0
- package/dist/app/charts/tooltips/TooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/TooltipContent.js +99 -0
- package/dist/app/charts/tooltips/TooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/tooltipUtils.d.ts +186 -36
- package/dist/app/charts/tooltips/tooltipUtils.d.ts.map +1 -0
- package/dist/app/charts/tooltips/tooltipUtils.js +277 -48
- package/dist/app/charts/tooltips/tooltipUtils.js.map +1 -1
- package/dist/app/charts/tooltips/useOutlierTooltip.d.ts +59 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.js +16 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.js.map +1 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.d.ts +51 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.js +52 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.js.map +1 -0
- package/dist/app/charts/tooltips/useTooltipStyle.d.ts +11 -0
- package/dist/app/charts/tooltips/useTooltipStyle.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useTooltipStyle.js +14 -0
- package/dist/app/charts/tooltips/useTooltipStyle.js.map +1 -0
- package/dist/app/charts/trackers/Tracker.d.ts +22 -6
- package/dist/app/charts/trackers/Tracker.d.ts.map +1 -0
- package/dist/app/charts/trackers/Tracker.js +36 -22
- package/dist/app/charts/trackers/Tracker.js.map +1 -1
- package/dist/app/charts/trackers/trackerUtils.d.ts +40 -18
- package/dist/app/charts/trackers/trackerUtils.d.ts.map +1 -0
- package/dist/app/charts/trackers/trackerUtils.js +213 -300
- package/dist/app/charts/trackers/trackerUtils.js.map +1 -1
- package/dist/app/charts/utils.d.ts +72 -33
- package/dist/app/charts/utils.d.ts.map +1 -0
- package/dist/app/charts/utils.js +87 -42
- package/dist/app/charts/utils.js.map +1 -1
- package/dist/index.d.ts +2 -45
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -72
- package/dist/index.js.map +1 -1
- package/package.json +87 -46
- package/src/app/charts/Chart.tsx +132 -168
- package/src/app/charts/axes/AxesState.ts +27 -29
- package/src/app/charts/axes/AxisInterval.ts +57 -32
- package/src/app/charts/axes/BaseAxisRange.ts +47 -27
- package/src/app/charts/axes/ContinuousAxis.tsx +235 -39
- package/src/app/charts/axes/ContinuousAxisRange.ts +29 -11
- package/src/app/charts/axes/EmptyAxis.tsx +52 -17
- package/src/app/charts/axes/OrdinalAxis.tsx +54 -28
- package/src/app/charts/axes/OrdinalAxisRange.ts +96 -16
- package/src/app/charts/axes/autoScale.ts +244 -0
- package/src/app/charts/axes/axes.ts +954 -735
- package/src/app/charts/d3types.ts +42 -13
- package/src/app/charts/datasources/StreamingDataSource.ts +214 -0
- package/src/app/charts/datasources/iteratesDataSource.ts +122 -0
- package/src/app/charts/datasources/ordinalDataSource.ts +205 -0
- package/src/app/charts/datasources/outlierDataSource.ts +90 -0
- package/src/app/charts/datasources/timeSeriesDataSource.ts +133 -0
- package/src/app/charts/filters/regexFilter.ts +45 -5
- package/src/app/charts/hooks/AxesProvider.tsx +301 -0
- package/src/app/charts/hooks/CanvasSurfaceProvider.tsx +117 -0
- package/src/app/charts/hooks/ChartProvider.tsx +79 -0
- package/src/app/charts/hooks/InteractionProvider.tsx +88 -0
- package/src/app/charts/hooks/PlotDimensionsProvider.tsx +109 -0
- package/src/app/charts/hooks/defaultAxesValues.ts +40 -0
- package/src/app/charts/hooks/defaultMouseValues.ts +24 -0
- package/src/app/charts/hooks/defaultPlotDimensions.ts +27 -0
- package/src/app/charts/hooks/defaultTooltipValues.tsx +23 -0
- package/src/app/charts/hooks/defaultUseChartValues.tsx +36 -0
- package/src/app/charts/hooks/useAxes.tsx +60 -228
- package/src/app/charts/hooks/useCanvasSurface.tsx +35 -0
- package/src/app/charts/hooks/useChart.tsx +47 -106
- package/src/app/charts/hooks/useDataSource.tsx +106 -0
- package/src/app/charts/hooks/useHoveredSeries.tsx +33 -0
- package/src/app/charts/hooks/useMouse.tsx +58 -82
- package/src/app/charts/hooks/usePlotDimensions.tsx +25 -89
- package/src/app/charts/hooks/useTooltip.tsx +32 -63
- package/src/app/charts/index.ts +213 -0
- package/src/app/charts/legends/Legend.tsx +198 -479
- package/src/app/charts/legends/constants.ts +37 -0
- package/src/app/charts/observables/iterates.ts +32 -12
- package/src/app/charts/observables/ordinals.ts +141 -67
- package/src/app/charts/observables/outliers.ts +20 -0
- package/src/app/charts/plots/BarPlot.tsx +784 -666
- package/src/app/charts/plots/OutlierPlot.tsx +685 -0
- package/src/app/charts/plots/PoincarePlot.tsx +707 -489
- package/src/app/charts/plots/RasterPlot.tsx +253 -445
- package/src/app/charts/plots/ScatterPlot.tsx +480 -463
- package/src/app/charts/plots/autoScaleYAxes.ts +102 -0
- package/src/app/charts/plots/colorizedLine.ts +185 -0
- package/src/app/charts/plots/constants.ts +16 -0
- package/src/app/charts/plots/hitTesting.ts +198 -0
- package/src/app/charts/plots/plot.ts +138 -44
- package/src/app/charts/plots/useCanvasZoomPan.ts +240 -0
- package/src/app/charts/plots/useStreamingTimeAxes.ts +384 -0
- package/src/app/charts/series/baseSeries.ts +81 -14
- package/src/app/charts/series/iterateSeries.ts +8 -8
- package/src/app/charts/series/ordinalSeries.ts +35 -20
- package/src/app/charts/series/outlierSeries.ts +188 -0
- package/src/app/charts/series/timeSeries.ts +14 -12
- package/src/app/charts/series/timeSeriesChartData.ts +31 -17
- package/src/app/charts/styling/barPlotStyle.ts +48 -5
- package/src/app/charts/styling/canvasStyle.ts +86 -0
- package/src/app/charts/styling/margins.ts +28 -4
- package/src/app/charts/styling/svgStyle.ts +10 -91
- package/src/app/charts/subscriptions/viewDrivers.ts +447 -0
- package/src/app/charts/tooltips/BarPlotTooltipContent.tsx +156 -380
- package/src/app/charts/tooltips/DefaultOutlierTooltipContent.tsx +40 -0
- package/src/app/charts/tooltips/OutlierPlotTooltipContent.tsx +67 -0
- package/src/app/charts/tooltips/PoincarePlotTooltipContent.tsx +229 -292
- package/src/app/charts/tooltips/RasterPlotTooltipContent.tsx +164 -217
- package/src/app/charts/tooltips/ScatterPlotTooltipContent.tsx +373 -236
- package/src/app/charts/tooltips/Tooltip.tsx +58 -124
- package/src/app/charts/tooltips/TooltipContent.tsx +177 -0
- package/src/app/charts/tooltips/tooltipUtils.ts +359 -61
- package/src/app/charts/tooltips/useOutlierTooltip.tsx +68 -0
- package/src/app/charts/tooltips/useTooltipPlacement.ts +86 -0
- package/src/app/charts/tooltips/useTooltipStyle.ts +15 -0
- package/src/app/charts/trackers/Tracker.tsx +68 -33
- package/src/app/charts/trackers/trackerUtils.ts +263 -376
- package/src/app/charts/utils.ts +90 -48
- package/src/index.ts +2 -322
- package/dist/app/charts/axes/AxesState.test.d.ts +0 -1
- package/dist/app/charts/axes/AxesState.test.js +0 -30
- package/dist/app/charts/axes/AxesState.test.js.map +0 -1
- package/dist/app/charts/axes/AxisInterval.test.d.ts +0 -1
- package/dist/app/charts/axes/AxisInterval.test.js +0 -120
- package/dist/app/charts/axes/AxisInterval.test.js.map +0 -1
- package/dist/app/charts/axes/ContinuousAxisRange.test.d.ts +0 -1
- package/dist/app/charts/axes/ContinuousAxisRange.test.js +0 -47
- package/dist/app/charts/axes/ContinuousAxisRange.test.js.map +0 -1
- package/dist/app/charts/axes/OrdinalAxisRange.test.d.ts +0 -1
- package/dist/app/charts/axes/OrdinalAxisRange.test.js +0 -48
- package/dist/app/charts/axes/OrdinalAxisRange.test.js.map +0 -1
- package/dist/app/charts/filters/regexFilter.test.d.ts +0 -1
- package/dist/app/charts/filters/regexFilter.test.js +0 -11
- package/dist/app/charts/filters/regexFilter.test.js.map +0 -1
- package/dist/app/charts/hooks/useDataObservable.d.ts +0 -72
- package/dist/app/charts/hooks/useDataObservable.js +0 -74
- package/dist/app/charts/hooks/useDataObservable.js.map +0 -1
- package/dist/app/charts/hooks/useInitialData.d.ts +0 -36
- package/dist/app/charts/hooks/useInitialData.js +0 -28
- package/dist/app/charts/hooks/useInitialData.js.map +0 -1
- package/dist/app/charts/observables/iterates.test.d.ts +0 -1
- package/dist/app/charts/observables/iterates.test.js +0 -180
- package/dist/app/charts/observables/iterates.test.js.map +0 -1
- package/dist/app/charts/observables/ordinals.test.d.ts +0 -1
- package/dist/app/charts/observables/ordinals.test.js +0 -102
- package/dist/app/charts/observables/ordinals.test.js.map +0 -1
- package/dist/app/charts/series/datumSeries.test.d.ts +0 -1
- package/dist/app/charts/series/datumSeries.test.js +0 -50
- package/dist/app/charts/series/datumSeries.test.js.map +0 -1
- package/dist/app/charts/styling/margins.test.d.ts +0 -1
- package/dist/app/charts/styling/margins.test.js +0 -19
- package/dist/app/charts/styling/margins.test.js.map +0 -1
- package/dist/app/charts/subscriptions/subscription.test.d.ts +0 -1
- package/dist/app/charts/subscriptions/subscription.test.js +0 -395
- package/dist/app/charts/subscriptions/subscription.test.js.map +0 -1
- package/dist/app/charts/subscriptions/subscriptions.d.ts +0 -100
- package/dist/app/charts/subscriptions/subscriptions.js +0 -449
- package/dist/app/charts/subscriptions/subscriptions.js.map +0 -1
- package/src/app/charts/axes/AxesState.test.ts +0 -34
- package/src/app/charts/axes/AxisInterval.test.ts +0 -143
- package/src/app/charts/axes/ContinuousAxisRange.test.ts +0 -55
- package/src/app/charts/axes/OrdinalAxisRange.test.ts +0 -55
- package/src/app/charts/filters/regexFilter.test.ts +0 -13
- package/src/app/charts/hooks/useDataObservable.tsx +0 -170
- package/src/app/charts/hooks/useInitialData.tsx +0 -64
- package/src/app/charts/observables/iterates.test.ts +0 -201
- package/src/app/charts/observables/ordinals.test.ts +0 -135
- package/src/app/charts/series/datumSeries.test.ts +0 -60
- package/src/app/charts/styling/margins.test.ts +0 -22
- package/src/app/charts/subscriptions/subscription.test.ts +0 -499
- package/src/app/charts/subscriptions/subscriptions.ts +0 -635
|
@@ -1,76 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* CSS style properties for the chart's container element (the canvas -- named for the SVG
|
|
3
|
+
* element it used to be)
|
|
4
|
+
*/
|
|
3
5
|
export interface SvgStyle {
|
|
4
6
|
height?: string | number;
|
|
5
7
|
width?: string | number;
|
|
6
8
|
outline?: string;
|
|
7
|
-
[propName: string]:
|
|
9
|
+
[propName: string]: string | number | undefined;
|
|
8
10
|
}
|
|
9
|
-
export declare const initialSvgStyle: SvgStyle;
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
* been initialized. The client-width is a read-only property returns the width of
|
|
13
|
-
* the html element, including horizontal padding and borders, as an integer. The reason
|
|
14
|
-
* that we return 1 when the svg element hasn't yet been initialized, is so that the
|
|
15
|
-
* aspect (width / height) is 1.
|
|
16
|
-
* @param {SVGElement | null} svg The svg element
|
|
17
|
-
* @return {number} The client width of the svg
|
|
12
|
+
* The default container style: full width, anchored at the top left
|
|
18
13
|
*/
|
|
19
|
-
export declare
|
|
14
|
+
export declare const initialSvgStyle: SvgStyle;
|
|
20
15
|
/**
|
|
21
|
-
*
|
|
22
|
-
* been initialized. The client-height is a read-only property returns the height of
|
|
23
|
-
* the html element, including vertical padding and borders, as an integer. The reason
|
|
24
|
-
* that we return 1 when the svg element hasn't yet been initialized, is so that the
|
|
25
|
-
* aspect (width / height) is 1.
|
|
26
|
-
* @param {SVGElement | null} svg The svg element
|
|
27
|
-
* @return {number} The client height of the svg
|
|
16
|
+
* The style of a stroke (used by the bar plot's styles)
|
|
28
17
|
*/
|
|
29
|
-
export declare function grabHeight(svg: SVGElement | null): number;
|
|
30
|
-
export declare const STROKE_COLOR: string;
|
|
31
|
-
export declare const STROKE_WIDTH: string;
|
|
32
|
-
export declare const STROKE_OPACITY: string;
|
|
33
18
|
export interface SvgStrokeStyle {
|
|
34
19
|
readonly color: string;
|
|
35
20
|
readonly width: number;
|
|
36
21
|
readonly opacity: number;
|
|
37
22
|
}
|
|
38
|
-
export declare function updateSvgStrokeColor(current: SvgStrokeStyle, color: string): {
|
|
39
|
-
color: string;
|
|
40
|
-
width: number;
|
|
41
|
-
opacity: number;
|
|
42
|
-
};
|
|
43
|
-
export declare function updateSvgStrokeWidth(current: SvgStrokeStyle, width: number): {
|
|
44
|
-
width: number;
|
|
45
|
-
color: string;
|
|
46
|
-
opacity: number;
|
|
47
|
-
};
|
|
48
|
-
export declare function updateSvgStrokeOpacity(current: SvgStrokeStyle, opacity: number): {
|
|
49
|
-
opacity: number;
|
|
50
|
-
color: string;
|
|
51
|
-
width: number;
|
|
52
|
-
};
|
|
53
23
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @param style
|
|
56
|
-
* @param selection
|
|
57
|
-
* @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
|
|
58
|
-
* @template D The datum type
|
|
59
|
-
* @template The SVG G element
|
|
24
|
+
* The style of a fill (used by the bar plot's styles)
|
|
60
25
|
*/
|
|
61
|
-
export declare function applyStrokeStylesTo<E extends BaseType, D, G extends BaseType = SVGGElement>(selection: d3.Selection<E, D, G, any>, style: Partial<SvgStrokeStyle>): d3.Selection<E, D, G, any>;
|
|
62
26
|
export interface SvgFillStyle {
|
|
63
27
|
readonly color: string;
|
|
64
28
|
readonly opacity: number;
|
|
65
29
|
}
|
|
66
|
-
|
|
67
|
-
export declare function updateSvgFillOpacity(current: SvgFillStyle, opacity: number): SvgFillStyle;
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
* @param style
|
|
71
|
-
* @param selection
|
|
72
|
-
* @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
|
|
73
|
-
* @template D The datum type
|
|
74
|
-
* @template The SVG G element
|
|
75
|
-
*/
|
|
76
|
-
export declare function applyFillStylesTo<E extends BaseType, D, G extends BaseType = SVGGElement>(selection: d3.Selection<E, D, G, any>, style: Partial<SvgFillStyle>): d3.Selection<E, D, G, any>;
|
|
30
|
+
//# sourceMappingURL=svgStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgStyle.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/styling/svgStyle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnD;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAI7B,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAC3B"}
|
|
@@ -1,84 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default container style: full width, anchored at the top left
|
|
3
|
+
*/
|
|
1
4
|
export const initialSvgStyle = {
|
|
2
5
|
width: '100%',
|
|
3
|
-
// display: "inline-block",
|
|
4
|
-
// position: "floating",
|
|
5
6
|
top: 0,
|
|
6
7
|
left: 0
|
|
7
8
|
};
|
|
8
|
-
/**
|
|
9
|
-
* Grabs the client-width of the svg element, or 1 if the svg element hasn't yet
|
|
10
|
-
* been initialized. The client-width is a read-only property returns the width of
|
|
11
|
-
* the html element, including horizontal padding and borders, as an integer. The reason
|
|
12
|
-
* that we return 1 when the svg element hasn't yet been initialized, is so that the
|
|
13
|
-
* aspect (width / height) is 1.
|
|
14
|
-
* @param {SVGElement | null} svg The svg element
|
|
15
|
-
* @return {number} The client width of the svg
|
|
16
|
-
*/
|
|
17
|
-
export function grabWidth(svg) {
|
|
18
|
-
return svg !== null ? svg.clientWidth : 1;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Grabs the client-height of the svg element, or 1 if the svg element hasn't yet
|
|
22
|
-
* been initialized. The client-height is a read-only property returns the height of
|
|
23
|
-
* the html element, including vertical padding and borders, as an integer. The reason
|
|
24
|
-
* that we return 1 when the svg element hasn't yet been initialized, is so that the
|
|
25
|
-
* aspect (width / height) is 1.
|
|
26
|
-
* @param {SVGElement | null} svg The svg element
|
|
27
|
-
* @return {number} The client height of the svg
|
|
28
|
-
*/
|
|
29
|
-
export function grabHeight(svg) {
|
|
30
|
-
return svg !== null ? svg.clientHeight : 1;
|
|
31
|
-
}
|
|
32
|
-
export const STROKE_COLOR = "stroke";
|
|
33
|
-
export const STROKE_WIDTH = "stroke-width";
|
|
34
|
-
export const STROKE_OPACITY = "stroke-opacity";
|
|
35
|
-
export function updateSvgStrokeColor(current, color) {
|
|
36
|
-
return Object.assign(Object.assign({}, current), { color });
|
|
37
|
-
}
|
|
38
|
-
export function updateSvgStrokeWidth(current, width) {
|
|
39
|
-
return Object.assign(Object.assign({}, current), { width });
|
|
40
|
-
}
|
|
41
|
-
export function updateSvgStrokeOpacity(current, opacity) {
|
|
42
|
-
return Object.assign(Object.assign({}, current), { opacity });
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* @param style
|
|
47
|
-
* @param selection
|
|
48
|
-
* @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
|
|
49
|
-
* @template D The datum type
|
|
50
|
-
* @template The SVG G element
|
|
51
|
-
*/
|
|
52
|
-
export function applyStrokeStylesTo(selection, style) {
|
|
53
|
-
if (style.color !== undefined)
|
|
54
|
-
selection.style(STROKE_COLOR, style.color);
|
|
55
|
-
if (style.width !== undefined)
|
|
56
|
-
selection.style(STROKE_WIDTH, style.width);
|
|
57
|
-
if (style.opacity !== undefined)
|
|
58
|
-
selection.style(STROKE_OPACITY, style.opacity);
|
|
59
|
-
return selection;
|
|
60
|
-
}
|
|
61
|
-
const FILL_COLOR = "fill";
|
|
62
|
-
const FILL_OPACITY = "fill-opacity";
|
|
63
|
-
export function updateSvgFillColor(current, color) {
|
|
64
|
-
return Object.assign(Object.assign({}, current), { color });
|
|
65
|
-
}
|
|
66
|
-
export function updateSvgFillOpacity(current, opacity) {
|
|
67
|
-
return Object.assign(Object.assign({}, current), { opacity });
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* @param style
|
|
72
|
-
* @param selection
|
|
73
|
-
* @template E The SVG element (e.g. SVGRectElement, SVGLineElement, etc)
|
|
74
|
-
* @template D The datum type
|
|
75
|
-
* @template The SVG G element
|
|
76
|
-
*/
|
|
77
|
-
export function applyFillStylesTo(selection, style) {
|
|
78
|
-
if (style.color !== undefined)
|
|
79
|
-
selection.style(FILL_COLOR, style.color);
|
|
80
|
-
if (style.opacity !== undefined)
|
|
81
|
-
selection.style(FILL_OPACITY, style.opacity);
|
|
82
|
-
return selection;
|
|
83
|
-
}
|
|
84
9
|
//# sourceMappingURL=svgStyle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svgStyle.js","sourceRoot":"","sources":["../../../../src/app/charts/styling/svgStyle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svgStyle.js","sourceRoot":"","sources":["../../../../src/app/charts/styling/svgStyle.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAa;IACrC,KAAK,EAAE,MAAM;IACb,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;CACV,CAAA"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Subscription } from "rxjs";
|
|
2
|
+
import { type ContinuousNumericAxis } from "../axes/axes";
|
|
3
|
+
import { AxesState } from "../axes/AxesState";
|
|
4
|
+
import { ContinuousAxisRange } from "../axes/ContinuousAxisRange";
|
|
5
|
+
import type { AxesAssignment } from "../plots/plot";
|
|
6
|
+
import type { ChartData } from "../observables/ChartData";
|
|
7
|
+
import type { TimeSeriesChartData } from "../series/timeSeriesChartData";
|
|
8
|
+
import type { OutlierChartData } from "../observables/outliers";
|
|
9
|
+
import type { OrdinalChartData } from "../observables/ordinals";
|
|
10
|
+
import type { IterateChartData } from "../observables/iterates";
|
|
11
|
+
import type { StreamingDataSource } from "../datasources/StreamingDataSource";
|
|
12
|
+
/**
|
|
13
|
+
* The behavior of the time window when data is added to the chart: `SCROLL` slides the window
|
|
14
|
+
* forward (keeping its width) as new data passes its end; `SQUEEZE` keeps the window's start
|
|
15
|
+
* pinned and widens it instead.
|
|
16
|
+
* Note: a const object rather than an enum, to support `erasableSyntaxOnly`
|
|
17
|
+
*/
|
|
18
|
+
export declare const TimeWindowBehavior: {
|
|
19
|
+
readonly SCROLL: "SCROLL";
|
|
20
|
+
readonly SQUEEZE: "SQUEEZE";
|
|
21
|
+
};
|
|
22
|
+
export type TimeWindowBehavior = (typeof TimeWindowBehavior)[keyof typeof TimeWindowBehavior];
|
|
23
|
+
/**
|
|
24
|
+
* The part of a data source a view driver needs
|
|
25
|
+
*/
|
|
26
|
+
export type ViewDriverSource<CD extends ChartData> = Pick<StreamingDataSource<CD, unknown>, 'chartDataUpdatesObservable' | 'latestTime'>;
|
|
27
|
+
/**
|
|
28
|
+
* Gives the current time ("now") of each x-axis that a chunk of chart data has new points for
|
|
29
|
+
* @template CD The type of the chart data
|
|
30
|
+
*/
|
|
31
|
+
export type AxisTimesFor<CD> = (data: CD) => Map<string, number>;
|
|
32
|
+
/**
|
|
33
|
+
* The x-axes' times for time-series chart data: each axis's time is the latest time of the
|
|
34
|
+
* series assigned to it (see {@link currentTimesByGroup}), falling back to the chunk's latest time
|
|
35
|
+
* @param axisAssignments The assignment of the series to their x- and y-axes
|
|
36
|
+
* @param xAxesState The current state of the x-axes (for the default x-axis)
|
|
37
|
+
* @return The x-axes' times for a chunk of chart data
|
|
38
|
+
*/
|
|
39
|
+
export declare function timeSeriesAxisTimes(axisAssignments: Map<string, AxesAssignment>, xAxesState: AxesState<ContinuousNumericAxis>): AxisTimesFor<TimeSeriesChartData>;
|
|
40
|
+
/**
|
|
41
|
+
* The x-axes' times for outlier chart data: each axis's time is the time of the newest datum, of
|
|
42
|
+
* the series assigned to it, in the chunk
|
|
43
|
+
* @param axisAssignments The assignment of the series to their x- and y-axes
|
|
44
|
+
* @param xAxesState The current state of the x-axes (for the default x-axis)
|
|
45
|
+
* @return The x-axes' times for a chunk of chart data
|
|
46
|
+
* @template M The type of the outlier series' measures
|
|
47
|
+
*/
|
|
48
|
+
export declare function outlierAxisTimes<M extends readonly number[]>(axisAssignments: Map<string, AxesAssignment>, xAxesState: AxesState<ContinuousNumericAxis>): AxisTimesFor<OutlierChartData<M>>;
|
|
49
|
+
/**
|
|
50
|
+
* The options of a time-axis view driver (see {@link timeAxisViewDriverFor})
|
|
51
|
+
*/
|
|
52
|
+
export interface TimeAxisViewDriverOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The time (ms) over which updates are batched before redrawing
|
|
55
|
+
*/
|
|
56
|
+
windowingTime: number;
|
|
57
|
+
/**
|
|
58
|
+
* The period (ms) at which the source emits, when known (see {@link renderBatching}); not
|
|
59
|
+
* used with cadence
|
|
60
|
+
*/
|
|
61
|
+
dataUpdatePeriod?: number;
|
|
62
|
+
/**
|
|
63
|
+
* The time (ms) between cadence ticks, which advance the axes smoothly between data arrivals.
|
|
64
|
+
* Without one, the axes only advance as data arrives.
|
|
65
|
+
*/
|
|
66
|
+
cadencePeriod?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the time axes scroll or squeeze as data passes their ends (without cadence).
|
|
69
|
+
* Defaults to SCROLL.
|
|
70
|
+
*/
|
|
71
|
+
timeWindowBehavior?: TimeWindowBehavior;
|
|
72
|
+
/**
|
|
73
|
+
* The pinned start time for each axis, for SQUEEZE
|
|
74
|
+
*/
|
|
75
|
+
initialTimes?: Map<string, number>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The view driver for a plot whose x-axes are time (the scatter, raster, and outlier plots): it
|
|
79
|
+
* advances each x-axis's window as the data's time passes its end, records each axis's current
|
|
80
|
+
* time, and asks the plot to redraw.
|
|
81
|
+
*
|
|
82
|
+
* Without cadence, each axis's window advances (SCROLL or SQUEEZE) as new data passes its end.
|
|
83
|
+
* With cadence, cadence ticks advance every axis's window smoothly between data arrivals, to the
|
|
84
|
+
* stream time projected from a wall-clock anchor; real data (treated as ground truth) re-syncs the
|
|
85
|
+
* axes, and corrects the anchor when cadence has fallen behind. The driver also catches the axes up
|
|
86
|
+
* to the data source's latest time when it starts (e.g. after a remount), and whenever the page
|
|
87
|
+
* becomes visible again.
|
|
88
|
+
* @param dataSource The data source whose updates drive the view
|
|
89
|
+
* @param xAxesState The current state of the x-axes
|
|
90
|
+
* @param axisTimesFor Gives the current time of each x-axis that a chunk of data has new points for
|
|
91
|
+
* (e.g. {@link timeSeriesAxisTimes} or {@link outlierAxisTimes})
|
|
92
|
+
* @param updateTimingAndPlot Redraws the plot for the (advanced) time-windows
|
|
93
|
+
* @param setCurrentTime Records the current time for an axis
|
|
94
|
+
* @param options The batching, cadence, and time-window behavior
|
|
95
|
+
* @return The driver's subscription, to unsubscribe when the plot unmounts
|
|
96
|
+
* @template CD The type of the chart data
|
|
97
|
+
*/
|
|
98
|
+
export declare function timeAxisViewDriverFor<CD extends ChartData>(dataSource: ViewDriverSource<CD>, xAxesState: AxesState<ContinuousNumericAxis>, axisTimesFor: AxisTimesFor<CD>, updateTimingAndPlot: (ranges: Map<string, ContinuousAxisRange>) => void, setCurrentTime: (axisId: string, end: number) => void, options: TimeAxisViewDriverOptions): Subscription;
|
|
99
|
+
/**
|
|
100
|
+
* The view driver for an ordinal (bar) plot: reports the chart-wide current time and asks the
|
|
101
|
+
* plot to redraw as new data arrives. (The stats are kept by the data source.) Unlike the
|
|
102
|
+
* time-series drivers, it has no axis ranges to advance: an ordinal plot's axes don't scroll as
|
|
103
|
+
* data arrives, so its axes' ranges change only through the plot's own zoom, pan, and resize.
|
|
104
|
+
* @param dataSource The data source whose updates drive the view
|
|
105
|
+
* @param windowingTime The time (ms) over which updates are batched before redrawing
|
|
106
|
+
* @param updateTimingAndPlot Redraws the plot (and reports the chart time)
|
|
107
|
+
* @param setCurrentTime Records the chart-wide current time
|
|
108
|
+
* @param dataUpdatePeriod The period (ms) at which the source emits, when known (see {@link renderBatching})
|
|
109
|
+
* @return The driver's subscription, to unsubscribe when the plot unmounts
|
|
110
|
+
*/
|
|
111
|
+
export declare function ordinalViewDriverFor(dataSource: ViewDriverSource<OrdinalChartData>, windowingTime: number, updateTimingAndPlot: () => void, setCurrentTime: (currentTime: number) => void, dataUpdatePeriod?: number): Subscription;
|
|
112
|
+
/**
|
|
113
|
+
* The view driver for an iterates (Poincaré) plot: reports the current time and asks the plot to
|
|
114
|
+
* redraw as new data arrives (once the plot has both an x-axis and a y-axis).
|
|
115
|
+
* @param dataSource The data source whose updates drive the view
|
|
116
|
+
* @param windowingTime The time (ms) over which updates are batched before redrawing
|
|
117
|
+
* @param xAxesState The current state of the x-axes
|
|
118
|
+
* @param yAxesState The current state of the y-axes
|
|
119
|
+
* @param updateRangesAndPlot Updates the axes' ranges, and redraws the plot
|
|
120
|
+
* @param updateCurrentTime Records the current time (see {@link iteratesCurrentTime})
|
|
121
|
+
* @return The driver's subscription, to unsubscribe when the plot unmounts
|
|
122
|
+
*/
|
|
123
|
+
export declare function iteratesViewDriverFor(dataSource: ViewDriverSource<IterateChartData>, windowingTime: number, xAxesState: AxesState<ContinuousNumericAxis>, yAxesState: AxesState<ContinuousNumericAxis>, updateRangesAndPlot: () => void, updateCurrentTime: (time: number) => void): Subscription;
|
|
124
|
+
//# sourceMappingURL=viewDrivers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewDrivers.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/subscriptions/viewDrivers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmD,YAAY,EAAC,MAAM,MAAM,CAAC;AAEpF,OAAO,EAAuB,KAAK,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAmB5E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;CAGrB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,EAAE,SAAS,SAAS,IAAI,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,YAAY,CAAC,CAAA;AAgKxI;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAEhE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAC5C,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,GAC7C,YAAY,CAAC,mBAAmB,CAAC,CAWnC;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,EACxD,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAC5C,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,GAC7C,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAYnC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,SAAS,EACtD,UAAU,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAChC,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,EAC5C,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC,EAC9B,mBAAmB,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,KAAK,IAAI,EACvE,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,EACrD,OAAO,EAAE,yBAAyB,GACnC,YAAY,CA0Ed;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,EAC9C,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,IAAI,EAC/B,cAAc,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,EAC7C,gBAAgB,CAAC,EAAE,MAAM,GAC1B,YAAY,CAOd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,EAC9C,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,EAC5C,UAAU,EAAE,SAAS,CAAC,qBAAqB,CAAC,EAC5C,mBAAmB,EAAE,MAAM,IAAI,EAC/B,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC1C,YAAY,CAQd"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { interval } from "rxjs";
|
|
2
|
+
import { bufferCount, bufferTime, map, mergeAll, mergeWith } from "rxjs/operators";
|
|
3
|
+
import { continuousAxisRanges } from "../axes/axes";
|
|
4
|
+
import { currentTimesByGroup } from "../datasources/timeSeriesDataSource";
|
|
5
|
+
import { iteratesCurrentTime } from "../datasources/iteratesDataSource";
|
|
6
|
+
/*
|
|
7
|
+
* View drivers: the *view* half of a streaming plot.
|
|
8
|
+
*
|
|
9
|
+
* A {@link StreamingDataSource} (owned by the application) ingests the stream and keeps the series.
|
|
10
|
+
* A view driver (owned by one mounted plot) listens to the source's `chartDataUpdatesObservable` and keeps that plot's
|
|
11
|
+
* view in step with the data -- advancing the visible time-window (auto-scroll, cadence) and asking
|
|
12
|
+
* the plot to redraw. A plot creates its driver when it mounts and *always* unsubscribes it when it
|
|
13
|
+
* unmounts. Nothing here ever outlives the plot that created it, and nothing here ever mutates the
|
|
14
|
+
* series, so there is never a reason to keep a driver alive across a remount, adopt one, or defer
|
|
15
|
+
* its teardown.
|
|
16
|
+
*
|
|
17
|
+
* (Before v2, a plot's single subscription did both the ingestion and the view work, which tied
|
|
18
|
+
* the data's lifetime to the plot's -- see the data sources for the ingestion half.)
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The behavior of the time window when data is added to the chart: `SCROLL` slides the window
|
|
22
|
+
* forward (keeping its width) as new data passes its end; `SQUEEZE` keeps the window's start
|
|
23
|
+
* pinned and widens it instead.
|
|
24
|
+
* Note: a const object rather than an enum, to support `erasableSyntaxOnly`
|
|
25
|
+
*/
|
|
26
|
+
export const TimeWindowBehavior = {
|
|
27
|
+
SCROLL: "SCROLL",
|
|
28
|
+
SQUEEZE: "SQUEEZE"
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Batches the source's updates for rendering. When the source's own emission period is known,
|
|
32
|
+
* batches by a fixed count (`windowingTime / dataUpdatePeriod`) rather than by wall-clock time:
|
|
33
|
+
* `bufferTime` and the source's own timer are two independent clocks, so ordinary timer jitter can
|
|
34
|
+
* shift a tick across a buffer boundary, making the number of ticks per flush vary and the
|
|
35
|
+
* auto-scroll uneven. Counting emissions directly is immune to that jitter.
|
|
36
|
+
* @param windowingTime The time (ms) over which to batch updates
|
|
37
|
+
* @param dataUpdatePeriod The period (ms) at which the source emits, when known
|
|
38
|
+
* @return The batching operator
|
|
39
|
+
*/
|
|
40
|
+
function renderBatching(windowingTime, dataUpdatePeriod) {
|
|
41
|
+
return dataUpdatePeriod !== undefined && dataUpdatePeriod > 0 ?
|
|
42
|
+
bufferCount(Math.max(1, Math.round(windowingTime / dataUpdatePeriod))) :
|
|
43
|
+
bufferTime(windowingTime);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Advances the visible window for the specified axis (in place, within `timesWindows`) so its
|
|
47
|
+
* right edge sits at `targetTime`, preserving the window's current width (but never starting
|
|
48
|
+
* before 0, in which case the window stays at [0, width] until the time passes its width) -- but only once
|
|
49
|
+
* `targetTime` actually exceeds the window's current right edge. This gate is what lets a user
|
|
50
|
+
* pan/zoom the window ahead of the current time and watch the data catch up to it before scrolling
|
|
51
|
+
* resumes. Leaves `.original` untouched (zoom math is incremental, so it doesn't depend on it).
|
|
52
|
+
* @param timesWindows A `map(axis_id -> range)` updated in place
|
|
53
|
+
* @param axisId The axis to advance
|
|
54
|
+
* @param targetTime The time the axis's right edge should advance to
|
|
55
|
+
*/
|
|
56
|
+
function advanceAxisRangeInMapTo(timesWindows, axisId, targetTime) {
|
|
57
|
+
const range = timesWindows.get(axisId);
|
|
58
|
+
if (range === undefined)
|
|
59
|
+
return;
|
|
60
|
+
const [startTime, endTime] = range.current.asTuple();
|
|
61
|
+
if (endTime < targetTime) {
|
|
62
|
+
const timeWindow = endTime - startTime;
|
|
63
|
+
timesWindows.set(axisId, range.update(Math.max(0, targetTime - timeWindow), Math.max(targetTime, timeWindow)));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Advances a range to a target time when new data arrives: SCROLL slides the window (width
|
|
68
|
+
* preserved); SQUEEZE pins the window's start at `initialStart` so the window widens instead.
|
|
69
|
+
* @param range The range to advance
|
|
70
|
+
* @param targetTime The time the range's right edge should advance to
|
|
71
|
+
* @param timeWindowBehavior Whether to scroll or squeeze
|
|
72
|
+
* @param initialStart The pinned start time for SQUEEZE mode (ignored for SCROLL)
|
|
73
|
+
* @return The advanced range, with `.original` unchanged
|
|
74
|
+
*/
|
|
75
|
+
function scrollOrSqueezeRangeTo(range, targetTime, timeWindowBehavior, initialStart) {
|
|
76
|
+
const [startTime, endTime] = range.current.asTuple();
|
|
77
|
+
const timeWindow = endTime - startTime;
|
|
78
|
+
const newStart = timeWindowBehavior === TimeWindowBehavior.SQUEEZE && initialStart !== undefined ?
|
|
79
|
+
initialStart :
|
|
80
|
+
Math.max(0, targetTime - timeWindow);
|
|
81
|
+
return range.update(newStart, Math.max(targetTime, timeWindow));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @param axisAssignments The assignment of the series to their x- and y-axes
|
|
85
|
+
* @param xAxesState The current state of the x-axes (for the default x-axis)
|
|
86
|
+
* @return A {@link TimeGroupFor} that groups series by their assigned x-axis (or the default x-axis)
|
|
87
|
+
*/
|
|
88
|
+
function xAxisGroupFor(axisAssignments, xAxesState) {
|
|
89
|
+
return name => { var _a; return ((_a = axisAssignments.get(name)) === null || _a === void 0 ? void 0 : _a.xAxis) || xAxesState.axisDefaultId().getOrElse(""); };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Re-syncs every x-axis to the data's ground-truth time whenever the page becomes visible again.
|
|
93
|
+
* Browsers pause `requestAnimationFrame` and throttle timers for hidden pages (including a macOS
|
|
94
|
+
* Spaces switch), and the cadence and data timers don't resume in lockstep, so without this an
|
|
95
|
+
* axis can lag behind until whichever clock fell behind organically catches up.
|
|
96
|
+
* @param dataSource The data source (for the data's ground-truth time)
|
|
97
|
+
* @param xAxesState The current state of the x-axes
|
|
98
|
+
* @param timesWindows A `map(axis_id -> range)` of the x-axes' windows, updated in place
|
|
99
|
+
* @param setCurrentTime Records the current time for an axis
|
|
100
|
+
* @param updateTimingAndPlot Redraws the plot for the (advanced) time-windows
|
|
101
|
+
* @return The teardown for the listener, to add to the driver's subscription
|
|
102
|
+
*/
|
|
103
|
+
function resyncOnVisible(dataSource, xAxesState, timesWindows, setCurrentTime, updateTimingAndPlot) {
|
|
104
|
+
if (typeof document === 'undefined')
|
|
105
|
+
return () => {
|
|
106
|
+
};
|
|
107
|
+
const resyncAxesOnVisible = () => {
|
|
108
|
+
if (document.visibilityState !== 'visible')
|
|
109
|
+
return;
|
|
110
|
+
const groundTruthTime = dataSource.latestTime();
|
|
111
|
+
if (!isFinite(groundTruthTime))
|
|
112
|
+
return;
|
|
113
|
+
xAxesState.axisIds().forEach(axisId => {
|
|
114
|
+
advanceAxisRangeInMapTo(timesWindows, axisId, groundTruthTime);
|
|
115
|
+
setCurrentTime(axisId, groundTruthTime);
|
|
116
|
+
});
|
|
117
|
+
updateTimingAndPlot(timesWindows);
|
|
118
|
+
};
|
|
119
|
+
document.addEventListener('visibilitychange', resyncAxesOnVisible);
|
|
120
|
+
return () => document.removeEventListener('visibilitychange', resyncAxesOnVisible);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Marks a cadence tick in a view driver's stream of updates (rather than disguising the tick as an
|
|
124
|
+
* empty chunk of chart data)
|
|
125
|
+
*/
|
|
126
|
+
const CADENCE_TICK = Symbol('cadence-tick');
|
|
127
|
+
/**
|
|
128
|
+
* The cadence ticks merged, unbuffered, with the batched data updates. Cadence ticks must not go
|
|
129
|
+
* through the render batching, or each batch would deliver its cadence ticks in one burst,
|
|
130
|
+
* collapsing the smooth per-tick scroll down to the batch rate. (The ticks carry no time: the
|
|
131
|
+
* driver projects the stream time from its own wall-clock anchor, so throttled ticks don't make it
|
|
132
|
+
* fall permanently behind.)
|
|
133
|
+
* @param updates$ The data source's updates
|
|
134
|
+
* @param windowingTime The time (ms) over which the data updates are batched
|
|
135
|
+
* @param cadencePeriod The time (ms) between cadence ticks
|
|
136
|
+
* @return The data updates (each batch flattened back into single updates), merged with the
|
|
137
|
+
* cadence ticks
|
|
138
|
+
*/
|
|
139
|
+
function withCadence(updates$, windowingTime, cadencePeriod) {
|
|
140
|
+
const cadence = interval(cadencePeriod).pipe(map(() => CADENCE_TICK));
|
|
141
|
+
return updates$.pipe(bufferTime(windowingTime), mergeAll(), mergeWith(cadence));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Tracks the best-known stream time and when it was measured, so a cadence tick can project the
|
|
145
|
+
* current stream time as `knownTime + (now - measuredAt)`. Seeded from the data source -- which
|
|
146
|
+
* kept ingesting while the plot was unmounted, so this is the true current time even right after
|
|
147
|
+
* a remount -- and corrected forward whenever real data overtakes the projection (but never
|
|
148
|
+
* backward, which would make cadence stutter by the data's processing latency on every tick).
|
|
149
|
+
* @param seedTime The best-known stream time to start from (`-Infinity` when there's no data yet)
|
|
150
|
+
* @return The anchor: `now()` projects the current stream time, `isKnown()` says whether there's a
|
|
151
|
+
* stream time to project from, and `correctTo(time)` moves the anchor forward to a later real time
|
|
152
|
+
*/
|
|
153
|
+
function cadenceAnchor(seedTime) {
|
|
154
|
+
let knownTime = seedTime;
|
|
155
|
+
let measuredAt = performance.now();
|
|
156
|
+
const now = () => knownTime + (performance.now() - measuredAt);
|
|
157
|
+
return {
|
|
158
|
+
now,
|
|
159
|
+
isKnown: () => isFinite(knownTime),
|
|
160
|
+
correctTo: (realTime) => {
|
|
161
|
+
if (realTime > now()) {
|
|
162
|
+
knownTime = realTime;
|
|
163
|
+
measuredAt = performance.now();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The x-axes' times for time-series chart data: each axis's time is the latest time of the
|
|
170
|
+
* series assigned to it (see {@link currentTimesByGroup}), falling back to the chunk's latest time
|
|
171
|
+
* @param axisAssignments The assignment of the series to their x- and y-axes
|
|
172
|
+
* @param xAxesState The current state of the x-axes (for the default x-axis)
|
|
173
|
+
* @return The x-axes' times for a chunk of chart data
|
|
174
|
+
*/
|
|
175
|
+
export function timeSeriesAxisTimes(axisAssignments, xAxesState) {
|
|
176
|
+
const groupFor = xAxisGroupFor(axisAssignments, xAxesState);
|
|
177
|
+
return data => {
|
|
178
|
+
const groupTimes = currentTimesByGroup(data, groupFor);
|
|
179
|
+
const times = new Map();
|
|
180
|
+
data.newPoints.forEach((_, name) => {
|
|
181
|
+
const axisId = groupFor(name);
|
|
182
|
+
times.set(axisId, groupTimes.get(axisId) || data.maxTime);
|
|
183
|
+
});
|
|
184
|
+
return times;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The x-axes' times for outlier chart data: each axis's time is the time of the newest datum, of
|
|
189
|
+
* the series assigned to it, in the chunk
|
|
190
|
+
* @param axisAssignments The assignment of the series to their x- and y-axes
|
|
191
|
+
* @param xAxesState The current state of the x-axes (for the default x-axis)
|
|
192
|
+
* @return The x-axes' times for a chunk of chart data
|
|
193
|
+
* @template M The type of the outlier series' measures
|
|
194
|
+
*/
|
|
195
|
+
export function outlierAxisTimes(axisAssignments, xAxesState) {
|
|
196
|
+
const groupFor = xAxisGroupFor(axisAssignments, xAxesState);
|
|
197
|
+
return data => {
|
|
198
|
+
const times = new Map();
|
|
199
|
+
data.newPoints.forEach((newData, name) => {
|
|
200
|
+
var _a;
|
|
201
|
+
const axisId = groupFor(name);
|
|
202
|
+
let time = (_a = times.get(axisId)) !== null && _a !== void 0 ? _a : -Infinity;
|
|
203
|
+
for (const datum of newData)
|
|
204
|
+
time = Math.max(time, datum.datum.x);
|
|
205
|
+
if (Number.isFinite(time))
|
|
206
|
+
times.set(axisId, time);
|
|
207
|
+
});
|
|
208
|
+
return times;
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The view driver for a plot whose x-axes are time (the scatter, raster, and outlier plots): it
|
|
213
|
+
* advances each x-axis's window as the data's time passes its end, records each axis's current
|
|
214
|
+
* time, and asks the plot to redraw.
|
|
215
|
+
*
|
|
216
|
+
* Without cadence, each axis's window advances (SCROLL or SQUEEZE) as new data passes its end.
|
|
217
|
+
* With cadence, cadence ticks advance every axis's window smoothly between data arrivals, to the
|
|
218
|
+
* stream time projected from a wall-clock anchor; real data (treated as ground truth) re-syncs the
|
|
219
|
+
* axes, and corrects the anchor when cadence has fallen behind. The driver also catches the axes up
|
|
220
|
+
* to the data source's latest time when it starts (e.g. after a remount), and whenever the page
|
|
221
|
+
* becomes visible again.
|
|
222
|
+
* @param dataSource The data source whose updates drive the view
|
|
223
|
+
* @param xAxesState The current state of the x-axes
|
|
224
|
+
* @param axisTimesFor Gives the current time of each x-axis that a chunk of data has new points for
|
|
225
|
+
* (e.g. {@link timeSeriesAxisTimes} or {@link outlierAxisTimes})
|
|
226
|
+
* @param updateTimingAndPlot Redraws the plot for the (advanced) time-windows
|
|
227
|
+
* @param setCurrentTime Records the current time for an axis
|
|
228
|
+
* @param options The batching, cadence, and time-window behavior
|
|
229
|
+
* @return The driver's subscription, to unsubscribe when the plot unmounts
|
|
230
|
+
* @template CD The type of the chart data
|
|
231
|
+
*/
|
|
232
|
+
export function timeAxisViewDriverFor(dataSource, xAxesState, axisTimesFor, updateTimingAndPlot, setCurrentTime, options) {
|
|
233
|
+
const { windowingTime, dataUpdatePeriod, cadencePeriod, timeWindowBehavior = TimeWindowBehavior.SCROLL, initialTimes = new Map(), } = options;
|
|
234
|
+
// built ONCE, here, and advanced in place on every update: the plot hands this same map
|
|
235
|
+
// back to its pan/zoom handlers (via `updateTimingAndPlot`), so their mutations land here too
|
|
236
|
+
// rather than being discarded by a rebuild
|
|
237
|
+
const timesWindows = continuousAxisRanges(xAxesState.axes);
|
|
238
|
+
if (cadencePeriod === undefined) {
|
|
239
|
+
return dataSource.chartDataUpdatesObservable
|
|
240
|
+
.pipe(renderBatching(windowingTime, dataUpdatePeriod))
|
|
241
|
+
.subscribe(dataList => dataList.forEach(data => {
|
|
242
|
+
axisTimesFor(data).forEach((currentAxisTime, axisId) => {
|
|
243
|
+
// record the axis' "now" on every update -- not only once the window starts
|
|
244
|
+
// scrolling -- since the plot's zoom pivots on it while streaming: before the
|
|
245
|
+
// data reaches the window's end, there would otherwise be no "now" to pivot on,
|
|
246
|
+
// and the zoom would pivot on the window's right edge, possibly leaving the
|
|
247
|
+
// data off-screen
|
|
248
|
+
setCurrentTime(axisId, currentAxisTime);
|
|
249
|
+
const range = timesWindows.get(axisId);
|
|
250
|
+
if (range !== undefined && range.current.end < currentAxisTime) {
|
|
251
|
+
timesWindows.set(axisId, scrollOrSqueezeRangeTo(range, currentAxisTime, timeWindowBehavior, initialTimes.get(axisId)));
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
updateTimingAndPlot(timesWindows);
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
const anchor = cadenceAnchor(dataSource.latestTime());
|
|
258
|
+
const catchUp = () => {
|
|
259
|
+
if (!anchor.isKnown())
|
|
260
|
+
return;
|
|
261
|
+
xAxesState.axisIds().forEach(axisId => advanceAxisRangeInMapTo(timesWindows, axisId, anchor.now()));
|
|
262
|
+
updateTimingAndPlot(timesWindows);
|
|
263
|
+
};
|
|
264
|
+
// catch the axes up to the current stream time right away, rather than leaving them where they
|
|
265
|
+
// were restored to until the first tick arrives (which, right after a remount, can take a
|
|
266
|
+
// noticeable while and would show up as "pause, then jump")
|
|
267
|
+
catchUp();
|
|
268
|
+
const subscription = withCadence(dataSource.chartDataUpdatesObservable, windowingTime, cadencePeriod)
|
|
269
|
+
.subscribe(update => {
|
|
270
|
+
if (update === CADENCE_TICK) {
|
|
271
|
+
// a cadence tick: advance every axis to the projected stream time
|
|
272
|
+
const cadenceTime = anchor.now();
|
|
273
|
+
xAxesState.axisIds().forEach(axisId => {
|
|
274
|
+
advanceAxisRangeInMapTo(timesWindows, axisId, cadenceTime);
|
|
275
|
+
setCurrentTime(axisId, cadenceTime);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
// real data: re-sync each axis to the data's own time, and correct the cadence
|
|
280
|
+
// anchor if the data has overtaken it
|
|
281
|
+
axisTimesFor(update).forEach((currentAxisTime, axisId) => {
|
|
282
|
+
advanceAxisRangeInMapTo(timesWindows, axisId, currentAxisTime);
|
|
283
|
+
anchor.correctTo(currentAxisTime);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
updateTimingAndPlot(timesWindows);
|
|
287
|
+
});
|
|
288
|
+
subscription.add(resyncOnVisible(dataSource, xAxesState, timesWindows, setCurrentTime, updateTimingAndPlot));
|
|
289
|
+
// one more catch-up on the next paint frame, narrowing the gap until the first real tick
|
|
290
|
+
// (whose scheduling can lag right after a route change, while React commits the new tree)
|
|
291
|
+
const catchUpFrame = requestAnimationFrame(catchUp);
|
|
292
|
+
subscription.add(() => cancelAnimationFrame(catchUpFrame));
|
|
293
|
+
return subscription;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* The view driver for an ordinal (bar) plot: reports the chart-wide current time and asks the
|
|
297
|
+
* plot to redraw as new data arrives. (The stats are kept by the data source.) Unlike the
|
|
298
|
+
* time-series drivers, it has no axis ranges to advance: an ordinal plot's axes don't scroll as
|
|
299
|
+
* data arrives, so its axes' ranges change only through the plot's own zoom, pan, and resize.
|
|
300
|
+
* @param dataSource The data source whose updates drive the view
|
|
301
|
+
* @param windowingTime The time (ms) over which updates are batched before redrawing
|
|
302
|
+
* @param updateTimingAndPlot Redraws the plot (and reports the chart time)
|
|
303
|
+
* @param setCurrentTime Records the chart-wide current time
|
|
304
|
+
* @param dataUpdatePeriod The period (ms) at which the source emits, when known (see {@link renderBatching})
|
|
305
|
+
* @return The driver's subscription, to unsubscribe when the plot unmounts
|
|
306
|
+
*/
|
|
307
|
+
export function ordinalViewDriverFor(dataSource, windowingTime, updateTimingAndPlot, setCurrentTime, dataUpdatePeriod) {
|
|
308
|
+
return dataSource.chartDataUpdatesObservable
|
|
309
|
+
.pipe(renderBatching(windowingTime, dataUpdatePeriod))
|
|
310
|
+
.subscribe(dataList => dataList.forEach(data => {
|
|
311
|
+
if (data.newPoints.size > 0)
|
|
312
|
+
setCurrentTime(data.stats.maxDatum.time.time || NaN);
|
|
313
|
+
updateTimingAndPlot();
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* The view driver for an iterates (Poincaré) plot: reports the current time and asks the plot to
|
|
318
|
+
* redraw as new data arrives (once the plot has both an x-axis and a y-axis).
|
|
319
|
+
* @param dataSource The data source whose updates drive the view
|
|
320
|
+
* @param windowingTime The time (ms) over which updates are batched before redrawing
|
|
321
|
+
* @param xAxesState The current state of the x-axes
|
|
322
|
+
* @param yAxesState The current state of the y-axes
|
|
323
|
+
* @param updateRangesAndPlot Updates the axes' ranges, and redraws the plot
|
|
324
|
+
* @param updateCurrentTime Records the current time (see {@link iteratesCurrentTime})
|
|
325
|
+
* @return The driver's subscription, to unsubscribe when the plot unmounts
|
|
326
|
+
*/
|
|
327
|
+
export function iteratesViewDriverFor(dataSource, windowingTime, xAxesState, yAxesState, updateRangesAndPlot, updateCurrentTime) {
|
|
328
|
+
return dataSource.chartDataUpdatesObservable
|
|
329
|
+
.pipe(bufferTime(windowingTime))
|
|
330
|
+
.subscribe(dataList => dataList.forEach(data => {
|
|
331
|
+
if (data.newPoints.size > 0)
|
|
332
|
+
updateCurrentTime(iteratesCurrentTime(data));
|
|
333
|
+
// (the original only redrew once both a default x-axis and a default y-axis existed)
|
|
334
|
+
if (xAxesState.axes.size > 0 && yAxesState.axes.size > 0)
|
|
335
|
+
updateRangesAndPlot();
|
|
336
|
+
}));
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=viewDrivers.js.map
|