semiotic 3.4.2 → 3.5.1

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 (163) 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 +113 -1
  28. package/dist/components/charts/ordinal/BoxPlot.d.ts +33 -0
  29. package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
  30. package/dist/components/charts/ordinal/DotPlot.d.ts +33 -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 +40 -0
  34. package/dist/components/charts/ordinal/Histogram.d.ts +97 -0
  35. package/dist/components/charts/ordinal/LikertChart.d.ts +44 -0
  36. package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
  37. package/dist/components/charts/ordinal/RidgelinePlot.d.ts +29 -0
  38. package/dist/components/charts/ordinal/StackedBarChart.d.ts +40 -0
  39. package/dist/components/charts/ordinal/SwarmPlot.d.ts +38 -0
  40. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +62 -0
  41. package/dist/components/charts/ordinal/ViolinPlot.d.ts +34 -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 +67 -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 +44 -1
  65. package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
  66. package/dist/components/charts/xy/CandlestickChart.d.ts +37 -6
  67. package/dist/components/charts/xy/ConnectedScatterplot.d.ts +28 -0
  68. package/dist/components/charts/xy/Heatmap.d.ts +4 -0
  69. package/dist/components/charts/xy/LineChart.d.ts +12 -0
  70. package/dist/components/charts/xy/MinimapChart.d.ts +58 -0
  71. package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
  72. package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
  73. package/dist/components/charts/xy/Scatterplot.d.ts +38 -2
  74. package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
  75. package/dist/components/charts/xy/StackedAreaChart.d.ts +61 -1
  76. package/dist/components/realtime/types.d.ts +2 -4
  77. package/dist/components/recipes/bullet.d.ts +86 -0
  78. package/dist/components/recipes/calendar.d.ts +43 -0
  79. package/dist/components/recipes/dagre.d.ts +56 -0
  80. package/dist/components/recipes/flextree.d.ts +55 -0
  81. package/dist/components/recipes/marimekko.d.ts +55 -0
  82. package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
  83. package/dist/components/recipes/recipeUtils.d.ts +27 -0
  84. package/dist/components/recipes/waffle.d.ts +46 -0
  85. package/dist/components/semiotic-ai.d.ts +4 -0
  86. package/dist/components/semiotic-network.d.ts +3 -0
  87. package/dist/components/semiotic-ordinal.d.ts +3 -0
  88. package/dist/components/semiotic-recipes.d.ts +24 -0
  89. package/dist/components/semiotic-xy.d.ts +3 -0
  90. package/dist/components/semiotic.d.ts +2 -2
  91. package/dist/components/server/renderToStaticSVG.d.ts +8 -2
  92. package/dist/components/server/serverChartConfigs.d.ts +47 -1
  93. package/dist/components/server/staticAnnotations.d.ts +6 -0
  94. package/dist/components/store/ObservationStore.d.ts +1 -3
  95. package/dist/components/store/SelectionStore.d.ts +1 -3
  96. package/dist/components/store/ThemeStore.d.ts +4 -4
  97. package/dist/components/store/TooltipStore.d.ts +1 -3
  98. package/dist/components/store/createStore.d.ts +4 -2
  99. package/dist/components/stream/CanvasHitTester.d.ts +10 -8
  100. package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
  101. package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
  102. package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
  103. package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
  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 +13 -0
  114. package/dist/components/stream/hoverUtils.d.ts +4 -10
  115. package/dist/components/stream/networkCustomLayout.d.ts +67 -0
  116. package/dist/components/stream/networkTypes.d.ts +45 -0
  117. package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
  118. package/dist/components/stream/ordinalTypes.d.ts +35 -1
  119. package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
  120. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
  121. package/dist/components/stream/sampleCurvePath.d.ts +9 -0
  122. package/dist/components/stream/types.d.ts +44 -1
  123. package/dist/components/stream/useHydration.d.ts +89 -0
  124. package/dist/components/stream/useStableShallow.d.ts +1 -0
  125. package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
  126. package/dist/geo.min.js +2 -1
  127. package/dist/geo.module.min.js +2 -1
  128. package/dist/network.min.js +2 -1
  129. package/dist/network.module.min.js +2 -1
  130. package/dist/ordinal.min.js +2 -1
  131. package/dist/ordinal.module.min.js +2 -1
  132. package/dist/realtime.min.js +2 -1
  133. package/dist/realtime.module.min.js +2 -1
  134. package/dist/semiotic-ai.d.ts +69 -65
  135. package/dist/semiotic-ai.min.js +2 -1
  136. package/dist/semiotic-ai.module.min.js +2 -1
  137. package/dist/semiotic-data.d.ts +4 -4
  138. package/dist/semiotic-geo.d.ts +15 -15
  139. package/dist/semiotic-network.d.ts +19 -16
  140. package/dist/semiotic-ordinal.d.ts +31 -28
  141. package/dist/semiotic-realtime.d.ts +17 -17
  142. package/dist/semiotic-recipes.d.ts +24 -0
  143. package/dist/semiotic-recipes.min.js +1 -0
  144. package/dist/semiotic-recipes.module.min.js +1 -0
  145. package/dist/semiotic-server.d.ts +6 -6
  146. package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
  147. package/dist/semiotic-themes.d.ts +3 -3
  148. package/dist/semiotic-themes.min.js +2 -1
  149. package/dist/semiotic-themes.module.min.js +2 -1
  150. package/dist/semiotic-utils.d.ts +23 -23
  151. package/dist/semiotic-utils.min.js +2 -1
  152. package/dist/semiotic-utils.module.min.js +2 -1
  153. package/dist/semiotic-xy.d.ts +27 -24
  154. package/dist/semiotic.d.ts +63 -63
  155. package/dist/semiotic.min.js +2 -1
  156. package/dist/semiotic.module.min.js +2 -1
  157. package/dist/server.min.js +1 -1
  158. package/dist/server.module.min.js +1 -1
  159. package/dist/test-utils/canvasMock.d.ts +34 -5
  160. package/dist/xy.min.js +2 -1
  161. package/dist/xy.module.min.js +2 -1
  162. package/package.json +38 -17
  163. 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;
@@ -32,8 +32,48 @@ export interface GroupedBarChartProps<TDatum extends Datum = Datum> extends Base
32
32
  annotations?: Datum[];
33
33
  /** Custom formatter for category tick labels */
34
34
  categoryFormat?: CategoryFormatFn;
35
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
36
+ valueExtent?: [number | undefined, number | undefined] | [number];
35
37
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
36
38
  }
39
+ /**
40
+ * GroupedBarChart - Multiple bars per category, side by side.
41
+ *
42
+ * Each row contributes to one bar inside the group named by
43
+ * `categoryAccessor`; `groupBy` splits each category into the
44
+ * side-by-side series. Use {@link StackedBarChart} when group totals
45
+ * matter more than individual values.
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * // Quarterly revenue by region
50
+ * <GroupedBarChart
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
+ * groupBy="region"
60
+ * showLegend
61
+ * />
62
+ * ```
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * // Custom palette + sorted categories
67
+ * <GroupedBarChart
68
+ * data={data}
69
+ * categoryAccessor="quarter"
70
+ * valueAccessor="revenue"
71
+ * groupBy="region"
72
+ * colorScheme={["#3b82f6", "#22c55e", "#ef4444"]}
73
+ * sort="asc"
74
+ * />
75
+ * ```
76
+ */
37
77
  export declare const GroupedBarChart: {
38
78
  <TDatum extends Datum = Datum>(props: GroupedBarChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
39
79
  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;
@@ -38,8 +72,71 @@ export interface HistogramProps<TDatum extends Datum = Datum> extends BaseChartP
38
72
  };
39
73
  /** Custom formatter for category tick labels */
40
74
  categoryFormat?: CategoryFormatFn;
75
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. Wins over Histogram's auto-computed shared bin extent — useful for pinning the axis to a known range so streamed updates don't shift the bins as min/max drift. */
76
+ valueExtent?: [number | undefined, number | undefined] | [number];
41
77
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
42
78
  }
79
+ /**
80
+ * Histogram - Visualize the distribution of a continuous variable as bars.
81
+ *
82
+ * Always horizontal-bars-by-value-axis style. Either bin raw observations
83
+ * via `bins` and `valueAccessor`, or pass pre-binned rows directly. Use
84
+ * `relative` to convert counts to a fraction of total.
85
+ *
86
+ * For comparison across multiple distributions overlaid, prefer
87
+ * {@link RidgelinePlot} (one row per group, stacked) or
88
+ * {@link ViolinPlot} (mirrored density per group).
89
+ *
90
+ * @example
91
+ * ```tsx
92
+ * // Bin raw observations
93
+ * <Histogram
94
+ * data={observations} // [{ value: 12 }, { value: 18 }, ...]
95
+ * valueAccessor="value"
96
+ * bins={20}
97
+ * />
98
+ * ```
99
+ *
100
+ * @example
101
+ * ```tsx
102
+ * // Pre-binned data
103
+ * <Histogram
104
+ * data={[
105
+ * { bucket: "0–10", count: 3 },
106
+ * { bucket: "10–20", count: 7 },
107
+ * { bucket: "20–30", count: 5 },
108
+ * ]}
109
+ * categoryAccessor="bucket"
110
+ * valueAccessor="count"
111
+ * />
112
+ * ```
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * // Brush to select a value range; receives the brushed extent
117
+ * <Histogram
118
+ * data={observations}
119
+ * valueAccessor="value"
120
+ * brush
121
+ * onBrush={(extent) => console.log(extent?.r)}
122
+ * />
123
+ * ```
124
+ *
125
+ * @example
126
+ * ```tsx
127
+ * // Relative frequencies (fractions of total)
128
+ * <Histogram
129
+ * data={observations}
130
+ * valueAccessor="value"
131
+ * bins={30}
132
+ * relative
133
+ * />
134
+ * ```
135
+ *
136
+ * @remarks
137
+ * For streaming distributions (window-based binning over a live data
138
+ * stream), use {@link RealtimeHistogram} from `semiotic/realtime` instead.
139
+ */
43
140
  export declare const Histogram: {
44
141
  <TDatum extends Datum = Datum>(props: HistogramProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
45
142
  displayName?: string;
@@ -87,11 +87,55 @@ export interface LikertChartProps<TDatum extends Datum = Datum> extends BaseChar
87
87
  annotations?: Datum[];
88
88
  /** Custom formatter for category tick labels */
89
89
  categoryFormat?: CategoryFormatFn;
90
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. Likert is normally pinned to symmetric proportions; pass `valueExtent` to override. */
91
+ valueExtent?: [number | undefined, number | undefined] | [number];
90
92
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
91
93
  }
92
94
  export interface LikertChartHandle extends RealtimeFrameHandle {
93
95
  getScales(): ReturnType<NonNullable<StreamOrdinalFrameHandle["getScales"]>>;
94
96
  }
97
+ /**
98
+ * LikertChart - Diverging stacked bars for ordered survey responses.
99
+ *
100
+ * Each category (question) gets a horizontal bar where positive responses
101
+ * extend right and negative responses extend left, centered on the
102
+ * midpoint of the `levels` ordering. Best for 5-point or 7-point Likert
103
+ * scales where you want to see net sentiment at a glance.
104
+ *
105
+ * Two data shapes are supported: pre-aggregated (one row per
106
+ * category × level via `levelAccessor` + `countAccessor`) or raw
107
+ * observations (one row per response via `valueAccessor`).
108
+ *
109
+ * @example
110
+ * ```tsx
111
+ * // Pre-aggregated: question × level × count
112
+ * <LikertChart
113
+ * data={[
114
+ * { question: "Easy to use", level: "Strongly Agree", count: 12 },
115
+ * { question: "Easy to use", level: "Agree", count: 30 },
116
+ * { question: "Easy to use", level: "Neutral", count: 8 },
117
+ * { question: "Easy to use", level: "Disagree", count: 4 },
118
+ * { question: "Easy to use", level: "Strongly Disagree", count: 1 },
119
+ * ]}
120
+ * categoryAccessor="question"
121
+ * levelAccessor="level"
122
+ * countAccessor="count"
123
+ * levels={["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"]}
124
+ * />
125
+ * ```
126
+ *
127
+ * @example
128
+ * ```tsx
129
+ * // Raw observations: one row per response
130
+ * <LikertChart
131
+ * data={surveyResponses}
132
+ * categoryAccessor="question"
133
+ * valueAccessor="response"
134
+ * levels={["Never", "Rarely", "Sometimes", "Often", "Always"]}
135
+ * colorScheme="RdYlGn"
136
+ * />
137
+ * ```
138
+ */
95
139
  export declare const LikertChart: {
96
140
  <TDatum extends Datum = Datum>(props: LikertChartProps<TDatum> & React.RefAttributes<LikertChartHandle>): React.ReactElement | null;
97
141
  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;
@@ -29,6 +29,8 @@ export interface RidgelinePlotProps<TDatum extends Datum = Datum> extends BaseCh
29
29
  annotations?: Datum[];
30
30
  /** Custom formatter for category tick labels */
31
31
  categoryFormat?: CategoryFormatFn;
32
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
33
+ valueExtent?: [number | undefined, number | undefined] | [number];
32
34
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
33
35
  }
34
36
  /**
@@ -36,6 +38,33 @@ export interface RidgelinePlotProps<TDatum extends Datum = Datum> extends BaseCh
36
38
  *
37
39
  * Each category shows its value distribution as a filled area extending from a
38
40
  * baseline. The amplitude prop controls overlap between rows.
41
+ *
42
+ * Compare with {@link ViolinPlot} (mirrored, side-by-side) and
43
+ * {@link BoxPlot} (five-number summaries only). Best for ≤30 categories
44
+ * with enough observations per category to estimate density.
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * // Test scores per class — distributions stacked vertically
49
+ * <RidgelinePlot
50
+ * data={observations}
51
+ * categoryAccessor="class"
52
+ * valueAccessor="score"
53
+ * bins={30}
54
+ * />
55
+ * ```
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * // More overlap (denser packing) + smooth curve
60
+ * <RidgelinePlot
61
+ * data={observations}
62
+ * categoryAccessor="month"
63
+ * valueAccessor="temperature"
64
+ * amplitude={2.5}
65
+ * curve="monotoneX"
66
+ * />
67
+ * ```
39
68
  */
40
69
  export declare const RidgelinePlot: {
41
70
  <TDatum extends Datum = Datum>(props: RidgelinePlotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
@@ -33,8 +33,48 @@ export interface StackedBarChartProps<TDatum extends Datum = Datum> extends Base
33
33
  annotations?: Datum[];
34
34
  /** Custom formatter for category tick labels */
35
35
  categoryFormat?: CategoryFormatFn;
36
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. Stacked bars auto-extend the value domain to cover the cumulative stack unless `valueExtent` is fully specified. */
37
+ valueExtent?: [number | undefined, number | undefined] | [number];
36
38
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
37
39
  }
40
+ /**
41
+ * StackedBarChart - Categorical bars split into stacked segments.
42
+ *
43
+ * Each row contributes one segment of the bar named by `categoryAccessor`;
44
+ * `stackBy` chooses which series the segment belongs to. Use
45
+ * {@link GroupedBarChart} when individual segment values matter more than
46
+ * the total; pass `normalize` to compare composition rather than absolute
47
+ * size.
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * // Quarterly revenue split by region
52
+ * <StackedBarChart
53
+ * data={[
54
+ * { quarter: "Q1", region: "EMEA", revenue: 120 },
55
+ * { quarter: "Q1", region: "Americas", revenue: 95 },
56
+ * { quarter: "Q2", region: "EMEA", revenue: 140 },
57
+ * { quarter: "Q2", region: "Americas", revenue: 110 },
58
+ * ]}
59
+ * categoryAccessor="quarter"
60
+ * valueAccessor="revenue"
61
+ * stackBy="region"
62
+ * showLegend
63
+ * />
64
+ * ```
65
+ *
66
+ * @example
67
+ * ```tsx
68
+ * // Normalized to 100% — focus on composition
69
+ * <StackedBarChart
70
+ * data={data}
71
+ * categoryAccessor="quarter"
72
+ * valueAccessor="revenue"
73
+ * stackBy="region"
74
+ * normalize
75
+ * />
76
+ * ```
77
+ */
38
78
  export declare const StackedBarChart: {
39
79
  <TDatum extends Datum = Datum>(props: StackedBarChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
40
80
  displayName?: string;
@@ -41,8 +41,46 @@ export interface SwarmPlotProps<TDatum extends Datum = Datum> extends BaseChartP
41
41
  };
42
42
  /** Custom formatter for category tick labels */
43
43
  categoryFormat?: CategoryFormatFn;
44
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
45
+ valueExtent?: [number | undefined, number | undefined] | [number];
44
46
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
45
47
  }
48
+ /**
49
+ * SwarmPlot - Show every individual observation per category as a beeswarm.
50
+ *
51
+ * Points are placed along the value axis and offset perpendicular to it
52
+ * to avoid overlap, producing a packed cluster per category. Best for
53
+ * datasets where you want both the distribution shape AND the individual
54
+ * observations visible — typically dozens to a few thousand points.
55
+ *
56
+ * For aggregate distribution shape only, prefer {@link ViolinPlot},
57
+ * {@link BoxPlot}, or {@link RidgelinePlot}.
58
+ *
59
+ * @example
60
+ * ```tsx
61
+ * // Reaction-time observations per cohort
62
+ * <SwarmPlot
63
+ * data={observations}
64
+ * categoryAccessor="cohort"
65
+ * valueAccessor="reactionTime"
66
+ * pointRadius={3}
67
+ * />
68
+ * ```
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * // Color by group within each category, sized by weight
73
+ * <SwarmPlot
74
+ * data={observations}
75
+ * categoryAccessor="condition"
76
+ * valueAccessor="score"
77
+ * colorBy="group"
78
+ * sizeBy="weight"
79
+ * sizeRange={[2, 10]}
80
+ * showLegend
81
+ * />
82
+ * ```
83
+ */
46
84
  export declare const SwarmPlot: {
47
85
  <TDatum extends Datum = Datum>(props: SwarmPlotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
48
86
  displayName?: string;
@@ -61,9 +61,71 @@ 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
+ };
86
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
87
+ valueExtent?: [number | undefined, number | undefined] | [number];
64
88
  /** Pass-through props to StreamOrdinalFrame */
65
89
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
66
90
  }
91
+ /**
92
+ * SwimlaneChart - Range bars per category (swim lane), one segment per row.
93
+ *
94
+ * Each row becomes a horizontal segment in the lane named by
95
+ * `categoryAccessor`; `subcategoryAccessor` chooses the segment label
96
+ * within the lane. Useful for project timelines, status histories,
97
+ * Gantt-like views, and per-resource workloads.
98
+ *
99
+ * @example
100
+ * ```tsx
101
+ * // Project task ranges per assignee
102
+ * <SwimlaneChart
103
+ * data={[
104
+ * { team: "Design", task: "Spec", value: 8 },
105
+ * { team: "Design", task: "Mocks", value: 12 },
106
+ * { team: "Eng", task: "API", value: 16 },
107
+ * { team: "Eng", task: "Client", value: 10 },
108
+ * { team: "QA", task: "Plan", value: 4 },
109
+ * ]}
110
+ * categoryAccessor="team"
111
+ * subcategoryAccessor="task"
112
+ * valueAccessor="value"
113
+ * />
114
+ * ```
115
+ *
116
+ * @example
117
+ * ```tsx
118
+ * // Color by subcategory + custom label rotation
119
+ * <SwimlaneChart
120
+ * data={data}
121
+ * categoryAccessor="team"
122
+ * subcategoryAccessor="task"
123
+ * valueAccessor="hours"
124
+ * colorBy="task"
125
+ * showLegend
126
+ * />
127
+ * ```
128
+ */
67
129
  export declare const SwimlaneChart: {
68
130
  <TDatum extends Datum = Datum>(props: SwimlaneChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
69
131
  displayName?: string;
@@ -40,8 +40,42 @@ export interface ViolinPlotProps<TDatum extends Datum = Datum> extends BaseChart
40
40
  };
41
41
  /** Custom formatter for category tick labels */
42
42
  categoryFormat?: CategoryFormatFn;
43
+ /** Fixed value-axis domain `[min, max]`. Either bound may be `undefined` to leave that side data-derived. */
44
+ valueExtent?: [number | undefined, number | undefined] | [number];
43
45
  frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "size">>;
44
46
  }
47
+ /**
48
+ * ViolinPlot - Mirrored density curves per category for distribution shape.
49
+ *
50
+ * Each category gets a symmetric kernel density estimate, optionally with
51
+ * a {@link BoxPlot}-style IQR overlay (`showIQR`). Compare with
52
+ * {@link RidgelinePlot} (stacked, single-sided), {@link BoxPlot} (summary
53
+ * only), or {@link SwarmPlot} (every observation visible).
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * // Reaction-time distribution per cohort
58
+ * <ViolinPlot
59
+ * data={observations}
60
+ * categoryAccessor="cohort"
61
+ * valueAccessor="reactionTime"
62
+ * bins={40}
63
+ * />
64
+ * ```
65
+ *
66
+ * @example
67
+ * ```tsx
68
+ * // Smoother curve + IQR overlay
69
+ * <ViolinPlot
70
+ * data={observations}
71
+ * categoryAccessor="condition"
72
+ * valueAccessor="score"
73
+ * curve="monotoneX"
74
+ * showIQR
75
+ * colorBy="condition"
76
+ * />
77
+ * ```
78
+ */
45
79
  export declare const ViolinPlot: {
46
80
  <TDatum extends Datum = Datum>(props: ViolinPlotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
47
81
  displayName?: string;