stream-charts 1.2.1 → 2.0.1-snapshot
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
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import {BaseAxis} from "./axes";
|
|
1
|
+
import type {BaseAxis} from "./axes";
|
|
2
2
|
import {Optional} from "result-fn";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Holds the information to allow mapping axes
|
|
6
|
-
* These objects hold the axis ID, its location on the chart (i.e. left,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Holds the information to allow mapping axes IDs to the underlying axes objects (of either the
|
|
6
|
+
* x-axes or the y-axes). These objects hold the axis ID, its location on the chart (i.e. left,
|
|
7
|
+
* right, bottom, top), its type, and (for the axis types that extend `BaseAxis`) its scale and the
|
|
8
|
+
* functions for updating and drawing it.
|
|
9
9
|
* @typeParam A The type of the axes (must extend `BaseAxis`)
|
|
10
10
|
*/
|
|
11
11
|
export class AxesState<A extends BaseAxis> {
|
|
12
12
|
readonly axes: Map<string, A>
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Use {@link from} or {@link empty} to create an axes state
|
|
16
|
+
* @param axes Mapping of the axes IDs to the axes
|
|
17
|
+
*/
|
|
14
18
|
private constructor(axes: Map<string, A>) {
|
|
15
19
|
this.axes = axes
|
|
16
20
|
}
|
|
@@ -40,19 +44,8 @@ export class AxesState<A extends BaseAxis> {
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
copy(): AxesState<A> {
|
|
47
|
-
return new AxesState<A>(
|
|
48
|
-
new Map<string, A>(Array.from(this.axes.entries())
|
|
49
|
-
.map(([id, axis]) => [id, {...axis}])
|
|
50
|
-
)
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Adds an axis to the current axis state and returns a new axis state. This is an internal state
|
|
47
|
+
* Adds an axis to this axes state's map of axes (in place), and returns a new axes state holding
|
|
48
|
+
* that same map (a new object, so that React sees the change). This is an internal state
|
|
56
49
|
* management function. This should generally not be used. Instead, use the {@link UseAxesValues.addXAxis}
|
|
57
50
|
* and {@link UseAxesValues.addYAxis} functions to add axes.
|
|
58
51
|
* @param axis The axis to add
|
|
@@ -67,23 +60,27 @@ export class AxesState<A extends BaseAxis> {
|
|
|
67
60
|
}
|
|
68
61
|
|
|
69
62
|
/**
|
|
70
|
-
* Attempts to retrieve the
|
|
71
|
-
* @param axisId The unique ID of the axis
|
|
72
|
-
*
|
|
63
|
+
* Attempts to retrieve the axis for the specified ID.
|
|
64
|
+
* @param axisId The unique ID of the axis, or `""` to request the default axis (the
|
|
65
|
+
* convention used throughout this library wherever a series has no explicit axis
|
|
66
|
+
* assignment -- see e.g. each plot component's own `axesFor` helper).
|
|
67
|
+
* @return The axis matching `axisId`; the default axis (see {@link defaultAxis}) if
|
|
68
|
+
* `axisId` is `""` and at least one axis exists; otherwise an empty `Optional`. A non-empty
|
|
69
|
+
* `axisId` that doesn't match any axis is deliberately treated as "not found" rather than
|
|
70
|
+
* silently substituting an unrelated axis -- that used to happen for *any* unmatched ID,
|
|
71
|
+
* which masked stale/mistyped axis IDs as if they'd resolved correctly.
|
|
73
72
|
*/
|
|
74
73
|
axisFor(axisId: string): Optional<A> {
|
|
75
74
|
const axis = this.axes.get(axisId)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (axis === undefined && this.axes.size >= 1) {
|
|
79
|
-
return Optional.of(Array.from(this.axes.values())[0])
|
|
75
|
+
if (axis === undefined && axisId === "" && this.axes.size >= 1) {
|
|
76
|
+
return this.defaultAxis()
|
|
80
77
|
}
|
|
81
78
|
return Optional.ofNullable(axis)
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
/**
|
|
85
|
-
* Returns the default axis
|
|
86
|
-
* @return The default axis
|
|
82
|
+
* Returns the default axis: the first axis added
|
|
83
|
+
* @return The default axis, or an empty `Optional` when there are no axes
|
|
87
84
|
* @see axisDefaultId
|
|
88
85
|
*/
|
|
89
86
|
defaultAxis(): Optional<A> {
|
|
@@ -94,14 +91,15 @@ export class AxesState<A extends BaseAxis> {
|
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
/**
|
|
97
|
-
* @return An array holding all
|
|
94
|
+
* @return An array holding the IDs of all the axes
|
|
98
95
|
*/
|
|
99
96
|
axisIds(): Array<string> {
|
|
100
97
|
return Array.from(this.axes.keys())
|
|
101
98
|
}
|
|
102
99
|
|
|
103
100
|
/**
|
|
104
|
-
* @return The
|
|
101
|
+
* @return The ID of the default axis (the first axis added), or an empty `Optional` when there
|
|
102
|
+
* are no axes
|
|
105
103
|
*/
|
|
106
104
|
axisDefaultId(): Optional<string> {
|
|
107
105
|
const ids = Array.from(this.axes.keys())
|
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* An immutable (start, end) interval, with `start <= end`, used both for an axis' domain (its
|
|
3
|
+
* data-space, for example, the range of the tick values) and for an axis' range (its pixel-space,
|
|
4
|
+
* the physical start and end pixels on the screen). An interval whose start or end is `NaN` is
|
|
5
|
+
* empty.
|
|
5
6
|
*/
|
|
6
7
|
export class AxisInterval {
|
|
7
|
-
|
|
8
|
+
readonly start: number
|
|
9
|
+
readonly end: number
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
12
|
+
* Use {@link from}, {@link as}, or {@link empty} to create an axis interval
|
|
13
|
+
* @param start The interval's start
|
|
14
|
+
* @param end The interval's end
|
|
15
|
+
*/
|
|
16
|
+
private constructor(start: number, end: number) {
|
|
17
|
+
this.start = start
|
|
18
|
+
this.end = end
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates an axis interval from the specified start and end values. The values are normalized
|
|
23
|
+
* so that `start <= end` regardless of the order they're passed in -- callers never need to
|
|
24
|
+
* worry about which endpoint ended up larger (e.g. after a pan/zoom delta pushes one endpoint
|
|
25
|
+
* past the other).
|
|
26
|
+
*
|
|
27
|
+
* If exactly one of `start`/`end` is `NaN`, both endpoints of the result collapse to `NaN`
|
|
28
|
+
* (`Math.min`/`Math.max` propagate `NaN` unconditionally) -- the same representation as an
|
|
29
|
+
* intentionally-empty interval (see {@link empty}). That's indistinguishable from genuinely
|
|
30
|
+
* wanting an empty interval, and silently discards which of the two inputs was actually bad,
|
|
31
|
+
* so this logs a warning for that specific mixed case (one real number, one `NaN`) to surface
|
|
32
|
+
* what's almost always an upstream computation error -- `from(NaN, NaN)` (a deliberate empty
|
|
33
|
+
* interval) is not warned about.
|
|
11
34
|
* @param start The axis-range start value
|
|
12
35
|
* @param end The axis-range end value
|
|
13
36
|
* @return The axis-interval
|
|
14
37
|
*/
|
|
15
38
|
static from(start: number, end: number): AxisInterval {
|
|
39
|
+
if ((isNaN(start) || isNaN(end)) && !(isNaN(start) && isNaN(end))) {
|
|
40
|
+
console.warn(
|
|
41
|
+
`AxisInterval.from received exactly one NaN endpoint -- this usually indicates an ` +
|
|
42
|
+
`upstream computation error, not an intentional empty interval (use AxisInterval.empty() ` +
|
|
43
|
+
`for that); start: ${start}, end: ${end}`
|
|
44
|
+
)
|
|
45
|
+
}
|
|
16
46
|
return new AxisInterval(Math.min(start, end), Math.max(start, end))
|
|
17
47
|
}
|
|
18
48
|
|
|
@@ -48,7 +78,11 @@ export class AxisInterval {
|
|
|
48
78
|
}
|
|
49
79
|
|
|
50
80
|
/**
|
|
51
|
-
*
|
|
81
|
+
* Determines whether this axis interval's start and end are the specified ones (two empty
|
|
82
|
+
* intervals are equal)
|
|
83
|
+
* @param start The start to compare to
|
|
84
|
+
* @param end The end to compare to
|
|
85
|
+
* @return `true` if this axis interval's start and end are the specified ones, `false` otherwise
|
|
52
86
|
*/
|
|
53
87
|
equalsInterval(start: number, end: number): boolean {
|
|
54
88
|
return (this.start === start && this.end === end) || (this.isEmpty() && isNaN(start) && isNaN(end))
|
|
@@ -64,8 +98,8 @@ export class AxisInterval {
|
|
|
64
98
|
}
|
|
65
99
|
|
|
66
100
|
/**
|
|
67
|
-
* Creates a copy of
|
|
68
|
-
* @return A copy of
|
|
101
|
+
* Creates a copy of this axis interval
|
|
102
|
+
* @return A copy of this axis interval
|
|
69
103
|
*/
|
|
70
104
|
copy(): AxisInterval {
|
|
71
105
|
return AxisInterval.from(this.start, this.end)
|
|
@@ -80,9 +114,10 @@ export class AxisInterval {
|
|
|
80
114
|
}
|
|
81
115
|
|
|
82
116
|
/**
|
|
83
|
-
* Applies the specified function to
|
|
84
|
-
*
|
|
85
|
-
* @
|
|
117
|
+
* Applies the specified function to this axis interval's start and end, and returns the
|
|
118
|
+
* resulting interval
|
|
119
|
+
* @param fn The function to apply to the axis interval's start and end
|
|
120
|
+
* @return A new axis interval holding the function's result
|
|
86
121
|
*/
|
|
87
122
|
map(fn: (start: number, end: number) => [start: number, end: number]): AxisInterval {
|
|
88
123
|
const [start, end] = fn(this.start, this.end)
|
|
@@ -90,50 +125,40 @@ export class AxisInterval {
|
|
|
90
125
|
}
|
|
91
126
|
|
|
92
127
|
/**
|
|
93
|
-
* Calculates the measure (end - start) of
|
|
128
|
+
* Calculates the measure (end - start) of this axis interval.
|
|
94
129
|
* The measure of an empty axis interval is 0.
|
|
95
|
-
* @return The measure (end - start) of
|
|
130
|
+
* @return The measure (end - start) of this axis interval
|
|
96
131
|
*/
|
|
97
132
|
measure(): number {
|
|
98
133
|
return this.isNotEmpty() ? this.end - this.start : 0
|
|
99
134
|
}
|
|
100
135
|
|
|
101
136
|
/**
|
|
102
|
-
*
|
|
103
|
-
* @param delta The amount by which to
|
|
104
|
-
* @return A new axis interval
|
|
137
|
+
* Creates an axis interval whose start is moved by the specified amount (and whose end isn't)
|
|
138
|
+
* @param delta The amount by which to move the start
|
|
139
|
+
* @return A new axis interval (empty when this one is)
|
|
105
140
|
*/
|
|
106
141
|
translateStart(delta: number): AxisInterval {
|
|
107
142
|
return this.isNotEmpty() ? AxisInterval.from(this.start + delta, this.end) : AxisInterval.empty()
|
|
108
143
|
}
|
|
109
144
|
|
|
110
145
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @param delta The amount by which to
|
|
113
|
-
* @return
|
|
146
|
+
* Creates an axis interval whose end is moved by the specified amount (and whose start isn't)
|
|
147
|
+
* @param delta The amount by which to move the end
|
|
148
|
+
* @return A new axis interval (empty when this one is)
|
|
114
149
|
*/
|
|
115
150
|
translateEnd(delta: number): AxisInterval {
|
|
116
151
|
return this.isNotEmpty() ? AxisInterval.from(this.start, this.end + delta) : AxisInterval.empty()
|
|
117
152
|
}
|
|
118
153
|
|
|
119
154
|
/**
|
|
120
|
-
*
|
|
155
|
+
* Creates an axis interval that's this one translated (both its start and its end moved) by the
|
|
156
|
+
* specified amount
|
|
121
157
|
* @param delta The amount by which to translate the axis interval
|
|
122
|
-
* @return
|
|
158
|
+
* @return A new axis interval (empty when this one is)
|
|
123
159
|
*/
|
|
124
160
|
translate(delta: number): AxisInterval {
|
|
125
161
|
return this.isNotEmpty() ? AxisInterval.from(this.start + delta, this.end + delta) : AxisInterval.empty()
|
|
126
162
|
}
|
|
127
163
|
}
|
|
128
164
|
|
|
129
|
-
/**
|
|
130
|
-
* Creates a copy of the specified map(axis_id, (start, end))
|
|
131
|
-
* @param ranges The ranges map to copy
|
|
132
|
-
* @return A copy of the specified map(axis_id, (start, end))
|
|
133
|
-
*/
|
|
134
|
-
export function copyRangeMap(ranges: Map<string, AxisInterval>): Map<string, AxisInterval> {
|
|
135
|
-
return new Map(Array.from(ranges.entries())
|
|
136
|
-
.map(([id, range]) => [id, range.copy()])
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
@@ -31,67 +31,87 @@ export abstract class BaseAxisRange {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* The current distance between the start and end of the range
|
|
35
|
+
* @return The current range's measure (0 when it's empty)
|
|
35
36
|
*/
|
|
36
37
|
get currentDistance(): number {
|
|
37
38
|
return this.current.measure()
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
+
* The original (e.g. before any zooming or panning) distance between the start and end of the range
|
|
43
|
+
* @return The original range's measure (0 when it's empty)
|
|
42
44
|
*/
|
|
43
45
|
get originalDistance(): number {
|
|
44
46
|
return this.original.measure()
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
50
|
+
* Scales the range by the specified *incremental* factor -- i.e. relative to `.current`, not
|
|
51
|
+
* relative to `.original`. d3-zoom's own `transform.k` is cumulative from wherever `__zoom` was
|
|
52
|
+
* last reset to identity, so callers must first convert it to an incremental factor (this
|
|
53
|
+
* event's `k` divided by the previously-applied `k`, tracked in a ref that survives across
|
|
54
|
+
* zoom events -- see `useCanvasZoomPan`) before calling this. Scaling relative
|
|
55
|
+
* to `.current` this way means `.original` no longer needs to be preserved/shifted for the
|
|
56
|
+
* zoom math to stay correct -- unlike the previous design, where `factor` was the *cumulative*
|
|
57
|
+
* `transform.k` applied against `.original`, which broke the moment anything (e.g. a fresh
|
|
58
|
+
* subscription on Run) rebuilt `.original` to match a since-zoomed `.current` mid-session.
|
|
59
|
+
* @param factor The incremental scale factor (this event's change in scale, not the cumulative
|
|
60
|
+
* scale since the axis was last at identity)
|
|
57
61
|
* @param value The current value being scaled
|
|
58
62
|
* @return The new range, represented by an array holding the start and end value
|
|
59
63
|
*/
|
|
60
64
|
protected scaledRange(factor: number, value: number): AxisInterval {
|
|
61
65
|
const dtStart = value - this.current.start
|
|
62
66
|
const dtEnd = this.current.end - value
|
|
63
|
-
const start = value - dtStart * factor
|
|
64
|
-
const end = value + dtEnd * factor
|
|
67
|
+
const start = value - dtStart * factor
|
|
68
|
+
const end = value + dtEnd * factor
|
|
65
69
|
return AxisInterval.from(start, end)
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* from that
|
|
73
|
-
* @param factor The scale factor
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
73
|
+
* Scales the axis-range by the specified factor from the specified `value` (see
|
|
74
|
+
* {@link scaledRange} for what "incremental" means for a continuous axis range). The equations are written so
|
|
75
|
+
* that the zooming (scaling) occurs at the specified `value`, and expands/contracts
|
|
76
|
+
* equally from that `value`.
|
|
77
|
+
* @param factor The scale factor -- incremental for a {@link ContinuousAxisRange}, but cumulative
|
|
78
|
+
* for an {@link OrdinalAxisRange} (see its {@link OrdinalAxisRange.scale})
|
|
79
|
+
* @param value The value from which to scale the interval
|
|
80
|
+
* @return A new axis range with updated values
|
|
76
81
|
*/
|
|
77
82
|
abstract scale(factor: number, value: number): BaseAxisRange
|
|
78
83
|
|
|
79
84
|
/**
|
|
80
|
-
* Scales the axis-range
|
|
81
|
-
*
|
|
82
|
-
* at the specified
|
|
83
|
-
*
|
|
85
|
+
* Scales the axis-range from the specified `value`, honoring the specified
|
|
86
|
+
* `constraint` min and max. The equations are written so that the zooming (scaling)
|
|
87
|
+
* occurs at the specified `value`, and expands/contracts equally from that
|
|
88
|
+
* `value`.
|
|
89
|
+
*
|
|
90
|
+
* IMPORTANT: the two concrete subclasses give `constraint` opposite meanings, and neither
|
|
91
|
+
* uses the same kind of `factor` -- this base signature is shared for convenience, not
|
|
92
|
+
* because the implementations are interchangeable:
|
|
93
|
+
* - {@link ContinuousAxisRange.constrainedScale} takes an *incremental* factor and *clamps*
|
|
94
|
+
* the result to stay inside `constraint` -- `constraint` is a hard viewport edge the range
|
|
95
|
+
* is not allowed to scroll/zoom past.
|
|
96
|
+
* - {@link OrdinalAxisRange.constrainedScale} takes a *cumulative* factor and *widens* the
|
|
97
|
+
* result to guarantee it fully covers `constraint` -- `constraint` is the domain that must
|
|
98
|
+
* be entirely visible once zoomed all the way out, and widening (rather than clamping) is
|
|
99
|
+
* what fixes the pivot-drift bug documented on `OrdinalAxisRange.scaledCumulative`.
|
|
100
|
+
* Do not port logic between the two without re-reading both subclasses' own doc comments.
|
|
101
|
+
* @param factor The scale factor -- incremental or cumulative, depending on the concrete subclass
|
|
84
102
|
* @param value The value at which the zoom is initiated
|
|
85
103
|
* @param constraint The min and max range
|
|
86
|
-
* @return A new
|
|
104
|
+
* @return A new axis range with updated values
|
|
87
105
|
*/
|
|
88
106
|
abstract constrainedScale(factor: number, value: number, constraint: [min: number, max: number]): BaseAxisRange
|
|
89
107
|
|
|
90
108
|
/**
|
|
91
|
-
* Translates the axis-range by the specified amount
|
|
109
|
+
* Translates the axis-range by the specified amount, unless that would take it outside the
|
|
110
|
+
* constraint interval
|
|
92
111
|
* @param amount The amount by which to translate the axis-range
|
|
93
112
|
* @param [constraints] Optional constraint interval in which the axis range must be within
|
|
94
|
-
* @return An updated
|
|
113
|
+
* @return An updated axis range that has been translated by the specified amount (or an
|
|
114
|
+
* unchanged copy, when the translation would leave the constraint interval)
|
|
95
115
|
*/
|
|
96
116
|
abstract translate(amount: number, constraints?: [start: number, end: number]): BaseAxisRange
|
|
97
117
|
|