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,223 +1,131 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import type {CSSProperties, ReactElement} from "react";
|
|
2
|
+
import {type Sparkline, sparklineFor, type TooltipStyle} from "./tooltipUtils";
|
|
3
|
+
import {TooltipContent} from "./TooltipContent";
|
|
4
4
|
import {formatNumber, formatTime, formatValue} from "../utils";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {usePlotDimensions} from "../hooks/usePlotDimensions";
|
|
9
|
-
import {emptyOrdinalDatum, OrdinalDatum} from "../series/ordinalSeries";
|
|
10
|
-
import {TooltipData} from "../hooks/useTooltip";
|
|
11
|
-
import {WindowedOrdinalStats} from "../subscriptions/subscriptions";
|
|
12
|
-
import {DataFrame} from "data-frame-ts";
|
|
13
|
-
import {createTable, Padding, TableData, TableFont, TableFormatter, TableStyler} from "svg-table";
|
|
5
|
+
import {emptyOrdinalDatum, type OrdinalDatum} from "../series/ordinalSeries";
|
|
6
|
+
import type {TooltipData} from "../hooks/useTooltip";
|
|
7
|
+
import type {WindowedOrdinalStats} from "../datasources/ordinalDataSource";
|
|
14
8
|
import {defaultOrdinalValueStats} from "../observables/ordinals";
|
|
15
|
-
import {
|
|
16
|
-
import {BAR_CHART_TOOLTIP_PROVIDER_IDS} from "../plots/BarPlot";
|
|
17
|
-
import {ContinuousAxisRange} from "../axes/ContinuousAxisRange";
|
|
9
|
+
import {BAR_CHART_TOOLTIP_PROVIDER_IDS} from "../plots/constants";
|
|
18
10
|
|
|
19
11
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
3. When your tooltip content component (`<MyTooltipContent/>`) mounts, use the {@link registerTooltipContentProvider}
|
|
29
|
-
function to register your tooltip content provider.
|
|
30
|
-
4. When the chart dimensions, margin, container, etc, change, register your tooltip content provider
|
|
31
|
-
again (you can register as many times as you like because it only uses the last content provider
|
|
32
|
-
registered).
|
|
33
|
-
|
|
34
|
-
That's it! A bit more details below.
|
|
35
|
-
|
|
36
|
-
The {@link registerTooltipContentProvider} function from the {@link useChart} hook allows you to register
|
|
37
|
-
one tooltip content provider. A second call to this function will cause the {@link useChart} hook to drop
|
|
38
|
-
the first one in favor of the second one.
|
|
39
|
-
|
|
40
|
-
The {@link registerTooltipContentProvider} function from the {@link useChart} hook accepts a higher-order
|
|
41
|
-
function that allowing a closure on content/chart-specific data. Specifically, you must hand the
|
|
42
|
-
{@link registerTooltipContentProvider} a function of the form:
|
|
43
|
-
|
|
44
|
-
`(seriesName: string, time: number, series: TimeSeries, mouseCoords: [x: number, y: number]) => TooltipDimensions`
|
|
45
|
-
|
|
46
|
-
Your function to add that actual content will be what this function calls whenever d3 fires a mouse-over
|
|
47
|
-
event on one you the time-series in the chart.
|
|
48
|
-
|
|
49
|
-
The code snippet below is from the `useEffect` call in the {@link ScatterPlotTooltipContent}.
|
|
50
|
-
Note that the first four arguments to the {@link addTooltipContent} function are those provided by the {@link useChart} hook
|
|
51
|
-
when a d3 mouse-over event occurs on one of your series. The additional six arguments are from the closure formed
|
|
52
|
-
on the variables in your component. The `chartId`, `container`, `margin`, and `plotDimensions` are from the
|
|
53
|
-
{@link useChart} hook called by the {@link ScatterPlotTooltipContent} component. The last two
|
|
54
|
-
arguments, `defaultTooltipStyle` and `options` are specific to the {@link ScatterPlotTooltipContent}.
|
|
55
|
-
For example, the `options` property is set by the caller of the {@link ScatterPlotTooltipContent}
|
|
56
|
-
component.
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
// register the tooltip content provider function with the chart hook (useChart) so that
|
|
60
|
-
// it is visible to all children of the Chart (i.e. the <Tooltip>).
|
|
61
|
-
registerTooltipContentProvider(
|
|
62
|
-
(seriesName: string,
|
|
63
|
-
time: number,
|
|
64
|
-
tooltipData: TooltipData<OrdinalDatum, WindowedOrdinalStats>,
|
|
65
|
-
mouseCoords: [x: number, y: number]
|
|
66
|
-
) => {
|
|
67
|
-
return addTooltipContent(
|
|
68
|
-
seriesName, tooltipData, mouseCoords,
|
|
69
|
-
chartId, container, margin, plotDimensions, tooltipStyle,
|
|
70
|
-
ordinalUnits
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
)
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
This pattern allows you to supplement that `useChart` mouse-over callback with information specific to your component.
|
|
12
|
+
* Properties for rendering the tooltip content
|
|
13
|
+
*/
|
|
14
|
+
export interface Props {
|
|
15
|
+
/** the units of the values (e.g. "mV"), shown after the values (none by default) */
|
|
16
|
+
ordinalUnits?: string
|
|
17
|
+
/** the style of the tooltip */
|
|
18
|
+
style?: Partial<TooltipStyle>
|
|
19
|
+
}
|
|
77
20
|
|
|
21
|
+
/**
|
|
22
|
+
* A single stats row's windowed/all values, already formatted for display.
|
|
78
23
|
*/
|
|
24
|
+
interface StatsRow {
|
|
25
|
+
label: string
|
|
26
|
+
windowed: string
|
|
27
|
+
all: string
|
|
28
|
+
/** whether the windowed or all-time cell (or neither) should be highlighted, based on which specific bar-chart element is hovered */
|
|
29
|
+
highlight: 'windowed' | 'all' | 'none'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// the size of the tooltip's sparkline (of the value over time)
|
|
33
|
+
const SPARKLINE_WIDTH = 180
|
|
34
|
+
const SPARKLINE_HEIGHT = 36
|
|
79
35
|
|
|
80
36
|
/**
|
|
81
|
-
*
|
|
82
|
-
* shown below.
|
|
83
|
-
* ```
|
|
84
|
-
* series name
|
|
85
|
-
* xFormatter, yFormatter
|
|
86
|
-
* ```
|
|
37
|
+
* The data needed to render the tooltip's content, captured when the mouse moves over an element
|
|
87
38
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
39
|
+
interface BarTooltipContent {
|
|
40
|
+
seriesName: string
|
|
41
|
+
headerLabel: string
|
|
42
|
+
valueLine: string
|
|
43
|
+
// the value over time (the data the chart holds), when there's enough of it to draw
|
|
44
|
+
sparkline: Sparkline | undefined
|
|
45
|
+
rows: Array<StatsRow>
|
|
91
46
|
}
|
|
92
47
|
|
|
93
48
|
/**
|
|
94
|
-
* Adds tooltip content that shows the series name
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* time, value
|
|
98
|
-
* ```
|
|
49
|
+
* Adds tooltip content that shows the series name, the current value, a small stats table
|
|
50
|
+
* (count/min/max/mean, windowed vs. all-time) for the bar-chart element being hovered, and a
|
|
51
|
+
* sparkline of the value over the data the chart holds.
|
|
99
52
|
*
|
|
100
|
-
*
|
|
101
|
-
* event on a series. The content provider is returns the {@link addTooltipContent} function
|
|
102
|
-
* when called. And when called the {@link addTooltipContent} function adds the actual tooltip
|
|
103
|
-
* content to the SVG element.
|
|
53
|
+
* Built on {@link TooltipContent}; put it inside a {@link Tooltip}.
|
|
104
54
|
* @param props The properties describing the tooltip content
|
|
105
|
-
* @return null
|
|
55
|
+
* @return The tooltip's portal, or `null` when nothing is being hovered
|
|
106
56
|
*/
|
|
107
|
-
export function BarPlotTooltipContent(props: Props): null {
|
|
108
|
-
const {
|
|
109
|
-
chartId,
|
|
110
|
-
container,
|
|
111
|
-
tooltip,
|
|
112
|
-
axes
|
|
113
|
-
} = useChart<OrdinalDatum, SeriesLineStyle, WindowedOrdinalStats, ContinuousAxisRange, ContinuousNumericAxis>()
|
|
114
|
-
|
|
115
|
-
const {registerTooltipContentProvider} = tooltip
|
|
116
|
-
const {yAxesState, axisAssignmentsFor} = axes
|
|
117
|
-
const {margin, plotDimensions} = usePlotDimensions()
|
|
57
|
+
export function BarPlotTooltipContent(props: Props): ReactElement | null {
|
|
118
58
|
const {style, ordinalUnits = ""} = props
|
|
119
|
-
const tooltipStyle = useMemo(() => ({...defaultTooltipStyle, ...style}), [style])
|
|
120
59
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
// actual content
|
|
130
|
-
useEffect(
|
|
131
|
-
() => {
|
|
132
|
-
if (container) {
|
|
133
|
-
// register the tooltip content provider function with the chart hook (useChart) so that
|
|
134
|
-
// it is visible to all children of the Chart (i.e. the <Tooltip>).
|
|
135
|
-
registerTooltipContentProvider(
|
|
136
|
-
/**
|
|
137
|
-
*
|
|
138
|
-
* @param seriesName The name of the series
|
|
139
|
-
* @param time The mouse time
|
|
140
|
-
* @param tooltipData The series data and metadata
|
|
141
|
-
* @param mouseCoords The coordinates of the mouse
|
|
142
|
-
* @param providerId The ID of the tooltip content provider
|
|
143
|
-
* @return The tooltip contents
|
|
144
|
-
*/
|
|
145
|
-
(seriesName: string,
|
|
146
|
-
time: number,
|
|
147
|
-
tooltipData: TooltipData<OrdinalDatum, WindowedOrdinalStats>,
|
|
148
|
-
mouseCoords: [x: number, y: number],
|
|
149
|
-
providerId?: string
|
|
150
|
-
) => {
|
|
151
|
-
if (providerId !== undefined) {
|
|
152
|
-
return addTooltipContent(
|
|
153
|
-
seriesName, providerId, tooltipData, mouseCoords,
|
|
154
|
-
chartId, container, margin, plotDimensions, tooltipStyle,
|
|
155
|
-
ordinalUnits
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
return {x: 0, y: 0, contentWidth: 0, contentHeight: 0}
|
|
159
|
-
//
|
|
160
|
-
// switch (providerId) {
|
|
161
|
-
// case BAR_CHART_TOOLTIP_PROVIDER_IDS.currentValue:
|
|
162
|
-
// return addTooltipContent(
|
|
163
|
-
// seriesName, 'current value', tooltipData, mouseCoords,
|
|
164
|
-
// chartId, container, margin, plotDimensions, tooltipStyle,
|
|
165
|
-
// ordinalUnits
|
|
166
|
-
// )
|
|
167
|
-
// case BAR_CHART_TOOLTIP_PROVIDER_IDS.meanValue:
|
|
168
|
-
// return addTooltipContent(
|
|
169
|
-
// seriesName, 'mean value', tooltipData, mouseCoords,
|
|
170
|
-
// chartId, container, margin, plotDimensions, tooltipStyle,
|
|
171
|
-
// ordinalUnits
|
|
172
|
-
// )
|
|
173
|
-
// case BAR_CHART_TOOLTIP_PROVIDER_IDS.minMax:
|
|
174
|
-
// return addTooltipContent(
|
|
175
|
-
// seriesName, 'min/max', tooltipData, mouseCoords,
|
|
176
|
-
// chartId, container, margin, plotDimensions, tooltipStyle,
|
|
177
|
-
// ordinalUnits
|
|
178
|
-
// )
|
|
179
|
-
// case BAR_CHART_TOOLTIP_PROVIDER_IDS.windowedMeanValue:
|
|
180
|
-
// return addTooltipContent(
|
|
181
|
-
// seriesName, 'windowed mean', tooltipData, mouseCoords,
|
|
182
|
-
// chartId, container, margin, plotDimensions, tooltipStyle,
|
|
183
|
-
// ordinalUnits
|
|
184
|
-
// )
|
|
185
|
-
// case BAR_CHART_TOOLTIP_PROVIDER_IDS.windowedMinMax:
|
|
186
|
-
// return addTooltipContent(
|
|
187
|
-
// seriesName, 'windowed min/max', tooltipData, mouseCoords,
|
|
188
|
-
// chartId, container, margin, plotDimensions, tooltipStyle,
|
|
189
|
-
// ordinalUnits
|
|
190
|
-
// )
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
// default:
|
|
194
|
-
// return {x: 0, y: 0, contentWidth: 0, contentHeight: 0}
|
|
195
|
-
// }
|
|
196
|
-
}
|
|
197
|
-
)
|
|
60
|
+
return (
|
|
61
|
+
<TooltipContent<OrdinalDatum, WindowedOrdinalStats, BarTooltipContent>
|
|
62
|
+
style={style}
|
|
63
|
+
capture={(seriesName, _value, tooltipData, providerId) =>
|
|
64
|
+
// (the provider ID says which of the bar's elements is hovered)
|
|
65
|
+
providerId === undefined ?
|
|
66
|
+
undefined :
|
|
67
|
+
captureTooltipContent(seriesName, providerId, tooltipData, ordinalUnits)
|
|
198
68
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
69
|
+
>
|
|
70
|
+
{(tooltipContent, tooltipStyle) => {
|
|
71
|
+
const cellStyle: CSSProperties = {padding: '1px 10px', textAlign: 'right', border: 'none'}
|
|
72
|
+
const rowLabelStyle: CSSProperties = {...cellStyle, textAlign: 'left', paddingLeft: 0}
|
|
73
|
+
const headerCellStyle: CSSProperties = {...cellStyle, fontWeight: tooltipStyle.fontWeight + 550}
|
|
74
|
+
const highlightStyle: CSSProperties = {fontWeight: tooltipStyle.fontWeight + 300}
|
|
75
|
+
|
|
76
|
+
return <>
|
|
77
|
+
<div style={{fontSize: tooltipStyle.fontSize, fontWeight: tooltipStyle.fontWeight}}>
|
|
78
|
+
{tooltipContent.seriesName} ({tooltipContent.headerLabel})
|
|
79
|
+
</div>
|
|
80
|
+
<div style={{fontSize: tooltipStyle.fontSize + 2, fontWeight: tooltipStyle.fontWeight + 150, marginBottom: 6}}>
|
|
81
|
+
{tooltipContent.valueLine}
|
|
82
|
+
</div>
|
|
83
|
+
<table style={{fontSize: tooltipStyle.fontSize, borderCollapse: 'collapse', border: 'none'}}>
|
|
84
|
+
<thead>
|
|
85
|
+
<tr>
|
|
86
|
+
<td style={rowLabelStyle}/>
|
|
87
|
+
<td style={headerCellStyle}>Windowed</td>
|
|
88
|
+
<td style={headerCellStyle}>All</td>
|
|
89
|
+
</tr>
|
|
90
|
+
</thead>
|
|
91
|
+
<tbody>
|
|
92
|
+
{tooltipContent.rows.map(row => (
|
|
93
|
+
<tr key={row.label}>
|
|
94
|
+
<td style={rowLabelStyle}>{row.label}</td>
|
|
95
|
+
<td style={row.highlight === 'windowed' ? {...cellStyle, ...highlightStyle} : cellStyle}>{row.windowed}</td>
|
|
96
|
+
<td style={row.highlight === 'all' ? {...cellStyle, ...highlightStyle} : cellStyle}>{row.all}</td>
|
|
97
|
+
</tr>
|
|
98
|
+
))}
|
|
99
|
+
</tbody>
|
|
100
|
+
</table>
|
|
101
|
+
{/* the value over time, ending in the current value (the dot) */}
|
|
102
|
+
{tooltipContent.sparkline !== undefined &&
|
|
103
|
+
<svg
|
|
104
|
+
width={SPARKLINE_WIDTH}
|
|
105
|
+
height={SPARKLINE_HEIGHT}
|
|
106
|
+
style={{display: 'block', marginTop: 8}}
|
|
107
|
+
aria-hidden="true"
|
|
108
|
+
>
|
|
109
|
+
<path
|
|
110
|
+
d={tooltipContent.sparkline.path}
|
|
111
|
+
fill="none"
|
|
112
|
+
stroke={tooltipStyle.fontColor}
|
|
113
|
+
strokeWidth={1.25}
|
|
114
|
+
strokeLinejoin="round"
|
|
115
|
+
strokeLinecap="round"
|
|
116
|
+
/>
|
|
117
|
+
<circle
|
|
118
|
+
cx={tooltipContent.sparkline.end[0]}
|
|
119
|
+
cy={tooltipContent.sparkline.end[1]}
|
|
120
|
+
r={2.5}
|
|
121
|
+
fill={tooltipStyle.fontColor}
|
|
122
|
+
/>
|
|
123
|
+
</svg>
|
|
124
|
+
}
|
|
125
|
+
</>
|
|
126
|
+
}}
|
|
127
|
+
</TooltipContent>
|
|
206
128
|
)
|
|
207
|
-
|
|
208
|
-
return null
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const dimension: Dimension = {
|
|
212
|
-
width: 60,
|
|
213
|
-
defaultWidth: 70,
|
|
214
|
-
minWidth: 50,
|
|
215
|
-
maxWidth: 100,
|
|
216
|
-
|
|
217
|
-
height: 15,
|
|
218
|
-
defaultHeight: 15,
|
|
219
|
-
minHeight: 10,
|
|
220
|
-
maxHeight: 50
|
|
221
129
|
}
|
|
222
130
|
|
|
223
131
|
/**
|
|
@@ -244,196 +152,64 @@ function labelForProviderId(providerId: string): string {
|
|
|
244
152
|
}
|
|
245
153
|
|
|
246
154
|
/**
|
|
247
|
-
*
|
|
155
|
+
* Determines which stats-table cell (if any) should be highlighted for the given provider ID,
|
|
156
|
+
* matching the original's `coordinatesForProviderId` (row 2/3/4 = Min/Max/Mean; column
|
|
157
|
+
* 1/2 = Windowed/All).
|
|
158
|
+
* @param providerId The tooltip provider ID for which the highlighted element (bar chart series
|
|
159
|
+
* element) that is hovered
|
|
160
|
+
* @return A function that, given a stats-row label, returns which column (if any) to highlight
|
|
161
|
+
*/
|
|
162
|
+
function highlightFor(providerId: string): (rowLabel: 'Count' | 'Min' | 'Max' | 'Mean') => 'windowed' | 'all' | 'none' {
|
|
163
|
+
switch (providerId) {
|
|
164
|
+
case BAR_CHART_TOOLTIP_PROVIDER_IDS.meanValue:
|
|
165
|
+
return label => label === 'Mean' ? 'all' : 'none'
|
|
166
|
+
case BAR_CHART_TOOLTIP_PROVIDER_IDS.minMax:
|
|
167
|
+
return label => (label === 'Min' || label === 'Max') ? 'all' : 'none'
|
|
168
|
+
case BAR_CHART_TOOLTIP_PROVIDER_IDS.windowedMeanValue:
|
|
169
|
+
return label => label === 'Mean' ? 'windowed' : 'none'
|
|
170
|
+
case BAR_CHART_TOOLTIP_PROVIDER_IDS.windowedMinMax:
|
|
171
|
+
return label => (label === 'Min' || label === 'Max') ? 'windowed' : 'none'
|
|
172
|
+
default:
|
|
173
|
+
return () => 'none'
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Captures the data needed to render the tooltip's content (its header, value, stats table, and
|
|
179
|
+
* sparkline)
|
|
248
180
|
* @param seriesName The name of the series (i.e. the neuron ID)
|
|
249
|
-
* @param providerId The tooltip content provider ID (i.e.
|
|
181
|
+
* @param providerId The tooltip content provider ID (i.e. which bar-chart element is hovered)
|
|
250
182
|
* @param tooltipData The series data and metadata
|
|
251
|
-
* @param mouseCoords The coordinates of the mouse when the event was fired (relative to the plot container)
|
|
252
|
-
* @param chartId The ID of this chart
|
|
253
|
-
* @param container The plot container (SVGSVGElement)
|
|
254
|
-
* @param margin The plot margins
|
|
255
|
-
* @param tooltipStyle The style properties for the tooltip
|
|
256
|
-
* @param plotDimensions The dimensions of the plot
|
|
257
183
|
* @param ordinalUnits The units of the ordinal data (i.e. "mV")
|
|
258
|
-
* @return The
|
|
184
|
+
* @return The tooltip's content
|
|
259
185
|
*/
|
|
260
|
-
function
|
|
186
|
+
function captureTooltipContent(
|
|
261
187
|
seriesName: string,
|
|
262
188
|
providerId: string,
|
|
263
189
|
tooltipData: TooltipData<OrdinalDatum, WindowedOrdinalStats>,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
container: SVGSVGElement,
|
|
267
|
-
margin: Margin,
|
|
268
|
-
plotDimensions: Dimensions,
|
|
269
|
-
tooltipStyle: TooltipStyle,
|
|
270
|
-
ordinalUnits: string
|
|
271
|
-
): TooltipDimensions {
|
|
272
|
-
const [x, y] = mouseCoords
|
|
190
|
+
ordinalUnits: string,
|
|
191
|
+
): BarTooltipContent {
|
|
273
192
|
const {series, metadata: statistics} = tooltipData
|
|
193
|
+
|
|
274
194
|
const currentDatum = series.length > 0 ? series[series.length - 1] : emptyOrdinalDatum
|
|
275
195
|
const valueStats = statistics.valueStatsForSeries.get(seriesName) || defaultOrdinalValueStats()
|
|
276
196
|
const windowedValueStats = statistics.windowedValueStatsForSeries.get(seriesName) || defaultOrdinalValueStats()
|
|
277
197
|
const displayOrdinalUnits = ordinalUnits.length > 0 ? ` ${ordinalUnits}` : ""
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
.
|
|
284
|
-
.
|
|
285
|
-
.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
.attr('id', `t${currentDatum.time}-${seriesName}-${chartId}`)
|
|
295
|
-
.attr('class', 'tooltip')
|
|
296
|
-
.attr('fill', tooltipStyle.fontColor)
|
|
297
|
-
.attr('font-family', 'sans-serif')
|
|
298
|
-
.attr('font-size', tooltipStyle.fontSize + 2)
|
|
299
|
-
.attr('font-weight', tooltipStyle.fontWeight + 150)
|
|
300
|
-
.text(() => `${formatValue(currentDatum.value)}${displayOrdinalUnits} (${formatTime(currentDatum.time)} ms)`)
|
|
301
|
-
|
|
302
|
-
// calculate the max width and height of the text (we'll adjust the coordinates of the header
|
|
303
|
-
// text once we have the table dimensions)
|
|
304
|
-
const headerTextHeight = header.node()?.getBBox()?.height || 0;
|
|
305
|
-
const idHeight = text.node()?.getBBox()?.height || 0;
|
|
306
|
-
const textHeight = headerTextHeight + idHeight;
|
|
307
|
-
|
|
308
|
-
const font: TableFont = {
|
|
309
|
-
size: tooltipStyle.fontSize,
|
|
310
|
-
family: tooltipStyle.fontFamily,
|
|
311
|
-
color: tooltipStyle.fontColor,
|
|
312
|
-
weight: tooltipStyle.fontWeight
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const padding: Padding = {
|
|
316
|
-
top: tooltipStyle.paddingTop,
|
|
317
|
-
bottom: tooltipStyle.paddingBottom,
|
|
318
|
-
right: tooltipStyle.paddingRight,
|
|
319
|
-
left: tooltipStyle.paddingLeft
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const units = ordinalUnits.length > 0 ? ` (${ordinalUnits})` : ""
|
|
323
|
-
return DataFrame
|
|
324
|
-
.from<number | string>([
|
|
325
|
-
[windowedValueStats.count, valueStats.count],
|
|
326
|
-
[windowedValueStats.min.value, valueStats.min.value],
|
|
327
|
-
[windowedValueStats.max.value, valueStats.max.value],
|
|
328
|
-
[windowedValueStats.mean, valueStats.mean],
|
|
329
|
-
])
|
|
330
|
-
// create the table data that has the column headers
|
|
331
|
-
.flatMap(df => TableData
|
|
332
|
-
.fromDataFrame(df)
|
|
333
|
-
.withColumnHeader(["Windowed", "All"])
|
|
334
|
-
.flatMap(td => td.withRowHeader(["Count", `Min${units}`, `Max${units}`, `Mean${units}`]))
|
|
335
|
-
)
|
|
336
|
-
// add the data formatters for statistics
|
|
337
|
-
.flatMap(tableData => TableFormatter.fromTableData(tableData)
|
|
338
|
-
.addRowFormatters([2, 3, 4], value => formatValue(value as number))
|
|
339
|
-
.flatMap(tf => tf.addRowFormatter(1, value => formatNumber(value as number, " ,.0f")))
|
|
340
|
-
.flatMap(tf => tf.formatTable())
|
|
341
|
-
)
|
|
342
|
-
.map(tableData => TableStyler.fromTableData(tableData)
|
|
343
|
-
.withTableFont(font)
|
|
344
|
-
.withPadding(padding)
|
|
345
|
-
.withColumnHeaderStyle({
|
|
346
|
-
font: {...font, weight: 650},
|
|
347
|
-
padding: {top: 15, bottom: 0},
|
|
348
|
-
dimension: {...dimension, maxHeight: 70},
|
|
349
|
-
alignText: 'right',
|
|
350
|
-
})
|
|
351
|
-
.withRowHeaderStyle({
|
|
352
|
-
font: {...font, weight: 650},
|
|
353
|
-
padding: {left: 0, right: 10},
|
|
354
|
-
dimension: dimension,
|
|
355
|
-
alignText: 'left',
|
|
356
|
-
})
|
|
357
|
-
.withColumnStyles([], {
|
|
358
|
-
padding: {left: 10, right: 10},
|
|
359
|
-
alignText: 'right',
|
|
360
|
-
})
|
|
361
|
-
.withRowStyles([], {
|
|
362
|
-
font,
|
|
363
|
-
dimension: {...dimension, maxHeight: 20},
|
|
364
|
-
padding: {top: 0, bottom: 0}
|
|
365
|
-
}
|
|
366
|
-
)
|
|
367
|
-
.withCellStyleWhen((_, row, column) => {
|
|
368
|
-
// apply the style to the cell corresponding to the chart element that the user
|
|
369
|
-
// moused-over.
|
|
370
|
-
const coordinates = coordinatesForProviderId(providerId)
|
|
371
|
-
if (coordinates.length > 0) {
|
|
372
|
-
return coordinates.findIndex(c => c.row === row && c.column === column) > -1
|
|
373
|
-
}
|
|
374
|
-
return false
|
|
375
|
-
},
|
|
376
|
-
{font: {...font, weight: font.weight + 300}, alignText: 'right', padding: {left: 10, right: 10, top: 0, bottom: 0}},
|
|
377
|
-
100
|
|
378
|
-
)
|
|
379
|
-
.styleTable()
|
|
380
|
-
)
|
|
381
|
-
.flatMap(styledTable =>
|
|
382
|
-
createTable(styledTable, container, `t${currentDatum.time}-${seriesName}-header-${chartId}`, tooltipCoordinates)
|
|
383
|
-
)
|
|
384
|
-
.map(renderingInfo => {
|
|
385
|
-
// the calculated table coordinates and dimensions. we'll move the header text into place,
|
|
386
|
-
// and then move the table down so that it fits
|
|
387
|
-
const {tableX: x, tableY: y, tableWidth: contentWidth, tableHeight: contentHeight} = renderingInfo
|
|
388
|
-
|
|
389
|
-
// set the location of the header (series name) and text (value and time)
|
|
390
|
-
header
|
|
391
|
-
.attr('x', () => x + tooltipStyle.paddingLeft)
|
|
392
|
-
.attr('y', () => y - idHeight)
|
|
393
|
-
text
|
|
394
|
-
.attr('x', () => x + tooltipStyle.paddingLeft)
|
|
395
|
-
.attr('y', () => y)
|
|
396
|
-
|
|
397
|
-
return {x, y: y - textHeight, contentWidth, contentHeight: contentHeight + textHeight + padding.top}
|
|
398
|
-
})
|
|
399
|
-
.getOrThrow()
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Calculates the coordinates that are affected by the provider ID
|
|
403
|
-
* @param providerId The ID of the provider for the element type being moused-over
|
|
404
|
-
* @return An array of coordinates that are affected by the provider ID
|
|
405
|
-
*/
|
|
406
|
-
function coordinatesForProviderId(providerId: string): Array<{ row: number, column: number }> {
|
|
407
|
-
switch (providerId) {
|
|
408
|
-
case BAR_CHART_TOOLTIP_PROVIDER_IDS.currentValue:
|
|
409
|
-
return []
|
|
410
|
-
case BAR_CHART_TOOLTIP_PROVIDER_IDS.meanValue:
|
|
411
|
-
return [{row: 4, column: 2}]
|
|
412
|
-
case BAR_CHART_TOOLTIP_PROVIDER_IDS.minMax:
|
|
413
|
-
return [{row: 2, column: 2}, {row: 3, column: 2}]
|
|
414
|
-
case BAR_CHART_TOOLTIP_PROVIDER_IDS.windowedMeanValue:
|
|
415
|
-
return [{row: 4, column: 1}]
|
|
416
|
-
case BAR_CHART_TOOLTIP_PROVIDER_IDS.windowedMinMax:
|
|
417
|
-
return [{row: 2, column: 1}, {row: 3, column: 1}]
|
|
418
|
-
|
|
419
|
-
default:
|
|
420
|
-
return []
|
|
421
|
-
}
|
|
198
|
+
const unitsSuffix = ordinalUnits.length > 0 ? ` (${ordinalUnits})` : ""
|
|
199
|
+
|
|
200
|
+
const highlight = highlightFor(providerId)
|
|
201
|
+
const rows: Array<StatsRow> = [
|
|
202
|
+
{label: 'Count', windowed: formatNumber(windowedValueStats.count, " ,.0f"), all: formatNumber(valueStats.count, " ,.0f"), highlight: highlight('Count')},
|
|
203
|
+
{label: `Min${unitsSuffix}`, windowed: formatValue(windowedValueStats.min.value), all: formatValue(valueStats.min.value), highlight: highlight('Min')},
|
|
204
|
+
{label: `Max${unitsSuffix}`, windowed: formatValue(windowedValueStats.max.value), all: formatValue(valueStats.max.value), highlight: highlight('Max')},
|
|
205
|
+
{label: `Mean${unitsSuffix}`, windowed: formatValue(windowedValueStats.mean), all: formatValue(valueStats.mean), highlight: highlight('Mean')},
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
seriesName,
|
|
210
|
+
headerLabel: labelForProviderId(providerId),
|
|
211
|
+
valueLine: `${formatValue(currentDatum.value)}${displayOrdinalUnits} (${formatTime(currentDatum.time)} ms)`,
|
|
212
|
+
sparkline: sparklineFor(series, SPARKLINE_WIDTH, SPARKLINE_HEIGHT),
|
|
213
|
+
rows,
|
|
422
214
|
}
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Calculates the coordinates of the tooltip based on the width and height of the SVG
|
|
426
|
-
* table. This is needed because the tooltip needs to be adjusted relative mouse location
|
|
427
|
-
* when the mouse coordinates are too close to an edge.
|
|
428
|
-
* @param width The SVG table width
|
|
429
|
-
* @param height The SVG table height
|
|
430
|
-
* @return The updated tooltip coordinates
|
|
431
|
-
*/
|
|
432
|
-
function tooltipCoordinates(width: number, height: number): [x: number, y: number] {
|
|
433
|
-
return [
|
|
434
|
-
tooltipX(x, width, plotDimensions, tooltipStyle, margin),
|
|
435
|
-
tooltipY(y + textHeight + padding.top, height, plotDimensions, tooltipStyle, margin)
|
|
436
|
-
]
|
|
437
|
-
}
|
|
438
|
-
|
|
439
215
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {type JSX} from "react"
|
|
2
|
+
import {useOutlierTooltip} from "./useOutlierTooltip"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The default content of the {@link OutlierPlotTooltipContent} (used when it has no children of
|
|
6
|
+
* its own): reads what the tooltip shows, and the formatters, from {@link useOutlierTooltip}
|
|
7
|
+
* @return The series' name, the outlier (if any), the band, its measure, and the number of points
|
|
8
|
+
* in the band
|
|
9
|
+
*/
|
|
10
|
+
export function DefaultOutlierTooltipContent(): JSX.Element {
|
|
11
|
+
const {
|
|
12
|
+
tooltipContent,
|
|
13
|
+
tooltipStyle,
|
|
14
|
+
datumFormatter,
|
|
15
|
+
bandFormatter,
|
|
16
|
+
measureFormatter,
|
|
17
|
+
} = useOutlierTooltip()
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
seriesName,
|
|
21
|
+
datum,
|
|
22
|
+
upperMeasure = 1,
|
|
23
|
+
lowerMeasure = 0,
|
|
24
|
+
pointsInBand,
|
|
25
|
+
} = tooltipContent
|
|
26
|
+
|
|
27
|
+
const outerProb = 1 - upperMeasure
|
|
28
|
+
const innerProb = upperMeasure - lowerMeasure
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<div style={{fontWeight: tooltipStyle.fontWeight + 500, fontSize: tooltipStyle.fontSize + 2}}>Series: {seriesName}</div>
|
|
33
|
+
<hr/>
|
|
34
|
+
{datum && <div>{datumFormatter(datum.datum.x, datum.datum.y)}</div>}
|
|
35
|
+
<div>{bandFormatter(lowerMeasure, upperMeasure)}</div>
|
|
36
|
+
<div>{measureFormatter(innerProb, outerProb)}</div>
|
|
37
|
+
<div>Points in band: {pointsInBand}</div>
|
|
38
|
+
</>
|
|
39
|
+
)
|
|
40
|
+
}
|