semiotic 3.2.2 → 3.3.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/CLAUDE.md +118 -222
- package/README.md +37 -17
- package/ai/schema.json +64 -1
- package/ai/system-prompt.md +3 -3
- package/dist/components/Tooltip/Tooltip.d.ts +6 -1
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +55 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
- package/dist/components/charts/shared/hooks.d.ts +5 -1
- package/dist/components/charts/shared/types.d.ts +14 -5
- package/dist/components/charts/shared/useChartSetup.d.ts +2 -0
- package/dist/components/charts/xy/AreaChart.d.ts +17 -2
- package/dist/components/charts/xy/LineChart.d.ts +14 -3
- package/dist/components/realtime/RingBuffer.d.ts +11 -0
- package/dist/components/realtime/types.d.ts +4 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-server.d.ts +6 -1
- package/dist/components/semiotic-utils.d.ts +2 -1
- package/dist/components/semiotic.d.ts +3 -3
- package/dist/components/server/animatedGif.d.ts +78 -0
- package/dist/components/server/renderToStaticSVG.d.ts +85 -5
- package/dist/components/server/staticAnnotations.d.ts +40 -0
- package/dist/components/server/staticLegend.d.ts +39 -0
- package/dist/components/server/svgHatchPattern.d.ts +26 -0
- package/dist/components/server/themeResolver.d.ts +35 -0
- package/dist/components/store/LinkedCrosshairStore.d.ts +6 -2
- package/dist/components/stream/CanvasHitTester.d.ts +13 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +6 -1
- package/dist/components/stream/NetworkPipelineStore.d.ts +20 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +11 -0
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +6 -1
- package/dist/components/stream/PipelineStore.d.ts +28 -1
- package/dist/components/stream/SVGOverlay.d.ts +11 -5
- package/dist/components/stream/accessorUtils.d.ts +3 -3
- package/dist/components/stream/geoTypes.d.ts +2 -0
- package/dist/components/stream/hitTestUtils.d.ts +15 -0
- package/dist/components/stream/networkTypes.d.ts +33 -0
- package/dist/components/stream/ordinalTypes.d.ts +37 -4
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +17 -0
- package/dist/components/stream/types.d.ts +58 -5
- package/dist/components/stream/xySceneBuilders/mixedScene.d.ts +12 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +15 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +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.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-server.d.ts +6 -1
- package/dist/semiotic-utils.d.ts +2 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic.d.ts +3 -3
- 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/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +21 -7
package/ai/system-prompt.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Semiotic — React Data Visualization
|
|
2
2
|
|
|
3
|
-
Use `
|
|
3
|
+
Use sub-path imports: `semiotic/xy` (143KB gz), `semiotic/ordinal` (109KB), `semiotic/network` (98KB), `semiotic/geo` (93KB), `semiotic/realtime` (145KB). Or `semiotic/ai` for all 38 HOCs in one import (269KB).
|
|
4
4
|
|
|
5
5
|
## Flat Array Data (`data: object[]`)
|
|
6
6
|
- **LineChart** — `xAccessor`, `yAccessor`, `lineBy` (multi-line), `curve`
|
|
@@ -58,7 +58,7 @@ const chartRef = useRef()
|
|
|
58
58
|
chartRef.current.push({ x: 1, y: 2 })
|
|
59
59
|
<Scatterplot ref={chartRef} xAccessor="x" yAccessor="y" />
|
|
60
60
|
```
|
|
61
|
-
Methods: `push(datum)`, `pushMany(data)`, `clear()`, `getData()`. Streaming-specific props (`windowSize`, `decay`, `pulse`) go in `frameProps`. Supported: XY charts, ordinal charts, network charts (ForceDirectedGraph, SankeyDiagram, ChordDiagram), ProportionalSymbolMap, DistanceCartogram. Not supported: hierarchy charts (TreeDiagram, Treemap, CirclePack, OrbitDiagram), ChoroplethMap, FlowMap, ScatterplotMatrix.
|
|
61
|
+
Methods: `push(datum)`, `pushMany(data)`, `remove(id)` (requires `pointIdAccessor`/`dataIdAccessor`), `update(id, updater)`, `clear()`, `getData()`. Network HOC refs use `remove()`/`update()` for node operations. Edge-level methods (`removeNode`, `removeEdge`, `updateNode`, `updateEdge`) are on `StreamNetworkFrameHandle`. Geo charts: `update()` is implemented as remove+push internally. Streaming-specific props (`windowSize`, `decay`, `pulse`) go in `frameProps`. Supported: XY charts, ordinal charts, network charts (ForceDirectedGraph, SankeyDiagram, ChordDiagram), ProportionalSymbolMap, DistanceCartogram. Not supported: hierarchy charts (TreeDiagram, Treemap, CirclePack, OrbitDiagram), ChoroplethMap, FlowMap, ScatterplotMatrix.
|
|
62
62
|
|
|
63
63
|
For advanced streaming control, use Stream Frames (`StreamXYFrame`, `StreamOrdinalFrame`, `StreamNetworkFrame`) with `runtimeMode="streaming"` and ref-based push.
|
|
64
64
|
|
|
@@ -113,5 +113,5 @@ Or use ThemeProvider with 15 named presets: `<ThemeProvider theme="tufte">`, `"t
|
|
|
113
113
|
|
|
114
114
|
## Key Patterns
|
|
115
115
|
- **Percentile band + main line**: Layer `<AreaChart yAccessor="p95" y0Accessor="p5" showLine={false} />` + `<LineChart yAccessor="p50" />`. AreaChart's `showLine` only draws the top edge, NOT a separate main line.
|
|
116
|
-
- **SSR**: `
|
|
116
|
+
- **SSR**: `renderChart("BarChart", props)` from `semiotic/server` — uses HOC names. Also `"Sparkline"` (no axes, 2px margins). `renderToImage()` (PNG), `renderToAnimatedGif()` (GIF), `renderDashboard()` (multi-chart). All accept `theme`. Required props: StackedBarChart needs `stackBy`, GroupedBarChart needs `groupBy`, StackedAreaChart needs `areaBy`, BubbleChart needs `sizeBy`, FunnelChart uses `stepAccessor`, GaugeChart needs `thresholds`.
|
|
117
117
|
- **exportChart**: Pass the wrapper div, not the SVG element: `exportChart(wrapperDiv, { format: "png" })`. It finds canvas+SVG internally.
|
|
@@ -134,12 +134,17 @@ export declare function MultiLineTooltip(config?: MultiLineTooltipConfig): (data
|
|
|
134
134
|
/**
|
|
135
135
|
* Type for tooltip prop that chart components accept
|
|
136
136
|
*/
|
|
137
|
-
export type TooltipProp = boolean | ((data: Record<string, unknown>) => React.ReactNode) | ReturnType<typeof Tooltip> | ReturnType<typeof MultiLineTooltip> | TooltipConfig;
|
|
137
|
+
export type TooltipProp = boolean | "multi" | ((data: Record<string, unknown>) => React.ReactNode) | ReturnType<typeof Tooltip> | ReturnType<typeof MultiLineTooltip> | TooltipConfig;
|
|
138
138
|
/**
|
|
139
139
|
* The function signature that Stream Frames expect for tooltipContent.
|
|
140
140
|
* Compatible with HoverData and any Record-based hover object.
|
|
141
141
|
*/
|
|
142
142
|
export type TooltipContentFn = (d: Record<string, any>) => React.ReactNode;
|
|
143
|
+
/**
|
|
144
|
+
* Multi-point tooltip: shows all series values at the hovered X position
|
|
145
|
+
* with color swatches (legend-style). Used when tooltipMode="multi".
|
|
146
|
+
*/
|
|
147
|
+
export declare function MultiPointTooltip(): TooltipContentFn;
|
|
143
148
|
/**
|
|
144
149
|
* Convert a tooltip prop to the format Semiotic expects.
|
|
145
150
|
* Returns `false` to disable, or a `TooltipContentFn` compatible with
|
|
@@ -52,6 +52,8 @@ export { PieChart } from "./ordinal/PieChart";
|
|
|
52
52
|
export type { PieChartProps } from "./ordinal/PieChart";
|
|
53
53
|
export { DonutChart } from "./ordinal/DonutChart";
|
|
54
54
|
export type { DonutChartProps } from "./ordinal/DonutChart";
|
|
55
|
+
export { GaugeChart } from "./ordinal/GaugeChart";
|
|
56
|
+
export type { GaugeChartProps, GaugeThreshold } from "./ordinal/GaugeChart";
|
|
55
57
|
export { GroupedBarChart } from "./ordinal/GroupedBarChart";
|
|
56
58
|
export type { GroupedBarChartProps } from "./ordinal/GroupedBarChart";
|
|
57
59
|
export { SwimlaneChart } from "./ordinal/SwimlaneChart";
|
|
@@ -19,6 +19,8 @@ export interface BarChartProps<TDatum extends Record<string, any> = Record<strin
|
|
|
19
19
|
colorScheme?: string | string[];
|
|
20
20
|
sort?: boolean | "asc" | "desc" | ((a: Record<string, any>, b: Record<string, any>) => number);
|
|
21
21
|
barPadding?: number;
|
|
22
|
+
/** When true, adds padding below the 0 baseline. Default false (bars flush with axis). */
|
|
23
|
+
baselinePadding?: boolean;
|
|
22
24
|
enableHover?: boolean;
|
|
23
25
|
showGrid?: boolean;
|
|
24
26
|
showCategoryTicks?: boolean;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StreamOrdinalFrameProps } from "../../stream/ordinalTypes";
|
|
3
|
+
import type { BaseChartProps } from "../shared/types";
|
|
4
|
+
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
6
|
+
export interface GaugeThreshold {
|
|
7
|
+
/** Upper bound of this zone (value, not percentage) */
|
|
8
|
+
value: number;
|
|
9
|
+
/** Color for this threshold zone */
|
|
10
|
+
color: string;
|
|
11
|
+
/** Optional label for the zone */
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GaugeChartProps extends BaseChartProps {
|
|
15
|
+
/** Current gauge value */
|
|
16
|
+
value: number;
|
|
17
|
+
/** Minimum scale value (default 0) */
|
|
18
|
+
min?: number;
|
|
19
|
+
/** Maximum scale value (default 100) */
|
|
20
|
+
max?: number;
|
|
21
|
+
/** Threshold zones — ordered list of { value, color, label? }. Last threshold's value should equal max. */
|
|
22
|
+
thresholds?: GaugeThreshold[];
|
|
23
|
+
/** Color of the value arc when no thresholds defined (default: theme primary) */
|
|
24
|
+
color?: string;
|
|
25
|
+
/** Background arc color (default: var(--semiotic-grid, #e0e0e0)) */
|
|
26
|
+
backgroundColor?: string;
|
|
27
|
+
/** Arc thickness as fraction of radius (0–1, default 0.3) */
|
|
28
|
+
arcWidth?: number;
|
|
29
|
+
/** Show needle indicator (default true) */
|
|
30
|
+
showNeedle?: boolean;
|
|
31
|
+
/** Needle color (default: var(--semiotic-text, #333)) */
|
|
32
|
+
needleColor?: string;
|
|
33
|
+
/** Center content — ReactNode rendered at the gauge center. If not provided, shows the value. */
|
|
34
|
+
centerContent?: React.ReactNode | ((value: number, min: number, max: number) => React.ReactNode);
|
|
35
|
+
/** Format function for the default center value label */
|
|
36
|
+
valueFormat?: (value: number) => string;
|
|
37
|
+
/** Show scale tick labels at min, max, and threshold boundaries (default true) */
|
|
38
|
+
showScaleLabels?: boolean;
|
|
39
|
+
/** Arc sweep angle in degrees (default 240 — leaves a 120° gap at the bottom) */
|
|
40
|
+
sweep?: number;
|
|
41
|
+
/** When false, all threshold zones render at full color and only the needle indicates value. Default true (zones fill up to value). */
|
|
42
|
+
fillZones?: boolean;
|
|
43
|
+
/** Enable tooltip on arc segments */
|
|
44
|
+
tooltip?: TooltipProp;
|
|
45
|
+
/** Annotations — supports threshold markers via standard annotation system */
|
|
46
|
+
annotations?: Record<string, any>[];
|
|
47
|
+
/** Enable hover interaction (default true) */
|
|
48
|
+
enableHover?: boolean;
|
|
49
|
+
/** frameProps escape hatch */
|
|
50
|
+
frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
|
|
51
|
+
}
|
|
52
|
+
export declare const GaugeChart: {
|
|
53
|
+
(props: GaugeChartProps & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
54
|
+
displayName?: string;
|
|
55
|
+
};
|
|
@@ -16,6 +16,7 @@ export interface GroupedBarChartProps<TDatum extends Record<string, any> = Recor
|
|
|
16
16
|
colorBy?: ChartAccessor<TDatum, string>;
|
|
17
17
|
colorScheme?: string | string[];
|
|
18
18
|
barPadding?: number;
|
|
19
|
+
baselinePadding?: boolean;
|
|
19
20
|
enableHover?: boolean;
|
|
20
21
|
showGrid?: boolean;
|
|
21
22
|
showCategoryTicks?: boolean;
|
|
@@ -17,6 +17,7 @@ export interface StackedBarChartProps<TDatum extends Record<string, any> = Recor
|
|
|
17
17
|
colorScheme?: string | string[];
|
|
18
18
|
normalize?: boolean;
|
|
19
19
|
barPadding?: number;
|
|
20
|
+
baselinePadding?: boolean;
|
|
20
21
|
enableHover?: boolean;
|
|
21
22
|
showGrid?: boolean;
|
|
22
23
|
showCategoryTicks?: boolean;
|
|
@@ -56,6 +56,10 @@ export interface SwimlaneChartProps<TDatum extends Record<string, any> = Record<
|
|
|
56
56
|
};
|
|
57
57
|
/** Custom formatter for category tick labels */
|
|
58
58
|
categoryFormat?: CategoryFormatFn;
|
|
59
|
+
/** Custom tick values for the value axis. Forces specific values instead of d3 auto-ticks. */
|
|
60
|
+
rTickValues?: number[];
|
|
61
|
+
/** Align first value tick label to start, last to end. Prevents clipping at chart edges. */
|
|
62
|
+
tickLabelEdgeAlign?: boolean;
|
|
59
63
|
/** Pass-through props to StreamOrdinalFrame */
|
|
60
64
|
frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
|
|
61
65
|
}
|
|
@@ -96,6 +96,8 @@ export interface RealtimeHeatmapProps<TDatum extends Record<string, any> = Recor
|
|
|
96
96
|
legendPosition?: LegendPosition;
|
|
97
97
|
/** Legend interaction mode */
|
|
98
98
|
legendInteraction?: LegendInteractionMode;
|
|
99
|
+
/** ID accessor for remove()/update() on the push API */
|
|
100
|
+
pointIdAccessor?: string | ((d: any) => string);
|
|
99
101
|
}
|
|
100
102
|
/**
|
|
101
103
|
* RealtimeHeatmap - Streaming heatmap with 2D grid binning.
|
|
@@ -130,6 +130,8 @@ export interface RealtimeTemporalHistogramProps<TDatum extends Record<string, an
|
|
|
130
130
|
legendPosition?: LegendPosition;
|
|
131
131
|
/** Legend interaction mode */
|
|
132
132
|
legendInteraction?: LegendInteractionMode;
|
|
133
|
+
/** ID accessor for remove()/update() on the push API */
|
|
134
|
+
pointIdAccessor?: string | ((d: any) => string);
|
|
133
135
|
}
|
|
134
136
|
/**
|
|
135
137
|
* RealtimeTemporalHistogram - Streaming temporal histogram.
|
|
@@ -96,6 +96,8 @@ export interface RealtimeLineChartProps<TDatum extends Record<string, any> = Rec
|
|
|
96
96
|
legendPosition?: LegendPosition;
|
|
97
97
|
/** Legend interaction mode */
|
|
98
98
|
legendInteraction?: LegendInteractionMode;
|
|
99
|
+
/** ID accessor for remove()/update() on the push API */
|
|
100
|
+
pointIdAccessor?: string | ((d: any) => string);
|
|
99
101
|
}
|
|
100
102
|
/**
|
|
101
103
|
* RealtimeLineChart - Simplified wrapper for streaming line charts.
|
|
@@ -96,6 +96,8 @@ export interface RealtimeSwarmChartProps<TDatum extends Record<string, any> = Re
|
|
|
96
96
|
legendPosition?: LegendPosition;
|
|
97
97
|
/** Legend interaction mode */
|
|
98
98
|
legendInteraction?: LegendInteractionMode;
|
|
99
|
+
/** ID accessor for remove()/update() on the push API */
|
|
100
|
+
pointIdAccessor?: string | ((d: any) => string);
|
|
99
101
|
}
|
|
100
102
|
/**
|
|
101
103
|
* RealtimeSwarmChart - Simplified wrapper for streaming dot/swarm charts.
|
|
@@ -96,6 +96,8 @@ export interface RealtimeWaterfallChartProps<TDatum extends Record<string, any>
|
|
|
96
96
|
legendPosition?: LegendPosition;
|
|
97
97
|
/** Legend interaction mode */
|
|
98
98
|
legendInteraction?: LegendInteractionMode;
|
|
99
|
+
/** ID accessor for remove()/update() on the push API */
|
|
100
|
+
pointIdAccessor?: string | ((d: any) => string);
|
|
99
101
|
}
|
|
100
102
|
/**
|
|
101
103
|
* RealtimeWaterfallChart - Simplified wrapper for streaming waterfall charts.
|
|
@@ -43,7 +43,7 @@ export declare function useSortedData(data: Array<Record<string, any>>, sort: bo
|
|
|
43
43
|
* @param unwrapData - Deprecated / no-op. Hover data is always unwrapped
|
|
44
44
|
* (stream frames wrap the raw datum in { data, time, value, x, y }).
|
|
45
45
|
*/
|
|
46
|
-
export declare function useChartSelection({ selection, linkedHover, fallbackFields, unwrapData, onObservation, chartType, chartId, onClick, }: {
|
|
46
|
+
export declare function useChartSelection({ selection, linkedHover, fallbackFields, unwrapData, onObservation, chartType, chartId, onClick, hoverHighlight, colorByField, }: {
|
|
47
47
|
selection?: SelectionConfig;
|
|
48
48
|
linkedHover?: LinkedHoverProp;
|
|
49
49
|
fallbackFields?: string[];
|
|
@@ -55,8 +55,11 @@ export declare function useChartSelection({ selection, linkedHover, fallbackFiel
|
|
|
55
55
|
x: number;
|
|
56
56
|
y: number;
|
|
57
57
|
}) => void;
|
|
58
|
+
hoverHighlight?: boolean;
|
|
59
|
+
colorByField?: string;
|
|
58
60
|
}): {
|
|
59
61
|
activeSelectionHook: SelectionHookResult | null;
|
|
62
|
+
hoverSelectionHook: SelectionHookResult | null;
|
|
60
63
|
customHoverBehavior: (d: Record<string, any> | null) => void;
|
|
61
64
|
customClickBehavior: (d: Record<string, any> | null) => void;
|
|
62
65
|
/** Stable ID for this chart instance, used to suppress linked crosshair on source chart */
|
|
@@ -125,6 +128,7 @@ export declare function useLegendInteraction(mode: LegendInteractionMode | undef
|
|
|
125
128
|
interface ChartModeInput {
|
|
126
129
|
width?: number;
|
|
127
130
|
height?: number;
|
|
131
|
+
showAxes?: boolean;
|
|
128
132
|
showGrid?: boolean;
|
|
129
133
|
enableHover?: boolean;
|
|
130
134
|
showLegend?: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type React from "react";
|
|
1
2
|
import type { MarginType } from "../../types/generalTypes";
|
|
2
3
|
import type { OnObservationCallback } from "../../store/ObservationStore";
|
|
3
4
|
/**
|
|
@@ -92,6 +93,14 @@ export interface BaseChartProps {
|
|
|
92
93
|
x: number;
|
|
93
94
|
y: number;
|
|
94
95
|
}) => void;
|
|
96
|
+
/** Dim non-hovered series when hovering a data mark. Requires `colorBy`. */
|
|
97
|
+
hoverHighlight?: boolean;
|
|
98
|
+
/** Max pixel distance for hover/click hit testing. Default 30. Increase for sparse charts, decrease for dense ones. */
|
|
99
|
+
hoverRadius?: number;
|
|
100
|
+
/** ID accessor for remove()/update() on XY charts. Extracts a unique identifier from each datum. */
|
|
101
|
+
pointIdAccessor?: string | ((d: any) => string);
|
|
102
|
+
/** ID accessor for remove()/update() on ordinal charts. Extracts a unique identifier from each datum. */
|
|
103
|
+
dataIdAccessor?: string | ((d: any) => string);
|
|
95
104
|
/** Visual emphasis level for dashboard hierarchy. "primary" spans two columns in ChartGrid. */
|
|
96
105
|
emphasis?: "primary" | "secondary";
|
|
97
106
|
/** Enable declarative bounded animation (enter/exit/update transitions).
|
|
@@ -109,16 +118,16 @@ export interface AxisConfig {
|
|
|
109
118
|
xLabel?: string;
|
|
110
119
|
/** Label for the y-axis */
|
|
111
120
|
yLabel?: string;
|
|
112
|
-
/** Format function for x-axis tick labels */
|
|
113
|
-
xFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
114
|
-
/** Format function for y-axis tick labels */
|
|
115
|
-
yFormat?: (d: any) => string;
|
|
121
|
+
/** Format function for x-axis tick labels. Return string or ReactNode for custom rendering. */
|
|
122
|
+
xFormat?: (d: any, index?: number, allTicks?: number[]) => string | React.ReactNode;
|
|
123
|
+
/** Format function for y-axis tick labels. Return string or ReactNode for custom rendering. */
|
|
124
|
+
yFormat?: (d: any) => string | React.ReactNode;
|
|
116
125
|
}
|
|
117
126
|
/**
|
|
118
127
|
* Category formatting for ordinal chart tick labels.
|
|
119
128
|
* Receives the category value and its index, returns a formatted string.
|
|
120
129
|
*/
|
|
121
|
-
export type CategoryFormatFn = (label: string, index?: number) => string;
|
|
130
|
+
export type CategoryFormatFn = (label: string, index?: number) => string | React.ReactNode;
|
|
122
131
|
/**
|
|
123
132
|
* Accessor type - can be a property name or a function
|
|
124
133
|
* @deprecated Use DataAccessor from generalTypes for generic type safety
|
|
@@ -74,19 +74,34 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
74
74
|
*/
|
|
75
75
|
y0Accessor?: ChartAccessor<TDatum, number>;
|
|
76
76
|
/**
|
|
77
|
-
* Gradient fill from line to baseline. Set `true` for default (80% → 5%)
|
|
78
|
-
*
|
|
77
|
+
* Gradient fill from line to baseline. Set `true` for default opacity (80% → 5%),
|
|
78
|
+
* `{ topOpacity, bottomOpacity }` for custom opacity, or
|
|
79
|
+
* `{ colorStops: [{offset, color}] }` for multi-color gradients.
|
|
79
80
|
* @default false
|
|
80
81
|
*/
|
|
81
82
|
gradientFill?: boolean | {
|
|
82
83
|
topOpacity: number;
|
|
83
84
|
bottomOpacity: number;
|
|
85
|
+
} | {
|
|
86
|
+
colorStops: Array<{
|
|
87
|
+
offset: number;
|
|
88
|
+
color: string;
|
|
89
|
+
}>;
|
|
84
90
|
};
|
|
85
91
|
/**
|
|
86
92
|
* Area opacity (flat fill, ignored when gradientFill is set)
|
|
87
93
|
* @default 0.7
|
|
88
94
|
*/
|
|
89
95
|
areaOpacity?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Horizontal gradient for the line stroke. Color stops define a left-to-right gradient.
|
|
98
|
+
*/
|
|
99
|
+
lineGradient?: {
|
|
100
|
+
colorStops: Array<{
|
|
101
|
+
offset: number;
|
|
102
|
+
color: string;
|
|
103
|
+
}>;
|
|
104
|
+
};
|
|
90
105
|
/**
|
|
91
106
|
* Show line on top of area
|
|
92
107
|
* @default true
|
|
@@ -38,7 +38,7 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
38
38
|
* Scale type for the x-axis
|
|
39
39
|
* @default "linear"
|
|
40
40
|
*/
|
|
41
|
-
xScaleType?: "linear" | "log";
|
|
41
|
+
xScaleType?: "linear" | "log" | "time";
|
|
42
42
|
/**
|
|
43
43
|
* Scale type for the y-axis
|
|
44
44
|
* @default "linear"
|
|
@@ -89,15 +89,26 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
89
89
|
*/
|
|
90
90
|
pointRadius?: number;
|
|
91
91
|
/**
|
|
92
|
-
* Fill area under the line
|
|
92
|
+
* Fill area under the line. `true` fills all series, `string[]` lists series
|
|
93
|
+
* names (matching lineBy/colorBy group key) that get area fill while others stay as lines.
|
|
93
94
|
* @default false
|
|
94
95
|
*/
|
|
95
|
-
fillArea?: boolean;
|
|
96
|
+
fillArea?: boolean | string[];
|
|
96
97
|
/**
|
|
97
98
|
* Area opacity when fillArea is true
|
|
98
99
|
* @default 0.3
|
|
99
100
|
*/
|
|
100
101
|
areaOpacity?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Horizontal gradient for the line stroke. Color stops define a left-to-right gradient.
|
|
104
|
+
* `{ colorStops: [{ offset: 0, color: "blue" }, { offset: 1, color: "red" }] }`
|
|
105
|
+
*/
|
|
106
|
+
lineGradient?: {
|
|
107
|
+
colorStops: Array<{
|
|
108
|
+
offset: number;
|
|
109
|
+
color: string;
|
|
110
|
+
}>;
|
|
111
|
+
};
|
|
101
112
|
/**
|
|
102
113
|
* Line stroke width
|
|
103
114
|
* @default 2
|
|
@@ -13,6 +13,17 @@ export declare class RingBuffer<T> {
|
|
|
13
13
|
forEach(callback: (value: T, index: number) => void): void;
|
|
14
14
|
toArray(): T[];
|
|
15
15
|
resize(newCapacity: number): T[];
|
|
16
|
+
/**
|
|
17
|
+
* Update items in place. The updater receives each matching item and returns
|
|
18
|
+
* the replacement. Returns the previous values of updated items.
|
|
19
|
+
* O(n) scan, no compaction needed — buffer positions stay stable.
|
|
20
|
+
*/
|
|
21
|
+
update(predicate: (item: T) => boolean, updater: (item: T) => T): T[];
|
|
22
|
+
/**
|
|
23
|
+
* Remove items matching a predicate. Returns removed items.
|
|
24
|
+
* O(n) scan + compaction. Size decreases; capacity stays the same.
|
|
25
|
+
*/
|
|
26
|
+
remove(predicate: (item: T) => boolean): T[];
|
|
16
27
|
clear(): void;
|
|
17
28
|
get size(): number;
|
|
18
29
|
get capacity(): number;
|
|
@@ -131,6 +131,10 @@ export interface RealtimeFrameProps {
|
|
|
131
131
|
export interface RealtimeFrameHandle {
|
|
132
132
|
push(point: Record<string, any>): void;
|
|
133
133
|
pushMany(points: Record<string, any>[]): void;
|
|
134
|
+
/** Remove data by ID. Requires an ID accessor (pointIdAccessor or dataIdAccessor). */
|
|
135
|
+
remove(id: string | string[]): Record<string, any>[];
|
|
136
|
+
/** Update data by ID in place. Requires an ID accessor. Returns previous values. */
|
|
137
|
+
update(id: string | string[], updater: (d: Record<string, any>) => Record<string, any>): Record<string, any>[];
|
|
134
138
|
clear(): void;
|
|
135
139
|
getData(): Record<string, any>[];
|
|
136
140
|
}
|
|
@@ -15,6 +15,8 @@ export { ViolinPlot } from "./charts/ordinal/ViolinPlot";
|
|
|
15
15
|
export { DotPlot } from "./charts/ordinal/DotPlot";
|
|
16
16
|
export { PieChart } from "./charts/ordinal/PieChart";
|
|
17
17
|
export { DonutChart } from "./charts/ordinal/DonutChart";
|
|
18
|
+
export { GaugeChart } from "./charts/ordinal/GaugeChart";
|
|
19
|
+
export type { GaugeChartProps, GaugeThreshold } from "./charts/ordinal/GaugeChart";
|
|
18
20
|
export { RidgelinePlot } from "./charts/ordinal/RidgelinePlot";
|
|
19
21
|
export { FunnelChart } from "./charts/ordinal/FunnelChart";
|
|
20
22
|
export { LikertChart } from "./charts/ordinal/LikertChart";
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export { renderToStaticSVG, renderXYToStaticSVG, renderOrdinalToStaticSVG, renderNetworkToStaticSVG, renderGeoToStaticSVG } from "./server/renderToStaticSVG";
|
|
1
|
+
export { renderToStaticSVG, renderXYToStaticSVG, renderOrdinalToStaticSVG, renderNetworkToStaticSVG, renderGeoToStaticSVG, renderChart, renderToImage, renderDashboard, } from "./server/renderToStaticSVG";
|
|
2
|
+
export type { RenderToImageOptions, DashboardChart, DashboardLayout, RenderDashboardOptions, } from "./server/renderToStaticSVG";
|
|
3
|
+
export { renderToAnimatedGif, generateFrameSVGs, generateFrameSequence } from "./server/animatedGif";
|
|
4
|
+
export type { AnimatedGifOptions } from "./server/animatedGif";
|
|
5
|
+
export { resolveTheme, themeStyles } from "./server/themeResolver";
|
|
6
|
+
export type { ThemeInput } from "./server/themeResolver";
|
|
@@ -17,6 +17,7 @@ export { createHatchPattern } from "./charts/shared/hatchPattern";
|
|
|
17
17
|
export type { HatchPatternOptions } from "./charts/shared/hatchPattern";
|
|
18
18
|
export { validateProps } from "./charts/shared/validateProps";
|
|
19
19
|
export { diagnoseConfig } from "./charts/shared/diagnoseConfig";
|
|
20
|
+
export { getHitRadius } from "./stream/hitTestUtils";
|
|
20
21
|
export { toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX } from "./export/chartConfig";
|
|
21
22
|
export type { ChartConfig, ToConfigOptions, CopyFormat } from "./export/chartConfig";
|
|
22
23
|
export { serializeSelections, deserializeSelections } from "./export/selectionSerializer";
|
|
@@ -26,5 +27,5 @@ export { fromVegaLite } from "./data/fromVegaLite";
|
|
|
26
27
|
export type { VegaLiteSpec, VegaLiteEncoding } from "./data/fromVegaLite";
|
|
27
28
|
export { RingBuffer } from "./realtime/RingBuffer";
|
|
28
29
|
export { IncrementalExtent } from "./realtime/IncrementalExtent";
|
|
29
|
-
export { normalizeTooltip } from "./Tooltip/Tooltip";
|
|
30
|
+
export { normalizeTooltip, MultiPointTooltip } from "./Tooltip/Tooltip";
|
|
30
31
|
export { useReducedMotion, useHighContrast } from "./stream/useMediaPreferences";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import StreamXYFrame from "./stream/StreamXYFrame";
|
|
2
2
|
import StreamOrdinalFrame from "./stream/StreamOrdinalFrame";
|
|
3
3
|
import StreamNetworkFrame from "./stream/StreamNetworkFrame";
|
|
4
|
-
import { Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, LikertChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, PieChart, DonutChart, GroupedBarChart, FunnelChart, SwimlaneChart, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, MultiAxisLineChart } from "./charts";
|
|
4
|
+
import { Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, LikertChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, PieChart, DonutChart, GaugeChart, GroupedBarChart, FunnelChart, SwimlaneChart, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, MultiAxisLineChart } from "./charts";
|
|
5
5
|
import { LinkedCharts } from "./LinkedCharts";
|
|
6
6
|
import { ThemeProvider, useTheme } from "./ThemeProvider";
|
|
7
7
|
import { exportChart } from "./export/exportChart";
|
|
@@ -23,8 +23,8 @@ import { RealtimeTemporalHistogram, RealtimeHistogram } from "./charts/realtime/
|
|
|
23
23
|
import { RealtimeSwarmChart } from "./charts/realtime/RealtimeSwarmChart";
|
|
24
24
|
import { RealtimeWaterfallChart } from "./charts/realtime/RealtimeWaterfallChart";
|
|
25
25
|
import { RealtimeHeatmap } from "./charts/realtime/RealtimeHeatmap";
|
|
26
|
-
export { StreamXYFrame, StreamOrdinalFrame, StreamNetworkFrame, Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, LikertChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, PieChart, DonutChart, FunnelChart, GroupedBarChart, SwimlaneChart, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, MultiAxisLineChart, LinkedCharts, ThemeProvider, useTheme, exportChart, toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX, serializeSelections, deserializeSelections, fromVegaLite, ChartErrorBoundary, ChartContainer, ChartGrid, CategoryColorProvider, useCategoryColors, ContextLayout, DetailsPanel, Tooltip, MultiLineTooltip, normalizeTooltip, RingBuffer, IncrementalExtent, RealtimeLineChart, RealtimeTemporalHistogram, RealtimeHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap, createHatchPattern };
|
|
27
|
-
export { ScatterplotProps, ConnectedScatterplotProps, LineChartProps, AreaChartProps, StackedAreaChartProps, HeatmapProps, BubbleChartProps, BarChartProps, StackedBarChartProps, LikertChartProps, SwarmPlotProps, BoxPlotProps, HistogramProps, ViolinPlotProps, DotPlotProps, PieChartProps, DonutChartProps, FunnelChartProps, GroupedBarChartProps, SwimlaneChartProps, RidgelinePlotProps, OrbitDiagramProps, OrbitNode, ForceDirectedGraphProps, ChordDiagramProps, SankeyDiagramProps, TreeDiagramProps, TreemapProps, CirclePackProps, ScatterplotMatrixProps, MinimapChartProps, MinimapConfig, QuadrantChartProps, MultiAxisLineChartProps, MultiAxisSeriesConfig, QuadrantsConfig, QuadrantConfig, CenterlineStyle, BaseChartProps, AxisConfig, Accessor, ChartAccessor, ChartMode } from "./charts";
|
|
26
|
+
export { StreamXYFrame, StreamOrdinalFrame, StreamNetworkFrame, Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, LikertChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, PieChart, DonutChart, GaugeChart, FunnelChart, GroupedBarChart, SwimlaneChart, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, MultiAxisLineChart, LinkedCharts, ThemeProvider, useTheme, exportChart, toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX, serializeSelections, deserializeSelections, fromVegaLite, ChartErrorBoundary, ChartContainer, ChartGrid, CategoryColorProvider, useCategoryColors, ContextLayout, DetailsPanel, Tooltip, MultiLineTooltip, normalizeTooltip, RingBuffer, IncrementalExtent, RealtimeLineChart, RealtimeTemporalHistogram, RealtimeHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap, createHatchPattern };
|
|
27
|
+
export { ScatterplotProps, ConnectedScatterplotProps, LineChartProps, AreaChartProps, StackedAreaChartProps, HeatmapProps, BubbleChartProps, BarChartProps, StackedBarChartProps, LikertChartProps, SwarmPlotProps, BoxPlotProps, HistogramProps, ViolinPlotProps, DotPlotProps, PieChartProps, DonutChartProps, GaugeChartProps, GaugeThreshold, FunnelChartProps, GroupedBarChartProps, SwimlaneChartProps, RidgelinePlotProps, OrbitDiagramProps, OrbitNode, ForceDirectedGraphProps, ChordDiagramProps, SankeyDiagramProps, TreeDiagramProps, TreemapProps, CirclePackProps, ScatterplotMatrixProps, MinimapChartProps, MinimapConfig, QuadrantChartProps, MultiAxisLineChartProps, MultiAxisSeriesConfig, QuadrantsConfig, QuadrantConfig, CenterlineStyle, BaseChartProps, AxisConfig, Accessor, ChartAccessor, ChartMode } from "./charts";
|
|
28
28
|
export type { StreamXYFrameProps, StreamXYFrameHandle, StreamChartType, RuntimeMode, SceneNode, Changeset, StreamScales, StreamLayout, CurveType, CanvasRendererFn } from "./stream/types";
|
|
29
29
|
export type { StreamRendererFn } from "./stream/renderers/types";
|
|
30
30
|
export type { StreamOrdinalFrameProps, StreamOrdinalFrameHandle, OrdinalChartType, OrdinalScales, OrdinalSceneNode } from "./stream/ordinalTypes";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animated GIF generation from semiotic chart data.
|
|
3
|
+
*
|
|
4
|
+
* Renders a sequence of chart frames by progressively feeding data into
|
|
5
|
+
* PipelineStore, optionally applying transition easing and decay effects,
|
|
6
|
+
* then encoding all frames as an animated GIF.
|
|
7
|
+
*
|
|
8
|
+
* Phases:
|
|
9
|
+
* 1. Sliding window — slice data into progressive windows, render each
|
|
10
|
+
* 2. Transition easing — interpolate enter/update between data windows
|
|
11
|
+
* 3. Decay/pulse — apply age-based opacity fading per frame
|
|
12
|
+
*
|
|
13
|
+
* Requires: sharp (SVG→PNG rasterization), gifenc (GIF encoding)
|
|
14
|
+
* Both are optional dependencies of semiotic.
|
|
15
|
+
*/
|
|
16
|
+
import type { SemioticTheme } from "../store/ThemeStore";
|
|
17
|
+
export interface AnimatedGifOptions {
|
|
18
|
+
/** Frames per second (default 12) */
|
|
19
|
+
fps?: number;
|
|
20
|
+
/** Number of data points to advance per frame (default: auto-calculated) */
|
|
21
|
+
stepSize?: number;
|
|
22
|
+
/** Data points visible per frame (default: all data up to current step) */
|
|
23
|
+
windowSize?: number;
|
|
24
|
+
/** Total number of frames (default: auto from data length / stepSize) */
|
|
25
|
+
frameCount?: number;
|
|
26
|
+
/** Lock X axis domain to prevent shifting (default: auto from full data) */
|
|
27
|
+
xExtent?: [number, number];
|
|
28
|
+
/** Lock Y axis domain (default: auto from full data) */
|
|
29
|
+
yExtent?: [number, number];
|
|
30
|
+
/** Transition frames between data steps (0 = no easing, default 4). XY charts only — ordinal charts use instant transitions. */
|
|
31
|
+
transitionFrames?: number;
|
|
32
|
+
/** Easing for transitions (default "ease-out") */
|
|
33
|
+
easing?: "linear" | "ease-out";
|
|
34
|
+
/** Apply decay (age-based fade) to older data points */
|
|
35
|
+
decay?: {
|
|
36
|
+
type: "linear" | "exponential" | "step";
|
|
37
|
+
minOpacity?: number;
|
|
38
|
+
halfLife?: number;
|
|
39
|
+
};
|
|
40
|
+
/** Loop the GIF (default true) */
|
|
41
|
+
loop?: boolean;
|
|
42
|
+
/** Scale factor for resolution (default 1) */
|
|
43
|
+
scale?: number;
|
|
44
|
+
/** Background color */
|
|
45
|
+
background?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface AnimatedGifFrameConfig {
|
|
48
|
+
/** Chart width */
|
|
49
|
+
width: number;
|
|
50
|
+
/** Chart height */
|
|
51
|
+
height: number;
|
|
52
|
+
/** Theme for styling */
|
|
53
|
+
theme: SemioticTheme;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Generate SVG strings for each animation frame.
|
|
57
|
+
* This is the core logic shared between GIF export and client-side preview.
|
|
58
|
+
*/
|
|
59
|
+
export declare function generateFrameSVGs(chartType: string, data: Record<string, any>[], props: Record<string, any>, options?: AnimatedGifOptions): string[];
|
|
60
|
+
/**
|
|
61
|
+
* Generate SVG strings from an array of data snapshots.
|
|
62
|
+
*
|
|
63
|
+
* Unlike `generateFrameSVGs` which slices a single array progressively,
|
|
64
|
+
* this accepts pre-built snapshots — each entry is the complete props
|
|
65
|
+
* for one frame. Use for scenarios where data changes non-monotonically
|
|
66
|
+
* (edge deletion, network splits, failover paths).
|
|
67
|
+
*
|
|
68
|
+
* Each snapshot is passed directly to `renderChart()`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function generateFrameSequence(component: string, snapshots: Record<string, any>[], baseProps?: Record<string, any>): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Render a chart as an animated GIF.
|
|
73
|
+
*
|
|
74
|
+
* Requires `sharp` (SVG→PNG) and `gifenc` (GIF encoding) as optional dependencies.
|
|
75
|
+
*
|
|
76
|
+
* @returns Buffer containing the animated GIF
|
|
77
|
+
*/
|
|
78
|
+
export declare function renderToAnimatedGif(chartType: string, data: Record<string, any>[], props: Record<string, any>, options?: AnimatedGifOptions): Promise<Buffer>;
|
|
@@ -4,15 +4,95 @@
|
|
|
4
4
|
* Uses the shared SceneToSVG converters (same code used by Stream Frames
|
|
5
5
|
* for SSR) plus PipelineStore / OrdinalPipelineStore / NetworkPipelineStore
|
|
6
6
|
* for scene graph computation.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Theme inlining (resolve presets to concrete SVG styles)
|
|
10
|
+
* - Legend rendering (categorical color swatches)
|
|
11
|
+
* - Accessibility (title, desc, role="img")
|
|
12
|
+
* - Grid lines
|
|
13
|
+
* - Annotations (y-threshold, x-threshold, band, label, text, category-highlight)
|
|
14
|
+
* - renderChart HOC-level API
|
|
7
15
|
*/
|
|
16
|
+
import * as React from "react";
|
|
8
17
|
import type { StreamXYFrameProps } from "../stream/types";
|
|
9
18
|
import type { StreamNetworkFrameProps } from "../stream/networkTypes";
|
|
10
19
|
import type { StreamOrdinalFrameProps } from "../stream/ordinalTypes";
|
|
11
20
|
import type { StreamGeoFrameProps } from "../stream/geoTypes";
|
|
21
|
+
import { type ThemeInput } from "./themeResolver";
|
|
12
22
|
type FrameType = "xy" | "ordinal" | "network" | "geo";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
interface ThemeAwareProps {
|
|
24
|
+
theme?: ThemeInput;
|
|
25
|
+
showLegend?: boolean;
|
|
26
|
+
showGrid?: boolean;
|
|
27
|
+
annotations?: Record<string, any>[];
|
|
28
|
+
title?: string | React.ReactNode;
|
|
29
|
+
description?: string;
|
|
30
|
+
background?: string;
|
|
31
|
+
className?: string;
|
|
32
|
+
/** Prefix for SVG element IDs — used by renderDashboard to avoid collisions */
|
|
33
|
+
_idPrefix?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function renderToStaticSVG(frameType: FrameType, props: (StreamXYFrameProps | StreamNetworkFrameProps | StreamOrdinalFrameProps | StreamGeoFrameProps) & ThemeAwareProps): string;
|
|
36
|
+
export declare function renderXYToStaticSVG(props: StreamXYFrameProps & ThemeAwareProps): string;
|
|
37
|
+
export declare function renderOrdinalToStaticSVG(props: StreamOrdinalFrameProps & ThemeAwareProps): string;
|
|
38
|
+
export declare function renderNetworkToStaticSVG(props: StreamNetworkFrameProps & ThemeAwareProps): string;
|
|
39
|
+
export declare function renderGeoToStaticSVG(props: StreamGeoFrameProps & ThemeAwareProps): string;
|
|
40
|
+
/** Chart component name to frame type + props mapping */
|
|
41
|
+
type ChartName = "LineChart" | "AreaChart" | "StackedAreaChart" | "Scatterplot" | "BubbleChart" | "ConnectedScatterplot" | "Heatmap" | "Sparkline" | "BarChart" | "StackedBarChart" | "GroupedBarChart" | "PieChart" | "DonutChart" | "SwimlaneChart" | "Histogram" | "BoxPlot" | "ViolinPlot" | "SwarmPlot" | "DotPlot" | "RidgelinePlot" | "FunnelChart" | "GaugeChart" | "ForceDirectedGraph" | "SankeyDiagram" | "ChordDiagram" | "TreeDiagram" | "Treemap" | "CirclePack" | "ChoroplethMap" | "ProportionalSymbolMap";
|
|
42
|
+
interface RenderChartOptions {
|
|
43
|
+
/** Output format — currently only "svg" is synchronous */
|
|
44
|
+
format?: "svg";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Render a chart using HOC-level props (categoryAccessor, valueAccessor, etc.)
|
|
48
|
+
* instead of frame-level props (oAccessor, rAccessor, etc.).
|
|
49
|
+
*
|
|
50
|
+
* This is the primary API for AI/MCP workflows.
|
|
51
|
+
*/
|
|
52
|
+
export declare function renderChart(component: ChartName, props: Record<string, any>, _options?: RenderChartOptions): string;
|
|
53
|
+
export interface RenderToImageOptions {
|
|
54
|
+
/** Output format */
|
|
55
|
+
format?: "png" | "jpeg";
|
|
56
|
+
/** Scale factor (e.g., 2 for retina) */
|
|
57
|
+
scale?: number;
|
|
58
|
+
/** Background color (overrides theme) */
|
|
59
|
+
background?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Render a chart to a PNG or JPEG Buffer.
|
|
63
|
+
*
|
|
64
|
+
* Requires `sharp` as an optional peer dependency.
|
|
65
|
+
* Falls back to a descriptive error if sharp is not installed.
|
|
66
|
+
*/
|
|
67
|
+
export declare function renderToImage(frameTypeOrComponent: FrameType | ChartName, props: Record<string, any>, options?: RenderToImageOptions): Promise<Buffer>;
|
|
68
|
+
export interface DashboardChart {
|
|
69
|
+
/** Frame type or HOC component name */
|
|
70
|
+
component?: ChartName;
|
|
71
|
+
frameType?: FrameType;
|
|
72
|
+
/** Chart props (data, accessors, etc.) */
|
|
73
|
+
props: Record<string, any>;
|
|
74
|
+
/** Span multiple columns (for emphasis="primary") */
|
|
75
|
+
colSpan?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface DashboardLayout {
|
|
78
|
+
/** Number of columns */
|
|
79
|
+
columns?: number;
|
|
80
|
+
/** Gap between charts in pixels */
|
|
81
|
+
gap?: number;
|
|
82
|
+
}
|
|
83
|
+
export interface RenderDashboardOptions {
|
|
84
|
+
title?: string;
|
|
85
|
+
subtitle?: string;
|
|
86
|
+
theme?: ThemeInput;
|
|
87
|
+
width?: number;
|
|
88
|
+
height?: number;
|
|
89
|
+
layout?: DashboardLayout;
|
|
90
|
+
background?: string;
|
|
91
|
+
/** Output format */
|
|
92
|
+
format?: "svg";
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Compose multiple charts into a single SVG.
|
|
96
|
+
*/
|
|
97
|
+
export declare function renderDashboard(charts: DashboardChart[], options?: RenderDashboardOptions): string;
|
|
18
98
|
export {};
|