semiotic 3.1.2 → 3.2.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 +134 -216
- package/LICENSE +197 -10
- package/README.md +1 -0
- package/ai/dist/componentRegistry.js +6 -0
- package/ai/dist/mcp-server.js +115 -5
- package/ai/examples.md +93 -0
- package/ai/schema.json +3916 -878
- package/ai/system-prompt.md +27 -0
- package/dist/components/ThemeProvider.d.ts +5 -3
- package/dist/components/charts/geo/ChoroplethMap.d.ts +1 -1
- package/dist/components/charts/index.d.ts +8 -1
- package/dist/components/charts/ordinal/BarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +55 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -0
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -0
- package/dist/components/charts/shared/colorManipulation.d.ts +15 -0
- package/dist/components/charts/shared/formatUtils.d.ts +28 -0
- package/dist/components/charts/shared/hatchPattern.d.ts +35 -0
- package/dist/components/charts/shared/hooks.d.ts +16 -1
- package/dist/components/charts/shared/legendUtils.d.ts +2 -1
- package/dist/components/charts/shared/selectionUtils.d.ts +11 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +49 -5
- package/dist/components/charts/shared/types.d.ts +4 -1
- package/dist/components/charts/xy/Heatmap.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +71 -0
- package/dist/components/realtime/types.d.ts +2 -0
- package/dist/components/semiotic-ai.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-themes.d.ts +64 -0
- package/dist/components/semiotic-xy.d.ts +1 -0
- package/dist/components/semiotic.d.ts +11 -5
- package/dist/components/store/ThemeStore.d.ts +22 -2
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +1 -0
- package/dist/components/stream/PipelineStore.d.ts +2 -0
- package/dist/components/stream/SVGOverlay.d.ts +5 -3
- package/dist/components/stream/accessorUtils.d.ts +14 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalSceneBuilders/barFunnelScene.d.ts +27 -0
- package/dist/components/stream/ordinalSceneBuilders/funnelScene.d.ts +26 -0
- package/dist/components/stream/ordinalTypes.d.ts +16 -2
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +12 -0
- package/dist/components/stream/renderers/trapezoidCanvasRenderer.d.ts +15 -0
- package/dist/components/stream/sceneUtils.d.ts +10 -0
- package/dist/components/stream/types.d.ts +10 -3
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +1 -0
- 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-ordinal.d.ts +3 -0
- package/dist/semiotic-statisticalOverlays-D8LhSbQt.js +1 -0
- package/dist/semiotic-themes.d.ts +64 -0
- package/dist/semiotic-themes.min.js +1 -0
- package/dist/semiotic-themes.module.min.js +1 -0
- package/dist/semiotic-xy.d.ts +1 -0
- package/dist/semiotic.d.ts +11 -5
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +1 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +24 -5
- package/dist/semiotic-ai-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/semiotic-statisticalOverlays-C1f7TYyD.js +0 -1
- package/dist/xy-statisticalOverlays-C1f7TYyD.js +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* semiotic/themes — Named theme presets for Semiotic charts.
|
|
3
|
+
*
|
|
4
|
+
* Each theme provides light and dark mode variants as full SemioticTheme objects.
|
|
5
|
+
* Use with ThemeProvider: `<ThemeProvider theme={TUFTE_LIGHT} />` or by name:
|
|
6
|
+
* `<ThemeProvider theme="tufte" />` / `<ThemeProvider theme="tufte-dark" />`.
|
|
7
|
+
*
|
|
8
|
+
* Also exports `themeToCSS()` and `themeToTokens()` for serialization.
|
|
9
|
+
*/
|
|
10
|
+
import type { SemioticTheme } from "./store/ThemeStore";
|
|
11
|
+
import { LIGHT_THEME, DARK_THEME, HIGH_CONTRAST_THEME, COLOR_BLIND_SAFE_CATEGORICAL } from "./store/ThemeStore";
|
|
12
|
+
export { LIGHT_THEME, DARK_THEME, HIGH_CONTRAST_THEME, COLOR_BLIND_SAFE_CATEGORICAL };
|
|
13
|
+
export type { SemioticTheme };
|
|
14
|
+
export declare const PASTELS_LIGHT: SemioticTheme;
|
|
15
|
+
export declare const PASTELS_DARK: SemioticTheme;
|
|
16
|
+
export declare const BI_TOOL_LIGHT: SemioticTheme;
|
|
17
|
+
export declare const BI_TOOL_DARK: SemioticTheme;
|
|
18
|
+
export declare const ITALIAN_LIGHT: SemioticTheme;
|
|
19
|
+
export declare const ITALIAN_DARK: SemioticTheme;
|
|
20
|
+
export declare const TUFTE_LIGHT: SemioticTheme;
|
|
21
|
+
export declare const TUFTE_DARK: SemioticTheme;
|
|
22
|
+
export declare const JOURNALIST_LIGHT: SemioticTheme;
|
|
23
|
+
export declare const JOURNALIST_DARK: SemioticTheme;
|
|
24
|
+
export declare const PLAYFUL_LIGHT: SemioticTheme;
|
|
25
|
+
export declare const PLAYFUL_DARK: SemioticTheme;
|
|
26
|
+
/** All named theme presets, keyed by slug. */
|
|
27
|
+
export declare const THEME_PRESETS: Record<string, SemioticTheme>;
|
|
28
|
+
/** All valid named theme strings for ThemeProvider. */
|
|
29
|
+
export type ThemePresetName = keyof typeof THEME_PRESETS;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a theme preset name to a SemioticTheme object.
|
|
32
|
+
* Returns undefined if the name is not recognized.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveThemePreset(name: string): SemioticTheme | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Convert a SemioticTheme to a CSS custom properties string.
|
|
37
|
+
* Useful for SSR or generating stylesheet content.
|
|
38
|
+
*
|
|
39
|
+
* @param theme - A SemioticTheme object
|
|
40
|
+
* @param selector - CSS selector to scope the variables (default: `:root`)
|
|
41
|
+
* @returns CSS string with custom properties
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const css = themeToCSS(TUFTE_LIGHT, ".my-charts")
|
|
46
|
+
* // .my-charts {
|
|
47
|
+
* // --semiotic-bg: #fffff8;
|
|
48
|
+
* // --semiotic-text: #111111;
|
|
49
|
+
* // ...
|
|
50
|
+
* // }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function themeToCSS(theme: SemioticTheme, selector?: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Convert a SemioticTheme to a design tokens JSON object.
|
|
56
|
+
* Compatible with Style Dictionary / Design Token Community Group format.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const tokens = themeToTokens(TUFTE_LIGHT)
|
|
61
|
+
* // { semiotic: { bg: { $value: "#fffff8", $type: "color" }, ... } }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function themeToTokens(theme: SemioticTheme): Record<string, any>;
|
|
@@ -14,4 +14,5 @@ export { Heatmap } from "./charts/xy/Heatmap";
|
|
|
14
14
|
export { ScatterplotMatrix } from "./charts/xy/ScatterplotMatrix";
|
|
15
15
|
export { MinimapChart } from "./charts/xy/MinimapChart";
|
|
16
16
|
export { QuadrantChart } from "./charts/xy/QuadrantChart";
|
|
17
|
+
export { MultiAxisLineChart } from "./charts/xy/MultiAxisLineChart";
|
|
17
18
|
export type { StreamXYFrameProps, StreamXYFrameHandle } from "./stream/types";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import StreamXYFrame from "./stream/StreamXYFrame";
|
|
2
2
|
import StreamOrdinalFrame from "./stream/StreamOrdinalFrame";
|
|
3
3
|
import StreamNetworkFrame from "./stream/StreamNetworkFrame";
|
|
4
|
-
import { Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, PieChart, DonutChart, GroupedBarChart, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart } from "./charts";
|
|
4
|
+
import { Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, PieChart, DonutChart, GroupedBarChart, FunnelChart, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, MultiAxisLineChart } from "./charts";
|
|
5
5
|
import { LinkedCharts } from "./LinkedCharts";
|
|
6
6
|
import { ThemeProvider, useTheme } from "./ThemeProvider";
|
|
7
7
|
import { exportChart } from "./export/exportChart";
|
|
8
|
+
import { createHatchPattern } from "./charts/shared/hatchPattern";
|
|
8
9
|
import { toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX } from "./export/chartConfig";
|
|
9
10
|
import { serializeSelections, deserializeSelections } from "./export/selectionSerializer";
|
|
10
11
|
import { fromVegaLite } from "./data/fromVegaLite";
|
|
@@ -22,8 +23,8 @@ import { RealtimeTemporalHistogram, RealtimeHistogram } from "./charts/realtime/
|
|
|
22
23
|
import { RealtimeSwarmChart } from "./charts/realtime/RealtimeSwarmChart";
|
|
23
24
|
import { RealtimeWaterfallChart } from "./charts/realtime/RealtimeWaterfallChart";
|
|
24
25
|
import { RealtimeHeatmap } from "./charts/realtime/RealtimeHeatmap";
|
|
25
|
-
export { StreamXYFrame, StreamOrdinalFrame, StreamNetworkFrame, Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, PieChart, DonutChart, GroupedBarChart, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, LinkedCharts, ThemeProvider, useTheme, exportChart, toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX, serializeSelections, deserializeSelections, fromVegaLite, ChartErrorBoundary, ChartContainer, ChartGrid, CategoryColorProvider, useCategoryColors, ContextLayout, DetailsPanel, Tooltip, MultiLineTooltip, normalizeTooltip, RingBuffer, IncrementalExtent, RealtimeLineChart, RealtimeTemporalHistogram, RealtimeHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap };
|
|
26
|
-
export { ScatterplotProps, ConnectedScatterplotProps, LineChartProps, AreaChartProps, StackedAreaChartProps, HeatmapProps, BubbleChartProps, BarChartProps, StackedBarChartProps, SwarmPlotProps, BoxPlotProps, HistogramProps, ViolinPlotProps, DotPlotProps, PieChartProps, DonutChartProps, GroupedBarChartProps, RidgelinePlotProps, OrbitDiagramProps, OrbitNode, ForceDirectedGraphProps, ChordDiagramProps, SankeyDiagramProps, TreeDiagramProps, TreemapProps, CirclePackProps, ScatterplotMatrixProps, MinimapChartProps, MinimapConfig, QuadrantChartProps, QuadrantsConfig, QuadrantConfig, CenterlineStyle, BaseChartProps, AxisConfig, Accessor, ChartAccessor, ChartMode } from "./charts";
|
|
26
|
+
export { StreamXYFrame, StreamOrdinalFrame, StreamNetworkFrame, Scatterplot, ConnectedScatterplot, LineChart, AreaChart, StackedAreaChart, Heatmap, BubbleChart, BarChart, StackedBarChart, SwarmPlot, BoxPlot, Histogram, ViolinPlot, RidgelinePlot, DotPlot, ForceDirectedGraph, ChordDiagram, SankeyDiagram, TreeDiagram, PieChart, DonutChart, FunnelChart, GroupedBarChart, Treemap, CirclePack, OrbitDiagram, ScatterplotMatrix, MinimapChart, QuadrantChart, MultiAxisLineChart, LinkedCharts, ThemeProvider, useTheme, exportChart, toConfig, fromConfig, toURL, fromURL, copyConfig, configToJSX, serializeSelections, deserializeSelections, fromVegaLite, ChartErrorBoundary, ChartContainer, ChartGrid, CategoryColorProvider, useCategoryColors, ContextLayout, DetailsPanel, Tooltip, MultiLineTooltip, normalizeTooltip, RingBuffer, IncrementalExtent, RealtimeLineChart, RealtimeTemporalHistogram, RealtimeHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap, createHatchPattern };
|
|
27
|
+
export { ScatterplotProps, ConnectedScatterplotProps, LineChartProps, AreaChartProps, StackedAreaChartProps, HeatmapProps, BubbleChartProps, BarChartProps, StackedBarChartProps, SwarmPlotProps, BoxPlotProps, HistogramProps, ViolinPlotProps, DotPlotProps, PieChartProps, DonutChartProps, FunnelChartProps, GroupedBarChartProps, RidgelinePlotProps, OrbitDiagramProps, OrbitNode, ForceDirectedGraphProps, ChordDiagramProps, SankeyDiagramProps, TreeDiagramProps, TreemapProps, CirclePackProps, ScatterplotMatrixProps, MinimapChartProps, MinimapConfig, QuadrantChartProps, MultiAxisLineChartProps, MultiAxisSeriesConfig, QuadrantsConfig, QuadrantConfig, CenterlineStyle, BaseChartProps, AxisConfig, Accessor, ChartAccessor, ChartMode } from "./charts";
|
|
27
28
|
export type { StreamXYFrameProps, StreamXYFrameHandle, StreamChartType, RuntimeMode, SceneNode, Changeset, StreamScales, StreamLayout, CurveType, CanvasRendererFn } from "./stream/types";
|
|
28
29
|
export type { StreamRendererFn } from "./stream/renderers/types";
|
|
29
30
|
export type { StreamOrdinalFrameProps, StreamOrdinalFrameHandle, OrdinalChartType, OrdinalScales, OrdinalSceneNode } from "./stream/ordinalTypes";
|
|
@@ -37,7 +38,10 @@ export type { UseChartObserverOptions, UseChartObserverResult } from "./LinkedCh
|
|
|
37
38
|
export type { ChartObservation, OnObservationCallback } from "./store/ObservationStore";
|
|
38
39
|
export type { ResolutionMode, SelectionClause, Selection } from "./store/SelectionStore";
|
|
39
40
|
export type { SemioticTheme } from "./ThemeProvider";
|
|
40
|
-
export { LIGHT_THEME, DARK_THEME } from "./ThemeProvider";
|
|
41
|
+
export { LIGHT_THEME, DARK_THEME, HIGH_CONTRAST_THEME } from "./ThemeProvider";
|
|
42
|
+
export { COLOR_BLIND_SAFE_CATEGORICAL } from "./store/ThemeStore";
|
|
43
|
+
export { themeToCSS, themeToTokens, resolveThemePreset, THEME_PRESETS } from "./semiotic-themes";
|
|
44
|
+
export type { ThemePresetName } from "./semiotic-themes";
|
|
41
45
|
export type { ChartErrorBoundaryProps } from "./ChartErrorBoundary";
|
|
42
46
|
export type { ChartContainerProps, ChartContainerHandle } from "./ChartContainer";
|
|
43
47
|
export type { ChartGridProps } from "./ChartGrid";
|
|
@@ -47,7 +51,9 @@ export type { DetailsPanelProps } from "./DetailsPanel";
|
|
|
47
51
|
export type { ChartConfig, ToConfigOptions, CopyFormat } from "./export/chartConfig";
|
|
48
52
|
export type { VegaLiteSpec, VegaLiteEncoding } from "./data/fromVegaLite";
|
|
49
53
|
export type { SerializedSelections, SerializedSelection, SerializedFieldSelection } from "./export/selectionSerializer";
|
|
50
|
-
export {
|
|
54
|
+
export type { HatchPatternOptions } from "./charts/shared/hatchPattern";
|
|
55
|
+
export { smartTickFormat, adaptiveTimeTicks } from "./charts/shared/formatUtils";
|
|
56
|
+
export { darkenColor, lightenColor } from "./charts/shared/colorManipulation";
|
|
51
57
|
export type { TooltipProp, TooltipConfig, TooltipField, MultiLineTooltipConfig } from "./Tooltip/Tooltip";
|
|
52
58
|
export type { ArrowOfTime, WindowMode, ThresholdType, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, AnnotationContext, AnnotationAnchorMode, CrosshairStyle, HoverAnnotationConfig, HoverData } from "./realtime/types";
|
|
53
59
|
export type { RealtimeLineChartProps } from "./charts/realtime/RealtimeLineChart";
|
|
@@ -4,11 +4,18 @@ export interface SemioticTheme {
|
|
|
4
4
|
primary: string;
|
|
5
5
|
categorical: string[];
|
|
6
6
|
sequential: string;
|
|
7
|
+
/** d3-scale-chromatic diverging scheme name, e.g. "RdBu", "PiYG" */
|
|
8
|
+
diverging?: string;
|
|
7
9
|
background: string;
|
|
8
10
|
text: string;
|
|
9
11
|
textSecondary: string;
|
|
10
12
|
grid: string;
|
|
11
13
|
border: string;
|
|
14
|
+
focus?: string;
|
|
15
|
+
/** Linked hover/selection highlight color */
|
|
16
|
+
selection?: string;
|
|
17
|
+
/** Opacity for non-selected (dimmed) elements, 0–1 */
|
|
18
|
+
selectionOpacity?: number;
|
|
12
19
|
};
|
|
13
20
|
typography: {
|
|
14
21
|
fontFamily: string;
|
|
@@ -16,16 +23,29 @@ export interface SemioticTheme {
|
|
|
16
23
|
labelSize: number;
|
|
17
24
|
tickSize: number;
|
|
18
25
|
};
|
|
26
|
+
tooltip?: {
|
|
27
|
+
background?: string;
|
|
28
|
+
text?: string;
|
|
29
|
+
borderRadius?: string;
|
|
30
|
+
fontSize?: string;
|
|
31
|
+
shadow?: string;
|
|
32
|
+
};
|
|
33
|
+
borderRadius?: string;
|
|
19
34
|
}
|
|
35
|
+
/** Color-blind safe categorical palette (8 colors).
|
|
36
|
+
* Derived from Wong (2011) "Points of view: Color blindness" — safe for
|
|
37
|
+
* deuteranopia, protanopia, and tritanopia. */
|
|
38
|
+
export declare const COLOR_BLIND_SAFE_CATEGORICAL: string[];
|
|
20
39
|
export declare const LIGHT_THEME: SemioticTheme;
|
|
21
40
|
export declare const DARK_THEME: SemioticTheme;
|
|
41
|
+
export declare const HIGH_CONTRAST_THEME: SemioticTheme;
|
|
22
42
|
export interface ThemeStoreState {
|
|
23
43
|
theme: SemioticTheme;
|
|
24
|
-
setTheme: (theme: Partial<SemioticTheme> | "light" | "dark") => void;
|
|
44
|
+
setTheme: (theme: Partial<SemioticTheme> | "light" | "dark" | "high-contrast") => void;
|
|
25
45
|
}
|
|
26
46
|
export declare const ThemeProvider: import("react").FC<{
|
|
27
47
|
children: React.ReactNode;
|
|
28
48
|
}>, useThemeSelector: <R>(selector: (state: {
|
|
29
49
|
theme: SemioticTheme;
|
|
30
|
-
setTheme(theme: Partial<SemioticTheme> | "light" | "dark"): void;
|
|
50
|
+
setTheme(theme: Partial<SemioticTheme> | "light" | "dark" | "high-contrast"): void;
|
|
31
51
|
}) => R) => R;
|
|
@@ -119,6 +119,8 @@ export declare class PipelineStore {
|
|
|
119
119
|
scales: StreamScales | null;
|
|
120
120
|
scene: SceneNode[];
|
|
121
121
|
version: number;
|
|
122
|
+
/** True when the x accessor returns Date objects (auto-detected on first data ingestion) */
|
|
123
|
+
xIsDate: boolean;
|
|
122
124
|
private _quadtree;
|
|
123
125
|
private static readonly QUADTREE_THRESHOLD;
|
|
124
126
|
constructor(config: PipelineConfig);
|
|
@@ -7,7 +7,7 @@ export interface AxisConfig {
|
|
|
7
7
|
orient: "left" | "right" | "top" | "bottom";
|
|
8
8
|
label?: string;
|
|
9
9
|
ticks?: number;
|
|
10
|
-
tickFormat?: (d: any) => string;
|
|
10
|
+
tickFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
11
11
|
baseline?: boolean | "under";
|
|
12
12
|
jaggedBase?: boolean;
|
|
13
13
|
/** Highlight ticks at time boundaries (new month, year, etc.) with semibold text.
|
|
@@ -30,7 +30,9 @@ interface SVGOverlayProps {
|
|
|
30
30
|
axes?: AxisConfig[];
|
|
31
31
|
xLabel?: string;
|
|
32
32
|
yLabel?: string;
|
|
33
|
-
|
|
33
|
+
/** Label for the right Y axis (dual-axis charts) */
|
|
34
|
+
yLabelRight?: string;
|
|
35
|
+
xFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
34
36
|
yFormat?: (d: any) => string;
|
|
35
37
|
showGrid?: boolean;
|
|
36
38
|
title?: string | ReactNode;
|
|
@@ -90,7 +92,7 @@ interface SVGUnderlayProps {
|
|
|
90
92
|
showAxes?: boolean;
|
|
91
93
|
axes?: AxisConfig[];
|
|
92
94
|
showGrid?: boolean;
|
|
93
|
-
xFormat?: (d: any) => string;
|
|
95
|
+
xFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
94
96
|
yFormat?: (d: any) => string;
|
|
95
97
|
}
|
|
96
98
|
export declare function SVGUnderlay(props: SVGUnderlayProps): React.JSX.Element | null;
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare two accessor specs for equivalence.
|
|
3
|
+
* - Same reference: always equivalent (`===`)
|
|
4
|
+
* - String accessors: exact string match
|
|
5
|
+
* - Function accessors: `.toString()` comparison (catches inline arrow functions
|
|
6
|
+
* like `d => d.value` that are recreated on every render but have identical source)
|
|
7
|
+
* - Mismatched types or undefined vs defined: not equivalent
|
|
8
|
+
*
|
|
9
|
+
* **Known limitation**: `.toString()` compares source text, not closure bindings.
|
|
10
|
+
* Two functions with identical source but different captured variables will appear
|
|
11
|
+
* equivalent. For closures that depend on changing values, use `useCallback` with
|
|
12
|
+
* the variable in the dependency array so the reference changes when behavior changes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function accessorsEquivalent(a: string | ((...args: any[]) => any) | undefined, b: string | ((...args: any[]) => any) | undefined): boolean;
|
|
1
15
|
export declare function resolveAccessor<T>(accessor: string | ((d: T) => number) | undefined, fallback: string): (d: T) => number;
|
|
2
16
|
export declare function resolveRawAccessor<T>(accessor: string | ((d: T) => any) | undefined, fallback: string): (d: T) => any;
|
|
3
17
|
export declare function resolveStringAccessor<T>(accessor: string | ((d: T) => string) | undefined, fallback?: string): ((d: T) => string) | undefined;
|
|
@@ -54,6 +54,8 @@ export interface RealtimeEdge {
|
|
|
54
54
|
circularPathData?: any;
|
|
55
55
|
bezier?: BezierCache;
|
|
56
56
|
data?: Record<string, any>;
|
|
57
|
+
/** Unique key for this edge (supports parallel edges between same node pair) */
|
|
58
|
+
_edgeKey?: string;
|
|
57
59
|
}
|
|
58
60
|
export interface BezierPoint {
|
|
59
61
|
x: number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { OrdinalSceneNode, OrdinalLayout } from "../ordinalTypes";
|
|
2
|
+
import type { OrdinalSceneContext } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Bar-funnel scene builder (vertical orientation).
|
|
5
|
+
*
|
|
6
|
+
* Renders funnel data as vertical bars — one per step on the x-axis.
|
|
7
|
+
* Each bar is stacked: solid bottom = retained value, hatched top = dropoff
|
|
8
|
+
* from the previous step. The first step has no dropoff (100% solid).
|
|
9
|
+
*
|
|
10
|
+
* Multi-category: bars are grouped side-by-side within each step,
|
|
11
|
+
* each with its own retained + dropoff stack.
|
|
12
|
+
*
|
|
13
|
+
* The rScale (y-axis) is set by the pipeline based on the data's max value.
|
|
14
|
+
* Bars are sized proportionally via scales.r so the first step fills the
|
|
15
|
+
* available height and subsequent steps shrink relative to it.
|
|
16
|
+
*
|
|
17
|
+
* Metadata on each rect datum (used by barFunnelLabelRenderer):
|
|
18
|
+
* - __barFunnelValue: numeric value for this bar
|
|
19
|
+
* - __barFunnelPercent: percent of this category's first-step value
|
|
20
|
+
* - __barFunnelIsFirstStep: true for step index 0
|
|
21
|
+
* - __barFunnelIsDropoff: true for the dropoff portion (hatched)
|
|
22
|
+
* - __barFunnelStep: step name
|
|
23
|
+
* - __barFunnelDropoffValue: the dropoff amount
|
|
24
|
+
* - __barFunnelCategory: category key (for multi-category)
|
|
25
|
+
* - __barFunnelLabelX/Y: position for the floating label
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildBarFunnelScene(ctx: OrdinalSceneContext, layout: OrdinalLayout): OrdinalSceneNode[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OrdinalSceneNode, OrdinalLayout } from "../ordinalTypes";
|
|
2
|
+
import type { OrdinalSceneContext } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Funnel scene builder.
|
|
5
|
+
*
|
|
6
|
+
* Steps run top-to-bottom. Each step is a horizontal row whose bar width is
|
|
7
|
+
* proportional to its value. Multiple categories mirror around the center axis:
|
|
8
|
+
* with 2 categories, one extends right and the other extends left.
|
|
9
|
+
*
|
|
10
|
+
* Produces:
|
|
11
|
+
* - RectSceneNode for each bar (step × category)
|
|
12
|
+
* - TrapezoidSceneNode for each connector between consecutive steps
|
|
13
|
+
*
|
|
14
|
+
* Label metadata on each rect datum (used by funnelLabelRenderer):
|
|
15
|
+
* - __funnelStepLabel: step name (only on first category rect per row)
|
|
16
|
+
* - __funnelValue: numeric value for this bar
|
|
17
|
+
* - __funnelPercent: percent of this category's first-step value
|
|
18
|
+
* - __funnelIsFirstStep: true for step index 0 (suppresses "100%")
|
|
19
|
+
* - __funnelStepLabelX/Y: center position for step name
|
|
20
|
+
* - __funnelValueLabelX/Y: center position for value label
|
|
21
|
+
* - __funnelBarW: pixel width of this bar (for min-size suppression)
|
|
22
|
+
*
|
|
23
|
+
* NOTE: FunnelChart HOC uses projection="horizontal" so the ordinal band
|
|
24
|
+
* scale maps to layout.height (y-axis). col.x = y-position, col.width = band height.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildFunnelScene(ctx: OrdinalSceneContext, layout: OrdinalLayout): OrdinalSceneNode[];
|
|
@@ -3,7 +3,7 @@ import type { ScaleLinear, ScaleBand } from "d3-scale";
|
|
|
3
3
|
import type { ArrowOfTime, WindowMode, HoverAnnotationConfig, HoverData, AnnotationContext } from "../realtime/types";
|
|
4
4
|
import type { Style, DecayConfig, PulseConfig, TransitionConfig, StalenessConfig } from "./types";
|
|
5
5
|
import type { LegendGroup } from "../types/legendTypes";
|
|
6
|
-
export type OrdinalChartType = "bar" | "clusterbar" | "point" | "swarm" | "pie" | "donut" | "boxplot" | "violin" | "histogram" | "ridgeline" | "timeline";
|
|
6
|
+
export type OrdinalChartType = "bar" | "clusterbar" | "point" | "swarm" | "pie" | "donut" | "boxplot" | "violin" | "histogram" | "ridgeline" | "timeline" | "funnel" | "bar-funnel";
|
|
7
7
|
export interface OrdinalScales {
|
|
8
8
|
o: ScaleBand<string>;
|
|
9
9
|
r: ScaleLinear<number, number>;
|
|
@@ -102,9 +102,18 @@ export interface ConnectorSceneNode {
|
|
|
102
102
|
group?: string;
|
|
103
103
|
_targetOpacity?: number;
|
|
104
104
|
}
|
|
105
|
+
export interface TrapezoidSceneNode {
|
|
106
|
+
type: "trapezoid";
|
|
107
|
+
/** Four corners: [top-left, top-right, bottom-right, bottom-left] */
|
|
108
|
+
points: [number, number][];
|
|
109
|
+
style: Style;
|
|
110
|
+
datum: any;
|
|
111
|
+
category?: string;
|
|
112
|
+
_targetOpacity?: number;
|
|
113
|
+
}
|
|
105
114
|
export type { Style, PointSceneNode, RectSceneNode } from "./types";
|
|
106
115
|
import type { PointSceneNode, RectSceneNode } from "./types";
|
|
107
|
-
export type OrdinalSceneNode = RectSceneNode | PointSceneNode | WedgeSceneNode | BoxplotSceneNode | ViolinSceneNode | ConnectorSceneNode;
|
|
116
|
+
export type OrdinalSceneNode = RectSceneNode | PointSceneNode | WedgeSceneNode | BoxplotSceneNode | ViolinSceneNode | ConnectorSceneNode | TrapezoidSceneNode;
|
|
108
117
|
export interface OrdinalColumn {
|
|
109
118
|
name: string;
|
|
110
119
|
x: number;
|
|
@@ -144,6 +153,8 @@ export interface OrdinalPipelineConfig {
|
|
|
144
153
|
showOutliers?: boolean;
|
|
145
154
|
showIQR?: boolean;
|
|
146
155
|
amplitude?: number;
|
|
156
|
+
connectorOpacity?: number;
|
|
157
|
+
showLabels?: boolean;
|
|
147
158
|
oSort?: ((a: any, b: any) => number) | boolean | "asc" | "desc";
|
|
148
159
|
connectorAccessor?: string | ((d: any) => string);
|
|
149
160
|
connectorStyle?: Style | ((d: any) => Style);
|
|
@@ -189,6 +200,8 @@ export interface StreamOrdinalFrameProps<T = Record<string, any>> {
|
|
|
189
200
|
showOutliers?: boolean;
|
|
190
201
|
showIQR?: boolean;
|
|
191
202
|
amplitude?: number;
|
|
203
|
+
connectorOpacity?: number;
|
|
204
|
+
showLabels?: boolean;
|
|
192
205
|
rExtent?: [number?, number?];
|
|
193
206
|
oExtent?: string[];
|
|
194
207
|
extentPadding?: number;
|
|
@@ -203,6 +216,7 @@ export interface StreamOrdinalFrameProps<T = Record<string, any>> {
|
|
|
203
216
|
colorScheme?: string | string[];
|
|
204
217
|
barColors?: Record<string, string>;
|
|
205
218
|
showAxes?: boolean;
|
|
219
|
+
showCategoryTicks?: boolean;
|
|
206
220
|
oLabel?: string;
|
|
207
221
|
rLabel?: string;
|
|
208
222
|
oFormat?: (d: string) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrdinalLayout, OrdinalScales, OrdinalSceneNode } from "../ordinalTypes";
|
|
2
|
+
export declare const barFunnelHatchRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Canvas renderer for bar-funnel labels.
|
|
5
|
+
*
|
|
6
|
+
* Draws a floating label above each bar (or bar group) showing:
|
|
7
|
+
* - Bold percentage (of first step)
|
|
8
|
+
* - Raw value below it
|
|
9
|
+
*
|
|
10
|
+
* Labels appear on a white rounded-rect background (matching the reference images).
|
|
11
|
+
*/
|
|
12
|
+
export declare const barFunnelLabelRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OrdinalLayout, OrdinalScales, OrdinalSceneNode } from "../ordinalTypes";
|
|
2
|
+
/**
|
|
3
|
+
* Canvas renderer for trapezoid (funnel connector) nodes.
|
|
4
|
+
* Draws filled quadrilaterals connecting consecutive funnel steps.
|
|
5
|
+
*/
|
|
6
|
+
export declare const trapezoidCanvasRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Canvas renderer for funnel labels.
|
|
9
|
+
*
|
|
10
|
+
* Renders white text with dark outline (matching reference images):
|
|
11
|
+
* - Step name: bold, centered at row top, shown once per step
|
|
12
|
+
* - Value (percent): bold, centered in each bar. Suppressed if text overflows bar.
|
|
13
|
+
* First step suppresses "(100%)" since it's always 100%.
|
|
14
|
+
*/
|
|
15
|
+
export declare const funnelLabelRenderer: (ctx: CanvasRenderingContext2D, nodes: OrdinalSceneNode[], _scales: OrdinalScales, _layout: OrdinalLayout) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SceneNode } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Extract a display color from a scene node's style.
|
|
4
|
+
* For lines/areas, prefers stroke (the visible line color).
|
|
5
|
+
* For points/rects, prefers fill.
|
|
6
|
+
* For heatcells, reads the top-level `fill` field (style is optional).
|
|
7
|
+
* For candlesticks, uses `upColor`/`downColor` based on direction.
|
|
8
|
+
* Returns null if no color can be resolved (e.g. CanvasPattern fill with no stroke).
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveNodeColor(node: SceneNode | null): string | null;
|
|
@@ -61,7 +61,8 @@ export interface Style {
|
|
|
61
61
|
strokeWidth?: number;
|
|
62
62
|
strokeDasharray?: string;
|
|
63
63
|
strokeLinecap?: "butt" | "round" | "square";
|
|
64
|
-
|
|
64
|
+
/** Fill color or CanvasPattern (e.g. from createHatchPattern) */
|
|
65
|
+
fill?: string | CanvasPattern;
|
|
65
66
|
fillOpacity?: number;
|
|
66
67
|
opacity?: number;
|
|
67
68
|
/** For icon/isotype bars: an image to stamp instead of filling */
|
|
@@ -342,13 +343,15 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
|
|
|
342
343
|
orient: "left" | "right" | "top" | "bottom";
|
|
343
344
|
label?: string;
|
|
344
345
|
ticks?: number;
|
|
345
|
-
tickFormat?: (d: any) => string;
|
|
346
|
+
tickFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
346
347
|
baseline?: boolean | "under";
|
|
347
348
|
jaggedBase?: boolean;
|
|
348
349
|
}>;
|
|
349
350
|
xLabel?: string;
|
|
350
351
|
yLabel?: string;
|
|
351
|
-
|
|
352
|
+
/** Label for the right Y axis (dual-axis charts) */
|
|
353
|
+
yLabelRight?: string;
|
|
354
|
+
xFormat?: (d: any, index?: number, allTicks?: number[]) => string;
|
|
352
355
|
yFormat?: (d: any) => string;
|
|
353
356
|
tickFormatTime?: (value: number) => string;
|
|
354
357
|
tickFormatValue?: (value: number) => string;
|
|
@@ -391,6 +394,8 @@ export interface StreamXYFrameProps<T = Record<string, any>> {
|
|
|
391
394
|
foregroundGraphics?: ReactNode;
|
|
392
395
|
/** Canvas renderers executed before the chart-type renderers (e.g. connecting lines under points) */
|
|
393
396
|
canvasPreRenderers?: CanvasRendererFn[];
|
|
397
|
+
/** SVG pre-renderers for SSR — SVG equivalent of canvasPreRenderers, rendered under data marks */
|
|
398
|
+
svgPreRenderers?: SVGPreRendererFn[];
|
|
394
399
|
title?: string | ReactNode;
|
|
395
400
|
categoryAccessor?: string | ((d: T) => string);
|
|
396
401
|
/** Configurable opacity decay for older data points */
|
|
@@ -428,4 +433,6 @@ export interface StreamXYFrameHandle<T = Record<string, any>> {
|
|
|
428
433
|
} | null;
|
|
429
434
|
}
|
|
430
435
|
export type CanvasRendererFn = (ctx: CanvasRenderingContext2D, nodes: SceneNode[], scales: StreamScales, layout: StreamLayout) => void;
|
|
436
|
+
/** SVG equivalent of CanvasRendererFn — returns React elements for SSR/SVG rendering */
|
|
437
|
+
export type SVGPreRendererFn = (nodes: SceneNode[], scales: StreamScales, layout: StreamLayout) => ReactNode;
|
|
431
438
|
export type { ArrowOfTime, WindowMode, LineStyle, BarStyle, WaterfallStyle, SwarmStyle, HoverAnnotationConfig, HoverData, AnnotationContext, AnnotationAnchorMode };
|