@optilogic/charts 1.0.0-beta.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3034 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +489 -192
- package/dist/index.d.ts +489 -192
- package/dist/index.js +3006 -175
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/cartesian/area-chart.tsx +177 -0
- package/src/cartesian/bar-chart.tsx +217 -0
- package/src/cartesian/composed-chart.tsx +222 -0
- package/src/cartesian/line-chart.tsx +159 -0
- package/src/cartesian/scatter-chart.tsx +158 -0
- package/src/cartesian/waterfall-chart.tsx +171 -0
- package/src/dashboard/chart-builder.tsx +310 -0
- package/src/dashboard/chart-renderer.tsx +250 -0
- package/src/dashboard/kpi-card.tsx +121 -0
- package/src/dashboard/scenario-comparison.tsx +235 -0
- package/src/dashboard/sparkline.tsx +86 -0
- package/src/index.ts +50 -19
- package/src/radial/donut-chart.tsx +135 -0
- package/src/radial/pie-chart.tsx +153 -0
- package/src/radial/radar-chart.tsx +111 -0
- package/src/radial/radial-bar-chart.tsx +115 -0
- package/src/shared/chart-container.tsx +104 -0
- package/src/shared/chart-legend.tsx +57 -0
- package/src/shared/chart-tooltip.tsx +159 -0
- package/src/shared/colors.ts +37 -0
- package/src/shared/formatters.ts +51 -0
- package/src/shared/types.ts +66 -0
- package/src/shared/use-live-data.ts +83 -0
- package/src/specialized/funnel-chart.tsx +93 -0
- package/src/specialized/gantt-chart.tsx +416 -0
- package/src/specialized/heatmap-chart.tsx +250 -0
- package/src/specialized/sankey-chart.tsx +155 -0
- package/src/specialized/treemap-chart.tsx +121 -0
- package/src/bar-chart.tsx +0 -337
- package/src/line-chart.tsx +0 -266
package/dist/index.d.ts
CHANGED
|
@@ -1,240 +1,537 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* LineChart
|
|
5
|
-
*
|
|
6
|
-
* A reusable, theme-aware line chart component built on Recharts.
|
|
7
|
-
* Supports multiple series, configurable axes, animations, and styling
|
|
8
|
-
* that integrates with the project's CSS variable theming system.
|
|
9
|
-
*/
|
|
3
|
+
import { TooltipProps } from 'recharts';
|
|
10
4
|
|
|
11
5
|
/** Theme-aware chart colors from CSS variables */
|
|
12
|
-
declare const CHART_COLORS:
|
|
6
|
+
declare const CHART_COLORS: readonly ["hsl(var(--chart-1))", "hsl(var(--chart-2))", "hsl(var(--chart-3))", "hsl(var(--chart-4))", "hsl(var(--chart-5))", "hsl(var(--chart-6))", "hsl(var(--chart-7))", "hsl(var(--chart-8))", "hsl(var(--chart-9))", "hsl(var(--chart-10))", "hsl(var(--chart-11))", "hsl(var(--chart-12))"];
|
|
13
7
|
declare function getChartColor(index: number, custom?: string): string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name: string;
|
|
20
|
-
/** Custom color (defaults to theme chart colors) */
|
|
21
|
-
color?: string;
|
|
22
|
-
/** Line stroke width (default: 2) */
|
|
23
|
-
strokeWidth?: number;
|
|
24
|
-
/** Show dots on data points (default: false) */
|
|
25
|
-
dot?: boolean;
|
|
26
|
-
/** Line interpolation type */
|
|
27
|
-
type?: "monotone" | "linear" | "step" | "basis" | "natural";
|
|
28
|
-
}
|
|
29
|
-
/** X-axis configuration */
|
|
30
|
-
interface LineChartXAxis {
|
|
31
|
-
/** Key in data objects for x-axis values */
|
|
8
|
+
type SemanticColorName = "positive" | "negative" | "neutral" | "warning";
|
|
9
|
+
declare function getSemanticColor(name: SemanticColorName): string;
|
|
10
|
+
|
|
11
|
+
/** X-axis configuration shared across cartesian charts */
|
|
12
|
+
interface ChartXAxis {
|
|
32
13
|
dataKey: string;
|
|
33
|
-
/** Axis label */
|
|
34
14
|
label?: string;
|
|
35
|
-
/** Custom tick formatter */
|
|
36
15
|
tickFormatter?: (value: unknown) => string;
|
|
37
|
-
/** Minimum gap between ticks in pixels */
|
|
38
16
|
minTickGap?: number;
|
|
39
17
|
}
|
|
40
|
-
/** Y-axis configuration */
|
|
41
|
-
interface
|
|
42
|
-
/** Domain bounds [min, max] - use "auto" for automatic */
|
|
18
|
+
/** Y-axis configuration shared across cartesian charts */
|
|
19
|
+
interface ChartYAxis {
|
|
43
20
|
domain?: [
|
|
44
21
|
number | "auto" | "dataMin" | "dataMax",
|
|
45
22
|
number | "auto" | "dataMin" | "dataMax"
|
|
46
23
|
];
|
|
47
|
-
/** Axis label */
|
|
48
24
|
label?: string;
|
|
49
|
-
/** Custom tick formatter */
|
|
50
25
|
tickFormatter?: (value: unknown) => string;
|
|
51
|
-
/** Axis width in pixels */
|
|
52
26
|
width?: number;
|
|
53
27
|
}
|
|
54
28
|
/** Grid configuration */
|
|
55
|
-
interface
|
|
56
|
-
/** Show vertical grid lines */
|
|
29
|
+
interface ChartGrid {
|
|
57
30
|
vertical?: boolean;
|
|
58
|
-
/** Show horizontal grid lines */
|
|
59
31
|
horizontal?: boolean;
|
|
60
32
|
}
|
|
61
33
|
/** Legend configuration */
|
|
62
|
-
interface
|
|
63
|
-
/** Vertical position */
|
|
34
|
+
interface ChartLegend {
|
|
64
35
|
position?: "top" | "bottom";
|
|
65
|
-
/** Horizontal alignment */
|
|
66
36
|
align?: "left" | "center" | "right";
|
|
67
37
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
38
|
+
/** Chart margin */
|
|
39
|
+
interface ChartMargin {
|
|
40
|
+
top?: number;
|
|
41
|
+
right?: number;
|
|
42
|
+
bottom?: number;
|
|
43
|
+
left?: number;
|
|
44
|
+
}
|
|
45
|
+
/** Tooltip value formatter */
|
|
46
|
+
type TooltipFormatter = (value: number, name: string) => string | [string, string];
|
|
47
|
+
/** Tooltip configuration (pass true for defaults, false to disable) */
|
|
48
|
+
interface ChartTooltipConfig {
|
|
49
|
+
formatter?: TooltipFormatter;
|
|
50
|
+
labelFormatter?: (label: string) => string;
|
|
51
|
+
showTotal?: boolean;
|
|
52
|
+
showDelta?: boolean;
|
|
53
|
+
baseline?: string;
|
|
54
|
+
}
|
|
55
|
+
type ChartTooltipProp = boolean | ChartTooltipConfig;
|
|
56
|
+
/** Common props shared by all charts */
|
|
57
|
+
interface BaseChartProps {
|
|
58
|
+
className?: string;
|
|
59
|
+
height?: number | string;
|
|
60
|
+
margin?: ChartMargin;
|
|
84
61
|
animate?: boolean;
|
|
85
|
-
|
|
62
|
+
tooltip?: ChartTooltipProp;
|
|
63
|
+
/** Disables animation and optimises for frequent data updates */
|
|
64
|
+
live?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface ChartTooltipContentProps extends TooltipProps<number, string> {
|
|
68
|
+
config?: ChartTooltipConfig;
|
|
69
|
+
}
|
|
70
|
+
declare const ChartTooltipContent: React.NamedExoticComponent<ChartTooltipContentProps>;
|
|
71
|
+
/** Resolve the tooltip prop into Recharts Tooltip props */
|
|
72
|
+
declare function resolveTooltipProps(tooltip: boolean | ChartTooltipConfig | undefined): {
|
|
73
|
+
content: react_jsx_runtime.JSX.Element;
|
|
74
|
+
} | null;
|
|
75
|
+
|
|
76
|
+
interface LegendPayloadItem {
|
|
77
|
+
value: string;
|
|
78
|
+
color: string;
|
|
79
|
+
dataKey?: string;
|
|
80
|
+
}
|
|
81
|
+
interface ChartLegendContentProps {
|
|
82
|
+
payload?: LegendPayloadItem[];
|
|
83
|
+
}
|
|
84
|
+
declare const ChartLegendContent: React.NamedExoticComponent<ChartLegendContentProps>;
|
|
85
|
+
declare function resolveLegendConfig(legend: boolean | ChartLegend | undefined): ChartLegend | null;
|
|
86
|
+
|
|
87
|
+
interface ChartContainerProps {
|
|
88
|
+
children: React.ReactNode;
|
|
86
89
|
className?: string;
|
|
87
|
-
/** Chart height (default: 100%) */
|
|
88
90
|
height?: number | string;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
left?: number;
|
|
95
|
-
};
|
|
91
|
+
loading?: boolean;
|
|
92
|
+
empty?: boolean;
|
|
93
|
+
emptyMessage?: string;
|
|
94
|
+
title?: string;
|
|
95
|
+
description?: string;
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
declare const ChartContainer: React.ForwardRefExoticComponent<ChartContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
98
|
+
|
|
99
|
+
interface UseLiveDataConfig<T> {
|
|
100
|
+
/** Initial data snapshot */
|
|
101
|
+
initial?: T[];
|
|
102
|
+
/** Maximum number of data points to retain (ring buffer) */
|
|
103
|
+
maxPoints?: number;
|
|
104
|
+
/** Polling interval in ms (only used when mode is "poll") */
|
|
105
|
+
interval?: number;
|
|
106
|
+
/** Data fetch function for poll mode */
|
|
107
|
+
fetcher?: () => Promise<T[]>;
|
|
108
|
+
/** Start in paused state */
|
|
109
|
+
paused?: boolean;
|
|
110
|
+
}
|
|
111
|
+
interface UseLiveDataReturn<T> {
|
|
112
|
+
data: T[];
|
|
113
|
+
/** Push new data points */
|
|
114
|
+
push: (...items: T[]) => void;
|
|
115
|
+
/** Replace all data at once */
|
|
116
|
+
replace: (items: T[]) => void;
|
|
117
|
+
isPaused: boolean;
|
|
118
|
+
pause: () => void;
|
|
119
|
+
resume: () => void;
|
|
120
|
+
}
|
|
121
|
+
declare function useLiveData<T>(config?: UseLiveDataConfig<T>): UseLiveDataReturn<T>;
|
|
113
122
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
declare function formatCompact(value: number, decimals?: number): string;
|
|
124
|
+
declare function formatCurrency(value: number, currency?: string, decimals?: number): string;
|
|
125
|
+
declare function formatPercent(value: number, decimals?: number): string;
|
|
126
|
+
declare function formatUnit(value: number, unit: string, decimals?: number): string;
|
|
127
|
+
declare function formatDuration(seconds: number): string;
|
|
128
|
+
|
|
129
|
+
interface LineChartSeries {
|
|
130
|
+
dataKey: string;
|
|
131
|
+
name: string;
|
|
132
|
+
color?: string;
|
|
133
|
+
strokeWidth?: number;
|
|
134
|
+
dot?: boolean;
|
|
135
|
+
type?: "monotone" | "linear" | "step" | "basis" | "natural";
|
|
136
|
+
strokeDasharray?: string;
|
|
137
|
+
}
|
|
138
|
+
interface LineChartProps extends BaseChartProps {
|
|
139
|
+
data: Record<string, unknown>[];
|
|
140
|
+
series: LineChartSeries[];
|
|
141
|
+
xAxis: ChartXAxis;
|
|
142
|
+
yAxis?: ChartYAxis;
|
|
143
|
+
grid?: boolean | ChartGrid;
|
|
144
|
+
legend?: boolean | ChartLegend;
|
|
145
|
+
tooltip?: ChartTooltipProp;
|
|
146
|
+
loading?: boolean;
|
|
147
|
+
}
|
|
148
|
+
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
122
149
|
|
|
123
|
-
/** Configuration for a single bar series */
|
|
124
150
|
interface BarChartSeries {
|
|
125
|
-
/** Key in data objects for this series' values */
|
|
126
151
|
dataKey: string;
|
|
127
|
-
/** Display name shown in legend/tooltip */
|
|
128
152
|
name: string;
|
|
129
|
-
/** Custom color (defaults to theme chart colors) */
|
|
130
153
|
color?: string;
|
|
131
|
-
/** Stack ID - bars with the same stackId will be stacked */
|
|
132
154
|
stackId?: string;
|
|
133
|
-
/** Border radius for bars */
|
|
134
155
|
radius?: number | [number, number, number, number];
|
|
135
156
|
}
|
|
136
|
-
|
|
137
|
-
interface BarChartXAxis {
|
|
138
|
-
/** Key in data objects for x-axis values (category axis in vertical layout) */
|
|
139
|
-
dataKey: string;
|
|
140
|
-
/** Axis label */
|
|
141
|
-
label?: string;
|
|
142
|
-
/** Custom tick formatter */
|
|
143
|
-
tickFormatter?: (value: unknown) => string;
|
|
144
|
-
/** Minimum gap between ticks in pixels */
|
|
145
|
-
minTickGap?: number;
|
|
146
|
-
}
|
|
147
|
-
/** Y-axis configuration */
|
|
148
|
-
interface BarChartYAxis {
|
|
149
|
-
/** Domain bounds [min, max] - use "auto" for automatic */
|
|
150
|
-
domain?: [
|
|
151
|
-
number | "auto" | "dataMin" | "dataMax",
|
|
152
|
-
number | "auto" | "dataMin" | "dataMax"
|
|
153
|
-
];
|
|
154
|
-
/** Axis label */
|
|
155
|
-
label?: string;
|
|
156
|
-
/** Custom tick formatter */
|
|
157
|
-
tickFormatter?: (value: unknown) => string;
|
|
158
|
-
/** Axis width in pixels */
|
|
159
|
-
width?: number;
|
|
160
|
-
}
|
|
161
|
-
/** Grid configuration */
|
|
162
|
-
interface BarChartGrid {
|
|
163
|
-
/** Show vertical grid lines */
|
|
164
|
-
vertical?: boolean;
|
|
165
|
-
/** Show horizontal grid lines */
|
|
166
|
-
horizontal?: boolean;
|
|
167
|
-
}
|
|
168
|
-
/** Legend configuration */
|
|
169
|
-
interface BarChartLegend {
|
|
170
|
-
/** Vertical position */
|
|
171
|
-
position?: "top" | "bottom";
|
|
172
|
-
/** Horizontal alignment */
|
|
173
|
-
align?: "left" | "center" | "right";
|
|
174
|
-
}
|
|
175
|
-
interface BarChartProps {
|
|
176
|
-
/** Array of data points */
|
|
157
|
+
interface BarChartProps extends BaseChartProps {
|
|
177
158
|
data: Record<string, unknown>[];
|
|
178
|
-
/** Series configurations */
|
|
179
159
|
series: BarChartSeries[];
|
|
180
|
-
/** Chart layout orientation */
|
|
181
160
|
layout?: "vertical" | "horizontal";
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
grid?: boolean | BarChartGrid;
|
|
188
|
-
/** Show tooltip on hover */
|
|
189
|
-
tooltip?: boolean;
|
|
190
|
-
/** Legend configuration (true for default, false to hide, or object for fine control) */
|
|
191
|
-
legend?: boolean | BarChartLegend;
|
|
192
|
-
/** Enable animations */
|
|
193
|
-
animate?: boolean;
|
|
194
|
-
/** Bar width in pixels */
|
|
161
|
+
xAxis: ChartXAxis;
|
|
162
|
+
yAxis?: ChartYAxis;
|
|
163
|
+
grid?: boolean | ChartGrid;
|
|
164
|
+
legend?: boolean | ChartLegend;
|
|
165
|
+
tooltip?: ChartTooltipProp;
|
|
195
166
|
barSize?: number;
|
|
196
|
-
/** Gap between bars in a group (pixels) */
|
|
197
167
|
barGap?: number;
|
|
198
|
-
/** Gap between bar groups (pixels or percentage) */
|
|
199
168
|
barCategoryGap?: number | string;
|
|
200
|
-
|
|
169
|
+
loading?: boolean;
|
|
170
|
+
}
|
|
171
|
+
declare const BarChart: React.ForwardRefExoticComponent<BarChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
172
|
+
|
|
173
|
+
interface AreaChartSeries {
|
|
174
|
+
dataKey: string;
|
|
175
|
+
name: string;
|
|
176
|
+
color?: string;
|
|
177
|
+
fillOpacity?: number;
|
|
178
|
+
strokeWidth?: number;
|
|
179
|
+
type?: "monotone" | "linear" | "step" | "basis" | "natural";
|
|
180
|
+
stackId?: string;
|
|
181
|
+
}
|
|
182
|
+
interface AreaChartProps extends BaseChartProps {
|
|
183
|
+
data: Record<string, unknown>[];
|
|
184
|
+
series: AreaChartSeries[];
|
|
185
|
+
xAxis: ChartXAxis;
|
|
186
|
+
yAxis?: ChartYAxis;
|
|
187
|
+
grid?: boolean | ChartGrid;
|
|
188
|
+
legend?: boolean | ChartLegend;
|
|
189
|
+
tooltip?: ChartTooltipProp;
|
|
190
|
+
loading?: boolean;
|
|
191
|
+
}
|
|
192
|
+
declare const AreaChart: React.ForwardRefExoticComponent<AreaChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
193
|
+
|
|
194
|
+
interface ScatterChartSeries {
|
|
195
|
+
name: string;
|
|
196
|
+
data: Record<string, unknown>[];
|
|
197
|
+
color?: string;
|
|
198
|
+
/** Key for bubble size (optional, creates bubble chart) */
|
|
199
|
+
zDataKey?: string;
|
|
200
|
+
}
|
|
201
|
+
interface ScatterChartProps extends BaseChartProps {
|
|
202
|
+
series: ScatterChartSeries[];
|
|
203
|
+
xAxis: ChartXAxis & {
|
|
204
|
+
name?: string;
|
|
205
|
+
};
|
|
206
|
+
yAxis?: ChartYAxis & {
|
|
207
|
+
name?: string;
|
|
208
|
+
};
|
|
209
|
+
zAxis?: {
|
|
210
|
+
range?: [number, number];
|
|
211
|
+
};
|
|
212
|
+
grid?: boolean | ChartGrid;
|
|
213
|
+
legend?: boolean | ChartLegend;
|
|
214
|
+
tooltip?: ChartTooltipProp;
|
|
215
|
+
loading?: boolean;
|
|
216
|
+
}
|
|
217
|
+
declare const ScatterChart: React.ForwardRefExoticComponent<ScatterChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
218
|
+
|
|
219
|
+
interface ComposedChartSeries {
|
|
220
|
+
type: "line" | "bar" | "area";
|
|
221
|
+
dataKey: string;
|
|
222
|
+
name: string;
|
|
223
|
+
color?: string;
|
|
224
|
+
yAxisId?: string;
|
|
225
|
+
stackId?: string;
|
|
226
|
+
strokeWidth?: number;
|
|
227
|
+
strokeDasharray?: string;
|
|
228
|
+
fillOpacity?: number;
|
|
229
|
+
radius?: number | [number, number, number, number];
|
|
230
|
+
}
|
|
231
|
+
interface ComposedChartProps extends BaseChartProps {
|
|
232
|
+
data: Record<string, unknown>[];
|
|
233
|
+
series: ComposedChartSeries[];
|
|
234
|
+
xAxis: ChartXAxis;
|
|
235
|
+
yAxis?: ChartYAxis;
|
|
236
|
+
/** Secondary Y axis displayed on the right */
|
|
237
|
+
yAxisRight?: ChartYAxis & {
|
|
238
|
+
id: string;
|
|
239
|
+
};
|
|
240
|
+
grid?: boolean | ChartGrid;
|
|
241
|
+
legend?: boolean | ChartLegend;
|
|
242
|
+
tooltip?: ChartTooltipProp;
|
|
243
|
+
loading?: boolean;
|
|
244
|
+
}
|
|
245
|
+
declare const ComposedChart: React.ForwardRefExoticComponent<ComposedChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
246
|
+
|
|
247
|
+
interface WaterfallItem {
|
|
248
|
+
name: string;
|
|
249
|
+
value: number;
|
|
250
|
+
/** Mark as a summary/total bar rather than a delta */
|
|
251
|
+
isTotal?: boolean;
|
|
252
|
+
}
|
|
253
|
+
interface WaterfallChartProps extends BaseChartProps {
|
|
254
|
+
data: WaterfallItem[];
|
|
255
|
+
xAxis?: Partial<ChartXAxis>;
|
|
256
|
+
yAxis?: ChartYAxis;
|
|
257
|
+
tooltip?: ChartTooltipProp;
|
|
258
|
+
positiveColor?: string;
|
|
259
|
+
negativeColor?: string;
|
|
260
|
+
totalColor?: string;
|
|
261
|
+
loading?: boolean;
|
|
262
|
+
}
|
|
263
|
+
declare const WaterfallChart: React.ForwardRefExoticComponent<WaterfallChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
264
|
+
|
|
265
|
+
interface PieChartDatum {
|
|
266
|
+
name: string;
|
|
267
|
+
value: number;
|
|
268
|
+
color?: string;
|
|
269
|
+
}
|
|
270
|
+
interface PieChartProps extends BaseChartProps {
|
|
271
|
+
data: PieChartDatum[];
|
|
272
|
+
innerRadius?: number | string;
|
|
273
|
+
outerRadius?: number | string;
|
|
274
|
+
paddingAngle?: number;
|
|
275
|
+
startAngle?: number;
|
|
276
|
+
endAngle?: number;
|
|
277
|
+
legend?: boolean | ChartLegend;
|
|
278
|
+
tooltip?: ChartTooltipProp;
|
|
279
|
+
/** Label rendered on each slice */
|
|
280
|
+
label?: boolean | ((entry: PieChartDatum) => string);
|
|
281
|
+
loading?: boolean;
|
|
282
|
+
}
|
|
283
|
+
declare const PieChart: React.ForwardRefExoticComponent<PieChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
284
|
+
|
|
285
|
+
interface DonutChartDatum {
|
|
286
|
+
name: string;
|
|
287
|
+
value: number;
|
|
288
|
+
color?: string;
|
|
289
|
+
}
|
|
290
|
+
interface DonutChartProps extends BaseChartProps {
|
|
291
|
+
data: DonutChartDatum[];
|
|
292
|
+
innerRadius?: number | string;
|
|
293
|
+
outerRadius?: number | string;
|
|
294
|
+
paddingAngle?: number;
|
|
295
|
+
legend?: boolean | ChartLegend;
|
|
296
|
+
tooltip?: ChartTooltipProp;
|
|
297
|
+
/** Content rendered in the center of the donut */
|
|
298
|
+
centerLabel?: string;
|
|
299
|
+
centerValue?: string;
|
|
300
|
+
loading?: boolean;
|
|
301
|
+
}
|
|
302
|
+
declare const DonutChart: React.ForwardRefExoticComponent<DonutChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
303
|
+
|
|
304
|
+
interface RadarChartSeries {
|
|
305
|
+
dataKey: string;
|
|
306
|
+
name: string;
|
|
307
|
+
color?: string;
|
|
308
|
+
fillOpacity?: number;
|
|
309
|
+
strokeWidth?: number;
|
|
310
|
+
/** Use dashed stroke for baseline/reference series */
|
|
311
|
+
strokeDasharray?: string;
|
|
312
|
+
}
|
|
313
|
+
interface RadarChartProps extends BaseChartProps {
|
|
314
|
+
data: Record<string, unknown>[];
|
|
315
|
+
series: RadarChartSeries[];
|
|
316
|
+
/** Key in data used for the angle axis labels */
|
|
317
|
+
categoryKey: string;
|
|
318
|
+
domain?: [number, number];
|
|
319
|
+
legend?: boolean | ChartLegend;
|
|
320
|
+
tooltip?: ChartTooltipProp;
|
|
321
|
+
loading?: boolean;
|
|
322
|
+
}
|
|
323
|
+
declare const RadarChart: React.ForwardRefExoticComponent<RadarChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
324
|
+
|
|
325
|
+
interface RadialBarDatum {
|
|
326
|
+
name: string;
|
|
327
|
+
value: number;
|
|
328
|
+
fill?: string;
|
|
329
|
+
}
|
|
330
|
+
interface RadialBarChartProps extends BaseChartProps {
|
|
331
|
+
data: RadialBarDatum[];
|
|
332
|
+
innerRadius?: number | string;
|
|
333
|
+
outerRadius?: number | string;
|
|
334
|
+
startAngle?: number;
|
|
335
|
+
endAngle?: number;
|
|
336
|
+
legend?: boolean | ChartLegend;
|
|
337
|
+
tooltip?: ChartTooltipProp;
|
|
338
|
+
/** Show value labels on each bar */
|
|
339
|
+
showLabels?: boolean;
|
|
340
|
+
loading?: boolean;
|
|
341
|
+
}
|
|
342
|
+
declare const RadialBarChart: React.ForwardRefExoticComponent<RadialBarChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
343
|
+
|
|
344
|
+
interface SankeyNode {
|
|
345
|
+
name: string;
|
|
346
|
+
color?: string;
|
|
347
|
+
}
|
|
348
|
+
interface SankeyLink {
|
|
349
|
+
source: number;
|
|
350
|
+
target: number;
|
|
351
|
+
value: number;
|
|
352
|
+
}
|
|
353
|
+
interface SankeyChartData {
|
|
354
|
+
nodes: SankeyNode[];
|
|
355
|
+
links: SankeyLink[];
|
|
356
|
+
}
|
|
357
|
+
interface SankeyChartProps extends BaseChartProps {
|
|
358
|
+
data: SankeyChartData;
|
|
359
|
+
nodeWidth?: number;
|
|
360
|
+
nodePadding?: number;
|
|
361
|
+
tooltip?: ChartTooltipProp;
|
|
362
|
+
loading?: boolean;
|
|
363
|
+
}
|
|
364
|
+
declare const SankeyChart: React.ForwardRefExoticComponent<SankeyChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
365
|
+
|
|
366
|
+
interface TreemapDatum {
|
|
367
|
+
name: string;
|
|
368
|
+
value?: number;
|
|
369
|
+
color?: string;
|
|
370
|
+
children?: TreemapDatum[];
|
|
371
|
+
}
|
|
372
|
+
interface TreemapChartProps extends BaseChartProps {
|
|
373
|
+
data: TreemapDatum[];
|
|
374
|
+
dataKey?: string;
|
|
375
|
+
aspectRatio?: number;
|
|
376
|
+
tooltip?: ChartTooltipProp;
|
|
377
|
+
loading?: boolean;
|
|
378
|
+
}
|
|
379
|
+
declare const TreemapChart: React.ForwardRefExoticComponent<TreemapChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
380
|
+
|
|
381
|
+
interface FunnelDatum {
|
|
382
|
+
name: string;
|
|
383
|
+
value: number;
|
|
384
|
+
color?: string;
|
|
385
|
+
}
|
|
386
|
+
interface FunnelChartProps extends BaseChartProps {
|
|
387
|
+
data: FunnelDatum[];
|
|
388
|
+
tooltip?: ChartTooltipProp;
|
|
389
|
+
showLabels?: boolean;
|
|
390
|
+
loading?: boolean;
|
|
391
|
+
}
|
|
392
|
+
declare const FunnelChart: React.ForwardRefExoticComponent<FunnelChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
393
|
+
|
|
394
|
+
interface GanttTask {
|
|
395
|
+
id: string;
|
|
396
|
+
name: string;
|
|
397
|
+
start: Date;
|
|
398
|
+
end: Date;
|
|
399
|
+
/** 0–100 completion percentage */
|
|
400
|
+
progress?: number;
|
|
401
|
+
group?: string;
|
|
402
|
+
color?: string;
|
|
403
|
+
/** Task IDs this task depends on (renders dependency arrows) */
|
|
404
|
+
dependencies?: string[];
|
|
405
|
+
}
|
|
406
|
+
interface GanttMilestone {
|
|
407
|
+
id: string;
|
|
408
|
+
name: string;
|
|
409
|
+
date: Date;
|
|
410
|
+
color?: string;
|
|
411
|
+
}
|
|
412
|
+
type GanttTimeScale = "day" | "week" | "month";
|
|
413
|
+
interface GanttChartProps {
|
|
414
|
+
tasks: GanttTask[];
|
|
415
|
+
milestones?: GanttMilestone[];
|
|
416
|
+
timeScale?: GanttTimeScale;
|
|
201
417
|
className?: string;
|
|
202
|
-
/** Chart height (default: 100%) */
|
|
203
418
|
height?: number | string;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
right?: number;
|
|
208
|
-
bottom?: number;
|
|
209
|
-
left?: number;
|
|
210
|
-
};
|
|
419
|
+
rowHeight?: number;
|
|
420
|
+
labelWidth?: number;
|
|
421
|
+
onTaskClick?: (task: GanttTask) => void;
|
|
211
422
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
423
|
+
declare const GanttChart: React.ForwardRefExoticComponent<GanttChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
424
|
+
|
|
425
|
+
interface HeatmapCell {
|
|
426
|
+
x: string | number;
|
|
427
|
+
y: string | number;
|
|
428
|
+
value: number;
|
|
429
|
+
}
|
|
430
|
+
interface HeatmapColorScale {
|
|
431
|
+
min: string;
|
|
432
|
+
mid?: string;
|
|
433
|
+
max: string;
|
|
434
|
+
}
|
|
435
|
+
interface HeatmapChartProps {
|
|
436
|
+
data: HeatmapCell[];
|
|
437
|
+
xLabels: string[];
|
|
438
|
+
yLabels: string[];
|
|
439
|
+
colorScale?: HeatmapColorScale;
|
|
440
|
+
cellSize?: number;
|
|
441
|
+
showValues?: boolean;
|
|
442
|
+
valueFormatter?: (value: number) => string;
|
|
443
|
+
className?: string;
|
|
444
|
+
height?: number | string;
|
|
445
|
+
loading?: boolean;
|
|
446
|
+
onCellClick?: (cell: HeatmapCell) => void;
|
|
447
|
+
}
|
|
448
|
+
declare const HeatmapChart: React.ForwardRefExoticComponent<HeatmapChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
449
|
+
|
|
450
|
+
type SparklineVariant = "line" | "area" | "bar";
|
|
451
|
+
interface SparklineProps {
|
|
452
|
+
data: number[];
|
|
453
|
+
variant?: SparklineVariant;
|
|
454
|
+
color?: string;
|
|
455
|
+
width?: number | string;
|
|
456
|
+
height?: number;
|
|
457
|
+
strokeWidth?: number;
|
|
458
|
+
className?: string;
|
|
459
|
+
}
|
|
460
|
+
declare const Sparkline: React.NamedExoticComponent<SparklineProps>;
|
|
461
|
+
|
|
462
|
+
interface KPICardProps {
|
|
463
|
+
label: string;
|
|
464
|
+
value: string | number;
|
|
465
|
+
/** Previous period value for comparison */
|
|
466
|
+
previousValue?: number;
|
|
467
|
+
/** Change descriptor (e.g. "vs last month") */
|
|
468
|
+
changeLabel?: string;
|
|
469
|
+
sparklineData?: number[];
|
|
470
|
+
sparklineVariant?: SparklineVariant;
|
|
471
|
+
sparklineColor?: string;
|
|
472
|
+
icon?: React.ReactNode;
|
|
473
|
+
className?: string;
|
|
474
|
+
}
|
|
475
|
+
declare const KPICard: React.NamedExoticComponent<KPICardProps>;
|
|
476
|
+
|
|
477
|
+
interface ScenarioData {
|
|
478
|
+
name: string;
|
|
479
|
+
color?: string;
|
|
480
|
+
data: Record<string, unknown>[];
|
|
481
|
+
}
|
|
482
|
+
type ScenarioComparisonMode = "side-by-side" | "overlay" | "delta" | "scorecard";
|
|
483
|
+
interface ScenarioComparisonProps {
|
|
484
|
+
scenarios: ScenarioData[];
|
|
485
|
+
/** Data keys to compare */
|
|
486
|
+
metrics: string[];
|
|
487
|
+
/** Category axis key */
|
|
488
|
+
categoryKey: string;
|
|
489
|
+
mode?: ScenarioComparisonMode;
|
|
490
|
+
/** Index of the baseline scenario for delta calculations */
|
|
491
|
+
baselineIndex?: number;
|
|
492
|
+
tooltip?: ChartTooltipProp;
|
|
493
|
+
className?: string;
|
|
494
|
+
height?: number | string;
|
|
495
|
+
}
|
|
496
|
+
declare const ScenarioComparison: React.NamedExoticComponent<ScenarioComparisonProps>;
|
|
497
|
+
|
|
498
|
+
interface ChartConfigSeries {
|
|
499
|
+
dataKey: string;
|
|
500
|
+
name: string;
|
|
501
|
+
color?: string;
|
|
502
|
+
/** Only used for composed chart */
|
|
503
|
+
composedType?: "line" | "bar" | "area";
|
|
504
|
+
}
|
|
505
|
+
interface ChartConfig {
|
|
506
|
+
type: "line" | "bar" | "area" | "pie" | "donut" | "scatter" | "radar" | "composed" | "waterfall" | "funnel" | "treemap" | "radialBar" | "heatmap";
|
|
507
|
+
categoryKey: string;
|
|
508
|
+
series: ChartConfigSeries[];
|
|
509
|
+
legend?: string;
|
|
510
|
+
grid?: boolean;
|
|
511
|
+
animate?: boolean;
|
|
512
|
+
tooltip?: ChartTooltipProp;
|
|
513
|
+
}
|
|
514
|
+
interface ChartRendererProps {
|
|
515
|
+
config: ChartConfig;
|
|
516
|
+
data: Record<string, unknown>[];
|
|
517
|
+
height?: number | string;
|
|
518
|
+
className?: string;
|
|
519
|
+
}
|
|
520
|
+
declare const ChartRenderer: React.NamedExoticComponent<ChartRendererProps>;
|
|
521
|
+
|
|
522
|
+
interface ChartBuilderProps {
|
|
523
|
+
/** Available data columns the user can map to chart dimensions */
|
|
524
|
+
columns: string[];
|
|
525
|
+
/** The raw data rows */
|
|
526
|
+
data: Record<string, unknown>[];
|
|
527
|
+
/** Called when the config changes */
|
|
528
|
+
onChange?: (config: ChartConfig) => void;
|
|
529
|
+
/** Called when user explicitly saves */
|
|
530
|
+
onSave?: (config: ChartConfig) => void;
|
|
531
|
+
/** Initial config to start editing */
|
|
532
|
+
initialConfig?: Partial<ChartConfig>;
|
|
533
|
+
className?: string;
|
|
534
|
+
}
|
|
535
|
+
declare const ChartBuilder: React.NamedExoticComponent<ChartBuilderProps>;
|
|
239
536
|
|
|
240
|
-
export {
|
|
537
|
+
export { AreaChart, type AreaChartProps, type AreaChartSeries, BarChart, type BarChartProps, type BarChartSeries, type BaseChartProps, CHART_COLORS, ChartBuilder, type ChartBuilderProps, type ChartConfig, type ChartConfigSeries, ChartContainer, type ChartContainerProps, type ChartGrid, type ChartLegend, ChartLegendContent, type ChartMargin, ChartRenderer, type ChartRendererProps, type ChartTooltipConfig, ChartTooltipContent, type ChartTooltipContentProps, type ChartTooltipProp, type ChartXAxis, type ChartYAxis, ComposedChart, type ComposedChartProps, type ComposedChartSeries, DonutChart, type DonutChartDatum, type DonutChartProps, FunnelChart, type FunnelChartProps, type FunnelDatum, GanttChart, type GanttChartProps, type GanttMilestone, type GanttTask, type GanttTimeScale, type HeatmapCell, HeatmapChart, type HeatmapChartProps, type HeatmapColorScale, KPICard, type KPICardProps, LineChart, type LineChartProps, type LineChartSeries, PieChart, type PieChartDatum, type PieChartProps, RadarChart, type RadarChartProps, type RadarChartSeries, RadialBarChart, type RadialBarChartProps, type RadialBarDatum, SankeyChart, type SankeyChartData, type SankeyChartProps, type SankeyLink, type SankeyNode, ScatterChart, type ScatterChartProps, type ScatterChartSeries, ScenarioComparison, type ScenarioComparisonMode, type ScenarioComparisonProps, type ScenarioData, type SemanticColorName, Sparkline, type SparklineProps, type SparklineVariant, type TooltipFormatter, TreemapChart, type TreemapChartProps, type TreemapDatum, type UseLiveDataConfig, type UseLiveDataReturn, WaterfallChart, type WaterfallChartProps, type WaterfallItem, formatCompact, formatCurrency, formatDuration, formatPercent, formatUnit, getChartColor, getSemanticColor, resolveLegendConfig, resolveTooltipProps, useLiveData };
|