semiotic 3.4.1 → 3.5.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.
Files changed (164) hide show
  1. package/CLAUDE.md +114 -9
  2. package/README.md +45 -4
  3. package/ai/behaviorContracts.cjs +311 -0
  4. package/ai/chartSuggestions.cjs +291 -0
  5. package/ai/cli.js +255 -30
  6. package/ai/componentMetadata.cjs +107 -0
  7. package/ai/dist/mcp-server.js +907 -227
  8. package/ai/schema.json +3954 -2537
  9. package/ai/system-prompt.md +23 -4
  10. package/dist/components/LinkedCharts.d.ts +5 -1
  11. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  12. package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
  13. package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
  14. package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
  15. package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
  16. package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
  17. package/dist/components/charts/geo/FlowMap.d.ts +55 -0
  18. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
  19. package/dist/components/charts/index.d.ts +6 -0
  20. package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
  21. package/dist/components/charts/network/CirclePack.d.ts +36 -1
  22. package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
  23. package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
  24. package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
  25. package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
  26. package/dist/components/charts/network/Treemap.d.ts +36 -2
  27. package/dist/components/charts/ordinal/BarChart.d.ts +111 -1
  28. package/dist/components/charts/ordinal/BoxPlot.d.ts +31 -0
  29. package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
  30. package/dist/components/charts/ordinal/DotPlot.d.ts +31 -0
  31. package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
  32. package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
  33. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +38 -0
  34. package/dist/components/charts/ordinal/Histogram.d.ts +95 -0
  35. package/dist/components/charts/ordinal/LikertChart.d.ts +42 -0
  36. package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
  37. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +27 -0
  38. package/dist/components/charts/ordinal/StackedBarChart.d.ts +38 -0
  39. package/dist/components/charts/ordinal/SwarmPlot.d.ts +36 -0
  40. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +60 -0
  41. package/dist/components/charts/ordinal/ViolinPlot.d.ts +32 -0
  42. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
  43. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
  44. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
  45. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
  46. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
  47. package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +43 -0
  48. package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
  49. package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
  50. package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
  51. package/dist/components/charts/shared/colorUtils.d.ts +9 -10
  52. package/dist/components/charts/shared/numberFormat.d.ts +58 -0
  53. package/dist/components/charts/shared/sparseArray.d.ts +27 -0
  54. package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
  55. package/dist/components/charts/shared/timeFormat.d.ts +60 -0
  56. package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
  57. package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
  58. package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
  59. package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
  60. package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
  61. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  62. package/dist/components/charts/shared/validationMap.d.ts +2 -1
  63. package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
  64. package/dist/components/charts/xy/AreaChart.d.ts +30 -1
  65. package/dist/components/charts/xy/CandlestickChart.d.ts +33 -6
  66. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +24 -0
  67. package/dist/components/charts/xy/MinimapChart.d.ts +51 -0
  68. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
  69. package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
  70. package/dist/components/charts/xy/Scatterplot.d.ts +34 -2
  71. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
  72. package/dist/components/charts/xy/StackedAreaChart.d.ts +49 -1
  73. package/dist/components/export/selectionSerializer.d.ts +1 -1
  74. package/dist/components/realtime/types.d.ts +7 -9
  75. package/dist/components/recipes/bullet.d.ts +86 -0
  76. package/dist/components/recipes/calendar.d.ts +43 -0
  77. package/dist/components/recipes/dagre.d.ts +56 -0
  78. package/dist/components/recipes/flextree.d.ts +55 -0
  79. package/dist/components/recipes/marimekko.d.ts +55 -0
  80. package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
  81. package/dist/components/recipes/recipeUtils.d.ts +27 -0
  82. package/dist/components/recipes/waffle.d.ts +46 -0
  83. package/dist/components/semiotic-ai.d.ts +4 -0
  84. package/dist/components/semiotic-network.d.ts +3 -0
  85. package/dist/components/semiotic-ordinal.d.ts +3 -0
  86. package/dist/components/semiotic-recipes.d.ts +24 -0
  87. package/dist/components/semiotic-xy.d.ts +3 -0
  88. package/dist/components/semiotic.d.ts +2 -2
  89. package/dist/components/server/renderToStaticSVG.d.ts +8 -2
  90. package/dist/components/server/serverChartConfigs.d.ts +47 -1
  91. package/dist/components/server/staticAnnotations.d.ts +6 -0
  92. package/dist/components/store/ObservationStore.d.ts +1 -3
  93. package/dist/components/store/SelectionStore.d.ts +2 -4
  94. package/dist/components/store/ThemeStore.d.ts +4 -4
  95. package/dist/components/store/TooltipStore.d.ts +5 -3
  96. package/dist/components/store/createStore.d.ts +4 -2
  97. package/dist/components/store/useSelection.d.ts +7 -4
  98. package/dist/components/stream/CanvasHitTester.d.ts +10 -8
  99. package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
  100. package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
  101. package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
  102. package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
  103. package/dist/components/stream/NetworkSVGOverlay.d.ts +18 -12
  104. package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
  105. package/dist/components/stream/PipelineStore.d.ts +51 -0
  106. package/dist/components/stream/SVGOverlay.d.ts +12 -0
  107. package/dist/components/stream/SceneGraph.d.ts +15 -1
  108. package/dist/components/stream/SceneToSVG.d.ts +1 -1
  109. package/dist/components/stream/categoryDomain.d.ts +4 -0
  110. package/dist/components/stream/composeOverlays.d.ts +15 -0
  111. package/dist/components/stream/customLayout.d.ts +76 -0
  112. package/dist/components/stream/customLayoutPalette.d.ts +29 -0
  113. package/dist/components/stream/geoTypes.d.ts +33 -8
  114. package/dist/components/stream/hoverUtils.d.ts +4 -10
  115. package/dist/components/stream/keyboardNav.d.ts +18 -6
  116. package/dist/components/stream/networkCustomLayout.d.ts +67 -0
  117. package/dist/components/stream/networkTypes.d.ts +87 -21
  118. package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
  119. package/dist/components/stream/ordinalTypes.d.ts +47 -13
  120. package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
  121. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
  122. package/dist/components/stream/sampleCurvePath.d.ts +9 -0
  123. package/dist/components/stream/types.d.ts +57 -10
  124. package/dist/components/stream/useHydration.d.ts +89 -0
  125. package/dist/components/stream/useStableShallow.d.ts +1 -0
  126. package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
  127. package/dist/geo.min.js +2 -1
  128. package/dist/geo.module.min.js +2 -1
  129. package/dist/network.min.js +2 -1
  130. package/dist/network.module.min.js +2 -1
  131. package/dist/ordinal.min.js +2 -1
  132. package/dist/ordinal.module.min.js +2 -1
  133. package/dist/realtime.min.js +2 -1
  134. package/dist/realtime.module.min.js +2 -1
  135. package/dist/semiotic-ai.d.ts +69 -65
  136. package/dist/semiotic-ai.min.js +2 -1
  137. package/dist/semiotic-ai.module.min.js +2 -1
  138. package/dist/semiotic-data.d.ts +4 -4
  139. package/dist/semiotic-geo.d.ts +15 -15
  140. package/dist/semiotic-network.d.ts +19 -16
  141. package/dist/semiotic-ordinal.d.ts +31 -28
  142. package/dist/semiotic-realtime.d.ts +17 -17
  143. package/dist/semiotic-recipes.d.ts +24 -0
  144. package/dist/semiotic-recipes.min.js +1 -0
  145. package/dist/semiotic-recipes.module.min.js +1 -0
  146. package/dist/semiotic-server.d.ts +6 -6
  147. package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
  148. package/dist/semiotic-themes.d.ts +3 -3
  149. package/dist/semiotic-themes.min.js +2 -1
  150. package/dist/semiotic-themes.module.min.js +2 -1
  151. package/dist/semiotic-utils.d.ts +23 -23
  152. package/dist/semiotic-utils.min.js +2 -1
  153. package/dist/semiotic-utils.module.min.js +2 -1
  154. package/dist/semiotic-xy.d.ts +27 -24
  155. package/dist/semiotic.d.ts +63 -63
  156. package/dist/semiotic.min.js +2 -1
  157. package/dist/semiotic.module.min.js +2 -1
  158. package/dist/server.min.js +1 -1
  159. package/dist/server.module.min.js +1 -1
  160. package/dist/test-utils/canvasMock.d.ts +34 -5
  161. package/dist/xy.min.js +2 -1
  162. package/dist/xy.module.min.js +2 -1
  163. package/package.json +40 -20
  164. package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
@@ -51,6 +51,46 @@ export interface FunnelChartProps<TDatum extends Datum = Datum> extends BaseChar
51
51
  * **Vertical** (`orientation="vertical"`): vertical bars with hatched
52
52
  * dropoff stacking. Each bar shows retained (solid) + dropoff from
53
53
  * previous step (hatched). Multi-category renders grouped bars.
54
+ *
55
+ * For multi-step many-source flows prefer {@link SankeyDiagram}.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * // Classic conversion funnel
60
+ * <FunnelChart
61
+ * data={[
62
+ * { step: "Visit", users: 5000 },
63
+ * { step: "Signup", users: 3200 },
64
+ * { step: "Activate", users: 1800 },
65
+ * { step: "Upgrade", users: 240 },
66
+ * ]}
67
+ * stepAccessor="step"
68
+ * valueAccessor="users"
69
+ * />
70
+ * ```
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * // Vertical orientation showing absolute drop-off
75
+ * <FunnelChart
76
+ * data={steps}
77
+ * stepAccessor="step"
78
+ * valueAccessor="users"
79
+ * orientation="vertical"
80
+ * connectorOpacity={0.3}
81
+ * />
82
+ * ```
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * // Multi-category funnel — one funnel per cohort
87
+ * <FunnelChart
88
+ * data={cohortSteps}
89
+ * stepAccessor="step"
90
+ * valueAccessor="users"
91
+ * categoryAccessor="cohort"
92
+ * />
93
+ * ```
54
94
  */
55
95
  export declare const FunnelChart: {
56
96
  <TDatum extends Datum = Datum>(props: FunnelChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -50,6 +50,51 @@ export interface GaugeChartProps extends BaseChartProps {
50
50
  /** frameProps escape hatch */
51
51
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
52
52
  }
53
+ /**
54
+ * GaugeChart - A single-value indicator with an optional needle and threshold zones.
55
+ *
56
+ * Pass a `value` between `min` and `max`; threshold zones color the arc
57
+ * by status. Useful for KPI tiles, health-check displays, and scorecards.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * // Simple gauge with threshold zones
62
+ * <GaugeChart
63
+ * value={72}
64
+ * min={0}
65
+ * max={100}
66
+ * thresholds={[
67
+ * { value: 60, color: "#22c55e", label: "ok" },
68
+ * { value: 80, color: "#f59e0b", label: "warn" },
69
+ * { value: 100, color: "#ef4444", label: "crit" },
70
+ * ]}
71
+ * />
72
+ * ```
73
+ *
74
+ * @example
75
+ * ```tsx
76
+ * // Half-sweep gauge with center value text
77
+ * <GaugeChart
78
+ * value={42}
79
+ * min={0}
80
+ * max={100}
81
+ * sweep={Math.PI}
82
+ * arcWidth={20}
83
+ * centerContent={<text fontSize={32}>42%</text>}
84
+ * />
85
+ * ```
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * // Hide needle, fill the zone-of-current-value instead
90
+ * <GaugeChart
91
+ * value={87}
92
+ * thresholds={[{ value: 50, color: "#22c55e" }, { value: 90, color: "#f59e0b" }, { value: 100, color: "#ef4444" }]}
93
+ * showNeedle={false}
94
+ * fillZones
95
+ * />
96
+ * ```
97
+ */
53
98
  export declare const GaugeChart: {
54
99
  (props: GaugeChartProps & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
55
100
  displayName?: string;
@@ -34,6 +34,44 @@ export interface GroupedBarChartProps<TDatum extends Datum = Datum> extends Base
34
34
  categoryFormat?: CategoryFormatFn;
35
35
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
36
36
  }
37
+ /**
38
+ * GroupedBarChart - Multiple bars per category, side by side.
39
+ *
40
+ * Each row contributes to one bar inside the group named by
41
+ * `categoryAccessor`; `groupBy` splits each category into the
42
+ * side-by-side series. Use {@link StackedBarChart} when group totals
43
+ * matter more than individual values.
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * // Quarterly revenue by region
48
+ * <GroupedBarChart
49
+ * data={[
50
+ * { quarter: "Q1", region: "EMEA", revenue: 120 },
51
+ * { quarter: "Q1", region: "Americas", revenue: 95 },
52
+ * { quarter: "Q2", region: "EMEA", revenue: 140 },
53
+ * { quarter: "Q2", region: "Americas", revenue: 110 },
54
+ * ]}
55
+ * categoryAccessor="quarter"
56
+ * valueAccessor="revenue"
57
+ * groupBy="region"
58
+ * showLegend
59
+ * />
60
+ * ```
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * // Custom palette + sorted categories
65
+ * <GroupedBarChart
66
+ * data={data}
67
+ * categoryAccessor="quarter"
68
+ * valueAccessor="revenue"
69
+ * groupBy="region"
70
+ * colorScheme={["#3b82f6", "#22c55e", "#ef4444"]}
71
+ * sort="asc"
72
+ * />
73
+ * ```
74
+ */
37
75
  export declare const GroupedBarChart: {
38
76
  <TDatum extends Datum = Datum>(props: GroupedBarChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
39
77
  displayName?: string;
@@ -5,11 +5,45 @@ import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
5
5
  import type { BaseChartProps, ChartAccessor, CategoryFormatFn } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
+ /**
9
+ * Histogram component props
10
+ */
8
11
  export interface HistogramProps<TDatum extends Datum = Datum> extends BaseChartProps {
12
+ /**
13
+ * Array of rows. Either pre-binned (one row per bar with a category +
14
+ * count) or raw observations the chart will bin via `valueAccessor`.
15
+ * @example
16
+ * ```ts
17
+ * // Raw observations — chart bins them
18
+ * [{ value: 12 }, { value: 18 }, { value: 22 }, ...]
19
+ * // Or pre-binned
20
+ * [{ bucket: "0–10", count: 3 }, { bucket: "10–20", count: 7 }]
21
+ * ```
22
+ */
9
23
  data?: TDatum[];
24
+ /**
25
+ * Field name or function returning the bin label (used when data is
26
+ * already binned). Ignored when binning raw values.
27
+ * @default "category"
28
+ */
10
29
  categoryAccessor?: ChartAccessor<TDatum, string>;
30
+ /**
31
+ * Field name or function returning the numeric value to bin (raw mode)
32
+ * or the count for each bin (pre-binned mode).
33
+ * @default "value"
34
+ */
11
35
  valueAccessor?: ChartAccessor<TDatum, number>;
36
+ /**
37
+ * Number of equal-width bins for raw-data mode. Ignored when data is
38
+ * already binned.
39
+ * @default 25
40
+ */
12
41
  bins?: number;
42
+ /**
43
+ * Render bin heights as fraction of total instead of absolute counts.
44
+ * Y-axis becomes [0, 1].
45
+ * @default false
46
+ */
13
47
  relative?: boolean;
14
48
  categoryLabel?: string;
15
49
  valueLabel?: string;
@@ -40,6 +74,67 @@ export interface HistogramProps<TDatum extends Datum = Datum> extends BaseChartP
40
74
  categoryFormat?: CategoryFormatFn;
41
75
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
42
76
  }
77
+ /**
78
+ * Histogram - Visualize the distribution of a continuous variable as bars.
79
+ *
80
+ * Always horizontal-bars-by-value-axis style. Either bin raw observations
81
+ * via `bins` and `valueAccessor`, or pass pre-binned rows directly. Use
82
+ * `relative` to convert counts to a fraction of total.
83
+ *
84
+ * For comparison across multiple distributions overlaid, prefer
85
+ * {@link RidgelinePlot} (one row per group, stacked) or
86
+ * {@link ViolinPlot} (mirrored density per group).
87
+ *
88
+ * @example
89
+ * ```tsx
90
+ * // Bin raw observations
91
+ * <Histogram
92
+ * data={observations} // [{ value: 12 }, { value: 18 }, ...]
93
+ * valueAccessor="value"
94
+ * bins={20}
95
+ * />
96
+ * ```
97
+ *
98
+ * @example
99
+ * ```tsx
100
+ * // Pre-binned data
101
+ * <Histogram
102
+ * data={[
103
+ * { bucket: "0–10", count: 3 },
104
+ * { bucket: "10–20", count: 7 },
105
+ * { bucket: "20–30", count: 5 },
106
+ * ]}
107
+ * categoryAccessor="bucket"
108
+ * valueAccessor="count"
109
+ * />
110
+ * ```
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * // Brush to select a value range; receives the brushed extent
115
+ * <Histogram
116
+ * data={observations}
117
+ * valueAccessor="value"
118
+ * brush
119
+ * onBrush={(extent) => console.log(extent?.r)}
120
+ * />
121
+ * ```
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * // Relative frequencies (fractions of total)
126
+ * <Histogram
127
+ * data={observations}
128
+ * valueAccessor="value"
129
+ * bins={30}
130
+ * relative
131
+ * />
132
+ * ```
133
+ *
134
+ * @remarks
135
+ * For streaming distributions (window-based binning over a live data
136
+ * stream), use {@link RealtimeHistogram} from `semiotic/realtime` instead.
137
+ */
43
138
  export declare const Histogram: {
44
139
  <TDatum extends Datum = Datum>(props: HistogramProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
45
140
  displayName?: string;
@@ -92,6 +92,48 @@ export interface LikertChartProps<TDatum extends Datum = Datum> extends BaseChar
92
92
  export interface LikertChartHandle extends RealtimeFrameHandle {
93
93
  getScales(): ReturnType<NonNullable<StreamOrdinalFrameHandle["getScales"]>>;
94
94
  }
95
+ /**
96
+ * LikertChart - Diverging stacked bars for ordered survey responses.
97
+ *
98
+ * Each category (question) gets a horizontal bar where positive responses
99
+ * extend right and negative responses extend left, centered on the
100
+ * midpoint of the `levels` ordering. Best for 5-point or 7-point Likert
101
+ * scales where you want to see net sentiment at a glance.
102
+ *
103
+ * Two data shapes are supported: pre-aggregated (one row per
104
+ * category × level via `levelAccessor` + `countAccessor`) or raw
105
+ * observations (one row per response via `valueAccessor`).
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * // Pre-aggregated: question × level × count
110
+ * <LikertChart
111
+ * data={[
112
+ * { question: "Easy to use", level: "Strongly Agree", count: 12 },
113
+ * { question: "Easy to use", level: "Agree", count: 30 },
114
+ * { question: "Easy to use", level: "Neutral", count: 8 },
115
+ * { question: "Easy to use", level: "Disagree", count: 4 },
116
+ * { question: "Easy to use", level: "Strongly Disagree", count: 1 },
117
+ * ]}
118
+ * categoryAccessor="question"
119
+ * levelAccessor="level"
120
+ * countAccessor="count"
121
+ * levels={["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"]}
122
+ * />
123
+ * ```
124
+ *
125
+ * @example
126
+ * ```tsx
127
+ * // Raw observations: one row per response
128
+ * <LikertChart
129
+ * data={surveyResponses}
130
+ * categoryAccessor="question"
131
+ * valueAccessor="response"
132
+ * levels={["Never", "Rarely", "Sometimes", "Often", "Always"]}
133
+ * colorScheme="RdYlGn"
134
+ * />
135
+ * ```
136
+ */
95
137
  export declare const LikertChart: {
96
138
  <TDatum extends Datum = Datum>(props: LikertChartProps<TDatum> & React.RefAttributes<LikertChartHandle>): React.ReactElement | null;
97
139
  displayName?: string;
@@ -5,14 +5,51 @@ import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
5
5
  import type { BaseChartProps, ChartAccessor } from "../shared/types";
6
6
  import { type TooltipProp } from "../../Tooltip/Tooltip";
7
7
  import type { RealtimeFrameHandle } from "../../realtime/types";
8
+ /**
9
+ * PieChart component props
10
+ */
8
11
  export interface PieChartProps<TDatum extends Datum = Datum> extends BaseChartProps {
12
+ /**
13
+ * Array of category rows. Each row should have a category and a numeric
14
+ * value; values determine relative wedge size. Omit when using the push API.
15
+ * @example
16
+ * ```ts
17
+ * [{ region: "EMEA", revenue: 120 }, { region: "Americas", revenue: 85 }]
18
+ * ```
19
+ */
9
20
  data?: TDatum[];
21
+ /**
22
+ * Field name or function returning the wedge label.
23
+ * @default "category"
24
+ */
10
25
  categoryAccessor?: ChartAccessor<TDatum, string>;
26
+ /**
27
+ * Field name or function returning the wedge value (slice size). Values
28
+ * are aggregated by absolute magnitude (`Math.abs`), so negative inputs
29
+ * render as positive-sized wedges. If your data has signed values you
30
+ * need to differentiate, sign-encode via `colorBy` or pre-process.
31
+ * @default "value"
32
+ */
11
33
  valueAccessor?: ChartAccessor<TDatum, number>;
34
+ /**
35
+ * Field or function that determines wedge color. Defaults to coloring by
36
+ * `categoryAccessor` since pies are inherently categorical.
37
+ */
12
38
  colorBy?: ChartAccessor<TDatum, string>;
39
+ /**
40
+ * Color scheme for `colorBy`. Either a d3 scheme name (`"category10"`,
41
+ * `"set2"`, etc.) or an explicit array of colors. Falls back to the
42
+ * theme's categorical palette when omitted.
43
+ */
13
44
  colorScheme?: string | string[];
45
+ /**
46
+ * Rotation in **degrees** applied to the first wedge. `0` starts at 12
47
+ * o'clock and proceeds clockwise; `90` starts at 3 o'clock, `180` at 6
48
+ * o'clock, `270` at 9 o'clock.
49
+ * @default 0
50
+ */
14
51
  startAngle?: number;
15
- /** Rounded corner radius on wedge arcs */
52
+ /** Rounded corner radius on wedge arcs (pixels). */
16
53
  cornerRadius?: number;
17
54
  enableHover?: boolean;
18
55
  showCategoryTicks?: boolean;
@@ -23,6 +60,58 @@ export interface PieChartProps<TDatum extends Datum = Datum> extends BaseChartPr
23
60
  annotations?: Datum[];
24
61
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
25
62
  }
63
+ /**
64
+ * PieChart - Visualize a single categorical distribution as wedges of a circle.
65
+ *
66
+ * Each row becomes one wedge sized by `valueAccessor`. Best for ≤7 categories;
67
+ * with more, prefer {@link BarChart} or {@link DonutChart} for legibility.
68
+ *
69
+ * For a pie with a hole and center content, use {@link DonutChart}.
70
+ *
71
+ * @example
72
+ * ```tsx
73
+ * // Simple pie
74
+ * <PieChart
75
+ * data={[
76
+ * { region: "EMEA", revenue: 120 },
77
+ * { region: "Americas", revenue: 85 },
78
+ * { region: "APAC", revenue: 60 },
79
+ * ]}
80
+ * categoryAccessor="region"
81
+ * valueAccessor="revenue"
82
+ * />
83
+ * ```
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * // Custom palette + rounded wedges + start angle
88
+ * <PieChart
89
+ * data={data}
90
+ * categoryAccessor="region"
91
+ * valueAccessor="revenue"
92
+ * colorScheme={["#1f77b4", "#ff7f0e", "#2ca02c"]}
93
+ * cornerRadius={4}
94
+ * startAngle={90}
95
+ * showLegend
96
+ * />
97
+ * ```
98
+ *
99
+ * @example
100
+ * ```tsx
101
+ * // Hover highlight + click handler
102
+ * <PieChart
103
+ * data={data}
104
+ * categoryAccessor="region"
105
+ * valueAccessor="revenue"
106
+ * hoverHighlight
107
+ * onClick={(d) => console.log("clicked region:", d)}
108
+ * />
109
+ * ```
110
+ *
111
+ * @remarks
112
+ * Wraps {@link StreamOrdinalFrame} with pie-specific defaults. See
113
+ * {@link https://semiotic.nteract.io/charts/pie-chart} for live demos.
114
+ */
26
115
  export declare const PieChart: {
27
116
  <TDatum extends Datum = Datum>(props: PieChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
28
117
  displayName?: string;
@@ -36,6 +36,33 @@ export interface RidgelinePlotProps<TDatum extends Datum = Datum> extends BaseCh
36
36
  *
37
37
  * Each category shows its value distribution as a filled area extending from a
38
38
  * baseline. The amplitude prop controls overlap between rows.
39
+ *
40
+ * Compare with {@link ViolinPlot} (mirrored, side-by-side) and
41
+ * {@link BoxPlot} (five-number summaries only). Best for ≤30 categories
42
+ * with enough observations per category to estimate density.
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * // Test scores per class — distributions stacked vertically
47
+ * <RidgelinePlot
48
+ * data={observations}
49
+ * categoryAccessor="class"
50
+ * valueAccessor="score"
51
+ * bins={30}
52
+ * />
53
+ * ```
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * // More overlap (denser packing) + smooth curve
58
+ * <RidgelinePlot
59
+ * data={observations}
60
+ * categoryAccessor="month"
61
+ * valueAccessor="temperature"
62
+ * amplitude={2.5}
63
+ * curve="monotoneX"
64
+ * />
65
+ * ```
39
66
  */
40
67
  export declare const RidgelinePlot: {
41
68
  <TDatum extends Datum = Datum>(props: RidgelinePlotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -35,6 +35,44 @@ export interface StackedBarChartProps<TDatum extends Datum = Datum> extends Base
35
35
  categoryFormat?: CategoryFormatFn;
36
36
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
37
37
  }
38
+ /**
39
+ * StackedBarChart - Categorical bars split into stacked segments.
40
+ *
41
+ * Each row contributes one segment of the bar named by `categoryAccessor`;
42
+ * `stackBy` chooses which series the segment belongs to. Use
43
+ * {@link GroupedBarChart} when individual segment values matter more than
44
+ * the total; pass `normalize` to compare composition rather than absolute
45
+ * size.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // Quarterly revenue split by region
50
+ * <StackedBarChart
51
+ * data={[
52
+ * { quarter: "Q1", region: "EMEA", revenue: 120 },
53
+ * { quarter: "Q1", region: "Americas", revenue: 95 },
54
+ * { quarter: "Q2", region: "EMEA", revenue: 140 },
55
+ * { quarter: "Q2", region: "Americas", revenue: 110 },
56
+ * ]}
57
+ * categoryAccessor="quarter"
58
+ * valueAccessor="revenue"
59
+ * stackBy="region"
60
+ * showLegend
61
+ * />
62
+ * ```
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * // Normalized to 100% — focus on composition
67
+ * <StackedBarChart
68
+ * data={data}
69
+ * categoryAccessor="quarter"
70
+ * valueAccessor="revenue"
71
+ * stackBy="region"
72
+ * normalize
73
+ * />
74
+ * ```
75
+ */
38
76
  export declare const StackedBarChart: {
39
77
  <TDatum extends Datum = Datum>(props: StackedBarChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
40
78
  displayName?: string;
@@ -43,6 +43,42 @@ export interface SwarmPlotProps<TDatum extends Datum = Datum> extends BaseChartP
43
43
  categoryFormat?: CategoryFormatFn;
44
44
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
45
45
  }
46
+ /**
47
+ * SwarmPlot - Show every individual observation per category as a beeswarm.
48
+ *
49
+ * Points are placed along the value axis and offset perpendicular to it
50
+ * to avoid overlap, producing a packed cluster per category. Best for
51
+ * datasets where you want both the distribution shape AND the individual
52
+ * observations visible — typically dozens to a few thousand points.
53
+ *
54
+ * For aggregate distribution shape only, prefer {@link ViolinPlot},
55
+ * {@link BoxPlot}, or {@link RidgelinePlot}.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * // Reaction-time observations per cohort
60
+ * <SwarmPlot
61
+ * data={observations}
62
+ * categoryAccessor="cohort"
63
+ * valueAccessor="reactionTime"
64
+ * pointRadius={3}
65
+ * />
66
+ * ```
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * // Color by group within each category, sized by weight
71
+ * <SwarmPlot
72
+ * data={observations}
73
+ * categoryAccessor="condition"
74
+ * valueAccessor="score"
75
+ * colorBy="group"
76
+ * sizeBy="weight"
77
+ * sizeRange={[2, 10]}
78
+ * showLegend
79
+ * />
80
+ * ```
81
+ */
46
82
  export declare const SwarmPlot: {
47
83
  <TDatum extends Datum = Datum>(props: SwarmPlotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
48
84
  displayName?: string;
@@ -61,9 +61,69 @@ export interface SwimlaneChartProps<TDatum extends Datum = Datum> extends BaseCh
61
61
  rTickValues?: number[];
62
62
  /** Align first value tick label to start, last to end. Prevents clipping at chart edges. */
63
63
  tickLabelEdgeAlign?: boolean;
64
+ /** Gradient fill for swimlane segments. `true` uses tip→base opacity ramp;
65
+ * pass `{ topOpacity, bottomOpacity }` for a uniform alpha gradient or
66
+ * `{ colorStops }` for a multi-stop color ramp. Same shape as
67
+ * BarChart.gradientFill / AreaChart.gradientFill. The gradient runs along
68
+ * the lane's growth direction (left→right horizontal, bottom→top vertical). */
69
+ gradientFill?: boolean | {
70
+ topOpacity: number;
71
+ bottomOpacity: number;
72
+ } | {
73
+ colorStops: Array<{
74
+ offset: number;
75
+ color: string;
76
+ }>;
77
+ };
78
+ /** Lane "track" fill — a rect drawn behind each lane spanning the full
79
+ * value-axis range, sized to the lane's bandwidth. Lets budget/progress
80
+ * lanes read as filled vs. empty. Pass a color string (CSS vars
81
+ * supported, e.g. `"var(--semiotic-grid)"`) or `{ color, opacity }`. */
82
+ trackFill?: string | {
83
+ color: string;
84
+ opacity?: number;
85
+ };
64
86
  /** Pass-through props to StreamOrdinalFrame */
65
87
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
66
88
  }
89
+ /**
90
+ * SwimlaneChart - Range bars per category (swim lane), one segment per row.
91
+ *
92
+ * Each row becomes a horizontal segment in the lane named by
93
+ * `categoryAccessor`; `subcategoryAccessor` chooses the segment label
94
+ * within the lane. Useful for project timelines, status histories,
95
+ * Gantt-like views, and per-resource workloads.
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * // Project task ranges per assignee
100
+ * <SwimlaneChart
101
+ * data={[
102
+ * { team: "Design", task: "Spec", value: 8 },
103
+ * { team: "Design", task: "Mocks", value: 12 },
104
+ * { team: "Eng", task: "API", value: 16 },
105
+ * { team: "Eng", task: "Client", value: 10 },
106
+ * { team: "QA", task: "Plan", value: 4 },
107
+ * ]}
108
+ * categoryAccessor="team"
109
+ * subcategoryAccessor="task"
110
+ * valueAccessor="value"
111
+ * />
112
+ * ```
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * // Color by subcategory + custom label rotation
117
+ * <SwimlaneChart
118
+ * data={data}
119
+ * categoryAccessor="team"
120
+ * subcategoryAccessor="task"
121
+ * valueAccessor="hours"
122
+ * colorBy="task"
123
+ * showLegend
124
+ * />
125
+ * ```
126
+ */
67
127
  export declare const SwimlaneChart: {
68
128
  <TDatum extends Datum = Datum>(props: SwimlaneChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
69
129
  displayName?: string;
@@ -42,6 +42,38 @@ export interface ViolinPlotProps<TDatum extends Datum = Datum> extends BaseChart
42
42
  categoryFormat?: CategoryFormatFn;
43
43
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
44
44
  }
45
+ /**
46
+ * ViolinPlot - Mirrored density curves per category for distribution shape.
47
+ *
48
+ * Each category gets a symmetric kernel density estimate, optionally with
49
+ * a {@link BoxPlot}-style IQR overlay (`showIQR`). Compare with
50
+ * {@link RidgelinePlot} (stacked, single-sided), {@link BoxPlot} (summary
51
+ * only), or {@link SwarmPlot} (every observation visible).
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * // Reaction-time distribution per cohort
56
+ * <ViolinPlot
57
+ * data={observations}
58
+ * categoryAccessor="cohort"
59
+ * valueAccessor="reactionTime"
60
+ * bins={40}
61
+ * />
62
+ * ```
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * // Smoother curve + IQR overlay
67
+ * <ViolinPlot
68
+ * data={observations}
69
+ * categoryAccessor="condition"
70
+ * valueAccessor="score"
71
+ * curve="monotoneX"
72
+ * showIQR
73
+ * colorBy="condition"
74
+ * />
75
+ * ```
76
+ */
45
77
  export declare const ViolinPlot: {
46
78
  <TDatum extends Datum = Datum>(props: ViolinPlotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
47
79
  displayName?: string;
@@ -108,16 +108,34 @@ export interface RealtimeHeatmapProps<TDatum extends Datum = Datum> {
108
108
  *
109
109
  * @example
110
110
  * ```tsx
111
+ * // Count-aggregated heatmap — each push lands in a (time-bin × value-bin) cell
111
112
  * const ref = useRef<RealtimeFrameHandle>(null)
112
- * ref.current.push({ time: Date.now(), x: 42, y: 7 })
113
+ * useEffect(() => {
114
+ * const id = setInterval(() => ref.current?.push({ time: Date.now(), y: Math.random() * 10 }), 50)
115
+ * return () => clearInterval(id)
116
+ * }, [])
117
+ * return (
118
+ * <RealtimeHeatmap
119
+ * ref={ref}
120
+ * timeAccessor="time"
121
+ * valueAccessor="y"
122
+ * heatmapXBins={30}
123
+ * heatmapYBins={20}
124
+ * aggregation="count"
125
+ * />
126
+ * )
127
+ * ```
113
128
  *
129
+ * @example
130
+ * ```tsx
131
+ * // Mean aggregation with a sequential color scheme; useful for sensor density maps
114
132
  * <RealtimeHeatmap
115
133
  * ref={ref}
116
134
  * timeAccessor="time"
117
135
  * valueAccessor="y"
118
- * heatmapXBins={30}
119
- * heatmapYBins={20}
120
- * aggregation="count"
136
+ * aggregation="mean"
137
+ * colorScheme="viridis"
138
+ * windowSize={500}
121
139
  * />
122
140
  * ```
123
141
  */