stream-charts 1.0.0 → 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 +758 -345
- package/changes.md +10 -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} +17 -11
- package/dist/src/app/charts/{tooltipUtils.js → tooltips/tooltipUtils.js} +52 -25
- 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/changes.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# change history
|
|
2
2
|
|
|
3
|
+
## version 1.1.0 (bar chart, Poincare chart, refactoring)
|
|
4
|
+
1. Added bar chart
|
|
5
|
+
2. Added Poincare chart
|
|
6
|
+
3. Refactored code for better readability and maintainability
|
|
7
|
+
4. Added tests
|
|
8
|
+
5. Fixed an incorrect calculation of the plot size from the svg container size
|
|
9
|
+
|
|
10
|
+
## version 1.0.1 (tooltip clipping issue)
|
|
11
|
+
Fixed issue where the tooltip was getting clipped at the top of the plot under certain circumstances.
|
|
12
|
+
|
|
3
13
|
## version 1.0.0 (composability, multi-axes, performance, spline, axes scales, cadence)
|
|
4
14
|
1. A chart's configuration in no longer passed as properties of the component, but rather a `<Chart>` is composed by adding components such as axes, tracker, tooltip, and a plot.
|
|
5
15
|
2. Charts can now have two x-axes and two y-axes.
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import { Margin } from "./margins";
|
|
3
|
-
import { SvgStyle } from "./svgStyle";
|
|
4
|
-
import {
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { Margin } from "./styling/margins";
|
|
3
|
+
import { SvgStyle } from "./styling/svgStyle";
|
|
4
|
+
import { SeriesStyle } from "./axes/axes";
|
|
5
5
|
import { Observable, Subscription } from "rxjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { BaseSeries } from "./series/baseSeries";
|
|
7
|
+
import { ChartData } from "./observables/ChartData";
|
|
8
|
+
import { AxisInterval } from "./axes/AxisInterval";
|
|
9
|
+
/**
|
|
10
|
+
* @template CD refers to the chart-data that is used by the Observable that has the stream of data.
|
|
11
|
+
* @template D refers to the datum in the data-series
|
|
12
|
+
* @template S refers to the type for the series style
|
|
13
|
+
*/
|
|
14
|
+
interface Props<CD, D, S extends SeriesStyle> {
|
|
15
|
+
chartId: number;
|
|
9
16
|
/**
|
|
10
17
|
* The width of the chart container
|
|
11
18
|
*/
|
|
@@ -19,11 +26,11 @@ interface Props {
|
|
|
19
26
|
*/
|
|
20
27
|
margin?: Partial<Margin>;
|
|
21
28
|
/**
|
|
22
|
-
* The base/default color of the chart lines. This can be
|
|
29
|
+
* The base/default color of the chart lines. This can be overridden by the {@link Props.svgStyle} property.
|
|
23
30
|
*/
|
|
24
31
|
color?: string;
|
|
25
32
|
/**
|
|
26
|
-
* The base/default background color. This can be
|
|
33
|
+
* The base/default background color. This can be overridden by the {@link Props.svgStyle} property.
|
|
27
34
|
*/
|
|
28
35
|
backgroundColor?: string;
|
|
29
36
|
/**
|
|
@@ -31,51 +38,67 @@ interface Props {
|
|
|
31
38
|
*/
|
|
32
39
|
svgStyle?: Partial<SvgStyle>;
|
|
33
40
|
/**
|
|
34
|
-
* Map holding the series name to the
|
|
41
|
+
* Map holding the series name to the series style associated with that series.
|
|
42
|
+
*/
|
|
43
|
+
seriesStyles?: Map<string, S>;
|
|
44
|
+
/**
|
|
45
|
+
* Initial (static) data to plot before subscribing to the {@link TimeSeriesChartData} observable.
|
|
35
46
|
*/
|
|
36
|
-
|
|
47
|
+
initialData: Array<BaseSeries<D>>;
|
|
37
48
|
/**
|
|
38
|
-
*
|
|
49
|
+
* Optional conversion function that converts an array of base-series with datum type D to a
|
|
50
|
+
* descendent of a {@link ChartData} object
|
|
51
|
+
* @param initialData The initial array of series
|
|
39
52
|
*/
|
|
40
|
-
initialData: Array<
|
|
53
|
+
asChartData?: (initialData: Array<BaseSeries<D>>) => CD;
|
|
41
54
|
/**
|
|
42
55
|
* Regular expression that filters which series to display on the plot. Can be update while streaming
|
|
43
56
|
*/
|
|
44
57
|
seriesFilter?: RegExp;
|
|
45
58
|
/**
|
|
46
|
-
* {@link
|
|
59
|
+
* {@link TimeSeriesChartData} RxJS `Observable` that feeds the chart data to display (i.e. the data stream).
|
|
47
60
|
*/
|
|
48
|
-
seriesObservable?: Observable<
|
|
61
|
+
seriesObservable?: Observable<CD>;
|
|
49
62
|
/**
|
|
50
63
|
* The time-window (in milliseconds) to buffer the incoming data before updating the chart. This is
|
|
51
64
|
* a lever to reduce the lag between real-time and chart-time when a large amount of data is being
|
|
52
|
-
* sourced by the observable. Smaller time-
|
|
65
|
+
* sourced by the observable. Smaller time-windows result in smoother scrolling, but more updates, and
|
|
53
66
|
* possibly a larger lag.
|
|
54
67
|
*/
|
|
55
68
|
windowingTime?: number;
|
|
56
69
|
/**
|
|
57
|
-
* When switching to `true` from `false`, subscribes to the {@link
|
|
58
|
-
* to `false` from `true`, unsubscribes from the {@link
|
|
70
|
+
* When switching to `true` from `false`, subscribes to the {@link seriesObservable}. When switching
|
|
71
|
+
* to `false` from `true`, unsubscribes from the {@link seriesObservable}.
|
|
59
72
|
*/
|
|
60
73
|
shouldSubscribe?: boolean;
|
|
61
74
|
/**
|
|
62
|
-
* Callback when the chart subscribes to the {@link
|
|
75
|
+
* Callback when the chart subscribes to the {@link TimeSeriesChartData} observable
|
|
63
76
|
* @param subscription The RxJS subscription
|
|
64
77
|
*/
|
|
65
78
|
onSubscribe?: (subscription: Subscription) => void;
|
|
66
79
|
/**
|
|
67
|
-
* Callback when the time range changes.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
80
|
+
* Callback when the time range changes. This is generally used by plots where the
|
|
81
|
+
* x-axis starts to scroll as the data streams in past the end of the current time
|
|
82
|
+
* window.
|
|
83
|
+
* @param ranges A function that accepts the ranges, (start, end) associated with
|
|
84
|
+
* each axis in the plot. The ranges argument is a map(axis_id -> (start, end)).
|
|
85
|
+
* Where start and end refer to the range for the axis.
|
|
70
86
|
*/
|
|
71
|
-
|
|
87
|
+
onUpdateAxesBounds?: (ranges: Map<string, AxisInterval>) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Callback for updating the current chart time. This is generally used by plots
|
|
90
|
+
* where the axes do not represent time, but rather some fix values, and the data
|
|
91
|
+
* hold time information
|
|
92
|
+
* @param time The current chart time
|
|
93
|
+
*/
|
|
94
|
+
onUpdateChartTime?: (time: number) => void;
|
|
72
95
|
/**
|
|
73
96
|
* Callback function that is called when new data arrives to the chart.
|
|
74
97
|
* @param seriesName The name of the series for which new data arrived
|
|
75
98
|
* @param data The new data that arrived in the windowing tine
|
|
76
99
|
* @see UseChartValues.windowingTime
|
|
77
100
|
*/
|
|
78
|
-
onUpdateData?: (seriesName: string, data: Array<
|
|
101
|
+
onUpdateData?: (seriesName: string, data: Array<D>) => void;
|
|
79
102
|
/**
|
|
80
103
|
* The child components of the chart (i.e. the axis, plot, tracker, tooltip)
|
|
81
104
|
*/
|
|
@@ -85,21 +108,27 @@ interface Props {
|
|
|
85
108
|
* The chart container that holds the axes, plot, tracker, and tooltip. The chart manages the
|
|
86
109
|
* subscription, sets up the {@link useChart} hook via the {@link ChartProvider}.
|
|
87
110
|
* @param props The properties of the chart
|
|
111
|
+
* @template CD Chart data
|
|
112
|
+
* @template D The type of the datum type held in a series
|
|
113
|
+
* @template S The type of the series style
|
|
114
|
+
* @template TM The type of the tooltip metadata (the data about the series). If not specified,
|
|
115
|
+
* defaults to an empty object
|
|
88
116
|
* @constructor
|
|
89
117
|
* @example
|
|
90
118
|
*
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
|
|
120
|
+
<Chart
|
|
121
|
+
width={useGridCellWidth()}
|
|
122
|
+
height={useGridCellHeight()}
|
|
123
|
+
margin={{...defaultMargin, top: 60, right: 75, left: 70}}
|
|
124
|
+
color={theme.color}
|
|
125
|
+
backgroundColor={theme.backgroundColor}
|
|
126
|
+
seriesStyles={new Map([
|
|
98
127
|
['neuron1', {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
128
|
+
...defaultLineStyle,
|
|
129
|
+
color: 'orange',
|
|
130
|
+
lineWidth: 2,
|
|
131
|
+
highlightColor: 'orange'
|
|
103
132
|
}],
|
|
104
133
|
['neuron6', {
|
|
105
134
|
...defaultLineStyle,
|
|
@@ -108,60 +137,60 @@ interface Props {
|
|
|
108
137
|
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
109
138
|
highlightWidth: 5
|
|
110
139
|
}],
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
])}
|
|
141
|
+
initialData={initialDataRef.current}
|
|
142
|
+
seriesFilter={filter}
|
|
143
|
+
seriesObservable={observableRef.current}
|
|
144
|
+
shouldSubscribe={running}
|
|
145
|
+
onUpdateTime={handleChartTimeUpdate}
|
|
146
|
+
windowingTime={150}
|
|
147
|
+
>
|
|
148
|
+
<ContinuousAxis
|
|
149
|
+
axisId="x-axis-1"
|
|
150
|
+
location={AxisLocation.Bottom}
|
|
151
|
+
domain={[0, 5000]}
|
|
152
|
+
label="t (ms)"
|
|
153
|
+
/>
|
|
154
|
+
<CategoryAxis
|
|
155
|
+
axisId="y-axis-1"
|
|
156
|
+
location={AxisLocation.Left}
|
|
157
|
+
categories={initialDataRef.current.map(series => series.name)}
|
|
158
|
+
label="neuron"
|
|
159
|
+
/>
|
|
160
|
+
<CategoryAxis
|
|
161
|
+
axisId="y-axis-2"
|
|
162
|
+
location={AxisLocation.Right}
|
|
163
|
+
categories={initialDataRef.current.map(series => series.name)}
|
|
164
|
+
label="neuron"
|
|
165
|
+
/>
|
|
166
|
+
<Tracker
|
|
167
|
+
visible={visibility.tracker}
|
|
168
|
+
labelLocation={TrackerLabelLocation.WithMouse}
|
|
169
|
+
style={{color: theme.color}}
|
|
170
|
+
font={{color: theme.color}}
|
|
171
|
+
/>
|
|
172
|
+
<Tooltip
|
|
173
|
+
visible={visibility.tooltip}
|
|
174
|
+
style={{
|
|
146
175
|
fontColor: theme.color,
|
|
147
176
|
backgroundColor: theme.backgroundColor,
|
|
148
177
|
borderColor: theme.color,
|
|
149
178
|
backgroundOpacity: 0.9,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
export declare function Chart(props: Props): JSX.Element;
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
<RasterPlotTooltipContent
|
|
182
|
+
xFormatter={value => formatNumber(value, " ,.0f") + ' ms'}
|
|
183
|
+
yFormatter={value => formatNumber(value, " ,.1f") + ' mV'}
|
|
184
|
+
/>
|
|
185
|
+
</Tooltip>
|
|
186
|
+
<RasterPlot
|
|
187
|
+
spikeMargin={1}
|
|
188
|
+
dropDataAfter={5000}
|
|
189
|
+
panEnabled={true}
|
|
190
|
+
zoomEnabled={true}
|
|
191
|
+
zoomKeyModifiersRequired={true}
|
|
192
|
+
/>
|
|
193
|
+
</Chart>
|
|
194
|
+
*/
|
|
195
|
+
export declare function Chart<CD extends ChartData, D, S extends SeriesStyle, TM>(props: Props<CD, D, S>): JSX.Element;
|
|
167
196
|
export {};
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import { useEffect, useMemo, useRef } from 'react';
|
|
14
|
-
import { plotDimensionsFrom } from "./margins";
|
|
15
|
-
import { initialSvgStyle } from "./svgStyle";
|
|
16
|
-
import ChartProvider
|
|
3
|
+
import { plotDimensionsFrom } from "./styling/margins";
|
|
4
|
+
import { initialSvgStyle } from "./styling/svgStyle";
|
|
5
|
+
import ChartProvider from "./hooks/useChart";
|
|
6
|
+
import PlotDimensionsProvider, { defaultMargin } from "./hooks/usePlotDimensions";
|
|
17
7
|
import * as d3 from "d3";
|
|
18
|
-
import { createPlotContainer } from "./plot";
|
|
8
|
+
import { createPlotContainer } from "./plots/plot";
|
|
19
9
|
import { noop } from "./utils";
|
|
20
|
-
|
|
10
|
+
import AxesProvider from "./hooks/useAxes";
|
|
11
|
+
import MouseProvider from "./hooks/useMouse";
|
|
12
|
+
import TooltipProvider from "./hooks/useTooltip";
|
|
13
|
+
import DataObservableProvider from './hooks/useDataObservable';
|
|
14
|
+
import InitialDataProvider from "./hooks/useInitialData";
|
|
15
|
+
const defaultBackground = '#202020';
|
|
21
16
|
/**
|
|
22
17
|
* The chart container that holds the axes, plot, tracker, and tooltip. The chart manages the
|
|
23
18
|
* subscription, sets up the {@link useChart} hook via the {@link ChartProvider}.
|
|
24
19
|
* @param props The properties of the chart
|
|
20
|
+
* @template CD Chart data
|
|
21
|
+
* @template D The type of the datum type held in a series
|
|
22
|
+
* @template S The type of the series style
|
|
23
|
+
* @template TM The type of the tooltip metadata (the data about the series). If not specified,
|
|
24
|
+
* defaults to an empty object
|
|
25
25
|
* @constructor
|
|
26
26
|
* @example
|
|
27
27
|
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
|
|
29
|
+
<Chart
|
|
30
|
+
width={useGridCellWidth()}
|
|
31
|
+
height={useGridCellHeight()}
|
|
32
|
+
margin={{...defaultMargin, top: 60, right: 75, left: 70}}
|
|
33
|
+
color={theme.color}
|
|
34
|
+
backgroundColor={theme.backgroundColor}
|
|
35
|
+
seriesStyles={new Map([
|
|
35
36
|
['neuron1', {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
...defaultLineStyle,
|
|
38
|
+
color: 'orange',
|
|
39
|
+
lineWidth: 2,
|
|
40
|
+
highlightColor: 'orange'
|
|
40
41
|
}],
|
|
41
42
|
['neuron6', {
|
|
42
43
|
...defaultLineStyle,
|
|
@@ -45,105 +46,99 @@ var defaultBackground = '#202020';
|
|
|
45
46
|
highlightColor: theme.name === 'light' ? 'blue' : 'gray',
|
|
46
47
|
highlightWidth: 5
|
|
47
48
|
}],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
49
|
+
])}
|
|
50
|
+
initialData={initialDataRef.current}
|
|
51
|
+
seriesFilter={filter}
|
|
52
|
+
seriesObservable={observableRef.current}
|
|
53
|
+
shouldSubscribe={running}
|
|
54
|
+
onUpdateTime={handleChartTimeUpdate}
|
|
55
|
+
windowingTime={150}
|
|
56
|
+
>
|
|
57
|
+
<ContinuousAxis
|
|
58
|
+
axisId="x-axis-1"
|
|
59
|
+
location={AxisLocation.Bottom}
|
|
60
|
+
domain={[0, 5000]}
|
|
61
|
+
label="t (ms)"
|
|
62
|
+
/>
|
|
63
|
+
<CategoryAxis
|
|
64
|
+
axisId="y-axis-1"
|
|
65
|
+
location={AxisLocation.Left}
|
|
66
|
+
categories={initialDataRef.current.map(series => series.name)}
|
|
67
|
+
label="neuron"
|
|
68
|
+
/>
|
|
69
|
+
<CategoryAxis
|
|
70
|
+
axisId="y-axis-2"
|
|
71
|
+
location={AxisLocation.Right}
|
|
72
|
+
categories={initialDataRef.current.map(series => series.name)}
|
|
73
|
+
label="neuron"
|
|
74
|
+
/>
|
|
75
|
+
<Tracker
|
|
76
|
+
visible={visibility.tracker}
|
|
77
|
+
labelLocation={TrackerLabelLocation.WithMouse}
|
|
78
|
+
style={{color: theme.color}}
|
|
79
|
+
font={{color: theme.color}}
|
|
80
|
+
/>
|
|
81
|
+
<Tooltip
|
|
82
|
+
visible={visibility.tooltip}
|
|
83
|
+
style={{
|
|
83
84
|
fontColor: theme.color,
|
|
84
85
|
backgroundColor: theme.backgroundColor,
|
|
85
86
|
borderColor: theme.color,
|
|
86
87
|
backgroundOpacity: 0.9,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<RasterPlotTooltipContent
|
|
91
|
+
xFormatter={value => formatNumber(value, " ,.0f") + ' ms'}
|
|
92
|
+
yFormatter={value => formatNumber(value, " ,.1f") + ' mV'}
|
|
93
|
+
/>
|
|
94
|
+
</Tooltip>
|
|
95
|
+
<RasterPlot
|
|
96
|
+
spikeMargin={1}
|
|
97
|
+
dropDataAfter={5000}
|
|
98
|
+
panEnabled={true}
|
|
99
|
+
zoomEnabled={true}
|
|
100
|
+
zoomKeyModifiersRequired={true}
|
|
101
|
+
/>
|
|
102
|
+
</Chart>
|
|
103
|
+
*/
|
|
103
104
|
export function Chart(props) {
|
|
104
|
-
|
|
105
|
-
// onUpdateTime = noop,
|
|
106
|
-
_g = props.onSubscribe,
|
|
107
|
-
// onUpdateTime = noop,
|
|
108
|
-
onSubscribe = _g === void 0 ? noop : _g, _h = props.onUpdateTime, onUpdateTime = _h === void 0 ? noop : _h, _j = props.onUpdateData, onUpdateData = _j === void 0 ? noop : _j, children = props.children;
|
|
105
|
+
const { chartId, width, height, color = '#d2933f', backgroundColor = defaultBackground, seriesStyles = new Map(), initialData, asChartData, seriesFilter = /./, seriesObservable, windowingTime = 100, shouldSubscribe = true, onSubscribe = noop, onUpdateAxesBounds = noop, onUpdateChartTime = noop, onUpdateData = noop, children, } = props;
|
|
109
106
|
// override the defaults with the parent's properties, leaving any unset values as the default value
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// id of the chart to avoid dom conflicts when multiple charts are used in the same app
|
|
113
|
-
var chartId = useRef(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER));
|
|
107
|
+
const margin = Object.assign(Object.assign({}, defaultMargin), props.margin);
|
|
108
|
+
const svgStyle = useMemo(() => (Object.assign(Object.assign(Object.assign({}, initialSvgStyle), props.svgStyle), { width: props.width, height: props.height })), [props.height, props.svgStyle, props.width]);
|
|
114
109
|
// hold a reference to the current width and the plot dimensions
|
|
115
|
-
|
|
110
|
+
const plotDimRef = useRef(plotDimensionsFrom(width, height, margin));
|
|
116
111
|
// the container that holds the d3 svg element
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
const mainGRef = useRef(null);
|
|
113
|
+
const containerRef = useRef(null);
|
|
119
114
|
// creates the main <g> element for the chart if it doesn't already exist, otherwise
|
|
120
115
|
// updates the svg element with the updated dimensions or style properties
|
|
121
|
-
useEffect(
|
|
116
|
+
useEffect(() => {
|
|
122
117
|
if (containerRef.current) {
|
|
123
118
|
// create the main SVG element if it doesn't already exist
|
|
124
119
|
if (!mainGRef.current) {
|
|
125
|
-
mainGRef.current = createPlotContainer(chartId
|
|
120
|
+
mainGRef.current = createPlotContainer(chartId, containerRef.current, plotDimRef.current, color);
|
|
126
121
|
}
|
|
127
122
|
// build up the svg style from the defaults and any svg style object
|
|
128
123
|
// passed in as properties
|
|
129
|
-
|
|
130
|
-
.map(
|
|
124
|
+
const style = Object.getOwnPropertyNames(svgStyle)
|
|
125
|
+
.map(name => `${name}: ${svgStyle[name]}; `)
|
|
131
126
|
.join("");
|
|
132
127
|
// when the chart "backgroundColor" property is set (i.e. not the default value),
|
|
133
128
|
// then we need add it to the styles, overwriting any color that may have been
|
|
134
129
|
// set in the svg style object
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
const background = backgroundColor !== defaultBackground ?
|
|
131
|
+
`background-color: ${backgroundColor}; ` :
|
|
137
132
|
'';
|
|
138
133
|
// update the dimension and style
|
|
139
134
|
d3.select(containerRef.current)
|
|
140
135
|
.attr('width', width)
|
|
141
136
|
.attr('height', height)
|
|
142
|
-
.attr('style', style + background +
|
|
137
|
+
.attr('style', style + background + ` color: ${color}`);
|
|
143
138
|
}
|
|
144
|
-
}, [color, backgroundColor, height, svgStyle, width]);
|
|
145
|
-
return (_jsxs(_Fragment, { children: [_jsx("svg", { ref: containerRef }
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
}, [color, backgroundColor, height, svgStyle, width, chartId]);
|
|
140
|
+
return (_jsxs(_Fragment, { children: [_jsx("svg", { ref: containerRef }), _jsx(PlotDimensionsProvider, { containerDimensions: { width, height }, margin: margin, children: _jsx(AxesProvider, { onUpdateAxesInterval: onUpdateAxesBounds, children: _jsx(MouseProvider, { children: _jsx(TooltipProvider, { children: _jsx(InitialDataProvider, { initialData: initialData, asChartData: asChartData, children: _jsx(DataObservableProvider, { seriesObservable: seriesObservable, windowingTime: windowingTime, shouldSubscribe: shouldSubscribe, onSubscribe: onSubscribe, onUpdateData: onUpdateData, onUpdateChartTime: onUpdateChartTime, children: _jsx(ChartProvider, { chartId: chartId, container: containerRef.current, mainG: mainGRef.current, color: color, backgroundColor: backgroundColor, svgStyle: svgStyle, seriesStyles: seriesStyles, seriesFilter: seriesFilter, children:
|
|
141
|
+
// the chart elements are the children
|
|
142
|
+
children }) }) }) }) }) }) })] }));
|
|
148
143
|
}
|
|
149
144
|
//# sourceMappingURL=Chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../../src/app/charts/Chart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Chart.js","sourceRoot":"","sources":["../../../../src/app/charts/Chart.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BaseAxis } from "./axes";
|
|
2
|
+
import { Optional } from "result-fn";
|
|
3
|
+
/**
|
|
4
|
+
* Holds the information to allow mapping axes names to the underlying axes objects.
|
|
5
|
+
* These objects hold the axis ID, its location on the chart (i.e. left, right, bottom, upper)
|
|
6
|
+
* and the underlying d3 selection objects for managing the axes. Axis objects that extend
|
|
7
|
+
* the `BaseAxis` class may have additional properties.
|
|
8
|
+
* @typeParam A The type of the axes (must extend `BaseAxis`)
|
|
9
|
+
*/
|
|
10
|
+
export declare class AxesState<A extends BaseAxis> {
|
|
11
|
+
readonly axes: Map<string, A>;
|
|
12
|
+
private constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new axes state from the specified map of axes.
|
|
15
|
+
* @param axes Mapping of the axes ID's to the axes.
|
|
16
|
+
* @return A new axes-state object.
|
|
17
|
+
*/
|
|
18
|
+
static from<A extends BaseAxis>(axes: Map<string, A>): AxesState<A>;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an empty axes-state object.
|
|
21
|
+
* @return A new axes-state object.
|
|
22
|
+
*/
|
|
23
|
+
static empty<A extends BaseAxis>(): AxesState<A>;
|
|
24
|
+
/**
|
|
25
|
+
* @return `true` if the axes state is empty, `false` otherwise.
|
|
26
|
+
*/
|
|
27
|
+
isEmpty(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a deep copy of the current axes state.
|
|
30
|
+
* @return A deep copy of the current axes state.
|
|
31
|
+
*/
|
|
32
|
+
copy(): AxesState<A>;
|
|
33
|
+
/**
|
|
34
|
+
* Adds an axis to the current axis state and returns a new axis state. This is an internal state
|
|
35
|
+
* management function. This should generally not be used. Instead, use the {@link UseChartValues.addXAxis}
|
|
36
|
+
* and {@link UseChartValues.addYAxis} functions to add axes.
|
|
37
|
+
* @param axis The axis to add
|
|
38
|
+
* @param id The ID of the axis to add
|
|
39
|
+
* @return An updated axes state that has the new axis
|
|
40
|
+
* @see UseChartValues.addXAxis
|
|
41
|
+
* @see UseChartValues.addYAxis
|
|
42
|
+
*/
|
|
43
|
+
addAxis(axis: A, id: string): AxesState<A>;
|
|
44
|
+
/**
|
|
45
|
+
* Attempts to retrieve the x-axis for the specified ID
|
|
46
|
+
* @param axisId The unique ID of the axis
|
|
47
|
+
* @return The axis, or undefined if no axis with the specified ID is found
|
|
48
|
+
*/
|
|
49
|
+
axisFor(axisId: string): Optional<A>;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the default axis
|
|
52
|
+
* @return The default axis
|
|
53
|
+
* @see axisDefaultId
|
|
54
|
+
*/
|
|
55
|
+
defaultAxis(): Optional<A>;
|
|
56
|
+
/**
|
|
57
|
+
* @return An array holding all existing the x-axis IDs
|
|
58
|
+
*/
|
|
59
|
+
axisIds(): Array<string>;
|
|
60
|
+
/**
|
|
61
|
+
* @return The default name of the x-axis (in case only on default axis was added)
|
|
62
|
+
*/
|
|
63
|
+
axisDefaultId(): Optional<string>;
|
|
64
|
+
}
|