stream-charts 1.2.1 → 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 +36 -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/changes.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# change history
|
|
2
2
|
|
|
3
|
+
## version 2.0.0 (data sources, canvas rendering, outlier plot)
|
|
4
|
+
|
|
5
|
+
A redesign of how charts get their data and how they're drawn. Code written for 1.x needs updating; see "migrating from 1.x" in the [README](README.md).
|
|
6
|
+
|
|
7
|
+
**Breaking changes**
|
|
8
|
+
1. Charts read their data from an application-owned *data source* (`TimeSeriesDataSource`, `IteratesDataSource`, `OrdinalDataSource`, `OutlierDataSource`), handed to the chart through its new `dataSource` property. The data source subscribes to a *generator* (a function that creates the RxJS observable) when started, and unsubscribes when stopped. The `<Chart>`'s `initialData`, `seriesObservable`, `shouldSubscribe`, `onSubscribe`, and `onUpdateData` properties are gone: the initial data and `onUpdateData` are now data-source options, and running is controlled with `dataSource.start()` and `dataSource.stop()`.
|
|
9
|
+
2. `dropDataAfter` moved from the plots to the data sources (and can be changed with `setDropDataAfter`).
|
|
10
|
+
3. Charts are drawn on a single `<canvas>` rather than SVG elements. The `svgStyle` property still styles the chart's container.
|
|
11
|
+
4. `Datum` is now `{x, y}` rather than `{time, value}` (create one with `datumOf(time, value)`), and `seriesFromTuples` is now `timeSeriesFromTuples`. Series data is held in a `FastShiftArray`, so dropping old data is cheap.
|
|
12
|
+
5. `TrackerLabelLocation.WithMouse` was removed (`ByAxis` is the default, and `Nowhere` hides the labels).
|
|
13
|
+
6. `zoomKeyModifiersRequired` now defaults to `true` (hold shift or ctrl while scrolling to zoom).
|
|
14
|
+
7. The `useDataObservable` and `useInitialData` hooks were replaced by `useDataSource` and `useDataSourceRunning`.
|
|
15
|
+
8. The public API is everything exported from the package root (`import {...} from "stream-charts"`); anything else is internal. Several 1.x exports were renamed or removed.
|
|
16
|
+
|
|
17
|
+
**New**
|
|
18
|
+
1. Data keeps streaming while a chart is unmounted (for example, when the user navigates to another page), and a restarted data source carries on from its latest data rather than starting over.
|
|
19
|
+
2. Added the `<OutlierPlot>`, which plots a series with a confidence band for each measure (for example 1σ, 2σ, 3σ), and marks the points outside a band. Includes the `<OutlierPlotTooltipContent>`, which accepts custom content through `useOutlierTooltip`.
|
|
20
|
+
3. Added the `<EmptyAxis>`, a plain line for a side of the plot that has no axis.
|
|
21
|
+
4. Continuous y-axes can auto-scale (grow to fit the data on screen) in the scatter, bar, and outlier plots (`autoScale`, `autoScaleMin`, `autoScaleMax`, `autoScalePadding`, `autoScaledDomain`, `onAutoScale`).
|
|
22
|
+
5. The scatter plot can draw markers at each point (`markerRadius`, `hideMarkersWhileRunning`).
|
|
23
|
+
6. The Poincaré plot can colorize its lines by age (`colorizeLines`, `lineStartColor`, `lineEndColor`, `lineColorSteps`).
|
|
24
|
+
7. All plots can highlight the axes of the hovered series (`highlightAxesOnMouseOver`), and hand back a `resetZoom` function (`onZoomReset`) for resetting the zoom along with the axes.
|
|
25
|
+
8. The bar and Poincaré plots' zoom can survive remounting (`zoomState`, `onZoomStateChange`).
|
|
26
|
+
9. The chart takes a `dataUpdatePeriod`, which gives smoother scrolling when the data arrives at a known, regular period.
|
|
27
|
+
10. Custom tooltip content can be built on the new `<TooltipContent>` component. The raster, bar, and Poincaré tooltips now include sparklines.
|
|
28
|
+
11. Series filters are screened for regular expressions that risk catastrophic backtracking (`regexFilter`, `literalFilter`, `isSafeRegex`).
|
|
29
|
+
12. A plot on the wrong kind of axis (for example, a bar plot whose x-axis is a `<ContinuousAxis>`) reports which plot, which axis, and which axis component it needs, rather than naming the old axis types. The Poincaré plot now checks its axes too. See "which axes each plot takes" in the [README](README.md).
|
|
30
|
+
13. The bar plot zooms in the same direction as the other plots for the same wheel or trackpad gesture (it used to zoom the opposite way).
|
|
31
|
+
14. `<ScatterPlotTooltipContent>` and `<RasterPlotTooltipContent>` take an `intervalFormatter` for the mean interval between points (or spikes), a duration, which used to be formatted by the `xValueFormatter` (or `xFormatter`), and still is, by default.
|
|
32
|
+
15. A bottom x-axis' label is drawn above the chart's bottom edge, so that its descenders (as in `(ms)` or `f[n](x)`) are no longer cut off.
|
|
33
|
+
|
|
34
|
+
**Packaging and documentation**
|
|
35
|
+
1. Dependencies are now declared correctly (in 1.x they were all listed only as development dependencies, so none were installed with the package). React 19, RxJS 7, and d3 7 are peer dependencies, so the library shares the application's copies (`npm install stream-charts react react-dom rxjs d3`). The small utilities the library uses internally (`result-fn`, `fast-shift-array`, `safe-regex`), and d3's type definitions, are installed with the package.
|
|
36
|
+
2. Built with TypeScript 6 and tested with Jest 30.
|
|
37
|
+
3. Rewrote the README for the new API, with a quick start, a migration guide, and links to the example project's guides and tutorials. The API docs now cover the public API only.
|
|
38
|
+
|
|
3
39
|
## version 1.2.1 (doc update)
|
|
4
40
|
|
|
5
41
|
Added videos of the charts to the documentation.
|
|
@@ -1,40 +1,37 @@
|
|
|
1
|
-
import { JSX } from 'react';
|
|
2
|
-
import { Margin } from "./styling/margins";
|
|
3
|
-
import { SvgStyle } from "./styling/svgStyle";
|
|
4
|
-
import { SeriesStyle } from "./axes/axes";
|
|
5
|
-
import {
|
|
6
|
-
import { BaseSeries } from "./series/baseSeries";
|
|
7
|
-
import { ChartData } from "./observables/ChartData";
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
import { type Margin } from "./styling/margins";
|
|
3
|
+
import type { SvgStyle } from "./styling/svgStyle";
|
|
4
|
+
import type { BaseAxis, SeriesStyle } from "./axes/axes";
|
|
5
|
+
import type { ChartData } from "./observables/ChartData";
|
|
8
6
|
import { AxisInterval } from "./axes/AxisInterval";
|
|
7
|
+
import type { BaseAxisRange } from "./axes/BaseAxisRange";
|
|
8
|
+
import type { StreamingDataSource } from "./datasources/StreamingDataSource";
|
|
9
9
|
/**
|
|
10
|
-
* @param chartId A unique identifier for the chart. This is used to
|
|
10
|
+
* @param chartId A unique identifier for the chart. This is used to namespace draw-handles registered
|
|
11
|
+
* with the chart's canvas context.
|
|
11
12
|
* @param width The width of the chart container
|
|
12
13
|
* @param height The height of the chart container
|
|
13
14
|
* @param margin The margin between the edges of the chart container and the axes
|
|
14
|
-
* @param color The base/default color of the chart lines. This can be overridden by the {@link
|
|
15
|
-
* @param backgroundColor The base/default background color. This can be overridden by the {@link
|
|
16
|
-
* @param svgStyle Overrides for the
|
|
15
|
+
* @param color The base/default color of the chart lines. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
16
|
+
* @param backgroundColor The base/default background color. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
17
|
+
* @param svgStyle Overrides for the chart container's CSS style
|
|
17
18
|
* @param seriesStyles Map holding the series name to the series style associated with that series.
|
|
18
|
-
* @param initialData Initial (static) data to plot before subscribing to the {@link ChartData} observable.
|
|
19
|
-
* @param asChartData Optional conversion function that converts an array of base-series with datum type D to a
|
|
20
|
-
* descendent of a {@link ChartData} object
|
|
21
19
|
* @param seriesFilter Regular expression that filters which series to display on the plot. Can be update while streaming
|
|
22
|
-
* @param
|
|
20
|
+
* @param dataSource The application-owned {@link StreamingDataSource} that holds (and ingests) the chart's data
|
|
23
21
|
* @param windowingTime The time-window (in milliseconds) to buffer the incoming data before updating the chart. This is
|
|
24
22
|
* a lever to reduce the lag between real-time and chart-time when a large amount of data is being
|
|
25
|
-
*
|
|
23
|
+
* ingested by the data source. Smaller time-windows result in smoother scrolling, but more updates, and
|
|
26
24
|
* possibly a larger lag.
|
|
27
|
-
* @param
|
|
28
|
-
* to `false` from `true`, unsubscribes from the {@link seriesObservable}.
|
|
29
|
-
* @param onSubscribe Callback when the chart subscribes to the {@link ChartData} observable
|
|
25
|
+
* @param dataUpdatePeriod The period (ms) at which the data source's generator emits new data, when known
|
|
30
26
|
* @param onUpdateAxesBounds Callback when the time range changes. This is generally used by plots where the
|
|
31
27
|
* x-axis starts to scroll as the data streams in past the end of the current time
|
|
32
28
|
* @param onUpdateChartTime Callback for updating the current chart time. This is generally used by plots
|
|
29
|
+
* whose axes don't represent time (e.g. the Poincaré plot)
|
|
33
30
|
* @template CD refers to the chart-data that is used by the Observable that has the stream of data.
|
|
34
31
|
* @template D refers to the datum in the data-series
|
|
35
32
|
* @template S refers to the type for the series style
|
|
36
33
|
*/
|
|
37
|
-
export interface Props<CD, D, S extends SeriesStyle> {
|
|
34
|
+
export interface Props<CD extends ChartData, D, S extends SeriesStyle> {
|
|
38
35
|
chartId: number;
|
|
39
36
|
/**
|
|
40
37
|
* The width of the chart container
|
|
@@ -49,56 +46,48 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
49
46
|
*/
|
|
50
47
|
margin?: Partial<Margin>;
|
|
51
48
|
/**
|
|
52
|
-
* The base/default color of the chart lines. This can be overridden by the {@link
|
|
49
|
+
* The base/default color of the chart lines. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
53
50
|
*/
|
|
54
51
|
color?: string;
|
|
55
52
|
/**
|
|
56
|
-
* The base/default background color. This can be overridden by the {@link
|
|
53
|
+
* The base/default background color. This can be overridden by the {@link ChartProps.svgStyle} property.
|
|
57
54
|
*/
|
|
58
55
|
backgroundColor?: string;
|
|
59
56
|
/**
|
|
60
|
-
* Overrides for the
|
|
57
|
+
* Overrides for the chart container's CSS style
|
|
61
58
|
*/
|
|
62
59
|
svgStyle?: Partial<SvgStyle>;
|
|
63
60
|
/**
|
|
64
61
|
* Map holding the series name to the series style associated with that series.
|
|
65
62
|
*/
|
|
66
63
|
seriesStyles?: Map<string, S>;
|
|
67
|
-
/**
|
|
68
|
-
* Initial (static) data to plot before subscribing to the {@link ChartData} observable.
|
|
69
|
-
*/
|
|
70
|
-
initialData: Array<BaseSeries<D>>;
|
|
71
|
-
/**
|
|
72
|
-
* Optional conversion function that converts an array of base-series with datum type D to a
|
|
73
|
-
* descendent of a {@link ChartData} object
|
|
74
|
-
* @param initialData The initial array of series
|
|
75
|
-
*/
|
|
76
|
-
asChartData?: (initialData: Array<BaseSeries<D>>) => CD;
|
|
77
64
|
/**
|
|
78
65
|
* Regular expression that filters which series to display on the plot. Can be update while streaming
|
|
79
66
|
*/
|
|
80
67
|
seriesFilter?: RegExp;
|
|
81
68
|
/**
|
|
82
|
-
*
|
|
69
|
+
* The application-owned source of the chart's data (see {@link StreamingDataSource}). The chart
|
|
70
|
+
* and its plots read their series from the data source, and redraw as it ingests new data --
|
|
71
|
+
* they never subscribe to the data stream themselves. The application starts and stops the
|
|
72
|
+
* data source (e.g. Run/Pause), and the data source keeps ingesting while the chart is
|
|
73
|
+
* unmounted (e.g. the user navigated to another page), so the chart picks up where it left
|
|
74
|
+
* off when it remounts.
|
|
83
75
|
*/
|
|
84
|
-
|
|
76
|
+
dataSource: StreamingDataSource<CD, D>;
|
|
85
77
|
/**
|
|
86
78
|
* The time-window (in milliseconds) to buffer the incoming data before updating the chart. This is
|
|
87
79
|
* a lever to reduce the lag between real-time and chart-time when a large amount of data is being
|
|
88
|
-
*
|
|
80
|
+
* ingested by the data source. Smaller time-windows result in smoother scrolling, but more updates, and
|
|
89
81
|
* possibly a larger lag.
|
|
90
82
|
*/
|
|
91
83
|
windowingTime?: number;
|
|
92
84
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
85
|
+
* The period (ms) at which the data source's generator emits new data, when known. When
|
|
86
|
+
* provided, buffering switches from wall-clock-based to a fixed tick count derived from
|
|
87
|
+
* `windowingTime / dataUpdatePeriod`, avoiding a jittery scroll that can otherwise result once
|
|
88
|
+
* the axis auto-scrolls (see the view drivers in `subscriptions/viewDrivers.ts`).
|
|
95
89
|
*/
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Callback when the chart subscribes to the {@link ChartData} observable
|
|
99
|
-
* @param subscription The RxJS subscription
|
|
100
|
-
*/
|
|
101
|
-
onSubscribe?: (subscription: Subscription) => void;
|
|
90
|
+
dataUpdatePeriod?: number;
|
|
102
91
|
/**
|
|
103
92
|
* Callback when the time range changes. This is generally used by plots where the
|
|
104
93
|
* x-axis starts to scroll as the data streams in past the end of the current time
|
|
@@ -115,103 +104,10 @@ export interface Props<CD, D, S extends SeriesStyle> {
|
|
|
115
104
|
* @param time The current chart time
|
|
116
105
|
*/
|
|
117
106
|
onUpdateChartTime?: (time: number) => void;
|
|
118
|
-
/**
|
|
119
|
-
* Callback function that is called when new data arrives to the chart.
|
|
120
|
-
* @param seriesName The name of the series for which new data arrived
|
|
121
|
-
* @param data The new data that arrived in the windowing tine
|
|
122
|
-
* @see UseChartValues.windowingTime
|
|
123
|
-
*/
|
|
124
|
-
onUpdateData?: (seriesName: string, data: Array<D>) => void;
|
|
125
107
|
/**
|
|
126
108
|
* The child components of the chart (i.e. the axis, plot, tracker, tooltip)
|
|
127
109
|
*/
|
|
128
110
|
children: JSX.Element | Array<JSX.Element>;
|
|
129
111
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
* subscription, sets up the {@link useChart} hook via the {@link ChartProvider}.
|
|
133
|
-
* @param props The properties of the chart
|
|
134
|
-
* @template CD Chart data
|
|
135
|
-
* @template D The type of the datum type held in a series
|
|
136
|
-
* @template S The type of the series style
|
|
137
|
-
* @template TM The type of the tooltip metadata (the data about the series). If not specified,
|
|
138
|
-
* defaults to an empty object
|
|
139
|
-
* @example
|
|
140
|
-
*
|
|
141
|
-
|
|
142
|
-
<Chart
|
|
143
|
-
width={useGridCellWidth()}
|
|
144
|
-
height={useGridCellHeight()}
|
|
145
|
-
margin={{...defaultMargin, top: 60, right: 75, left: 70}}
|
|
146
|
-
color={theme.color}
|
|
147
|
-
backgroundColor={theme.backgroundColor}
|
|
148
|
-
seriesStyles={new Map([
|
|
149
|
-
['neuron1', {
|
|
150
|
-
...defaultLineStyle,
|
|
151
|
-
color: 'orange',
|
|
152
|
-
lineWidth: 2,
|
|
153
|
-
highlightColor: 'orange'
|
|
154
|
-
}],
|
|
155
|
-
['neuron6', {
|
|
156
|
-
...defaultLineStyle,
|
|
157
|
-
color: theme.name === 'light' ? 'blue' : 'gray',
|
|
158
|
-
lineWidth: 3,
|
|
159
|
-
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
160
|
-
highlightWidth: 5
|
|
161
|
-
}],
|
|
162
|
-
])}
|
|
163
|
-
initialData={initialDataRef.current}
|
|
164
|
-
seriesFilter={filter}
|
|
165
|
-
seriesObservable={observableRef.current}
|
|
166
|
-
shouldSubscribe={running}
|
|
167
|
-
onUpdateTime={handleChartTimeUpdate}
|
|
168
|
-
windowingTime={150}
|
|
169
|
-
>
|
|
170
|
-
<ContinuousAxis
|
|
171
|
-
axisId="x-axis-1"
|
|
172
|
-
location={AxisLocation.Bottom}
|
|
173
|
-
domain={[0, 5000]}
|
|
174
|
-
label="t (ms)"
|
|
175
|
-
/>
|
|
176
|
-
<CategoryAxis
|
|
177
|
-
axisId="y-axis-1"
|
|
178
|
-
location={AxisLocation.Left}
|
|
179
|
-
categories={initialDataRef.current.map(series => series.name)}
|
|
180
|
-
label="neuron"
|
|
181
|
-
/>
|
|
182
|
-
<CategoryAxis
|
|
183
|
-
axisId="y-axis-2"
|
|
184
|
-
location={AxisLocation.Right}
|
|
185
|
-
categories={initialDataRef.current.map(series => series.name)}
|
|
186
|
-
label="neuron"
|
|
187
|
-
/>
|
|
188
|
-
<Tracker
|
|
189
|
-
visible={visibility.tracker}
|
|
190
|
-
labelLocation={TrackerLabelLocation.WithMouse}
|
|
191
|
-
style={{color: theme.color}}
|
|
192
|
-
font={{color: theme.color}}
|
|
193
|
-
/>
|
|
194
|
-
<Tooltip
|
|
195
|
-
visible={visibility.tooltip}
|
|
196
|
-
style={{
|
|
197
|
-
fontColor: theme.color,
|
|
198
|
-
backgroundColor: theme.backgroundColor,
|
|
199
|
-
borderColor: theme.color,
|
|
200
|
-
backgroundOpacity: 0.9,
|
|
201
|
-
}}
|
|
202
|
-
>
|
|
203
|
-
<RasterPlotTooltipContent
|
|
204
|
-
xFormatter={value => formatNumber(value, " ,.0f") + ' ms'}
|
|
205
|
-
yFormatter={value => formatNumber(value, " ,.1f") + ' mV'}
|
|
206
|
-
/>
|
|
207
|
-
</Tooltip>
|
|
208
|
-
<RasterPlot
|
|
209
|
-
spikeMargin={1}
|
|
210
|
-
dropDataAfter={5000}
|
|
211
|
-
panEnabled={true}
|
|
212
|
-
zoomEnabled={true}
|
|
213
|
-
zoomKeyModifiersRequired={true}
|
|
214
|
-
/>
|
|
215
|
-
</Chart>
|
|
216
|
-
*/
|
|
217
|
-
export declare function Chart<CD extends ChartData, D, S extends SeriesStyle, TM>(props: Props<CD, D, S>): JSX.Element;
|
|
112
|
+
export declare function Chart<CD extends ChartData, D, S extends SeriesStyle, TM, AR extends BaseAxisRange, A extends BaseAxis>(props: Props<CD, D, S>): JSX.Element;
|
|
113
|
+
//# sourceMappingURL=Chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/app/charts/Chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,GAAG,EAAU,MAAM,OAAO,CAAA;AACvC,OAAO,EAAC,KAAK,MAAM,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAGvD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAQxD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAC;AAK3E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,WAAW;IACjE,OAAO,EAAE,MAAM,CAAA;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAE7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAKrB;;;;;;;OAOG;IACH,UAAU,EAAE,mBAAmB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACtC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,IAAI,CAAA;IAChE;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAE1C;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;CAC9C;AAuGD,wBAAgB,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC,EAAE,CAAC,SAAS,WAAW,EAAE,EAAE,EAAE,EAAE,SAAS,aAAa,EAAE,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAyF3J"}
|
package/dist/app/charts/Chart.js
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
3
|
-
import { plotDimensionsFrom } from "./styling/margins";
|
|
4
|
-
import { initialSvgStyle } from "./styling/svgStyle";
|
|
5
|
-
import ChartProvider from "./hooks/useChart";
|
|
6
|
-
import PlotDimensionsProvider, { defaultMargin } from "./hooks/usePlotDimensions";
|
|
7
|
-
import * as d3 from "d3";
|
|
8
|
-
import { createPlotContainer } from "./plots/plot";
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
9
3
|
import { noop } from "./utils";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
4
|
+
import { defaultMargin } from "./hooks/defaultPlotDimensions";
|
|
5
|
+
import PlotDimensionsProvider from "./hooks/PlotDimensionsProvider";
|
|
6
|
+
import CanvasSurfaceProvider from "./hooks/CanvasSurfaceProvider";
|
|
7
|
+
import InteractionProvider from "./hooks/InteractionProvider";
|
|
8
|
+
import ChartProvider from "./hooks/ChartProvider";
|
|
9
|
+
import AxesProvider from "./hooks/AxesProvider";
|
|
10
|
+
import { isSafeRegex } from "./filters/regexFilter";
|
|
11
|
+
import { ChartDataContext } from "./hooks/useDataSource";
|
|
15
12
|
const defaultBackground = '#202020';
|
|
16
13
|
/**
|
|
17
|
-
* The chart container that holds the axes, plot, tracker, and tooltip. The chart
|
|
18
|
-
*
|
|
14
|
+
* The chart container that holds the axes, plot, tracker, and tooltip. The chart reads its data
|
|
15
|
+
* from the application-owned data source (its `dataSource` prop), and sets up the
|
|
16
|
+
* {@link useChart} hook via the {@link ChartProvider}.
|
|
17
|
+
*
|
|
18
|
+
* Internally, the chart is backed by a single `<canvas>` element rather than an SVG element tree.
|
|
19
|
+
* The canvas itself is created and sized by {@link CanvasSurfaceProvider}, which derives its size
|
|
20
|
+
* from {@link usePlotDimensions} (the single source of truth for the chart's dimensions) rather
|
|
21
|
+
* than from this component's `width`/`height` props directly -- this keeps the canvas correctly
|
|
22
|
+
* sized even if dimensions are ever updated via `usePlotDimensions().updateDimensions(...)`
|
|
23
|
+
* independent of a prop change. Axes, plots, and the tracker don't create/mutate their own DOM
|
|
24
|
+
* nodes -- they register a draw function with the {@link CanvasContext} (exposed via
|
|
25
|
+
* `useChart().canvasContext`, itself sourced from {@link CanvasSurfaceProvider} via
|
|
26
|
+
* `useCanvasSurface()`), and the canvas context clears and repaints all registered draw functions
|
|
27
|
+
* whenever a redraw is requested.
|
|
19
28
|
* @param props The properties of the chart
|
|
29
|
+
* @return The chart, with its children inside the chart's context providers
|
|
20
30
|
* @template CD Chart data
|
|
21
31
|
* @template D The type of the datum type held in a series
|
|
22
32
|
* @template S The type of the series style
|
|
@@ -33,24 +43,22 @@ const defaultBackground = '#202020';
|
|
|
33
43
|
backgroundColor={theme.backgroundColor}
|
|
34
44
|
seriesStyles={new Map([
|
|
35
45
|
['neuron1', {
|
|
36
|
-
...defaultLineStyle,
|
|
46
|
+
...defaultLineStyle(),
|
|
37
47
|
color: 'orange',
|
|
38
48
|
lineWidth: 2,
|
|
39
49
|
highlightColor: 'orange'
|
|
40
50
|
}],
|
|
41
51
|
['neuron6', {
|
|
42
|
-
...defaultLineStyle,
|
|
52
|
+
...defaultLineStyle(),
|
|
43
53
|
color: theme.name === 'light' ? 'blue' : 'gray',
|
|
44
54
|
lineWidth: 3,
|
|
45
55
|
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
46
56
|
highlightWidth: 5
|
|
47
57
|
}],
|
|
48
58
|
])}
|
|
49
|
-
|
|
59
|
+
dataSource={dataSource}
|
|
50
60
|
seriesFilter={filter}
|
|
51
|
-
|
|
52
|
-
shouldSubscribe={running}
|
|
53
|
-
onUpdateTime={handleChartTimeUpdate}
|
|
61
|
+
onUpdateAxesBounds={handleChartTimeUpdate}
|
|
54
62
|
windowingTime={150}
|
|
55
63
|
>
|
|
56
64
|
<ContinuousAxis
|
|
@@ -59,16 +67,16 @@ const defaultBackground = '#202020';
|
|
|
59
67
|
domain={[0, 5000]}
|
|
60
68
|
label="t (ms)"
|
|
61
69
|
/>
|
|
62
|
-
<
|
|
70
|
+
<OrdinalAxis
|
|
63
71
|
axisId="y-axis-1"
|
|
64
72
|
location={AxisLocation.Left}
|
|
65
|
-
categories={
|
|
73
|
+
categories={dataSource.seriesList().map(series => series.name)}
|
|
66
74
|
label="neuron"
|
|
67
75
|
/>
|
|
68
|
-
<
|
|
76
|
+
<OrdinalAxis
|
|
69
77
|
axisId="y-axis-2"
|
|
70
78
|
location={AxisLocation.Right}
|
|
71
|
-
categories={
|
|
79
|
+
categories={dataSource.seriesList().map(series => series.name)}
|
|
72
80
|
label="neuron"
|
|
73
81
|
/>
|
|
74
82
|
<Tracker
|
|
@@ -93,52 +101,53 @@ const defaultBackground = '#202020';
|
|
|
93
101
|
</Tooltip>
|
|
94
102
|
<RasterPlot
|
|
95
103
|
spikeMargin={1}
|
|
96
|
-
dropDataAfter={5000}
|
|
97
104
|
panEnabled={true}
|
|
98
105
|
zoomEnabled={true}
|
|
99
106
|
zoomKeyModifiersRequired={true}
|
|
100
107
|
/>
|
|
101
108
|
</Chart>
|
|
102
109
|
*/
|
|
110
|
+
// the defaults (constants, so that their identity doesn't change from one render to the next)
|
|
111
|
+
const NO_SERIES_STYLES = new Map();
|
|
112
|
+
const MATCH_EVERYTHING = /./;
|
|
103
113
|
export function Chart(props) {
|
|
104
|
-
const { chartId, width, height, color = '#d2933f', backgroundColor = defaultBackground, seriesStyles =
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
children }) }) }) }) }) }) })] }));
|
|
114
|
+
const { chartId, width, height, color = '#d2933f', backgroundColor = defaultBackground, seriesStyles = NO_SERIES_STYLES, seriesFilter = MATCH_EVERYTHING, dataSource, windowingTime = 100, dataUpdatePeriod, onUpdateAxesBounds = noop, onUpdateChartTime = noop, children, } = props;
|
|
115
|
+
// the series the data source held when it was handed to the chart. Memoized on the data source
|
|
116
|
+
// ALONE: a new data source means new initial data, and the plots reset themselves when the
|
|
117
|
+
// initial data changes -- so it must not change when anything else does (e.g. a new
|
|
118
|
+
// `onUpdateChartTime` callback on every render of the chart's parent, which would otherwise
|
|
119
|
+
// reset the plots on every render)
|
|
120
|
+
const initialData = useMemo(() => dataSource.seriesList(), [dataSource]);
|
|
121
|
+
// the chart's data: the data source, its initial data, and the streaming settings
|
|
122
|
+
const chartData = useMemo(() => ({
|
|
123
|
+
dataSource: dataSource,
|
|
124
|
+
initialData,
|
|
125
|
+
windowingTime,
|
|
126
|
+
dataUpdatePeriod,
|
|
127
|
+
onUpdateChartTime
|
|
128
|
+
}), [dataSource, initialData, windowingTime, dataUpdatePeriod, onUpdateChartTime]);
|
|
129
|
+
// override the defaults with the parent's properties, leaving any unset values as the default
|
|
130
|
+
// value (memoized on the margin's values, so that a new `margin` object with the same values
|
|
131
|
+
// doesn't change the plot dimensions' context)
|
|
132
|
+
const { top, bottom, left, right } = { ...defaultMargin, ...props.margin };
|
|
133
|
+
const margin = useMemo(() => ({ top, bottom, left, right }), [top, bottom, left, right]);
|
|
134
|
+
const containerDimensions = useMemo(() => ({ width, height }), [width, height]);
|
|
135
|
+
// `seriesFilter` is tested against every series name on every redraw frame by each plot
|
|
136
|
+
// component (not just once), so an unvetted pattern -- e.g. one built directly from
|
|
137
|
+
// free-text user input without going through the `regexFilter` helper, which already screens
|
|
138
|
+
// for this -- could freeze the whole render loop with catastrophic backtracking. This is the
|
|
139
|
+
// one place every `seriesFilter`, however it was constructed, necessarily passes through
|
|
140
|
+
// before reaching a plot, so it's checked here too, falling back to the safe match-everything
|
|
141
|
+
// default rather than ever handing plots something that could hang them.
|
|
142
|
+
const safeSeriesFilter = useMemo(() => {
|
|
143
|
+
if (isSafeRegex(seriesFilter))
|
|
144
|
+
return seriesFilter;
|
|
145
|
+
console.warn(`seriesFilter regex risks catastrophic backtracking and was ignored; ` +
|
|
146
|
+
`falling back to the default (match-everything) filter; pattern: ${seriesFilter}`);
|
|
147
|
+
return MATCH_EVERYTHING;
|
|
148
|
+
}, [seriesFilter]);
|
|
149
|
+
return (_jsx(PlotDimensionsProvider, { containerDimensions: containerDimensions, margin: margin, children: _jsx(CanvasSurfaceProvider, { chartId: chartId, color: color, backgroundColor: backgroundColor, svgStyle: props.svgStyle, children: _jsx(AxesProvider, { onUpdateAxesInterval: onUpdateAxesBounds, children: _jsx(InteractionProvider, { children: _jsx(ChartDataContext.Provider, { value: chartData, children: _jsx(ChartProvider, { chartId: chartId, color: color, backgroundColor: backgroundColor, seriesStyles: seriesStyles, seriesFilter: safeSeriesFilter, children:
|
|
150
|
+
// the chart elements are the children
|
|
151
|
+
children }) }) }) }) }) }));
|
|
143
152
|
}
|
|
144
153
|
//# sourceMappingURL=Chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/app/charts/Chart.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../src/app/charts/Chart.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAW,OAAO,EAAC,MAAM,OAAO,CAAA;AAIvC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAK7B,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAC5D,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AACpE,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAClE,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAC,gBAAgB,EAAuB,MAAM,uBAAuB,CAAC;AAE7E,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAgHpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgGE;AACF,8FAA8F;AAC9F,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAuB,CAAA;AACvD,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAE5B,MAAM,UAAU,KAAK,CAAmG,KAAsB;IAC1I,MAAM,EACF,OAAO,EAEP,KAAK,EACL,MAAM,EACN,KAAK,GAAG,SAAS,EACjB,eAAe,GAAG,iBAAiB,EACnC,YAAY,GAAG,gBAAkC,EACjD,YAAY,GAAG,gBAAgB,EAC/B,UAAU,EACV,aAAa,GAAG,GAAG,EACnB,gBAAgB,EAEhB,kBAAkB,GAAG,IAAI,EACzB,iBAAiB,GAAG,IAAI,EAExB,QAAQ,GACX,GAAG,KAAK,CAAA;IAET,+FAA+F;IAC/F,2FAA2F;IAC3F,oFAAoF;IACpF,4FAA4F;IAC5F,mCAAmC;IACnC,MAAM,WAAW,GAAG,OAAO,CAAuB,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;IAE9F,kFAAkF;IAClF,MAAM,SAAS,GAAG,OAAO,CACrB,GAAG,EAAE,CAAC,CAAC;QACH,UAAU,EAAE,UAAuD;QACnE,WAAW;QACX,aAAa;QACb,gBAAgB;QAChB,iBAAiB;KACpB,CAAC,EACF,CAAC,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAChF,CAAA;IAED,8FAA8F;IAC9F,6FAA6F;IAC7F,+CAA+C;IAC/C,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,GAAG,EAAC,GAAG,aAAa,EAAE,GAAG,KAAK,CAAC,MAAM,EAAC,CAAA;IACtE,MAAM,MAAM,GAAG,OAAO,CAAS,GAAG,EAAE,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IAC9F,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,MAAM,EAAC,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;IAE7E,wFAAwF;IACxF,oFAAoF;IACpF,6FAA6F;IAC7F,6FAA6F;IAC7F,yFAAyF;IACzF,8FAA8F;IAC9F,yEAAyE;IACzE,MAAM,gBAAgB,GAAG,OAAO,CAC5B,GAAG,EAAE;QACD,IAAI,WAAW,CAAC,YAAY,CAAC;YAAE,OAAO,YAAY,CAAA;QAClD,OAAO,CAAC,IAAI,CACR,sEAAsE;YACtE,mEAAmE,YAAY,EAAE,CACpF,CAAA;QACD,OAAO,gBAAgB,CAAA;IAC3B,CAAC,EACD,CAAC,YAAY,CAAC,CACjB,CAAA;IAED,OAAO,CACH,KAAC,sBAAsB,IAAC,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,YAC5E,KAAC,qBAAqB,IAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,YAC7G,KAAC,YAAY,IAAC,oBAAoB,EAAE,kBAAkB,YAClD,KAAC,mBAAmB,cAChB,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS,YACvC,KAAC,aAAa,IACV,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,gBAAgB;4BAG1B,sCAAsC;4BACtC,QAAQ,GAEA,GACQ,GACV,GACX,GACK,GACH,CAC5B,CAAC;AACN,CAAC"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { BaseAxis } from "./axes";
|
|
1
|
+
import type { BaseAxis } from "./axes";
|
|
2
2
|
import { Optional } from "result-fn";
|
|
3
3
|
/**
|
|
4
|
-
* Holds the information to allow mapping axes
|
|
5
|
-
* These objects hold the axis ID, its location on the chart (i.e. left,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Holds the information to allow mapping axes IDs to the underlying axes objects (of either the
|
|
5
|
+
* x-axes or the y-axes). These objects hold the axis ID, its location on the chart (i.e. left,
|
|
6
|
+
* right, bottom, top), its type, and (for the axis types that extend `BaseAxis`) its scale and the
|
|
7
|
+
* functions for updating and drawing it.
|
|
8
8
|
* @typeParam A The type of the axes (must extend `BaseAxis`)
|
|
9
9
|
*/
|
|
10
10
|
export declare class AxesState<A extends BaseAxis> {
|
|
11
11
|
readonly axes: Map<string, A>;
|
|
12
|
+
/**
|
|
13
|
+
* Use {@link from} or {@link empty} to create an axes state
|
|
14
|
+
* @param axes Mapping of the axes IDs to the axes
|
|
15
|
+
*/
|
|
12
16
|
private constructor();
|
|
13
17
|
/**
|
|
14
18
|
* Creates a new axes state from the specified map of axes.
|
|
@@ -26,12 +30,8 @@ export declare class AxesState<A extends BaseAxis> {
|
|
|
26
30
|
*/
|
|
27
31
|
isEmpty(): boolean;
|
|
28
32
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
copy(): AxesState<A>;
|
|
33
|
-
/**
|
|
34
|
-
* Adds an axis to the current axis state and returns a new axis state. This is an internal state
|
|
33
|
+
* Adds an axis to this axes state's map of axes (in place), and returns a new axes state holding
|
|
34
|
+
* that same map (a new object, so that React sees the change). This is an internal state
|
|
35
35
|
* management function. This should generally not be used. Instead, use the {@link UseAxesValues.addXAxis}
|
|
36
36
|
* and {@link UseAxesValues.addYAxis} functions to add axes.
|
|
37
37
|
* @param axis The axis to add
|
|
@@ -42,23 +42,31 @@ export declare class AxesState<A extends BaseAxis> {
|
|
|
42
42
|
*/
|
|
43
43
|
addAxis(axis: A, id: string): AxesState<A>;
|
|
44
44
|
/**
|
|
45
|
-
* Attempts to retrieve the
|
|
46
|
-
* @param axisId The unique ID of the axis
|
|
47
|
-
*
|
|
45
|
+
* Attempts to retrieve the axis for the specified ID.
|
|
46
|
+
* @param axisId The unique ID of the axis, or `""` to request the default axis (the
|
|
47
|
+
* convention used throughout this library wherever a series has no explicit axis
|
|
48
|
+
* assignment -- see e.g. each plot component's own `axesFor` helper).
|
|
49
|
+
* @return The axis matching `axisId`; the default axis (see {@link defaultAxis}) if
|
|
50
|
+
* `axisId` is `""` and at least one axis exists; otherwise an empty `Optional`. A non-empty
|
|
51
|
+
* `axisId` that doesn't match any axis is deliberately treated as "not found" rather than
|
|
52
|
+
* silently substituting an unrelated axis -- that used to happen for *any* unmatched ID,
|
|
53
|
+
* which masked stale/mistyped axis IDs as if they'd resolved correctly.
|
|
48
54
|
*/
|
|
49
55
|
axisFor(axisId: string): Optional<A>;
|
|
50
56
|
/**
|
|
51
|
-
* Returns the default axis
|
|
52
|
-
* @return The default axis
|
|
57
|
+
* Returns the default axis: the first axis added
|
|
58
|
+
* @return The default axis, or an empty `Optional` when there are no axes
|
|
53
59
|
* @see axisDefaultId
|
|
54
60
|
*/
|
|
55
61
|
defaultAxis(): Optional<A>;
|
|
56
62
|
/**
|
|
57
|
-
* @return An array holding all
|
|
63
|
+
* @return An array holding the IDs of all the axes
|
|
58
64
|
*/
|
|
59
65
|
axisIds(): Array<string>;
|
|
60
66
|
/**
|
|
61
|
-
* @return The
|
|
67
|
+
* @return The ID of the default axis (the first axis added), or an empty `Optional` when there
|
|
68
|
+
* are no axes
|
|
62
69
|
*/
|
|
63
70
|
axisDefaultId(): Optional<string>;
|
|
64
71
|
}
|
|
72
|
+
//# sourceMappingURL=AxesState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxesState.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxesState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC;;;;;;GAMG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,QAAQ;IACrC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAE7B;;;OAGG;IACH,OAAO;IAIP;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAInE;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC;IAIhD;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAK1C;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;IAQpC;;;;OAIG;IACH,WAAW,IAAI,QAAQ,CAAC,CAAC,CAAC;IAO1B;;OAEG;IACH,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC;IAIxB;;;OAGG;IACH,aAAa,IAAI,QAAQ,CAAC,MAAM,CAAC;CAMpC"}
|