stream-charts 1.0.1 → 1.1.1
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/README.md +757 -342
- package/changes.md +11 -0
- package/dist/src/app/charts/Chart.d.ts +116 -87
- package/dist/src/app/charts/Chart.js +96 -101
- package/dist/src/app/charts/Chart.js.map +1 -1
- package/dist/src/app/charts/axes/AxesState.d.ts +64 -0
- package/dist/src/app/charts/axes/AxesState.js +97 -0
- package/dist/src/app/charts/axes/AxesState.js.map +1 -0
- package/dist/src/app/charts/axes/AxesState.test.js +30 -0
- package/dist/src/app/charts/axes/AxesState.test.js.map +1 -0
- package/dist/src/app/charts/axes/AxisInterval.d.ts +92 -0
- package/dist/src/app/charts/axes/AxisInterval.js +126 -0
- package/dist/src/app/charts/axes/AxisInterval.js.map +1 -0
- package/dist/src/app/charts/axes/AxisInterval.test.js +120 -0
- package/dist/src/app/charts/axes/AxisInterval.test.js.map +1 -0
- package/dist/src/app/charts/axes/BaseAxisRange.d.ts +83 -0
- package/dist/src/app/charts/axes/BaseAxisRange.js +58 -0
- package/dist/src/app/charts/axes/BaseAxisRange.js.map +1 -0
- package/dist/src/app/charts/axes/ContinuousAxis.d.ts +22 -0
- package/dist/src/app/charts/axes/ContinuousAxis.js +96 -0
- package/dist/src/app/charts/axes/ContinuousAxis.js.map +1 -0
- package/dist/src/app/charts/axes/ContinuousAxisRange.d.ts +59 -0
- package/dist/src/app/charts/axes/ContinuousAxisRange.js +84 -0
- package/dist/src/app/charts/axes/ContinuousAxisRange.js.map +1 -0
- package/dist/src/app/charts/axes/ContinuousAxisRange.test.js +47 -0
- package/dist/src/app/charts/axes/ContinuousAxisRange.test.js.map +1 -0
- package/dist/src/app/charts/axes/OrdinalAxis.d.ts +23 -0
- package/dist/src/app/charts/axes/OrdinalAxis.js +124 -0
- package/dist/src/app/charts/axes/OrdinalAxis.js.map +1 -0
- package/dist/src/app/charts/axes/OrdinalAxisRange.d.ts +69 -0
- package/dist/src/app/charts/axes/OrdinalAxisRange.js +100 -0
- package/dist/src/app/charts/axes/OrdinalAxisRange.js.map +1 -0
- package/dist/src/app/charts/axes/OrdinalAxisRange.test.js +48 -0
- package/dist/src/app/charts/axes/OrdinalAxisRange.test.js.map +1 -0
- package/dist/src/app/charts/axes/axes.d.ts +391 -0
- package/dist/src/app/charts/axes/axes.js +1046 -0
- package/dist/src/app/charts/axes/axes.js.map +1 -0
- package/dist/src/app/charts/d3types.d.ts +10 -10
- package/dist/src/app/charts/filters/regexFilter.d.ts +9 -0
- package/dist/src/app/charts/filters/regexFilter.js +18 -0
- package/dist/src/app/charts/filters/regexFilter.js.map +1 -0
- package/dist/src/app/charts/filters/regexFilter.test.d.ts +1 -0
- package/dist/src/app/charts/filters/regexFilter.test.js +11 -0
- package/dist/src/app/charts/filters/regexFilter.test.js.map +1 -0
- package/dist/src/app/charts/hooks/useAxes.d.ts +144 -0
- package/dist/src/app/charts/hooks/useAxes.js +187 -0
- package/dist/src/app/charts/hooks/useAxes.js.map +1 -0
- package/dist/src/app/charts/hooks/useChart.d.ts +30 -201
- package/dist/src/app/charts/hooks/useChart.js +33 -134
- package/dist/src/app/charts/hooks/useChart.js.map +1 -1
- package/dist/src/app/charts/hooks/useDataObservable.d.ts +74 -0
- package/dist/src/app/charts/hooks/useDataObservable.js +76 -0
- package/dist/src/app/charts/hooks/useDataObservable.js.map +1 -0
- package/dist/src/app/charts/hooks/useInitialData.d.ts +38 -0
- package/dist/src/app/charts/hooks/useInitialData.js +29 -0
- package/dist/src/app/charts/hooks/useInitialData.js.map +1 -0
- package/dist/src/app/charts/hooks/useMouse.d.ts +53 -0
- package/dist/src/app/charts/hooks/useMouse.js +65 -0
- package/dist/src/app/charts/hooks/useMouse.js.map +1 -0
- package/dist/src/app/charts/hooks/usePlotDimensions.d.ts +34 -0
- package/dist/src/app/charts/hooks/usePlotDimensions.js +73 -0
- package/dist/src/app/charts/hooks/usePlotDimensions.js.map +1 -0
- package/dist/src/app/charts/hooks/useTooltip.d.ts +64 -0
- package/dist/src/app/charts/hooks/useTooltip.js +52 -0
- package/dist/src/app/charts/hooks/useTooltip.js.map +1 -0
- package/dist/src/app/charts/observables/ChartData.d.ts +23 -0
- package/dist/src/app/charts/observables/ChartData.js +20 -0
- package/dist/src/app/charts/observables/ChartData.js.map +1 -0
- package/dist/src/app/charts/observables/iterates.d.ts +52 -0
- package/dist/src/app/charts/observables/iterates.js +121 -0
- package/dist/src/app/charts/observables/iterates.js.map +1 -0
- package/dist/src/app/charts/observables/iterates.test.d.ts +1 -0
- package/dist/src/app/charts/observables/iterates.test.js +180 -0
- package/dist/src/app/charts/observables/iterates.test.js.map +1 -0
- package/dist/src/app/charts/observables/ordinals.d.ts +75 -0
- package/dist/src/app/charts/observables/ordinals.js +141 -0
- package/dist/src/app/charts/observables/ordinals.js.map +1 -0
- package/dist/src/app/charts/observables/ordinals.test.d.ts +1 -0
- package/dist/src/app/charts/observables/ordinals.test.js +102 -0
- package/dist/src/app/charts/observables/ordinals.test.js.map +1 -0
- package/dist/src/app/charts/plots/BarPlot.d.ts +81 -0
- package/dist/src/app/charts/plots/BarPlot.js +557 -0
- package/dist/src/app/charts/plots/BarPlot.js.map +1 -0
- package/dist/src/app/charts/plots/PoincarePlot.d.ts +78 -0
- package/dist/src/app/charts/plots/PoincarePlot.js +504 -0
- package/dist/src/app/charts/plots/PoincarePlot.js.map +1 -0
- package/dist/src/app/charts/{RasterPlot.d.ts → plots/RasterPlot.d.ts} +1 -1
- package/dist/src/app/charts/{RasterPlot.js → plots/RasterPlot.js} +152 -133
- package/dist/src/app/charts/plots/RasterPlot.js.map +1 -0
- package/dist/src/app/charts/{ScatterPlot.d.ts → plots/ScatterPlot.d.ts} +10 -8
- package/dist/src/app/charts/plots/ScatterPlot.js +379 -0
- package/dist/src/app/charts/plots/ScatterPlot.js.map +1 -0
- package/dist/src/app/charts/{plot.d.ts → plots/plot.d.ts} +12 -14
- package/dist/src/app/charts/{plot.js → plots/plot.js} +19 -17
- package/dist/src/app/charts/plots/plot.js.map +1 -0
- package/dist/src/app/charts/series/baseSeries.d.ts +38 -0
- package/dist/src/app/charts/series/baseSeries.js +36 -0
- package/dist/src/app/charts/series/baseSeries.js.map +1 -0
- package/dist/src/app/charts/series/datumSeries.test.d.ts +1 -0
- package/dist/src/app/charts/series/datumSeries.test.js +50 -0
- package/dist/src/app/charts/series/datumSeries.test.js.map +1 -0
- package/dist/src/app/charts/series/iterateSeries.d.ts +42 -0
- package/dist/src/app/charts/series/iterateSeries.js +34 -0
- package/dist/src/app/charts/series/iterateSeries.js.map +1 -0
- package/dist/src/app/charts/series/ordinalSeries.d.ts +54 -0
- package/dist/src/app/charts/series/ordinalSeries.js +98 -0
- package/dist/src/app/charts/series/ordinalSeries.js.map +1 -0
- package/dist/src/app/charts/series/timeSeries.d.ts +30 -0
- package/dist/src/app/charts/series/timeSeries.js +19 -0
- package/dist/src/app/charts/series/timeSeries.js.map +1 -0
- package/dist/src/app/charts/{chartData.d.ts → series/timeSeriesChartData.d.ts} +11 -6
- package/dist/src/app/charts/series/timeSeriesChartData.js +32 -0
- package/dist/src/app/charts/series/timeSeriesChartData.js.map +1 -0
- package/dist/src/app/charts/styling/barPlotStyle.d.ts +41 -0
- package/dist/src/app/charts/styling/barPlotStyle.js +84 -0
- package/dist/src/app/charts/styling/barPlotStyle.js.map +1 -0
- package/dist/src/app/charts/{margins.d.ts → styling/margins.d.ts} +7 -5
- package/dist/src/app/charts/{margins.js → styling/margins.js} +19 -9
- package/dist/src/app/charts/styling/margins.js.map +1 -0
- package/dist/src/app/charts/styling/margins.test.d.ts +1 -0
- package/dist/src/app/charts/styling/margins.test.js +19 -0
- package/dist/src/app/charts/styling/margins.test.js.map +1 -0
- package/dist/src/app/charts/styling/svgStyle.d.ts +76 -0
- package/dist/src/app/charts/styling/svgStyle.js +84 -0
- package/dist/src/app/charts/styling/svgStyle.js.map +1 -0
- package/dist/src/app/charts/subscriptions/subscription.test.d.ts +1 -0
- package/dist/src/app/charts/subscriptions/subscription.test.js +395 -0
- package/dist/src/app/charts/subscriptions/subscription.test.js.map +1 -0
- package/dist/src/app/charts/subscriptions/subscriptions.d.ts +100 -0
- package/dist/src/app/charts/subscriptions/subscriptions.js +449 -0
- package/dist/src/app/charts/subscriptions/subscriptions.js.map +1 -0
- package/dist/src/app/charts/tooltips/BarPlotTooltipContent.d.ts +90 -0
- package/dist/src/app/charts/tooltips/BarPlotTooltipContent.js +302 -0
- package/dist/src/app/charts/tooltips/BarPlotTooltipContent.js.map +1 -0
- package/dist/src/app/charts/tooltips/PoincarePlotTooltipContent.d.ts +100 -0
- package/dist/src/app/charts/tooltips/PoincarePlotTooltipContent.js +190 -0
- package/dist/src/app/charts/tooltips/PoincarePlotTooltipContent.js.map +1 -0
- package/dist/src/app/charts/{RasterPlotTooltipContent.js → tooltips/RasterPlotTooltipContent.js} +40 -44
- package/dist/src/app/charts/tooltips/RasterPlotTooltipContent.js.map +1 -0
- package/dist/src/app/charts/tooltips/ScatterPlotTooltipContent.js +154 -0
- package/dist/src/app/charts/tooltips/ScatterPlotTooltipContent.js.map +1 -0
- package/dist/src/app/charts/{Tooltip.d.ts → tooltips/Tooltip.d.ts} +4 -2
- package/dist/src/app/charts/{Tooltip.js → tooltips/Tooltip.js} +23 -28
- package/dist/src/app/charts/tooltips/Tooltip.js.map +1 -0
- package/dist/src/app/charts/{tooltipUtils.d.ts → tooltips/tooltipUtils.d.ts} +11 -6
- package/dist/src/app/charts/{tooltipUtils.js → tooltips/tooltipUtils.js} +33 -17
- package/dist/src/app/charts/tooltips/tooltipUtils.js.map +1 -0
- package/dist/src/app/charts/{Tracker.d.ts → trackers/Tracker.d.ts} +6 -5
- package/dist/src/app/charts/trackers/Tracker.js +60 -0
- package/dist/src/app/charts/trackers/Tracker.js.map +1 -0
- package/dist/src/app/charts/{trackerUtils.d.ts → trackers/trackerUtils.d.ts} +13 -8
- package/dist/src/app/charts/trackers/trackerUtils.js +359 -0
- package/dist/src/app/charts/trackers/trackerUtils.js.map +1 -0
- package/dist/src/app/charts/utils.d.ts +22 -32
- package/dist/src/app/charts/utils.js +36 -37
- package/dist/src/app/charts/utils.js.map +1 -1
- package/dist/src/index.d.ts +48 -15
- package/dist/src/index.js +71 -15
- package/dist/src/index.js.map +1 -1
- package/package.json +30 -20
- package/src/app/charts/Chart.tsx +334 -0
- package/src/app/charts/axes/AxesState.test.ts +34 -0
- package/src/app/charts/axes/AxesState.ts +112 -0
- package/src/app/charts/axes/AxisInterval.test.ts +143 -0
- package/src/app/charts/axes/AxisInterval.ts +139 -0
- package/src/app/charts/axes/BaseAxisRange.ts +113 -0
- package/src/app/charts/axes/ContinuousAxis.tsx +192 -0
- package/src/app/charts/axes/ContinuousAxisRange.test.ts +55 -0
- package/src/app/charts/axes/ContinuousAxisRange.ts +96 -0
- package/src/app/charts/axes/OrdinalAxis.tsx +223 -0
- package/src/app/charts/axes/OrdinalAxisRange.test.ts +55 -0
- package/src/app/charts/axes/OrdinalAxisRange.ts +112 -0
- package/src/app/charts/axes/axes.ts +1569 -0
- package/src/app/charts/d3types.ts +16 -0
- package/src/app/charts/filters/regexFilter.test.ts +13 -0
- package/src/app/charts/filters/regexFilter.ts +17 -0
- package/src/app/charts/hooks/useAxes.tsx +341 -0
- package/src/app/charts/hooks/useChart.tsx +159 -0
- package/src/app/charts/hooks/useDataObservable.tsx +175 -0
- package/src/app/charts/hooks/useInitialData.tsx +65 -0
- package/src/app/charts/hooks/useMouse.tsx +125 -0
- package/src/app/charts/hooks/usePlotDimensions.tsx +120 -0
- package/src/app/charts/hooks/useTooltip.tsx +112 -0
- package/src/app/charts/observables/ChartData.ts +31 -0
- package/src/app/charts/observables/iterates.test.ts +201 -0
- package/src/app/charts/observables/iterates.ts +203 -0
- package/src/app/charts/observables/ordinals.test.ts +135 -0
- package/src/app/charts/observables/ordinals.ts +248 -0
- package/src/app/charts/plots/BarPlot.tsx +1088 -0
- package/src/app/charts/plots/PoincarePlot.tsx +832 -0
- package/src/app/charts/plots/RasterPlot.tsx +676 -0
- package/src/app/charts/plots/ScatterPlot.tsx +653 -0
- package/src/app/charts/plots/plot.ts +75 -0
- package/src/app/charts/series/baseSeries.ts +52 -0
- package/src/app/charts/series/datumSeries.test.ts +60 -0
- package/src/app/charts/series/iterateSeries.ts +56 -0
- package/src/app/charts/series/ordinalSeries.ts +164 -0
- package/src/app/charts/series/timeSeries.ts +40 -0
- package/src/app/charts/series/timeSeriesChartData.ts +68 -0
- package/src/app/charts/styling/barPlotStyle.ts +126 -0
- package/src/app/charts/styling/margins.test.ts +22 -0
- package/src/app/charts/styling/margins.ts +58 -0
- package/src/app/charts/styling/svgStyle.ts +118 -0
- package/src/app/charts/subscriptions/subscription.test.ts +499 -0
- package/src/app/charts/subscriptions/subscriptions.ts +635 -0
- package/src/app/charts/tooltips/BarPlotTooltipContent.tsx +440 -0
- package/src/app/charts/tooltips/PoincarePlotTooltipContent.tsx +352 -0
- package/src/app/charts/tooltips/RasterPlotTooltipContent.tsx +274 -0
- package/src/app/charts/tooltips/ScatterPlotTooltipContent.tsx +319 -0
- package/src/app/charts/tooltips/Tooltip.tsx +148 -0
- package/src/app/charts/tooltips/tooltipUtils.ts +216 -0
- package/src/app/charts/trackers/Tracker.tsx +129 -0
- package/src/app/charts/trackers/trackerUtils.ts +494 -0
- package/src/app/charts/utils.ts +109 -0
- package/dist/src/app/charts/CategoryAxis.d.ts +0 -20
- package/dist/src/app/charts/CategoryAxis.js +0 -112
- package/dist/src/app/charts/CategoryAxis.js.map +0 -1
- package/dist/src/app/charts/ContinuousAxis.d.ts +0 -16
- package/dist/src/app/charts/ContinuousAxis.js +0 -186
- package/dist/src/app/charts/ContinuousAxis.js.map +0 -1
- package/dist/src/app/charts/RasterPlot.js.map +0 -1
- package/dist/src/app/charts/RasterPlotTooltipContent.js.map +0 -1
- package/dist/src/app/charts/ScatterPlot.js +0 -351
- package/dist/src/app/charts/ScatterPlot.js.map +0 -1
- package/dist/src/app/charts/ScatterPlotTooltipContent.js +0 -163
- package/dist/src/app/charts/ScatterPlotTooltipContent.js.map +0 -1
- package/dist/src/app/charts/Tooltip.js.map +0 -1
- package/dist/src/app/charts/Tracker.js +0 -65
- package/dist/src/app/charts/Tracker.js.map +0 -1
- package/dist/src/app/charts/axes.d.ts +0 -132
- package/dist/src/app/charts/axes.js +0 -265
- package/dist/src/app/charts/axes.js.map +0 -1
- package/dist/src/app/charts/chartData.js +0 -32
- package/dist/src/app/charts/chartData.js.map +0 -1
- package/dist/src/app/charts/continuousAxisRangeFor.d.ts +0 -20
- package/dist/src/app/charts/continuousAxisRangeFor.js +0 -68
- package/dist/src/app/charts/continuousAxisRangeFor.js.map +0 -1
- package/dist/src/app/charts/datumSeries.d.ts +0 -59
- package/dist/src/app/charts/datumSeries.js +0 -55
- package/dist/src/app/charts/datumSeries.js.map +0 -1
- package/dist/src/app/charts/datumSeries.test.js +0 -50
- package/dist/src/app/charts/datumSeries.test.js.map +0 -1
- package/dist/src/app/charts/hooks/AxesState.d.ts +0 -37
- package/dist/src/app/charts/hooks/AxesState.js +0 -44
- package/dist/src/app/charts/hooks/AxesState.js.map +0 -1
- package/dist/src/app/charts/margins.js.map +0 -1
- package/dist/src/app/charts/margins.test.js +0 -14
- package/dist/src/app/charts/margins.test.js.map +0 -1
- package/dist/src/app/charts/plot.js.map +0 -1
- package/dist/src/app/charts/regexFilter.d.ts +0 -9
- package/dist/src/app/charts/regexFilter.js +0 -17
- package/dist/src/app/charts/regexFilter.js.map +0 -1
- package/dist/src/app/charts/regexFilter.test.js +0 -11
- package/dist/src/app/charts/regexFilter.test.js.map +0 -1
- package/dist/src/app/charts/subscriptions.d.ts +0 -43
- package/dist/src/app/charts/subscriptions.js +0 -213
- package/dist/src/app/charts/subscriptions.js.map +0 -1
- package/dist/src/app/charts/svgStyle.d.ts +0 -27
- package/dist/src/app/charts/svgStyle.js +0 -32
- package/dist/src/app/charts/svgStyle.js.map +0 -1
- package/dist/src/app/charts/timeRange.test.js +0 -54
- package/dist/src/app/charts/timeRange.test.js.map +0 -1
- package/dist/src/app/charts/tooltipUtils.js.map +0 -1
- package/dist/src/app/charts/trackerUtils.js +0 -130
- package/dist/src/app/charts/trackerUtils.js.map +0 -1
- /package/dist/src/app/charts/{datumSeries.test.d.ts → axes/AxesState.test.d.ts} +0 -0
- /package/dist/src/app/charts/{margins.test.d.ts → axes/AxisInterval.test.d.ts} +0 -0
- /package/dist/src/app/charts/{regexFilter.test.d.ts → axes/ContinuousAxisRange.test.d.ts} +0 -0
- /package/dist/src/app/charts/{timeRange.test.d.ts → axes/OrdinalAxisRange.test.d.ts} +0 -0
- /package/dist/src/app/charts/{RasterPlotTooltipContent.d.ts → tooltips/RasterPlotTooltipContent.d.ts} +0 -0
- /package/dist/src/app/charts/{ScatterPlotTooltipContent.d.ts → tooltips/ScatterPlotTooltipContent.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -4,76 +4,116 @@
|
|
|
4
4
|
[Change History](changes.md) •
|
|
5
5
|
[Example Project](https://github.com/robphilipp/stream-charts-examples)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## [⤒](#top) <span id="intro">intro</span>
|
|
8
|
+
`stream-charts` is a [react](https://reactjs.org)-based library for building real-time time-series charts for viewing high frequency data. Ingesting and plotting new data for about 100 time-series every 25 ms isn't generally a problem.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
The following plot types are currently available:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
1. **Scatter Plot**: for plotting time-series data.
|
|
13
|
+
2. **Raster Plot**: for plotting event-timing data.
|
|
14
|
+
3. **Bar Plot**: for plotting time-series as bars that show the current value and its minimum, maximum, and mean values for all times and time-windows.
|
|
15
|
+
4. **Poincare Plot**: for plotting function iterates (`f[n](t)` vs `f[n-m](t)`).
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
> Try it on codesandbox [stream-charts](https://codesandbox.io/p/sandbox/n7c8jm)
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
`Charts` are composable using react components. So you can add different axis types, multiple axes, trackers, tooltips, and plots. `stream-charts` provides the following react components from which to build your own charts:
|
|
20
|
+
1. The [Chart](#chart-usage) serves as the container, holding the other components as children, and providing the data to the plot.
|
|
21
|
+
2. The [ContinuousAxis](#continuous-axes-usage) and [OrdinalAxis](#ordinal-axes-usage) components define the x- and y-axes, and provide the scales for the axes. Charts are required to have at least one x-axis and one y-axis.
|
|
22
|
+
3. The optional [Tracker](#tracker-usage) component shows the value associated with the current mouse location of the axes to which it is assigned.
|
|
23
|
+
4. The optional [Tooltip](#tooltip-usage) component shows the `TooltipContent` for the datum under the mouse cursor. Each plot type has a default tooltip content component ([ScatterPlotTooltipContent](#scatterplot-tooltip-usage), [RasterPlotTooltipContent](#rasterplot-tooltip-usage), [BarPlotTooltipContent](#barplot-tooltip-usage), [PoincarePlotTooltipContent](#poincareplot-tooltip-usage)).
|
|
24
|
+
5. The `Plot` component displays the data. Currently, there are four plot components: [ScatterPlot](#scatter-plot-usage), [RasterPlot](#raster-plot-usage), [BarPlot](#bar-plot-usage), and [PoincarePlot](#poincare-plot-usage).
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
### [⤒](#content) <span id="axes">capabilities</span>
|
|
27
|
+
Charts can have multiple x-axes and y-axes, and these axes can have different scales. Time series can be assigned to an axis or use the default one. Currently, there are continuous and ordinal (category) axes. Continuous axes are available with all the scales supported by [d3](https://d3js.org) (for example, linear scales, logarithmic scales, and power scales).
|
|
20
28
|
|
|
21
|
-
|
|
29
|
+
Each plot type comes with a default tooltip and tooltip content. However, you can customize the tooltip and tooltip content to suit your needs.
|
|
22
30
|
|
|
31
|
+
The charts are designed to be responsive to changes in size, for example, to support window resizing.
|
|
23
32
|
|
|
24
|
-
|
|
25
|
-
Although still under development, there are two charts available:
|
|
33
|
+
With `stream-charts` you can display initial (static) data as well as live data from an [Observable](https://rxjs-dev.firebaseapp.com/api/index/class/Observable).
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
2. scatter chart.
|
|
29
|
-
|
|
30
|
-
Over time, I'll add additional chart types. In the meantime, I welcome any contributions to create new chart types (bar, gauges, etc).
|
|
31
|
-
|
|
32
|
-
## [⤒](#top) <span id="content">content</span>
|
|
35
|
+
All aspects of the `Charts` style are exposed allowing you to use your favorite frameworks theme provider, or none at all.
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
[example raster chart code](#example-raster-chart-code)<br>
|
|
36
|
-
[example scatter chart code](#example-scatter-chart-code)
|
|
37
|
+
`Charts` provide zooming and panning that can be enabled or disabled. And zooming is set to use a modifier key by default so that it doesn't interfere with normal scrolling.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[data ttl, time-windows, performance](#data-ttl)<br>
|
|
39
|
+
### [⤒](#top) <span id="content">rendering performance</span>
|
|
40
|
+
Charts can easily ingest and plot new data for about 100 time-series every 25 ms.
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
[<Chart/>](#chart-usage)<br>
|
|
44
|
-
[dimensions](#chart-usage-dimensions)<br>
|
|
45
|
-
[styling](#chart-usage-styling)<br>
|
|
46
|
-
[initial data](#chart-usage-initial-data)<br>
|
|
47
|
-
[streaming data](#chart-usage-streaming-data)<br>
|
|
42
|
+
When using lower update frequencies, such as < 250 ms, and data updates are sparse, you can set an update cadence so that the plot's time smoothly scrolls, rather than updating only when new data arrives.
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
[<ContinousAxis/>](#continuous-axes-usage)<br>
|
|
51
|
-
[base properties](#continuous-axes-usage-base)<br>
|
|
52
|
-
[styling](#continuous-axes-usage-styling)<br>
|
|
44
|
+
`Charts` can have a data TTL (time-to-live) to drop older data to allow long-running streams of data. With the data-update callback you can capture that data and store it in local storage, memory, or a location of your choice.
|
|
53
45
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
To achieve this type of performance, the charts:
|
|
47
|
+
1. accept an [rxjs](https://rxjs-dev.firebaseapp.com) [Observable](https://rxjs-dev.firebaseapp.com/api/index/class/Observable) as the source of the time-series data, and
|
|
48
|
+
2. are implemented using [d3](https://d3js.org) SVG elements wrapped in [react](https://reactjs.org) functional components, and
|
|
49
|
+
3. keep chart updates outside [react](https://reactjs.org)'s render cycle.
|
|
57
50
|
|
|
58
|
-
**[plots](#plots)**<br>
|
|
59
|
-
[<ScatterPlot/>](#scatter-plot-usage)<br>
|
|
60
|
-
[base properties](#scatter-plot-usage-base)<br>
|
|
61
|
-
[view-modifying interactions](#scatter-plot-usage-view)<br>
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
[view-modifying interactions](#raster-plot-usage-view)<br>
|
|
52
|
+
### [⤒](#top) <span id="content">project status</span>
|
|
53
|
+
The following plots are currently available:
|
|
66
54
|
|
|
67
|
-
**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
1. **Scatter Plot**: for plotting time-series data.
|
|
56
|
+
2. **Raster Plot**: for plotting event-timing data.
|
|
57
|
+
3. **Bar Plot**: for plotting windowed stats (min, max, mean).
|
|
58
|
+
4. **Poincare Plot**: for plotting iterates (n vs n-1).
|
|
71
59
|
|
|
72
|
-
|
|
60
|
+
Over time, I'll add additional chart types. In the meantime, I welcome any contributions to create new chart types (gauges, etc).
|
|
73
61
|
|
|
74
|
-
|
|
62
|
+
## [⤒](#top) <span id="content">content</span>
|
|
75
63
|
|
|
76
|
-
|
|
64
|
+
**[quick start](#quick-start)**
|
|
65
|
+
- [example raster chart code](#example-raster-chart-code)
|
|
66
|
+
- [example scatter chart code](#example-scatter-chart-code)
|
|
67
|
+
- [example bar chart code](#example-bar-chart-code)
|
|
68
|
+
- [example poincare chart code](#example-poincare-chart-code)
|
|
69
|
+
|
|
70
|
+
**[intro](#intro)**
|
|
71
|
+
- [terminology](#terminology)
|
|
72
|
+
- [data ttl, time-windows, performance](#data-ttl)
|
|
73
|
+
|
|
74
|
+
**[chart](#chart)**
|
|
75
|
+
- [<Chart/>](#chart-usage)
|
|
76
|
+
- [dimensions](#chart-usage-dimensions)
|
|
77
|
+
- [styling](#chart-usage-styling)
|
|
78
|
+
- [initial data](#chart-usage-initial-data)
|
|
79
|
+
- [streaming data](#chart-usage-streaming-data)
|
|
80
|
+
|
|
81
|
+
**[axes](#axes)**
|
|
82
|
+
- [<ContinuousAxis/>](#continuous-axes-usage)
|
|
83
|
+
- [base properties](#continuous-axes-usage-base)
|
|
84
|
+
- [styling](#continuous-axes-usage-styling)
|
|
85
|
+
|
|
86
|
+
- [<OrdinalAxis/>](#ordinal-axes-usage)
|
|
87
|
+
- [base properties](#ordinal-axes-usage-base)
|
|
88
|
+
- [styling](#ordinal-axes-usage-styling)
|
|
89
|
+
|
|
90
|
+
**[plots](#plots)**
|
|
91
|
+
- [<ScatterPlot/>](#scatter-plot-usage)
|
|
92
|
+
- [base properties](#scatter-plot-usage-base)
|
|
93
|
+
- [view-modifying interactions](#scatter-plot-usage-view)
|
|
94
|
+
|
|
95
|
+
- [<RasterPlot/>](#raster-plot-usage)
|
|
96
|
+
- [base properties](#raster-plot-usage-base)
|
|
97
|
+
- [view-modifying interactions](#raster-plot-usage-view)
|
|
98
|
+
|
|
99
|
+
- [<BarPlot/>](#bar-plot-usage)
|
|
100
|
+
- [base properties](#bar-plot-usage-base)
|
|
101
|
+
- [view-modifying interactions](#bar-plot-usage-view)
|
|
102
|
+
|
|
103
|
+
- [<PoincarePlot/>](#poincare-plot-usage)
|
|
104
|
+
- [base properties](#poincare-plot-usage-base)
|
|
105
|
+
- [view-modifying interactions](#poincare-plot-usage-view)
|
|
106
|
+
|
|
107
|
+
**[utilities](#utilities)**
|
|
108
|
+
- [<Tracker/>](#tracker-usage)
|
|
109
|
+
- [base properties](#tracker-usage-base)
|
|
110
|
+
- [styling](#tracker-usage-styling)
|
|
111
|
+
- [<Tooltip/>](#tooltip-usage)
|
|
112
|
+
- [<RasterPlotTooltipContent/>](#rasterplot-tooltip-usage)
|
|
113
|
+
- [<ScatterPlotTooltipContent/>](#scatterplot-tooltip-usage)
|
|
114
|
+
- [<BarPlotTooltipContent/>](#barplot-tooltip-usage)
|
|
115
|
+
- [<PoincarePlotTooltipContent/>](#poincareplot-tooltip-usage)
|
|
116
|
+
- [hooks](#hooks)
|
|
77
117
|
|
|
78
118
|
|
|
79
119
|
## [⤒](#content) <span id="quick-start">quick start</span>
|
|
@@ -83,66 +123,99 @@ npm install stream-charts
|
|
|
83
123
|
```
|
|
84
124
|
|
|
85
125
|
### [⤒](#content) <span id="example-raster-chart-code">example raster chart</span>
|
|
86
|
-
|
|
126
|
+
An example raster chart (see [example](https://github.com/robphilipp/stream-charts-examples/blob/master/src/app/examples/StreamingRasterChart.tsx))
|
|
87
127
|
|
|
88
|
-

|
|
89
129
|
|
|
90
130
|
|
|
91
131
|
```typescript jsx
|
|
92
|
-
import {RasterChart} from "stream-charts";
|
|
93
|
-
// .
|
|
94
|
-
// .
|
|
95
|
-
// .
|
|
96
132
|
<Chart
|
|
133
|
+
chartId={chartId.current}
|
|
97
134
|
width={useGridCellWidth()}
|
|
98
135
|
height={useGridCellHeight()}
|
|
99
|
-
margin={{...defaultMargin, top:
|
|
136
|
+
margin={{...defaultMargin, top: 40, right: 75, left: 70, bottom: 40}}
|
|
137
|
+
// svgStyle={{'background-color': 'pink'}}
|
|
100
138
|
color={theme.color}
|
|
101
139
|
backgroundColor={theme.backgroundColor}
|
|
102
140
|
seriesStyles={new Map([
|
|
103
|
-
['
|
|
104
|
-
|
|
105
|
-
color:
|
|
106
|
-
lineWidth:
|
|
107
|
-
highlightColor:
|
|
108
|
-
|
|
109
|
-
|
|
141
|
+
['neuron1', {
|
|
142
|
+
...defaultLineStyle(),
|
|
143
|
+
color: 'orange',
|
|
144
|
+
lineWidth: 2,
|
|
145
|
+
highlightColor: 'orange'
|
|
146
|
+
}],
|
|
147
|
+
['neuron2', {
|
|
148
|
+
...defaultLineStyle(),
|
|
149
|
+
color: 'orange',
|
|
150
|
+
lineWidth: 2,
|
|
151
|
+
highlightColor: 'orange'
|
|
152
|
+
}],
|
|
153
|
+
['neuron3', {
|
|
154
|
+
...defaultLineStyle(),
|
|
155
|
+
color: 'orange',
|
|
156
|
+
lineWidth: 2,
|
|
157
|
+
highlightColor: 'orange'
|
|
158
|
+
}],
|
|
159
|
+
['neuron4', {
|
|
160
|
+
...defaultLineStyle(),
|
|
161
|
+
color: 'orange',
|
|
162
|
+
lineWidth: 2,
|
|
163
|
+
highlightColor: 'orange'
|
|
164
|
+
}],
|
|
165
|
+
['neuron5', {
|
|
166
|
+
...defaultLineStyle(),
|
|
167
|
+
color: 'orange',
|
|
168
|
+
lineWidth: 2,
|
|
169
|
+
highlightColor: 'orange'
|
|
170
|
+
}],
|
|
171
|
+
['neuron6', {
|
|
172
|
+
...defaultLineStyle(),
|
|
173
|
+
color: theme.name === 'light' ? 'blue' : 'gray',
|
|
174
|
+
lineWidth: 3,
|
|
175
|
+
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
176
|
+
highlightWidth: 5
|
|
177
|
+
}],
|
|
178
|
+
// ['test3', {...defaultLineStyle, color: 'dodgerblue', lineWidth: 1, highlightColor: 'dodgerblue', highlightWidth: 3}],
|
|
110
179
|
])}
|
|
111
180
|
initialData={initialDataRef.current}
|
|
112
181
|
seriesFilter={filter}
|
|
113
182
|
seriesObservable={observableRef.current}
|
|
114
183
|
shouldSubscribe={running}
|
|
115
|
-
|
|
184
|
+
onUpdateAxesBounds={handleChartTimeUpdate}
|
|
185
|
+
windowingTime={25}
|
|
186
|
+
// onSubscribe={subscription => console.log("subscribed raster")}
|
|
116
187
|
>
|
|
117
188
|
<ContinuousAxis
|
|
118
189
|
axisId="x-axis-1"
|
|
119
190
|
location={AxisLocation.Bottom}
|
|
120
191
|
domain={[0, 5000]}
|
|
121
|
-
label="
|
|
192
|
+
label="t (ms)"
|
|
122
193
|
// font={{color: theme.color}}
|
|
123
194
|
/>
|
|
124
195
|
<ContinuousAxis
|
|
125
196
|
axisId="x-axis-2"
|
|
126
197
|
location={AxisLocation.Top}
|
|
127
|
-
domain={[0,
|
|
128
|
-
label="
|
|
198
|
+
domain={[0, 5000]}
|
|
199
|
+
label="t (ms)"
|
|
129
200
|
// font={{color: theme.color}}
|
|
130
201
|
/>
|
|
131
|
-
<
|
|
202
|
+
<OrdinalAxis
|
|
132
203
|
axisId="y-axis-1"
|
|
133
204
|
location={AxisLocation.Left}
|
|
134
205
|
categories={initialDataRef.current.map(series => series.name)}
|
|
135
|
-
label="
|
|
206
|
+
label="neuron"
|
|
207
|
+
axisTickStyle={{rotation: 25}}
|
|
136
208
|
/>
|
|
137
|
-
<
|
|
209
|
+
<OrdinalAxis
|
|
138
210
|
axisId="y-axis-2"
|
|
139
211
|
location={AxisLocation.Right}
|
|
140
212
|
categories={initialDataRef.current.map(series => series.name)}
|
|
141
|
-
label="
|
|
213
|
+
label="neuron"
|
|
142
214
|
/>
|
|
143
215
|
<Tracker
|
|
144
216
|
visible={visibility.tracker}
|
|
145
|
-
labelLocation={TrackerLabelLocation.
|
|
217
|
+
labelLocation={TrackerLabelLocation.ByAxis}
|
|
218
|
+
labelFormatter={x => `${d3.format(",.0f")(x)} ms`}
|
|
146
219
|
style={{color: theme.color}}
|
|
147
220
|
font={{color: theme.color}}
|
|
148
221
|
// onTrackerUpdate={update => console.dir(update)}
|
|
@@ -164,14 +237,20 @@ import {RasterChart} from "stream-charts";
|
|
|
164
237
|
<RasterPlot
|
|
165
238
|
axisAssignments={new Map([
|
|
166
239
|
// ['test', assignAxes("x-axis-1", "y-axis-1")],
|
|
167
|
-
['
|
|
240
|
+
['neuron1', assignAxes("x-axis-2", "y-axis-2")],
|
|
241
|
+
['neuron2', assignAxes("x-axis-2", "y-axis-2")],
|
|
242
|
+
['neuron3', assignAxes("x-axis-2", "y-axis-2")],
|
|
243
|
+
['neuron4', assignAxes("x-axis-2", "y-axis-2")],
|
|
244
|
+
['neuron5', assignAxes("x-axis-2", "y-axis-2")],
|
|
245
|
+
['neuron6', assignAxes("x-axis-2", "y-axis-2")],
|
|
168
246
|
// ['test3', assignAxes("x-axis-1", "y-axis-1")],
|
|
169
247
|
])}
|
|
170
|
-
|
|
248
|
+
spikeMargin={1}
|
|
249
|
+
dropDataAfter={5000}
|
|
171
250
|
panEnabled={true}
|
|
172
251
|
zoomEnabled={true}
|
|
173
252
|
zoomKeyModifiersRequired={true}
|
|
174
|
-
withCadenceOf={
|
|
253
|
+
withCadenceOf={50}
|
|
175
254
|
/>
|
|
176
255
|
</Chart>
|
|
177
256
|
```
|
|
@@ -180,39 +259,51 @@ import {RasterChart} from "stream-charts";
|
|
|
180
259
|
|
|
181
260
|
An example scatter chart (see [example](https://github.com/robphilipp/stream-charts-examples/blob/master/src/app/examples/StreamingScatterChart.tsx))
|
|
182
261
|
|
|
183
|
-

|
|
184
263
|
|
|
185
264
|
|
|
186
265
|
```typescript jsx
|
|
187
|
-
import {ScatterChart} from "stream-charts";
|
|
188
|
-
// .
|
|
189
|
-
// .
|
|
190
|
-
// .
|
|
191
266
|
<Chart
|
|
267
|
+
chartId={chartId.current}
|
|
192
268
|
width={useGridCellWidth()}
|
|
193
269
|
height={useGridCellHeight()}
|
|
194
|
-
margin={{...defaultMargin, top:
|
|
270
|
+
margin={{...defaultMargin, top: 40, bottom: 40, right: 60}}
|
|
271
|
+
// svgStyle={{'background-color': 'pink'}}
|
|
195
272
|
color={theme.color}
|
|
196
273
|
backgroundColor={theme.backgroundColor}
|
|
197
274
|
seriesStyles={new Map([
|
|
198
|
-
['test1', {
|
|
199
|
-
|
|
200
|
-
color:
|
|
201
|
-
lineWidth:
|
|
202
|
-
highlightColor:
|
|
203
|
-
|
|
204
|
-
|
|
275
|
+
['test1', {
|
|
276
|
+
...defaultLineStyle(),
|
|
277
|
+
color: 'orange',
|
|
278
|
+
lineWidth: 1,
|
|
279
|
+
highlightColor: 'orange'
|
|
280
|
+
}],
|
|
281
|
+
['test2', {
|
|
282
|
+
...defaultLineStyle(),
|
|
283
|
+
color: theme.name === 'light' ? 'blue' : 'gray',
|
|
284
|
+
lineWidth: 3,
|
|
285
|
+
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
286
|
+
highlightWidth: 5
|
|
287
|
+
}],
|
|
288
|
+
['test3', {
|
|
289
|
+
...defaultLineStyle(),
|
|
290
|
+
color: theme.name === 'light' ? 'dodgerblue' : 'gray',
|
|
291
|
+
lineWidth: 3,
|
|
292
|
+
highlightColor: theme.name === 'light' ? 'dodgerblue' : 'gray',
|
|
293
|
+
highlightWidth: 5
|
|
294
|
+
}],
|
|
205
295
|
])}
|
|
206
296
|
initialData={initialDataRef.current}
|
|
207
297
|
seriesFilter={filter}
|
|
208
298
|
seriesObservable={observableRef.current}
|
|
209
299
|
shouldSubscribe={running}
|
|
300
|
+
onUpdateAxesBounds={handleChartTimeUpdate}
|
|
210
301
|
windowingTime={25}
|
|
211
302
|
>
|
|
212
303
|
<ContinuousAxis
|
|
213
304
|
axisId="x-axis-1"
|
|
214
305
|
location={AxisLocation.Bottom}
|
|
215
|
-
domain={[10,
|
|
306
|
+
domain={[10, 10000]}
|
|
216
307
|
label="x-axis"
|
|
217
308
|
/>
|
|
218
309
|
<ContinuousAxis
|
|
@@ -224,7 +315,7 @@ import {ScatterChart} from "stream-charts";
|
|
|
224
315
|
<ContinuousAxis
|
|
225
316
|
axisId="x-axis-2"
|
|
226
317
|
location={AxisLocation.Top}
|
|
227
|
-
domain={[100,
|
|
318
|
+
domain={[100, 5000]}
|
|
228
319
|
label="x-axis (2)"
|
|
229
320
|
/>
|
|
230
321
|
<ContinuousAxis
|
|
@@ -236,7 +327,8 @@ import {ScatterChart} from "stream-charts";
|
|
|
236
327
|
/>
|
|
237
328
|
<Tracker
|
|
238
329
|
visible={visibility.tracker}
|
|
239
|
-
labelLocation={TrackerLabelLocation.
|
|
330
|
+
labelLocation={TrackerLabelLocation.ByAxis}
|
|
331
|
+
labelFormatter={x => `${d3.format(",.0f")(x)} ms`}
|
|
240
332
|
style={{color: theme.color}}
|
|
241
333
|
font={{color: theme.color}}
|
|
242
334
|
// onTrackerUpdate={update => console.dir(update)}
|
|
@@ -254,49 +346,297 @@ import {ScatterChart} from "stream-charts";
|
|
|
254
346
|
xLabel="t (ms)"
|
|
255
347
|
yLabel="count"
|
|
256
348
|
yValueFormatter={value => formatNumber(value, " ,.0f")}
|
|
257
|
-
yChangeFormatter={
|
|
349
|
+
yChangeFormatter={(y1, y2) => formatNumber(y2 - y1, " ,.0f")}
|
|
258
350
|
/>
|
|
259
351
|
</Tooltip>
|
|
260
352
|
<ScatterPlot
|
|
261
353
|
interpolation={interpolation}
|
|
262
354
|
axisAssignments={new Map([
|
|
355
|
+
// ['test1', assignAxes("x-axis-1", "y-axis-1")],
|
|
263
356
|
['test2', assignAxes("x-axis-2", "y-axis-2")],
|
|
357
|
+
['test3', assignAxes("x-axis-2", "y-axis-1")],
|
|
264
358
|
])}
|
|
265
|
-
dropDataAfter={
|
|
359
|
+
dropDataAfter={20000}
|
|
266
360
|
panEnabled={true}
|
|
267
361
|
zoomEnabled={true}
|
|
268
362
|
zoomKeyModifiersRequired={true}
|
|
269
|
-
withCadenceOf={30}
|
|
363
|
+
// withCadenceOf={30}
|
|
364
|
+
// timeWindowBehavior={TimeWindowBehavior.SQUEEZE}
|
|
270
365
|
/>
|
|
271
366
|
</Chart>
|
|
367
|
+
|
|
272
368
|
```
|
|
273
369
|
|
|
274
|
-
|
|
370
|
+
### [⤒](#content) <span id="example-bar-chart-code">example bar chart</span>
|
|
275
371
|
|
|
276
|
-
|
|
372
|
+
Example bar chart showing windowed statistics (see [example](https://github.com/robphilipp/stream-charts-examples/blob/develop/src/app/examples/StreamingBarChart.tsx)).
|
|
277
373
|
|
|
278
|
-
|
|
374
|
+

|
|
375
|
+
|
|
376
|
+
```typescript jsx
|
|
377
|
+
|
|
378
|
+
<Chart<OrdinalChartData, OrdinalDatum, BarSeriesStyle, WindowedOrdinalStats>
|
|
379
|
+
chartId={chartId.current}
|
|
380
|
+
width={useGridCellWidth()}
|
|
381
|
+
height={useGridCellHeight()}
|
|
382
|
+
margin={{...defaultMargin, top: 60, bottom: 80, right: 75, left: 70}}
|
|
383
|
+
// svgStyle={{'background-color': 'pink'}}
|
|
384
|
+
color={theme.color}
|
|
385
|
+
backgroundColor={theme.backgroundColor}
|
|
386
|
+
seriesStyles={new Map<string, BarSeriesStyle>([
|
|
387
|
+
['neuron1', {
|
|
388
|
+
...defaultBarSeriesStyle('orange'),
|
|
389
|
+
lineWidth: 2,
|
|
390
|
+
minMaxBar: {
|
|
391
|
+
...defaultBarSeriesStyle('orange').minMaxBar,
|
|
392
|
+
stroke: {
|
|
393
|
+
...defaultBarSeriesStyle('orange').minMaxBar.stroke,
|
|
394
|
+
width: 0
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
} as BarSeriesStyle],
|
|
398
|
+
['neuron14', {
|
|
399
|
+
...defaultBarSeriesStyle(theme.name === 'light' ? 'blue' : 'gray'),
|
|
400
|
+
lineWidth: 3,
|
|
401
|
+
highlightWidth: 5,
|
|
402
|
+
minMaxBar: {
|
|
403
|
+
...defaultBarSeriesStyle(theme.name === 'light' ? 'blue' : 'gray').minMaxBar,
|
|
404
|
+
widthFraction: 1
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
} as BarSeriesStyle],
|
|
408
|
+
['neuron31', {
|
|
409
|
+
...defaultBarSeriesStyle('green'),
|
|
410
|
+
lineWidth: 2,
|
|
411
|
+
} as BarSeriesStyle],
|
|
412
|
+
])}
|
|
413
|
+
initialData={initialDataRef.current}
|
|
414
|
+
seriesObservable={observableRef.current}
|
|
415
|
+
seriesFilter={filter}
|
|
416
|
+
shouldSubscribe={running}
|
|
417
|
+
onUpdateChartTime={handleChartTimeUpdate}
|
|
418
|
+
onUpdateAxesBounds={handleChartRangeUpdate}
|
|
419
|
+
windowingTime={25}
|
|
279
420
|
>
|
|
280
|
-
|
|
421
|
+
<OrdinalAxis
|
|
422
|
+
axisId="x-axis-1"
|
|
423
|
+
location={AxisLocation.Bottom}
|
|
424
|
+
categories={initialDataRef.current.map(series => series.name)}
|
|
425
|
+
label="neuron"
|
|
426
|
+
axisTickStyle={{rotation: 90}}
|
|
427
|
+
/>
|
|
428
|
+
<OrdinalAxis
|
|
429
|
+
axisId="x-axis-2"
|
|
430
|
+
location={AxisLocation.Top}
|
|
431
|
+
categories={initialDataRef.current.map(series => series.name)}
|
|
432
|
+
label="neuron"
|
|
433
|
+
axisTickStyle={{rotation: 40}}
|
|
434
|
+
/>
|
|
435
|
+
<ContinuousAxis
|
|
436
|
+
axisId="y-axis-1"
|
|
437
|
+
location={AxisLocation.Left}
|
|
438
|
+
domain={[-1.1, 1.1]}
|
|
439
|
+
label="ρ (mV)"
|
|
440
|
+
/>
|
|
441
|
+
<ContinuousAxis
|
|
442
|
+
axisId="y-axis-2"
|
|
443
|
+
location={AxisLocation.Right}
|
|
444
|
+
domain={[-1.1, 1.1]}
|
|
445
|
+
label="ρ (mV)"
|
|
446
|
+
/>
|
|
447
|
+
<Tracker
|
|
448
|
+
visible={visibility.tracker}
|
|
449
|
+
trackerAxis={AxisLocation.Left}
|
|
450
|
+
labelLocation={TrackerLabelLocation.ByAxis}
|
|
451
|
+
labelFormatter={x => `${d3.format(".2f")(x)} mV`}
|
|
452
|
+
style={{color: theme.color}}
|
|
453
|
+
font={{color: theme.color}}
|
|
454
|
+
// onTrackerUpdate={update => console.dir(update)}
|
|
455
|
+
/>
|
|
456
|
+
<Tooltip
|
|
457
|
+
visible={visibility.tooltip}
|
|
458
|
+
style={{
|
|
459
|
+
fontColor: theme.color,
|
|
460
|
+
backgroundColor: theme.backgroundColor,
|
|
461
|
+
borderColor: theme.color,
|
|
462
|
+
backgroundOpacity: 0.9,
|
|
463
|
+
}}
|
|
464
|
+
>
|
|
465
|
+
<BarPlotTooltipContent ordinalUnits="mV"/>
|
|
466
|
+
</Tooltip>
|
|
467
|
+
<BarPlot
|
|
468
|
+
barMargin={1}
|
|
469
|
+
dropDataAfter={5000}
|
|
470
|
+
panEnabled={true}
|
|
471
|
+
zoomEnabled={true}
|
|
472
|
+
zoomKeyModifiersRequired={true}
|
|
473
|
+
// withCadenceOf={50}
|
|
474
|
+
|
|
475
|
+
// to have the upper axis zoom when the series zoom, we must have at
|
|
476
|
+
// least one series assigned to this axis.
|
|
477
|
+
axisAssignments={new Map([
|
|
478
|
+
['neuron1', assignAxes("x-axis-2", "y-axis-2")],
|
|
479
|
+
])}
|
|
480
|
+
|
|
481
|
+
showMinMaxBars={showMinMax}
|
|
482
|
+
showValueLines={showValue}
|
|
483
|
+
showMeanValueLines={showMean}
|
|
484
|
+
showWindowedMinMaxBars={showWinMinMax}
|
|
485
|
+
showWindowedMeanValueLines={showWinMean}
|
|
486
|
+
/>
|
|
487
|
+
</Chart>
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### [⤒](#content) <span id="example-poincare-chart-code">example poincare chart</span>
|
|
491
|
+
|
|
492
|
+
Example Poincare (iterates) chart (see [example](https://github.com/robphilipp/stream-charts-examples/blob/develop/src/app/examples/StreamingPoincareChart.tsx)).
|
|
493
|
+
|
|
494
|
+

|
|
495
|
+
|
|
496
|
+
```typescript jsx
|
|
497
|
+
<Chart
|
|
498
|
+
chartId={chartId.current}
|
|
499
|
+
width={useGridCellWidth()}
|
|
500
|
+
height={useGridCellHeight()}
|
|
501
|
+
margin={{...defaultMargin, top: 40, bottom: 30, right: 60}}
|
|
502
|
+
// svgStyle={{'background-color': 'pink'}}
|
|
503
|
+
color={theme.color}
|
|
504
|
+
backgroundColor={theme.backgroundColor}
|
|
505
|
+
seriesStyles={new Map([
|
|
506
|
+
['test1', {
|
|
507
|
+
...defaultLineStyle(),
|
|
508
|
+
color: 'orange',
|
|
509
|
+
lineWidth: 1,
|
|
510
|
+
highlightColor: 'orange'
|
|
511
|
+
}],
|
|
512
|
+
['test2', {
|
|
513
|
+
...defaultLineStyle(),
|
|
514
|
+
color: theme.name === 'light' ? 'blue' : 'gray',
|
|
515
|
+
lineWidth: 1,
|
|
516
|
+
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
517
|
+
highlightWidth: 5
|
|
518
|
+
}],
|
|
519
|
+
['test3', {
|
|
520
|
+
...defaultLineStyle(),
|
|
521
|
+
color: theme.name === 'light' ? 'red' : 'gray',
|
|
522
|
+
lineWidth: 1,
|
|
523
|
+
highlightColor: theme.name === 'light' ? 'dodgerblue' : 'gray',
|
|
524
|
+
highlightWidth: 5
|
|
525
|
+
}],
|
|
526
|
+
])}
|
|
527
|
+
initialData={initialDataRef.current}
|
|
528
|
+
// seriesFilter={filter}
|
|
529
|
+
seriesObservable={observableRef.current}
|
|
530
|
+
shouldSubscribe={running}
|
|
531
|
+
onUpdateChartTime={handleChartTimeUpdate}
|
|
532
|
+
windowingTime={25}
|
|
533
|
+
>
|
|
534
|
+
<ContinuousAxis
|
|
535
|
+
axisId="x-axis-1"
|
|
536
|
+
location={AxisLocation.Bottom}
|
|
537
|
+
domain={axesRange}
|
|
538
|
+
label="f[n](x)"
|
|
539
|
+
updateAxisBasedOnDomainValues={false}
|
|
540
|
+
/>
|
|
541
|
+
<ContinuousAxis
|
|
542
|
+
axisId="y-axis-1"
|
|
543
|
+
location={AxisLocation.Left}
|
|
544
|
+
domain={axesRange}
|
|
545
|
+
label={`f[n+${lagN}](x)`}
|
|
546
|
+
updateAxisBasedOnDomainValues={false}
|
|
547
|
+
/>
|
|
548
|
+
<ContinuousAxis
|
|
549
|
+
axisId="x-axis-2"
|
|
550
|
+
location={AxisLocation.Top}
|
|
551
|
+
domain={axesRange}
|
|
552
|
+
label="f[n](x)"
|
|
553
|
+
updateAxisBasedOnDomainValues={false}
|
|
554
|
+
/>
|
|
555
|
+
<ContinuousAxis
|
|
556
|
+
axisId="y-axis-2"
|
|
557
|
+
location={AxisLocation.Right}
|
|
558
|
+
domain={axesRange}
|
|
559
|
+
label={`f[n+${lagN}](x)`}
|
|
560
|
+
updateAxisBasedOnDomainValues={false}
|
|
561
|
+
/>
|
|
562
|
+
<Tracker
|
|
563
|
+
key="tracker-x-axis"
|
|
564
|
+
visible={visibility.tracker}
|
|
565
|
+
// labelLocation={TrackerLabelLocation.Nowhere}
|
|
566
|
+
labelLocation={TrackerLabelLocation.ByAxis}
|
|
567
|
+
trackerAxis={AxisLocation.Bottom}
|
|
568
|
+
labelFormatter={x => `${d3.format(",.3f")(x)}`}
|
|
569
|
+
style={{color: theme.color}}
|
|
570
|
+
font={{color: theme.color}}
|
|
571
|
+
// onTrackerUpdate={update => console.dir("bottom", update)}
|
|
572
|
+
/>
|
|
573
|
+
<Tracker
|
|
574
|
+
key="tracker-y-axis"
|
|
575
|
+
visible={visibility.tracker}
|
|
576
|
+
// labelLocation={TrackerLabelLocation.Nowhere}
|
|
577
|
+
labelLocation={TrackerLabelLocation.ByAxis}
|
|
578
|
+
trackerAxis={AxisLocation.Left}
|
|
579
|
+
labelFormatter={x => `${d3.format(",.3f")(x)}`}
|
|
580
|
+
style={{color: theme.color}}
|
|
581
|
+
font={{color: theme.color}}
|
|
582
|
+
// onTrackerUpdate={update => console.dir("left", update)}
|
|
583
|
+
/>
|
|
584
|
+
<Tooltip
|
|
585
|
+
visible={visibility.tooltip}
|
|
586
|
+
style={{
|
|
587
|
+
fontColor: theme.color,
|
|
588
|
+
backgroundColor: theme.backgroundColor,
|
|
589
|
+
borderColor: theme.color,
|
|
590
|
+
backgroundOpacity: 0.9,
|
|
591
|
+
}}
|
|
592
|
+
>
|
|
593
|
+
<PoincarePlotTooltipContent
|
|
594
|
+
xLabel="t (ms)"
|
|
595
|
+
yLabel="f(x)"
|
|
596
|
+
yValueFormatter={value => formatNumber(value, " ,.4f")}
|
|
597
|
+
style={{
|
|
598
|
+
...defaultTooltipStyle,
|
|
599
|
+
fontColor: 'black',
|
|
600
|
+
// fontColor: theme.color,
|
|
601
|
+
fontWeight: 650
|
|
602
|
+
}}
|
|
603
|
+
/>
|
|
604
|
+
</Tooltip>
|
|
605
|
+
<PoincarePlot
|
|
606
|
+
interpolation={interpolation}
|
|
607
|
+
dropDataAfter={dropAfterMs}
|
|
608
|
+
panEnabled={true}
|
|
609
|
+
zoomEnabled={true}
|
|
610
|
+
zoomKeyModifiersRequired={true}
|
|
611
|
+
// withCadenceOf={30}
|
|
612
|
+
/>
|
|
613
|
+
</Chart>
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
## [⤒](#content) <span id="intro">intro</span>
|
|
617
|
+
|
|
618
|
+
`stream-charts` aim to provide high-performance charts for displaying large amounts of data in real-time. The examples (above) show various plot types whose data can be updated about every 25 ms.
|
|
619
|
+
|
|
620
|
+
There are obviously limits to the amount of data, and the performance of the plots. For example, the raster chart plots thousands of lines in the chart. When displaying more data in the raster plot, update performance will suffer. Therefore, you must tune your plots somewhat when you are working in the limits of their performance.
|
|
281
621
|
|
|
282
622
|
### [⤒](#content) <span id="terminology">terminology</span>
|
|
283
623
|
|
|
284
|
-
A <Chart/> holds a `plot`, the `axes`, and optionally, a <Tracker/>, and a <Tooltip/>. A <Chart/> is generic, and holds a specific type of `plot`, for example, a <RasterPlot/> or
|
|
624
|
+
A <Chart/> holds a `plot`, the `axes`, and optionally, a <Tracker/>, and a <Tooltip/>. A <Chart/> is generic, and holds a specific type of `plot`, for example, a <RasterPlot/>, <ScatterPlot/>, <BarPlot/>, or <PoincarePlot/>. The `plot` holds the data, and optionally provides pan and zoom. The `axes` provide the scale of the data. For example, the scale could be a continuous numeric logarithmic scale, or an ordinal scale. The `axes` are also generic. Though, a `plot` can restrict the type of `axes` allowed. For example, a <RasterPlot/> requires that the y-axes are ordinal axes. <Trackers/> are generic. <Tooltips/> are also generic, though the tooltip content is a child, specific to a plot type, that it knows how to interpret and present the data.
|
|
285
625
|
|
|
286
|
-
|
|
287
|
-
|
|
626
|
+
**<Chart/>** [↴](#chart)<br>
|
|
627
|
+
Generic container which holds the `Axes`, `Plot`, `Tracker`, `Tooltip`.
|
|
288
628
|
|
|
289
|
-
|
|
290
|
-
|
|
629
|
+
**Axes** [↴](#axes)<br>
|
|
630
|
+
Defines the scale of the data. `stream-charts` current has two axis types: [<ContinuousAxis/>](#continuous-axes-usage) and [<OrdinalAxis/>](#ordinal-axes-usage). The <ContinuousAxis/> can be used as an x-axis or y-axis. However, the <OrdinalAxis/> can only be used as a y-axes because these are all time-series charts and the x-axis currently only represents time.
|
|
291
631
|
|
|
292
|
-
|
|
293
|
-
|
|
632
|
+
**Plot** [↴](#plots)<br>
|
|
633
|
+
The plot is a container for the data that uses the `axes` for scale, domain, and range information. Plots provide panning and zooming of the x-axis (time), interacting with the `axes` to update the time-range. The plot is the visual representation of the data. Currently, four types of plots are available: [<RasterPlot/>](#raster-plot-usage), [<ScatterPlot/>](#scatter-plot-usage), [<BarPlot/>](#bar-plot-usage), and [<PoincarePlot/>](#poincare-plot-usage).
|
|
294
634
|
|
|
295
|
-
|
|
296
|
-
|
|
635
|
+
**<Tracker/>** [↴](#tracker-usage)<br>
|
|
636
|
+
The tracker displays the current plot time of the mouse. When multiple x-axes are used in the chart, then the tracker displays both times (i.e. from the upper and lower x-axis).
|
|
297
637
|
|
|
298
|
-
|
|
299
|
-
|
|
638
|
+
**<Tooltip/>** [↴](#tooltip-usage)<br>
|
|
639
|
+
The tooltip is a generic component for rendering information about the data when the user mouses over a series or datum. The `<Tooltip/>` expects a child component that understands the data and renders the information show in the tooltip. For example, when using a [<RasterPlot/>](#raster-plot-usage), the [<RasterPlotTooltipContent/>](#rasterplot-tooltip-usage) renders the data for the raster plot tooltip. And when using a [<ScatterPlot/>](#scatter-plot-usage), the [<ScatterPlotTooltipContent/>](#scatterplot-tooltip-usage) renders the data for the scatter plot tooltip. The tooltip content can be extended.
|
|
300
640
|
|
|
301
641
|
### [⤒](#content) <span id="data-ttl">data ttl, time-windows, performance</span>
|
|
302
642
|
|
|
@@ -327,93 +667,92 @@ The `Chart`s properties fall into four categories:
|
|
|
327
667
|
4. streamed data and how to manage the stream of data
|
|
328
668
|
|
|
329
669
|
#### [⤒](#content) <span id="chart-usage-dimensions"><Chart/> dimensions</span>
|
|
330
|
-
|
|
331
|
-
|
|
670
|
+
**width (pixels)**<br>
|
|
671
|
+
The width (in pixels) of the container that holds the chart. The actual plot will be smaller based on the margins.
|
|
332
672
|
|
|
333
|
-
|
|
334
|
-
|
|
673
|
+
**height (pixels)**<br>
|
|
674
|
+
The height (in pixels) of the container that holds the chart. The actual plot will be smaller based on the margins.
|
|
335
675
|
|
|
336
676
|
#### [⤒](#content) <span id="chart-usage-styling"><Chart/> styling</span>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
677
|
+
**margin ([Margin](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/margins.ts), optional)**<br>
|
|
678
|
+
The margin (in pixels) around plot. For example, if the container has a (h, w) = (300, 600) and a margin of 10 pixels for the top, left, right, bottom, then the actual plot will have a (h, w) = (290, 590), leaving only 10 pixels around the plot for axis titles, ticks, and axis labels.
|
|
679
|
+
|
|
680
|
+
The Margin has the following shape
|
|
341
681
|
>```typescript
|
|
342
682
|
>interface Margin {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
683
|
+
top: number
|
|
684
|
+
bottom: number
|
|
685
|
+
left: number
|
|
686
|
+
right: number
|
|
347
687
|
>}
|
|
348
688
|
>```
|
|
349
689
|
|
|
350
690
|
|
|
351
|
-
|
|
352
|
-
|
|
691
|
+
**color (string, optional)**<br>
|
|
692
|
+
The color of the axis lines and text, which can be overridden specifically by the axes styles.
|
|
693
|
+
|
|
694
|
+
**backgroundColor (string, optional)**<br>
|
|
695
|
+
The color of the chart background (the whole chart, not just the plot).
|
|
353
696
|
|
|
354
|
-
|
|
355
|
-
|
|
697
|
+
**svgStyle ([SvgStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/svgStyle.ts), optional)**<br>
|
|
698
|
+
The style attributes for the main SVG element, in case you want to change those. Generally, this is not needed.
|
|
356
699
|
|
|
357
|
-
|
|
358
|
-
> The style attributes for the main SVG element, in case you want to change those. Generally, this is not needed.
|
|
359
|
-
>
|
|
360
|
-
> The SvgStyle has the following shape
|
|
700
|
+
The SvgStyle has the following shape
|
|
361
701
|
>```typescript
|
|
362
702
|
>interface SvgStyle {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
703
|
+
height?: string | number
|
|
704
|
+
width?: string | number
|
|
705
|
+
outline?: string
|
|
706
|
+
// any valid SVG CSS attribute
|
|
707
|
+
[propName: string]: any
|
|
368
708
|
>}
|
|
369
709
|
>```
|
|
370
710
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
711
|
+
**seriesStyles (Map<string, [SeriesLineStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) >, optional)**<br>
|
|
712
|
+
A map holding the data series name with an associated SeriesLineStyle. Any series listed in this map will use the associated styles for that series. Any series not in the map will use the default series styles.
|
|
713
|
+
|
|
714
|
+
The SeriesLineStyle has the following shape
|
|
715
|
+
```typescript
|
|
716
|
+
interface SeriesLineStyle {
|
|
717
|
+
color: string
|
|
718
|
+
lineWidth: number
|
|
719
|
+
// the color of the series when the user mouses over the series
|
|
720
|
+
highlightColor: string
|
|
721
|
+
// the line width of the series when the user mouses over the series
|
|
722
|
+
highlightWidth: number
|
|
723
|
+
// the line margin used for raster charts
|
|
724
|
+
margin?: number
|
|
725
|
+
}
|
|
386
726
|
>```
|
|
387
727
|
|
|
388
728
|
#### [⤒](#content) <span id="chart-usage-initial-data"><Chart/> initial data</span>
|
|
389
729
|
|
|
390
730
|
Holds the initial (static data). This data is displayed in the chart even before subscribing to the chart-data observable. The initial data can be used to generate static charts.
|
|
391
731
|
|
|
392
|
-
|
|
393
|
-
|
|
732
|
+
**initialData (Array<[Series](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/datumSeries.ts) >)**<br>
|
|
733
|
+
An array holding the initial data series to be plotted before subscribing to the chart-data observable.
|
|
394
734
|
>
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
> }
|
|
735
|
+
The Series has the following shape
|
|
736
|
+
```typescript
|
|
737
|
+
interface Series {
|
|
738
|
+
// the series name
|
|
739
|
+
readonly name: string
|
|
740
|
+
// the array of time-value pairs
|
|
741
|
+
data: Array<Datum>
|
|
742
|
+
// ... accessor functions
|
|
743
|
+
// .
|
|
744
|
+
// .
|
|
745
|
+
// .
|
|
746
|
+
}
|
|
747
|
+
```
|
|
748
|
+
And the [Datum](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/datumSeries.ts) is an immutable object that has the following shape
|
|
749
|
+
```typescript
|
|
750
|
+
interface Datum {
|
|
751
|
+
readonly time: number;
|
|
752
|
+
readonly value: number;
|
|
753
|
+
}
|
|
415
754
|
>```
|
|
416
|
-
|
|
755
|
+
There are a number of helper functions for creating `Series` and `Datum`.
|
|
417
756
|
>> `seriesFrom(name: string, data: Array<Datum> = []): Series`<br>
|
|
418
757
|
>> `seriesFromTuples(name: string, data: Array<[number, number]> = []): Series`<br>
|
|
419
758
|
>> `emptySeries(name: string): Series`<br>
|
|
@@ -423,42 +762,42 @@ Holds the initial (static data). This data is displayed in the chart even before
|
|
|
423
762
|
|
|
424
763
|
A set of properties, functions, and callbacks to control and observe the streaming of live data into the chart.
|
|
425
764
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
765
|
+
**seriesObservable (Observable<[ChartData](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/chartData.ts) >)**<br>
|
|
766
|
+
An observable of (source for) chart-data. The `shouldSubscribe` property controls whether the chart subscribes to the observable, or unsubscribes. This is the source of live data to the chart. An example of an observable is shown below.
|
|
767
|
+
```typescript
|
|
768
|
+
function randomSpikeDataObservable(
|
|
769
|
+
series: Array<Series>,
|
|
770
|
+
updatePeriod: number = UPDATE_PERIOD_MS,
|
|
771
|
+
spikeProbability: number = 0.1
|
|
772
|
+
): Observable<ChartData> {
|
|
773
|
+
const seriesNames = series.map(series => series.name)
|
|
774
|
+
const initialData = initialChartData(series)
|
|
775
|
+
return interval(updatePeriod).pipe(
|
|
776
|
+
// convert the number sequence to a time
|
|
777
|
+
map(sequence => (sequence + 1) * updatePeriod),
|
|
778
|
+
// create a random spike for each series
|
|
779
|
+
map((time) => randomSpikeData(time, seriesNames, initialData.maxTimes, updatePeriod, spikeProbability))
|
|
780
|
+
)
|
|
781
|
+
}
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
**shouldSubscribe (boolean, optional, default = false)**<br>
|
|
785
|
+
Optional property, that when set from `false` to `true`, causes the <Chart/> to subscribe to the chart-data observable. When set to `false` after a subscription, causes the <Chart/> to unsubscribe from the chart-data observable.
|
|
786
|
+
|
|
787
|
+
**windowingTime (number, milliseconds, optional, default = 100 ms)**<br>
|
|
788
|
+
Optional property that defines a time-window during which incoming events are buffered, and then handed to plot, causing the plot to update. The `windowingTime` defines the maximum plot update rate, though not the maximum data update rate. The larger the windowing time, the fewer updates per unit time, and the more choppy the updates. Large amounts of data with high update rates can cause rendering delays. The windowing time provides a lever to manage the plot update rates to get the smoothest plot updates that keep up with real-time.
|
|
789
|
+
|
|
790
|
+
**shouldSubscribe (number, optional, default = false)**<br>
|
|
791
|
+
Optional property that default to `false`. When changed to `true`, from `false`, signals the <Chart/> to subscribe to the `seriesObservable`, streaming in the `ChartData` and updating the <Chart/> in real-time.
|
|
792
|
+
|
|
793
|
+
**onSubscribe (callback function, (subscription: Subscription) => void, optional, default = noop**<br>
|
|
794
|
+
Optional callback function that is called when the <Chart/> subscribes to the `ChartData` observable.
|
|
795
|
+
|
|
796
|
+
**onUpdateData (callback function, (seriesName: string, data: Array<Datum>)) => void, optional, default = noop)**<br>
|
|
797
|
+
Optional callback function that is called when the data updates. This callback can be used if you would like to respond to data updates. For example, use this callback if you would like to have the plot drop data after 10 seconds, but would like to store that data in an in-browser database. Though, a more efficient way to store the data would be to subscribe to the series-observable separately, and then use that observer to stream the data to the storage.
|
|
798
|
+
|
|
799
|
+
**onUpdateTime (callback function, (times: Map<string, [start: number, end: number]>) => void, optional, default = noop)**<br>
|
|
800
|
+
Optional callback this is called whenever the time-ranges change. Use this to track the current time of the plot.
|
|
462
801
|
|
|
463
802
|
## [⤒](#content) <span id="axes">axes</span>
|
|
464
803
|
|
|
@@ -472,67 +811,67 @@ When creating a <ContinuousAxis/>, you must specify its location using the
|
|
|
472
811
|
|
|
473
812
|
The base properties defining the axis.
|
|
474
813
|
|
|
475
|
-
|
|
476
|
-
|
|
814
|
+
**axisId (string)**<br>
|
|
815
|
+
The unique ID of the axis. The axis can then be referred to by this ID. For example, when assigning axes to series, the assignment is made by associating the axis ID to the series name.
|
|
477
816
|
|
|
478
|
-
|
|
479
|
-
|
|
817
|
+
**location ([AxisLocation](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) )**<br>
|
|
818
|
+
The location of the axis. As defined by the `AxisLocation` in the the [axes.ts](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) file, x-axes can be placed on the `bottom` or the `top`, and y-axes can be placed on the `left` or the `right`.
|
|
480
819
|
|
|
481
|
-
|
|
482
|
-
|
|
820
|
+
**scale (ScaleContinuousNumeric<number, number>, optional, default = d3.scaleLinear)**<br>
|
|
821
|
+
The optional scale (factory) of the continuous axis. The scale of the axis is like the axis ruler and determines how the points are placed on the screen. For example, a linear scale is like an evenly spaced ruler, and the mapping between screen location and data value are linear. As another example, the log scale has a logarithmic mapping between the screen location and the data. The scale can be a linear scale (default scale, d3.scaleLinear), a logarithmic scale (d3.scaleLog), a power scale (d3.scalePower), or any other d3 continouos numeric scale that works. Not that if a chart, for example, has two x-axes, that the x-axes are **not** required to have the same scale.
|
|
483
822
|
|
|
484
|
-
|
|
485
|
-
|
|
823
|
+
**domain ([min: number, max: number])**<br>
|
|
824
|
+
The domain of the axis (in d3 terminology) is effectively the minimum value of the axis and the maximum value of the axis when the initial data is displayed. The domain defines the time-window of the displayed data. For example, if the `domain` for an x-axis is specified as `[1000, 6000]`, then the axis starts at `1000` and ends at `6000`, and the time-window is `5000`. Once data starts to stream past the axis end, the plot starts to scroll, maintaining the calculated time-window (in out example, 5000). Of course, a zooming event will change the domain, and also the time-window.
|
|
486
825
|
|
|
487
|
-
|
|
488
|
-
|
|
826
|
+
**label (string)**<br>
|
|
827
|
+
The axis label.
|
|
489
828
|
|
|
490
829
|
#### [⤒](#content) <span id="continuous-axes-usage-styling"><ContinuousAxis/> styling</span>
|
|
491
830
|
|
|
492
831
|
A set of properties to update the style of the axes.
|
|
493
832
|
|
|
494
|
-
|
|
495
|
-
|
|
833
|
+
**font (Partial<[AxesLabelFont](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) >)**<br>
|
|
834
|
+
An optional CSS properties specifying the font for the axis and tick labels.
|
|
496
835
|
|
|
497
836
|
|
|
498
|
-
### [⤒](#content) <span id="
|
|
837
|
+
### [⤒](#content) <span id="ordinal-axes-usage"><OrdinalAxis/></span>
|
|
499
838
|
|
|
500
|
-
The <
|
|
839
|
+
The <OrdinalAxis/> must be a child of the <Chart/>. Each <Chart/> can have one or two ordinal axes for the y-axes. Unlike the [<ContinuousAxis/>](#continuous-axes-usage), the <OrdinalAxis/> can only be used as a y-axis because for stream charts (at this point) the x-axes represent time. In the same way as with the [<ContinuousAxis/>](#continuous-axes-usage), when using multiple multiple y-axes you must assign the series to the axes in one of the `Plot` components. Any series that are not explicitly assigned an axis will be assigned to the default y-axis, which is the left-hand side axis in the <Chart/>.
|
|
501
840
|
|
|
502
|
-
When creating
|
|
841
|
+
When creating an <OrdinalAxis/>, you must specify its location using the `AxisLocation` enum defined in the [axes.ts](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) file. Each axis must have a unique axis ID. The <OrdinalAxis/> uses a band scale (d3.scaleBand).
|
|
503
842
|
|
|
504
|
-
#### [⤒](#content) <span id="
|
|
843
|
+
#### [⤒](#content) <span id="ordinal-axes-usage-base"><OrdinalAxis/> base properties</span>
|
|
505
844
|
|
|
506
845
|
The base properties defining the axis.
|
|
507
846
|
|
|
508
|
-
|
|
509
|
-
|
|
847
|
+
**axisId (string)**<br>
|
|
848
|
+
The unique ID of the axis. The axis can then be referred to by this ID. For example, when assigning axes to series, the assignment is made by associating the axis ID to the series name.
|
|
510
849
|
|
|
511
|
-
|
|
512
|
-
|
|
850
|
+
**location ([AxisLocation](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) )**<br>
|
|
851
|
+
The location of the axis. As defined by the `AxisLocation` in the the [axes.ts](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) file, x-axes can be placed on the `bottom` or the `top`, and y-axes can be placed on the `left` or the `right`.
|
|
513
852
|
|
|
514
|
-
|
|
515
|
-
|
|
853
|
+
**categories (Array<string>)**<br>
|
|
854
|
+
The required `categories` property holds the names of the categories, in the order that they will be displayed on the axis. The first element in the array will be shown at the top of the axis. The second element will be lower, and the last element will be at the bottom of the axis.
|
|
516
855
|
|
|
517
|
-
|
|
518
|
-
|
|
856
|
+
**domain ([min: number, max: number])**<br>
|
|
857
|
+
The domain of the axis (in d3 terminology) is effectively the minimum value of the displayed axis and the maximum value of the displayed axis when the initial data is displayed. The domain defines the time-window of the displayed data. For example, if the `domain` for an x-axis is specified as `[1000, 6000]`, then the axis starts at `1000` and ends at `6000`, and the time-window is `5000`. Once data starts to stream past the axis end, the plot starts to scroll, maintaining the calculated time-window (in our example, 5000). Of course, a zooming event will change the domain, and also the time-window.
|
|
519
858
|
|
|
520
|
-
|
|
521
|
-
|
|
859
|
+
**label (string)**<br>
|
|
860
|
+
The axis label.
|
|
522
861
|
|
|
523
|
-
#### [⤒](#content) <span id="
|
|
862
|
+
#### [⤒](#content) <span id="ordinal-axes-usage-styling"><OrdinalAxis/> styling</span>
|
|
524
863
|
|
|
525
864
|
A set of properties to update the style of the axes.
|
|
526
865
|
|
|
527
|
-
|
|
528
|
-
|
|
866
|
+
**font (Partial<[AxesLabelFont](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) >, optional)**<br>
|
|
867
|
+
An optional CSS properties specifying the font for the axis and tick labels.
|
|
529
868
|
|
|
530
869
|
|
|
531
870
|
## [⤒](#content) <span id="plots">plots</span>
|
|
532
871
|
|
|
533
872
|
### [⤒](#content) <span id="scatter-plot-usage"><ScatterPlot/></span>
|
|
534
873
|
|
|
535
|
-
In `stream-charts`, the `plot` is the data visualization component. To work, a plot must be a child of the <Chart/> component so that it is plugged into the `stream-charts` ecosystem. The plot determines how to render the data. But it relies on the axes to determine scaling information so that it can map data to screen locations. And therefore, a plot must have sibling axes ([<ContinousAxis/>](#continuous-axes-usage), [<
|
|
874
|
+
In `stream-charts`, the `plot` is the data visualization component. To work, a plot must be a child of the <Chart/> component so that it is plugged into the `stream-charts` ecosystem. The plot determines how to render the data. But it relies on the axes to determine scaling information so that it can map data to screen locations. And therefore, a plot must have sibling axes ([<ContinousAxis/>](#continuous-axes-usage), [<OrdinalAxis/>](#ordinal-axes-usage)) components for the x-axis and the y-axis. Because the plot is responsible for data visualization, it is also where the data series are assigned to axes. The assignment of axes to series is optional, and any series not explicitly assigned to an axis will be assigned to the default axes. The default x-axis is the bottom axis, and the default y-axis is the axis on the left-hand side of the plot.
|
|
536
875
|
|
|
537
876
|
The plot determines what view-modifying user interactions are available. Specifically, panning the data to the left and right in time, and zooming in time.
|
|
538
877
|
|
|
@@ -540,66 +879,115 @@ The <ScatterPlot/> specifically is used to plot time-series data, where th
|
|
|
540
879
|
|
|
541
880
|
#### [⤒](#content) <span id="scatter-plot-usage-base"><ScatterPlot/> base properties</span>
|
|
542
881
|
|
|
543
|
-
|
|
544
|
-
|
|
882
|
+
**axisAssignments (Map<string, [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts) >, optional, default = Map())**<br>
|
|
883
|
+
An optional property that assigns data series to (x, y)-axes. Any series not assigned to an axis will use the default axis. The default x-axis is the bottom axis, and the default y-axis is the axis on the left-hand side of the plot. The `Map` associates the series name with an [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts), which is a simple object (`{xAxis: string, yAxis: string}`) that holds the axis ID for the x-axis and for the y-axis assigned to the series.
|
|
545
884
|
|
|
546
|
-
|
|
547
|
-
|
|
885
|
+
**interpolation (d3.CurveFactory, optional, default = d3.curveLinear)**<br>
|
|
886
|
+
An optional property that defines how the data series line will be interpolated between individual data points. You can use any valid [d3.CurveFactory](https://github.com/d3/d3-shape#curves) for the interpolation. Changing the interpolation once the data is already display, will cause a re-render of the data with the new interpolation.
|
|
548
887
|
|
|
549
|
-
|
|
550
|
-
|
|
888
|
+
<span id="scatter-plot-drop">**dropDataAfter (number, milliseconds, opitional, default = Infinity)**</span><br>
|
|
889
|
+
Optional property that sets when to drop data (effectively a TTL). This only drops data while streaming. Don't worry, your data won't disappear after the streaming has stopped. By default, none of the data is dropped. However, when large amounts of data are being streamed and plotted over long periods of time, memory and performance may become an issue. Setting this value allows a scrolling chart to run forever without running into resource issues.
|
|
551
890
|
|
|
552
891
|
#### [⤒](#content) <span id="scatter-plot-usage-view"><ScatterPlot/> view-modifying interactions</span>
|
|
553
892
|
|
|
554
893
|
View-modifying interactions are those that change the way the data is displayed. For example, zooming in time, panning in time.
|
|
555
894
|
|
|
556
|
-
|
|
557
|
-
|
|
895
|
+
**panEnabled (boolean, optional, default = false)**<br>
|
|
896
|
+
Optional property that defaults to `false`. When set to `true` then enables "panning" which allows the user to drag the plot to the left and right.
|
|
558
897
|
|
|
559
|
-
|
|
560
|
-
|
|
898
|
+
**zoomEnabled (boolean, optional, default = false)**<br>
|
|
899
|
+
Optional property that defaults for `false`. When set to `true` then enables "zooming" which allows the user to increase or decrease the displayed time range. By default, scrolling will cause the zoom effect. See the `zoomKeyModifiersRequired` property which requires the `shift` key to be pressed in order for the zoom action to apply.
|
|
561
900
|
|
|
562
|
-
|
|
563
|
-
|
|
901
|
+
**zoomKeyModifiersRequired (boolean, optional, default = false)**<br>
|
|
902
|
+
An optional property that defaults to `false`. When set to `true`, and the `zoomEnabled` property is also set to `true`, then requires that the `shift` key be pressed when scrolling in order to activate the zoom. This is nice when a user can scroll through your page containing the plot, so that zooming doesn't interfere with scrolling.
|
|
564
903
|
|
|
565
|
-
|
|
566
|
-
|
|
904
|
+
**withCadenceOf (number, optional, default = undefinded)**<br>
|
|
905
|
+
An optional property that defaults to `undefined`. When set, uses a cadence with the specified refresh period (in milliseconds). For plots with slow data updates (> 100 ms) using a cadence of 10 to 25 ms smooths out the updates so the time scrolling doesn't appear choppy. When updates are around 25 ms or less, then setting the cadence period too small will result in poor update performance. Generally at high update speeds, the cadence is unnecessary. Finally, using cadence, sets the max time to the current time. See also the related <Chart/>'s `windowingTime` property.
|
|
567
906
|
|
|
568
907
|
|
|
569
908
|
### [⤒](#content) <span id="raster-plot-usage"><RasterPlot/></span>
|
|
570
909
|
|
|
571
|
-
In `stream-charts`, the `plot` is the data visualization component. To work, a plot must be a child of the <Chart/> component so that it is plugged into the `stream-charts` ecosystem. The plot determines how to render the data. But it relies on the axes to determine scaling information so that it can map data to screen locations. And therefore, a plot must have sibling axes ([<ContinousAxis/>](#continuous-axes-usage), [<
|
|
910
|
+
In `stream-charts`, the `plot` is the data visualization component. To work, a plot must be a child of the <Chart/> component so that it is plugged into the `stream-charts` ecosystem. The plot determines how to render the data. But it relies on the axes to determine scaling information so that it can map data to screen locations. And therefore, a plot must have sibling axes ([<ContinousAxis/>](#continuous-axes-usage), [<OrdinalAxis/>](#ordinal-axes-usage)) components for the x-axis and the y-axis. Because the plot is responsible for data visualization, it is also where the data series are assigned to axes. The assignment of axes to series is optional, and any series not explicitly assigned to an axis will be assigned to the default axes. The default x-axis is the bottom axis, and the default y-axis is the axis on the left-hand side of the plot.
|
|
572
911
|
|
|
573
912
|
The plot determines what view-modifying user interactions are available. Specifically, panning the data to the left and right in time, and zooming in time.
|
|
574
913
|
|
|
575
|
-
The <RasterPlot/> specifically is used to plot event-timing data, where the x-values are time, and the y-values are a category to which the event belongs. The x-axis is required to be a [<
|
|
914
|
+
The <RasterPlot/> specifically is used to plot event-timing data, where the x-values are time, and the y-values are a category to which the event belongs. The x-axis is required to be a [<ContinuousAxis/>](#continuous-axes-usage), and the y-axis is required to be an [<OrdinalAxis/>](#ordinal-axes-usage).
|
|
576
915
|
|
|
577
916
|
#### [⤒](#content) <span id="raster-plot-usage-base"><RasterPlot/> base properties</span>
|
|
578
917
|
|
|
579
|
-
|
|
580
|
-
|
|
918
|
+
**axisAssignments (Map<string, [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts) >, optional, default = Map())**<br>
|
|
919
|
+
An optional property that assigns data series to (x, y)-axes. Any series not assigned to an axis will use the default axis. The default x-axis is the bottom axis, and the default y-axis is the axis on the left-hand side of the plot. The `Map` associates the series name with an [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts), which is a simple object (`{xAxis: string, yAxis: string}`) that holds the axis ID for the x-axis and for the y-axis assigned to the series.
|
|
581
920
|
|
|
582
|
-
|
|
583
|
-
|
|
921
|
+
<span id="raster-plot-drop">**dropDataAfter (number, milliseconds, opitional, default = Infinity)**</span><br>
|
|
922
|
+
Optional property that sets when to drop data (effectively a TTL). This only drops data while streaming. Don't worry, your data won't disappear after the streaming has stopped. By default, none of the data is dropped. However, when large amounts of data are being streamed and plotted over long periods of time, memory and performance may become an issue. Setting this value allows a scrolling chart to run forever without running into resource issues.
|
|
584
923
|
|
|
585
|
-
|
|
586
|
-
|
|
924
|
+
**spikeMargin (number, pixels, default = 2)**<br>
|
|
925
|
+
Optional property that adds a margin to the top and bottom of the raster (event) lines to give vertical spacing to the events in the plot. Margins on individual series can also be set through the [Chart.seriesStyles](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/hooks/useChart.tsx) property.
|
|
587
926
|
|
|
588
927
|
#### [⤒](#content) <span id="raster-plot-usage-view"><RasterPlot/> view-modifying interactions</span>
|
|
589
928
|
|
|
590
929
|
View-modifying interactions are those that change the way the data is displayed. For example, zooming in time, panning in time.
|
|
591
930
|
|
|
592
|
-
|
|
593
|
-
|
|
931
|
+
**panEnabled (boolean, optional, default = false)**<br>
|
|
932
|
+
Optional property that defaults to `false`. When set to `true` then enables "panning" which allows the user to drag the plot to the left and right.
|
|
933
|
+
|
|
934
|
+
**zoomEnabled (boolean, optional, default = false)**<br>
|
|
935
|
+
Optional property that defaults for `false`. When set to `true` then enables "zooming" which allows the user to increase or decrease the displayed time range. By default, scrolling will cause the zoom effect. See the `zoomKeyModifiersRequired` property which requires the `shift` key to be pressed in order for the zoom action to apply.
|
|
936
|
+
|
|
937
|
+
**zoomKeyModifiersRequired (boolean, optional, default = false)**<br>
|
|
938
|
+
An optional property that defaults to `false`. When set to `true`, and the `zoomEnabled` property is also set to `true`, then requires that the `shift` key be pressed when scrolling in order to activate the zoom. This is nice when a user can scroll through your page containing the plot, so that zooming doesn't interfere with scrolling.
|
|
939
|
+
|
|
940
|
+
**withCadenceOf (number, optional, default = undefinded)**<br>
|
|
941
|
+
An optional property that defaults to `undefined`. When set, uses a cadence with the specified refresh period (in milliseconds). For plots with slow data updates (> 100 ms) using a cadence of 10 to 25 ms smooths out the updates so the time scrolling doesn't appear choppy. When updates are around 25 ms or less, then setting the cadence period too small will result in poor update performance. Generally at high update speeds, the cadence is unnecessary. Finally, using cadence, sets the max time to the current time. See also the related <Chart/>'s `windowingTime` property.
|
|
942
|
+
|
|
943
|
+
### [⤒](#content) <span id="bar-plot-usage"><BarPlot/></span>
|
|
944
|
+
|
|
945
|
+
The <BarPlot/> is used to plot windowed statistics for a data series. It can display the current value, the mean value, and the min/max range for the windowed data.
|
|
946
|
+
|
|
947
|
+
#### [⤒](#content) <span id="bar-plot-usage-base"><BarPlot/> base properties</span>
|
|
948
|
+
|
|
949
|
+
**axisAssignments (Map<string, [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts) >, optional, default = Map())**<br>
|
|
950
|
+
An optional property that assigns data series to (x, y)-axes. Any series not assigned to an axis will use the default axis. The default x-axis is the bottom axis, and the default y-axis is the axis on the left-hand side of the plot.
|
|
951
|
+
|
|
952
|
+
**showMinMaxBars (boolean, optional, default = false)**<br>
|
|
953
|
+
When `true`, displays bars representing the minimum and maximum values in the data.
|
|
954
|
+
|
|
955
|
+
**showWindowedMinMaxBars (boolean, optional, default = false)**<br>
|
|
956
|
+
When `true`, displays bars representing the windowed minimum and maximum values.
|
|
957
|
+
|
|
958
|
+
**showValueLines (boolean, optional, default = false)**<br>
|
|
959
|
+
When `true`, displays lines representing the current values of the data series.
|
|
960
|
+
|
|
961
|
+
**showMeanValueLines (boolean, optional, default = false)**<br>
|
|
962
|
+
When `true`, displays lines representing the mean values of the data series.
|
|
963
|
+
|
|
964
|
+
**showWindowedMeanValueLines (boolean, optional, default = false)**<br>
|
|
965
|
+
When `true`, displays lines representing the windowed mean values.
|
|
966
|
+
|
|
967
|
+
**barMargin (number, pixels, optional, default = 2)**<br>
|
|
968
|
+
Optional property that adds a margin to the top and bottom of the bars.
|
|
969
|
+
|
|
970
|
+
#### [⤒](#content) <span id="bar-plot-usage-view"><BarPlot/> view-modifying interactions</span>
|
|
971
|
+
|
|
972
|
+
**panEnabled**, **zoomEnabled**, **zoomKeyModifiersRequired**, **withCadenceOf**<br>
|
|
973
|
+
These properties behave the same as in [<ScatterPlot/>](#scatter-plot-usage-view).
|
|
974
|
+
|
|
975
|
+
### [⤒](#content) <span id="poincare-plot-usage"><PoincarePlot/></span>
|
|
976
|
+
|
|
977
|
+
The <PoincarePlot/> (also known as an iterates plot) is used to plot the current value of a series against its previous value (n vs n-1). This is useful for identifying patterns or oscillations in the data.
|
|
594
978
|
|
|
595
|
-
|
|
596
|
-
> Optional property that defaults for `false`. When set to `true` then enables "zooming" which allows the user to increase or decrease the displayed time range. By default, scrolling will cause the zoom effect. See the `zoomKeyModifiersRequired` property which requires the `shift` key to be pressed in order for the zoom action to apply.
|
|
979
|
+
#### [⤒](#content) <span id="poincare-plot-usage-base"><PoincarePlot/> base properties</span>
|
|
597
980
|
|
|
598
|
-
|
|
599
|
-
|
|
981
|
+
**interpolation (d3.CurveFactory, optional, default = undefined)**<br>
|
|
982
|
+
An optional property that defines how the line between iterates will be interpolated. Use `NoCurveFactory` to disable the line.
|
|
600
983
|
|
|
601
|
-
|
|
602
|
-
|
|
984
|
+
**showPoints (boolean, optional, default = false)**<br>
|
|
985
|
+
When `true`, displays individual data points on the plot.
|
|
986
|
+
|
|
987
|
+
#### [⤒](#content) <span id="poincare-plot-usage-view"><PoincarePlot/> view-modifying interactions</span>
|
|
988
|
+
|
|
989
|
+
**panEnabled**, **zoomEnabled**, **zoomKeyModifiersRequired**, **withCadenceOf**<br>
|
|
990
|
+
These properties behave the same as in [<ScatterPlot/>](#scatter-plot-usage-view).
|
|
603
991
|
|
|
604
992
|
## [⤒](#content) <span id="utilities">utilities</span>
|
|
605
993
|
|
|
@@ -609,23 +997,23 @@ The tracker, when enabled, follows the mouse when it is in the plot area, render
|
|
|
609
997
|
|
|
610
998
|
#### [⤒](#content) <span id="tracker-usage-base"><Tracker/> base properties</span>
|
|
611
999
|
|
|
612
|
-
|
|
613
|
-
|
|
1000
|
+
**visible (boolean)**<br>
|
|
1001
|
+
When set to `true` the tracker is visible when the mouse is in the plot area. When set to `false` the tracker is not shown.
|
|
614
1002
|
|
|
615
|
-
|
|
616
|
-
|
|
1003
|
+
**labelLocation ([TrackerLabelLocation](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/Tracker.tsx), optional, default = TrackerLabelLocation.WithMouse)**<br>
|
|
1004
|
+
Optional property specifies the location of the label. The `TrackerLabelLocation` is an enumeration with three values `Nowhere`, `WithMouse`, and `ByAxes`. By default, the label location is with the mouse (i.e. `WithMouse`). The `Nowhere` location can be used to hide the label, in cases where you would like to use your own. The `WithMouse` value has the label follow the mouse in the vertical direction along the tracker line. And the `ByAxes` displays the labels next to their respective axes, with the tracker line.
|
|
617
1005
|
|
|
618
|
-
|
|
619
|
-
|
|
1006
|
+
**onTrackerUpdate ((update: TrackerAxisUpdate) => void, optional, default = noop)**<br>
|
|
1007
|
+
Optional callback function that accepts the update from the tracker. Use this to display the tracker and data information outside of the <Chart/>. The `TrackerAxisUpdate` is a `Map<string, TrackerAxisInfo>`, the `TrackerAxisInfo` has the shape `{x: number, axisLocation: AxisLocation}`, and the `AxisLocation` is an same enumeration used for placing the axes on the chart (i.e. `AxisLocation.Bottom`, `AxisLocation.Top`).
|
|
620
1008
|
|
|
621
1009
|
|
|
622
1010
|
#### [⤒](#content) <span id="tracker-usage-styling"><Tracker/> styling</span>
|
|
623
1011
|
|
|
624
|
-
|
|
625
|
-
|
|
1012
|
+
**style ([TrackerStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/trackerUtils.ts), optional, default = {visible: false, color: '#d2933f', lineWidth: 1})**<br>
|
|
1013
|
+
Optional property defining the style for the tracker line. Has a shape of `{visible: boolean, color: string, lineWidth: number}`.
|
|
626
1014
|
|
|
627
|
-
|
|
628
|
-
|
|
1015
|
+
**font ([TrackerLabelFont](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/trackerUtils.ts), optional, default = {size: 12, color: '#d2933f', weight: 300, family: 'sans-serif'})**<br>
|
|
1016
|
+
Optional property defining the font for the tracker label. Has a shape of `{size: number, color: string, family: string, weight: number}`.
|
|
629
1017
|
|
|
630
1018
|
|
|
631
1019
|
### [⤒](#content) <span id="tooltip-usage"><Tooltip/></span>
|
|
@@ -634,32 +1022,32 @@ A tooltip renders information about the data over which the mouse is hovering. T
|
|
|
634
1022
|
|
|
635
1023
|
The properties for the lt;Tooltip/> are simple and limited. The tooltip content components have more options.
|
|
636
1024
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
1025
|
+
**visible (boolean)**<br>
|
|
1026
|
+
When set to `true` the the tooltip is shown when the mouse hovers over a data series or point.
|
|
1027
|
+
|
|
1028
|
+
**style ([TooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts), optional, default = [defaultTooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts) )**<br>
|
|
1029
|
+
Optional property defining the style of the tooltip. The following style elements are available
|
|
1030
|
+
1. **visible**<br>Visibility of the tooltip when the mouse hovers over a data series or point
|
|
1031
|
+
---
|
|
1032
|
+
2. **fontSize**<br>The size of the font displayed in the tooltip
|
|
1033
|
+
3. **fontColor**<br>The color of the text displayed in the tooltip
|
|
1034
|
+
4. **fontFamily**<br>The font weight for the text displayed in the tooltip
|
|
1035
|
+
5. **fontWeight**<br>The font weight for the text displayed in the tooltip
|
|
1036
|
+
---
|
|
1037
|
+
6. **backgroundColor**<br>The background color of the tooltip
|
|
1038
|
+
7. **backgroundOpacity**<br>The opacity of the background (i.e. how transparent it is)
|
|
1039
|
+
---
|
|
1040
|
+
8. **borderColor**<br>The color of the border surrounding the tooltip content
|
|
1041
|
+
9. **borderWidth**<br>The width of the border surrounding the tooltip content
|
|
1042
|
+
10. **borderRadius**<br>The radius of the border surrounding the tooltip content
|
|
1043
|
+
---
|
|
1044
|
+
11. **paddingLeft**<br>The padding to the left of the tooltip content
|
|
1045
|
+
12. **paddingRight**<br>The padding to the right of the tooltip content
|
|
1046
|
+
13. **paddingTop**<br>The padding to the top of the tooltip content
|
|
1047
|
+
14. **paddingBottom**<br>The padding to the bottom of the tooltip content
|
|
1048
|
+
|
|
1049
|
+
**children (<ScatterPlotTooltipContent/> and <RasterPlotTooltipContent/>)**<br>
|
|
1050
|
+
The tooltip content.
|
|
663
1051
|
|
|
664
1052
|
|
|
665
1053
|
### [⤒](#content) <span id="scatterplot-tooltip-usage"><ScatterPlotTooltipContent/></span>
|
|
@@ -676,61 +1064,88 @@ series name
|
|
|
676
1064
|
|
|
677
1065
|
---
|
|
678
1066
|
|
|
679
|
-
|
|
680
|
-
|
|
1067
|
+
**xLabel (string)**<br>
|
|
1068
|
+
Required property that gives a name to the x-values. This is the label for the x-values in the tooltip.
|
|
681
1069
|
|
|
682
|
-
|
|
683
|
-
|
|
1070
|
+
**yLabel (string)**<br>
|
|
1071
|
+
Required property that gives a name to the y-values. This is the label for the y-values in the tooltip.
|
|
684
1072
|
|
|
685
|
-
|
|
686
|
-
|
|
1073
|
+
**beforeHeader (string, optional, default = 'before')**<br>
|
|
1074
|
+
Optional property that gives a name to the data point that is immediately before the mouse location.
|
|
687
1075
|
|
|
688
|
-
|
|
689
|
-
|
|
1076
|
+
**afterHeader (string, optional, default = 'after')**<br>
|
|
1077
|
+
Optional property that gives a name to the data point that is immediately after the mouse location.
|
|
690
1078
|
|
|
691
|
-
|
|
692
|
-
|
|
1079
|
+
**deltaHeader (string, optional, default = '∆')**<br>
|
|
1080
|
+
Optional property that gives a name to the difference between the datum immediately before and after the mouse location.
|
|
693
1081
|
|
|
694
|
-
|
|
695
|
-
|
|
1082
|
+
**xValueFormatter ((value: number) => string, optional, default =** [**formatTime**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1083
|
+
Optional function that formats the x-value immediately before and after the mouse location. The default function formats that x-values as natural numbers representing milliseconds.
|
|
696
1084
|
|
|
697
|
-
|
|
698
|
-
|
|
1085
|
+
**yValueFormatter ((value: number) => string, optional, default =** [**formatValue**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1086
|
+
Optional function that formats the x-value immediately before and after the mouse location. The default function formats the y-values as floating point with 3 values to the right of the decimal point.
|
|
699
1087
|
|
|
700
|
-
|
|
701
|
-
|
|
1088
|
+
**xChangeFormatter ((value1: number, value2: number) => string, optional, default =** [**formatTimeChange**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1089
|
+
Optional function that formats the change in the x-value of the points immediately before and after the mouse location. The default function formats the value as a natural number.
|
|
702
1090
|
|
|
703
|
-
|
|
704
|
-
|
|
1091
|
+
**yChangeFormatter ((value1: number, value2: number) => string, optional, default =** [**formatValueChange**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1092
|
+
Optional function that formats the change in the y-value of the points immediately before and after the mouse location. The default function formats the value as floating point with 3 values to the right of the decimal point.
|
|
705
1093
|
|
|
706
|
-
|
|
707
|
-
|
|
1094
|
+
**style ([TooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts), optional, default = [defaultTooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts) )**<br>
|
|
1095
|
+
Optional styles for the tooltip content. The styles are the same as those for the <Tooltip/>.
|
|
708
1096
|
|
|
709
1097
|
|
|
710
1098
|
### [⤒](#content) <span id="rasterplot-tooltip-usage"><RasterTooltipContent/></span>
|
|
711
|
-
The <RasterPlotTooltipContent/> shows the series name, the time and value of the point over which the mouse is hovering. There are only three properties.
|
|
1099
|
+
The <RasterPlotTooltipContent/> shows the series name, the time, and value of the point over which the mouse is hovering. There are only three properties.
|
|
712
1100
|
|
|
713
|
-
|
|
714
|
-
|
|
1101
|
+
**xFormatter ((value: number) => string, optional, default =** [**formatTime**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1102
|
+
Optional function that formats the x-value immediately before and after the mouse location. The default function formats that x-values as natural numbers representing milliseconds.
|
|
715
1103
|
|
|
716
|
-
|
|
717
|
-
|
|
1104
|
+
**yFormatter ((value: number) => string, optional, default =** [**formatValue**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1105
|
+
Optional function that formats the x-value immediately before and after the mouse location. The default function formats the y-values as floating point with 3 values to the right of the decimal point.
|
|
718
1106
|
|
|
719
|
-
|
|
720
|
-
|
|
1107
|
+
**style ([TooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts), optional, default = [defaultTooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts) )**<br>
|
|
1108
|
+
Optional styles for the tooltip content. The styles are the same as those for the <Tooltip/>.
|
|
721
1109
|
|
|
722
|
-
|
|
1110
|
+
### [⤒](#content) <span id="barplot-tooltip-usage"><BarPlotTooltipContent/></span>
|
|
723
1111
|
|
|
724
|
-
|
|
725
|
-
```shell
|
|
726
|
-
npm install
|
|
727
|
-
npm run build
|
|
728
|
-
```
|
|
1112
|
+
The <BarPlotTooltipContent/> displays the series name and current statistics in a table format.
|
|
729
1113
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
1114
|
+
**ordinalUnits (string, optional)**<br>
|
|
1115
|
+
Optional units to display alongside the values.
|
|
1116
|
+
|
|
1117
|
+
**style ([TooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts), optional)**<br>
|
|
1118
|
+
Optional styles for the tooltip content.
|
|
1119
|
+
|
|
1120
|
+
### [⤒](#content) <span id="poincareplot-tooltip-usage"><PoincarePlotTooltipContent/></span>
|
|
1121
|
+
|
|
1122
|
+
The <PoincarePlotTooltipContent/> displays the series name and the current, previous, and next iterates in a table format.
|
|
1123
|
+
|
|
1124
|
+
**xLabel (string)**<br>
|
|
1125
|
+
Required label for the x-axis values.
|
|
1126
|
+
|
|
1127
|
+
**yLabel (string)**<br>
|
|
1128
|
+
Required label for the y-axis values.
|
|
1129
|
+
|
|
1130
|
+
**nMinusLagHeader**, **nHeader**, **nPlusLagHeader** (string, optional)<br>
|
|
1131
|
+
Optional headers for the previous, current, and next iterates.
|
|
1132
|
+
|
|
1133
|
+
**xValueFormatter**, **yValueFormatter**, **xChangeFormatter**, **yChangeFormatter** (optional)<br>
|
|
1134
|
+
Optional formatters for values and their changes.
|
|
1135
|
+
|
|
1136
|
+
**style ([TooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts), optional)**<br>
|
|
1137
|
+
Optional styles for the tooltip content.
|
|
1138
|
+
|
|
1139
|
+
## [⤒](#content) <span id="hooks">hooks</span>
|
|
1140
|
+
|
|
1141
|
+
For advanced usage, `stream-charts` provides several hooks to interact with the chart's internal state.
|
|
1142
|
+
|
|
1143
|
+
- **useChart()**: Access the chart's context, including dimensions, scales, and registration functions for tooltips and trackers.
|
|
1144
|
+
- **useAxes()**: Access the state of the x and y axes.
|
|
1145
|
+
- **usePlotDimensions()**: Access the dimensions of the plot area and margins.
|
|
1146
|
+
- **useDataObservable()**: Access the data stream observable.
|
|
1147
|
+
|
|
1148
|
+
## [⤒](#content) <span id="building">building</span>
|
|
734
1149
|
|
|
735
1150
|
Testing
|
|
736
1151
|
```shell
|