stream-charts 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +809 -1022
- package/changes.md +36 -0
- package/dist/app/charts/Chart.d.ts +35 -139
- package/dist/app/charts/Chart.d.ts.map +1 -0
- package/dist/app/charts/Chart.js +74 -65
- package/dist/app/charts/Chart.js.map +1 -1
- package/dist/app/charts/axes/AxesState.d.ts +26 -18
- package/dist/app/charts/axes/AxesState.d.ts.map +1 -0
- package/dist/app/charts/axes/AxesState.js +26 -24
- package/dist/app/charts/axes/AxesState.js.map +1 -1
- package/dist/app/charts/axes/AxisInterval.d.ts +44 -26
- package/dist/app/charts/axes/AxisInterval.d.ts.map +1 -0
- package/dist/app/charts/axes/AxisInterval.js +48 -29
- package/dist/app/charts/axes/AxisInterval.js.map +1 -1
- package/dist/app/charts/axes/BaseAxisRange.d.ts +46 -22
- package/dist/app/charts/axes/BaseAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/BaseAxisRange.js +17 -12
- package/dist/app/charts/axes/BaseAxisRange.js.map +1 -1
- package/dist/app/charts/axes/ContinuousAxis.d.ts +47 -6
- package/dist/app/charts/axes/ContinuousAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/ContinuousAxis.js +160 -27
- package/dist/app/charts/axes/ContinuousAxis.js.map +1 -1
- package/dist/app/charts/axes/ContinuousAxisRange.d.ts +29 -10
- package/dist/app/charts/axes/ContinuousAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/ContinuousAxisRange.js +29 -11
- package/dist/app/charts/axes/ContinuousAxisRange.js.map +1 -1
- package/dist/app/charts/axes/EmptyAxis.d.ts +5 -2
- package/dist/app/charts/axes/EmptyAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/EmptyAxis.js +30 -9
- package/dist/app/charts/axes/EmptyAxis.js.map +1 -1
- package/dist/app/charts/axes/OrdinalAxis.d.ts +5 -3
- package/dist/app/charts/axes/OrdinalAxis.d.ts.map +1 -0
- package/dist/app/charts/axes/OrdinalAxis.js +39 -16
- package/dist/app/charts/axes/OrdinalAxis.js.map +1 -1
- package/dist/app/charts/axes/OrdinalAxisRange.d.ts +76 -13
- package/dist/app/charts/axes/OrdinalAxisRange.d.ts.map +1 -0
- package/dist/app/charts/axes/OrdinalAxisRange.js +95 -16
- package/dist/app/charts/axes/OrdinalAxisRange.js.map +1 -1
- package/dist/app/charts/axes/autoScale.d.ts +111 -0
- package/dist/app/charts/axes/autoScale.d.ts.map +1 -0
- package/dist/app/charts/axes/autoScale.js +188 -0
- package/dist/app/charts/axes/autoScale.js.map +1 -0
- package/dist/app/charts/axes/axes.d.ts +273 -150
- package/dist/app/charts/axes/axes.d.ts.map +1 -0
- package/dist/app/charts/axes/axes.js +808 -583
- package/dist/app/charts/axes/axes.js.map +1 -1
- package/dist/app/charts/d3types.d.ts +40 -11
- package/dist/app/charts/d3types.d.ts.map +1 -0
- package/dist/app/charts/d3types.js +3 -0
- package/dist/app/charts/d3types.js.map +1 -1
- package/dist/app/charts/datasources/StreamingDataSource.d.ts +149 -0
- package/dist/app/charts/datasources/StreamingDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/StreamingDataSource.js +110 -0
- package/dist/app/charts/datasources/StreamingDataSource.js.map +1 -0
- package/dist/app/charts/datasources/iteratesDataSource.d.ts +73 -0
- package/dist/app/charts/datasources/iteratesDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/iteratesDataSource.js +87 -0
- package/dist/app/charts/datasources/iteratesDataSource.js.map +1 -0
- package/dist/app/charts/datasources/ordinalDataSource.d.ts +75 -0
- package/dist/app/charts/datasources/ordinalDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/ordinalDataSource.js +135 -0
- package/dist/app/charts/datasources/ordinalDataSource.js.map +1 -0
- package/dist/app/charts/datasources/outlierDataSource.d.ts +53 -0
- package/dist/app/charts/datasources/outlierDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/outlierDataSource.js +57 -0
- package/dist/app/charts/datasources/outlierDataSource.js.map +1 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.d.ts +77 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.d.ts.map +1 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.js +85 -0
- package/dist/app/charts/datasources/timeSeriesDataSource.js.map +1 -0
- package/dist/app/charts/filters/regexFilter.d.ts +31 -4
- package/dist/app/charts/filters/regexFilter.d.ts.map +1 -0
- package/dist/app/charts/filters/regexFilter.js +38 -4
- package/dist/app/charts/filters/regexFilter.js.map +1 -1
- package/dist/app/charts/hooks/AxesProvider.d.ts +21 -0
- package/dist/app/charts/hooks/AxesProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/AxesProvider.js +213 -0
- package/dist/app/charts/hooks/AxesProvider.js.map +1 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts +25 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.js +76 -0
- package/dist/app/charts/hooks/CanvasSurfaceProvider.js.map +1 -0
- package/dist/app/charts/hooks/ChartProvider.d.ts +40 -0
- package/dist/app/charts/hooks/ChartProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/ChartProvider.js +33 -0
- package/dist/app/charts/hooks/ChartProvider.js.map +1 -0
- package/dist/app/charts/hooks/InteractionProvider.d.ts +23 -0
- package/dist/app/charts/hooks/InteractionProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/InteractionProvider.js +60 -0
- package/dist/app/charts/hooks/InteractionProvider.js.map +1 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts +16 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.d.ts.map +1 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.js +76 -0
- package/dist/app/charts/hooks/PlotDimensionsProvider.js.map +1 -0
- package/dist/app/charts/hooks/defaultAxesValues.d.ts +11 -0
- package/dist/app/charts/hooks/defaultAxesValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultAxesValues.js +36 -0
- package/dist/app/charts/hooks/defaultAxesValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultMouseValues.d.ts +9 -0
- package/dist/app/charts/hooks/defaultMouseValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultMouseValues.js +23 -0
- package/dist/app/charts/hooks/defaultMouseValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.d.ts +13 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.js +23 -0
- package/dist/app/charts/hooks/defaultPlotDimensions.js.map +1 -0
- package/dist/app/charts/hooks/defaultTooltipValues.d.ts +9 -0
- package/dist/app/charts/hooks/defaultTooltipValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultTooltipValues.js +21 -0
- package/dist/app/charts/hooks/defaultTooltipValues.js.map +1 -0
- package/dist/app/charts/hooks/defaultUseChartValues.d.ts +14 -0
- package/dist/app/charts/hooks/defaultUseChartValues.d.ts.map +1 -0
- package/dist/app/charts/hooks/defaultUseChartValues.js +30 -0
- package/dist/app/charts/hooks/defaultUseChartValues.js.map +1 -0
- package/dist/app/charts/hooks/useAxes.d.ts +49 -36
- package/dist/app/charts/hooks/useAxes.d.ts.map +1 -0
- package/dist/app/charts/hooks/useAxes.js +16 -176
- package/dist/app/charts/hooks/useAxes.js.map +1 -1
- package/dist/app/charts/hooks/useCanvasSurface.d.ts +25 -0
- package/dist/app/charts/hooks/useCanvasSurface.d.ts.map +1 -0
- package/dist/app/charts/hooks/useCanvasSurface.js +18 -0
- package/dist/app/charts/hooks/useCanvasSurface.js.map +1 -0
- package/dist/app/charts/hooks/useChart.d.ts +30 -44
- package/dist/app/charts/hooks/useChart.d.ts.map +1 -0
- package/dist/app/charts/hooks/useChart.js +26 -48
- package/dist/app/charts/hooks/useChart.js.map +1 -1
- package/dist/app/charts/hooks/useDataSource.d.ts +68 -0
- package/dist/app/charts/hooks/useDataSource.d.ts.map +1 -0
- package/dist/app/charts/hooks/useDataSource.js +63 -0
- package/dist/app/charts/hooks/useDataSource.js.map +1 -0
- package/dist/app/charts/hooks/useHoveredSeries.d.ts +25 -0
- package/dist/app/charts/hooks/useHoveredSeries.d.ts.map +1 -0
- package/dist/app/charts/hooks/useHoveredSeries.js +15 -0
- package/dist/app/charts/hooks/useHoveredSeries.js.map +1 -0
- package/dist/app/charts/hooks/useMouse.d.ts +46 -22
- package/dist/app/charts/hooks/useMouse.d.ts.map +1 -0
- package/dist/app/charts/hooks/useMouse.js +12 -56
- package/dist/app/charts/hooks/useMouse.js.map +1 -1
- package/dist/app/charts/hooks/usePlotDimensions.d.ts +25 -13
- package/dist/app/charts/hooks/usePlotDimensions.d.ts.map +1 -0
- package/dist/app/charts/hooks/usePlotDimensions.js +6 -62
- package/dist/app/charts/hooks/usePlotDimensions.js.map +1 -1
- package/dist/app/charts/hooks/useTooltip.d.ts +24 -26
- package/dist/app/charts/hooks/useTooltip.d.ts.map +1 -0
- package/dist/app/charts/hooks/useTooltip.js +12 -42
- package/dist/app/charts/hooks/useTooltip.js.map +1 -1
- package/dist/app/charts/index.d.ts +66 -0
- package/dist/app/charts/index.d.ts.map +1 -0
- package/dist/app/charts/index.js +87 -0
- package/dist/app/charts/index.js.map +1 -0
- package/dist/app/charts/legends/Legend.d.ts +33 -12
- package/dist/app/charts/legends/Legend.d.ts.map +1 -0
- package/dist/app/charts/legends/Legend.js +138 -379
- package/dist/app/charts/legends/Legend.js.map +1 -1
- package/dist/app/charts/legends/constants.d.ts +19 -0
- package/dist/app/charts/legends/constants.d.ts.map +1 -0
- package/dist/app/charts/legends/constants.js +34 -0
- package/dist/app/charts/legends/constants.js.map +1 -0
- package/dist/app/charts/observables/ChartData.d.ts +1 -0
- package/dist/app/charts/observables/ChartData.d.ts.map +1 -0
- package/dist/app/charts/observables/iterates.d.ts +13 -7
- package/dist/app/charts/observables/iterates.d.ts.map +1 -0
- package/dist/app/charts/observables/iterates.js +42 -9
- package/dist/app/charts/observables/iterates.js.map +1 -1
- package/dist/app/charts/observables/ordinals.d.ts +70 -12
- package/dist/app/charts/observables/ordinals.d.ts.map +1 -0
- package/dist/app/charts/observables/ordinals.js +127 -48
- package/dist/app/charts/observables/ordinals.js.map +1 -1
- package/dist/app/charts/observables/outliers.d.ts +18 -0
- package/dist/app/charts/observables/outliers.d.ts.map +1 -0
- package/dist/app/charts/observables/outliers.js +2 -0
- package/dist/app/charts/observables/outliers.js.map +1 -0
- package/dist/app/charts/plots/BarPlot.d.ts +87 -13
- package/dist/app/charts/plots/BarPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/BarPlot.js +603 -356
- package/dist/app/charts/plots/BarPlot.js.map +1 -1
- package/dist/app/charts/plots/OutlierPlot.d.ts +123 -0
- package/dist/app/charts/plots/OutlierPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/OutlierPlot.js +430 -0
- package/dist/app/charts/plots/OutlierPlot.js.map +1 -0
- package/dist/app/charts/plots/PoincarePlot.d.ts +92 -14
- package/dist/app/charts/plots/PoincarePlot.d.ts.map +1 -0
- package/dist/app/charts/plots/PoincarePlot.js +523 -364
- package/dist/app/charts/plots/PoincarePlot.js.map +1 -1
- package/dist/app/charts/plots/RasterPlot.d.ts +31 -10
- package/dist/app/charts/plots/RasterPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/RasterPlot.js +198 -306
- package/dist/app/charts/plots/RasterPlot.js.map +1 -1
- package/dist/app/charts/plots/ScatterPlot.d.ts +77 -21
- package/dist/app/charts/plots/ScatterPlot.d.ts.map +1 -0
- package/dist/app/charts/plots/ScatterPlot.js +359 -302
- package/dist/app/charts/plots/ScatterPlot.js.map +1 -1
- package/dist/app/charts/plots/autoScaleYAxes.d.ts +43 -0
- package/dist/app/charts/plots/autoScaleYAxes.d.ts.map +1 -0
- package/dist/app/charts/plots/autoScaleYAxes.js +71 -0
- package/dist/app/charts/plots/autoScaleYAxes.js.map +1 -0
- package/dist/app/charts/plots/colorizedLine.d.ts +61 -0
- package/dist/app/charts/plots/colorizedLine.d.ts.map +1 -0
- package/dist/app/charts/plots/colorizedLine.js +157 -0
- package/dist/app/charts/plots/colorizedLine.js.map +1 -0
- package/dist/app/charts/plots/constants.d.ts +7 -0
- package/dist/app/charts/plots/constants.d.ts.map +1 -0
- package/dist/app/charts/plots/constants.js +11 -0
- package/dist/app/charts/plots/constants.js.map +1 -0
- package/dist/app/charts/plots/hitTesting.d.ts +88 -0
- package/dist/app/charts/plots/hitTesting.d.ts.map +1 -0
- package/dist/app/charts/plots/hitTesting.js +136 -0
- package/dist/app/charts/plots/hitTesting.js.map +1 -0
- package/dist/app/charts/plots/plot.d.ts +52 -16
- package/dist/app/charts/plots/plot.d.ts.map +1 -0
- package/dist/app/charts/plots/plot.js +108 -35
- package/dist/app/charts/plots/plot.js.map +1 -1
- package/dist/app/charts/plots/useCanvasZoomPan.d.ts +119 -0
- package/dist/app/charts/plots/useCanvasZoomPan.d.ts.map +1 -0
- package/dist/app/charts/plots/useCanvasZoomPan.js +113 -0
- package/dist/app/charts/plots/useCanvasZoomPan.js.map +1 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.d.ts +103 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.d.ts.map +1 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.js +257 -0
- package/dist/app/charts/plots/useStreamingTimeAxes.js.map +1 -0
- package/dist/app/charts/series/baseSeries.d.ts +60 -8
- package/dist/app/charts/series/baseSeries.d.ts.map +1 -0
- package/dist/app/charts/series/baseSeries.js +53 -8
- package/dist/app/charts/series/baseSeries.js.map +1 -1
- package/dist/app/charts/series/iterateSeries.d.ts +9 -8
- package/dist/app/charts/series/iterateSeries.d.ts.map +1 -0
- package/dist/app/charts/series/iterateSeries.js +7 -7
- package/dist/app/charts/series/iterateSeries.js.map +1 -1
- package/dist/app/charts/series/ordinalSeries.d.ts +27 -13
- package/dist/app/charts/series/ordinalSeries.d.ts.map +1 -0
- package/dist/app/charts/series/ordinalSeries.js +29 -15
- package/dist/app/charts/series/ordinalSeries.js.map +1 -1
- package/dist/app/charts/series/outlierSeries.d.ts +142 -0
- package/dist/app/charts/series/outlierSeries.d.ts.map +1 -0
- package/dist/app/charts/series/outlierSeries.js +82 -0
- package/dist/app/charts/series/outlierSeries.js.map +1 -0
- package/dist/app/charts/series/timeSeries.d.ts +13 -9
- package/dist/app/charts/series/timeSeries.d.ts.map +1 -0
- package/dist/app/charts/series/timeSeries.js +6 -3
- package/dist/app/charts/series/timeSeries.js.map +1 -1
- package/dist/app/charts/series/timeSeriesChartData.d.ts +18 -10
- package/dist/app/charts/series/timeSeriesChartData.d.ts.map +1 -0
- package/dist/app/charts/series/timeSeriesChartData.js +28 -14
- package/dist/app/charts/series/timeSeriesChartData.js.map +1 -1
- package/dist/app/charts/styling/barPlotStyle.d.ts +46 -2
- package/dist/app/charts/styling/barPlotStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/barPlotStyle.js +37 -3
- package/dist/app/charts/styling/barPlotStyle.js.map +1 -1
- package/dist/app/charts/styling/canvasStyle.d.ts +53 -0
- package/dist/app/charts/styling/canvasStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/canvasStyle.js +71 -0
- package/dist/app/charts/styling/canvasStyle.js.map +1 -0
- package/dist/app/charts/styling/margins.d.ts +21 -2
- package/dist/app/charts/styling/margins.d.ts.map +1 -0
- package/dist/app/charts/styling/margins.js +25 -4
- package/dist/app/charts/styling/margins.js.map +1 -1
- package/dist/app/charts/styling/svgStyle.d.ts +10 -56
- package/dist/app/charts/styling/svgStyle.d.ts.map +1 -0
- package/dist/app/charts/styling/svgStyle.js +3 -78
- package/dist/app/charts/styling/svgStyle.js.map +1 -1
- package/dist/app/charts/subscriptions/viewDrivers.d.ts +124 -0
- package/dist/app/charts/subscriptions/viewDrivers.d.ts.map +1 -0
- package/dist/app/charts/subscriptions/viewDrivers.js +338 -0
- package/dist/app/charts/subscriptions/viewDrivers.js.map +1 -0
- package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts +12 -78
- package/dist/app/charts/tooltips/BarPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/BarPlotTooltipContent.js +65 -257
- package/dist/app/charts/tooltips/BarPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts +9 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js +16 -0
- package/dist/app/charts/tooltips/DefaultOutlierTooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts +30 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js +26 -0
- package/dist/app/charts/tooltips/OutlierPlotTooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts +22 -72
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js +104 -171
- package/dist/app/charts/tooltips/PoincarePlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts +32 -8
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.js +62 -115
- package/dist/app/charts/tooltips/RasterPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts +39 -12
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js +162 -134
- package/dist/app/charts/tooltips/ScatterPlotTooltipContent.js.map +1 -1
- package/dist/app/charts/tooltips/Tooltip.d.ts +27 -32
- package/dist/app/charts/tooltips/Tooltip.d.ts.map +1 -0
- package/dist/app/charts/tooltips/Tooltip.js +37 -81
- package/dist/app/charts/tooltips/Tooltip.js.map +1 -1
- package/dist/app/charts/tooltips/TooltipContent.d.ts +81 -0
- package/dist/app/charts/tooltips/TooltipContent.d.ts.map +1 -0
- package/dist/app/charts/tooltips/TooltipContent.js +99 -0
- package/dist/app/charts/tooltips/TooltipContent.js.map +1 -0
- package/dist/app/charts/tooltips/tooltipUtils.d.ts +186 -36
- package/dist/app/charts/tooltips/tooltipUtils.d.ts.map +1 -0
- package/dist/app/charts/tooltips/tooltipUtils.js +277 -48
- package/dist/app/charts/tooltips/tooltipUtils.js.map +1 -1
- package/dist/app/charts/tooltips/useOutlierTooltip.d.ts +59 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.js +16 -0
- package/dist/app/charts/tooltips/useOutlierTooltip.js.map +1 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.d.ts +51 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.js +52 -0
- package/dist/app/charts/tooltips/useTooltipPlacement.js.map +1 -0
- package/dist/app/charts/tooltips/useTooltipStyle.d.ts +11 -0
- package/dist/app/charts/tooltips/useTooltipStyle.d.ts.map +1 -0
- package/dist/app/charts/tooltips/useTooltipStyle.js +14 -0
- package/dist/app/charts/tooltips/useTooltipStyle.js.map +1 -0
- package/dist/app/charts/trackers/Tracker.d.ts +22 -6
- package/dist/app/charts/trackers/Tracker.d.ts.map +1 -0
- package/dist/app/charts/trackers/Tracker.js +36 -22
- package/dist/app/charts/trackers/Tracker.js.map +1 -1
- package/dist/app/charts/trackers/trackerUtils.d.ts +40 -18
- package/dist/app/charts/trackers/trackerUtils.d.ts.map +1 -0
- package/dist/app/charts/trackers/trackerUtils.js +213 -300
- package/dist/app/charts/trackers/trackerUtils.js.map +1 -1
- package/dist/app/charts/utils.d.ts +72 -33
- package/dist/app/charts/utils.d.ts.map +1 -0
- package/dist/app/charts/utils.js +87 -42
- package/dist/app/charts/utils.js.map +1 -1
- package/dist/index.d.ts +2 -45
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -72
- package/dist/index.js.map +1 -1
- package/package.json +87 -46
- package/src/app/charts/Chart.tsx +132 -168
- package/src/app/charts/axes/AxesState.ts +27 -29
- package/src/app/charts/axes/AxisInterval.ts +57 -32
- package/src/app/charts/axes/BaseAxisRange.ts +47 -27
- package/src/app/charts/axes/ContinuousAxis.tsx +235 -39
- package/src/app/charts/axes/ContinuousAxisRange.ts +29 -11
- package/src/app/charts/axes/EmptyAxis.tsx +52 -17
- package/src/app/charts/axes/OrdinalAxis.tsx +54 -28
- package/src/app/charts/axes/OrdinalAxisRange.ts +96 -16
- package/src/app/charts/axes/autoScale.ts +244 -0
- package/src/app/charts/axes/axes.ts +954 -735
- package/src/app/charts/d3types.ts +42 -13
- package/src/app/charts/datasources/StreamingDataSource.ts +214 -0
- package/src/app/charts/datasources/iteratesDataSource.ts +122 -0
- package/src/app/charts/datasources/ordinalDataSource.ts +205 -0
- package/src/app/charts/datasources/outlierDataSource.ts +90 -0
- package/src/app/charts/datasources/timeSeriesDataSource.ts +133 -0
- package/src/app/charts/filters/regexFilter.ts +45 -5
- package/src/app/charts/hooks/AxesProvider.tsx +301 -0
- package/src/app/charts/hooks/CanvasSurfaceProvider.tsx +117 -0
- package/src/app/charts/hooks/ChartProvider.tsx +79 -0
- package/src/app/charts/hooks/InteractionProvider.tsx +88 -0
- package/src/app/charts/hooks/PlotDimensionsProvider.tsx +109 -0
- package/src/app/charts/hooks/defaultAxesValues.ts +40 -0
- package/src/app/charts/hooks/defaultMouseValues.ts +24 -0
- package/src/app/charts/hooks/defaultPlotDimensions.ts +27 -0
- package/src/app/charts/hooks/defaultTooltipValues.tsx +23 -0
- package/src/app/charts/hooks/defaultUseChartValues.tsx +36 -0
- package/src/app/charts/hooks/useAxes.tsx +60 -228
- package/src/app/charts/hooks/useCanvasSurface.tsx +35 -0
- package/src/app/charts/hooks/useChart.tsx +47 -106
- package/src/app/charts/hooks/useDataSource.tsx +106 -0
- package/src/app/charts/hooks/useHoveredSeries.tsx +33 -0
- package/src/app/charts/hooks/useMouse.tsx +58 -82
- package/src/app/charts/hooks/usePlotDimensions.tsx +25 -89
- package/src/app/charts/hooks/useTooltip.tsx +32 -63
- package/src/app/charts/index.ts +213 -0
- package/src/app/charts/legends/Legend.tsx +198 -479
- package/src/app/charts/legends/constants.ts +37 -0
- package/src/app/charts/observables/iterates.ts +32 -12
- package/src/app/charts/observables/ordinals.ts +141 -67
- package/src/app/charts/observables/outliers.ts +20 -0
- package/src/app/charts/plots/BarPlot.tsx +784 -666
- package/src/app/charts/plots/OutlierPlot.tsx +685 -0
- package/src/app/charts/plots/PoincarePlot.tsx +707 -489
- package/src/app/charts/plots/RasterPlot.tsx +253 -445
- package/src/app/charts/plots/ScatterPlot.tsx +480 -463
- package/src/app/charts/plots/autoScaleYAxes.ts +102 -0
- package/src/app/charts/plots/colorizedLine.ts +185 -0
- package/src/app/charts/plots/constants.ts +16 -0
- package/src/app/charts/plots/hitTesting.ts +198 -0
- package/src/app/charts/plots/plot.ts +138 -44
- package/src/app/charts/plots/useCanvasZoomPan.ts +240 -0
- package/src/app/charts/plots/useStreamingTimeAxes.ts +384 -0
- package/src/app/charts/series/baseSeries.ts +81 -14
- package/src/app/charts/series/iterateSeries.ts +8 -8
- package/src/app/charts/series/ordinalSeries.ts +35 -20
- package/src/app/charts/series/outlierSeries.ts +188 -0
- package/src/app/charts/series/timeSeries.ts +14 -12
- package/src/app/charts/series/timeSeriesChartData.ts +31 -17
- package/src/app/charts/styling/barPlotStyle.ts +48 -5
- package/src/app/charts/styling/canvasStyle.ts +86 -0
- package/src/app/charts/styling/margins.ts +28 -4
- package/src/app/charts/styling/svgStyle.ts +10 -91
- package/src/app/charts/subscriptions/viewDrivers.ts +447 -0
- package/src/app/charts/tooltips/BarPlotTooltipContent.tsx +156 -380
- package/src/app/charts/tooltips/DefaultOutlierTooltipContent.tsx +40 -0
- package/src/app/charts/tooltips/OutlierPlotTooltipContent.tsx +67 -0
- package/src/app/charts/tooltips/PoincarePlotTooltipContent.tsx +229 -292
- package/src/app/charts/tooltips/RasterPlotTooltipContent.tsx +164 -217
- package/src/app/charts/tooltips/ScatterPlotTooltipContent.tsx +373 -236
- package/src/app/charts/tooltips/Tooltip.tsx +58 -124
- package/src/app/charts/tooltips/TooltipContent.tsx +177 -0
- package/src/app/charts/tooltips/tooltipUtils.ts +359 -61
- package/src/app/charts/tooltips/useOutlierTooltip.tsx +68 -0
- package/src/app/charts/tooltips/useTooltipPlacement.ts +86 -0
- package/src/app/charts/tooltips/useTooltipStyle.ts +15 -0
- package/src/app/charts/trackers/Tracker.tsx +68 -33
- package/src/app/charts/trackers/trackerUtils.ts +263 -376
- package/src/app/charts/utils.ts +90 -48
- package/src/index.ts +2 -322
- package/dist/app/charts/axes/AxesState.test.d.ts +0 -1
- package/dist/app/charts/axes/AxesState.test.js +0 -30
- package/dist/app/charts/axes/AxesState.test.js.map +0 -1
- package/dist/app/charts/axes/AxisInterval.test.d.ts +0 -1
- package/dist/app/charts/axes/AxisInterval.test.js +0 -120
- package/dist/app/charts/axes/AxisInterval.test.js.map +0 -1
- package/dist/app/charts/axes/ContinuousAxisRange.test.d.ts +0 -1
- package/dist/app/charts/axes/ContinuousAxisRange.test.js +0 -47
- package/dist/app/charts/axes/ContinuousAxisRange.test.js.map +0 -1
- package/dist/app/charts/axes/OrdinalAxisRange.test.d.ts +0 -1
- package/dist/app/charts/axes/OrdinalAxisRange.test.js +0 -48
- package/dist/app/charts/axes/OrdinalAxisRange.test.js.map +0 -1
- package/dist/app/charts/filters/regexFilter.test.d.ts +0 -1
- package/dist/app/charts/filters/regexFilter.test.js +0 -11
- package/dist/app/charts/filters/regexFilter.test.js.map +0 -1
- package/dist/app/charts/hooks/useDataObservable.d.ts +0 -72
- package/dist/app/charts/hooks/useDataObservable.js +0 -74
- package/dist/app/charts/hooks/useDataObservable.js.map +0 -1
- package/dist/app/charts/hooks/useInitialData.d.ts +0 -36
- package/dist/app/charts/hooks/useInitialData.js +0 -28
- package/dist/app/charts/hooks/useInitialData.js.map +0 -1
- package/dist/app/charts/observables/iterates.test.d.ts +0 -1
- package/dist/app/charts/observables/iterates.test.js +0 -180
- package/dist/app/charts/observables/iterates.test.js.map +0 -1
- package/dist/app/charts/observables/ordinals.test.d.ts +0 -1
- package/dist/app/charts/observables/ordinals.test.js +0 -102
- package/dist/app/charts/observables/ordinals.test.js.map +0 -1
- package/dist/app/charts/series/datumSeries.test.d.ts +0 -1
- package/dist/app/charts/series/datumSeries.test.js +0 -50
- package/dist/app/charts/series/datumSeries.test.js.map +0 -1
- package/dist/app/charts/styling/margins.test.d.ts +0 -1
- package/dist/app/charts/styling/margins.test.js +0 -19
- package/dist/app/charts/styling/margins.test.js.map +0 -1
- package/dist/app/charts/subscriptions/subscription.test.d.ts +0 -1
- package/dist/app/charts/subscriptions/subscription.test.js +0 -395
- package/dist/app/charts/subscriptions/subscription.test.js.map +0 -1
- package/dist/app/charts/subscriptions/subscriptions.d.ts +0 -100
- package/dist/app/charts/subscriptions/subscriptions.js +0 -449
- package/dist/app/charts/subscriptions/subscriptions.js.map +0 -1
- package/src/app/charts/axes/AxesState.test.ts +0 -34
- package/src/app/charts/axes/AxisInterval.test.ts +0 -143
- package/src/app/charts/axes/ContinuousAxisRange.test.ts +0 -55
- package/src/app/charts/axes/OrdinalAxisRange.test.ts +0 -55
- package/src/app/charts/filters/regexFilter.test.ts +0 -13
- package/src/app/charts/hooks/useDataObservable.tsx +0 -170
- package/src/app/charts/hooks/useInitialData.tsx +0 -64
- package/src/app/charts/observables/iterates.test.ts +0 -201
- package/src/app/charts/observables/ordinals.test.ts +0 -135
- package/src/app/charts/series/datumSeries.test.ts +0 -60
- package/src/app/charts/styling/margins.test.ts +0 -22
- package/src/app/charts/subscriptions/subscription.test.ts +0 -499
- package/src/app/charts/subscriptions/subscriptions.ts +0 -635
|
@@ -1,70 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type {ReactElement} from "react";
|
|
2
|
+
import {
|
|
3
|
+
categoryTooltipY,
|
|
4
|
+
type RasterTooltipMetadata,
|
|
5
|
+
type Sparkline,
|
|
6
|
+
sparklineFor,
|
|
7
|
+
type SeriesStatistics,
|
|
8
|
+
seriesStatistics,
|
|
9
|
+
type TooltipStyle,
|
|
10
|
+
valueOrMissing
|
|
11
|
+
} from "./tooltipUtils";
|
|
12
|
+
import {TooltipContent} from "./TooltipContent";
|
|
13
|
+
import {formatNumber, formatTime, formatValue} from "../utils";
|
|
14
|
+
import {useChart} from "../hooks/useChart";
|
|
15
|
+
import type {OrdinalStringAxis, SeriesLineStyle} from "../axes/axes";
|
|
8
16
|
import {usePlotDimensions} from "../hooks/usePlotDimensions";
|
|
9
|
-
import {Datum} from "../series/timeSeries";
|
|
10
|
-
import {TooltipData} from "../hooks/useTooltip";
|
|
17
|
+
import type {Datum} from "../series/timeSeries";
|
|
11
18
|
import {ContinuousAxisRange} from "../axes/ContinuousAxisRange";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
# Want to write your own tooltip-content component?
|
|
15
|
-
|
|
16
|
-
Here's how to write your own tooltip-content component.
|
|
17
|
-
|
|
18
|
-
To create your own tooltip content `<MyTooltipContent/>` you must do the following:
|
|
19
|
-
1. Create a react component for your tooltip content (see for example, {@link ScatterPlotTooltipContent}
|
|
20
|
-
as a reference.
|
|
21
|
-
2. Use the {@link useChart} hook to get the {@link registerTooltipContentProvider} registration function.
|
|
22
|
-
3. When your tooltip content component (`<MyTooltipContent/>`) mounts, use the {@link registerTooltipContentProvider}
|
|
23
|
-
function to register your tooltip content provider.
|
|
24
|
-
4. When the chart dimensions, margin, container, etc, change, register your tooltip content provider
|
|
25
|
-
again (you can register as many times as you like because it only uses the last content provider
|
|
26
|
-
registered).
|
|
27
|
-
|
|
28
|
-
That's it! A bit more details below.
|
|
29
|
-
|
|
30
|
-
The {@link registerTooltipContentProvider} function from the {@link useChart} hook allows you to register
|
|
31
|
-
one tooltip content provider. A second call to this function will cause the {@link useChart} hook to drop
|
|
32
|
-
the first one in favor of the second one.
|
|
33
|
-
|
|
34
|
-
The {@link registerTooltipContentProvider} function from the {@link useChart} hook accepts a higher-order
|
|
35
|
-
function that allowing a closure on content/chart-specific data. Specifically, you must hand the
|
|
36
|
-
{@link registerTooltipContentProvider} a function of the form:
|
|
37
|
-
|
|
38
|
-
`(seriesName: string, time: number, series: TimeSeries, mouseCoords: [x: number, y: number]) => TooltipDimensions`
|
|
39
|
-
|
|
40
|
-
Your function to add that actual content will be what this function calls whenever d3 fires a mouse-over
|
|
41
|
-
event on one you the time-series in the chart.
|
|
42
|
-
|
|
43
|
-
The code snippet below is from the `useEffect` call in the {@link ScatterPlotTooltipContent}.
|
|
44
|
-
Note that the first four arguments to the {@link addTooltipContent} function are those provided by the {@link useChart} hook
|
|
45
|
-
when a d3 mouse-over event occurs on one of your series. The additional six arguments are from the closure formed
|
|
46
|
-
on the variables in your component. The `chartId`, `container`, `margin`, and `plotDimensions` are from the
|
|
47
|
-
{@link useChart} hook called by the {@link ScatterPlotTooltipContent} component. The last two
|
|
48
|
-
arguments, `defaultTooltipStyle` and `options` are specific to the {@link ScatterPlotTooltipContent}.
|
|
49
|
-
For example, the `options` property is set by the caller of the {@link ScatterPlotTooltipContent}
|
|
50
|
-
component.
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
// register the tooltip content provider function with the chart hook (useChart) so that
|
|
54
|
-
// it is visible to all children of the Chart (i.e. the <Tooltip>).
|
|
55
|
-
registerTooltipContentProvider(
|
|
56
|
-
(seriesName: string, time: number, series: TimeSeries, mouseCoords: [x: number, y: number]) =>
|
|
57
|
-
addTooltipContent(
|
|
58
|
-
seriesName, time, series, mouseCoords,
|
|
59
|
-
chartId, container, margin, plotDimensions,
|
|
60
|
-
defaultTooltipStyle, options
|
|
61
|
-
)
|
|
62
|
-
)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
This pattern allows you to supplement that `useChart` mouse-over callback with information specific to you component.
|
|
66
|
-
|
|
67
|
-
*/
|
|
19
|
+
import type {Series} from "../plots/plot";
|
|
68
20
|
|
|
69
21
|
/**
|
|
70
22
|
* Options for displaying the tooltip content. These options are specific to this
|
|
@@ -75,12 +27,12 @@ import {ContinuousAxisRange} from "../axes/ContinuousAxisRange";
|
|
|
75
27
|
* formatters.x(x), formatters.y(y)
|
|
76
28
|
* ```
|
|
77
29
|
*/
|
|
78
|
-
interface TooltipOptions {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
30
|
+
// interface TooltipOptions {
|
|
31
|
+
// formatters: {
|
|
32
|
+
// x: (value: number) => string,
|
|
33
|
+
// y: (value: number) => string,
|
|
34
|
+
// }
|
|
35
|
+
// }
|
|
84
36
|
|
|
85
37
|
/**
|
|
86
38
|
* Properties for rendering the tooltip content. The properties are applied as
|
|
@@ -89,185 +41,180 @@ interface TooltipOptions {
|
|
|
89
41
|
* series name
|
|
90
42
|
* xFormatter, yFormatter
|
|
91
43
|
* ```
|
|
44
|
+
* Below that, the spikes' statistics: the mean value and standard deviation (formatted by
|
|
45
|
+
* `yFormatter`), and the mean time between spikes (formatted by `intervalFormatter`).
|
|
92
46
|
*/
|
|
93
47
|
export interface Props {
|
|
48
|
+
/** formats the spike's time */
|
|
94
49
|
xFormatter?: (value: number) => string
|
|
50
|
+
/** formats the values (the spike's value, and the mean and standard deviation of the values) */
|
|
95
51
|
yFormatter?: (value: number) => string
|
|
52
|
+
/**
|
|
53
|
+
* formats the mean time between spikes (a duration, in the times' units). Defaults to the
|
|
54
|
+
* `xFormatter`, so give it its own formatter when the times are formatted as something that isn't
|
|
55
|
+
* a duration, such as the time of day
|
|
56
|
+
*/
|
|
57
|
+
intervalFormatter?: (interval: number) => string
|
|
58
|
+
/** the style of the tooltip */
|
|
96
59
|
style?: Partial<TooltipStyle>
|
|
97
60
|
}
|
|
98
61
|
|
|
62
|
+
// the size of the tooltip's sparkline (of the spikes' values over the window)
|
|
63
|
+
const SPARKLINE_WIDTH = 180
|
|
64
|
+
const SPARKLINE_HEIGHT = 36
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The data needed to render the tooltip's content, captured when the mouse moves over an element
|
|
68
|
+
*/
|
|
69
|
+
interface RasterTooltipContent {
|
|
70
|
+
seriesName: string
|
|
71
|
+
spikeTime: number
|
|
72
|
+
value: number
|
|
73
|
+
// statistics of the series' spikes in the window (the data the chart holds)
|
|
74
|
+
statistics: SeriesStatistics | undefined
|
|
75
|
+
// the spikes' values over the window, when there are enough of them to draw
|
|
76
|
+
sparkline: Sparkline | undefined
|
|
77
|
+
// the spike's row's axis (the tooltip is centered on the row)
|
|
78
|
+
axis: OrdinalStringAxis
|
|
79
|
+
}
|
|
80
|
+
|
|
99
81
|
/**
|
|
100
|
-
* Adds tooltip content that shows the series name
|
|
82
|
+
* Adds tooltip content that shows the series name, the (time, value) of the selected spike, the
|
|
83
|
+
* statistics of the series' spikes in the window of data the chart holds (their count, the mean
|
|
84
|
+
* and standard deviation of their values, and the mean time between them), and a sparkline of
|
|
85
|
+
* their values over the window, with the selected spike marked.
|
|
101
86
|
* ```
|
|
102
87
|
* series name
|
|
103
88
|
* time, value
|
|
89
|
+
* statistics
|
|
90
|
+
* sparkline
|
|
104
91
|
* ```
|
|
105
92
|
*
|
|
106
|
-
*
|
|
107
|
-
* event on a series. The content provider is returns the {@link addTooltipContent} function
|
|
108
|
-
* when called. And when called the {@link addTooltipContent} function adds the actual tooltip
|
|
109
|
-
* content to the SVG element.
|
|
93
|
+
* Built on {@link TooltipContent}; put it inside a {@link Tooltip}.
|
|
110
94
|
* @param props The properties describing the tooltip content
|
|
111
|
-
* @return null
|
|
95
|
+
* @return The tooltip's portal, or `null` when nothing is being hovered
|
|
112
96
|
*/
|
|
113
|
-
export function RasterPlotTooltipContent(props: Props): null {
|
|
114
|
-
const {
|
|
115
|
-
|
|
116
|
-
container,
|
|
117
|
-
tooltip,
|
|
118
|
-
axes
|
|
119
|
-
} = useChart<Datum, SeriesLineStyle, NoTooltipMetadata, ContinuousAxisRange, OrdinalStringAxis>()
|
|
120
|
-
|
|
121
|
-
const {registerTooltipContentProvider} = tooltip
|
|
122
|
-
|
|
123
|
-
const {
|
|
124
|
-
yAxesState,
|
|
125
|
-
axisAssignmentsFor
|
|
126
|
-
} = axes
|
|
127
|
-
|
|
97
|
+
export function RasterPlotTooltipContent(props: Props): ReactElement | null {
|
|
98
|
+
const {axes} = useChart<Datum, SeriesLineStyle, Partial<RasterTooltipMetadata>, ContinuousAxisRange, OrdinalStringAxis>()
|
|
99
|
+
const {yAxesState, axisAssignmentsFor} = axes
|
|
128
100
|
const {margin, plotDimensions} = usePlotDimensions()
|
|
129
101
|
|
|
130
102
|
const {
|
|
131
103
|
xFormatter = formatTime,
|
|
132
104
|
yFormatter = formatValue,
|
|
105
|
+
intervalFormatter = xFormatter,
|
|
133
106
|
style,
|
|
134
107
|
} = props
|
|
135
108
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
109
|
+
return (
|
|
110
|
+
<TooltipContent<Datum, Partial<RasterTooltipMetadata>, RasterTooltipContent>
|
|
111
|
+
style={style}
|
|
112
|
+
capture={(seriesName, _time, tooltipData) => {
|
|
113
|
+
const yAxisId = axisAssignmentsFor(seriesName).yAxis
|
|
114
|
+
const axis = yAxesState
|
|
115
|
+
.axisFor(yAxisId)
|
|
116
|
+
.getOrThrow(() => new Error(`No assigned y-axis exists; axis_id: ${yAxisId}`))
|
|
117
|
+
return captureTooltipContent(seriesName, tooltipData.series[0], tooltipData.metadata.spikes, axis)
|
|
118
|
+
}}
|
|
119
|
+
// (vertically, the tooltip is centered on the spike's row, rather than placed below the mouse)
|
|
120
|
+
topFor={(content, height) =>
|
|
121
|
+
categoryTooltipY(content.seriesName, height, content.axis, margin, content.axis.scale.bandwidth(), plotDimensions)
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
{(tooltipContent, tooltipStyle) => <>
|
|
125
|
+
<div style={{fontSize: tooltipStyle.fontSize, fontWeight: tooltipStyle.fontWeight}}>
|
|
126
|
+
{tooltipContent.seriesName}
|
|
127
|
+
</div>
|
|
128
|
+
<div style={{fontSize: tooltipStyle.fontSize + 2, fontWeight: tooltipStyle.fontWeight + 150}}>
|
|
129
|
+
{xFormatter(tooltipContent.spikeTime)}, {yFormatter(tooltipContent.value)}
|
|
130
|
+
</div>
|
|
131
|
+
{/* the series' spikes over the window (the data the chart holds) */}
|
|
132
|
+
{tooltipContent.statistics !== undefined && tooltipContent.statistics.count > 0 &&
|
|
133
|
+
// (sized to its content, rather than the app's default full-width tables, so that
|
|
134
|
+
// the values sit next to their labels)
|
|
135
|
+
<table style={{fontSize: tooltipStyle.fontSize, borderCollapse: 'collapse', border: 'none', marginTop: 6, width: 'auto'}}>
|
|
136
|
+
<tbody>
|
|
137
|
+
{[
|
|
138
|
+
['Spikes', formatNumber(tooltipContent.statistics.count, " ,.0f")],
|
|
139
|
+
['Mean value', valueOrMissing(tooltipContent.statistics.meanValue, yFormatter)],
|
|
140
|
+
['Std. deviation', valueOrMissing(tooltipContent.statistics.valueStandardDeviation, yFormatter)],
|
|
141
|
+
['Mean interval', valueOrMissing(tooltipContent.statistics.meanInterval, intervalFormatter)],
|
|
142
|
+
].map(([label, value]) => (
|
|
143
|
+
<tr key={label}>
|
|
144
|
+
<td style={{padding: '1px 12px 1px 0', textAlign: 'left', border: 'none'}}>{label}</td>
|
|
145
|
+
<td style={{padding: '1px 0', textAlign: 'right', border: 'none'}}>{value}</td>
|
|
146
|
+
</tr>
|
|
147
|
+
))}
|
|
148
|
+
</tbody>
|
|
149
|
+
</table>
|
|
155
150
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
151
|
+
{/* the spikes' values over the window, with the hovered spike marked (the dot) */}
|
|
152
|
+
{tooltipContent.sparkline !== undefined &&
|
|
153
|
+
<svg
|
|
154
|
+
width={SPARKLINE_WIDTH}
|
|
155
|
+
height={SPARKLINE_HEIGHT}
|
|
156
|
+
style={{display: 'block', marginTop: 8}}
|
|
157
|
+
aria-hidden="true"
|
|
158
|
+
>
|
|
159
|
+
<path
|
|
160
|
+
d={tooltipContent.sparkline.path}
|
|
161
|
+
fill="none"
|
|
162
|
+
stroke={tooltipStyle.fontColor}
|
|
163
|
+
strokeWidth={1.25}
|
|
164
|
+
strokeLinejoin="round"
|
|
165
|
+
strokeLinecap="round"
|
|
166
|
+
/>
|
|
167
|
+
{tooltipContent.sparkline.mark !== undefined &&
|
|
168
|
+
<circle
|
|
169
|
+
cx={tooltipContent.sparkline.mark[0]}
|
|
170
|
+
cy={tooltipContent.sparkline.mark[1]}
|
|
171
|
+
r={2.5}
|
|
172
|
+
fill={tooltipStyle.fontColor}
|
|
173
|
+
/>
|
|
174
|
+
}
|
|
175
|
+
</svg>
|
|
181
176
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
[
|
|
186
|
-
chartId, container, margin, plotDimensions, registerTooltipContentProvider,
|
|
187
|
-
xFormatter,
|
|
188
|
-
yFormatter,
|
|
189
|
-
tooltipStyle,
|
|
190
|
-
yAxesState, axisAssignmentsFor
|
|
191
|
-
]
|
|
177
|
+
</>}
|
|
178
|
+
</TooltipContent>
|
|
192
179
|
)
|
|
193
|
-
|
|
194
|
-
return null
|
|
195
180
|
}
|
|
196
181
|
|
|
197
182
|
/**
|
|
198
|
-
*
|
|
183
|
+
* Captures the data needed to render the tooltip content: the selected spike, and the statistics
|
|
184
|
+
* and sparkline of the series' spikes
|
|
199
185
|
* @param seriesName The name of the series (i.e. the neuron ID)
|
|
200
|
-
* @param
|
|
201
|
-
* @param
|
|
202
|
-
* @param mouseCoords The coordinates of the mouse when the event was fired (relative to the plot container)
|
|
203
|
-
* @param chartId The ID of this chart
|
|
204
|
-
* @param container The plot container (SVGSVGElement)
|
|
205
|
-
* @param margin The plot margins
|
|
206
|
-
* @param tooltipStyle The style properties for the tooltip
|
|
186
|
+
* @param selected The selected datum (time, value), or `undefined` (in which case there's no tooltip)
|
|
187
|
+
* @param spikes All the series' spikes in the window (for the statistics and the sparkline), when known
|
|
207
188
|
* @param axis The category axis to which the time-series is associated
|
|
208
|
-
* @
|
|
209
|
-
* @param options The options passed through the the function that adds the tooltip content
|
|
210
|
-
* @return The width and text height of the tooltip content
|
|
189
|
+
* @return The tooltip's content, or `undefined` when there's no selected spike
|
|
211
190
|
*/
|
|
212
|
-
function
|
|
191
|
+
function captureTooltipContent(
|
|
213
192
|
seriesName: string,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
mouseCoords: [x: number, y: number],
|
|
217
|
-
chartId: number,
|
|
218
|
-
container: SVGSVGElement,
|
|
219
|
-
margin: Margin,
|
|
220
|
-
plotDimensions: Dimensions,
|
|
221
|
-
tooltipStyle: TooltipStyle,
|
|
193
|
+
selected: Datum | undefined,
|
|
194
|
+
spikes: Series<Datum> | undefined,
|
|
222
195
|
axis: OrdinalStringAxis,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
.
|
|
237
|
-
|
|
238
|
-
.text(() => seriesName)
|
|
239
|
-
|
|
240
|
-
// display the time (ms) and spike strength (mV) in the tooltip
|
|
241
|
-
const text = d3.select<SVGSVGElement | null, any>(container)
|
|
242
|
-
.append<SVGTextElement>("text")
|
|
243
|
-
.attr('id', `t${spikeTime}-${seriesName}-${chartId}`)
|
|
244
|
-
.attr('class', 'tooltip')
|
|
245
|
-
.attr('fill', tooltipStyle.fontColor)
|
|
246
|
-
.attr('font-family', 'sans-serif')
|
|
247
|
-
.attr('font-size', tooltipStyle.fontSize + 2)
|
|
248
|
-
.attr('font-weight', tooltipStyle.fontWeight + 150)
|
|
249
|
-
.text(() => `${formatters.x(spikeTime)}, ${formatters.y(value)}`)
|
|
250
|
-
|
|
251
|
-
// calculate the max width and height of the text
|
|
252
|
-
const tooltipWidth = Math.max(header.node()?.getBBox()?.width || 0, text.node()?.getBBox()?.width || 0);
|
|
253
|
-
const headerTextHeight = header.node()?.getBBox()?.height || 0;
|
|
254
|
-
const idHeight = text.node()?.getBBox()?.height || 0;
|
|
255
|
-
const textHeight = headerTextHeight + idHeight;
|
|
256
|
-
|
|
257
|
-
// set the header text location
|
|
258
|
-
// const spikeHeight = plotDimensions.height / liveDataRef.current.size
|
|
259
|
-
const xCoord = tooltipX(x, tooltipWidth, plotDimensions, tooltipStyle, margin)
|
|
260
|
-
const yCoord = categoryTooltipY(seriesName, textHeight, axis, tooltipStyle, margin, axis.scale.bandwidth(), plotDimensions)
|
|
261
|
-
const xTooltip = xCoord + tooltipStyle.paddingLeft
|
|
262
|
-
const yTooltip = yCoord + tooltipStyle.paddingTop
|
|
263
|
-
header
|
|
264
|
-
.attr('x', () => xTooltip)
|
|
265
|
-
.attr('y', () => yTooltip - idHeight + textHeight)
|
|
266
|
-
|
|
267
|
-
// set the tooltip text (i.e. neuron ID) location
|
|
268
|
-
text
|
|
269
|
-
.attr('x', () => xTooltip)
|
|
270
|
-
.attr('y', () => yTooltip + textHeight)
|
|
196
|
+
): RasterTooltipContent | undefined {
|
|
197
|
+
// `selected` comes from the caller's `tooltipData.series[0]` -- this component is a public,
|
|
198
|
+
// independently-usable tooltip-content provider, and `TooltipData.series: Series<D>` permits
|
|
199
|
+
// an empty array, so guard here rather than relying on every caller to have already checked
|
|
200
|
+
// (RasterPlot.tsx's own mousemove handler does today, but that shouldn't be the only thing
|
|
201
|
+
// standing between an empty series and a destructuring crash below)
|
|
202
|
+
if (selected === undefined) return undefined
|
|
203
|
+
|
|
204
|
+
const {x: spikeTime, y} = selected
|
|
205
|
+
|
|
206
|
+
// the spikes' statistics, and their values over time, over the window (the data the chart holds)
|
|
207
|
+
const spikeValues: Array<{ time: number, value: number }> = []
|
|
208
|
+
if (spikes !== undefined) {
|
|
209
|
+
for (let i = 0; i < spikes.length; i++) spikeValues.push({time: spikes[i].x, value: spikes[i].y})
|
|
210
|
+
}
|
|
271
211
|
|
|
272
|
-
return {
|
|
212
|
+
return {
|
|
213
|
+
seriesName,
|
|
214
|
+
spikeTime,
|
|
215
|
+
value: y,
|
|
216
|
+
statistics: spikes !== undefined ? seriesStatistics(spikes) : undefined,
|
|
217
|
+
sparkline: sparklineFor(spikeValues, SPARKLINE_WIDTH, SPARKLINE_HEIGHT, 2, undefined, spikeTime),
|
|
218
|
+
axis,
|
|
219
|
+
}
|
|
273
220
|
}
|