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
package/package.json
CHANGED
|
@@ -1,32 +1,108 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-charts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Charts for steaming data",
|
|
5
5
|
"author": "Rob Philipp",
|
|
6
6
|
"homepage": "https://robphilipp.github.io/stream-charts/",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/robphilipp/stream-charts.git"
|
|
11
|
+
},
|
|
9
12
|
"main": "dist/index.js",
|
|
13
|
+
"module": "dist/index.js",
|
|
10
14
|
"types": "dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"source": "./src/index.ts",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"src/index.ts",
|
|
27
|
+
"src/app/charts",
|
|
28
|
+
"!src/**/*.test.ts",
|
|
29
|
+
"!src/**/*.test.tsx",
|
|
30
|
+
"README.md",
|
|
31
|
+
"changes.md"
|
|
32
|
+
],
|
|
11
33
|
"scripts": {
|
|
12
|
-
"
|
|
13
|
-
"build": "tsc",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
34
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
35
|
+
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
36
|
+
"test": "jest src/app/charts",
|
|
37
|
+
"lint": "eslint src",
|
|
38
|
+
"prepack": "node -e \"for (const f of ['README.md','changes.md','LICENSE']) require('fs').copyFileSync('../../'+f, f)\" && npm run build",
|
|
39
|
+
"prepublishOnly": "npm test",
|
|
40
|
+
"gen-docs": "typedoc",
|
|
41
|
+
"postpack": "node -e \"for (const f of ['README.md','changes.md','LICENSE']) require('fs').rmSync(f,{force:true})\""
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": "^19.0.0",
|
|
45
|
+
"react-dom": "^19.0.0",
|
|
46
|
+
"rxjs": "^7.8.0",
|
|
47
|
+
"d3": "^7.9.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@types/d3": "^7.4.3",
|
|
51
|
+
"fast-shift-array": "^0.1.6",
|
|
52
|
+
"result-fn": "^0.5.3",
|
|
53
|
+
"safe-regex": "^2.1.1"
|
|
16
54
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@babel/core": "^7.26.9",
|
|
57
|
+
"@babel/preset-env": "^7.26.9",
|
|
58
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
59
|
+
"@eslint/js": "^10.0.1",
|
|
60
|
+
"@jest/globals": "^30.0.5",
|
|
61
|
+
"@testing-library/dom": "^10.4.1",
|
|
62
|
+
"@testing-library/jest-dom": "^6.6.4",
|
|
63
|
+
"@testing-library/react": "^16.3.0",
|
|
64
|
+
"@testing-library/user-event": "^14.6.1",
|
|
65
|
+
"@types/jest": "^30.0.0",
|
|
66
|
+
"@types/node": "^24.12.2",
|
|
67
|
+
"@types/react": "^19.2.7",
|
|
68
|
+
"@types/react-dom": "^19.2.3",
|
|
69
|
+
"@types/safe-regex": "^1.1.6",
|
|
70
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
71
|
+
"d3": "^7.9.0",
|
|
72
|
+
"eslint": "^10.8.1",
|
|
73
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
74
|
+
"eslint-plugin-react-refresh": "^0.5.3",
|
|
75
|
+
"globals": "^17.6.0",
|
|
76
|
+
"jest": "^30.0.5",
|
|
77
|
+
"jest-util": "^30.5.1",
|
|
78
|
+
"react": "^19.0.0",
|
|
79
|
+
"react-dom": "^19.0.0",
|
|
80
|
+
"rxjs": "^7.8.2",
|
|
81
|
+
"ts-jest": "^29.4.15",
|
|
82
|
+
"typedoc": "^0.28.20",
|
|
83
|
+
"typescript": "^6.0.3",
|
|
84
|
+
"typescript-eslint": "^8.66.0",
|
|
85
|
+
"vite": "^8.2.1"
|
|
19
86
|
},
|
|
20
87
|
"typedocOptions": {
|
|
21
88
|
"externalSymbolLinkMappings": {
|
|
22
89
|
"result-fn": {
|
|
23
|
-
"Optional": "https://github.com/robphilipp/result-fn/blob/master/docs/Optional.md"
|
|
90
|
+
"Optional": "https://github.com/robphilipp/result-fn/blob/master/docs/Optional.md",
|
|
91
|
+
"Result": "https://github.com/robphilipp/result-fn/blob/master/docs/Result.md"
|
|
24
92
|
},
|
|
25
93
|
"typescript": {
|
|
26
94
|
"Set": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set",
|
|
27
95
|
"Map": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map"
|
|
96
|
+
},
|
|
97
|
+
"fast-shift-array": {
|
|
98
|
+
"FastShiftArray": "https://www.npmjs.com/package/fast-shift-array"
|
|
28
99
|
}
|
|
29
|
-
}
|
|
100
|
+
},
|
|
101
|
+
"entryPoints": [
|
|
102
|
+
"src/index.ts"
|
|
103
|
+
],
|
|
104
|
+
"tsconfig": "tsconfig.build.json",
|
|
105
|
+
"out": "../../docs"
|
|
30
106
|
},
|
|
31
107
|
"browserslist": {
|
|
32
108
|
"production": [
|
|
@@ -39,40 +115,5 @@
|
|
|
39
115
|
"last 1 firefox version",
|
|
40
116
|
"last 1 safari version"
|
|
41
117
|
]
|
|
42
|
-
}
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@babel/core": "^7.28.4",
|
|
45
|
-
"@babel/preset-env": "^7.28.3",
|
|
46
|
-
"@babel/preset-typescript": "^7.27.1",
|
|
47
|
-
"@jest/globals": "^30.2.0",
|
|
48
|
-
"@testing-library/dom": "^10.4.1",
|
|
49
|
-
"@testing-library/jest-dom": "^6.8.0",
|
|
50
|
-
"@testing-library/react": "^16.3.0",
|
|
51
|
-
"@testing-library/user-event": "^14.6.1",
|
|
52
|
-
"@types/d3": "^7.4.3",
|
|
53
|
-
"@types/jest": "^30.0.0",
|
|
54
|
-
"@types/node": "^24.6.0",
|
|
55
|
-
"@types/react": "^19.1.15",
|
|
56
|
-
"@types/react-dom": "^19.1.9",
|
|
57
|
-
"d3": "^7.9.0",
|
|
58
|
-
"data-frame-ts": "^1.0.3",
|
|
59
|
-
"jest": "^30.2.0",
|
|
60
|
-
"jest-util": "^30.2.0",
|
|
61
|
-
"react": "^19.1.1",
|
|
62
|
-
"react-dom": "^19.1.1",
|
|
63
|
-
"result-fn": "^0.5.0",
|
|
64
|
-
"rxjs": "^7.8.2",
|
|
65
|
-
"svg-table": "^0.1.2",
|
|
66
|
-
"ts-jest": "^29.4.4",
|
|
67
|
-
"typescript": "^5.9.2"
|
|
68
|
-
},
|
|
69
|
-
"files": [
|
|
70
|
-
"package.json",
|
|
71
|
-
"README.md",
|
|
72
|
-
"changes.md",
|
|
73
|
-
"dist/app",
|
|
74
|
-
"dist/index.*",
|
|
75
|
-
"src/app/charts/**",
|
|
76
|
-
"src/index.ts"
|
|
77
|
-
]
|
|
118
|
+
}
|
|
78
119
|
}
|
package/src/app/charts/Chart.tsx
CHANGED
|
@@ -1,54 +1,50 @@
|
|
|
1
|
-
import {JSX,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import ChartProvider from "./hooks/useChart";
|
|
6
|
-
import PlotDimensionsProvider, {defaultMargin} from "./hooks/usePlotDimensions";
|
|
7
|
-
import * as d3 from "d3";
|
|
8
|
-
import {SeriesStyle} from "./axes/axes";
|
|
9
|
-
import {createPlotContainer} from "./plots/plot";
|
|
1
|
+
import {type JSX, useMemo} from 'react'
|
|
2
|
+
import {type Margin} from "./styling/margins";
|
|
3
|
+
import type {SvgStyle} from "./styling/svgStyle";
|
|
4
|
+
import type {BaseAxis, SeriesStyle} from "./axes/axes";
|
|
10
5
|
import {noop} from "./utils";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import TooltipProvider from "./hooks/useTooltip";
|
|
14
|
-
import {Observable, Subscription} from "rxjs";
|
|
15
|
-
import DataObservableProvider from './hooks/useDataObservable';
|
|
16
|
-
import {BaseSeries} from "./series/baseSeries";
|
|
17
|
-
import InitialDataProvider from "./hooks/useInitialData";
|
|
18
|
-
import {ChartData} from "./observables/ChartData";
|
|
6
|
+
import type {BaseSeries} from "./series/baseSeries";
|
|
7
|
+
import type {ChartData} from "./observables/ChartData";
|
|
19
8
|
import {AxisInterval} from "./axes/AxisInterval";
|
|
9
|
+
import type {BaseAxisRange} from "./axes/BaseAxisRange";
|
|
10
|
+
import {defaultMargin} from "./hooks/defaultPlotDimensions";
|
|
11
|
+
import PlotDimensionsProvider from "./hooks/PlotDimensionsProvider";
|
|
12
|
+
import CanvasSurfaceProvider from "./hooks/CanvasSurfaceProvider";
|
|
13
|
+
import InteractionProvider from "./hooks/InteractionProvider";
|
|
14
|
+
import ChartProvider from "./hooks/ChartProvider";
|
|
15
|
+
import AxesProvider from "./hooks/AxesProvider";
|
|
16
|
+
import {isSafeRegex} from "./filters/regexFilter";
|
|
17
|
+
import type {StreamingDataSource} from "./datasources/StreamingDataSource";
|
|
18
|
+
import {ChartDataContext, type ChartDataValues} from "./hooks/useDataSource";
|
|
20
19
|
|
|
21
20
|
const defaultBackground = '#202020';
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
|
-
* @param chartId A unique identifier for the chart. This is used to
|
|
23
|
+
* @param chartId A unique identifier for the chart. This is used to namespace draw-handles registered
|
|
24
|
+
* with the chart's canvas context.
|
|
25
25
|
* @param width The width of the chart container
|
|
26
26
|
* @param height The height of the chart container
|
|
27
27
|
* @param margin The margin between the edges of the chart container and the axes
|
|
28
|
-
* @param color The base/default color of the chart lines. This can be overridden by the {@link
|
|
29
|
-
* @param backgroundColor The base/default background color. This can be overridden by the {@link
|
|
30
|
-
* @param svgStyle Overrides for the
|
|
28
|
+
* @param color The base/default color of the chart lines. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
29
|
+
* @param backgroundColor The base/default background color. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
30
|
+
* @param svgStyle Overrides for the chart container's CSS style
|
|
31
31
|
* @param seriesStyles Map holding the series name to the series style associated with that series.
|
|
32
|
-
* @param initialData Initial (static) data to plot before subscribing to the {@link ChartData} observable.
|
|
33
|
-
* @param asChartData Optional conversion function that converts an array of base-series with datum type D to a
|
|
34
|
-
* descendent of a {@link ChartData} object
|
|
35
32
|
* @param seriesFilter Regular expression that filters which series to display on the plot. Can be update while streaming
|
|
36
|
-
* @param
|
|
33
|
+
* @param dataSource The application-owned {@link StreamingDataSource} that holds (and ingests) the chart's data
|
|
37
34
|
* @param windowingTime The time-window (in milliseconds) to buffer the incoming data before updating the chart. This is
|
|
38
35
|
* a lever to reduce the lag between real-time and chart-time when a large amount of data is being
|
|
39
|
-
*
|
|
36
|
+
* ingested by the data source. Smaller time-windows result in smoother scrolling, but more updates, and
|
|
40
37
|
* possibly a larger lag.
|
|
41
|
-
* @param
|
|
42
|
-
* to `false` from `true`, unsubscribes from the {@link seriesObservable}.
|
|
43
|
-
* @param onSubscribe Callback when the chart subscribes to the {@link ChartData} observable
|
|
38
|
+
* @param dataUpdatePeriod The period (ms) at which the data source's generator emits new data, when known
|
|
44
39
|
* @param onUpdateAxesBounds Callback when the time range changes. This is generally used by plots where the
|
|
45
40
|
* x-axis starts to scroll as the data streams in past the end of the current time
|
|
46
41
|
* @param onUpdateChartTime Callback for updating the current chart time. This is generally used by plots
|
|
42
|
+
* whose axes don't represent time (e.g. the Poincaré plot)
|
|
47
43
|
* @template CD refers to the chart-data that is used by the Observable that has the stream of data.
|
|
48
44
|
* @template D refers to the datum in the data-series
|
|
49
45
|
* @template S refers to the type for the series style
|
|
50
46
|
*/
|
|
51
|
-
export interface Props<CD, D, S extends SeriesStyle> {
|
|
47
|
+
export interface Props<CD extends ChartData, D, S extends SeriesStyle> {
|
|
52
48
|
chartId: number
|
|
53
49
|
/**
|
|
54
50
|
* The width of the chart container
|
|
@@ -63,15 +59,15 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
63
59
|
*/
|
|
64
60
|
margin?: Partial<Margin>
|
|
65
61
|
/**
|
|
66
|
-
* The base/default color of the chart lines. This can be overridden by the {@link
|
|
62
|
+
* The base/default color of the chart lines. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
67
63
|
*/
|
|
68
64
|
color?: string
|
|
69
65
|
/**
|
|
70
|
-
* The base/default background color. This can be overridden by the {@link
|
|
66
|
+
* The base/default background color. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
71
67
|
*/
|
|
72
68
|
backgroundColor?: string
|
|
73
69
|
/**
|
|
74
|
-
* Overrides for the
|
|
70
|
+
* Overrides for the chart container's CSS style
|
|
75
71
|
*/
|
|
76
72
|
svgStyle?: Partial<SvgStyle>
|
|
77
73
|
/**
|
|
@@ -79,19 +75,6 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
79
75
|
*/
|
|
80
76
|
seriesStyles?: Map<string, S>
|
|
81
77
|
|
|
82
|
-
/*
|
|
83
|
-
| INITIAL DATA
|
|
84
|
-
*/
|
|
85
|
-
/**
|
|
86
|
-
* Initial (static) data to plot before subscribing to the {@link ChartData} observable.
|
|
87
|
-
*/
|
|
88
|
-
initialData: Array<BaseSeries<D>>
|
|
89
|
-
/**
|
|
90
|
-
* Optional conversion function that converts an array of base-series with datum type D to a
|
|
91
|
-
* descendent of a {@link ChartData} object
|
|
92
|
-
* @param initialData The initial array of series
|
|
93
|
-
*/
|
|
94
|
-
asChartData?: (initialData: Array<BaseSeries<D>>) => CD
|
|
95
78
|
/**
|
|
96
79
|
* Regular expression that filters which series to display on the plot. Can be update while streaming
|
|
97
80
|
*/
|
|
@@ -101,26 +84,28 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
101
84
|
| DATA STREAM
|
|
102
85
|
*/
|
|
103
86
|
/**
|
|
104
|
-
*
|
|
87
|
+
* The application-owned source of the chart's data (see {@link StreamingDataSource}). The chart
|
|
88
|
+
* and its plots read their series from the data source, and redraw as it ingests new data --
|
|
89
|
+
* they never subscribe to the data stream themselves. The application starts and stops the
|
|
90
|
+
* data source (e.g. Run/Pause), and the data source keeps ingesting while the chart is
|
|
91
|
+
* unmounted (e.g. the user navigated to another page), so the chart picks up where it left
|
|
92
|
+
* off when it remounts.
|
|
105
93
|
*/
|
|
106
|
-
|
|
94
|
+
dataSource: StreamingDataSource<CD, D>
|
|
107
95
|
/**
|
|
108
96
|
* The time-window (in milliseconds) to buffer the incoming data before updating the chart. This is
|
|
109
97
|
* a lever to reduce the lag between real-time and chart-time when a large amount of data is being
|
|
110
|
-
*
|
|
98
|
+
* ingested by the data source. Smaller time-windows result in smoother scrolling, but more updates, and
|
|
111
99
|
* possibly a larger lag.
|
|
112
100
|
*/
|
|
113
101
|
windowingTime?: number
|
|
114
102
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Callback when the chart subscribes to the {@link ChartData} observable
|
|
121
|
-
* @param subscription The RxJS subscription
|
|
103
|
+
* The period (ms) at which the data source's generator emits new data, when known. When
|
|
104
|
+
* provided, buffering switches from wall-clock-based to a fixed tick count derived from
|
|
105
|
+
* `windowingTime / dataUpdatePeriod`, avoiding a jittery scroll that can otherwise result once
|
|
106
|
+
* the axis auto-scrolls (see the view drivers in `subscriptions/viewDrivers.ts`).
|
|
122
107
|
*/
|
|
123
|
-
|
|
108
|
+
dataUpdatePeriod?: number
|
|
124
109
|
/**
|
|
125
110
|
* Callback when the time range changes. This is generally used by plots where the
|
|
126
111
|
* x-axis starts to scroll as the data streams in past the end of the current time
|
|
@@ -137,13 +122,6 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
137
122
|
* @param time The current chart time
|
|
138
123
|
*/
|
|
139
124
|
onUpdateChartTime?: (time: number) => void
|
|
140
|
-
/**
|
|
141
|
-
* Callback function that is called when new data arrives to the chart.
|
|
142
|
-
* @param seriesName The name of the series for which new data arrived
|
|
143
|
-
* @param data The new data that arrived in the windowing tine
|
|
144
|
-
* @see UseChartValues.windowingTime
|
|
145
|
-
*/
|
|
146
|
-
onUpdateData?: (seriesName: string, data: Array<D>) => void
|
|
147
125
|
|
|
148
126
|
/**
|
|
149
127
|
* The child components of the chart (i.e. the axis, plot, tracker, tooltip)
|
|
@@ -152,9 +130,22 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
152
130
|
}
|
|
153
131
|
|
|
154
132
|
/**
|
|
155
|
-
* The chart container that holds the axes, plot, tracker, and tooltip. The chart
|
|
156
|
-
*
|
|
133
|
+
* The chart container that holds the axes, plot, tracker, and tooltip. The chart reads its data
|
|
134
|
+
* from the application-owned data source (its `dataSource` prop), and sets up the
|
|
135
|
+
* {@link useChart} hook via the {@link ChartProvider}.
|
|
136
|
+
*
|
|
137
|
+
* Internally, the chart is backed by a single `<canvas>` element rather than an SVG element tree.
|
|
138
|
+
* The canvas itself is created and sized by {@link CanvasSurfaceProvider}, which derives its size
|
|
139
|
+
* from {@link usePlotDimensions} (the single source of truth for the chart's dimensions) rather
|
|
140
|
+
* than from this component's `width`/`height` props directly -- this keeps the canvas correctly
|
|
141
|
+
* sized even if dimensions are ever updated via `usePlotDimensions().updateDimensions(...)`
|
|
142
|
+
* independent of a prop change. Axes, plots, and the tracker don't create/mutate their own DOM
|
|
143
|
+
* nodes -- they register a draw function with the {@link CanvasContext} (exposed via
|
|
144
|
+
* `useChart().canvasContext`, itself sourced from {@link CanvasSurfaceProvider} via
|
|
145
|
+
* `useCanvasSurface()`), and the canvas context clears and repaints all registered draw functions
|
|
146
|
+
* whenever a redraw is requested.
|
|
157
147
|
* @param props The properties of the chart
|
|
148
|
+
* @return The chart, with its children inside the chart's context providers
|
|
158
149
|
* @template CD Chart data
|
|
159
150
|
* @template D The type of the datum type held in a series
|
|
160
151
|
* @template S The type of the series style
|
|
@@ -171,24 +162,22 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
171
162
|
backgroundColor={theme.backgroundColor}
|
|
172
163
|
seriesStyles={new Map([
|
|
173
164
|
['neuron1', {
|
|
174
|
-
...defaultLineStyle,
|
|
165
|
+
...defaultLineStyle(),
|
|
175
166
|
color: 'orange',
|
|
176
167
|
lineWidth: 2,
|
|
177
168
|
highlightColor: 'orange'
|
|
178
169
|
}],
|
|
179
170
|
['neuron6', {
|
|
180
|
-
...defaultLineStyle,
|
|
171
|
+
...defaultLineStyle(),
|
|
181
172
|
color: theme.name === 'light' ? 'blue' : 'gray',
|
|
182
173
|
lineWidth: 3,
|
|
183
174
|
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
184
175
|
highlightWidth: 5
|
|
185
176
|
}],
|
|
186
177
|
])}
|
|
187
|
-
|
|
178
|
+
dataSource={dataSource}
|
|
188
179
|
seriesFilter={filter}
|
|
189
|
-
|
|
190
|
-
shouldSubscribe={running}
|
|
191
|
-
onUpdateTime={handleChartTimeUpdate}
|
|
180
|
+
onUpdateAxesBounds={handleChartTimeUpdate}
|
|
192
181
|
windowingTime={150}
|
|
193
182
|
>
|
|
194
183
|
<ContinuousAxis
|
|
@@ -197,16 +186,16 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
197
186
|
domain={[0, 5000]}
|
|
198
187
|
label="t (ms)"
|
|
199
188
|
/>
|
|
200
|
-
<
|
|
189
|
+
<OrdinalAxis
|
|
201
190
|
axisId="y-axis-1"
|
|
202
191
|
location={AxisLocation.Left}
|
|
203
|
-
categories={
|
|
192
|
+
categories={dataSource.seriesList().map(series => series.name)}
|
|
204
193
|
label="neuron"
|
|
205
194
|
/>
|
|
206
|
-
<
|
|
195
|
+
<OrdinalAxis
|
|
207
196
|
axisId="y-axis-2"
|
|
208
197
|
location={AxisLocation.Right}
|
|
209
|
-
categories={
|
|
198
|
+
categories={dataSource.seriesList().map(series => series.name)}
|
|
210
199
|
label="neuron"
|
|
211
200
|
/>
|
|
212
201
|
<Tracker
|
|
@@ -231,14 +220,17 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
231
220
|
</Tooltip>
|
|
232
221
|
<RasterPlot
|
|
233
222
|
spikeMargin={1}
|
|
234
|
-
dropDataAfter={5000}
|
|
235
223
|
panEnabled={true}
|
|
236
224
|
zoomEnabled={true}
|
|
237
225
|
zoomKeyModifiersRequired={true}
|
|
238
226
|
/>
|
|
239
227
|
</Chart>
|
|
240
228
|
*/
|
|
241
|
-
|
|
229
|
+
// the defaults (constants, so that their identity doesn't change from one render to the next)
|
|
230
|
+
const NO_SERIES_STYLES = new Map<string, SeriesStyle>()
|
|
231
|
+
const MATCH_EVERYTHING = /./
|
|
232
|
+
|
|
233
|
+
export function Chart<CD extends ChartData, D, S extends SeriesStyle, TM, AR extends BaseAxisRange, A extends BaseAxis>(props: Props<CD, D, S>): JSX.Element {
|
|
242
234
|
const {
|
|
243
235
|
chartId,
|
|
244
236
|
|
|
@@ -246,113 +238,85 @@ export function Chart<CD extends ChartData, D, S extends SeriesStyle, TM>(props:
|
|
|
246
238
|
height,
|
|
247
239
|
color = '#d2933f',
|
|
248
240
|
backgroundColor = defaultBackground,
|
|
249
|
-
seriesStyles =
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
seriesFilter = /./,
|
|
253
|
-
seriesObservable,
|
|
241
|
+
seriesStyles = NO_SERIES_STYLES as Map<string, S>,
|
|
242
|
+
seriesFilter = MATCH_EVERYTHING,
|
|
243
|
+
dataSource,
|
|
254
244
|
windowingTime = 100,
|
|
255
|
-
|
|
245
|
+
dataUpdatePeriod,
|
|
256
246
|
|
|
257
|
-
onSubscribe = noop,
|
|
258
247
|
onUpdateAxesBounds = noop,
|
|
259
248
|
onUpdateChartTime = noop,
|
|
260
|
-
onUpdateData = noop,
|
|
261
249
|
|
|
262
250
|
children,
|
|
263
251
|
} = props
|
|
264
252
|
|
|
265
|
-
//
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
)
|
|
253
|
+
// the series the data source held when it was handed to the chart. Memoized on the data source
|
|
254
|
+
// ALONE: a new data source means new initial data, and the plots reset themselves when the
|
|
255
|
+
// initial data changes -- so it must not change when anything else does (e.g. a new
|
|
256
|
+
// `onUpdateChartTime` callback on every render of the chart's parent, which would otherwise
|
|
257
|
+
// reset the plots on every render)
|
|
258
|
+
const initialData = useMemo<Array<BaseSeries<D>>>(() => dataSource.seriesList(), [dataSource])
|
|
271
259
|
|
|
272
|
-
//
|
|
273
|
-
const
|
|
260
|
+
// the chart's data: the data source, its initial data, and the streaming settings
|
|
261
|
+
const chartData = useMemo<ChartDataValues<CD, D, BaseSeries<D>>>(
|
|
262
|
+
() => ({
|
|
263
|
+
dataSource: dataSource as StreamingDataSource<CD, D, BaseSeries<D>>,
|
|
264
|
+
initialData,
|
|
265
|
+
windowingTime,
|
|
266
|
+
dataUpdatePeriod,
|
|
267
|
+
onUpdateChartTime
|
|
268
|
+
}),
|
|
269
|
+
[dataSource, initialData, windowingTime, dataUpdatePeriod, onUpdateChartTime]
|
|
270
|
+
)
|
|
274
271
|
|
|
275
|
-
// the
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const
|
|
272
|
+
// override the defaults with the parent's properties, leaving any unset values as the default
|
|
273
|
+
// value (memoized on the margin's values, so that a new `margin` object with the same values
|
|
274
|
+
// doesn't change the plot dimensions' context)
|
|
275
|
+
const {top, bottom, left, right} = {...defaultMargin, ...props.margin}
|
|
276
|
+
const margin = useMemo<Margin>(() => ({top, bottom, left, right}), [top, bottom, left, right])
|
|
277
|
+
const containerDimensions = useMemo(() => ({width, height}), [width, height])
|
|
279
278
|
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
|
|
279
|
+
// `seriesFilter` is tested against every series name on every redraw frame by each plot
|
|
280
|
+
// component (not just once), so an unvetted pattern -- e.g. one built directly from
|
|
281
|
+
// free-text user input without going through the `regexFilter` helper, which already screens
|
|
282
|
+
// for this -- could freeze the whole render loop with catastrophic backtracking. This is the
|
|
283
|
+
// one place every `seriesFilter`, however it was constructed, necessarily passes through
|
|
284
|
+
// before reaching a plot, so it's checked here too, falling back to the safe match-everything
|
|
285
|
+
// default rather than ever handing plots something that could hang them.
|
|
286
|
+
const safeSeriesFilter = useMemo<RegExp>(
|
|
283
287
|
() => {
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
// build up the svg style from the defaults and any svg style object
|
|
291
|
-
// passed in as properties
|
|
292
|
-
const style = Object.getOwnPropertyNames(svgStyle)
|
|
293
|
-
.map(name => `${name}: ${svgStyle[name]}; `)
|
|
294
|
-
.join("")
|
|
295
|
-
|
|
296
|
-
// when the chart "backgroundColor" property is set (i.e. not the default value),
|
|
297
|
-
// then we need add it to the styles, overwriting any color that may have been
|
|
298
|
-
// set in the svg style object
|
|
299
|
-
const background = backgroundColor !== defaultBackground ?
|
|
300
|
-
`background-color: ${backgroundColor}; ` :
|
|
301
|
-
''
|
|
302
|
-
|
|
303
|
-
// update the dimension and style
|
|
304
|
-
d3.select<SVGSVGElement, any>(containerRef.current)
|
|
305
|
-
.attr('width', width)
|
|
306
|
-
.attr('height', height)
|
|
307
|
-
.attr('style', style + background + ` color: ${color}`)
|
|
308
|
-
}
|
|
288
|
+
if (isSafeRegex(seriesFilter)) return seriesFilter
|
|
289
|
+
console.warn(
|
|
290
|
+
`seriesFilter regex risks catastrophic backtracking and was ignored; ` +
|
|
291
|
+
`falling back to the default (match-everything) filter; pattern: ${seriesFilter}`
|
|
292
|
+
)
|
|
293
|
+
return MATCH_EVERYTHING
|
|
309
294
|
},
|
|
310
|
-
[
|
|
295
|
+
[seriesFilter]
|
|
311
296
|
)
|
|
312
297
|
|
|
313
298
|
return (
|
|
314
|
-
|
|
315
|
-
<
|
|
316
|
-
<PlotDimensionsProvider containerDimensions={{width, height}} margin={margin}>
|
|
299
|
+
<PlotDimensionsProvider containerDimensions={containerDimensions} margin={margin}>
|
|
300
|
+
<CanvasSurfaceProvider chartId={chartId} color={color} backgroundColor={backgroundColor} svgStyle={props.svgStyle}>
|
|
317
301
|
<AxesProvider onUpdateAxesInterval={onUpdateAxesBounds}>
|
|
318
|
-
<
|
|
319
|
-
<
|
|
320
|
-
<
|
|
321
|
-
|
|
322
|
-
|
|
302
|
+
<InteractionProvider<D, TM>>
|
|
303
|
+
<ChartDataContext.Provider value={chartData}>
|
|
304
|
+
<ChartProvider<S, AR, A>
|
|
305
|
+
chartId={chartId}
|
|
306
|
+
color={color}
|
|
307
|
+
backgroundColor={backgroundColor}
|
|
308
|
+
seriesStyles={seriesStyles}
|
|
309
|
+
seriesFilter={safeSeriesFilter}
|
|
323
310
|
>
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
onUpdateChartTime={onUpdateChartTime}
|
|
332
|
-
>
|
|
333
|
-
<ChartProvider
|
|
334
|
-
chartId={chartId}
|
|
335
|
-
container={containerRef.current}
|
|
336
|
-
mainG={mainGRef.current}
|
|
337
|
-
|
|
338
|
-
color={color}
|
|
339
|
-
backgroundColor={backgroundColor}
|
|
340
|
-
svgStyle={svgStyle}
|
|
341
|
-
seriesStyles={seriesStyles}
|
|
342
|
-
seriesFilter={seriesFilter}
|
|
343
|
-
hoveredSeriesRef={hoveredSeriesRef}
|
|
344
|
-
>
|
|
345
|
-
{
|
|
346
|
-
// the chart elements are the children
|
|
347
|
-
children
|
|
348
|
-
}
|
|
349
|
-
</ChartProvider>
|
|
350
|
-
</DataObservableProvider>
|
|
351
|
-
</InitialDataProvider>
|
|
352
|
-
</TooltipProvider>
|
|
353
|
-
</MouseProvider>
|
|
311
|
+
{
|
|
312
|
+
// the chart elements are the children
|
|
313
|
+
children
|
|
314
|
+
}
|
|
315
|
+
</ChartProvider>
|
|
316
|
+
</ChartDataContext.Provider>
|
|
317
|
+
</InteractionProvider>
|
|
354
318
|
</AxesProvider>
|
|
355
|
-
</
|
|
356
|
-
|
|
319
|
+
</CanvasSurfaceProvider>
|
|
320
|
+
</PlotDimensionsProvider>
|
|
357
321
|
);
|
|
358
|
-
}
|
|
322
|
+
}
|