stream-charts 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +756 -343
- package/changes.md +7 -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,114 @@
|
|
|
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
|
-
`Charts` are composable using react components. So you can add different axis types, multiple axes, trackers, tooltips, and plots.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
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.
|
|
20
|
-
|
|
21
|
-
`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.
|
|
17
|
+
`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:
|
|
18
|
+
1. The [Chart](#chart-usage) serves as the container, holding the other components as children, and providing the data to the plot.
|
|
19
|
+
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.
|
|
20
|
+
3. The optional [Tracker](#tracker-usage) component shows the value associated with the current mouse location of the axes to which it is assigned.
|
|
21
|
+
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)).
|
|
22
|
+
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).
|
|
22
23
|
|
|
24
|
+
### [⤒](#content) <span id="axes">capabilities</span>
|
|
25
|
+
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).
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
Although still under development, there are two charts available:
|
|
27
|
+
Each plot type comes with a default tooltip and tooltip content. However, you can customize the tooltip and tooltip content to suit your needs.
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
2. scatter chart.
|
|
29
|
+
The charts are designed to be responsive to changes in size, for example, to support window resizing.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
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).
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
All aspects of the `Charts` style are exposed allowing you to use your favorite frameworks theme provider, or none at all.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
[example raster chart code](#example-raster-chart-code)<br>
|
|
36
|
-
[example scatter chart code](#example-scatter-chart-code)
|
|
35
|
+
`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
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
[data ttl, time-windows, performance](#data-ttl)<br>
|
|
37
|
+
### [⤒](#top) <span id="content">rendering performance</span>
|
|
38
|
+
Charts can easily ingest and plot new data for about 100 time-series every 25 ms.
|
|
41
39
|
|
|
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>
|
|
40
|
+
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
41
|
|
|
49
|
-
|
|
50
|
-
[<ContinousAxis/>](#continuous-axes-usage)<br>
|
|
51
|
-
[base properties](#continuous-axes-usage-base)<br>
|
|
52
|
-
[styling](#continuous-axes-usage-styling)<br>
|
|
42
|
+
`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
43
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
To achieve this type of performance, the charts:
|
|
45
|
+
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
|
|
46
|
+
2. are implemented using [d3](https://d3js.org) SVG elements wrapped in [react](https://reactjs.org) functional components, and
|
|
47
|
+
3. keep chart updates outside [react](https://reactjs.org)'s render cycle.
|
|
57
48
|
|
|
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
49
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
[view-modifying interactions](#raster-plot-usage-view)<br>
|
|
50
|
+
### [⤒](#top) <span id="content">project status</span>
|
|
51
|
+
The following plots are currently available:
|
|
66
52
|
|
|
67
|
-
**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
53
|
+
1. **Scatter Plot**: for plotting time-series data.
|
|
54
|
+
2. **Raster Plot**: for plotting event-timing data.
|
|
55
|
+
3. **Bar Plot**: for plotting windowed stats (min, max, mean).
|
|
56
|
+
4. **Poincare Plot**: for plotting iterates (n vs n-1).
|
|
71
57
|
|
|
72
|
-
|
|
58
|
+
Over time, I'll add additional chart types. In the meantime, I welcome any contributions to create new chart types (gauges, etc).
|
|
73
59
|
|
|
74
|
-
|
|
60
|
+
## [⤒](#top) <span id="content">content</span>
|
|
75
61
|
|
|
76
|
-
|
|
62
|
+
**[quick start](#quick-start)**
|
|
63
|
+
- [example raster chart code](#example-raster-chart-code)
|
|
64
|
+
- [example scatter chart code](#example-scatter-chart-code)
|
|
65
|
+
- [example bar chart code](#example-bar-chart-code)
|
|
66
|
+
- [example poincare chart code](#example-poincare-chart-code)
|
|
67
|
+
|
|
68
|
+
**[intro](#intro)**
|
|
69
|
+
- [terminology](#terminology)
|
|
70
|
+
- [data ttl, time-windows, performance](#data-ttl)
|
|
71
|
+
|
|
72
|
+
**[chart](#chart)**
|
|
73
|
+
- [<Chart/>](#chart-usage)
|
|
74
|
+
- [dimensions](#chart-usage-dimensions)
|
|
75
|
+
- [styling](#chart-usage-styling)
|
|
76
|
+
- [initial data](#chart-usage-initial-data)
|
|
77
|
+
- [streaming data](#chart-usage-streaming-data)
|
|
78
|
+
|
|
79
|
+
**[axes](#axes)**
|
|
80
|
+
- [<ContinuousAxis/>](#continuous-axes-usage)
|
|
81
|
+
- [base properties](#continuous-axes-usage-base)
|
|
82
|
+
- [styling](#continuous-axes-usage-styling)
|
|
83
|
+
|
|
84
|
+
- [<OrdinalAxis/>](#ordinal-axes-usage)
|
|
85
|
+
- [base properties](#ordinal-axes-usage-base)
|
|
86
|
+
- [styling](#ordinal-axes-usage-styling)
|
|
87
|
+
|
|
88
|
+
**[plots](#plots)**
|
|
89
|
+
- [<ScatterPlot/>](#scatter-plot-usage)
|
|
90
|
+
- [base properties](#scatter-plot-usage-base)
|
|
91
|
+
- [view-modifying interactions](#scatter-plot-usage-view)
|
|
92
|
+
|
|
93
|
+
- [<RasterPlot/>](#raster-plot-usage)
|
|
94
|
+
- [base properties](#raster-plot-usage-base)
|
|
95
|
+
- [view-modifying interactions](#raster-plot-usage-view)
|
|
96
|
+
|
|
97
|
+
- [<BarPlot/>](#bar-plot-usage)
|
|
98
|
+
- [base properties](#bar-plot-usage-base)
|
|
99
|
+
- [view-modifying interactions](#bar-plot-usage-view)
|
|
100
|
+
|
|
101
|
+
- [<PoincarePlot/>](#poincare-plot-usage)
|
|
102
|
+
- [base properties](#poincare-plot-usage-base)
|
|
103
|
+
- [view-modifying interactions](#poincare-plot-usage-view)
|
|
104
|
+
|
|
105
|
+
**[utilities](#utilities)**
|
|
106
|
+
- [<Tracker/>](#tracker-usage)
|
|
107
|
+
- [base properties](#tracker-usage-base)
|
|
108
|
+
- [styling](#tracker-usage-styling)
|
|
109
|
+
- [<Tooltip/>](#tooltip-usage)
|
|
110
|
+
- [<RasterPlotTooltipContent/>](#rasterplot-tooltip-usage)
|
|
111
|
+
- [<ScatterPlotTooltipContent/>](#scatterplot-tooltip-usage)
|
|
112
|
+
- [<BarPlotTooltipContent/>](#barplot-tooltip-usage)
|
|
113
|
+
- [<PoincarePlotTooltipContent/>](#poincareplot-tooltip-usage)
|
|
114
|
+
- [hooks](#hooks)
|
|
77
115
|
|
|
78
116
|
|
|
79
117
|
## [⤒](#content) <span id="quick-start">quick start</span>
|
|
@@ -83,66 +121,99 @@ npm install stream-charts
|
|
|
83
121
|
```
|
|
84
122
|
|
|
85
123
|
### [⤒](#content) <span id="example-raster-chart-code">example raster chart</span>
|
|
86
|
-
|
|
124
|
+
An example raster chart (see [example](https://github.com/robphilipp/stream-charts-examples/blob/master/src/app/examples/StreamingRasterChart.tsx))
|
|
87
125
|
|
|
88
|
-

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

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

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

|
|
493
|
+
|
|
494
|
+
```typescript jsx
|
|
495
|
+
<Chart
|
|
496
|
+
chartId={chartId.current}
|
|
497
|
+
width={useGridCellWidth()}
|
|
498
|
+
height={useGridCellHeight()}
|
|
499
|
+
margin={{...defaultMargin, top: 40, bottom: 30, right: 60}}
|
|
500
|
+
// svgStyle={{'background-color': 'pink'}}
|
|
501
|
+
color={theme.color}
|
|
502
|
+
backgroundColor={theme.backgroundColor}
|
|
503
|
+
seriesStyles={new Map([
|
|
504
|
+
['test1', {
|
|
505
|
+
...defaultLineStyle(),
|
|
506
|
+
color: 'orange',
|
|
507
|
+
lineWidth: 1,
|
|
508
|
+
highlightColor: 'orange'
|
|
509
|
+
}],
|
|
510
|
+
['test2', {
|
|
511
|
+
...defaultLineStyle(),
|
|
512
|
+
color: theme.name === 'light' ? 'blue' : 'gray',
|
|
513
|
+
lineWidth: 1,
|
|
514
|
+
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
515
|
+
highlightWidth: 5
|
|
516
|
+
}],
|
|
517
|
+
['test3', {
|
|
518
|
+
...defaultLineStyle(),
|
|
519
|
+
color: theme.name === 'light' ? 'red' : 'gray',
|
|
520
|
+
lineWidth: 1,
|
|
521
|
+
highlightColor: theme.name === 'light' ? 'dodgerblue' : 'gray',
|
|
522
|
+
highlightWidth: 5
|
|
523
|
+
}],
|
|
524
|
+
])}
|
|
525
|
+
initialData={initialDataRef.current}
|
|
526
|
+
// seriesFilter={filter}
|
|
527
|
+
seriesObservable={observableRef.current}
|
|
528
|
+
shouldSubscribe={running}
|
|
529
|
+
onUpdateChartTime={handleChartTimeUpdate}
|
|
530
|
+
windowingTime={25}
|
|
531
|
+
>
|
|
532
|
+
<ContinuousAxis
|
|
533
|
+
axisId="x-axis-1"
|
|
534
|
+
location={AxisLocation.Bottom}
|
|
535
|
+
domain={axesRange}
|
|
536
|
+
label="f[n](x)"
|
|
537
|
+
updateAxisBasedOnDomainValues={false}
|
|
538
|
+
/>
|
|
539
|
+
<ContinuousAxis
|
|
540
|
+
axisId="y-axis-1"
|
|
541
|
+
location={AxisLocation.Left}
|
|
542
|
+
domain={axesRange}
|
|
543
|
+
label={`f[n+${lagN}](x)`}
|
|
544
|
+
updateAxisBasedOnDomainValues={false}
|
|
545
|
+
/>
|
|
546
|
+
<ContinuousAxis
|
|
547
|
+
axisId="x-axis-2"
|
|
548
|
+
location={AxisLocation.Top}
|
|
549
|
+
domain={axesRange}
|
|
550
|
+
label="f[n](x)"
|
|
551
|
+
updateAxisBasedOnDomainValues={false}
|
|
552
|
+
/>
|
|
553
|
+
<ContinuousAxis
|
|
554
|
+
axisId="y-axis-2"
|
|
555
|
+
location={AxisLocation.Right}
|
|
556
|
+
domain={axesRange}
|
|
557
|
+
label={`f[n+${lagN}](x)`}
|
|
558
|
+
updateAxisBasedOnDomainValues={false}
|
|
559
|
+
/>
|
|
560
|
+
<Tracker
|
|
561
|
+
key="tracker-x-axis"
|
|
562
|
+
visible={visibility.tracker}
|
|
563
|
+
// labelLocation={TrackerLabelLocation.Nowhere}
|
|
564
|
+
labelLocation={TrackerLabelLocation.ByAxis}
|
|
565
|
+
trackerAxis={AxisLocation.Bottom}
|
|
566
|
+
labelFormatter={x => `${d3.format(",.3f")(x)}`}
|
|
567
|
+
style={{color: theme.color}}
|
|
568
|
+
font={{color: theme.color}}
|
|
569
|
+
// onTrackerUpdate={update => console.dir("bottom", update)}
|
|
570
|
+
/>
|
|
571
|
+
<Tracker
|
|
572
|
+
key="tracker-y-axis"
|
|
573
|
+
visible={visibility.tracker}
|
|
574
|
+
// labelLocation={TrackerLabelLocation.Nowhere}
|
|
575
|
+
labelLocation={TrackerLabelLocation.ByAxis}
|
|
576
|
+
trackerAxis={AxisLocation.Left}
|
|
577
|
+
labelFormatter={x => `${d3.format(",.3f")(x)}`}
|
|
578
|
+
style={{color: theme.color}}
|
|
579
|
+
font={{color: theme.color}}
|
|
580
|
+
// onTrackerUpdate={update => console.dir("left", update)}
|
|
581
|
+
/>
|
|
582
|
+
<Tooltip
|
|
583
|
+
visible={visibility.tooltip}
|
|
584
|
+
style={{
|
|
585
|
+
fontColor: theme.color,
|
|
586
|
+
backgroundColor: theme.backgroundColor,
|
|
587
|
+
borderColor: theme.color,
|
|
588
|
+
backgroundOpacity: 0.9,
|
|
589
|
+
}}
|
|
590
|
+
>
|
|
591
|
+
<PoincarePlotTooltipContent
|
|
592
|
+
xLabel="t (ms)"
|
|
593
|
+
yLabel="f(x)"
|
|
594
|
+
yValueFormatter={value => formatNumber(value, " ,.4f")}
|
|
595
|
+
style={{
|
|
596
|
+
...defaultTooltipStyle,
|
|
597
|
+
fontColor: 'black',
|
|
598
|
+
// fontColor: theme.color,
|
|
599
|
+
fontWeight: 650
|
|
600
|
+
}}
|
|
601
|
+
/>
|
|
602
|
+
</Tooltip>
|
|
603
|
+
<PoincarePlot
|
|
604
|
+
interpolation={interpolation}
|
|
605
|
+
dropDataAfter={dropAfterMs}
|
|
606
|
+
panEnabled={true}
|
|
607
|
+
zoomEnabled={true}
|
|
608
|
+
zoomKeyModifiersRequired={true}
|
|
609
|
+
// withCadenceOf={30}
|
|
610
|
+
/>
|
|
611
|
+
</Chart>
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
## [⤒](#content) <span id="intro">intro</span>
|
|
615
|
+
|
|
616
|
+
`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.
|
|
617
|
+
|
|
618
|
+
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
619
|
|
|
282
620
|
### [⤒](#content) <span id="terminology">terminology</span>
|
|
283
621
|
|
|
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
|
|
622
|
+
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
623
|
|
|
286
|
-
|
|
287
|
-
|
|
624
|
+
**<Chart/>** [↴](#chart)<br>
|
|
625
|
+
Generic container which holds the `Axes`, `Plot`, `Tracker`, `Tooltip`.
|
|
288
626
|
|
|
289
|
-
|
|
290
|
-
|
|
627
|
+
**Axes** [↴](#axes)<br>
|
|
628
|
+
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
629
|
|
|
292
|
-
|
|
293
|
-
|
|
630
|
+
**Plot** [↴](#plots)<br>
|
|
631
|
+
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
632
|
|
|
295
|
-
|
|
296
|
-
|
|
633
|
+
**<Tracker/>** [↴](#tracker-usage)<br>
|
|
634
|
+
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
635
|
|
|
298
|
-
|
|
299
|
-
|
|
636
|
+
**<Tooltip/>** [↴](#tooltip-usage)<br>
|
|
637
|
+
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
638
|
|
|
301
639
|
### [⤒](#content) <span id="data-ttl">data ttl, time-windows, performance</span>
|
|
302
640
|
|
|
@@ -327,93 +665,92 @@ The `Chart`s properties fall into four categories:
|
|
|
327
665
|
4. streamed data and how to manage the stream of data
|
|
328
666
|
|
|
329
667
|
#### [⤒](#content) <span id="chart-usage-dimensions"><Chart/> dimensions</span>
|
|
330
|
-
|
|
331
|
-
|
|
668
|
+
**width (pixels)**<br>
|
|
669
|
+
The width (in pixels) of the container that holds the chart. The actual plot will be smaller based on the margins.
|
|
332
670
|
|
|
333
|
-
|
|
334
|
-
|
|
671
|
+
**height (pixels)**<br>
|
|
672
|
+
The height (in pixels) of the container that holds the chart. The actual plot will be smaller based on the margins.
|
|
335
673
|
|
|
336
674
|
#### [⤒](#content) <span id="chart-usage-styling"><Chart/> styling</span>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
675
|
+
**margin ([Margin](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/margins.ts), optional)**<br>
|
|
676
|
+
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.
|
|
677
|
+
|
|
678
|
+
The Margin has the following shape
|
|
341
679
|
>```typescript
|
|
342
680
|
>interface Margin {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
681
|
+
top: number
|
|
682
|
+
bottom: number
|
|
683
|
+
left: number
|
|
684
|
+
right: number
|
|
347
685
|
>}
|
|
348
686
|
>```
|
|
349
687
|
|
|
350
688
|
|
|
351
|
-
|
|
352
|
-
|
|
689
|
+
**color (string, optional)**<br>
|
|
690
|
+
The color of the axis lines and text, which can be overridden specifically by the axes styles.
|
|
691
|
+
|
|
692
|
+
**backgroundColor (string, optional)**<br>
|
|
693
|
+
The color of the chart background (the whole chart, not just the plot).
|
|
353
694
|
|
|
354
|
-
|
|
355
|
-
|
|
695
|
+
**svgStyle ([SvgStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/svgStyle.ts), optional)**<br>
|
|
696
|
+
The style attributes for the main SVG element, in case you want to change those. Generally, this is not needed.
|
|
356
697
|
|
|
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
|
|
698
|
+
The SvgStyle has the following shape
|
|
361
699
|
>```typescript
|
|
362
700
|
>interface SvgStyle {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
701
|
+
height?: string | number
|
|
702
|
+
width?: string | number
|
|
703
|
+
outline?: string
|
|
704
|
+
// any valid SVG CSS attribute
|
|
705
|
+
[propName: string]: any
|
|
368
706
|
>}
|
|
369
707
|
>```
|
|
370
708
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
709
|
+
**seriesStyles (Map<string, [SeriesLineStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) >, optional)**<br>
|
|
710
|
+
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.
|
|
711
|
+
|
|
712
|
+
The SeriesLineStyle has the following shape
|
|
713
|
+
```typescript
|
|
714
|
+
interface SeriesLineStyle {
|
|
715
|
+
color: string
|
|
716
|
+
lineWidth: number
|
|
717
|
+
// the color of the series when the user mouses over the series
|
|
718
|
+
highlightColor: string
|
|
719
|
+
// the line width of the series when the user mouses over the series
|
|
720
|
+
highlightWidth: number
|
|
721
|
+
// the line margin used for raster charts
|
|
722
|
+
margin?: number
|
|
723
|
+
}
|
|
386
724
|
>```
|
|
387
725
|
|
|
388
726
|
#### [⤒](#content) <span id="chart-usage-initial-data"><Chart/> initial data</span>
|
|
389
727
|
|
|
390
728
|
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
729
|
|
|
392
|
-
|
|
393
|
-
|
|
730
|
+
**initialData (Array<[Series](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/datumSeries.ts) >)**<br>
|
|
731
|
+
An array holding the initial data series to be plotted before subscribing to the chart-data observable.
|
|
394
732
|
>
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
> }
|
|
733
|
+
The Series has the following shape
|
|
734
|
+
```typescript
|
|
735
|
+
interface Series {
|
|
736
|
+
// the series name
|
|
737
|
+
readonly name: string
|
|
738
|
+
// the array of time-value pairs
|
|
739
|
+
data: Array<Datum>
|
|
740
|
+
// ... accessor functions
|
|
741
|
+
// .
|
|
742
|
+
// .
|
|
743
|
+
// .
|
|
744
|
+
}
|
|
745
|
+
```
|
|
746
|
+
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
|
|
747
|
+
```typescript
|
|
748
|
+
interface Datum {
|
|
749
|
+
readonly time: number;
|
|
750
|
+
readonly value: number;
|
|
751
|
+
}
|
|
415
752
|
>```
|
|
416
|
-
|
|
753
|
+
There are a number of helper functions for creating `Series` and `Datum`.
|
|
417
754
|
>> `seriesFrom(name: string, data: Array<Datum> = []): Series`<br>
|
|
418
755
|
>> `seriesFromTuples(name: string, data: Array<[number, number]> = []): Series`<br>
|
|
419
756
|
>> `emptySeries(name: string): Series`<br>
|
|
@@ -423,42 +760,42 @@ Holds the initial (static data). This data is displayed in the chart even before
|
|
|
423
760
|
|
|
424
761
|
A set of properties, functions, and callbacks to control and observe the streaming of live data into the chart.
|
|
425
762
|
|
|
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
|
-
|
|
763
|
+
**seriesObservable (Observable<[ChartData](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/chartData.ts) >)**<br>
|
|
764
|
+
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.
|
|
765
|
+
```typescript
|
|
766
|
+
function randomSpikeDataObservable(
|
|
767
|
+
series: Array<Series>,
|
|
768
|
+
updatePeriod: number = UPDATE_PERIOD_MS,
|
|
769
|
+
spikeProbability: number = 0.1
|
|
770
|
+
): Observable<ChartData> {
|
|
771
|
+
const seriesNames = series.map(series => series.name)
|
|
772
|
+
const initialData = initialChartData(series)
|
|
773
|
+
return interval(updatePeriod).pipe(
|
|
774
|
+
// convert the number sequence to a time
|
|
775
|
+
map(sequence => (sequence + 1) * updatePeriod),
|
|
776
|
+
// create a random spike for each series
|
|
777
|
+
map((time) => randomSpikeData(time, seriesNames, initialData.maxTimes, updatePeriod, spikeProbability))
|
|
778
|
+
)
|
|
779
|
+
}
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
**shouldSubscribe (boolean, optional, default = false)**<br>
|
|
783
|
+
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.
|
|
784
|
+
|
|
785
|
+
**windowingTime (number, milliseconds, optional, default = 100 ms)**<br>
|
|
786
|
+
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.
|
|
787
|
+
|
|
788
|
+
**shouldSubscribe (number, optional, default = false)**<br>
|
|
789
|
+
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.
|
|
790
|
+
|
|
791
|
+
**onSubscribe (callback function, (subscription: Subscription) => void, optional, default = noop**<br>
|
|
792
|
+
Optional callback function that is called when the <Chart/> subscribes to the `ChartData` observable.
|
|
793
|
+
|
|
794
|
+
**onUpdateData (callback function, (seriesName: string, data: Array<Datum>)) => void, optional, default = noop)**<br>
|
|
795
|
+
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.
|
|
796
|
+
|
|
797
|
+
**onUpdateTime (callback function, (times: Map<string, [start: number, end: number]>) => void, optional, default = noop)**<br>
|
|
798
|
+
Optional callback this is called whenever the time-ranges change. Use this to track the current time of the plot.
|
|
462
799
|
|
|
463
800
|
## [⤒](#content) <span id="axes">axes</span>
|
|
464
801
|
|
|
@@ -472,67 +809,67 @@ When creating a <ContinuousAxis/>, you must specify its location using the
|
|
|
472
809
|
|
|
473
810
|
The base properties defining the axis.
|
|
474
811
|
|
|
475
|
-
|
|
476
|
-
|
|
812
|
+
**axisId (string)**<br>
|
|
813
|
+
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
814
|
|
|
478
|
-
|
|
479
|
-
|
|
815
|
+
**location ([AxisLocation](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) )**<br>
|
|
816
|
+
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
817
|
|
|
481
|
-
|
|
482
|
-
|
|
818
|
+
**scale (ScaleContinuousNumeric<number, number>, optional, default = d3.scaleLinear)**<br>
|
|
819
|
+
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
820
|
|
|
484
|
-
|
|
485
|
-
|
|
821
|
+
**domain ([min: number, max: number])**<br>
|
|
822
|
+
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
823
|
|
|
487
|
-
|
|
488
|
-
|
|
824
|
+
**label (string)**<br>
|
|
825
|
+
The axis label.
|
|
489
826
|
|
|
490
827
|
#### [⤒](#content) <span id="continuous-axes-usage-styling"><ContinuousAxis/> styling</span>
|
|
491
828
|
|
|
492
829
|
A set of properties to update the style of the axes.
|
|
493
830
|
|
|
494
|
-
|
|
495
|
-
|
|
831
|
+
**font (Partial<[AxesLabelFont](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) >)**<br>
|
|
832
|
+
An optional CSS properties specifying the font for the axis and tick labels.
|
|
496
833
|
|
|
497
834
|
|
|
498
|
-
### [⤒](#content) <span id="
|
|
835
|
+
### [⤒](#content) <span id="ordinal-axes-usage"><OrdinalAxis/></span>
|
|
499
836
|
|
|
500
|
-
The <
|
|
837
|
+
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
838
|
|
|
502
|
-
When creating
|
|
839
|
+
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
840
|
|
|
504
|
-
#### [⤒](#content) <span id="
|
|
841
|
+
#### [⤒](#content) <span id="ordinal-axes-usage-base"><OrdinalAxis/> base properties</span>
|
|
505
842
|
|
|
506
843
|
The base properties defining the axis.
|
|
507
844
|
|
|
508
|
-
|
|
509
|
-
|
|
845
|
+
**axisId (string)**<br>
|
|
846
|
+
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
847
|
|
|
511
|
-
|
|
512
|
-
|
|
848
|
+
**location ([AxisLocation](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) )**<br>
|
|
849
|
+
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
850
|
|
|
514
|
-
|
|
515
|
-
|
|
851
|
+
**categories (Array<string>)**<br>
|
|
852
|
+
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
853
|
|
|
517
|
-
|
|
518
|
-
|
|
854
|
+
**domain ([min: number, max: number])**<br>
|
|
855
|
+
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
856
|
|
|
520
|
-
|
|
521
|
-
|
|
857
|
+
**label (string)**<br>
|
|
858
|
+
The axis label.
|
|
522
859
|
|
|
523
|
-
#### [⤒](#content) <span id="
|
|
860
|
+
#### [⤒](#content) <span id="ordinal-axes-usage-styling"><OrdinalAxis/> styling</span>
|
|
524
861
|
|
|
525
862
|
A set of properties to update the style of the axes.
|
|
526
863
|
|
|
527
|
-
|
|
528
|
-
|
|
864
|
+
**font (Partial<[AxesLabelFont](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/axes.ts) >, optional)**<br>
|
|
865
|
+
An optional CSS properties specifying the font for the axis and tick labels.
|
|
529
866
|
|
|
530
867
|
|
|
531
868
|
## [⤒](#content) <span id="plots">plots</span>
|
|
532
869
|
|
|
533
870
|
### [⤒](#content) <span id="scatter-plot-usage"><ScatterPlot/></span>
|
|
534
871
|
|
|
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), [<
|
|
872
|
+
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
873
|
|
|
537
874
|
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
875
|
|
|
@@ -540,66 +877,115 @@ The <ScatterPlot/> specifically is used to plot time-series data, where th
|
|
|
540
877
|
|
|
541
878
|
#### [⤒](#content) <span id="scatter-plot-usage-base"><ScatterPlot/> base properties</span>
|
|
542
879
|
|
|
543
|
-
|
|
544
|
-
|
|
880
|
+
**axisAssignments (Map<string, [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts) >, optional, default = Map())**<br>
|
|
881
|
+
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
882
|
|
|
546
|
-
|
|
547
|
-
|
|
883
|
+
**interpolation (d3.CurveFactory, optional, default = d3.curveLinear)**<br>
|
|
884
|
+
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
885
|
|
|
549
|
-
|
|
550
|
-
|
|
886
|
+
<span id="scatter-plot-drop">**dropDataAfter (number, milliseconds, opitional, default = Infinity)**</span><br>
|
|
887
|
+
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
888
|
|
|
552
889
|
#### [⤒](#content) <span id="scatter-plot-usage-view"><ScatterPlot/> view-modifying interactions</span>
|
|
553
890
|
|
|
554
891
|
View-modifying interactions are those that change the way the data is displayed. For example, zooming in time, panning in time.
|
|
555
892
|
|
|
556
|
-
|
|
557
|
-
|
|
893
|
+
**panEnabled (boolean, optional, default = false)**<br>
|
|
894
|
+
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
895
|
|
|
559
|
-
|
|
560
|
-
|
|
896
|
+
**zoomEnabled (boolean, optional, default = false)**<br>
|
|
897
|
+
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
898
|
|
|
562
|
-
|
|
563
|
-
|
|
899
|
+
**zoomKeyModifiersRequired (boolean, optional, default = false)**<br>
|
|
900
|
+
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
901
|
|
|
565
|
-
|
|
566
|
-
|
|
902
|
+
**withCadenceOf (number, optional, default = undefinded)**<br>
|
|
903
|
+
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
904
|
|
|
568
905
|
|
|
569
906
|
### [⤒](#content) <span id="raster-plot-usage"><RasterPlot/></span>
|
|
570
907
|
|
|
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), [<
|
|
908
|
+
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
909
|
|
|
573
910
|
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
911
|
|
|
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 [<
|
|
912
|
+
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
913
|
|
|
577
914
|
#### [⤒](#content) <span id="raster-plot-usage-base"><RasterPlot/> base properties</span>
|
|
578
915
|
|
|
579
|
-
|
|
580
|
-
|
|
916
|
+
**axisAssignments (Map<string, [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts) >, optional, default = Map())**<br>
|
|
917
|
+
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
918
|
|
|
582
|
-
|
|
583
|
-
|
|
919
|
+
<span id="raster-plot-drop">**dropDataAfter (number, milliseconds, opitional, default = Infinity)**</span><br>
|
|
920
|
+
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
921
|
|
|
585
|
-
|
|
586
|
-
|
|
922
|
+
**spikeMargin (number, pixels, default = 2)**<br>
|
|
923
|
+
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
924
|
|
|
588
925
|
#### [⤒](#content) <span id="raster-plot-usage-view"><RasterPlot/> view-modifying interactions</span>
|
|
589
926
|
|
|
590
927
|
View-modifying interactions are those that change the way the data is displayed. For example, zooming in time, panning in time.
|
|
591
928
|
|
|
592
|
-
|
|
593
|
-
|
|
929
|
+
**panEnabled (boolean, optional, default = false)**<br>
|
|
930
|
+
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.
|
|
931
|
+
|
|
932
|
+
**zoomEnabled (boolean, optional, default = false)**<br>
|
|
933
|
+
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.
|
|
934
|
+
|
|
935
|
+
**zoomKeyModifiersRequired (boolean, optional, default = false)**<br>
|
|
936
|
+
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.
|
|
937
|
+
|
|
938
|
+
**withCadenceOf (number, optional, default = undefinded)**<br>
|
|
939
|
+
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.
|
|
940
|
+
|
|
941
|
+
### [⤒](#content) <span id="bar-plot-usage"><BarPlot/></span>
|
|
942
|
+
|
|
943
|
+
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.
|
|
944
|
+
|
|
945
|
+
#### [⤒](#content) <span id="bar-plot-usage-base"><BarPlot/> base properties</span>
|
|
946
|
+
|
|
947
|
+
**axisAssignments (Map<string, [AxesAssignment](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/plot.ts) >, optional, default = Map())**<br>
|
|
948
|
+
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.
|
|
949
|
+
|
|
950
|
+
**showMinMaxBars (boolean, optional, default = false)**<br>
|
|
951
|
+
When `true`, displays bars representing the minimum and maximum values in the data.
|
|
952
|
+
|
|
953
|
+
**showWindowedMinMaxBars (boolean, optional, default = false)**<br>
|
|
954
|
+
When `true`, displays bars representing the windowed minimum and maximum values.
|
|
955
|
+
|
|
956
|
+
**showValueLines (boolean, optional, default = false)**<br>
|
|
957
|
+
When `true`, displays lines representing the current values of the data series.
|
|
958
|
+
|
|
959
|
+
**showMeanValueLines (boolean, optional, default = false)**<br>
|
|
960
|
+
When `true`, displays lines representing the mean values of the data series.
|
|
961
|
+
|
|
962
|
+
**showWindowedMeanValueLines (boolean, optional, default = false)**<br>
|
|
963
|
+
When `true`, displays lines representing the windowed mean values.
|
|
964
|
+
|
|
965
|
+
**barMargin (number, pixels, optional, default = 2)**<br>
|
|
966
|
+
Optional property that adds a margin to the top and bottom of the bars.
|
|
967
|
+
|
|
968
|
+
#### [⤒](#content) <span id="bar-plot-usage-view"><BarPlot/> view-modifying interactions</span>
|
|
969
|
+
|
|
970
|
+
**panEnabled**, **zoomEnabled**, **zoomKeyModifiersRequired**, **withCadenceOf**<br>
|
|
971
|
+
These properties behave the same as in [<ScatterPlot/>](#scatter-plot-usage-view).
|
|
972
|
+
|
|
973
|
+
### [⤒](#content) <span id="poincare-plot-usage"><PoincarePlot/></span>
|
|
974
|
+
|
|
975
|
+
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
976
|
|
|
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.
|
|
977
|
+
#### [⤒](#content) <span id="poincare-plot-usage-base"><PoincarePlot/> base properties</span>
|
|
597
978
|
|
|
598
|
-
|
|
599
|
-
|
|
979
|
+
**interpolation (d3.CurveFactory, optional, default = undefined)**<br>
|
|
980
|
+
An optional property that defines how the line between iterates will be interpolated. Use `NoCurveFactory` to disable the line.
|
|
600
981
|
|
|
601
|
-
|
|
602
|
-
|
|
982
|
+
**showPoints (boolean, optional, default = false)**<br>
|
|
983
|
+
When `true`, displays individual data points on the plot.
|
|
984
|
+
|
|
985
|
+
#### [⤒](#content) <span id="poincare-plot-usage-view"><PoincarePlot/> view-modifying interactions</span>
|
|
986
|
+
|
|
987
|
+
**panEnabled**, **zoomEnabled**, **zoomKeyModifiersRequired**, **withCadenceOf**<br>
|
|
988
|
+
These properties behave the same as in [<ScatterPlot/>](#scatter-plot-usage-view).
|
|
603
989
|
|
|
604
990
|
## [⤒](#content) <span id="utilities">utilities</span>
|
|
605
991
|
|
|
@@ -609,23 +995,23 @@ The tracker, when enabled, follows the mouse when it is in the plot area, render
|
|
|
609
995
|
|
|
610
996
|
#### [⤒](#content) <span id="tracker-usage-base"><Tracker/> base properties</span>
|
|
611
997
|
|
|
612
|
-
|
|
613
|
-
|
|
998
|
+
**visible (boolean)**<br>
|
|
999
|
+
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
1000
|
|
|
615
|
-
|
|
616
|
-
|
|
1001
|
+
**labelLocation ([TrackerLabelLocation](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/Tracker.tsx), optional, default = TrackerLabelLocation.WithMouse)**<br>
|
|
1002
|
+
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
1003
|
|
|
618
|
-
|
|
619
|
-
|
|
1004
|
+
**onTrackerUpdate ((update: TrackerAxisUpdate) => void, optional, default = noop)**<br>
|
|
1005
|
+
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
1006
|
|
|
621
1007
|
|
|
622
1008
|
#### [⤒](#content) <span id="tracker-usage-styling"><Tracker/> styling</span>
|
|
623
1009
|
|
|
624
|
-
|
|
625
|
-
|
|
1010
|
+
**style ([TrackerStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/trackerUtils.ts), optional, default = {visible: false, color: '#d2933f', lineWidth: 1})**<br>
|
|
1011
|
+
Optional property defining the style for the tracker line. Has a shape of `{visible: boolean, color: string, lineWidth: number}`.
|
|
626
1012
|
|
|
627
|
-
|
|
628
|
-
|
|
1013
|
+
**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>
|
|
1014
|
+
Optional property defining the font for the tracker label. Has a shape of `{size: number, color: string, family: string, weight: number}`.
|
|
629
1015
|
|
|
630
1016
|
|
|
631
1017
|
### [⤒](#content) <span id="tooltip-usage"><Tooltip/></span>
|
|
@@ -634,32 +1020,32 @@ A tooltip renders information about the data over which the mouse is hovering. T
|
|
|
634
1020
|
|
|
635
1021
|
The properties for the lt;Tooltip/> are simple and limited. The tooltip content components have more options.
|
|
636
1022
|
|
|
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
|
-
|
|
1023
|
+
**visible (boolean)**<br>
|
|
1024
|
+
When set to `true` the the tooltip is shown when the mouse hovers over a data series or point.
|
|
1025
|
+
|
|
1026
|
+
**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>
|
|
1027
|
+
Optional property defining the style of the tooltip. The following style elements are available
|
|
1028
|
+
1. **visible**<br>Visibility of the tooltip when the mouse hovers over a data series or point
|
|
1029
|
+
---
|
|
1030
|
+
2. **fontSize**<br>The size of the font displayed in the tooltip
|
|
1031
|
+
3. **fontColor**<br>The color of the text displayed in the tooltip
|
|
1032
|
+
4. **fontFamily**<br>The font weight for the text displayed in the tooltip
|
|
1033
|
+
5. **fontWeight**<br>The font weight for the text displayed in the tooltip
|
|
1034
|
+
---
|
|
1035
|
+
6. **backgroundColor**<br>The background color of the tooltip
|
|
1036
|
+
7. **backgroundOpacity**<br>The opacity of the background (i.e. how transparent it is)
|
|
1037
|
+
---
|
|
1038
|
+
8. **borderColor**<br>The color of the border surrounding the tooltip content
|
|
1039
|
+
9. **borderWidth**<br>The width of the border surrounding the tooltip content
|
|
1040
|
+
10. **borderRadius**<br>The radius of the border surrounding the tooltip content
|
|
1041
|
+
---
|
|
1042
|
+
11. **paddingLeft**<br>The padding to the left of the tooltip content
|
|
1043
|
+
12. **paddingRight**<br>The padding to the right of the tooltip content
|
|
1044
|
+
13. **paddingTop**<br>The padding to the top of the tooltip content
|
|
1045
|
+
14. **paddingBottom**<br>The padding to the bottom of the tooltip content
|
|
1046
|
+
|
|
1047
|
+
**children (<ScatterPlotTooltipContent/> and <RasterPlotTooltipContent/>)**<br>
|
|
1048
|
+
The tooltip content.
|
|
663
1049
|
|
|
664
1050
|
|
|
665
1051
|
### [⤒](#content) <span id="scatterplot-tooltip-usage"><ScatterPlotTooltipContent/></span>
|
|
@@ -676,61 +1062,88 @@ series name
|
|
|
676
1062
|
|
|
677
1063
|
---
|
|
678
1064
|
|
|
679
|
-
|
|
680
|
-
|
|
1065
|
+
**xLabel (string)**<br>
|
|
1066
|
+
Required property that gives a name to the x-values. This is the label for the x-values in the tooltip.
|
|
681
1067
|
|
|
682
|
-
|
|
683
|
-
|
|
1068
|
+
**yLabel (string)**<br>
|
|
1069
|
+
Required property that gives a name to the y-values. This is the label for the y-values in the tooltip.
|
|
684
1070
|
|
|
685
|
-
|
|
686
|
-
|
|
1071
|
+
**beforeHeader (string, optional, default = 'before')**<br>
|
|
1072
|
+
Optional property that gives a name to the data point that is immediately before the mouse location.
|
|
687
1073
|
|
|
688
|
-
|
|
689
|
-
|
|
1074
|
+
**afterHeader (string, optional, default = 'after')**<br>
|
|
1075
|
+
Optional property that gives a name to the data point that is immediately after the mouse location.
|
|
690
1076
|
|
|
691
|
-
|
|
692
|
-
|
|
1077
|
+
**deltaHeader (string, optional, default = '∆')**<br>
|
|
1078
|
+
Optional property that gives a name to the difference between the datum immediately before and after the mouse location.
|
|
693
1079
|
|
|
694
|
-
|
|
695
|
-
|
|
1080
|
+
**xValueFormatter ((value: number) => string, optional, default =** [**formatTime**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1081
|
+
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
1082
|
|
|
697
|
-
|
|
698
|
-
|
|
1083
|
+
**yValueFormatter ((value: number) => string, optional, default =** [**formatValue**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1084
|
+
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
1085
|
|
|
700
|
-
|
|
701
|
-
|
|
1086
|
+
**xChangeFormatter ((value1: number, value2: number) => string, optional, default =** [**formatTimeChange**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1087
|
+
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
1088
|
|
|
703
|
-
|
|
704
|
-
|
|
1089
|
+
**yChangeFormatter ((value1: number, value2: number) => string, optional, default =** [**formatValueChange**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1090
|
+
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
1091
|
|
|
706
|
-
|
|
707
|
-
|
|
1092
|
+
**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>
|
|
1093
|
+
Optional styles for the tooltip content. The styles are the same as those for the <Tooltip/>.
|
|
708
1094
|
|
|
709
1095
|
|
|
710
1096
|
### [⤒](#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.
|
|
1097
|
+
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
1098
|
|
|
713
|
-
|
|
714
|
-
|
|
1099
|
+
**xFormatter ((value: number) => string, optional, default =** [**formatTime**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1100
|
+
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
1101
|
|
|
716
|
-
|
|
717
|
-
|
|
1102
|
+
**yFormatter ((value: number) => string, optional, default =** [**formatValue**](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/utils.ts) <br>
|
|
1103
|
+
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
1104
|
|
|
719
|
-
|
|
720
|
-
|
|
1105
|
+
**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>
|
|
1106
|
+
Optional styles for the tooltip content. The styles are the same as those for the <Tooltip/>.
|
|
721
1107
|
|
|
722
|
-
|
|
1108
|
+
### [⤒](#content) <span id="barplot-tooltip-usage"><BarPlotTooltipContent/></span>
|
|
723
1109
|
|
|
724
|
-
|
|
725
|
-
```shell
|
|
726
|
-
npm install
|
|
727
|
-
npm run build
|
|
728
|
-
```
|
|
1110
|
+
The <BarPlotTooltipContent/> displays the series name and current statistics in a table format.
|
|
729
1111
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
1112
|
+
**ordinalUnits (string, optional)**<br>
|
|
1113
|
+
Optional units to display alongside the values.
|
|
1114
|
+
|
|
1115
|
+
**style ([TooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts), optional)**<br>
|
|
1116
|
+
Optional styles for the tooltip content.
|
|
1117
|
+
|
|
1118
|
+
### [⤒](#content) <span id="poincareplot-tooltip-usage"><PoincarePlotTooltipContent/></span>
|
|
1119
|
+
|
|
1120
|
+
The <PoincarePlotTooltipContent/> displays the series name and the current, previous, and next iterates in a table format.
|
|
1121
|
+
|
|
1122
|
+
**xLabel (string)**<br>
|
|
1123
|
+
Required label for the x-axis values.
|
|
1124
|
+
|
|
1125
|
+
**yLabel (string)**<br>
|
|
1126
|
+
Required label for the y-axis values.
|
|
1127
|
+
|
|
1128
|
+
**nMinusLagHeader**, **nHeader**, **nPlusLagHeader** (string, optional)<br>
|
|
1129
|
+
Optional headers for the previous, current, and next iterates.
|
|
1130
|
+
|
|
1131
|
+
**xValueFormatter**, **yValueFormatter**, **xChangeFormatter**, **yChangeFormatter** (optional)<br>
|
|
1132
|
+
Optional formatters for values and their changes.
|
|
1133
|
+
|
|
1134
|
+
**style ([TooltipStyle](https://github.com/robphilipp/stream-charts/blob/master/src/app/charts/tooltipUtils.ts), optional)**<br>
|
|
1135
|
+
Optional styles for the tooltip content.
|
|
1136
|
+
|
|
1137
|
+
## [⤒](#content) <span id="hooks">hooks</span>
|
|
1138
|
+
|
|
1139
|
+
For advanced usage, `stream-charts` provides several hooks to interact with the chart's internal state.
|
|
1140
|
+
|
|
1141
|
+
- **useChart()**: Access the chart's context, including dimensions, scales, and registration functions for tooltips and trackers.
|
|
1142
|
+
- **useAxes()**: Access the state of the x and y axes.
|
|
1143
|
+
- **usePlotDimensions()**: Access the dimensions of the plot area and margins.
|
|
1144
|
+
- **useDataObservable()**: Access the data stream observable.
|
|
1145
|
+
|
|
1146
|
+
## [⤒](#content) <span id="building">building</span>
|
|
734
1147
|
|
|
735
1148
|
Testing
|
|
736
1149
|
```shell
|