semiotic 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +227 -27
- package/README.md +43 -11
- package/ai/examples.md +358 -18
- package/ai/schema.json +64 -2
- package/ai/system-prompt.md +50 -12
- package/dist/components/Legend.d.ts +7 -1
- package/dist/components/charts/geo/ChoroplethMap.d.ts +53 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +90 -0
- package/dist/components/charts/geo/FlowMap.d.ts +83 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +67 -0
- package/dist/components/charts/geo/index.d.ts +8 -0
- package/dist/components/charts/index.d.ts +2 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +6 -5
- package/dist/components/charts/network/CirclePack.d.ts +2 -2
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +9 -7
- package/dist/components/charts/network/OrbitDiagram.d.ts +21 -20
- package/dist/components/charts/network/SankeyDiagram.d.ts +6 -5
- package/dist/components/charts/network/TreeDiagram.d.ts +2 -2
- package/dist/components/charts/network/Treemap.d.ts +2 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +7 -5
- package/dist/components/charts/ordinal/BoxPlot.d.ts +8 -6
- package/dist/components/charts/ordinal/DonutChart.d.ts +8 -6
- package/dist/components/charts/ordinal/DotPlot.d.ts +8 -6
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +7 -5
- package/dist/components/charts/ordinal/Histogram.d.ts +8 -5
- package/dist/components/charts/ordinal/PieChart.d.ts +8 -6
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +7 -5
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -6
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +8 -5
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +24 -6
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +28 -7
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +23 -5
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +24 -6
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +23 -5
- package/dist/components/charts/shared/colorUtils.d.ts +5 -0
- package/dist/components/charts/shared/hooks.d.ts +13 -1
- package/dist/components/charts/shared/legendUtils.d.ts +2 -3
- package/dist/components/charts/shared/statisticalOverlays.d.ts +1 -2
- package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +10 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +1 -1
- package/dist/components/charts/shared/types.d.ts +10 -4
- package/dist/components/charts/shared/useChartSetup.d.ts +112 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +65 -0
- package/dist/components/charts/xy/AreaChart.d.ts +11 -6
- package/dist/components/charts/xy/BubbleChart.d.ts +11 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -6
- package/dist/components/charts/xy/Heatmap.d.ts +16 -5
- package/dist/components/charts/xy/LineChart.d.ts +21 -5
- package/dist/components/charts/xy/MinimapChart.d.ts +3 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +120 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +9 -6
- package/dist/components/charts/xy/StackedAreaChart.d.ts +11 -6
- package/dist/components/geo/mergeData.d.ts +18 -0
- package/dist/components/geo/referenceGeography.d.ts +10 -0
- package/dist/components/geo/useReferenceAreas.d.ts +13 -0
- package/dist/components/realtime/RingBuffer.d.ts +1 -0
- package/dist/components/realtime/types.d.ts +17 -0
- package/dist/components/semiotic-data.d.ts +1 -0
- package/dist/components/semiotic-geo.d.ts +16 -0
- package/dist/components/semiotic-server.d.ts +1 -1
- package/dist/components/semiotic-xy.d.ts +1 -0
- package/dist/components/semiotic.d.ts +4 -4
- package/dist/components/server/renderToStaticSVG.d.ts +4 -2
- package/dist/components/stream/AccessibleDataTable.d.ts +50 -0
- package/dist/components/stream/CanvasHitTester.d.ts +8 -2
- package/dist/components/stream/DataSourceAdapter.d.ts +33 -4
- package/dist/components/stream/GeoCanvasHitTester.d.ts +19 -0
- package/dist/components/stream/GeoParticlePool.d.ts +46 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +81 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +31 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +16 -4
- package/dist/components/stream/NetworkSVGOverlay.d.ts +4 -1
- package/dist/components/stream/OrdinalPipelineStore.d.ts +8 -4
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +23 -1
- package/dist/components/stream/PipelineStore.d.ts +57 -5
- package/dist/components/stream/SVGOverlay.d.ts +28 -1
- package/dist/components/stream/SceneGraph.d.ts +7 -3
- package/dist/components/stream/SceneToSVG.d.ts +2 -0
- package/dist/components/stream/StreamGeoFrame.d.ts +4 -0
- package/dist/components/stream/accessorUtils.d.ts +1 -0
- package/dist/components/stream/canvasSetup.d.ts +26 -0
- package/dist/components/stream/geoTypes.d.ts +186 -0
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +0 -7
- package/dist/components/stream/layouts/index.d.ts +2 -1
- package/dist/components/stream/layouts/orbitLayoutPlugin.d.ts +2 -0
- package/dist/components/stream/legendRenderer.d.ts +33 -0
- package/dist/components/stream/networkTypes.d.ts +49 -1
- package/dist/components/stream/ordinalTypes.d.ts +10 -0
- package/dist/components/stream/pipelineTransitionUtils.d.ts +42 -0
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +9 -0
- package/dist/components/stream/renderers/heatmapCanvasRenderer.d.ts +2 -1
- package/dist/components/stream/renderers/lineCanvasRenderer.d.ts +1 -0
- package/dist/components/stream/renderers/renderPulse.d.ts +50 -0
- package/dist/components/stream/types.d.ts +77 -3
- package/dist/components/types/legendTypes.d.ts +27 -3
- package/dist/geo.min.js +1 -0
- package/dist/geo.module.min.js +1 -0
- 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-data.d.ts +1 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +16 -0
- package/dist/semiotic-server.d.ts +1 -1
- package/dist/semiotic-xy.d.ts +1 -0
- package/dist/semiotic.d.ts +4 -4
- 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/test-utils/canvasMock.d.ts +3 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +29 -7
- package/dist/test/canvasMock.d.ts +0 -2
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useChartLegendAndMargin, useLegendInteraction, DEFAULT_COLOR } from "./hooks";
|
|
2
|
+
import type { LegendInteractionMode, LegendPosition } from "./hooks";
|
|
3
|
+
import type { Accessor, SelectionConfig, LinkedHoverProp } from "./types";
|
|
4
|
+
import type { OnObservationCallback } from "../../store/ObservationStore";
|
|
5
|
+
import type { MarginType } from "../../types/generalTypes";
|
|
6
|
+
import type { SelectionHookResult } from "./selectionUtils";
|
|
7
|
+
import type { ReactElement, ReactNode } from "react";
|
|
8
|
+
/**
|
|
9
|
+
* Input parameters for useChartSetup.
|
|
10
|
+
*
|
|
11
|
+
* This hook consolidates the color scale, category extraction, legend interaction,
|
|
12
|
+
* effective selection merge, legend + margin computation, loading/empty guards,
|
|
13
|
+
* and legend behavior props that every HOC chart repeats.
|
|
14
|
+
*/
|
|
15
|
+
export interface ChartSetupInput {
|
|
16
|
+
/** The data array used for color scale and category extraction */
|
|
17
|
+
data: Array<Record<string, any>>;
|
|
18
|
+
/** The original data prop (may be undefined) — used for empty-state check */
|
|
19
|
+
rawData: unknown[] | undefined;
|
|
20
|
+
/** The color-by accessor (may be an "actual" colorBy derived from stackBy/groupBy/categoryAccessor) */
|
|
21
|
+
colorBy: Accessor<string> | undefined;
|
|
22
|
+
/** Color scheme name or custom array */
|
|
23
|
+
colorScheme: string | string[];
|
|
24
|
+
/** Legend interaction mode */
|
|
25
|
+
legendInteraction: LegendInteractionMode | undefined;
|
|
26
|
+
/** Legend position override */
|
|
27
|
+
legendPosition?: LegendPosition;
|
|
28
|
+
/** Selection config from the HOC */
|
|
29
|
+
selection: SelectionConfig | undefined;
|
|
30
|
+
/** Linked hover config from the HOC */
|
|
31
|
+
linkedHover: LinkedHoverProp | undefined;
|
|
32
|
+
/** Fallback fields for selection/hover — typically derived from colorBy or categoryAccessor */
|
|
33
|
+
fallbackFields: string[];
|
|
34
|
+
/** Whether to unwrap data in hover callback (ordinal/network = true, XY = false) */
|
|
35
|
+
unwrapData?: boolean;
|
|
36
|
+
/** onObservation callback */
|
|
37
|
+
onObservation: OnObservationCallback | undefined;
|
|
38
|
+
/** Chart type name (e.g. "BarChart") */
|
|
39
|
+
chartType: string;
|
|
40
|
+
/** Chart ID for observation events */
|
|
41
|
+
chartId: string | undefined;
|
|
42
|
+
/** Show legend override */
|
|
43
|
+
showLegend: boolean | undefined;
|
|
44
|
+
/** User-provided margin */
|
|
45
|
+
userMargin: MarginType | undefined;
|
|
46
|
+
/** Mode-resolved margin defaults */
|
|
47
|
+
marginDefaults: {
|
|
48
|
+
top: number;
|
|
49
|
+
bottom: number;
|
|
50
|
+
left: number;
|
|
51
|
+
right: number;
|
|
52
|
+
};
|
|
53
|
+
/** Loading state */
|
|
54
|
+
loading: boolean | undefined;
|
|
55
|
+
/** Empty content override */
|
|
56
|
+
emptyContent?: ReactNode;
|
|
57
|
+
/** Resolved width from useChartMode */
|
|
58
|
+
width: number;
|
|
59
|
+
/** Resolved height from useChartMode */
|
|
60
|
+
height: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Output from useChartSetup.
|
|
64
|
+
*/
|
|
65
|
+
export interface ChartSetupResult {
|
|
66
|
+
/** Color scale function, or undefined if no colorBy */
|
|
67
|
+
colorScale: ((v: string) => string) | undefined;
|
|
68
|
+
/** All unique category values from colorBy */
|
|
69
|
+
allCategories: string[];
|
|
70
|
+
/** Legend interaction state (onLegendHover, onLegendClick, highlighted, isolated) */
|
|
71
|
+
legendState: ReturnType<typeof useLegendInteraction>;
|
|
72
|
+
/** The effective selection hook — legend selection takes priority over cross-chart selection */
|
|
73
|
+
effectiveSelectionHook: SelectionHookResult | null;
|
|
74
|
+
/** The active cross-chart selection hook (before legend merge) */
|
|
75
|
+
activeSelectionHook: SelectionHookResult | null;
|
|
76
|
+
/** Custom hover behavior callback for the frame */
|
|
77
|
+
customHoverBehavior: (d: Record<string, any> | null) => void;
|
|
78
|
+
/** Custom click behavior callback for the frame */
|
|
79
|
+
customClickBehavior: (d: Record<string, any> | null) => void;
|
|
80
|
+
/** Legend config (or undefined if no legend) */
|
|
81
|
+
legend: ReturnType<typeof useChartLegendAndMargin>["legend"];
|
|
82
|
+
/** Computed margin with legend-aware adjustments */
|
|
83
|
+
margin: {
|
|
84
|
+
top: number;
|
|
85
|
+
bottom: number;
|
|
86
|
+
left: number;
|
|
87
|
+
right: number;
|
|
88
|
+
};
|
|
89
|
+
/** Resolved legend position */
|
|
90
|
+
legendPosition: LegendPosition;
|
|
91
|
+
/** If non-null, the HOC should return this element (loading or empty state) */
|
|
92
|
+
earlyReturn: ReactElement | null;
|
|
93
|
+
/** Props to spread into the stream frame for legend behavior */
|
|
94
|
+
legendBehaviorProps: Record<string, any>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Hook that consolidates the shared boilerplate across all HOC charts:
|
|
98
|
+
*
|
|
99
|
+
* 1. Loading / empty state guards
|
|
100
|
+
* 2. useChartSelection (selection + linked hover)
|
|
101
|
+
* 3. useColorScale
|
|
102
|
+
* 4. allCategories extraction via useMemo
|
|
103
|
+
* 5. useLegendInteraction
|
|
104
|
+
* 6. effectiveSelectionHook merge (legend selection > cross-chart selection)
|
|
105
|
+
* 7. useChartLegendAndMargin
|
|
106
|
+
* 8. legendBehaviorProps for the stream frame
|
|
107
|
+
*
|
|
108
|
+
* Hooks are always called (no conditional returns before hooks) to satisfy React's
|
|
109
|
+
* rules of hooks. The `earlyReturn` field signals that the HOC should return early.
|
|
110
|
+
*/
|
|
111
|
+
export declare function useChartSetup(input: ChartSetupInput): ChartSetupResult;
|
|
112
|
+
export { DEFAULT_COLOR };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Accessor } from "./types";
|
|
2
|
+
import type { LegendPosition } from "./hooks";
|
|
3
|
+
/**
|
|
4
|
+
* Hook that discovers categories from streamed (pushed) data and builds
|
|
5
|
+
* a legend dynamically.
|
|
6
|
+
*
|
|
7
|
+
* When the `data` prop is provided (bounded mode), this hook is inert —
|
|
8
|
+
* the legend is built by `useChartSetup` from the full dataset.
|
|
9
|
+
*
|
|
10
|
+
* When `data` is undefined (push API mode), this hook:
|
|
11
|
+
* 1. Wraps push/pushMany to intercept incoming data
|
|
12
|
+
* 2. Extracts category values via `colorBy`
|
|
13
|
+
* 3. Builds a legend config when new categories are discovered
|
|
14
|
+
*
|
|
15
|
+
* Returns `wrapPush` / `wrapPushMany` callbacks to wrap the imperative handle,
|
|
16
|
+
* plus a `streamingLegend` that should override the (empty) legend from useChartSetup.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useStreamingLegend({ isPushMode, colorBy, colorScheme, showLegend, legendPosition, }: {
|
|
19
|
+
/** True when data prop is undefined (push API mode) */
|
|
20
|
+
isPushMode: boolean;
|
|
21
|
+
/** The color-by accessor (may be derived from stackBy/groupBy/categoryAccessor) */
|
|
22
|
+
colorBy: Accessor<string> | undefined;
|
|
23
|
+
/** Color scheme name or custom array */
|
|
24
|
+
colorScheme: string | string[];
|
|
25
|
+
/** Whether legend is requested */
|
|
26
|
+
showLegend: boolean | undefined;
|
|
27
|
+
/** Legend position */
|
|
28
|
+
legendPosition?: LegendPosition;
|
|
29
|
+
}): {
|
|
30
|
+
wrapPush: (originalPush: (d: any) => void) => (datum: any) => void;
|
|
31
|
+
wrapPushMany: (originalPushMany: (d: any[]) => void) => (data: any[]) => void;
|
|
32
|
+
resetCategories: () => void;
|
|
33
|
+
streamingLegend: {
|
|
34
|
+
legendGroups: {
|
|
35
|
+
styleFn: (d: import("../../types/legendTypes").LegendItem) => Record<string, string | number>;
|
|
36
|
+
type: "fill";
|
|
37
|
+
items: {
|
|
38
|
+
label: string;
|
|
39
|
+
color: string;
|
|
40
|
+
}[];
|
|
41
|
+
label: string;
|
|
42
|
+
}[];
|
|
43
|
+
} | undefined;
|
|
44
|
+
streamingMarginAdjust: {
|
|
45
|
+
right: number;
|
|
46
|
+
left?: undefined;
|
|
47
|
+
top?: undefined;
|
|
48
|
+
bottom?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
left: number;
|
|
51
|
+
right?: undefined;
|
|
52
|
+
top?: undefined;
|
|
53
|
+
bottom?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
top: number;
|
|
56
|
+
right?: undefined;
|
|
57
|
+
left?: undefined;
|
|
58
|
+
bottom?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
bottom: number;
|
|
61
|
+
right?: undefined;
|
|
62
|
+
left?: undefined;
|
|
63
|
+
top?: undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
4
5
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
5
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
6
7
|
/**
|
|
@@ -15,7 +16,7 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
15
16
|
* [{x: 1, y: 10, category: 'A'}, {x: 2, y: 20, category: 'A'}, {x: 1, y: 15, category: 'B'}]
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
data
|
|
19
|
+
data?: TDatum[];
|
|
19
20
|
/**
|
|
20
21
|
* Field name or function to access x values
|
|
21
22
|
* @default "x"
|
|
@@ -118,6 +119,10 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
118
119
|
* - "none": static legend (default)
|
|
119
120
|
*/
|
|
120
121
|
legendInteraction?: LegendInteractionMode;
|
|
122
|
+
/**
|
|
123
|
+
* Legend position
|
|
124
|
+
*/
|
|
125
|
+
legendPosition?: LegendPosition;
|
|
121
126
|
/**
|
|
122
127
|
* Tooltip configuration
|
|
123
128
|
*/
|
|
@@ -157,7 +162,7 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
157
162
|
* />
|
|
158
163
|
* ```
|
|
159
164
|
*/
|
|
160
|
-
export declare
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
165
|
+
export declare const AreaChart: {
|
|
166
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: AreaChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
167
|
+
displayName?: string;
|
|
168
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps, MarginalGraphicsConfig } from "../../stream/types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
4
5
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
5
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
6
7
|
/**
|
|
@@ -14,7 +15,7 @@ export interface BubbleChartProps<TDatum extends Record<string, any> = Record<st
|
|
|
14
15
|
* [{x: 1, y: 10, size: 50, category: 'A'}, {x: 2, y: 20, size: 30, category: 'B'}]
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
|
-
data
|
|
18
|
+
data?: TDatum[];
|
|
18
19
|
/**
|
|
19
20
|
* Field name or function to access x values
|
|
20
21
|
* @default "x"
|
|
@@ -100,6 +101,10 @@ export interface BubbleChartProps<TDatum extends Record<string, any> = Record<st
|
|
|
100
101
|
* - "none": static legend (default)
|
|
101
102
|
*/
|
|
102
103
|
legendInteraction?: LegendInteractionMode;
|
|
104
|
+
/**
|
|
105
|
+
* Legend position
|
|
106
|
+
*/
|
|
107
|
+
legendPosition?: LegendPosition;
|
|
103
108
|
/**
|
|
104
109
|
* Annotation objects to render on the chart
|
|
105
110
|
*/
|
|
@@ -172,7 +177,7 @@ export interface BubbleChartProps<TDatum extends Record<string, any> = Record<st
|
|
|
172
177
|
* @param props - BubbleChart configuration
|
|
173
178
|
* @returns Rendered bubble chart
|
|
174
179
|
*/
|
|
175
|
-
export declare
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
180
|
+
export declare const BubbleChart: {
|
|
181
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: BubbleChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
182
|
+
displayName?: string;
|
|
183
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
3
4
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
4
5
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
6
|
import type { LegendInteractionMode } from "../shared/hooks";
|
|
@@ -7,8 +8,8 @@ import type { LegendInteractionMode } from "../shared/hooks";
|
|
|
7
8
|
* ConnectedScatterplot component props
|
|
8
9
|
*/
|
|
9
10
|
export interface ConnectedScatterplotProps<TDatum extends Record<string, any> = Record<string, any>> extends BaseChartProps, AxisConfig {
|
|
10
|
-
/** Array of data points. Each point needs x and y properties. */
|
|
11
|
-
data
|
|
11
|
+
/** Array of data points. Each point needs x and y properties. Omit when using push API. */
|
|
12
|
+
data?: TDatum[];
|
|
12
13
|
/** Field name or function to access x values @default "x" */
|
|
13
14
|
xAccessor?: ChartAccessor<TDatum, number>;
|
|
14
15
|
/** Field name or function to access y values @default "y" */
|
|
@@ -57,7 +58,7 @@ export interface ConnectedScatterplotProps<TDatum extends Record<string, any> =
|
|
|
57
58
|
* />
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
|
-
export declare
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
61
|
+
export declare const ConnectedScatterplot: {
|
|
62
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: ConnectedScatterplotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
63
|
+
displayName?: string;
|
|
64
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
3
4
|
import type { LegendInteractionMode } from "../shared/hooks";
|
|
4
5
|
import type { BaseChartProps, ChartAccessor } from "../shared/types";
|
|
5
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
@@ -14,7 +15,7 @@ export interface HeatmapProps<TDatum extends Record<string, any> = Record<string
|
|
|
14
15
|
* [{x: 1, y: 1, value: 10}, {x: 1, y: 2, value: 20}, {x: 2, y: 1, value: 15}]
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
|
-
data
|
|
18
|
+
data?: TDatum[];
|
|
18
19
|
/**
|
|
19
20
|
* Field name or function to access x values
|
|
20
21
|
* @default "x"
|
|
@@ -87,6 +88,16 @@ export interface HeatmapProps<TDatum extends Record<string, any> = Record<string
|
|
|
87
88
|
* Tooltip configuration
|
|
88
89
|
*/
|
|
89
90
|
tooltip?: TooltipProp;
|
|
91
|
+
/**
|
|
92
|
+
* Show a gradient legend for the color scale.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
showLegend?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Position of the gradient legend.
|
|
98
|
+
* @default "right"
|
|
99
|
+
*/
|
|
100
|
+
legendPosition?: "right" | "left" | "top" | "bottom";
|
|
90
101
|
/**
|
|
91
102
|
* Legend interaction mode.
|
|
92
103
|
* - "highlight": hover dims non-hovered categories to 30% opacity
|
|
@@ -162,7 +173,7 @@ export interface HeatmapProps<TDatum extends Record<string, any> = Record<string
|
|
|
162
173
|
* @param props - Heatmap configuration
|
|
163
174
|
* @returns Rendered heatmap
|
|
164
175
|
*/
|
|
165
|
-
export declare
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
176
|
+
export declare const Heatmap: {
|
|
177
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: HeatmapProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
178
|
+
displayName?: string;
|
|
179
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
3
4
|
import type { LegendInteractionMode } from "../shared/hooks";
|
|
4
5
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
5
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
@@ -22,7 +23,7 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
22
23
|
* [{label: 'Series A', coordinates: [{x: 1, y: 10}, {x: 2, y: 20}]}]
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
|
25
|
-
data
|
|
26
|
+
data?: TDatum[];
|
|
26
27
|
/**
|
|
27
28
|
* Field name or function to access x values
|
|
28
29
|
* @default "x"
|
|
@@ -33,6 +34,16 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
33
34
|
* @default "y"
|
|
34
35
|
*/
|
|
35
36
|
yAccessor?: ChartAccessor<TDatum, number>;
|
|
37
|
+
/**
|
|
38
|
+
* Scale type for the x-axis
|
|
39
|
+
* @default "linear"
|
|
40
|
+
*/
|
|
41
|
+
xScaleType?: "linear" | "log";
|
|
42
|
+
/**
|
|
43
|
+
* Scale type for the y-axis
|
|
44
|
+
* @default "linear"
|
|
45
|
+
*/
|
|
46
|
+
yScaleType?: "linear" | "log";
|
|
36
47
|
/**
|
|
37
48
|
* Field name or function to group data into multiple lines
|
|
38
49
|
* @example
|
|
@@ -114,6 +125,11 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
114
125
|
* - "none": static legend (default)
|
|
115
126
|
*/
|
|
116
127
|
legendInteraction?: LegendInteractionMode;
|
|
128
|
+
/**
|
|
129
|
+
* Legend position relative to the chart area
|
|
130
|
+
* @default "right"
|
|
131
|
+
*/
|
|
132
|
+
legendPosition?: "right" | "left" | "top" | "bottom";
|
|
117
133
|
/**
|
|
118
134
|
* Tooltip configuration
|
|
119
135
|
*/
|
|
@@ -234,7 +250,7 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
234
250
|
* @param props - LineChart configuration
|
|
235
251
|
* @returns Rendered line chart
|
|
236
252
|
*/
|
|
237
|
-
export declare
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
253
|
+
export declare const LineChart: {
|
|
254
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: LineChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
255
|
+
displayName?: string;
|
|
256
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { LegendPosition } from "../shared/hooks";
|
|
3
4
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
4
5
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
6
|
export interface MinimapConfig {
|
|
@@ -54,6 +55,8 @@ export interface MinimapChartProps<TDatum extends Record<string, any> = Record<s
|
|
|
54
55
|
showGrid?: boolean;
|
|
55
56
|
/** Show legend */
|
|
56
57
|
showLegend?: boolean;
|
|
58
|
+
/** Legend position */
|
|
59
|
+
legendPosition?: LegendPosition;
|
|
57
60
|
/** Tooltip config */
|
|
58
61
|
tooltip?: TooltipProp;
|
|
59
62
|
/** Minimap configuration */
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
5
|
+
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
6
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
7
|
+
/**
|
|
8
|
+
* Quadrant label and color configuration
|
|
9
|
+
*/
|
|
10
|
+
export interface QuadrantConfig {
|
|
11
|
+
/** Label text for the quadrant */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Background fill color for the quadrant */
|
|
14
|
+
color: string;
|
|
15
|
+
/** Fill opacity (default: 0.08) */
|
|
16
|
+
opacity?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Configuration for the four quadrants.
|
|
20
|
+
* Quadrants are defined relative to the center lines:
|
|
21
|
+
* - topRight: high X, high Y
|
|
22
|
+
* - topLeft: low X, high Y
|
|
23
|
+
* - bottomRight: high X, low Y
|
|
24
|
+
* - bottomLeft: low X, low Y
|
|
25
|
+
*/
|
|
26
|
+
export interface QuadrantsConfig {
|
|
27
|
+
topRight: QuadrantConfig;
|
|
28
|
+
topLeft: QuadrantConfig;
|
|
29
|
+
bottomRight: QuadrantConfig;
|
|
30
|
+
bottomLeft: QuadrantConfig;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Centerline style configuration
|
|
34
|
+
*/
|
|
35
|
+
export interface CenterlineStyle {
|
|
36
|
+
/** Line color @default "#999" */
|
|
37
|
+
stroke?: string;
|
|
38
|
+
/** Line width @default 1 */
|
|
39
|
+
strokeWidth?: number;
|
|
40
|
+
/** Dash pattern (e.g. [4, 3]) @default [] (solid) */
|
|
41
|
+
strokeDasharray?: number[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* QuadrantChart component props
|
|
45
|
+
*/
|
|
46
|
+
export interface QuadrantChartProps<TDatum extends Record<string, any> = Record<string, any>> extends BaseChartProps, AxisConfig {
|
|
47
|
+
/** Array of data points */
|
|
48
|
+
data?: TDatum[];
|
|
49
|
+
/** Field name or function to access x values @default "x" */
|
|
50
|
+
xAccessor?: ChartAccessor<TDatum, number>;
|
|
51
|
+
/** Field name or function to access y values @default "y" */
|
|
52
|
+
yAccessor?: ChartAccessor<TDatum, number>;
|
|
53
|
+
/** X-coordinate of the vertical center line. Defaults to midpoint of x domain. */
|
|
54
|
+
xCenter?: number;
|
|
55
|
+
/** Y-coordinate of the horizontal center line. Defaults to midpoint of y domain. */
|
|
56
|
+
yCenter?: number;
|
|
57
|
+
/** Quadrant configuration: labels and colors for each of the four quadrants */
|
|
58
|
+
quadrants: QuadrantsConfig;
|
|
59
|
+
/** Style for the center lines */
|
|
60
|
+
centerlineStyle?: CenterlineStyle;
|
|
61
|
+
/** Show quadrant labels @default true */
|
|
62
|
+
showQuadrantLabels?: boolean;
|
|
63
|
+
/** Font size for quadrant labels @default 12 */
|
|
64
|
+
quadrantLabelSize?: number;
|
|
65
|
+
/** Field name or function to determine point color */
|
|
66
|
+
colorBy?: ChartAccessor<TDatum, string>;
|
|
67
|
+
/** Color scheme for categorical data @default "category10" */
|
|
68
|
+
colorScheme?: string | string[];
|
|
69
|
+
/** Field name or function to determine point size */
|
|
70
|
+
sizeBy?: ChartAccessor<TDatum, number>;
|
|
71
|
+
/** Min and max radius for points @default [3, 15] */
|
|
72
|
+
sizeRange?: [number, number];
|
|
73
|
+
/** Default point radius @default 5 */
|
|
74
|
+
pointRadius?: number;
|
|
75
|
+
/** Point opacity @default 0.8 */
|
|
76
|
+
pointOpacity?: number;
|
|
77
|
+
/** Enable hover annotations @default true */
|
|
78
|
+
enableHover?: boolean;
|
|
79
|
+
/** Show grid lines @default false */
|
|
80
|
+
showGrid?: boolean;
|
|
81
|
+
/** Show legend @default true (when colorBy is specified) */
|
|
82
|
+
showLegend?: boolean;
|
|
83
|
+
/** Tooltip configuration */
|
|
84
|
+
tooltip?: TooltipProp;
|
|
85
|
+
/** Accessor for unique point IDs */
|
|
86
|
+
pointIdAccessor?: ChartAccessor<TDatum, string>;
|
|
87
|
+
/** Legend interaction mode */
|
|
88
|
+
legendInteraction?: LegendInteractionMode;
|
|
89
|
+
/** Legend position */
|
|
90
|
+
legendPosition?: LegendPosition;
|
|
91
|
+
/** Annotation objects */
|
|
92
|
+
annotations?: Record<string, any>[];
|
|
93
|
+
/** Additional StreamXYFrame props */
|
|
94
|
+
frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size">>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* QuadrantChart — A scatterplot divided into four labeled, colored quadrants
|
|
98
|
+
* by center lines at user-specified x/y positions.
|
|
99
|
+
*
|
|
100
|
+
* Each quadrant gets a background color and label. Points are rendered as a
|
|
101
|
+
* standard scatter plot on top. Supports push API for streaming data.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* <QuadrantChart
|
|
106
|
+
* data={[{x: 1, y: 10}, {x: 5, y: 3}]}
|
|
107
|
+
* xCenter={3} yCenter={5}
|
|
108
|
+
* quadrants={{
|
|
109
|
+
* topRight: { label: "Stars", color: "#4CAF50" },
|
|
110
|
+
* topLeft: { label: "Question Marks", color: "#FF9800" },
|
|
111
|
+
* bottomRight: { label: "Cash Cows", color: "#2196F3" },
|
|
112
|
+
* bottomLeft: { label: "Dogs", color: "#F44336" },
|
|
113
|
+
* }}
|
|
114
|
+
* />
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export declare const QuadrantChart: {
|
|
118
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: QuadrantChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
119
|
+
displayName?: string;
|
|
120
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps, MarginalGraphicsConfig } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
3
4
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
4
5
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
|
-
import type { LegendInteractionMode } from "../shared/hooks";
|
|
6
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
6
7
|
/**
|
|
7
8
|
* Scatterplot component props
|
|
8
9
|
*/
|
|
9
10
|
export interface ScatterplotProps<TDatum extends Record<string, any> = Record<string, any>> extends BaseChartProps, AxisConfig {
|
|
10
11
|
/** Array of data points. Each point should have x and y properties. */
|
|
11
|
-
data
|
|
12
|
+
data?: TDatum[];
|
|
12
13
|
/** Field name or function to access x values @default "x" */
|
|
13
14
|
xAccessor?: ChartAccessor<TDatum, number>;
|
|
14
15
|
/** Field name or function to access y values @default "y" */
|
|
@@ -39,6 +40,8 @@ export interface ScatterplotProps<TDatum extends Record<string, any> = Record<st
|
|
|
39
40
|
pointIdAccessor?: ChartAccessor<TDatum, string>;
|
|
40
41
|
/** Legend interaction mode */
|
|
41
42
|
legendInteraction?: LegendInteractionMode;
|
|
43
|
+
/** Legend position */
|
|
44
|
+
legendPosition?: LegendPosition;
|
|
42
45
|
/** Annotation objects to render on the chart */
|
|
43
46
|
annotations?: Record<string, any>[];
|
|
44
47
|
/** Additional StreamXYFrame props for advanced customization */
|
|
@@ -56,7 +59,7 @@ export interface ScatterplotProps<TDatum extends Record<string, any> = Record<st
|
|
|
56
59
|
* />
|
|
57
60
|
* ```
|
|
58
61
|
*/
|
|
59
|
-
export declare
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
62
|
+
export declare const Scatterplot: {
|
|
63
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: ScatterplotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
64
|
+
displayName?: string;
|
|
65
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
4
5
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
5
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
6
7
|
/**
|
|
@@ -14,7 +15,7 @@ export interface StackedAreaChartProps<TDatum extends Record<string, any> = Reco
|
|
|
14
15
|
* [{x: 1, y: 10, category: 'A'}, {x: 2, y: 20, category: 'A'}, {x: 1, y: 15, category: 'B'}]
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
|
-
data
|
|
18
|
+
data?: TDatum[];
|
|
18
19
|
/**
|
|
19
20
|
* Field name or function to access x values
|
|
20
21
|
* @default "x"
|
|
@@ -101,6 +102,10 @@ export interface StackedAreaChartProps<TDatum extends Record<string, any> = Reco
|
|
|
101
102
|
* - "none": static legend (default)
|
|
102
103
|
*/
|
|
103
104
|
legendInteraction?: LegendInteractionMode;
|
|
105
|
+
/**
|
|
106
|
+
* Legend position
|
|
107
|
+
*/
|
|
108
|
+
legendPosition?: LegendPosition;
|
|
104
109
|
/**
|
|
105
110
|
* Tooltip configuration
|
|
106
111
|
*/
|
|
@@ -140,7 +145,7 @@ export interface StackedAreaChartProps<TDatum extends Record<string, any> = Reco
|
|
|
140
145
|
* />
|
|
141
146
|
* ```
|
|
142
147
|
*/
|
|
143
|
-
export declare
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
148
|
+
export declare const StackedAreaChart: {
|
|
149
|
+
<TDatum extends Record<string, any> = Record<string, any>>(props: StackedAreaChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
150
|
+
displayName?: string;
|
|
151
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge external data into GeoJSON features by joining on a key field.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const enriched = mergeData(worldCountries, myCSV, {
|
|
7
|
+
* featureKey: "properties.iso_a3",
|
|
8
|
+
* dataKey: "country_code"
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Cross-pollination: This pattern (key-based data join) could be extracted
|
|
13
|
+
* to a shared utility for any data merge operation in Semiotic.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mergeData<T extends Record<string, any>>(features: GeoJSON.Feature[], data: T[], options: {
|
|
16
|
+
featureKey: string;
|
|
17
|
+
dataKey: string;
|
|
18
|
+
}): GeoJSON.Feature[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ReferenceGeography = "world-110m" | "world-50m" | "land-110m" | "land-50m";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a string reference to GeoJSON features.
|
|
4
|
+
* Uses dynamic import so bundlers can tree-shake/code-split the data.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveReferenceGeography(name: ReferenceGeography): Promise<GeoJSON.Feature[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Check whether a value is a known reference geography string.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isReferenceGeography(value: unknown): value is ReferenceGeography;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReferenceGeography } from "./referenceGeography";
|
|
2
|
+
export type AreasProp = GeoJSON.Feature[] | ReferenceGeography;
|
|
3
|
+
/**
|
|
4
|
+
* Hook that resolves an `areas` prop — either GeoJSON features passed directly,
|
|
5
|
+
* or a string reference ("world-110m", etc.) that triggers an async load.
|
|
6
|
+
*
|
|
7
|
+
* Returns `null` while loading, resolved features when ready.
|
|
8
|
+
*
|
|
9
|
+
* When `areas` is already an array, the value is returned synchronously via
|
|
10
|
+
* useMemo (no stale-frame lag between prop changes). The useState+useEffect
|
|
11
|
+
* path is only used for async reference string resolution.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useReferenceAreas(areas: AreasProp | undefined): GeoJSON.Feature[] | null;
|
|
@@ -10,6 +10,7 @@ export declare class RingBuffer<T> {
|
|
|
10
10
|
peek(): T | undefined;
|
|
11
11
|
peekOldest(): T | undefined;
|
|
12
12
|
[Symbol.iterator](): Iterator<T>;
|
|
13
|
+
forEach(callback: (value: T, index: number) => void): void;
|
|
13
14
|
toArray(): T[];
|
|
14
15
|
resize(newCapacity: number): T[];
|
|
15
16
|
clear(): void;
|