semiotic 3.0.0-beta.3 → 3.0.0-beta.4
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/CLAUDE.md +93 -753
- package/README.md +80 -7
- package/dist/ChartContainer.d.ts +60 -0
- package/dist/DetailsPanel.d.ts +37 -0
- package/dist/LinkedCharts.d.ts +2 -0
- package/dist/Tooltip/Tooltip.d.ts +2 -2
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
- package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
- package/dist/charts/shared/annotationRules.d.ts +3 -0
- package/dist/charts/shared/colorUtils.d.ts +17 -11
- package/dist/charts/shared/hooks.d.ts +96 -1
- package/dist/charts/shared/loess.d.ts +13 -0
- package/dist/charts/shared/networkUtils.d.ts +31 -0
- package/dist/charts/shared/tooltipUtils.d.ts +16 -0
- package/dist/charts/shared/types.d.ts +17 -2
- package/dist/charts/shared/validateChartData.d.ts +2 -3
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +4 -0
- package/dist/charts/xy/BubbleChart.d.ts +6 -0
- package/dist/charts/xy/Heatmap.d.ts +4 -0
- package/dist/charts/xy/LineChart.d.ts +6 -0
- package/dist/charts/xy/Scatterplot.d.ts +4 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
- package/dist/data/fromVegaLite.d.ts +48 -0
- package/dist/export/chartConfig.d.ts +29 -0
- package/dist/export/selectionSerializer.d.ts +20 -0
- package/dist/geometry/sankeyLinks.d.ts +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime/types.d.ts +20 -6
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +14 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +9 -19
- package/dist/semiotic-ordinal.d.ts +12 -14
- package/dist/semiotic-xy.d.ts +12 -18
- package/dist/semiotic.d.ts +16 -13
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/store/ObservationStore.d.ts +61 -0
- package/dist/store/SelectionStore.d.ts +9 -1
- package/dist/store/ThemeStore.d.ts +6 -1
- package/dist/store/TooltipStore.d.ts +3 -1
- package/dist/store/createStore.d.ts +4 -1
- package/dist/store/useObservation.d.ts +18 -0
- package/dist/stream/MarginalGraphics.d.ts +1 -1
- package/dist/stream/NetworkPipelineStore.d.ts +44 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
- package/dist/stream/ParticlePool.d.ts +2 -1
- package/dist/stream/PipelineStore.d.ts +11 -0
- package/dist/stream/SVGOverlay.d.ts +21 -2
- package/dist/stream/SceneGraph.d.ts +1 -1
- package/dist/stream/networkTypes.d.ts +58 -1
- package/dist/stream/ordinalTypes.d.ts +13 -0
- package/dist/stream/types.d.ts +14 -0
- package/dist/types/annotationTypes.d.ts +10 -0
- package/dist/types/networkTypes.d.ts +1 -2
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +27 -38
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
- package/dist/Axis/Axis.d.ts +0 -7
- package/dist/Axis/axisTitle.d.ts +0 -10
- package/dist/Axis/index.d.ts +0 -2
- package/dist/Axis/summaryGraphic.d.ts +0 -17
- package/dist/Brush.d.ts +0 -12
- package/dist/DividedLine.d.ts +0 -16
- package/dist/TooltipPositioner/index.d.ts +0 -7
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/annotationRules/baseRules.d.ts +0 -25
- package/dist/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/batchWork.d.ts +0 -6
- package/dist/constants/coordinateNames.d.ts +0 -8
- package/dist/constants/frame_props.d.ts +0 -13
- package/dist/data/dataFunctions.d.ts +0 -45
- package/dist/data/multiAccessorUtils.d.ts +0 -1
- package/dist/data/unflowedFunctions.d.ts +0 -1
- package/dist/generic_utilities/functions.d.ts +0 -1
- package/dist/geometry/areaDrawing.d.ts +0 -21
- package/dist/geometry/contourLayout.d.ts +0 -6
- package/dist/geometry/hexbinLayout.d.ts +0 -7
- package/dist/geometry/lineDrawing.d.ts +0 -71
- package/dist/geometry/summaryLayouts.d.ts +0 -45
- package/dist/index.d.ts +0 -1
- package/dist/processing/InteractionItems.d.ts +0 -13
- package/dist/processing/hierarchyUtils.d.ts +0 -16
- package/dist/processing/layouts/chordLayout.d.ts +0 -2
- package/dist/processing/layouts/forceLayout.d.ts +0 -3
- package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
- package/dist/processing/layouts/index.d.ts +0 -8
- package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
- package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
- package/dist/processing/layouts/types.d.ts +0 -17
- package/dist/processing/networkDefaults.d.ts +0 -36
- package/dist/realtime/renderers/barRenderer.d.ts +0 -2
- package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
- package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
- package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
- package/dist/stream/NetworkSceneGraph.d.ts +0 -14
- package/dist/stream/index.d.ts +0 -16
- package/dist/types/canvasTypes.d.ts +0 -9
- package/dist/types/xyTypes.d.ts +0 -24
- package/dist/useBoundingRect.d.ts +0 -2
- package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
- package/dist/visualizationLayerBehavior/general.d.ts +0 -80
package/CLAUDE.md
CHANGED
|
@@ -1,828 +1,168 @@
|
|
|
1
1
|
# Semiotic — AI Assistant Guide
|
|
2
2
|
|
|
3
3
|
## Quick Start
|
|
4
|
-
- Install: `npm install semiotic@3.0.0-beta.
|
|
4
|
+
- Install: `npm install semiotic@3.0.0-beta.4`
|
|
5
5
|
- Import from `semiotic` or granular: `semiotic/xy`, `semiotic/ordinal`, `semiotic/network`, `semiotic/realtime`, `semiotic/ai`, `semiotic/data`
|
|
6
|
-
- `semiotic/ai` exports
|
|
7
|
-
- `semiotic/data` exports
|
|
8
|
-
- `validateProps(componentName, props)` — validate props before rendering, returns `{ valid, errors }`
|
|
6
|
+
- `semiotic/ai` exports HOC charts + TooltipProvider + MultiLineTooltip + ThemeProvider + exportChart + validateProps + useChartObserver + DetailsPanel + ChartContainer
|
|
7
|
+
- `semiotic/data` exports: `bin`, `rollup`, `groupBy`, `pivot`
|
|
9
8
|
- CLI: `npx semiotic-ai [--schema|--compact|--examples]` — dump AI context to stdout
|
|
10
|
-
- MCP: `npx semiotic-mcp` — MCP server
|
|
9
|
+
- MCP: `npx semiotic-mcp` — MCP server rendering charts to static SVG
|
|
11
10
|
|
|
12
11
|
## Architecture
|
|
13
|
-
- **HOC Charts** (recommended): Simple props, sensible defaults
|
|
14
|
-
- **Stream Frames** (advanced): `StreamXYFrame`, `StreamOrdinalFrame`, `StreamNetworkFrame`
|
|
12
|
+
- **HOC Charts** (recommended): Simple props, sensible defaults
|
|
13
|
+
- **Stream Frames** (advanced): `StreamXYFrame`, `StreamOrdinalFrame`, `StreamNetworkFrame`
|
|
15
14
|
- Every HOC accepts `frameProps` to pass through to the underlying Stream Frame
|
|
15
|
+
- TypeScript `strict: true`; all charts have `role="img"` + `aria-label`
|
|
16
16
|
|
|
17
17
|
## Component Reference
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### Common props (all HOCs unless noted)
|
|
20
|
+
`title` (string), `width` (number, 600), `height` (number, 400), `margin` (object), `className` (string), `enableHover` (boolean, true), `tooltip` (fn), `showLegend` (boolean), `showGrid` (boolean, false), `frameProps` (object), `onObservation` (fn), `chartId` (string)
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
Line traces with curve interpolation, area fill, and point markers. Use for time series, trends, and continuous data.
|
|
22
|
+
### XY Charts (from "semiotic" or "semiotic/xy")
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
`lineBy` (string|fn), `lineDataAccessor` (string, "coordinates"),
|
|
26
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
27
|
-
`curve` ("linear"|"monotoneX"|"monotoneY"|"step"|"stepAfter"|"stepBefore"|"basis"|"cardinal"|"catmullRom", "linear"),
|
|
28
|
-
`lineWidth` (number, 2), `showPoints` (boolean, false), `pointRadius` (number, 3),
|
|
29
|
-
`fillArea` (boolean, false), `areaOpacity` (number, 0.3),
|
|
30
|
-
`xLabel` (string), `yLabel` (string), `xFormat` (fn), `yFormat` (fn),
|
|
31
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
32
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
33
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
34
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
24
|
+
**LineChart** — `data` (required), `xAccessor` ("x"), `yAccessor` ("y"), `lineBy`, `lineDataAccessor` ("coordinates"), `colorBy`, `colorScheme` ("category10"), `curve` ("linear"|"monotoneX"|"monotoneY"|"step"|"stepAfter"|"stepBefore"|"basis"|"cardinal"|"catmullRom"), `lineWidth` (2), `showPoints` (false), `pointRadius` (3), `fillArea` (false), `areaOpacity` (0.3), `xLabel`, `yLabel`, `xFormat`, `yFormat`
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
<LineChart data={sales} xAccessor="month" yAccessor="revenue" curve="monotoneX" />
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
#### AreaChart
|
|
41
|
-
Filled area under a line with optional stroke. Use for showing volume or magnitude over time.
|
|
42
|
-
|
|
43
|
-
Props: `data` (TDatum[], required), `xAccessor` (string|fn, "x"), `yAccessor` (string|fn, "y"),
|
|
44
|
-
`areaBy` (string|fn), `lineDataAccessor` (string, "coordinates"),
|
|
45
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
46
|
-
`curve` ("linear"|"monotoneX"|"monotoneY"|"step"|"stepAfter"|"stepBefore"|"basis"|"cardinal"|"catmullRom", "monotoneX"),
|
|
47
|
-
`areaOpacity` (number, 0.7), `showLine` (boolean, true), `lineWidth` (number, 2),
|
|
48
|
-
`xLabel` (string), `yLabel` (string), `xFormat` (fn), `yFormat` (fn),
|
|
49
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
50
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
51
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
52
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
53
|
-
|
|
54
|
-
```jsx
|
|
55
|
-
<AreaChart data={temps} xAccessor="date" yAccessor="temp" areaBy="city" />
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
#### StackedAreaChart
|
|
59
|
-
Stacked area chart with optional normalization to 100%. Use for part-to-whole trends over time.
|
|
60
|
-
|
|
61
|
-
Props: `data` (TDatum[], required), `xAccessor` (string|fn, "x"), `yAccessor` (string|fn, "y"),
|
|
62
|
-
`areaBy` (string|fn), `lineDataAccessor` (string, "coordinates"),
|
|
63
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
64
|
-
`curve` ("linear"|"monotoneX"|"monotoneY"|"step"|"stepAfter"|"stepBefore"|"basis"|"cardinal"|"catmullRom", "monotoneX"),
|
|
65
|
-
`areaOpacity` (number, 0.7), `showLine` (boolean, true), `lineWidth` (number, 2),
|
|
66
|
-
`normalize` (boolean, false),
|
|
67
|
-
`xLabel` (string), `yLabel` (string), `xFormat` (fn), `yFormat` (fn),
|
|
68
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
69
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
70
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
71
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
72
|
-
|
|
73
|
-
```jsx
|
|
74
|
-
<StackedAreaChart data={revenue} xAccessor="quarter" yAccessor="amount" areaBy="product" normalize />
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
#### Scatterplot
|
|
78
|
-
Individual data points plotted by x/y position with optional size and color encoding.
|
|
79
|
-
|
|
80
|
-
Props: `data` (TDatum[], required), `xAccessor` (string|fn, "x"), `yAccessor` (string|fn, "y"),
|
|
81
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
82
|
-
`sizeBy` (string|fn), `sizeRange` ([number, number], [3, 15]),
|
|
83
|
-
`pointRadius` (number, 5), `pointOpacity` (number, 0.8),
|
|
84
|
-
`xLabel` (string), `yLabel` (string), `xFormat` (fn), `yFormat` (fn),
|
|
85
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
86
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
87
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
88
|
-
`marginalGraphics` ({ top?, bottom?, left?, right? } — each "histogram"|"violin"|"ridgeline"|"boxplot" or { type, bins?, fill?, fillOpacity?, stroke?, strokeWidth? }),
|
|
89
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
90
|
-
|
|
91
|
-
```jsx
|
|
92
|
-
<Scatterplot data={iris} xAccessor="sepalLength" yAccessor="petalLength" colorBy="species" />
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### BubbleChart
|
|
96
|
-
Like Scatterplot but with required size dimension. Use when a third numeric variable matters.
|
|
97
|
-
|
|
98
|
-
Props: `data` (TDatum[], required), `sizeBy` (string|fn, **required**),
|
|
99
|
-
`xAccessor` (string|fn, "x"), `yAccessor` (string|fn, "y"),
|
|
100
|
-
`sizeRange` ([number, number], [5, 40]),
|
|
101
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
102
|
-
`bubbleOpacity` (number, 0.6), `bubbleStrokeWidth` (number, 1), `bubbleStrokeColor` (string, "white"),
|
|
103
|
-
`xLabel` (string), `yLabel` (string), `xFormat` (fn), `yFormat` (fn),
|
|
104
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
105
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
106
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
107
|
-
`marginalGraphics` ({ top?, bottom?, left?, right? } — each "histogram"|"violin"|"ridgeline"|"boxplot" or { type, bins?, fill?, fillOpacity?, stroke?, strokeWidth? }),
|
|
108
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
109
|
-
|
|
110
|
-
```jsx
|
|
111
|
-
<BubbleChart data={countries} xAccessor="gdp" yAccessor="life" sizeBy="population" colorBy="continent" />
|
|
112
|
-
```
|
|
26
|
+
**AreaChart** — Same as LineChart plus: `areaBy`, `areaOpacity` (0.7), `showLine` (true), curve default "monotoneX"
|
|
113
27
|
|
|
114
|
-
|
|
115
|
-
Grid/matrix visualization with color-encoded cell values.
|
|
116
|
-
|
|
117
|
-
Props: `data` (TDatum[], required), `xAccessor` (string|fn, "x"), `yAccessor` (string|fn, "y"),
|
|
118
|
-
`valueAccessor` (string|fn, "value"),
|
|
119
|
-
`colorScheme` ("blues"|"reds"|"greens"|"viridis"|"custom", "blues"),
|
|
120
|
-
`customColorScale` (any), `showValues` (boolean, false), `valueFormat` (fn),
|
|
121
|
-
`cellBorderColor` (string, "#fff"), `cellBorderWidth` (number, 1),
|
|
122
|
-
`xLabel` (string), `yLabel` (string), `xFormat` (fn), `yFormat` (fn),
|
|
123
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
124
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
125
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
126
|
-
|
|
127
|
-
```jsx
|
|
128
|
-
<Heatmap data={correlations} xAccessor="var1" yAccessor="var2" valueAccessor="r" colorScheme="viridis" />
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Ordinal/Categorical Charts (import from "semiotic" or "semiotic/ordinal")
|
|
132
|
-
|
|
133
|
-
#### BarChart
|
|
134
|
-
Vertical or horizontal bars for categorical comparisons.
|
|
135
|
-
|
|
136
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
137
|
-
`orientation` ("vertical"|"horizontal", "vertical"),
|
|
138
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
139
|
-
`sort` (boolean|"asc"|"desc"|fn, false), `barPadding` (number, 5),
|
|
140
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
141
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
142
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
143
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
144
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
145
|
-
|
|
146
|
-
```jsx
|
|
147
|
-
<BarChart data={sales} categoryAccessor="region" valueAccessor="total" orientation="horizontal" />
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### StackedBarChart
|
|
151
|
-
Stacked bars for part-to-whole comparisons across categories.
|
|
152
|
-
|
|
153
|
-
Props: `data` (TDatum[], required), `stackBy` (string|fn, **required**),
|
|
154
|
-
`categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
155
|
-
`orientation` ("vertical"|"horizontal", "vertical"),
|
|
156
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
157
|
-
`normalize` (boolean, false), `barPadding` (number, 5),
|
|
158
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
159
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
160
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
161
|
-
`showLegend` (boolean, true), `showGrid` (boolean, false),
|
|
162
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
163
|
-
|
|
164
|
-
```jsx
|
|
165
|
-
<StackedBarChart data={survey} categoryAccessor="question" stackBy="response" valueAccessor="count" />
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
#### GroupedBarChart
|
|
169
|
-
Side-by-side bars for comparing sub-categories within categories.
|
|
170
|
-
|
|
171
|
-
Props: `data` (TDatum[], required), `groupBy` (string|fn, **required**),
|
|
172
|
-
`categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
173
|
-
`orientation` ("vertical"|"horizontal", "vertical"),
|
|
174
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
175
|
-
`barPadding` (number, 5),
|
|
176
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
177
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
178
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
179
|
-
`showLegend` (boolean, true), `showGrid` (boolean, false),
|
|
180
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
181
|
-
|
|
182
|
-
```jsx
|
|
183
|
-
<GroupedBarChart data={results} categoryAccessor="year" groupBy="product" valueAccessor="revenue" />
|
|
184
|
-
```
|
|
28
|
+
**StackedAreaChart** — Same as AreaChart plus: `normalize` (false)
|
|
185
29
|
|
|
186
|
-
|
|
187
|
-
Beeswarm/jittered dot plot showing individual data points within categories.
|
|
188
|
-
|
|
189
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
190
|
-
`orientation` ("vertical"|"horizontal", "vertical"),
|
|
191
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
192
|
-
`sizeBy` (string|fn), `sizeRange` ([number, number], [3, 8]),
|
|
193
|
-
`pointRadius` (number, 4), `pointOpacity` (number, 0.7), `categoryPadding` (number, 20),
|
|
194
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
195
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
196
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
197
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
198
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
199
|
-
|
|
200
|
-
```jsx
|
|
201
|
-
<SwarmPlot data={salaries} categoryAccessor="department" valueAccessor="salary" colorBy="level" />
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
#### BoxPlot
|
|
205
|
-
Box-and-whisker plots showing statistical distribution per category.
|
|
206
|
-
|
|
207
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
208
|
-
`orientation` ("vertical"|"horizontal", "vertical"),
|
|
209
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
210
|
-
`showOutliers` (boolean, true), `outlierRadius` (number, 3), `categoryPadding` (number, 20),
|
|
211
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
212
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
213
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
214
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
215
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
216
|
-
|
|
217
|
-
```jsx
|
|
218
|
-
<BoxPlot data={scores} categoryAccessor="subject" valueAccessor="score" showOutliers />
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
#### Histogram
|
|
222
|
-
Binned frequency distribution chart showing how values are distributed across bins per category. Always renders horizontally.
|
|
223
|
-
|
|
224
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
225
|
-
`bins` (number, 25), `relative` (boolean, false),
|
|
226
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
227
|
-
`categoryPadding` (number, 20),
|
|
228
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
229
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
230
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
231
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
232
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
233
|
-
|
|
234
|
-
```jsx
|
|
235
|
-
<Histogram data={measurements} categoryAccessor="group" valueAccessor="value" bins={15} />
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
#### ViolinPlot
|
|
239
|
-
Violin plots showing full distribution shape (kernel density) per category with optional IQR lines.
|
|
240
|
-
|
|
241
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
242
|
-
`orientation` ("vertical"|"horizontal", "vertical"),
|
|
243
|
-
`bins` (number, 25), `curve` (string, "catmullRom"), `showIQR` (boolean, true),
|
|
244
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
245
|
-
`categoryPadding` (number, 20),
|
|
246
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
247
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
248
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
249
|
-
`showLegend` (boolean), `showGrid` (boolean, false),
|
|
250
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
251
|
-
|
|
252
|
-
```jsx
|
|
253
|
-
<ViolinPlot data={salaries} categoryAccessor="department" valueAccessor="salary" showIQR colorBy="department" />
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
#### DotPlot
|
|
257
|
-
Cleveland-style dot plot for comparing values across categories.
|
|
258
|
-
|
|
259
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
260
|
-
`orientation` ("vertical"|"horizontal", "horizontal"),
|
|
261
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
262
|
-
`sort` (boolean|"asc"|"desc"|fn, true), `dotRadius` (number, 5), `categoryPadding` (number, 10),
|
|
263
|
-
`categoryLabel` (string), `valueLabel` (string), `valueFormat` (fn),
|
|
264
|
-
`title` (string), `width` (number, 600), `height` (number, 400),
|
|
265
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
266
|
-
`showLegend` (boolean), `showGrid` (boolean, true),
|
|
267
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
268
|
-
|
|
269
|
-
```jsx
|
|
270
|
-
<DotPlot data={rankings} categoryAccessor="team" valueAccessor="wins" sort="desc" />
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
#### PieChart
|
|
274
|
-
Proportional slices in a circle.
|
|
275
|
-
|
|
276
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
277
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
278
|
-
`startAngle` (number, 0), `slicePadding` (number, 2),
|
|
279
|
-
`title` (string), `width` (number, 400), `height` (number, 400),
|
|
280
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
281
|
-
`showLegend` (boolean, true),
|
|
282
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
283
|
-
|
|
284
|
-
```jsx
|
|
285
|
-
<PieChart data={market} categoryAccessor="brand" valueAccessor="share" />
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
#### DonutChart
|
|
289
|
-
Pie chart with a hole in the center. Supports center content.
|
|
290
|
-
|
|
291
|
-
Props: `data` (TDatum[], required), `categoryAccessor` (string|fn, "category"), `valueAccessor` (string|fn, "value"),
|
|
292
|
-
`innerRadius` (number, 60), `centerContent` (ReactNode),
|
|
293
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
294
|
-
`startAngle` (number, 0), `slicePadding` (number, 2),
|
|
295
|
-
`title` (string), `width` (number, 400), `height` (number, 400),
|
|
296
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
297
|
-
`showLegend` (boolean, true),
|
|
298
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
299
|
-
|
|
300
|
-
```jsx
|
|
301
|
-
<DonutChart data={budget} categoryAccessor="category" valueAccessor="amount" centerContent={<span>$42K</span>} />
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Network Charts (import from "semiotic" or "semiotic/network")
|
|
305
|
-
|
|
306
|
-
#### ForceDirectedGraph
|
|
307
|
-
Physics-based node-link diagram. Use for relationships, social networks, knowledge graphs.
|
|
308
|
-
|
|
309
|
-
Props: `nodes` (TNode[], required), `edges` (TEdge[], required),
|
|
310
|
-
`nodeIDAccessor` (string|fn, "id"), `sourceAccessor` (string|fn, "source"), `targetAccessor` (string|fn, "target"),
|
|
311
|
-
`nodeLabel` (string|fn), `colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
312
|
-
`nodeSize` (number|string|fn, 8), `nodeSizeRange` ([number, number], [5, 20]),
|
|
313
|
-
`edgeWidth` (number|string|fn, 1), `edgeColor` (string, "#999"), `edgeOpacity` (number, 0.6),
|
|
314
|
-
`iterations` (number, 300), `forceStrength` (number, 0.1),
|
|
315
|
-
`showLabels` (boolean, false),
|
|
316
|
-
`title` (string), `width` (number, 600), `height` (number, 600),
|
|
317
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
318
|
-
`showLegend` (boolean, true),
|
|
319
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
320
|
-
|
|
321
|
-
```jsx
|
|
322
|
-
<ForceDirectedGraph nodes={people} edges={friendships} colorBy="team" nodeSize={8} showLabels />
|
|
323
|
-
```
|
|
30
|
+
**Scatterplot** — `data` (required), `xAccessor` ("x"), `yAccessor` ("y"), `colorBy`, `colorScheme`, `sizeBy`, `sizeRange` ([3,15]), `pointRadius` (5), `pointOpacity` (0.8), `xLabel`, `yLabel`, `marginalGraphics` ({top?,bottom?,left?,right?} — "histogram"|"violin"|"ridgeline"|"boxplot" or config object)
|
|
324
31
|
|
|
325
|
-
|
|
326
|
-
Flow diagram showing weighted connections between nodes. Use for flows, budgets, process mapping.
|
|
327
|
-
|
|
328
|
-
Props: `edges` (TEdge[], required), `nodes` (TNode[]),
|
|
329
|
-
`sourceAccessor` (string|fn, "source"), `targetAccessor` (string|fn, "target"),
|
|
330
|
-
`valueAccessor` (string|fn, "value"), `nodeIdAccessor` (string|fn, "id"),
|
|
331
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
332
|
-
`edgeColorBy` ("source"|"target"|"gradient"|fn, "source"),
|
|
333
|
-
`orientation` ("horizontal"|"vertical", "horizontal"),
|
|
334
|
-
`nodeAlign` ("justify"|"left"|"right"|"center", "justify"),
|
|
335
|
-
`nodePaddingRatio` (number, 0.05), `nodeWidth` (number, 15),
|
|
336
|
-
`nodeLabel` (string|fn), `showLabels` (boolean, true),
|
|
337
|
-
`edgeOpacity` (number, 0.5), `edgeSort` (fn),
|
|
338
|
-
`title` (string), `width` (number, 800), `height` (number, 600),
|
|
339
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
340
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
32
|
+
**BubbleChart** — Like Scatterplot with `sizeBy` (required), `sizeRange` ([5,40]), `bubbleOpacity` (0.6), `bubbleStrokeWidth` (1), `bubbleStrokeColor` ("white"), `marginalGraphics`
|
|
341
33
|
|
|
342
|
-
|
|
343
|
-
<SankeyDiagram edges={flows} sourceAccessor="from" targetAccessor="to" valueAccessor="amount" />
|
|
344
|
-
```
|
|
34
|
+
**Heatmap** — `data` (required), `xAccessor` ("x"), `yAccessor` ("y"), `valueAccessor` ("value"), `colorScheme` ("blues"|"reds"|"greens"|"viridis"|"custom"), `customColorScale`, `showValues` (false), `valueFormat`, `cellBorderColor` ("#fff"), `cellBorderWidth` (1)
|
|
345
35
|
|
|
346
|
-
|
|
347
|
-
Circular diagram showing inter-relationships between groups.
|
|
348
|
-
|
|
349
|
-
Props: `edges` (TEdge[], required), `nodes` (TNode[]),
|
|
350
|
-
`sourceAccessor` (string|fn, "source"), `targetAccessor` (string|fn, "target"),
|
|
351
|
-
`valueAccessor` (string|fn, "value"), `nodeIdAccessor` (string|fn, "id"),
|
|
352
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
353
|
-
`edgeColorBy` ("source"|"target"|fn, "source"),
|
|
354
|
-
`padAngle` (number, 0.01), `groupWidth` (number, 20), `sortGroups` (fn),
|
|
355
|
-
`nodeLabel` (string|fn), `showLabels` (boolean, true),
|
|
356
|
-
`edgeOpacity` (number, 0.5),
|
|
357
|
-
`title` (string), `width` (number, 600), `height` (number, 600),
|
|
358
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
359
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
36
|
+
### Ordinal Charts (from "semiotic" or "semiotic/ordinal")
|
|
360
37
|
|
|
361
|
-
|
|
362
|
-
<ChordDiagram edges={trades} sourceAccessor="exporter" targetAccessor="importer" valueAccessor="volume" />
|
|
363
|
-
```
|
|
38
|
+
**BarChart** — `data` (required), `categoryAccessor` ("category"), `valueAccessor` ("value"), `orientation` ("vertical"|"horizontal"), `colorBy`, `colorScheme`, `sort` (boolean|"asc"|"desc"|fn), `barPadding` (5), `categoryLabel`, `valueLabel`, `valueFormat`
|
|
364
39
|
|
|
365
|
-
|
|
366
|
-
Hierarchical tree layout. Supports tree, cluster, partition, and radial orientations.
|
|
367
|
-
|
|
368
|
-
Props: `data` (TNode, required — single root node with children),
|
|
369
|
-
`layout` ("tree"|"cluster"|"partition"|"treemap"|"circlepack", "tree"),
|
|
370
|
-
`orientation` ("vertical"|"horizontal"|"radial", "vertical"),
|
|
371
|
-
`childrenAccessor` (string|fn, "children"), `valueAccessor` (string|fn, "value"),
|
|
372
|
-
`nodeIdAccessor` (string|fn, "name"),
|
|
373
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
374
|
-
`colorByDepth` (boolean, false), `edgeStyle` ("line"|"curve", "curve"),
|
|
375
|
-
`nodeLabel` (string|fn), `showLabels` (boolean, true), `nodeSize` (number, 5),
|
|
376
|
-
`title` (string), `width` (number, 600), `height` (number, 600),
|
|
377
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
378
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
40
|
+
**StackedBarChart** — BarChart props plus `stackBy` (required), `normalize` (false)
|
|
379
41
|
|
|
380
|
-
|
|
381
|
-
<TreeDiagram data={orgChart} childrenAccessor="reports" nodeIdAccessor="name" orientation="horizontal" />
|
|
382
|
-
```
|
|
42
|
+
**GroupedBarChart** — BarChart props plus `groupBy` (required)
|
|
383
43
|
|
|
384
|
-
|
|
385
|
-
Space-filling rectangular hierarchy visualization. Labels are centered in cells.
|
|
386
|
-
Hover shows ancestor breadcrumb path (grandparent → parent → **node**) with outline.
|
|
387
|
-
`colorByDepth` uses a pastel palette keyed to hierarchy depth.
|
|
388
|
-
|
|
389
|
-
Props: `data` (TNode, required — single root node with children),
|
|
390
|
-
`childrenAccessor` (string|fn, "children"), `valueAccessor` (string|fn, "value"),
|
|
391
|
-
`nodeIdAccessor` (string|fn, "name"),
|
|
392
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
393
|
-
`colorByDepth` (boolean, false),
|
|
394
|
-
`showLabels` (boolean, true), `labelMode` ("leaf"|"parent"|"all", "leaf"),
|
|
395
|
-
`nodeLabel` (string|fn),
|
|
396
|
-
`padding` (number, 4), `paddingTop` (number, 0 — auto 18 when labelMode="parent"),
|
|
397
|
-
`title` (string), `width` (number, 600), `height` (number, 600),
|
|
398
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
399
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
44
|
+
**SwarmPlot** — `data` (required), `categoryAccessor`, `valueAccessor`, `orientation`, `colorBy`, `sizeBy`, `sizeRange` ([3,8]), `pointRadius` (4), `pointOpacity` (0.7), `categoryPadding` (20)
|
|
400
45
|
|
|
401
|
-
|
|
402
|
-
<Treemap data={fileSystem} childrenAccessor="children" valueAccessor="size" colorByDepth />
|
|
403
|
-
```
|
|
46
|
+
**BoxPlot** — `data` (required), `categoryAccessor`, `valueAccessor`, `orientation`, `colorBy`, `showOutliers` (true), `outlierRadius` (3), `categoryPadding` (20)
|
|
404
47
|
|
|
405
|
-
|
|
406
|
-
Nested circles representing hierarchical data. Leaf labels are centered; parent labels
|
|
407
|
-
are top-center with white-outlined black text. Circles smaller than 15px radius hide labels.
|
|
408
|
-
Hover shows ancestor breadcrumb path (grandparent → parent → **node**) with circle outline.
|
|
409
|
-
`colorByDepth` uses a pastel palette keyed to hierarchy depth (same as Treemap).
|
|
410
|
-
|
|
411
|
-
Props: `data` (TNode, required — single root node with children),
|
|
412
|
-
`childrenAccessor` (string|fn, "children"), `valueAccessor` (string|fn, "value"),
|
|
413
|
-
`nodeIdAccessor` (string|fn, "name"),
|
|
414
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
415
|
-
`colorByDepth` (boolean, false),
|
|
416
|
-
`showLabels` (boolean, true), `nodeLabel` (string|fn),
|
|
417
|
-
`circleOpacity` (number, 0.7), `padding` (number, 4),
|
|
418
|
-
`title` (string), `width` (number, 600), `height` (number, 600),
|
|
419
|
-
`enableHover` (boolean, true), `tooltip` (fn),
|
|
420
|
-
`margin` (object), `className` (string), `frameProps` (object)
|
|
48
|
+
**Histogram** — `data` (required), `categoryAccessor`, `valueAccessor`, `bins` (25), `relative` (false), `categoryPadding` (20). Always horizontal.
|
|
421
49
|
|
|
422
|
-
|
|
423
|
-
<CirclePack data={taxonomy} childrenAccessor="children" valueAccessor="count" colorByDepth />
|
|
424
|
-
```
|
|
50
|
+
**ViolinPlot** — `data` (required), `categoryAccessor`, `valueAccessor`, `orientation`, `bins` (25), `curve` ("catmullRom"), `showIQR` (true), `categoryPadding` (20)
|
|
425
51
|
|
|
426
|
-
|
|
52
|
+
**DotPlot** — `data` (required), `categoryAccessor`, `valueAccessor`, `orientation` ("horizontal"), `sort` (true), `dotRadius` (5), `categoryPadding` (10), `showGrid` default true
|
|
427
53
|
|
|
428
|
-
|
|
54
|
+
**PieChart** — `data` (required), `categoryAccessor`, `valueAccessor`, `colorBy`, `startAngle` (0), `slicePadding` (2), width/height default 400
|
|
429
55
|
|
|
430
|
-
|
|
431
|
-
const chartRef = useRef()
|
|
432
|
-
// Push data at any frequency
|
|
433
|
-
chartRef.current.push({ time: Date.now(), value: reading })
|
|
434
|
-
```
|
|
56
|
+
**DonutChart** — PieChart props plus `innerRadius` (60), `centerContent` (ReactNode)
|
|
435
57
|
|
|
436
|
-
|
|
437
|
-
Streaming line chart rendered on canvas.
|
|
438
|
-
|
|
439
|
-
Props: `size` ([number, number], [500, 300]),
|
|
440
|
-
`timeAccessor` (string|fn), `valueAccessor` (string|fn),
|
|
441
|
-
`windowSize` (number, 200), `windowMode` ("sliding"|"stepping", "sliding"),
|
|
442
|
-
`arrowOfTime` ("left"|"right", "right"),
|
|
443
|
-
`stroke` (string, "#007bff"), `strokeWidth` (number, 2), `strokeDasharray` (string),
|
|
444
|
-
`timeExtent` ([number, number]), `valueExtent` ([number, number]), `extentPadding` (number),
|
|
445
|
-
`showAxes` (boolean, true), `background` (string),
|
|
446
|
-
`enableHover` (boolean|object), `tooltipContent` (fn), `onHover` (fn),
|
|
447
|
-
`annotations` (object[]), `svgAnnotationRules` (fn),
|
|
448
|
-
`tickFormatTime` (fn), `tickFormatValue` (fn),
|
|
449
|
-
`margin` (object), `className` (string)
|
|
58
|
+
### Network Charts (from "semiotic" or "semiotic/network")
|
|
450
59
|
|
|
451
|
-
|
|
452
|
-
<RealtimeLineChart ref={chartRef} timeAccessor="time" valueAccessor="value" windowSize={200} />
|
|
453
|
-
```
|
|
60
|
+
**ForceDirectedGraph** — `nodes` (required), `edges` (required), `nodeIDAccessor` ("id"), `sourceAccessor` ("source"), `targetAccessor` ("target"), `nodeLabel`, `colorBy`, `nodeSize` (8), `nodeSizeRange` ([5,20]), `edgeWidth` (1), `edgeColor` ("#999"), `edgeOpacity` (0.6), `iterations` (300), `forceStrength` (0.1), `showLabels` (false). Width/height default 600.
|
|
454
61
|
|
|
455
|
-
|
|
456
|
-
Streaming temporal histogram with time-binned aggregation. (Previously RealtimeHistogram.)
|
|
457
|
-
|
|
458
|
-
Props: `binSize` (number, **required**),
|
|
459
|
-
`size` ([number, number], [500, 300]),
|
|
460
|
-
`timeAccessor` (string|fn), `valueAccessor` (string|fn),
|
|
461
|
-
`categoryAccessor` (string|fn), `colors` (Record<string, string>),
|
|
462
|
-
`windowSize` (number, 200), `windowMode` ("sliding"|"stepping", "sliding"),
|
|
463
|
-
`arrowOfTime` ("left"|"right", "right"),
|
|
464
|
-
`fill` (string), `stroke` (string), `strokeWidth` (number), `gap` (number),
|
|
465
|
-
`timeExtent` ([number, number]), `valueExtent` ([number, number]), `extentPadding` (number),
|
|
466
|
-
`showAxes` (boolean, true), `background` (string),
|
|
467
|
-
`enableHover` (boolean|object), `tooltipContent` (fn), `onHover` (fn),
|
|
468
|
-
`annotations` (object[]), `svgAnnotationRules` (fn),
|
|
469
|
-
`tickFormatTime` (fn), `tickFormatValue` (fn),
|
|
470
|
-
`margin` (object), `className` (string)
|
|
62
|
+
**SankeyDiagram** — `edges` (required), `nodes` (optional), `sourceAccessor`, `targetAccessor`, `valueAccessor` ("value"), `nodeIdAccessor` ("id"), `colorBy`, `edgeColorBy` ("source"|"target"|"gradient"|fn), `orientation` ("horizontal"|"vertical"), `nodeAlign` ("justify"|"left"|"right"|"center"), `nodePaddingRatio` (0.05), `nodeWidth` (15), `nodeLabel`, `showLabels` (true), `edgeOpacity` (0.5), `edgeSort`. Default 800x600.
|
|
471
63
|
|
|
472
|
-
|
|
473
|
-
<RealtimeTemporalHistogram ref={chartRef} binSize={1000} timeAccessor="time" valueAccessor="count" />
|
|
474
|
-
```
|
|
64
|
+
**ChordDiagram** — `edges` (required), `nodes`, `sourceAccessor`, `targetAccessor`, `valueAccessor`, `nodeIdAccessor`, `colorBy`, `edgeColorBy`, `padAngle` (0.01), `groupWidth` (20), `sortGroups`, `nodeLabel`, `showLabels` (true), `edgeOpacity` (0.5)
|
|
475
65
|
|
|
476
|
-
|
|
477
|
-
Streaming swarm/scatter chart showing individual data points.
|
|
478
|
-
|
|
479
|
-
Props: `size` ([number, number], [500, 300]),
|
|
480
|
-
`timeAccessor` (string|fn), `valueAccessor` (string|fn),
|
|
481
|
-
`categoryAccessor` (string|fn), `colors` (Record<string, string>),
|
|
482
|
-
`windowSize` (number, 200), `windowMode` ("sliding"|"stepping", "sliding"),
|
|
483
|
-
`arrowOfTime` ("left"|"right", "right"),
|
|
484
|
-
`radius` (number), `fill` (string), `opacity` (number), `stroke` (string), `strokeWidth` (number),
|
|
485
|
-
`timeExtent` ([number, number]), `valueExtent` ([number, number]), `extentPadding` (number),
|
|
486
|
-
`showAxes` (boolean, true), `background` (string),
|
|
487
|
-
`enableHover` (boolean|object), `tooltipContent` (fn), `onHover` (fn),
|
|
488
|
-
`annotations` (object[]), `svgAnnotationRules` (fn),
|
|
489
|
-
`tickFormatTime` (fn), `tickFormatValue` (fn),
|
|
490
|
-
`margin` (object), `className` (string)
|
|
66
|
+
**TreeDiagram** — `data` (required, single root with children), `layout` ("tree"|"cluster"|"partition"|"treemap"|"circlepack"), `orientation` ("vertical"|"horizontal"|"radial"), `childrenAccessor` ("children"), `valueAccessor`, `nodeIdAccessor` ("name"), `colorBy`, `colorByDepth` (false), `edgeStyle` ("line"|"curve"), `nodeLabel`, `showLabels` (true), `nodeSize` (5)
|
|
491
67
|
|
|
492
|
-
|
|
493
|
-
<RealtimeSwarmChart ref={chartRef} timeAccessor="time" valueAccessor="latency" categoryAccessor="service" />
|
|
494
|
-
```
|
|
68
|
+
**Treemap** — `data` (required, root with children), `childrenAccessor`, `valueAccessor`, `nodeIdAccessor` ("name"), `colorBy`, `colorByDepth` (false), `showLabels` (true), `labelMode` ("leaf"|"parent"|"all"), `nodeLabel`, `padding` (4), `paddingTop` (0, auto 18 for "parent"). Hover shows ancestor breadcrumb.
|
|
495
69
|
|
|
496
|
-
|
|
497
|
-
Streaming waterfall chart showing positive/negative changes over time.
|
|
498
|
-
|
|
499
|
-
Props: `size` ([number, number], [500, 300]),
|
|
500
|
-
`timeAccessor` (string|fn), `valueAccessor` (string|fn),
|
|
501
|
-
`windowSize` (number, 200), `windowMode` ("sliding"|"stepping", "sliding"),
|
|
502
|
-
`arrowOfTime` ("left"|"right", "right"),
|
|
503
|
-
`positiveColor` (string), `negativeColor` (string),
|
|
504
|
-
`connectorStroke` (string), `connectorWidth` (number),
|
|
505
|
-
`gap` (number), `stroke` (string), `strokeWidth` (number),
|
|
506
|
-
`timeExtent` ([number, number]), `valueExtent` ([number, number]), `extentPadding` (number),
|
|
507
|
-
`showAxes` (boolean, true), `background` (string),
|
|
508
|
-
`enableHover` (boolean|object), `tooltipContent` (fn), `onHover` (fn),
|
|
509
|
-
`annotations` (object[]), `svgAnnotationRules` (fn),
|
|
510
|
-
`tickFormatTime` (fn), `tickFormatValue` (fn),
|
|
511
|
-
`margin` (object), `className` (string)
|
|
70
|
+
**CirclePack** — `data` (required), `childrenAccessor`, `valueAccessor`, `nodeIdAccessor`, `colorBy`, `colorByDepth` (false), `showLabels` (true), `nodeLabel`, `circleOpacity` (0.7), `padding` (4). Labels hidden below 15px radius. Hover shows ancestor breadcrumb.
|
|
512
71
|
|
|
513
|
-
|
|
514
|
-
<RealtimeWaterfallChart ref={chartRef} timeAccessor="time" valueAccessor="delta" />
|
|
515
|
-
```
|
|
72
|
+
### Realtime Charts (from "semiotic" or "semiotic/realtime")
|
|
516
73
|
|
|
517
|
-
|
|
518
|
-
Streaming 2D heatmap with grid binning and configurable aggregation (count, sum, mean).
|
|
519
|
-
|
|
520
|
-
Props: `size` ([number, number], [500, 300]),
|
|
521
|
-
`timeAccessor` (string|fn), `valueAccessor` (string|fn),
|
|
522
|
-
`heatmapXBins` (number, 20), `heatmapYBins` (number, 20),
|
|
523
|
-
`aggregation` ("count"|"sum"|"mean", "count"),
|
|
524
|
-
`windowSize` (number, 200), `windowMode` ("sliding"|"stepping", "sliding"),
|
|
525
|
-
`arrowOfTime` ("left"|"right", "right"),
|
|
526
|
-
`timeExtent` ([number, number]), `valueExtent` ([number, number]), `extentPadding` (number),
|
|
527
|
-
`showAxes` (boolean, true), `background` (string),
|
|
528
|
-
`enableHover` (boolean|object), `tooltipContent` (fn), `onHover` (fn),
|
|
529
|
-
`decay` (DecayConfig), `pulse` (PulseConfig), `staleness` (StalenessConfig),
|
|
530
|
-
`margin` (object), `className` (string)
|
|
74
|
+
All use ref-based push API + canvas rendering: `chartRef.current.push({ time, value })`
|
|
531
75
|
|
|
532
|
-
|
|
533
|
-
<RealtimeHeatmap ref={chartRef} timeAccessor="x" valueAccessor="y" heatmapXBins={20} aggregation="count" />
|
|
534
|
-
```
|
|
76
|
+
**RealtimeLineChart** — `size` ([500,300]), `timeAccessor`, `valueAccessor`, `windowSize` (200), `windowMode` ("sliding"|"stepping"), `arrowOfTime` ("left"|"right"), `stroke`, `strokeWidth`, `strokeDasharray`, `timeExtent`, `valueExtent`, `extentPadding`, `showAxes`, `background`, `enableHover`, `tooltipContent`, `onHover`, `annotations`, `svgAnnotationRules`, `tickFormatTime`, `tickFormatValue`
|
|
535
77
|
|
|
536
|
-
|
|
537
|
-
Streaming Sankey diagram using `StreamNetworkFrame` with `chartType="sankey"`. Topology grows
|
|
538
|
-
over time via push API. Particles animate along links proportional to flow value. Tension model
|
|
539
|
-
batches relayouts for smooth performance.
|
|
540
|
-
|
|
541
|
-
Use `StreamNetworkFrame` directly with `chartType="sankey"` and `showParticles` for streaming
|
|
542
|
-
Sankey visualizations.
|
|
543
|
-
|
|
544
|
-
Props (on `StreamNetworkFrame`): `chartType` ("sankey", **required for streaming sankey**),
|
|
545
|
-
`size` ([number, number], [800, 600]),
|
|
546
|
-
`sourceAccessor` (string, "source"), `targetAccessor` (string, "target"),
|
|
547
|
-
`valueAccessor` (string, "value"),
|
|
548
|
-
`orientation` ("horizontal"|"vertical", "horizontal"),
|
|
549
|
-
`nodeAlign` ("justify"|"left"|"right"|"center", "justify"),
|
|
550
|
-
`nodePaddingRatio` (number, 0.05), `nodeWidth` (number, 15),
|
|
551
|
-
`showParticles` (boolean, true),
|
|
552
|
-
`particleStyle` ({ radius?, color?, opacity?, speedMultiplier?, maxPerEdge?, spawnRate? }),
|
|
553
|
-
`tensionConfig` ({ threshold?, newNode?, newEdge?, weightChange?, transitionDuration? }),
|
|
554
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
555
|
-
`edgeColorBy` ("source"|"target"|fn, "source"), `edgeOpacity` (number, 0.5),
|
|
556
|
-
`nodeLabel` (string|fn), `showLabels` (boolean, true),
|
|
557
|
-
`enableHover` (boolean, true), `tooltipContent` (fn),
|
|
558
|
-
`onTopologyChange` (fn), `background` (string),
|
|
559
|
-
`margin` (object), `className` (string)
|
|
560
|
-
|
|
561
|
-
Ref handle: `push({ source, target, value })`, `pushMany(edges)`, `clear()`,
|
|
562
|
-
`getTopology()`, `relayout()`, `getTension()`
|
|
78
|
+
**RealtimeTemporalHistogram** — RealtimeLineChart props plus `binSize` (required), `categoryAccessor`, `colors`, `fill`, `gap`, `decay`, `pulse`, `staleness`, `transition`
|
|
563
79
|
|
|
564
|
-
|
|
565
|
-
import { StreamNetworkFrame } from "semiotic"
|
|
80
|
+
**RealtimeSwarmChart** — RealtimeLineChart props plus `categoryAccessor`, `colors`, `radius`, `fill`, `opacity`
|
|
566
81
|
|
|
567
|
-
|
|
568
|
-
chartRef.current.push({ source: "Salary", target: "Budget", value: 5000 })
|
|
82
|
+
**RealtimeWaterfallChart** — RealtimeLineChart props plus `positiveColor`, `negativeColor`, `connectorStroke`, `connectorWidth`, `gap`
|
|
569
83
|
|
|
570
|
-
|
|
571
|
-
```
|
|
84
|
+
**RealtimeHeatmap** — RealtimeLineChart props plus `heatmapXBins` (20), `heatmapYBins` (20), `aggregation` ("count"|"sum"|"mean"), `linkedHover`, `decay`, `pulse`, `staleness`
|
|
572
85
|
|
|
573
|
-
|
|
86
|
+
**Streaming Sankey** — Use `StreamNetworkFrame` with `chartType="sankey"`, `showParticles`, `particleStyle`, `tensionConfig`, `thresholds`, `onTopologyChange`. Ref: `push()`, `pushMany()`, `clear()`, `getTopology()`, `relayout()`, `getTension()`
|
|
574
87
|
|
|
575
|
-
|
|
576
|
-
|
|
88
|
+
### Realtime Visual Encoding (all streaming charts)
|
|
89
|
+
- `decay` — older data fades (`{ type, halfLife, minOpacity }`)
|
|
90
|
+
- `pulse` — new data flashes (`{ duration, color, glowRadius }`)
|
|
91
|
+
- `transition` — smooth interpolation (`{ duration, easing }`)
|
|
92
|
+
- `staleness` — stale feed detection (`{ threshold, dimOpacity, showBadge }`)
|
|
577
93
|
|
|
578
|
-
|
|
94
|
+
### Coordinated Views (from "semiotic" or "semiotic/ai")
|
|
579
95
|
|
|
580
|
-
|
|
581
|
-
<LinkedCharts selections={{ dash: { resolution: "crossfilter" } }}>
|
|
582
|
-
<Scatterplot data={d} xAccessor="x" yAccessor="y"
|
|
583
|
-
linkedHover={{ name: "hl", fields: ["cat"] }}
|
|
584
|
-
selection={{ name: "hl" }} />
|
|
585
|
-
<BarChart data={agg} categoryAccessor="cat" valueAccessor="total"
|
|
586
|
-
selection={{ name: "hl" }} />
|
|
587
|
-
</LinkedCharts>
|
|
588
|
-
```
|
|
96
|
+
**LinkedCharts** — Wraps charts for coordination. Props: `selections` (Record with resolution: "union"|"intersect"|"crossfilter")
|
|
589
97
|
|
|
590
|
-
|
|
591
|
-
- `selection`
|
|
592
|
-
- `linkedHover`
|
|
593
|
-
- `linkedBrush`
|
|
594
|
-
|
|
595
|
-
**Hooks** (for custom coordinated views):
|
|
596
|
-
- `useSelection({ name, clientId?, fields? })` → { predicate, isActive, selectPoints, selectInterval, clear }
|
|
597
|
-
- `useLinkedHover({ name?, fields })` → { onHover, predicate, isActive }
|
|
598
|
-
- `useBrushSelection({ name, xField?, yField? })` → { brushInteraction, predicate, isActive, clear }
|
|
599
|
-
- `useFilteredData(data, selectionName, clientId?)` → filtered T[]
|
|
600
|
-
|
|
601
|
-
#### ScatterplotMatrix
|
|
602
|
-
N×N grid of scatterplots for exploring multi-dimensional data. Diagonal shows histograms.
|
|
603
|
-
Two mutually exclusive interaction modes: hover (default) cross-highlights the same datum
|
|
604
|
-
across all cells with a tooltip; brush mode enables crossfilter region selection.
|
|
605
|
-
|
|
606
|
-
Props: `data` (TDatum[], required), `fields` (string[], required),
|
|
607
|
-
`fieldLabels` (Record<string, string>),
|
|
608
|
-
`colorBy` (string|fn), `colorScheme` (string|string[], "category10"),
|
|
609
|
-
`cellSize` (number, 150), `cellGap` (number, 4),
|
|
610
|
-
`pointRadius` (number, 2), `pointOpacity` (number, 0.5),
|
|
611
|
-
`diagonal` ("histogram"|"density"|"label", "histogram"),
|
|
612
|
-
`histogramBins` (number, 20),
|
|
613
|
-
`hoverMode` (boolean, true — cross-highlight with tooltip above hovered point),
|
|
614
|
-
`brushMode` ("crossfilter"|"intersect"|false, "crossfilter" — active when hoverMode is false),
|
|
615
|
-
`unselectedOpacity` (number, 0.1),
|
|
616
|
-
`showGrid` (boolean, false), `tooltip` (fn), `showLegend` (boolean),
|
|
617
|
-
`width` (number), `height` (number), `className` (string)
|
|
98
|
+
Chart coordination props (on HOCs inside LinkedCharts):
|
|
99
|
+
- `selection` — consume named selection
|
|
100
|
+
- `linkedHover` — produce hover selections
|
|
101
|
+
- `linkedBrush` — produce brush selections (Scatterplot/BubbleChart only)
|
|
618
102
|
|
|
619
|
-
|
|
620
|
-
// Hover mode (default): cross-highlight on hover with tooltip
|
|
621
|
-
<ScatterplotMatrix
|
|
622
|
-
data={iris}
|
|
623
|
-
fields={["sepalLength", "sepalWidth", "petalLength", "petalWidth"]}
|
|
624
|
-
colorBy="species"
|
|
625
|
-
fieldLabels={{ sepalLength: "Sepal Length", sepalWidth: "Sepal Width", petalLength: "Petal Length", petalWidth: "Petal Width" }}
|
|
626
|
-
cellSize={160}
|
|
627
|
-
/>
|
|
628
|
-
|
|
629
|
-
// Brush mode: crossfilter region selection
|
|
630
|
-
<ScatterplotMatrix
|
|
631
|
-
data={iris}
|
|
632
|
-
fields={["sepalLength", "sepalWidth", "petalLength", "petalWidth"]}
|
|
633
|
-
colorBy="species"
|
|
634
|
-
cellSize={160}
|
|
635
|
-
hoverMode={false}
|
|
636
|
-
brushMode="crossfilter"
|
|
637
|
-
/>
|
|
638
|
-
```
|
|
103
|
+
Hooks: `useSelection`, `useLinkedHover`, `useBrushSelection`, `useFilteredData`
|
|
639
104
|
|
|
640
|
-
|
|
105
|
+
**ScatterplotMatrix** — `data` (required), `fields` (required), `fieldLabels`, `colorBy`, `cellSize` (150), `cellGap` (4), `pointRadius` (2), `pointOpacity` (0.5), `diagonal` ("histogram"|"density"|"label"), `histogramBins` (20), `hoverMode` (true), `brushMode` ("crossfilter"|"intersect"|false), `unselectedOpacity` (0.1)
|
|
641
106
|
|
|
642
|
-
|
|
107
|
+
## Key Usage Patterns
|
|
643
108
|
|
|
644
109
|
```jsx
|
|
645
|
-
//
|
|
646
|
-
<
|
|
110
|
+
// Multi-line data
|
|
111
|
+
<LineChart data={[{ id: "A", coordinates: [{x:0,y:1},{x:1,y:2}] }]} lineBy="id" xAccessor="x" yAccessor="y" />
|
|
647
112
|
|
|
648
|
-
//
|
|
649
|
-
<
|
|
113
|
+
// Hierarchical data (TreeDiagram, Treemap, CirclePack) — single root with children
|
|
114
|
+
<Treemap data={rootNode} childrenAccessor="children" valueAccessor="value" />
|
|
650
115
|
|
|
651
|
-
//
|
|
652
|
-
<
|
|
653
|
-
|
|
654
|
-
// Staleness: dim chart + show badge when data feed stops
|
|
655
|
-
<StreamXYFrame staleness={{ threshold: 5000, dimOpacity: 0.5, showBadge: true }} />
|
|
656
|
-
```
|
|
657
|
-
|
|
658
|
-
Works on StreamXYFrame, StreamOrdinalFrame, and all realtime HOCs. Features compose freely.
|
|
659
|
-
|
|
660
|
-
## Common Patterns
|
|
661
|
-
|
|
662
|
-
### Color encoding
|
|
663
|
-
```jsx
|
|
664
|
-
<BarChart data={d} categoryAccessor="name" valueAccessor="value" colorBy="region" />
|
|
665
|
-
// Custom colors:
|
|
666
|
-
<BarChart ... colorScheme={["#e41a1c", "#377eb8", "#4daf4a"]} />
|
|
667
|
-
```
|
|
668
|
-
|
|
669
|
-
### Tooltips
|
|
670
|
-
```jsx
|
|
671
|
-
import { MultiLineTooltip } from "semiotic"
|
|
116
|
+
// Network data
|
|
117
|
+
<SankeyDiagram nodes={nodes} edges={edges} valueAccessor="value" />
|
|
672
118
|
|
|
119
|
+
// Tooltips
|
|
673
120
|
<LineChart ... tooltip={MultiLineTooltip({ title: "name", fields: ["value"] })} />
|
|
674
|
-
```
|
|
675
|
-
|
|
676
|
-
### Legends
|
|
677
|
-
Automatic when `colorBy` is set. Control with `showLegend`.
|
|
678
|
-
|
|
679
|
-
### Grid lines
|
|
680
|
-
```jsx
|
|
681
|
-
<LineChart ... showGrid={true} />
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
### Marginal graphics
|
|
685
|
-
```jsx
|
|
686
|
-
// Add distribution plots in the margins of scatter/bubble charts
|
|
687
|
-
<Scatterplot data={iris} xAccessor="sepalLength" yAccessor="petalLength"
|
|
688
|
-
marginalGraphics={{ top: "histogram", right: "violin" }} />
|
|
689
|
-
|
|
690
|
-
// With custom config
|
|
691
|
-
<Scatterplot data={data} xAccessor="x" yAccessor="y"
|
|
692
|
-
marginalGraphics={{
|
|
693
|
-
top: { type: "ridgeline", fill: "#e41a1c", fillOpacity: 0.6 },
|
|
694
|
-
left: { type: "boxplot", fill: "#377eb8" }
|
|
695
|
-
}} />
|
|
696
|
-
```
|
|
697
|
-
|
|
698
|
-
### Multi-line data
|
|
699
|
-
```jsx
|
|
700
|
-
// Array of line objects, each with a coordinates array:
|
|
701
|
-
const data = [
|
|
702
|
-
{ id: "A", coordinates: [{ x: 0, y: 1 }, { x: 1, y: 2 }] },
|
|
703
|
-
{ id: "B", coordinates: [{ x: 0, y: 3 }, { x: 1, y: 1 }] }
|
|
704
|
-
]
|
|
705
|
-
<LineChart data={data} lineBy="id" xAccessor="x" yAccessor="y" />
|
|
706
|
-
```
|
|
707
|
-
|
|
708
|
-
### Hierarchical data (TreeDiagram, Treemap, CirclePack)
|
|
709
|
-
```jsx
|
|
710
|
-
// Single root object with nested children:
|
|
711
|
-
const data = {
|
|
712
|
-
name: "root",
|
|
713
|
-
children: [
|
|
714
|
-
{ name: "A", value: 10 },
|
|
715
|
-
{ name: "B", children: [{ name: "B1", value: 5 }] }
|
|
716
|
-
]
|
|
717
|
-
}
|
|
718
|
-
<Treemap data={data} childrenAccessor="children" valueAccessor="value" />
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
### Network data (ForceDirectedGraph, SankeyDiagram, ChordDiagram)
|
|
722
|
-
```jsx
|
|
723
|
-
const nodes = [{ id: "A" }, { id: "B" }, { id: "C" }]
|
|
724
|
-
const edges = [{ source: "A", target: "B", value: 10 }, { source: "B", target: "C", value: 5 }]
|
|
725
|
-
<SankeyDiagram nodes={nodes} edges={edges} valueAccessor="value" />
|
|
726
|
-
```
|
|
727
121
|
|
|
728
|
-
|
|
729
|
-
```jsx
|
|
730
|
-
// Cross-highlighting: hover one chart, highlight matching data in others
|
|
122
|
+
// Coordinated views
|
|
731
123
|
<LinkedCharts>
|
|
732
|
-
<Scatterplot data={d}
|
|
733
|
-
|
|
734
|
-
selection={{ name: "hl" }} />
|
|
735
|
-
<BarChart data={agg} categoryAccessor="region" valueAccessor="total"
|
|
736
|
-
linkedHover={{ name: "hl", fields: ["region"] }}
|
|
737
|
-
selection={{ name: "hl" }} />
|
|
124
|
+
<Scatterplot data={d} linkedHover={{ name: "hl", fields: ["cat"] }} selection={{ name: "hl" }} />
|
|
125
|
+
<BarChart data={agg} selection={{ name: "hl" }} />
|
|
738
126
|
</LinkedCharts>
|
|
739
|
-
```
|
|
740
127
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
// Hover cross-highlight (default)
|
|
744
|
-
<ScatterplotMatrix
|
|
745
|
-
data={iris}
|
|
746
|
-
fields={["sepalLength", "sepalWidth", "petalLength", "petalWidth"]}
|
|
747
|
-
colorBy="species"
|
|
748
|
-
fieldLabels={{ sepalLength: "Sepal Length", sepalWidth: "Sepal Width" }}
|
|
749
|
-
cellSize={160}
|
|
750
|
-
/>
|
|
751
|
-
// Crossfilter brushing
|
|
752
|
-
<ScatterplotMatrix
|
|
753
|
-
data={iris}
|
|
754
|
-
fields={["sepalLength", "sepalWidth", "petalLength", "petalWidth"]}
|
|
755
|
-
colorBy="species"
|
|
756
|
-
hoverMode={false}
|
|
757
|
-
brushMode="crossfilter"
|
|
758
|
-
/>
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
### ThemeProvider (import from "semiotic" or "semiotic/ai")
|
|
128
|
+
// Marginal graphics
|
|
129
|
+
<Scatterplot data={d} marginalGraphics={{ top: "histogram", right: "violin" }} />
|
|
762
130
|
|
|
763
|
-
|
|
131
|
+
// Theming
|
|
132
|
+
<ThemeProvider theme="dark"><LineChart ... /></ThemeProvider>
|
|
764
133
|
|
|
765
|
-
|
|
766
|
-
import {
|
|
134
|
+
// Data transforms
|
|
135
|
+
import { bin, rollup, groupBy, pivot } from "semiotic/data"
|
|
767
136
|
|
|
768
|
-
//
|
|
769
|
-
|
|
770
|
-
<LineChart data={d} xAccessor="x" yAccessor="y" />
|
|
771
|
-
</ThemeProvider>
|
|
137
|
+
// Browser export
|
|
138
|
+
await exportChart(el, { format: "png", scale: 2 })
|
|
772
139
|
|
|
773
|
-
//
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
140
|
+
// Realtime
|
|
141
|
+
const ref = useRef()
|
|
142
|
+
ref.current.push({ time: Date.now(), value: 42 })
|
|
143
|
+
<RealtimeLineChart ref={ref} timeAccessor="time" valueAccessor="value" />
|
|
777
144
|
```
|
|
778
145
|
|
|
779
|
-
|
|
146
|
+
## AI Features
|
|
780
147
|
|
|
781
|
-
|
|
148
|
+
**onObservation** — callback on all HOCs emitting structured events: hover, hover-end, click, click-end, brush, brush-end, selection, selection-end. Each includes `{ type, datum?, x?, y?, timestamp, chartType, chartId? }`.
|
|
782
149
|
|
|
783
|
-
|
|
150
|
+
**useChartObserver** — aggregates observations across LinkedCharts. Options: `limit` (50), `types`, `chartId`.
|
|
784
151
|
|
|
785
|
-
|
|
786
|
-
import { bin, rollup, groupBy, pivot } from "semiotic/data"
|
|
152
|
+
**Chart serialization** — `toConfig(name, props)` / `fromConfig(config)` for JSON round-trip. `toURL`/`fromURL` for permalinks. `copyConfig(config, "jsx")` for clipboard. `configToJSX(config)` for code gen. String accessors survive; functions are stripped.
|
|
787
153
|
|
|
788
|
-
|
|
789
|
-
rollup(data, { groupBy: "region", value: "sales", agg: "sum" }) // → aggregated rows
|
|
790
|
-
groupBy(data, { key: "region" }) // → [{ id, coordinates }] for LineChart
|
|
791
|
-
pivot(data, { columns: ["q1", "q2", "q3"] }) // → wide-to-long format
|
|
792
|
-
```
|
|
154
|
+
**DetailsPanel** — selection-driven detail panel. Props: `children` (render fn), `position` ("right"|"bottom"|"overlay"), `size` (300), `trigger` ("click"|"hover"), `chartId`, `dismissOnEmpty`, `showClose`. Use inside ChartContainer via `detailsPanel` prop.
|
|
793
155
|
|
|
794
|
-
|
|
156
|
+
**ChartErrorBoundary** — `fallback` (ReactNode), `onError` (fn)
|
|
795
157
|
|
|
796
|
-
|
|
797
|
-
import { exportChart } from "semiotic"
|
|
798
|
-
|
|
799
|
-
// Export chart container to SVG or PNG
|
|
800
|
-
await exportChart(containerElement, { format: "png", scale: 2 })
|
|
801
|
-
await exportChart(containerElement, { format: "svg", filename: "my-chart" })
|
|
802
|
-
```
|
|
803
|
-
|
|
804
|
-
### ChartErrorBoundary (import from "semiotic")
|
|
805
|
-
|
|
806
|
-
```jsx
|
|
807
|
-
import { ChartErrorBoundary } from "semiotic"
|
|
808
|
-
|
|
809
|
-
<ChartErrorBoundary fallback={<div>Chart error</div>} onError={logError}>
|
|
810
|
-
<LineChart data={data} xAccessor="x" yAccessor="y" />
|
|
811
|
-
</ChartErrorBoundary>
|
|
812
|
-
```
|
|
158
|
+
**validateProps(componentName, props)** — returns `{ valid, errors }`
|
|
813
159
|
|
|
814
160
|
## What Semiotic Does That Others Don't
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
-
|
|
819
|
-
-
|
|
820
|
-
-
|
|
821
|
-
-
|
|
822
|
-
-
|
|
823
|
-
- **Annotation system** — built-in hover, click, and custom annotations
|
|
824
|
-
- **Server-side SVG** — `renderToStaticSVG()` for email/OG images (import from "semiotic/server")
|
|
825
|
-
- **Browser export** — `exportChart()` for SVG/PNG download
|
|
826
|
-
- **Global theming** — `ThemeProvider` with dark mode support
|
|
827
|
-
|
|
828
|
-
For standard bar/line/pie charts in a simple dashboard, Recharts is a fine choice with a larger community. Semiotic is for projects that outgrow those libraries.
|
|
161
|
+
- Network visualization (force, sankey, chord, tree, treemap, circlepack) with same clean API
|
|
162
|
+
- Streaming data (canvas 60fps push API) + streaming Sankey with particles
|
|
163
|
+
- Realtime visual encoding (decay, pulse, transitions, staleness)
|
|
164
|
+
- Coordinated views (LinkedCharts, crossfilter brushing, ScatterplotMatrix)
|
|
165
|
+
- Statistical summaries (box, violin, swarm, histogram, marginal graphics)
|
|
166
|
+
- AI observation hooks + chart state serialization
|
|
167
|
+
- Server-side SVG via `renderToStaticSVG()` (from "semiotic/server")
|
|
168
|
+
- Global theming with ThemeProvider
|