stream-charts 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +809 -1022
- package/changes.md +40 -0
- package/dist/app/charts/Chart.d.ts +35 -139
- package/dist/app/charts/Chart.d.ts.map +1 -0
- package/dist/app/charts/Chart.js +74 -65
- package/dist/app/charts/Chart.js.map +1 -1
- package/dist/app/charts/axes/AxesState.d.ts +26 -18
- package/dist/app/charts/axes/AxesState.d.ts.map +1 -0
- package/dist/app/charts/axes/AxesState.js +26 -24
- package/dist/app/charts/axes/AxesState.js.map +1 -1
- package/dist/app/charts/axes/AxisInterval.d.ts +44 -26
- package/dist/app/charts/axes/AxisInterval.d.ts.map +1 -0
- package/dist/app/charts/axes/AxisInterval.js +48 -29
- package/dist/app/charts/axes/AxisInterval.js.map +1 -1
- package/dist/app/charts/axes/BaseAxisRange.d.ts +46 -22
- package/dist/app/charts/axes/BaseAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/BaseAxisRange.js +17 -12
- package/dist/app/charts/axes/BaseAxisRange.js.map +1 -1
- package/dist/app/charts/axes/ContinuousAxis.d.ts +47 -6
- package/dist/app/charts/axes/ContinuousAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/ContinuousAxis.js +160 -27
- package/dist/app/charts/axes/ContinuousAxis.js.map +1 -1
- package/dist/app/charts/axes/ContinuousAxisRange.d.ts +29 -10
- package/dist/app/charts/axes/ContinuousAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/ContinuousAxisRange.js +29 -11
- package/dist/app/charts/axes/ContinuousAxisRange.js.map +1 -1
- package/dist/app/charts/axes/EmptyAxis.d.ts +5 -2
- package/dist/app/charts/axes/EmptyAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/EmptyAxis.js +30 -9
- package/dist/app/charts/axes/EmptyAxis.js.map +1 -1
- package/dist/app/charts/axes/OrdinalAxis.d.ts +5 -3
- package/dist/app/charts/axes/OrdinalAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/OrdinalAxis.js +39 -16
- package/dist/app/charts/axes/OrdinalAxis.js.map +1 -1
- package/dist/app/charts/axes/OrdinalAxisRange.d.ts +76 -13
- package/dist/app/charts/axes/OrdinalAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/OrdinalAxisRange.js +95 -16
- package/dist/app/charts/axes/OrdinalAxisRange.js.map +1 -1
- package/dist/app/charts/axes/autoScale.d.ts +111 -0
- package/dist/app/charts/axes/autoScale.d.ts.map +1 -0
- package/dist/app/charts/axes/autoScale.js +188 -0
- package/dist/app/charts/axes/autoScale.js.map +1 -0
- package/dist/app/charts/axes/axes.d.ts +273 -150
- package/dist/app/charts/axes/axes.d.ts.map +1 -0
- package/dist/app/charts/axes/axes.js +808 -583
- package/dist/app/charts/axes/axes.js.map +1 -1
- package/dist/app/charts/d3types.d.ts +40 -11
- package/dist/app/charts/d3types.d.ts.map +1 -0
- package/dist/app/charts/d3types.js +3 -0
- package/dist/app/charts/d3types.js.map +1 -1
- package/dist/app/charts/datasources/StreamingDataSource.d.ts +149 -0
- package/dist/app/charts/datasources/StreamingDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/StreamingDataSource.js +110 -0
- package/dist/app/charts/datasources/StreamingDataSource.js.map +1 -0
- package/dist/app/charts/datasources/iteratesDataSource.d.ts +73 -0
- package/dist/app/charts/datasources/iteratesDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/iteratesDataSource.js +87 -0
- package/dist/app/charts/datasources/iteratesDataSource.js.map +1 -0
- package/dist/app/charts/datasources/ordinalDataSource.d.ts +75 -0
- package/dist/app/charts/datasources/ordinalDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/ordinalDataSource.js +135 -0
- package/dist/app/charts/datasources/ordinalDataSource.js.map +1 -0
- package/dist/app/charts/datasources/outlierDataSource.d.ts +53 -0
- package/dist/app/charts/datasources/outlierDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/outlierDataSource.js +57 -0
- package/dist/app/charts/datasources/outlierDataSource.js.map +1 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.d.ts +77 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.js +85 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.js.map +1 -0
- package/dist/app/charts/filters/regexFilter.d.ts +31 -4
- package/dist/app/charts/filters/regexFilter.d.ts.map +1 -0
- package/dist/app/charts/filters/regexFilter.js +38 -4
- package/dist/app/charts/filters/regexFilter.js.map +1 -1
- package/dist/app/charts/hooks/AxesProvider.d.ts +21 -0
- package/dist/app/charts/hooks/AxesProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/AxesProvider.js +213 -0
- package/dist/app/charts/hooks/AxesProvider.js.map +1 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts +25 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.js +76 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.js.map +1 -0
- package/dist/app/charts/hooks/ChartProvider.d.ts +40 -0
- package/dist/app/charts/hooks/ChartProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/ChartProvider.js +33 -0
- package/dist/app/charts/hooks/ChartProvider.js.map +1 -0
- package/dist/app/charts/hooks/InteractionProvider.d.ts +23 -0
- package/dist/app/charts/hooks/InteractionProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/InteractionProvider.js +60 -0
- package/dist/app/charts/hooks/InteractionProvider.js.map +1 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts +16 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.js +76 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.js.map +1 -0
- package/dist/app/charts/hooks/defaultAxesValues.d.ts +11 -0
- package/dist/app/charts/hooks/defaultAxesValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultAxesValues.js +36 -0
- package/dist/app/charts/hooks/defaultAxesValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultMouseValues.d.ts +9 -0
- package/dist/app/charts/hooks/defaultMouseValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultMouseValues.js +23 -0
- package/dist/app/charts/hooks/defaultMouseValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.d.ts +13 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.js +23 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.js.map +1 -0
- package/dist/app/charts/hooks/defaultTooltipValues.d.ts +9 -0
- package/dist/app/charts/hooks/defaultTooltipValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultTooltipValues.js +21 -0
- package/dist/app/charts/hooks/defaultTooltipValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultUseChartValues.d.ts +14 -0
- package/dist/app/charts/hooks/defaultUseChartValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultUseChartValues.js +30 -0
- package/dist/app/charts/hooks/defaultUseChartValues.js.map +1 -0
- package/dist/app/charts/hooks/useAxes.d.ts +49 -36
- package/dist/app/charts/hooks/useAxes.d.ts.map +1 -0
- package/dist/app/charts/hooks/useAxes.js +16 -176
- package/dist/app/charts/hooks/useAxes.js.map +1 -1
- package/dist/app/charts/hooks/useCanvasSurface.d.ts +25 -0
- package/dist/app/charts/hooks/useCanvasSurface.d.ts.map +1 -0
- package/dist/app/charts/hooks/useCanvasSurface.js +18 -0
- package/dist/app/charts/hooks/useCanvasSurface.js.map +1 -0
- package/dist/app/charts/hooks/useChart.d.ts +30 -44
- package/dist/app/charts/hooks/useChart.d.ts.map +1 -0
- package/dist/app/charts/hooks/useChart.js +26 -48
- package/dist/app/charts/hooks/useChart.js.map +1 -1
- package/dist/app/charts/hooks/useDataSource.d.ts +68 -0
- package/dist/app/charts/hooks/useDataSource.d.ts.map +1 -0
- package/dist/app/charts/hooks/useDataSource.js +63 -0
- package/dist/app/charts/hooks/useDataSource.js.map +1 -0
- package/dist/app/charts/hooks/useHoveredSeries.d.ts +25 -0
- package/dist/app/charts/hooks/useHoveredSeries.d.ts.map +1 -0
- package/dist/app/charts/hooks/useHoveredSeries.js +15 -0
- package/dist/app/charts/hooks/useHoveredSeries.js.map +1 -0
- package/dist/app/charts/hooks/useMouse.d.ts +46 -22
- package/dist/app/charts/hooks/useMouse.d.ts.map +1 -0
- package/dist/app/charts/hooks/useMouse.js +12 -56
- package/dist/app/charts/hooks/useMouse.js.map +1 -1
- package/dist/app/charts/hooks/usePlotDimensions.d.ts +25 -13
- package/dist/app/charts/hooks/usePlotDimensions.d.ts.map +1 -0
- package/dist/app/charts/hooks/usePlotDimensions.js +6 -62
- package/dist/app/charts/hooks/usePlotDimensions.js.map +1 -1
- package/dist/app/charts/hooks/useTooltip.d.ts +24 -26
- package/dist/app/charts/hooks/useTooltip.d.ts.map +1 -0
- package/dist/app/charts/hooks/useTooltip.js +12 -42
- package/dist/app/charts/hooks/useTooltip.js.map +1 -1
- package/dist/app/charts/index.d.ts +66 -0
- package/dist/app/charts/index.d.ts.map +1 -0
- package/dist/app/charts/index.js +87 -0
- package/dist/app/charts/index.js.map +1 -0
- package/dist/app/charts/legends/Legend.d.ts +33 -12
- package/dist/app/charts/legends/Legend.d.ts.map +1 -0
- package/dist/app/charts/legends/Legend.js +138 -379
- package/dist/app/charts/legends/Legend.js.map +1 -1
- package/dist/app/charts/legends/constants.d.ts +19 -0
- package/dist/app/charts/legends/constants.d.ts.map +1 -0
- package/dist/app/charts/legends/constants.js +34 -0
- package/dist/app/charts/legends/constants.js.map +1 -0
- package/dist/app/charts/observables/ChartData.d.ts +1 -0
- package/dist/app/charts/observables/ChartData.d.ts.map +1 -0
- package/dist/app/charts/observables/iterates.d.ts +13 -7
- package/dist/app/charts/observables/iterates.d.ts.map +1 -0
- package/dist/app/charts/observables/iterates.js +42 -9
- package/dist/app/charts/observables/iterates.js.map +1 -1
- package/dist/app/charts/observables/ordinals.d.ts +70 -12
- package/dist/app/charts/observables/ordinals.d.ts.map +1 -0
- package/dist/app/charts/observables/ordinals.js +127 -48
- package/dist/app/charts/observables/ordinals.js.map +1 -1
- package/dist/app/charts/observables/outliers.d.ts +18 -0
- package/dist/app/charts/observables/outliers.d.ts.map +1 -0
- package/dist/app/charts/observables/outliers.js +2 -0
- package/dist/app/charts/observables/outliers.js.map +1 -0
- package/dist/app/charts/plots/BarPlot.d.ts +87 -13
- package/dist/app/charts/plots/BarPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/BarPlot.js +603 -356
- package/dist/app/charts/plots/BarPlot.js.map +1 -1
- package/dist/app/charts/plots/OutlierPlot.d.ts +123 -0
- package/dist/app/charts/plots/OutlierPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/OutlierPlot.js +430 -0
- package/dist/app/charts/plots/OutlierPlot.js.map +1 -0
- package/dist/app/charts/plots/PoincarePlot.d.ts +92 -14
- package/dist/app/charts/plots/PoincarePlot.d.ts.map +1 -0
- package/dist/app/charts/plots/PoincarePlot.js +523 -364
- package/dist/app/charts/plots/PoincarePlot.js.map +1 -1
- package/dist/app/charts/plots/RasterPlot.d.ts +31 -10
- package/dist/app/charts/plots/RasterPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/RasterPlot.js +198 -306
- package/dist/app/charts/plots/RasterPlot.js.map +1 -1
- package/dist/app/charts/plots/ScatterPlot.d.ts +77 -21
- package/dist/app/charts/plots/ScatterPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/ScatterPlot.js +359 -302
- package/dist/app/charts/plots/ScatterPlot.js.map +1 -1
- package/dist/app/charts/plots/autoScaleYAxes.d.ts +43 -0
- package/dist/app/charts/plots/autoScaleYAxes.d.ts.map +1 -0
- package/dist/app/charts/plots/autoScaleYAxes.js +71 -0
- package/dist/app/charts/plots/autoScaleYAxes.js.map +1 -0
- package/dist/app/charts/plots/colorizedLine.d.ts +61 -0
- package/dist/app/charts/plots/colorizedLine.d.ts.map +1 -0
- package/dist/app/charts/plots/colorizedLine.js +157 -0
- package/dist/app/charts/plots/colorizedLine.js.map +1 -0
- package/dist/app/charts/plots/constants.d.ts +7 -0
- package/dist/app/charts/plots/constants.d.ts.map +1 -0
- package/dist/app/charts/plots/constants.js +11 -0
- package/dist/app/charts/plots/constants.js.map +1 -0
- package/dist/app/charts/plots/hitTesting.d.ts +88 -0
- package/dist/app/charts/plots/hitTesting.d.ts.map +1 -0
- package/dist/app/charts/plots/hitTesting.js +136 -0
- package/dist/app/charts/plots/hitTesting.js.map +1 -0
- package/dist/app/charts/plots/plot.d.ts +52 -16
- package/dist/app/charts/plots/plot.d.ts.map +1 -0
- package/dist/app/charts/plots/plot.js +108 -35
- package/dist/app/charts/plots/plot.js.map +1 -1
- package/dist/app/charts/plots/useCanvasZoomPan.d.ts +119 -0
- package/dist/app/charts/plots/useCanvasZoomPan.d.ts.map +1 -0
- package/dist/app/charts/plots/useCanvasZoomPan.js +113 -0
- package/dist/app/charts/plots/useCanvasZoomPan.js.map +1 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.d.ts +103 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.d.ts.map +1 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.js +257 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.js.map +1 -0
- package/dist/app/charts/series/baseSeries.d.ts +60 -8
- package/dist/app/charts/series/baseSeries.d.ts.map +1 -0
- package/dist/app/charts/series/baseSeries.js +53 -8
- package/dist/app/charts/series/baseSeries.js.map +1 -1
- package/dist/app/charts/series/iterateSeries.d.ts +9 -8
- package/dist/app/charts/series/iterateSeries.d.ts.map +1 -0
- package/dist/app/charts/series/iterateSeries.js +7 -7
- package/dist/app/charts/series/iterateSeries.js.map +1 -1
- package/dist/app/charts/series/ordinalSeries.d.ts +27 -13
- package/dist/app/charts/series/ordinalSeries.d.ts.map +1 -0
- package/dist/app/charts/series/ordinalSeries.js +29 -15
- package/dist/app/charts/series/ordinalSeries.js.map +1 -1
- package/dist/app/charts/series/outlierSeries.d.ts +142 -0
- package/dist/app/charts/series/outlierSeries.d.ts.map +1 -0
- package/dist/app/charts/series/outlierSeries.js +82 -0
- package/dist/app/charts/series/outlierSeries.js.map +1 -0
- package/dist/app/charts/series/timeSeries.d.ts +13 -9
- package/dist/app/charts/series/timeSeries.d.ts.map +1 -0
- package/dist/app/charts/series/timeSeries.js +6 -3
- package/dist/app/charts/series/timeSeries.js.map +1 -1
- package/dist/app/charts/series/timeSeriesChartData.d.ts +18 -10
- package/dist/app/charts/series/timeSeriesChartData.d.ts.map +1 -0
- package/dist/app/charts/series/timeSeriesChartData.js +28 -14
- package/dist/app/charts/series/timeSeriesChartData.js.map +1 -1
- package/dist/app/charts/styling/barPlotStyle.d.ts +46 -2
- package/dist/app/charts/styling/barPlotStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/barPlotStyle.js +37 -3
- package/dist/app/charts/styling/barPlotStyle.js.map +1 -1
- package/dist/app/charts/styling/canvasStyle.d.ts +53 -0
- package/dist/app/charts/styling/canvasStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/canvasStyle.js +71 -0
- package/dist/app/charts/styling/canvasStyle.js.map +1 -0
- package/dist/app/charts/styling/margins.d.ts +21 -2
- package/dist/app/charts/styling/margins.d.ts.map +1 -0
- package/dist/app/charts/styling/margins.js +25 -4
- package/dist/app/charts/styling/margins.js.map +1 -1
- package/dist/app/charts/styling/svgStyle.d.ts +10 -56
- package/dist/app/charts/styling/svgStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/svgStyle.js +3 -78
- package/dist/app/charts/styling/svgStyle.js.map +1 -1
- package/dist/app/charts/subscriptions/viewDrivers.d.ts +124 -0
- package/dist/app/charts/subscriptions/viewDrivers.d.ts.map +1 -0
- package/dist/app/charts/subscriptions/viewDrivers.js +338 -0
- package/dist/app/charts/subscriptions/viewDrivers.js.map +1 -0
- package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts +12 -78
- package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/BarPlotTooltipContent.js +65 -257
- package/dist/app/charts/tooltips/BarPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts +9 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js +16 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts +30 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js +26 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts +22 -72
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js +104 -171
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts +32 -8
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.js +62 -115
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts +39 -12
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js +162 -134
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/Tooltip.d.ts +27 -32
- package/dist/app/charts/tooltips/Tooltip.d.ts.map +1 -0
- package/dist/app/charts/tooltips/Tooltip.js +37 -81
- package/dist/app/charts/tooltips/Tooltip.js.map +1 -1
- package/dist/app/charts/tooltips/TooltipContent.d.ts +81 -0
- package/dist/app/charts/tooltips/TooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/TooltipContent.js +99 -0
- package/dist/app/charts/tooltips/TooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/tooltipUtils.d.ts +186 -36
- package/dist/app/charts/tooltips/tooltipUtils.d.ts.map +1 -0
- package/dist/app/charts/tooltips/tooltipUtils.js +277 -48
- package/dist/app/charts/tooltips/tooltipUtils.js.map +1 -1
- package/dist/app/charts/tooltips/useOutlierTooltip.d.ts +59 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.js +16 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.js.map +1 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.d.ts +51 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.js +52 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.js.map +1 -0
- package/dist/app/charts/tooltips/useTooltipStyle.d.ts +11 -0
- package/dist/app/charts/tooltips/useTooltipStyle.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useTooltipStyle.js +14 -0
- package/dist/app/charts/tooltips/useTooltipStyle.js.map +1 -0
- package/dist/app/charts/trackers/Tracker.d.ts +22 -6
- package/dist/app/charts/trackers/Tracker.d.ts.map +1 -0
- package/dist/app/charts/trackers/Tracker.js +36 -22
- package/dist/app/charts/trackers/Tracker.js.map +1 -1
- package/dist/app/charts/trackers/trackerUtils.d.ts +40 -18
- package/dist/app/charts/trackers/trackerUtils.d.ts.map +1 -0
- package/dist/app/charts/trackers/trackerUtils.js +213 -300
- package/dist/app/charts/trackers/trackerUtils.js.map +1 -1
- package/dist/app/charts/utils.d.ts +72 -33
- package/dist/app/charts/utils.d.ts.map +1 -0
- package/dist/app/charts/utils.js +87 -42
- package/dist/app/charts/utils.js.map +1 -1
- package/dist/index.d.ts +2 -45
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -72
- package/dist/index.js.map +1 -1
- package/package.json +87 -46
- package/src/app/charts/Chart.tsx +132 -168
- package/src/app/charts/axes/AxesState.ts +27 -29
- package/src/app/charts/axes/AxisInterval.ts +57 -32
- package/src/app/charts/axes/BaseAxisRange.ts +47 -27
- package/src/app/charts/axes/ContinuousAxis.tsx +235 -39
- package/src/app/charts/axes/ContinuousAxisRange.ts +29 -11
- package/src/app/charts/axes/EmptyAxis.tsx +52 -17
- package/src/app/charts/axes/OrdinalAxis.tsx +54 -28
- package/src/app/charts/axes/OrdinalAxisRange.ts +96 -16
- package/src/app/charts/axes/autoScale.ts +244 -0
- package/src/app/charts/axes/axes.ts +954 -735
- package/src/app/charts/d3types.ts +42 -13
- package/src/app/charts/datasources/StreamingDataSource.ts +214 -0
- package/src/app/charts/datasources/iteratesDataSource.ts +122 -0
- package/src/app/charts/datasources/ordinalDataSource.ts +205 -0
- package/src/app/charts/datasources/outlierDataSource.ts +90 -0
- package/src/app/charts/datasources/timeSeriesDataSource.ts +133 -0
- package/src/app/charts/filters/regexFilter.ts +45 -5
- package/src/app/charts/hooks/AxesProvider.tsx +301 -0
- package/src/app/charts/hooks/CanvasSurfaceProvider.tsx +117 -0
- package/src/app/charts/hooks/ChartProvider.tsx +79 -0
- package/src/app/charts/hooks/InteractionProvider.tsx +88 -0
- package/src/app/charts/hooks/PlotDimensionsProvider.tsx +109 -0
- package/src/app/charts/hooks/defaultAxesValues.ts +40 -0
- package/src/app/charts/hooks/defaultMouseValues.ts +24 -0
- package/src/app/charts/hooks/defaultPlotDimensions.ts +27 -0
- package/src/app/charts/hooks/defaultTooltipValues.tsx +23 -0
- package/src/app/charts/hooks/defaultUseChartValues.tsx +36 -0
- package/src/app/charts/hooks/useAxes.tsx +60 -228
- package/src/app/charts/hooks/useCanvasSurface.tsx +35 -0
- package/src/app/charts/hooks/useChart.tsx +47 -106
- package/src/app/charts/hooks/useDataSource.tsx +106 -0
- package/src/app/charts/hooks/useHoveredSeries.tsx +33 -0
- package/src/app/charts/hooks/useMouse.tsx +58 -82
- package/src/app/charts/hooks/usePlotDimensions.tsx +25 -89
- package/src/app/charts/hooks/useTooltip.tsx +32 -63
- package/src/app/charts/index.ts +213 -0
- package/src/app/charts/legends/Legend.tsx +198 -479
- package/src/app/charts/legends/constants.ts +37 -0
- package/src/app/charts/observables/iterates.ts +32 -12
- package/src/app/charts/observables/ordinals.ts +141 -67
- package/src/app/charts/observables/outliers.ts +20 -0
- package/src/app/charts/plots/BarPlot.tsx +784 -666
- package/src/app/charts/plots/OutlierPlot.tsx +685 -0
- package/src/app/charts/plots/PoincarePlot.tsx +707 -489
- package/src/app/charts/plots/RasterPlot.tsx +253 -445
- package/src/app/charts/plots/ScatterPlot.tsx +480 -463
- package/src/app/charts/plots/autoScaleYAxes.ts +102 -0
- package/src/app/charts/plots/colorizedLine.ts +185 -0
- package/src/app/charts/plots/constants.ts +16 -0
- package/src/app/charts/plots/hitTesting.ts +198 -0
- package/src/app/charts/plots/plot.ts +138 -44
- package/src/app/charts/plots/useCanvasZoomPan.ts +240 -0
- package/src/app/charts/plots/useStreamingTimeAxes.ts +384 -0
- package/src/app/charts/series/baseSeries.ts +81 -14
- package/src/app/charts/series/iterateSeries.ts +8 -8
- package/src/app/charts/series/ordinalSeries.ts +35 -20
- package/src/app/charts/series/outlierSeries.ts +188 -0
- package/src/app/charts/series/timeSeries.ts +14 -12
- package/src/app/charts/series/timeSeriesChartData.ts +31 -17
- package/src/app/charts/styling/barPlotStyle.ts +48 -5
- package/src/app/charts/styling/canvasStyle.ts +86 -0
- package/src/app/charts/styling/margins.ts +28 -4
- package/src/app/charts/styling/svgStyle.ts +10 -91
- package/src/app/charts/subscriptions/viewDrivers.ts +447 -0
- package/src/app/charts/tooltips/BarPlotTooltipContent.tsx +156 -380
- package/src/app/charts/tooltips/DefaultOutlierTooltipContent.tsx +40 -0
- package/src/app/charts/tooltips/OutlierPlotTooltipContent.tsx +67 -0
- package/src/app/charts/tooltips/PoincarePlotTooltipContent.tsx +229 -292
- package/src/app/charts/tooltips/RasterPlotTooltipContent.tsx +164 -217
- package/src/app/charts/tooltips/ScatterPlotTooltipContent.tsx +373 -236
- package/src/app/charts/tooltips/Tooltip.tsx +58 -124
- package/src/app/charts/tooltips/TooltipContent.tsx +177 -0
- package/src/app/charts/tooltips/tooltipUtils.ts +359 -61
- package/src/app/charts/tooltips/useOutlierTooltip.tsx +68 -0
- package/src/app/charts/tooltips/useTooltipPlacement.ts +86 -0
- package/src/app/charts/tooltips/useTooltipStyle.ts +15 -0
- package/src/app/charts/trackers/Tracker.tsx +68 -33
- package/src/app/charts/trackers/trackerUtils.ts +263 -376
- package/src/app/charts/utils.ts +90 -48
- package/src/index.ts +2 -322
- package/dist/app/charts/axes/AxesState.test.d.ts +0 -1
- package/dist/app/charts/axes/AxesState.test.js +0 -30
- package/dist/app/charts/axes/AxesState.test.js.map +0 -1
- package/dist/app/charts/axes/AxisInterval.test.d.ts +0 -1
- package/dist/app/charts/axes/AxisInterval.test.js +0 -120
- package/dist/app/charts/axes/AxisInterval.test.js.map +0 -1
- package/dist/app/charts/axes/ContinuousAxisRange.test.d.ts +0 -1
- package/dist/app/charts/axes/ContinuousAxisRange.test.js +0 -47
- package/dist/app/charts/axes/ContinuousAxisRange.test.js.map +0 -1
- package/dist/app/charts/axes/OrdinalAxisRange.test.d.ts +0 -1
- package/dist/app/charts/axes/OrdinalAxisRange.test.js +0 -48
- package/dist/app/charts/axes/OrdinalAxisRange.test.js.map +0 -1
- package/dist/app/charts/filters/regexFilter.test.d.ts +0 -1
- package/dist/app/charts/filters/regexFilter.test.js +0 -11
- package/dist/app/charts/filters/regexFilter.test.js.map +0 -1
- package/dist/app/charts/hooks/useDataObservable.d.ts +0 -72
- package/dist/app/charts/hooks/useDataObservable.js +0 -74
- package/dist/app/charts/hooks/useDataObservable.js.map +0 -1
- package/dist/app/charts/hooks/useInitialData.d.ts +0 -36
- package/dist/app/charts/hooks/useInitialData.js +0 -28
- package/dist/app/charts/hooks/useInitialData.js.map +0 -1
- package/dist/app/charts/observables/iterates.test.d.ts +0 -1
- package/dist/app/charts/observables/iterates.test.js +0 -180
- package/dist/app/charts/observables/iterates.test.js.map +0 -1
- package/dist/app/charts/observables/ordinals.test.d.ts +0 -1
- package/dist/app/charts/observables/ordinals.test.js +0 -102
- package/dist/app/charts/observables/ordinals.test.js.map +0 -1
- package/dist/app/charts/series/datumSeries.test.d.ts +0 -1
- package/dist/app/charts/series/datumSeries.test.js +0 -50
- package/dist/app/charts/series/datumSeries.test.js.map +0 -1
- package/dist/app/charts/styling/margins.test.d.ts +0 -1
- package/dist/app/charts/styling/margins.test.js +0 -19
- package/dist/app/charts/styling/margins.test.js.map +0 -1
- package/dist/app/charts/subscriptions/subscription.test.d.ts +0 -1
- package/dist/app/charts/subscriptions/subscription.test.js +0 -395
- package/dist/app/charts/subscriptions/subscription.test.js.map +0 -1
- package/dist/app/charts/subscriptions/subscriptions.d.ts +0 -100
- package/dist/app/charts/subscriptions/subscriptions.js +0 -449
- package/dist/app/charts/subscriptions/subscriptions.js.map +0 -1
- package/src/app/charts/axes/AxesState.test.ts +0 -34
- package/src/app/charts/axes/AxisInterval.test.ts +0 -143
- package/src/app/charts/axes/ContinuousAxisRange.test.ts +0 -55
- package/src/app/charts/axes/OrdinalAxisRange.test.ts +0 -55
- package/src/app/charts/filters/regexFilter.test.ts +0 -13
- package/src/app/charts/hooks/useDataObservable.tsx +0 -170
- package/src/app/charts/hooks/useInitialData.tsx +0 -64
- package/src/app/charts/observables/iterates.test.ts +0 -201
- package/src/app/charts/observables/ordinals.test.ts +0 -135
- package/src/app/charts/series/datumSeries.test.ts +0 -60
- package/src/app/charts/styling/margins.test.ts +0 -22
- package/src/app/charts/subscriptions/subscription.test.ts +0 -499
- package/src/app/charts/subscriptions/subscriptions.ts +0 -635
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { Optional } from "result-fn";
|
|
2
2
|
/**
|
|
3
|
-
* Holds the information to allow mapping axes
|
|
4
|
-
* These objects hold the axis ID, its location on the chart (i.e. left,
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Holds the information to allow mapping axes IDs to the underlying axes objects (of either the
|
|
4
|
+
* x-axes or the y-axes). These objects hold the axis ID, its location on the chart (i.e. left,
|
|
5
|
+
* right, bottom, top), its type, and (for the axis types that extend `BaseAxis`) its scale and the
|
|
6
|
+
* functions for updating and drawing it.
|
|
7
7
|
* @typeParam A The type of the axes (must extend `BaseAxis`)
|
|
8
8
|
*/
|
|
9
9
|
export class AxesState {
|
|
10
|
+
/**
|
|
11
|
+
* Use {@link from} or {@link empty} to create an axes state
|
|
12
|
+
* @param axes Mapping of the axes IDs to the axes
|
|
13
|
+
*/
|
|
10
14
|
constructor(axes) {
|
|
11
15
|
this.axes = axes;
|
|
12
16
|
}
|
|
@@ -32,15 +36,8 @@ export class AxesState {
|
|
|
32
36
|
return this.axes.size === 0;
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
copy() {
|
|
39
|
-
return new AxesState(new Map(Array.from(this.axes.entries())
|
|
40
|
-
.map(([id, axis]) => [id, Object.assign({}, axis)])));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Adds an axis to the current axis state and returns a new axis state. This is an internal state
|
|
39
|
+
* Adds an axis to this axes state's map of axes (in place), and returns a new axes state holding
|
|
40
|
+
* that same map (a new object, so that React sees the change). This is an internal state
|
|
44
41
|
* management function. This should generally not be used. Instead, use the {@link UseAxesValues.addXAxis}
|
|
45
42
|
* and {@link UseAxesValues.addYAxis} functions to add axes.
|
|
46
43
|
* @param axis The axis to add
|
|
@@ -54,22 +51,26 @@ export class AxesState {
|
|
|
54
51
|
return new AxesState(updatedAxes);
|
|
55
52
|
}
|
|
56
53
|
/**
|
|
57
|
-
* Attempts to retrieve the
|
|
58
|
-
* @param axisId The unique ID of the axis
|
|
59
|
-
*
|
|
54
|
+
* Attempts to retrieve the axis for the specified ID.
|
|
55
|
+
* @param axisId The unique ID of the axis, or `""` to request the default axis (the
|
|
56
|
+
* convention used throughout this library wherever a series has no explicit axis
|
|
57
|
+
* assignment -- see e.g. each plot component's own `axesFor` helper).
|
|
58
|
+
* @return The axis matching `axisId`; the default axis (see {@link defaultAxis}) if
|
|
59
|
+
* `axisId` is `""` and at least one axis exists; otherwise an empty `Optional`. A non-empty
|
|
60
|
+
* `axisId` that doesn't match any axis is deliberately treated as "not found" rather than
|
|
61
|
+
* silently substituting an unrelated axis -- that used to happen for *any* unmatched ID,
|
|
62
|
+
* which masked stale/mistyped axis IDs as if they'd resolved correctly.
|
|
60
63
|
*/
|
|
61
64
|
axisFor(axisId) {
|
|
62
65
|
const axis = this.axes.get(axisId);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (axis === undefined && this.axes.size >= 1) {
|
|
66
|
-
return Optional.of(Array.from(this.axes.values())[0]);
|
|
66
|
+
if (axis === undefined && axisId === "" && this.axes.size >= 1) {
|
|
67
|
+
return this.defaultAxis();
|
|
67
68
|
}
|
|
68
69
|
return Optional.ofNullable(axis);
|
|
69
70
|
}
|
|
70
71
|
/**
|
|
71
|
-
* Returns the default axis
|
|
72
|
-
* @return The default axis
|
|
72
|
+
* Returns the default axis: the first axis added
|
|
73
|
+
* @return The default axis, or an empty `Optional` when there are no axes
|
|
73
74
|
* @see axisDefaultId
|
|
74
75
|
*/
|
|
75
76
|
defaultAxis() {
|
|
@@ -79,13 +80,14 @@ export class AxesState {
|
|
|
79
80
|
Optional.empty();
|
|
80
81
|
}
|
|
81
82
|
/**
|
|
82
|
-
* @return An array holding all
|
|
83
|
+
* @return An array holding the IDs of all the axes
|
|
83
84
|
*/
|
|
84
85
|
axisIds() {
|
|
85
86
|
return Array.from(this.axes.keys());
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
88
|
-
* @return The
|
|
89
|
+
* @return The ID of the default axis (the first axis added), or an empty `Optional` when there
|
|
90
|
+
* are no axes
|
|
89
91
|
*/
|
|
90
92
|
axisDefaultId() {
|
|
91
93
|
const ids = Array.from(this.axes.keys());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxesState.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxesState.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IAGlB,YAAoB,IAAoB;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAqB,IAAoB;QAChD,OAAO,IAAI,SAAS,CAAI,IAAI,CAAC,CAAA;IACjC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK;QACR,OAAO,IAAI,SAAS,CAAI,IAAI,GAAG,EAAa,CAAC,CAAA;IACjD,CAAC;IAED;;OAEG;IACH,OAAO;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"AxesState.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxesState.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IAGlB;;;OAGG;IACH,YAAoB,IAAoB;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAqB,IAAoB;QAChD,OAAO,IAAI,SAAS,CAAI,IAAI,CAAC,CAAA;IACjC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KA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AAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACxC,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACnB,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACrB,QAAQ,CAAC,KAAK,EAAE,CAAA;IACxB,CAAC;CACJ"}
|
|
@@ -1,14 +1,31 @@
|
|
|
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 declare class AxisInterval {
|
|
7
8
|
readonly start: number;
|
|
8
9
|
readonly end: number;
|
|
10
|
+
/**
|
|
11
|
+
* Use {@link from}, {@link as}, or {@link empty} to create an axis interval
|
|
12
|
+
* @param start The interval's start
|
|
13
|
+
* @param end The interval's end
|
|
14
|
+
*/
|
|
9
15
|
private constructor();
|
|
10
16
|
/**
|
|
11
|
-
* Creates an axis interval from the specified start and end values
|
|
17
|
+
* Creates an axis interval from the specified start and end values. The values are normalized
|
|
18
|
+
* so that `start <= end` regardless of the order they're passed in -- callers never need to
|
|
19
|
+
* worry about which endpoint ended up larger (e.g. after a pan/zoom delta pushes one endpoint
|
|
20
|
+
* past the other).
|
|
21
|
+
*
|
|
22
|
+
* If exactly one of `start`/`end` is `NaN`, both endpoints of the result collapse to `NaN`
|
|
23
|
+
* (`Math.min`/`Math.max` propagate `NaN` unconditionally) -- the same representation as an
|
|
24
|
+
* intentionally-empty interval (see {@link empty}). That's indistinguishable from genuinely
|
|
25
|
+
* wanting an empty interval, and silently discards which of the two inputs was actually bad,
|
|
26
|
+
* so this logs a warning for that specific mixed case (one real number, one `NaN`) to surface
|
|
27
|
+
* what's almost always an upstream computation error -- `from(NaN, NaN)` (a deliberate empty
|
|
28
|
+
* interval) is not warned about.
|
|
12
29
|
* @param start The axis-range start value
|
|
13
30
|
* @param end The axis-range end value
|
|
14
31
|
* @return The axis-interval
|
|
@@ -34,7 +51,11 @@ export declare class AxisInterval {
|
|
|
34
51
|
*/
|
|
35
52
|
isNotEmpty(): boolean;
|
|
36
53
|
/**
|
|
37
|
-
*
|
|
54
|
+
* Determines whether this axis interval's start and end are the specified ones (two empty
|
|
55
|
+
* intervals are equal)
|
|
56
|
+
* @param start The start to compare to
|
|
57
|
+
* @param end The end to compare to
|
|
58
|
+
* @return `true` if this axis interval's start and end are the specified ones, `false` otherwise
|
|
38
59
|
*/
|
|
39
60
|
equalsInterval(start: number, end: number): boolean;
|
|
40
61
|
/**
|
|
@@ -44,8 +65,8 @@ export declare class AxisInterval {
|
|
|
44
65
|
*/
|
|
45
66
|
equals(other: AxisInterval): boolean;
|
|
46
67
|
/**
|
|
47
|
-
* Creates a copy of
|
|
48
|
-
* @return A copy of
|
|
68
|
+
* Creates a copy of this axis interval
|
|
69
|
+
* @return A copy of this axis interval
|
|
49
70
|
*/
|
|
50
71
|
copy(): AxisInterval;
|
|
51
72
|
/**
|
|
@@ -54,39 +75,36 @@ export declare class AxisInterval {
|
|
|
54
75
|
*/
|
|
55
76
|
asTuple(): [start: number, end: number];
|
|
56
77
|
/**
|
|
57
|
-
* Applies the specified function to
|
|
58
|
-
*
|
|
59
|
-
* @
|
|
78
|
+
* Applies the specified function to this axis interval's start and end, and returns the
|
|
79
|
+
* resulting interval
|
|
80
|
+
* @param fn The function to apply to the axis interval's start and end
|
|
81
|
+
* @return A new axis interval holding the function's result
|
|
60
82
|
*/
|
|
61
83
|
map(fn: (start: number, end: number) => [start: number, end: number]): AxisInterval;
|
|
62
84
|
/**
|
|
63
|
-
* Calculates the measure (end - start) of
|
|
85
|
+
* Calculates the measure (end - start) of this axis interval.
|
|
64
86
|
* The measure of an empty axis interval is 0.
|
|
65
|
-
* @return The measure (end - start) of
|
|
87
|
+
* @return The measure (end - start) of this axis interval
|
|
66
88
|
*/
|
|
67
89
|
measure(): number;
|
|
68
90
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @param delta The amount by which to
|
|
71
|
-
* @return A new axis interval
|
|
91
|
+
* Creates an axis interval whose start is moved by the specified amount (and whose end isn't)
|
|
92
|
+
* @param delta The amount by which to move the start
|
|
93
|
+
* @return A new axis interval (empty when this one is)
|
|
72
94
|
*/
|
|
73
95
|
translateStart(delta: number): AxisInterval;
|
|
74
96
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @param delta The amount by which to
|
|
77
|
-
* @return
|
|
97
|
+
* Creates an axis interval whose end is moved by the specified amount (and whose start isn't)
|
|
98
|
+
* @param delta The amount by which to move the end
|
|
99
|
+
* @return A new axis interval (empty when this one is)
|
|
78
100
|
*/
|
|
79
101
|
translateEnd(delta: number): AxisInterval;
|
|
80
102
|
/**
|
|
81
|
-
*
|
|
103
|
+
* Creates an axis interval that's this one translated (both its start and its end moved) by the
|
|
104
|
+
* specified amount
|
|
82
105
|
* @param delta The amount by which to translate the axis interval
|
|
83
|
-
* @return
|
|
106
|
+
* @return A new axis interval (empty when this one is)
|
|
84
107
|
*/
|
|
85
108
|
translate(delta: number): AxisInterval;
|
|
86
109
|
}
|
|
87
|
-
|
|
88
|
-
* Creates a copy of the specified map(axis_id, (start, end))
|
|
89
|
-
* @param ranges The ranges map to copy
|
|
90
|
-
* @return A copy of the specified map(axis_id, (start, end))
|
|
91
|
-
*/
|
|
92
|
-
export declare function copyRangeMap(ranges: Map<string, AxisInterval>): Map<string, AxisInterval>;
|
|
110
|
+
//# sourceMappingURL=AxisInterval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxisInterval.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxisInterval.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,YAAY;IACrB,QAAQ,CAAC,KAAK,EA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+
* 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 {
|
|
8
|
+
/**
|
|
9
|
+
* Use {@link from}, {@link as}, or {@link empty} to create an axis interval
|
|
10
|
+
* @param start The interval's start
|
|
11
|
+
* @param end The interval's end
|
|
12
|
+
*/
|
|
7
13
|
constructor(start, end) {
|
|
8
14
|
this.start = start;
|
|
9
15
|
this.end = end;
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
|
-
* Creates an axis interval from the specified start and end values
|
|
18
|
+
* Creates an axis interval from the specified start and end values. The values are normalized
|
|
19
|
+
* so that `start <= end` regardless of the order they're passed in -- callers never need to
|
|
20
|
+
* worry about which endpoint ended up larger (e.g. after a pan/zoom delta pushes one endpoint
|
|
21
|
+
* past the other).
|
|
22
|
+
*
|
|
23
|
+
* If exactly one of `start`/`end` is `NaN`, both endpoints of the result collapse to `NaN`
|
|
24
|
+
* (`Math.min`/`Math.max` propagate `NaN` unconditionally) -- the same representation as an
|
|
25
|
+
* intentionally-empty interval (see {@link empty}). That's indistinguishable from genuinely
|
|
26
|
+
* wanting an empty interval, and silently discards which of the two inputs was actually bad,
|
|
27
|
+
* so this logs a warning for that specific mixed case (one real number, one `NaN`) to surface
|
|
28
|
+
* what's almost always an upstream computation error -- `from(NaN, NaN)` (a deliberate empty
|
|
29
|
+
* interval) is not warned about.
|
|
13
30
|
* @param start The axis-range start value
|
|
14
31
|
* @param end The axis-range end value
|
|
15
32
|
* @return The axis-interval
|
|
16
33
|
*/
|
|
17
34
|
static from(start, end) {
|
|
35
|
+
if ((isNaN(start) || isNaN(end)) && !(isNaN(start) && isNaN(end))) {
|
|
36
|
+
console.warn(`AxisInterval.from received exactly one NaN endpoint -- this usually indicates an ` +
|
|
37
|
+
`upstream computation error, not an intentional empty interval (use AxisInterval.empty() ` +
|
|
38
|
+
`for that); start: ${start}, end: ${end}`);
|
|
39
|
+
}
|
|
18
40
|
return new AxisInterval(Math.min(start, end), Math.max(start, end));
|
|
19
41
|
}
|
|
20
42
|
/**
|
|
@@ -45,7 +67,11 @@ export class AxisInterval {
|
|
|
45
67
|
return !this.isEmpty();
|
|
46
68
|
}
|
|
47
69
|
/**
|
|
48
|
-
*
|
|
70
|
+
* Determines whether this axis interval's start and end are the specified ones (two empty
|
|
71
|
+
* intervals are equal)
|
|
72
|
+
* @param start The start to compare to
|
|
73
|
+
* @param end The end to compare to
|
|
74
|
+
* @return `true` if this axis interval's start and end are the specified ones, `false` otherwise
|
|
49
75
|
*/
|
|
50
76
|
equalsInterval(start, end) {
|
|
51
77
|
return (this.start === start && this.end === end) || (this.isEmpty() && isNaN(start) && isNaN(end));
|
|
@@ -59,8 +85,8 @@ export class AxisInterval {
|
|
|
59
85
|
return this.equalsInterval(other.start, other.end);
|
|
60
86
|
}
|
|
61
87
|
/**
|
|
62
|
-
* Creates a copy of
|
|
63
|
-
* @return A copy of
|
|
88
|
+
* Creates a copy of this axis interval
|
|
89
|
+
* @return A copy of this axis interval
|
|
64
90
|
*/
|
|
65
91
|
copy() {
|
|
66
92
|
return AxisInterval.from(this.start, this.end);
|
|
@@ -73,54 +99,47 @@ export class AxisInterval {
|
|
|
73
99
|
return [this.start, this.end];
|
|
74
100
|
}
|
|
75
101
|
/**
|
|
76
|
-
* Applies the specified function to
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
102
|
+
* Applies the specified function to this axis interval's start and end, and returns the
|
|
103
|
+
* resulting interval
|
|
104
|
+
* @param fn The function to apply to the axis interval's start and end
|
|
105
|
+
* @return A new axis interval holding the function's result
|
|
79
106
|
*/
|
|
80
107
|
map(fn) {
|
|
81
108
|
const [start, end] = fn(this.start, this.end);
|
|
82
109
|
return AxisInterval.from(start, end);
|
|
83
110
|
}
|
|
84
111
|
/**
|
|
85
|
-
* Calculates the measure (end - start) of
|
|
112
|
+
* Calculates the measure (end - start) of this axis interval.
|
|
86
113
|
* The measure of an empty axis interval is 0.
|
|
87
|
-
* @return The measure (end - start) of
|
|
114
|
+
* @return The measure (end - start) of this axis interval
|
|
88
115
|
*/
|
|
89
116
|
measure() {
|
|
90
117
|
return this.isNotEmpty() ? this.end - this.start : 0;
|
|
91
118
|
}
|
|
92
119
|
/**
|
|
93
|
-
*
|
|
94
|
-
* @param delta The amount by which to
|
|
95
|
-
* @return A new axis interval
|
|
120
|
+
* Creates an axis interval whose start is moved by the specified amount (and whose end isn't)
|
|
121
|
+
* @param delta The amount by which to move the start
|
|
122
|
+
* @return A new axis interval (empty when this one is)
|
|
96
123
|
*/
|
|
97
124
|
translateStart(delta) {
|
|
98
125
|
return this.isNotEmpty() ? AxisInterval.from(this.start + delta, this.end) : AxisInterval.empty();
|
|
99
126
|
}
|
|
100
127
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @param delta The amount by which to
|
|
103
|
-
* @return
|
|
128
|
+
* Creates an axis interval whose end is moved by the specified amount (and whose start isn't)
|
|
129
|
+
* @param delta The amount by which to move the end
|
|
130
|
+
* @return A new axis interval (empty when this one is)
|
|
104
131
|
*/
|
|
105
132
|
translateEnd(delta) {
|
|
106
133
|
return this.isNotEmpty() ? AxisInterval.from(this.start, this.end + delta) : AxisInterval.empty();
|
|
107
134
|
}
|
|
108
135
|
/**
|
|
109
|
-
*
|
|
136
|
+
* Creates an axis interval that's this one translated (both its start and its end moved) by the
|
|
137
|
+
* specified amount
|
|
110
138
|
* @param delta The amount by which to translate the axis interval
|
|
111
|
-
* @return
|
|
139
|
+
* @return A new axis interval (empty when this one is)
|
|
112
140
|
*/
|
|
113
141
|
translate(delta) {
|
|
114
142
|
return this.isNotEmpty() ? AxisInterval.from(this.start + delta, this.end + delta) : AxisInterval.empty();
|
|
115
143
|
}
|
|
116
144
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Creates a copy of the specified map(axis_id, (start, end))
|
|
119
|
-
* @param ranges The ranges map to copy
|
|
120
|
-
* @return A copy of the specified map(axis_id, (start, end))
|
|
121
|
-
*/
|
|
122
|
-
export function copyRangeMap(ranges) {
|
|
123
|
-
return new Map(Array.from(ranges.entries())
|
|
124
|
-
.map(([id, range]) => [id, range.copy()]));
|
|
125
|
-
}
|
|
126
145
|
//# sourceMappingURL=AxisInterval.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxisInterval.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxisInterval.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AxisInterval.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/AxisInterval.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAIrB;;;;OAIG;IACH,YAAoB,KAAa,EAAE,GAAW;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,CAAC,KAAa,EAAE,GAAW;QAClC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAChE,OAAO,CAAC,IAAI,CACR,mFAAmF;gBACnF,0FAA0F;gBAC1F,qBAAqB,KAAK,UAAU,GAAG,EAAE,CAC5C,CAAA;QACL,CAAC;QACD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAA;IACvE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAmC;QACzC,OAAO,YAAY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,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACxC,CAAC;IAED;;;;OAIG;IACH,OAAO;QACH,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACxD,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,KAAa;QACxB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;IACrG,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;IACrG,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,KAAa;QACnB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,CAAA;IAC7G,CAAC;CACJ"}
|
|
@@ -21,49 +21,72 @@ export declare abstract class BaseAxisRange {
|
|
|
21
21
|
*/
|
|
22
22
|
matchesOriginal(start: number, end: number): boolean;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* The current distance between the start and end of the range
|
|
25
|
+
* @return The current range's measure (0 when it's empty)
|
|
25
26
|
*/
|
|
26
27
|
get currentDistance(): number;
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* The original (e.g. before any zooming or panning) distance between the start and end of the range
|
|
30
|
+
* @return The original range's measure (0 when it's empty)
|
|
29
31
|
*/
|
|
30
32
|
get originalDistance(): number;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
*
|
|
34
|
+
* Scales the range by the specified *incremental* factor -- i.e. relative to `.current`, not
|
|
35
|
+
* relative to `.original`. d3-zoom's own `transform.k` is cumulative from wherever `__zoom` was
|
|
36
|
+
* last reset to identity, so callers must first convert it to an incremental factor (this
|
|
37
|
+
* event's `k` divided by the previously-applied `k`, tracked in a ref that survives across
|
|
38
|
+
* zoom events -- see `useCanvasZoomPan`) before calling this. Scaling relative
|
|
39
|
+
* to `.current` this way means `.original` no longer needs to be preserved/shifted for the
|
|
40
|
+
* zoom math to stay correct -- unlike the previous design, where `factor` was the *cumulative*
|
|
41
|
+
* `transform.k` applied against `.original`, which broke the moment anything (e.g. a fresh
|
|
42
|
+
* subscription on Run) rebuilt `.original` to match a since-zoomed `.current` mid-session.
|
|
43
|
+
* @param factor The incremental scale factor (this event's change in scale, not the cumulative
|
|
44
|
+
* scale since the axis was last at identity)
|
|
38
45
|
* @param value The current value being scaled
|
|
39
46
|
* @return The new range, represented by an array holding the start and end value
|
|
40
47
|
*/
|
|
41
48
|
protected scaledRange(factor: number, value: number): AxisInterval;
|
|
42
49
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* from that
|
|
47
|
-
* @param factor The scale factor
|
|
48
|
-
*
|
|
49
|
-
* @
|
|
50
|
+
* Scales the axis-range by the specified factor from the specified `value` (see
|
|
51
|
+
* {@link scaledRange} for what "incremental" means for a continuous axis range). The equations are written so
|
|
52
|
+
* that the zooming (scaling) occurs at the specified `value`, and expands/contracts
|
|
53
|
+
* equally from that `value`.
|
|
54
|
+
* @param factor The scale factor -- incremental for a {@link ContinuousAxisRange}, but cumulative
|
|
55
|
+
* for an {@link OrdinalAxisRange} (see its {@link OrdinalAxisRange.scale})
|
|
56
|
+
* @param value The value from which to scale the interval
|
|
57
|
+
* @return A new axis range with updated values
|
|
50
58
|
*/
|
|
51
59
|
abstract scale(factor: number, value: number): BaseAxisRange;
|
|
52
60
|
/**
|
|
53
|
-
* Scales the axis-range
|
|
54
|
-
*
|
|
55
|
-
* at the specified
|
|
56
|
-
*
|
|
61
|
+
* Scales the axis-range from the specified `value`, honoring the specified
|
|
62
|
+
* `constraint` min and max. The equations are written so that the zooming (scaling)
|
|
63
|
+
* occurs at the specified `value`, and expands/contracts equally from that
|
|
64
|
+
* `value`.
|
|
65
|
+
*
|
|
66
|
+
* IMPORTANT: the two concrete subclasses give `constraint` opposite meanings, and neither
|
|
67
|
+
* uses the same kind of `factor` -- this base signature is shared for convenience, not
|
|
68
|
+
* because the implementations are interchangeable:
|
|
69
|
+
* - {@link ContinuousAxisRange.constrainedScale} takes an *incremental* factor and *clamps*
|
|
70
|
+
* the result to stay inside `constraint` -- `constraint` is a hard viewport edge the range
|
|
71
|
+
* is not allowed to scroll/zoom past.
|
|
72
|
+
* - {@link OrdinalAxisRange.constrainedScale} takes a *cumulative* factor and *widens* the
|
|
73
|
+
* result to guarantee it fully covers `constraint` -- `constraint` is the domain that must
|
|
74
|
+
* be entirely visible once zoomed all the way out, and widening (rather than clamping) is
|
|
75
|
+
* what fixes the pivot-drift bug documented on `OrdinalAxisRange.scaledCumulative`.
|
|
76
|
+
* Do not port logic between the two without re-reading both subclasses' own doc comments.
|
|
77
|
+
* @param factor The scale factor -- incremental or cumulative, depending on the concrete subclass
|
|
57
78
|
* @param value The value at which the zoom is initiated
|
|
58
79
|
* @param constraint The min and max range
|
|
59
|
-
* @return A new
|
|
80
|
+
* @return A new axis range with updated values
|
|
60
81
|
*/
|
|
61
82
|
abstract constrainedScale(factor: number, value: number, constraint: [min: number, max: number]): BaseAxisRange;
|
|
62
83
|
/**
|
|
63
|
-
* Translates the axis-range by the specified amount
|
|
84
|
+
* Translates the axis-range by the specified amount, unless that would take it outside the
|
|
85
|
+
* constraint interval
|
|
64
86
|
* @param amount The amount by which to translate the axis-range
|
|
65
87
|
* @param [constraints] Optional constraint interval in which the axis range must be within
|
|
66
|
-
* @return An updated
|
|
88
|
+
* @return An updated axis range that has been translated by the specified amount (or an
|
|
89
|
+
* unchanged copy, when the translation would leave the constraint interval)
|
|
67
90
|
*/
|
|
68
91
|
abstract translate(amount: number, constraints?: [start: number, end: number]): BaseAxisRange;
|
|
69
92
|
/**
|
|
@@ -81,3 +104,4 @@ export declare abstract class BaseAxisRange {
|
|
|
81
104
|
*/
|
|
82
105
|
abstract updateOriginal(start: number, end: number): BaseAxisRange;
|
|
83
106
|
}
|
|
107
|
+
//# sourceMappingURL=BaseAxisRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseAxisRange.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/BaseAxisRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,8BAAsB,aAAa;IAC/B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;IAE9B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;IAE/B;;;;;;OAMG;IACH,SAAS,aAAa,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,GAAE,MAAc,EAAE,WAAW,GAAE,MAAY;IAK1G;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;IAIpD;;;OAGG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED;;;OAGG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;IAQlE;;;;;;;;;OASG;IACH,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa;IAE5D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,aAAa;IAE/G;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,aAAa;IAE7F;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa;IAE1D;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa;CACrE"}
|
|
@@ -24,34 +24,39 @@ export class BaseAxisRange {
|
|
|
24
24
|
return this.original.equalsInterval(start, end);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* The current distance between the start and end of the range
|
|
28
|
+
* @return The current range's measure (0 when it's empty)
|
|
28
29
|
*/
|
|
29
30
|
get currentDistance() {
|
|
30
31
|
return this.current.measure();
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
+
* The original (e.g. before any zooming or panning) distance between the start and end of the range
|
|
35
|
+
* @return The original range's measure (0 when it's empty)
|
|
34
36
|
*/
|
|
35
37
|
get originalDistance() {
|
|
36
38
|
return this.original.measure();
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
*
|
|
41
|
+
* Scales the range by the specified *incremental* factor -- i.e. relative to `.current`, not
|
|
42
|
+
* relative to `.original`. d3-zoom's own `transform.k` is cumulative from wherever `__zoom` was
|
|
43
|
+
* last reset to identity, so callers must first convert it to an incremental factor (this
|
|
44
|
+
* event's `k` divided by the previously-applied `k`, tracked in a ref that survives across
|
|
45
|
+
* zoom events -- see `useCanvasZoomPan`) before calling this. Scaling relative
|
|
46
|
+
* to `.current` this way means `.original` no longer needs to be preserved/shifted for the
|
|
47
|
+
* zoom math to stay correct -- unlike the previous design, where `factor` was the *cumulative*
|
|
48
|
+
* `transform.k` applied against `.original`, which broke the moment anything (e.g. a fresh
|
|
49
|
+
* subscription on Run) rebuilt `.original` to match a since-zoomed `.current` mid-session.
|
|
50
|
+
* @param factor The incremental scale factor (this event's change in scale, not the cumulative
|
|
51
|
+
* scale since the axis was last at identity)
|
|
47
52
|
* @param value The current value being scaled
|
|
48
53
|
* @return The new range, represented by an array holding the start and end value
|
|
49
54
|
*/
|
|
50
55
|
scaledRange(factor, value) {
|
|
51
56
|
const dtStart = value - this.current.start;
|
|
52
57
|
const dtEnd = this.current.end - value;
|
|
53
|
-
const start = value - dtStart * factor
|
|
54
|
-
const end = value + dtEnd * factor
|
|
58
|
+
const start = value - dtStart * factor;
|
|
59
|
+
const end = value + dtEnd * factor;
|
|
55
60
|
return AxisInterval.from(start, end);
|
|
56
61
|
}
|
|
57
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAxisRange.js","sourceRoot":"","sources":["../../../../src/app/charts/axes/BaseAxisRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAgB,aAAa;IAK/B;;;;;;OAMG;IACH,YAAsB,KAAa,EAAE,GAAW,EAAE,gBAAwB,KAAK,EAAE,cAAsB,GAAG;QACtG,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,EA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AC,OAAO,CAAC,GAAG,GAAG,KAAK,CAAA;QACtC,MAAM,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;QACtC,MAAM,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;QAClC,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACxC,CAAC;CA+DJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AxesFont, AxisLocation } from "./axes";
|
|
2
|
-
import { ScaleContinuousNumeric } from "d3";
|
|
1
|
+
import { type AxesFont, AxisLocation } from "./axes";
|
|
2
|
+
import type { ScaleContinuousNumeric } from "d3";
|
|
3
3
|
export interface Props {
|
|
4
4
|
axisId: string;
|
|
5
5
|
location: AxisLocation;
|
|
@@ -8,13 +8,54 @@ export interface Props {
|
|
|
8
8
|
font?: Partial<AxesFont>;
|
|
9
9
|
label: string;
|
|
10
10
|
updateAxisBasedOnDomainValues?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* When `true`, the axis' domain grows to fit the data plotted against it: when the data on
|
|
13
|
+
* screen goes above (or below) the domain, the domain grows to include it (plus the
|
|
14
|
+
* `autoScalePadding`), but never past `autoScaleMax` (or `autoScaleMin`). The axis starts out
|
|
15
|
+
* at the `domain` prop, clamped to those limits. The domain only ever grows -- it's restored
|
|
16
|
+
* to its start when the plot's data is replaced (e.g. on a reset), or when the `domain` prop
|
|
17
|
+
* or the limits change. When `false` (the default), the domain is exactly the `domain` prop.
|
|
18
|
+
*
|
|
19
|
+
* For y-axes only (an x-axis' domain follows time, and its zooming and panning), in the plots
|
|
20
|
+
* that support it (the scatter, bar, and outlier plots). Elsewhere, it's ignored, with a warning.
|
|
21
|
+
*/
|
|
22
|
+
autoScale?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The smallest value an auto-scaling axis' domain may reach. Defaults to `-Infinity` (no
|
|
25
|
+
* limit).
|
|
26
|
+
*/
|
|
27
|
+
autoScaleMin?: number;
|
|
28
|
+
/**
|
|
29
|
+
* The largest value an auto-scaling axis' domain may reach. Defaults to `Infinity` (no limit).
|
|
30
|
+
*/
|
|
31
|
+
autoScaleMax?: number;
|
|
32
|
+
/**
|
|
33
|
+
* The fraction of the axis' length left beyond the data's extreme when the axis grows, so the
|
|
34
|
+
* extreme point isn't drawn right on the edge (in the scale's own space, e.g. logarithmically
|
|
35
|
+
* for a log scale). From 0 to 0.45 (a larger value is treated as 0.45); defaults to 0.05.
|
|
36
|
+
*/
|
|
37
|
+
autoScalePadding?: number;
|
|
38
|
+
/**
|
|
39
|
+
* The auto-scaled domain to start from when auto-scaling starts (e.g. when the axis is
|
|
40
|
+
* created), instead of the `domain` prop -- for keeping the axis' growth across remounts (e.g.
|
|
41
|
+
* navigating away from the chart and back), along with `onAutoScale`. Clamped to the limits.
|
|
42
|
+
*/
|
|
43
|
+
autoScaledDomain?: [min: number, max: number];
|
|
44
|
+
/**
|
|
45
|
+
* Called with the axis' new domain whenever an auto-scaling axis grows, or is restored to its
|
|
46
|
+
* start (e.g. on a reset), so that it can be kept (see `autoScaledDomain`)
|
|
47
|
+
* @param domain The axis' new domain
|
|
48
|
+
*/
|
|
49
|
+
onAutoScale?: (domain: [min: number, max: number]) => void;
|
|
11
50
|
}
|
|
12
51
|
/**
|
|
13
|
-
* Represents a continuous numeric axis (x or y) that can be
|
|
52
|
+
* Represents a continuous numeric axis (x or y) that can be placed on the top, bottom,
|
|
14
53
|
* left, or right of the chart. The domain (axis range) can be managed by this axis
|
|
15
|
-
*
|
|
16
|
-
* React won't render it because we are
|
|
17
|
-
* involved, except to call this function if the props change.
|
|
54
|
+
* component or managed externally (i.e. deferred). This component returns null, meaning
|
|
55
|
+
* React won't render it because we are drawing directly onto the chart's shared canvas and
|
|
56
|
+
* don't want React involved, except to call this function if the props change.
|
|
18
57
|
* @param props The properties for the axis
|
|
58
|
+
* @return `null` (the axis draws onto the chart's canvas)
|
|
19
59
|
*/
|
|
20
60
|
export declare function ContinuousAxis(props: Props): null;
|
|
61
|
+
//# sourceMappingURL=ContinuousAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContinuousAxis.d.ts","sourceRoot":"","sources":["../../../../src/app/charts/axes/ContinuousAxis.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,QAAQ,EACb,YAAY,EAQf,MAAM,QAAQ,CAAC;AAIhB,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,IAAI,CAAC;AAQ/C,MAAM,WAAW,KAAK;IAElB,MAAM,EAAE,MAAM,CAAA;IAGd,QAAQ,EAAE,YAAY,CAAA;IAEtB,KAAK,CAAC,EAAE,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE9C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IAElC,IAAI,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IAExB,KAAK,EAAE,MAAM,CAAA;IAiBb,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IAC7C;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,IAAI,CAAA;CAC7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CA2RjD"}
|