semiotic 3.0.0 → 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 +242 -29
- package/README.md +101 -66
- package/ai/cli.js +34 -21
- package/ai/dist/componentRegistry.js +2 -0
- package/ai/dist/mcp-server.js +54 -0
- package/ai/examples.md +433 -18
- package/ai/schema.json +134 -1
- package/ai/system-prompt.md +51 -10
- package/dist/{ChartGrid.d.ts → components/ChartGrid.d.ts} +9 -7
- package/dist/components/Legend.d.ts +9 -0
- package/dist/{LinkedCharts.d.ts → components/LinkedCharts.d.ts} +34 -1
- package/dist/{Tooltip → components/Tooltip}/Tooltip.d.ts +9 -2
- 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/{charts → components/charts}/index.d.ts +4 -0
- package/dist/{charts → components/charts}/network/ChordDiagram.d.ts +8 -5
- package/dist/{charts → components/charts}/network/CirclePack.d.ts +4 -2
- package/dist/{charts → components/charts}/network/ForceDirectedGraph.d.ts +10 -6
- package/dist/components/charts/network/OrbitDiagram.d.ts +79 -0
- package/dist/{charts → components/charts}/network/SankeyDiagram.d.ts +8 -5
- package/dist/{charts → components/charts}/network/TreeDiagram.d.ts +4 -2
- package/dist/{charts → components/charts}/network/Treemap.d.ts +4 -2
- package/dist/{charts → components/charts}/ordinal/BarChart.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/BoxPlot.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/DonutChart.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/DotPlot.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/GroupedBarChart.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/Histogram.d.ts +8 -5
- package/dist/{charts → components/charts}/ordinal/PieChart.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/RidgelinePlot.d.ts +2 -0
- package/dist/{charts → components/charts}/ordinal/StackedBarChart.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/SwarmPlot.d.ts +9 -5
- package/dist/{charts → components/charts}/ordinal/ViolinPlot.d.ts +8 -5
- package/dist/{charts → components/charts}/realtime/RealtimeHeatmap.d.ts +24 -6
- package/dist/{charts → components/charts}/realtime/RealtimeHistogram.d.ts +28 -7
- package/dist/{charts → components/charts}/realtime/RealtimeLineChart.d.ts +23 -5
- package/dist/{charts → components/charts}/realtime/RealtimeSwarmChart.d.ts +24 -6
- package/dist/{charts → components/charts}/realtime/RealtimeWaterfallChart.d.ts +23 -5
- package/dist/{charts → components/charts}/shared/colorUtils.d.ts +5 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +23 -0
- package/dist/{charts → components/charts}/shared/hooks.d.ts +36 -2
- package/dist/{charts → components/charts}/shared/legendUtils.d.ts +2 -3
- package/dist/{charts → components/charts}/shared/statisticalOverlays.d.ts +1 -2
- package/dist/components/charts/shared/statisticalOverlaysLazy.d.ts +10 -0
- package/dist/components/charts/shared/stringDistance.d.ts +11 -0
- package/dist/{charts → components/charts}/shared/tooltipUtils.d.ts +2 -2
- package/dist/{charts → components/charts}/shared/types.d.ts +16 -4
- package/dist/components/charts/shared/useChartSetup.d.ts +112 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +65 -0
- package/dist/{charts → components/charts}/shared/withChartWrapper.d.ts +10 -0
- package/dist/{charts → components/charts}/xy/AreaChart.d.ts +18 -5
- package/dist/{charts → components/charts}/xy/BubbleChart.d.ts +18 -5
- package/dist/{charts → components/charts}/xy/ConnectedScatterplot.d.ts +10 -6
- package/dist/{charts → components/charts}/xy/Heatmap.d.ts +24 -5
- package/dist/{charts → components/charts}/xy/LineChart.d.ts +47 -5
- package/dist/{charts → components/charts}/xy/MinimapChart.d.ts +3 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +120 -0
- package/dist/{charts → components/charts}/xy/Scatterplot.d.ts +11 -5
- package/dist/{charts → components/charts}/xy/StackedAreaChart.d.ts +18 -5
- package/dist/{export → components/export}/exportChart.d.ts +6 -1
- 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/{realtime → components/realtime}/RingBuffer.d.ts +1 -0
- package/dist/{realtime → components/realtime}/types.d.ts +17 -0
- package/dist/components/semiotic-ai.d.ts +61 -0
- package/dist/components/semiotic-data.d.ts +8 -0
- package/dist/components/semiotic-geo.d.ts +16 -0
- package/dist/components/semiotic-network.d.ts +14 -0
- package/dist/components/semiotic-ordinal.d.ts +18 -0
- package/dist/components/semiotic-realtime.d.ts +22 -0
- package/dist/components/semiotic-server.d.ts +1 -0
- package/dist/components/semiotic-xy.d.ts +17 -0
- package/dist/components/semiotic.d.ts +57 -0
- package/dist/{server → components/server}/renderToStaticSVG.d.ts +11 -2
- package/dist/components/stream/AccessibleDataTable.d.ts +50 -0
- package/dist/{stream → components/stream}/CanvasHitTester.d.ts +8 -2
- package/dist/components/stream/DataSourceAdapter.d.ts +64 -0
- 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/{stream → components/stream}/NetworkPipelineStore.d.ts +16 -4
- package/dist/{stream → components/stream}/NetworkSVGOverlay.d.ts +24 -1
- package/dist/{stream → components/stream}/OrdinalPipelineStore.d.ts +8 -4
- package/dist/{stream → components/stream}/OrdinalSVGOverlay.d.ts +31 -1
- package/dist/{stream → components/stream}/PipelineStore.d.ts +64 -5
- package/dist/components/stream/SVGOverlay.d.ts +98 -0
- package/dist/{stream → components/stream}/SceneGraph.d.ts +7 -3
- package/dist/components/stream/SceneToSVG.d.ts +22 -0
- package/dist/components/stream/StreamGeoFrame.d.ts +4 -0
- package/dist/{stream → 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/hitTestUtils.d.ts +23 -0
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +2 -0
- package/dist/{stream → 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/{stream → components/stream}/networkTypes.d.ts +59 -3
- package/dist/{stream → components/stream}/ordinalTypes.d.ts +26 -10
- package/dist/components/stream/pipelineTransitionUtils.d.ts +42 -0
- package/dist/components/stream/renderers/areaCanvasRenderer.d.ts +2 -0
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +9 -0
- package/dist/{stream → components/stream}/renderers/heatmapCanvasRenderer.d.ts +2 -1
- package/dist/{stream → components/stream}/renderers/lineCanvasRenderer.d.ts +1 -0
- package/dist/components/stream/renderers/renderPulse.d.ts +50 -0
- package/dist/{stream → components/stream}/types.d.ts +89 -3
- package/dist/components/stream/useStalenessCheck.d.ts +16 -0
- package/dist/components/types/legendTypes.d.ts +49 -0
- 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.d.ts +3 -0
- 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-network.d.ts +1 -0
- package/dist/semiotic-ordinal.d.ts +1 -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 +23 -0
- package/dist/test-utils/frameMock.d.ts +78 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +34 -20
- package/dist/Legend.d.ts +0 -3
- package/dist/stream/DataSourceAdapter.d.ts +0 -35
- package/dist/stream/SVGOverlay.d.ts +0 -56
- package/dist/stream/layouts/forceLayoutPlugin.d.ts +0 -9
- package/dist/stream/renderers/areaCanvasRenderer.d.ts +0 -7
- package/dist/types/legendTypes.d.ts +0 -20
- /package/dist/{Annotation.d.ts → components/Annotation.d.ts} +0 -0
- /package/dist/{CategoryColors.d.ts → components/CategoryColors.d.ts} +0 -0
- /package/dist/{ChartContainer.d.ts → components/ChartContainer.d.ts} +0 -0
- /package/dist/{ChartErrorBoundary.d.ts → components/ChartErrorBoundary.d.ts} +0 -0
- /package/dist/{ContextLayout.d.ts → components/ContextLayout.d.ts} +0 -0
- /package/dist/{DetailsPanel.d.ts → components/DetailsPanel.d.ts} +0 -0
- /package/dist/{ThemeProvider.d.ts → components/ThemeProvider.d.ts} +0 -0
- /package/dist/{charts → components/charts}/shared/ChartError.d.ts +0 -0
- /package/dist/{charts → components/charts}/shared/annotationRules.d.ts +0 -0
- /package/dist/{charts → components/charts}/shared/formatUtils.d.ts +0 -0
- /package/dist/{charts → components/charts}/shared/loess.d.ts +0 -0
- /package/dist/{charts → components/charts}/shared/networkUtils.d.ts +0 -0
- /package/dist/{charts → components/charts}/shared/selectionUtils.d.ts +0 -0
- /package/dist/{charts → components/charts}/shared/validateChartData.d.ts +0 -0
- /package/dist/{charts → components/charts}/shared/validateProps.d.ts +0 -0
- /package/dist/{charts → components/charts}/xy/ScatterplotMatrix.d.ts +0 -0
- /package/dist/{data → components/data}/fromVegaLite.d.ts +0 -0
- /package/dist/{data → components/data}/transforms.d.ts +0 -0
- /package/dist/{export → components/export}/chartConfig.d.ts +0 -0
- /package/dist/{export → components/export}/selectionSerializer.d.ts +0 -0
- /package/dist/{geometry → components/geometry}/sankeyLinks.d.ts +0 -0
- /package/dist/{realtime → components/realtime}/BinAccumulator.d.ts +0 -0
- /package/dist/{realtime → components/realtime}/IncrementalExtent.d.ts +0 -0
- /package/dist/{realtime → components/realtime}/renderers/types.d.ts +0 -0
- /package/dist/{realtime → components/realtime}/renderers/waterfallRenderer.d.ts +0 -0
- /package/dist/{store → components/store}/ObservationStore.d.ts +0 -0
- /package/dist/{store → components/store}/SelectionStore.d.ts +0 -0
- /package/dist/{store → components/store}/ThemeStore.d.ts +0 -0
- /package/dist/{store → components/store}/TooltipStore.d.ts +0 -0
- /package/dist/{store → components/store}/createStore.d.ts +0 -0
- /package/dist/{store → components/store}/useObservation.d.ts +0 -0
- /package/dist/{store → components/store}/useSelection.d.ts +0 -0
- /package/dist/{stream → components/stream}/MarginalGraphics.d.ts +0 -0
- /package/dist/{stream → components/stream}/NetworkCanvasHitTester.d.ts +0 -0
- /package/dist/{stream → components/stream}/OrdinalCanvasHitTester.d.ts +0 -0
- /package/dist/{stream → components/stream}/ParticlePool.d.ts +0 -0
- /package/dist/{stream → components/stream}/StreamNetworkFrame.d.ts +0 -0
- /package/dist/{stream → components/stream}/StreamOrdinalFrame.d.ts +0 -0
- /package/dist/{stream → components/stream}/StreamXYFrame.d.ts +0 -0
- /package/dist/{stream → components/stream}/keyboardNav.d.ts +0 -0
- /package/dist/{stream → components/stream}/layouts/chordLayoutPlugin.d.ts +0 -0
- /package/dist/{stream → components/stream}/layouts/hierarchyLayoutPlugin.d.ts +0 -0
- /package/dist/{stream → components/stream}/layouts/sankeyLayoutPlugin.d.ts +0 -0
- /package/dist/{stream → components/stream}/ordinalSceneBuilders/barScene.d.ts +0 -0
- /package/dist/{stream → components/stream}/ordinalSceneBuilders/connectorScene.d.ts +0 -0
- /package/dist/{stream → components/stream}/ordinalSceneBuilders/pieScene.d.ts +0 -0
- /package/dist/{stream → components/stream}/ordinalSceneBuilders/pointScene.d.ts +0 -0
- /package/dist/{stream → components/stream}/ordinalSceneBuilders/statisticalScene.d.ts +0 -0
- /package/dist/{stream → components/stream}/ordinalSceneBuilders/timelineScene.d.ts +0 -0
- /package/dist/{stream → components/stream}/ordinalSceneBuilders/types.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/barCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/boxplotCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/candlestickCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/connectorCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/networkArcRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/networkCircleRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/networkEdgeRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/networkParticleRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/networkRectRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/pointCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/swarmCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/types.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/violinCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/waterfallCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/renderers/wedgeCanvasRenderer.d.ts +0 -0
- /package/dist/{stream → components/stream}/useResponsiveSize.d.ts +0 -0
- /package/dist/{types → components/types}/annotationTypes.d.ts +0 -0
- /package/dist/{types → components/types}/generalTypes.d.ts +0 -0
- /package/dist/{types → components/types}/interactionTypes.d.ts +0 -0
- /package/dist/{types → components/types}/networkTypes.d.ts +0 -0
- /package/dist/{types → components/types}/ordinalTypes.d.ts +0 -0
|
@@ -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
|
+
};
|
|
@@ -11,6 +11,16 @@ interface SafeRenderProps {
|
|
|
11
11
|
* with the component name and error message instead of crashing the page.
|
|
12
12
|
*/
|
|
13
13
|
export declare function SafeRender({ componentName, width, height, children }: SafeRenderProps): React.JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Renders a "No data available" placeholder when data is empty.
|
|
16
|
+
* Returns null when data is present or emptyContent is `false`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function renderEmptyState(data: any[] | undefined | null, width: number, height: number, emptyContent?: React.ReactNode | false): React.ReactElement | null;
|
|
19
|
+
/**
|
|
20
|
+
* Renders a shimmer/skeleton loading placeholder.
|
|
21
|
+
* Returns null when loading is false.
|
|
22
|
+
*/
|
|
23
|
+
export declare function renderLoadingState(loading: boolean | undefined, width: number, height: number): React.ReactElement | null;
|
|
14
24
|
/** Warn if a string accessor isn't found in the first data element */
|
|
15
25
|
export declare function warnMissingField(componentName: string, data: any[] | undefined, accessorName: string, accessorValue: any): void;
|
|
16
26
|
/** Warn if data looks like the wrong shape for this chart type */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
3
5
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
4
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
7
|
/**
|
|
@@ -14,7 +16,7 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
14
16
|
* [{x: 1, y: 10, category: 'A'}, {x: 2, y: 20, category: 'A'}, {x: 1, y: 15, category: 'B'}]
|
|
15
17
|
* ```
|
|
16
18
|
*/
|
|
17
|
-
data
|
|
19
|
+
data?: TDatum[];
|
|
18
20
|
/**
|
|
19
21
|
* Field name or function to access x values
|
|
20
22
|
* @default "x"
|
|
@@ -110,6 +112,17 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
110
112
|
* @default true (when multiple areas)
|
|
111
113
|
*/
|
|
112
114
|
showLegend?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Legend interaction mode.
|
|
117
|
+
* - "highlight": hover dims non-hovered categories to 30% opacity
|
|
118
|
+
* - "isolate": click toggles category visibility with checkmark indicators
|
|
119
|
+
* - "none": static legend (default)
|
|
120
|
+
*/
|
|
121
|
+
legendInteraction?: LegendInteractionMode;
|
|
122
|
+
/**
|
|
123
|
+
* Legend position
|
|
124
|
+
*/
|
|
125
|
+
legendPosition?: LegendPosition;
|
|
113
126
|
/**
|
|
114
127
|
* Tooltip configuration
|
|
115
128
|
*/
|
|
@@ -149,7 +162,7 @@ export interface AreaChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
149
162
|
* />
|
|
150
163
|
* ```
|
|
151
164
|
*/
|
|
152
|
-
export declare
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
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,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps, MarginalGraphicsConfig } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
3
5
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
4
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
7
|
/**
|
|
@@ -13,7 +15,7 @@ export interface BubbleChartProps<TDatum extends Record<string, any> = Record<st
|
|
|
13
15
|
* [{x: 1, y: 10, size: 50, category: 'A'}, {x: 2, y: 20, size: 30, category: 'B'}]
|
|
14
16
|
* ```
|
|
15
17
|
*/
|
|
16
|
-
data
|
|
18
|
+
data?: TDatum[];
|
|
17
19
|
/**
|
|
18
20
|
* Field name or function to access x values
|
|
19
21
|
* @default "x"
|
|
@@ -92,6 +94,17 @@ export interface BubbleChartProps<TDatum extends Record<string, any> = Record<st
|
|
|
92
94
|
marginalGraphics?: MarginalGraphicsConfig;
|
|
93
95
|
/** Accessor for unique point IDs, used by point-anchored annotations */
|
|
94
96
|
pointIdAccessor?: ChartAccessor<TDatum, string>;
|
|
97
|
+
/**
|
|
98
|
+
* Legend interaction mode.
|
|
99
|
+
* - "highlight": hover dims non-hovered categories to 30% opacity
|
|
100
|
+
* - "isolate": click toggles category visibility with checkmark indicators
|
|
101
|
+
* - "none": static legend (default)
|
|
102
|
+
*/
|
|
103
|
+
legendInteraction?: LegendInteractionMode;
|
|
104
|
+
/**
|
|
105
|
+
* Legend position
|
|
106
|
+
*/
|
|
107
|
+
legendPosition?: LegendPosition;
|
|
95
108
|
/**
|
|
96
109
|
* Annotation objects to render on the chart
|
|
97
110
|
*/
|
|
@@ -164,7 +177,7 @@ export interface BubbleChartProps<TDatum extends Record<string, any> = Record<st
|
|
|
164
177
|
* @param props - BubbleChart configuration
|
|
165
178
|
* @returns Rendered bubble chart
|
|
166
179
|
*/
|
|
167
|
-
export declare
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
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,13 +1,15 @@
|
|
|
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";
|
|
6
|
+
import type { LegendInteractionMode } from "../shared/hooks";
|
|
5
7
|
/**
|
|
6
8
|
* ConnectedScatterplot component props
|
|
7
9
|
*/
|
|
8
10
|
export interface ConnectedScatterplotProps<TDatum extends Record<string, any> = Record<string, any>> extends BaseChartProps, AxisConfig {
|
|
9
|
-
/** Array of data points. Each point needs x and y properties. */
|
|
10
|
-
data
|
|
11
|
+
/** Array of data points. Each point needs x and y properties. Omit when using push API. */
|
|
12
|
+
data?: TDatum[];
|
|
11
13
|
/** Field name or function to access x values @default "x" */
|
|
12
14
|
xAccessor?: ChartAccessor<TDatum, number>;
|
|
13
15
|
/** Field name or function to access y values @default "y" */
|
|
@@ -30,6 +32,8 @@ export interface ConnectedScatterplotProps<TDatum extends Record<string, any> =
|
|
|
30
32
|
tooltip?: TooltipProp;
|
|
31
33
|
/** Accessor for unique point IDs, used by point-anchored annotations */
|
|
32
34
|
pointIdAccessor?: ChartAccessor<TDatum, string>;
|
|
35
|
+
/** Legend interaction mode */
|
|
36
|
+
legendInteraction?: LegendInteractionMode;
|
|
33
37
|
/** Annotation objects to render on the chart */
|
|
34
38
|
annotations?: Record<string, any>[];
|
|
35
39
|
/** Additional StreamXYFrame props for advanced customization */
|
|
@@ -54,7 +58,7 @@ export interface ConnectedScatterplotProps<TDatum extends Record<string, any> =
|
|
|
54
58
|
* />
|
|
55
59
|
* ```
|
|
56
60
|
*/
|
|
57
|
-
export declare
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
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,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { LegendInteractionMode } from "../shared/hooks";
|
|
3
5
|
import type { BaseChartProps, ChartAccessor } from "../shared/types";
|
|
4
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
7
|
/**
|
|
@@ -13,7 +15,7 @@ export interface HeatmapProps<TDatum extends Record<string, any> = Record<string
|
|
|
13
15
|
* [{x: 1, y: 1, value: 10}, {x: 1, y: 2, value: 20}, {x: 2, y: 1, value: 15}]
|
|
14
16
|
* ```
|
|
15
17
|
*/
|
|
16
|
-
data
|
|
18
|
+
data?: TDatum[];
|
|
17
19
|
/**
|
|
18
20
|
* Field name or function to access x values
|
|
19
21
|
* @default "x"
|
|
@@ -86,6 +88,23 @@ export interface HeatmapProps<TDatum extends Record<string, any> = Record<string
|
|
|
86
88
|
* Tooltip configuration
|
|
87
89
|
*/
|
|
88
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";
|
|
101
|
+
/**
|
|
102
|
+
* Legend interaction mode.
|
|
103
|
+
* - "highlight": hover dims non-hovered categories to 30% opacity
|
|
104
|
+
* - "isolate": click toggles category visibility with checkmark indicators
|
|
105
|
+
* - "none": static legend (default)
|
|
106
|
+
*/
|
|
107
|
+
legendInteraction?: LegendInteractionMode;
|
|
89
108
|
/**
|
|
90
109
|
* Annotation objects to render on the chart
|
|
91
110
|
*/
|
|
@@ -154,7 +173,7 @@ export interface HeatmapProps<TDatum extends Record<string, any> = Record<string
|
|
|
154
173
|
* @param props - Heatmap configuration
|
|
155
174
|
* @returns Rendered heatmap
|
|
156
175
|
*/
|
|
157
|
-
export declare
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
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,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { LegendInteractionMode } from "../shared/hooks";
|
|
3
5
|
import type { BaseChartProps, AxisConfig, ChartAccessor } from "../shared/types";
|
|
4
6
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
7
|
import type { AnomalyConfig, ForecastConfig } from "../shared/statisticalOverlays";
|
|
@@ -21,7 +23,7 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
21
23
|
* [{label: 'Series A', coordinates: [{x: 1, y: 10}, {x: 2, y: 20}]}]
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
24
|
-
data
|
|
26
|
+
data?: TDatum[];
|
|
25
27
|
/**
|
|
26
28
|
* Field name or function to access x values
|
|
27
29
|
* @default "x"
|
|
@@ -32,6 +34,16 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
32
34
|
* @default "y"
|
|
33
35
|
*/
|
|
34
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";
|
|
35
47
|
/**
|
|
36
48
|
* Field name or function to group data into multiple lines
|
|
37
49
|
* @example
|
|
@@ -106,6 +118,18 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
106
118
|
* @default true (when multiple lines)
|
|
107
119
|
*/
|
|
108
120
|
showLegend?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Legend interaction mode.
|
|
123
|
+
* - "highlight": hover dims non-hovered categories to 30% opacity
|
|
124
|
+
* - "isolate": click toggles category visibility with checkmark indicators
|
|
125
|
+
* - "none": static legend (default)
|
|
126
|
+
*/
|
|
127
|
+
legendInteraction?: LegendInteractionMode;
|
|
128
|
+
/**
|
|
129
|
+
* Legend position relative to the chart area
|
|
130
|
+
* @default "right"
|
|
131
|
+
*/
|
|
132
|
+
legendPosition?: "right" | "left" | "top" | "bottom";
|
|
109
133
|
/**
|
|
110
134
|
* Tooltip configuration
|
|
111
135
|
*/
|
|
@@ -116,6 +140,24 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
116
140
|
* Annotation objects to render on the chart
|
|
117
141
|
*/
|
|
118
142
|
annotations?: Record<string, any>[];
|
|
143
|
+
/**
|
|
144
|
+
* Place category labels directly at line endpoints instead of using a separate legend.
|
|
145
|
+
* When true, auto-hides the legend (override with `showLegend: true`).
|
|
146
|
+
* Pass an object for fine-grained control.
|
|
147
|
+
*/
|
|
148
|
+
directLabel?: boolean | {
|
|
149
|
+
/** Where to place labels relative to the line. @default "end" */
|
|
150
|
+
position?: "end" | "start";
|
|
151
|
+
/** Font size for labels. @default 11 */
|
|
152
|
+
fontSize?: number;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* How to handle null/undefined/NaN values in the data.
|
|
156
|
+
* - "break": break the line at gaps (default)
|
|
157
|
+
* - "interpolate": connect across gaps (skip missing points)
|
|
158
|
+
* - "zero": drop to zero at gap boundaries
|
|
159
|
+
*/
|
|
160
|
+
gapStrategy?: "break" | "interpolate" | "zero";
|
|
119
161
|
/**
|
|
120
162
|
* Anomaly detection configuration. Highlights outlier points and shows
|
|
121
163
|
* a shaded band representing the expected range (mean +/- threshold * stddev).
|
|
@@ -208,7 +250,7 @@ export interface LineChartProps<TDatum extends Record<string, any> = Record<stri
|
|
|
208
250
|
* @param props - LineChart configuration
|
|
209
251
|
* @returns Rendered line chart
|
|
210
252
|
*/
|
|
211
|
-
export declare
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
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,13 +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";
|
|
6
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
5
7
|
/**
|
|
6
8
|
* Scatterplot component props
|
|
7
9
|
*/
|
|
8
10
|
export interface ScatterplotProps<TDatum extends Record<string, any> = Record<string, any>> extends BaseChartProps, AxisConfig {
|
|
9
11
|
/** Array of data points. Each point should have x and y properties. */
|
|
10
|
-
data
|
|
12
|
+
data?: TDatum[];
|
|
11
13
|
/** Field name or function to access x values @default "x" */
|
|
12
14
|
xAccessor?: ChartAccessor<TDatum, number>;
|
|
13
15
|
/** Field name or function to access y values @default "y" */
|
|
@@ -36,6 +38,10 @@ export interface ScatterplotProps<TDatum extends Record<string, any> = Record<st
|
|
|
36
38
|
marginalGraphics?: MarginalGraphicsConfig;
|
|
37
39
|
/** Accessor for unique point IDs, used by point-anchored annotations */
|
|
38
40
|
pointIdAccessor?: ChartAccessor<TDatum, string>;
|
|
41
|
+
/** Legend interaction mode */
|
|
42
|
+
legendInteraction?: LegendInteractionMode;
|
|
43
|
+
/** Legend position */
|
|
44
|
+
legendPosition?: LegendPosition;
|
|
39
45
|
/** Annotation objects to render on the chart */
|
|
40
46
|
annotations?: Record<string, any>[];
|
|
41
47
|
/** Additional StreamXYFrame props for advanced customization */
|
|
@@ -53,7 +59,7 @@ export interface ScatterplotProps<TDatum extends Record<string, any> = Record<st
|
|
|
53
59
|
* />
|
|
54
60
|
* ```
|
|
55
61
|
*/
|
|
56
|
-
export declare
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
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
|
+
};
|