radiant-charts-core 0.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/LICENSE +21 -0
- package/LICENSE.md +21 -0
- package/dist/index.d.mts +431 -0
- package/dist/index.d.ts +431 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +9 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +31 -0
- package/src/Declarative.tsx +503 -0
- package/src/RadiantChart.tsx +446 -0
- package/src/ResponsiveContainer.tsx +128 -0
- package/src/axes/CartesianAxis.ts +305 -0
- package/src/core/Animator.ts +119 -0
- package/src/core/ChartManager.ts +1062 -0
- package/src/core/CrosshairManager.ts +334 -0
- package/src/core/Legend.ts +269 -0
- package/src/core/ThemeManager.ts +98 -0
- package/src/index.ts +31 -0
- package/src/scale/Scale.ts +99 -0
- package/src/scene/Node.ts +183 -0
- package/src/scene/Scene.ts +197 -0
- package/src/scene/Shapes.ts +446 -0
- package/src/series/AreaSeries.ts +315 -0
- package/src/series/BarSeries.ts +502 -0
- package/src/series/LineSeries.ts +284 -0
- package/src/series/PieSeries.ts +203 -0
- package/src/series/ScatterSeries.ts +305 -0
- package/src/tooltip/TooltipContext.ts +22 -0
- package/src/tooltip/TooltipStore.ts +169 -0
- package/src/tooltip/__tests__/TooltipStore.test.ts +176 -0
- package/src/tooltip/coordUtils.ts +41 -0
- package/src/tooltip/index.ts +18 -0
- package/src/tooltip/types.ts +57 -0
- package/src/tooltip/useChartTooltip.ts +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RadiantCharts
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RadiantCharts
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type TooltipTrigger = 'hover' | 'none';
|
|
4
|
+
type TooltipMode = 'shared' | 'item';
|
|
5
|
+
type TooltipPositionMode = 'follow-pointer' | 'snap-to-data' | 'fixed';
|
|
6
|
+
interface TooltipDatumEntry {
|
|
7
|
+
seriesIndex: number;
|
|
8
|
+
seriesId: string;
|
|
9
|
+
seriesType: string;
|
|
10
|
+
title: string;
|
|
11
|
+
color: string;
|
|
12
|
+
datum: Record<string, any>;
|
|
13
|
+
dataIndex: number;
|
|
14
|
+
xValue: any;
|
|
15
|
+
yValue: any;
|
|
16
|
+
}
|
|
17
|
+
interface TooltipState {
|
|
18
|
+
active: boolean;
|
|
19
|
+
/** Raw mouse position — viewport-relative (clientX/Y) */
|
|
20
|
+
pointerX: number;
|
|
21
|
+
pointerY: number;
|
|
22
|
+
/** Snapped data-point position — viewport-relative, used as portal anchor */
|
|
23
|
+
anchorX: number;
|
|
24
|
+
anchorY: number;
|
|
25
|
+
/** Chart-local coordinates (relative to container top-left) */
|
|
26
|
+
localX: number;
|
|
27
|
+
localY: number;
|
|
28
|
+
/** Active data entries */
|
|
29
|
+
entries: TooltipDatumEntry[];
|
|
30
|
+
/** Shared X-axis label (for shared mode) */
|
|
31
|
+
sharedLabel: string | null;
|
|
32
|
+
}
|
|
33
|
+
interface TooltipOptions {
|
|
34
|
+
enabled?: boolean;
|
|
35
|
+
trigger?: TooltipTrigger;
|
|
36
|
+
mode?: TooltipMode;
|
|
37
|
+
positionMode?: TooltipPositionMode;
|
|
38
|
+
delay?: {
|
|
39
|
+
show?: number;
|
|
40
|
+
hide?: number;
|
|
41
|
+
};
|
|
42
|
+
offset?: {
|
|
43
|
+
x?: number;
|
|
44
|
+
y?: number;
|
|
45
|
+
};
|
|
46
|
+
snap?: boolean;
|
|
47
|
+
shared?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface DataLabelOptions {
|
|
51
|
+
readonly enabled?: boolean;
|
|
52
|
+
/** 'top' | 'bottom' | 'left' | 'right' | 'inside' | 'center' | 'outside' */
|
|
53
|
+
readonly position?: string;
|
|
54
|
+
readonly fontSize?: number;
|
|
55
|
+
readonly fontFamily?: string;
|
|
56
|
+
readonly fill?: string;
|
|
57
|
+
readonly fontWeight?: string;
|
|
58
|
+
readonly rotation?: number;
|
|
59
|
+
}
|
|
60
|
+
interface AnimationOptions {
|
|
61
|
+
readonly enabled?: boolean;
|
|
62
|
+
readonly duration?: number;
|
|
63
|
+
readonly easing?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic' | 'bounce' | 'elastic' | 'back';
|
|
64
|
+
readonly type?: 'grow' | 'fade' | 'slide' | 'pop' | 'draw' | 'radial';
|
|
65
|
+
readonly delay?: number;
|
|
66
|
+
}
|
|
67
|
+
interface DropShadow {
|
|
68
|
+
readonly enabled?: boolean;
|
|
69
|
+
readonly color?: string;
|
|
70
|
+
readonly xOffset?: number;
|
|
71
|
+
readonly yOffset?: number;
|
|
72
|
+
readonly blur?: number;
|
|
73
|
+
}
|
|
74
|
+
type MarkerShape = 'circle' | 'square' | 'cross' | 'diamond' | 'triangle' | 'plus';
|
|
75
|
+
interface MarkerOptions {
|
|
76
|
+
readonly enabled?: boolean;
|
|
77
|
+
readonly shape?: MarkerShape;
|
|
78
|
+
readonly size?: number;
|
|
79
|
+
readonly fill?: string;
|
|
80
|
+
readonly stroke?: string;
|
|
81
|
+
readonly strokeWidth?: number;
|
|
82
|
+
}
|
|
83
|
+
interface RadiantChartOptions {
|
|
84
|
+
readonly data: readonly any[];
|
|
85
|
+
readonly animation?: AnimationOptions;
|
|
86
|
+
readonly title?: {
|
|
87
|
+
text: string;
|
|
88
|
+
fontSize?: number;
|
|
89
|
+
fill?: string;
|
|
90
|
+
};
|
|
91
|
+
readonly subtitle?: {
|
|
92
|
+
text: string;
|
|
93
|
+
fontSize?: number;
|
|
94
|
+
fill?: string;
|
|
95
|
+
};
|
|
96
|
+
readonly legend?: {
|
|
97
|
+
readonly enabled?: boolean;
|
|
98
|
+
readonly position?: 'top' | 'bottom' | 'left' | 'right';
|
|
99
|
+
readonly type?: 'discrete';
|
|
100
|
+
readonly listeners?: {
|
|
101
|
+
readonly legendItemClick?: (event: {
|
|
102
|
+
seriesId: string;
|
|
103
|
+
visible: boolean;
|
|
104
|
+
}) => void;
|
|
105
|
+
readonly legendItemDoubleClick?: (event: {
|
|
106
|
+
seriesId: string;
|
|
107
|
+
isolated: boolean;
|
|
108
|
+
}) => void;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Node-level pointer event callbacks. Triggered when the user interacts with
|
|
113
|
+
* an individual data point (bar / marker / sector / etc).
|
|
114
|
+
*/
|
|
115
|
+
readonly listeners?: {
|
|
116
|
+
readonly nodeClick?: (event: {
|
|
117
|
+
seriesId: string;
|
|
118
|
+
datum: any;
|
|
119
|
+
xKey?: string;
|
|
120
|
+
yKey?: string;
|
|
121
|
+
type?: string;
|
|
122
|
+
}) => void;
|
|
123
|
+
readonly nodeDoubleClick?: (event: {
|
|
124
|
+
seriesId: string;
|
|
125
|
+
datum: any;
|
|
126
|
+
xKey?: string;
|
|
127
|
+
yKey?: string;
|
|
128
|
+
type?: string;
|
|
129
|
+
}) => void;
|
|
130
|
+
};
|
|
131
|
+
readonly showXAxis?: boolean;
|
|
132
|
+
readonly showYAxis?: boolean;
|
|
133
|
+
readonly showYAxisRight?: boolean;
|
|
134
|
+
readonly xAxisFontSize?: number;
|
|
135
|
+
readonly xAxisFontFamily?: string;
|
|
136
|
+
readonly xAxisRotation?: number;
|
|
137
|
+
readonly xAxisLabelAlignment?: 'start' | 'center' | 'end';
|
|
138
|
+
readonly yAxisFontSize?: number;
|
|
139
|
+
readonly yAxisFontFamily?: string;
|
|
140
|
+
readonly yAxisRotation?: number;
|
|
141
|
+
readonly yAxisLabelAlignment?: 'start' | 'center' | 'end';
|
|
142
|
+
readonly yAxisRightFontSize?: number;
|
|
143
|
+
readonly yAxisRightFontFamily?: string;
|
|
144
|
+
readonly yAxisRightRotation?: number;
|
|
145
|
+
readonly yAxisRightLabelAlignment?: 'start' | 'center' | 'end';
|
|
146
|
+
readonly series: readonly {
|
|
147
|
+
readonly type?: 'bar' | 'line' | 'pie' | 'donut' | 'area' | 'scatter';
|
|
148
|
+
readonly animation?: AnimationOptions;
|
|
149
|
+
readonly yAxisId?: 'left' | 'right';
|
|
150
|
+
readonly xAxisKey?: string;
|
|
151
|
+
readonly yAxisKey?: string;
|
|
152
|
+
readonly xKey?: string;
|
|
153
|
+
readonly yKey?: string;
|
|
154
|
+
readonly angleKey?: string;
|
|
155
|
+
readonly labelKey?: string;
|
|
156
|
+
readonly shadow?: DropShadow;
|
|
157
|
+
readonly connectMissingData?: boolean;
|
|
158
|
+
readonly sizeKey?: string;
|
|
159
|
+
readonly markerSize?: number;
|
|
160
|
+
readonly title?: string;
|
|
161
|
+
readonly fill?: string;
|
|
162
|
+
readonly stroke?: string;
|
|
163
|
+
readonly strokeWidth?: number;
|
|
164
|
+
readonly fills?: readonly string[];
|
|
165
|
+
readonly innerRadius?: number;
|
|
166
|
+
readonly outerRadius?: number;
|
|
167
|
+
readonly startAngle?: number;
|
|
168
|
+
readonly endAngle?: number;
|
|
169
|
+
readonly padAngle?: number;
|
|
170
|
+
readonly fillOpacity?: number;
|
|
171
|
+
readonly cornerRadius?: number;
|
|
172
|
+
readonly grouped?: boolean;
|
|
173
|
+
readonly stacked?: boolean;
|
|
174
|
+
readonly normalized?: boolean;
|
|
175
|
+
readonly direction?: 'vertical' | 'horizontal';
|
|
176
|
+
readonly interpolation?: 'linear' | 'step' | 'smooth';
|
|
177
|
+
/** @deprecated use interpolation:'step' */
|
|
178
|
+
readonly step?: boolean;
|
|
179
|
+
readonly marker?: MarkerOptions;
|
|
180
|
+
readonly jitter?: number;
|
|
181
|
+
readonly labels?: DataLabelOptions;
|
|
182
|
+
}[];
|
|
183
|
+
theme?: 'light' | 'dark' | 'system';
|
|
184
|
+
padding?: {
|
|
185
|
+
readonly top?: number;
|
|
186
|
+
readonly right?: number;
|
|
187
|
+
readonly bottom?: number;
|
|
188
|
+
readonly left?: number;
|
|
189
|
+
readonly inner?: number;
|
|
190
|
+
};
|
|
191
|
+
crosshair?: {
|
|
192
|
+
readonly x?: boolean;
|
|
193
|
+
readonly y?: boolean;
|
|
194
|
+
};
|
|
195
|
+
tooltip?: TooltipOptions;
|
|
196
|
+
toolbar?: {
|
|
197
|
+
readonly showExport?: boolean;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Callback triggered when keyboard navigation moves the internal focus index.
|
|
201
|
+
* Used for synchronizing the virtualized accessibility table.
|
|
202
|
+
*/
|
|
203
|
+
readonly onFocusChange?: (index: number | null) => void;
|
|
204
|
+
}
|
|
205
|
+
interface RadiantChartHandle {
|
|
206
|
+
/**
|
|
207
|
+
* Exports the current chart as a PNG and triggers a browser download.
|
|
208
|
+
* @param filename Download filename. Defaults to 'chart.png'.
|
|
209
|
+
*/
|
|
210
|
+
exportToPng(filename?: string): void;
|
|
211
|
+
}
|
|
212
|
+
interface RadiantChartProps {
|
|
213
|
+
options: RadiantChartOptions;
|
|
214
|
+
/**
|
|
215
|
+
* Explicit width for the chart container. Number = px, string = CSS value.
|
|
216
|
+
* Defaults to '100%'. For responsive sizing wrap with ResponsiveContainer.
|
|
217
|
+
*/
|
|
218
|
+
width?: number | string;
|
|
219
|
+
/**
|
|
220
|
+
* Explicit height for the chart container. Number = px, string = CSS value.
|
|
221
|
+
* Defaults to '100%'. When using '100%' the parent must have a defined height,
|
|
222
|
+
* or wrap with ResponsiveContainer which handles this automatically.
|
|
223
|
+
*/
|
|
224
|
+
height?: number | string;
|
|
225
|
+
className?: string;
|
|
226
|
+
style?: React.CSSProperties;
|
|
227
|
+
}
|
|
228
|
+
declare const RadiantChart: React.ForwardRefExoticComponent<RadiantChartProps & React.RefAttributes<RadiantChartHandle>>;
|
|
229
|
+
|
|
230
|
+
interface ResponsiveContainerProps {
|
|
231
|
+
/**
|
|
232
|
+
* Width of the container. Number = pixels, string = CSS value (e.g. '100%').
|
|
233
|
+
* Default: '100%'
|
|
234
|
+
*/
|
|
235
|
+
width?: number | string;
|
|
236
|
+
/**
|
|
237
|
+
* Height of the container. Number = pixels, string = CSS value (e.g. '100%').
|
|
238
|
+
* When '100%' the container observes its parent and fills it.
|
|
239
|
+
* Default: 300
|
|
240
|
+
*/
|
|
241
|
+
height?: number | string;
|
|
242
|
+
/** Minimum height in px applied as a CSS floor. Default: 100 */
|
|
243
|
+
minHeight?: number;
|
|
244
|
+
/** Minimum width in px applied as a CSS floor. Default: 0 */
|
|
245
|
+
minWidth?: number;
|
|
246
|
+
/**
|
|
247
|
+
* Aspect ratio (width ÷ height). When set, height is derived from the
|
|
248
|
+
* measured container width and this ratio. Overrides `height`.
|
|
249
|
+
*/
|
|
250
|
+
aspect?: number;
|
|
251
|
+
/**
|
|
252
|
+
* Debounce resize callbacks by N ms to avoid excessive re-renders.
|
|
253
|
+
* Default: 0 (no debounce)
|
|
254
|
+
*/
|
|
255
|
+
debounce?: number;
|
|
256
|
+
className?: string;
|
|
257
|
+
style?: React.CSSProperties;
|
|
258
|
+
children: React.ReactNode;
|
|
259
|
+
}
|
|
260
|
+
declare const ResponsiveContainer: React.FC<ResponsiveContainerProps>;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Radiant Charts — Declarative JSX API
|
|
264
|
+
*
|
|
265
|
+
* Provides a composable, JSX-first interface that React developers expect.
|
|
266
|
+
* Children register their configuration with the parent <Chart> via context;
|
|
267
|
+
* the parent assembles a standard RadiantChartOptions object and renders a
|
|
268
|
+
* single imperative RadiantChart under the hood.
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```tsx
|
|
272
|
+
* import { Chart, Bar, Line, XAxis, YAxis, Title, Legend } from 'radiant-charts/Declarative';
|
|
273
|
+
*
|
|
274
|
+
* const data = [
|
|
275
|
+
* { month: 'Jan', sales: 120, target: 100 },
|
|
276
|
+
* { month: 'Feb', sales: 150, target: 130 },
|
|
277
|
+
* { month: 'Mar', sales: 135, target: 140 },
|
|
278
|
+
* ];
|
|
279
|
+
*
|
|
280
|
+
* export default function Revenue() {
|
|
281
|
+
* return (
|
|
282
|
+
* <Chart data={data} theme="dark" height={400}>
|
|
283
|
+
* <Title text="Monthly Revenue" />
|
|
284
|
+
* <Legend position="bottom" />
|
|
285
|
+
* <XAxis fontSize={11} rotation={-45} />
|
|
286
|
+
* <YAxis show={false} />
|
|
287
|
+
* <Bar xKey="month" yKey="sales" fill="#4e79a7" cornerRadius={4} />
|
|
288
|
+
* <Line xKey="month" yKey="target" stroke="#e15759" />
|
|
289
|
+
* </Chart>
|
|
290
|
+
* );
|
|
291
|
+
* }
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
|
|
295
|
+
interface ChartProps {
|
|
296
|
+
/** The data array shared by all series children. */
|
|
297
|
+
data: readonly any[];
|
|
298
|
+
/** Color theme. Accepts 'light', 'dark', or 'system'. */
|
|
299
|
+
theme?: 'light' | 'dark' | 'system';
|
|
300
|
+
/** Chart width. Number = px, string = CSS value. Default '100%'. */
|
|
301
|
+
width?: number | string;
|
|
302
|
+
/** Chart height. Number = px, string = CSS value. Default '100%'. */
|
|
303
|
+
height?: number | string;
|
|
304
|
+
/** Global animation options applied to all series. */
|
|
305
|
+
animation?: AnimationOptions;
|
|
306
|
+
/** Padding around the plot area. */
|
|
307
|
+
padding?: {
|
|
308
|
+
top?: number;
|
|
309
|
+
right?: number;
|
|
310
|
+
bottom?: number;
|
|
311
|
+
left?: number;
|
|
312
|
+
inner?: number;
|
|
313
|
+
};
|
|
314
|
+
/** Crosshair configuration. */
|
|
315
|
+
crosshair?: {
|
|
316
|
+
x?: boolean;
|
|
317
|
+
y?: boolean;
|
|
318
|
+
};
|
|
319
|
+
/** Tooltip configuration. */
|
|
320
|
+
tooltip?: TooltipOptions;
|
|
321
|
+
/** Show the export toolbar in the top-right corner. */
|
|
322
|
+
showExport?: boolean;
|
|
323
|
+
/** Additional class name applied to the container. */
|
|
324
|
+
className?: string;
|
|
325
|
+
/** Inline style applied to the container. */
|
|
326
|
+
style?: React.CSSProperties;
|
|
327
|
+
/** Access the imperative chart handle (e.g. exportToPng). */
|
|
328
|
+
chartRef?: React.Ref<RadiantChartHandle>;
|
|
329
|
+
/** Declarative series, axis, title, legend, and annotation children. */
|
|
330
|
+
children?: React.ReactNode;
|
|
331
|
+
}
|
|
332
|
+
declare const Chart: React.FC<ChartProps>;
|
|
333
|
+
/** Shared props accepted by every series component. */
|
|
334
|
+
interface CommonSeriesProps {
|
|
335
|
+
xKey?: string;
|
|
336
|
+
yKey?: string;
|
|
337
|
+
fill?: string;
|
|
338
|
+
stroke?: string;
|
|
339
|
+
strokeWidth?: number;
|
|
340
|
+
fillOpacity?: number;
|
|
341
|
+
cornerRadius?: number;
|
|
342
|
+
title?: string;
|
|
343
|
+
grouped?: boolean;
|
|
344
|
+
stacked?: boolean;
|
|
345
|
+
normalized?: boolean;
|
|
346
|
+
direction?: 'vertical' | 'horizontal';
|
|
347
|
+
interpolation?: 'linear' | 'step' | 'smooth';
|
|
348
|
+
marker?: {
|
|
349
|
+
enabled?: boolean;
|
|
350
|
+
size?: number;
|
|
351
|
+
fill?: string;
|
|
352
|
+
};
|
|
353
|
+
labels?: DataLabelOptions;
|
|
354
|
+
animation?: AnimationOptions;
|
|
355
|
+
yAxisId?: 'left' | 'right';
|
|
356
|
+
/** Any additional props are forwarded verbatim to the engine. */
|
|
357
|
+
[key: string]: any;
|
|
358
|
+
}
|
|
359
|
+
declare const Bar: React.FC<CommonSeriesProps>;
|
|
360
|
+
declare const Line: React.FC<CommonSeriesProps>;
|
|
361
|
+
declare const Area: React.FC<CommonSeriesProps>;
|
|
362
|
+
declare const Scatter: React.FC<CommonSeriesProps>;
|
|
363
|
+
declare const Pie: React.FC<CommonSeriesProps>;
|
|
364
|
+
declare const Donut: React.FC<CommonSeriesProps>;
|
|
365
|
+
interface AxisProps {
|
|
366
|
+
/** Show or hide this axis. Default: true. */
|
|
367
|
+
show?: boolean;
|
|
368
|
+
/** Font size for axis labels in px. */
|
|
369
|
+
fontSize?: number;
|
|
370
|
+
/** Font family for axis labels. */
|
|
371
|
+
fontFamily?: string;
|
|
372
|
+
/** Label rotation in degrees. */
|
|
373
|
+
rotation?: number;
|
|
374
|
+
/** Label alignment. */
|
|
375
|
+
labelAlignment?: 'start' | 'center' | 'end';
|
|
376
|
+
}
|
|
377
|
+
declare const XAxis: React.FC<AxisProps>;
|
|
378
|
+
declare const YAxis: React.FC<AxisProps>;
|
|
379
|
+
declare const YAxisRight: React.FC<AxisProps>;
|
|
380
|
+
interface TitleProps {
|
|
381
|
+
text: string;
|
|
382
|
+
fontSize?: number;
|
|
383
|
+
fill?: string;
|
|
384
|
+
}
|
|
385
|
+
declare const Title: React.FC<TitleProps>;
|
|
386
|
+
declare const Subtitle: React.FC<TitleProps>;
|
|
387
|
+
interface LegendProps {
|
|
388
|
+
/** Show or hide the legend. Default: true. */
|
|
389
|
+
enabled?: boolean;
|
|
390
|
+
/** Legend placement. */
|
|
391
|
+
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
392
|
+
}
|
|
393
|
+
declare const Legend: React.FC<LegendProps>;
|
|
394
|
+
interface TooltipProps extends TooltipOptions {
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Configure the tooltip system declaratively as a child of `<Chart>`.
|
|
398
|
+
* This is a config-only component — it renders nothing.
|
|
399
|
+
* Props are passed through to the chart's tooltip options.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* <Chart data={data}>
|
|
403
|
+
* <Tooltip
|
|
404
|
+
* mode="shared"
|
|
405
|
+
* snap
|
|
406
|
+
* sticky
|
|
407
|
+
* bulletShape="circle"
|
|
408
|
+
* bodyTemplate="Revenue: ${revenue}"
|
|
409
|
+
* footerTemplate="Source: ${source}"
|
|
410
|
+
* style={{ background: '#1a1a2e', borderRadius: 12 }}
|
|
411
|
+
* />
|
|
412
|
+
* <Bar xKey="month" yKey="sales" />
|
|
413
|
+
* </Chart>
|
|
414
|
+
*/
|
|
415
|
+
declare const Tooltip: React.FC<TooltipProps>;
|
|
416
|
+
|
|
417
|
+
interface ChartTooltipContext {
|
|
418
|
+
active: boolean;
|
|
419
|
+
entries: TooltipDatumEntry[];
|
|
420
|
+
sharedLabel: string | null;
|
|
421
|
+
pointerX: number;
|
|
422
|
+
pointerY: number;
|
|
423
|
+
anchorX: number;
|
|
424
|
+
anchorY: number;
|
|
425
|
+
localX: number;
|
|
426
|
+
localY: number;
|
|
427
|
+
hide: () => void;
|
|
428
|
+
}
|
|
429
|
+
declare function useChartTooltip(): ChartTooltipContext;
|
|
430
|
+
|
|
431
|
+
export { type AnimationOptions, Area, type AxisProps, Bar, Chart, type ChartProps, type ChartTooltipContext, type DataLabelOptions, Donut, type DropShadow, Legend, type LegendProps, Line, type MarkerOptions, type MarkerShape, Pie, RadiantChart, type RadiantChartHandle, type RadiantChartOptions, ResponsiveContainer, Scatter, Subtitle, Title, type TitleProps, Tooltip, type TooltipDatumEntry, type TooltipMode, type TooltipOptions, type TooltipPositionMode, type TooltipProps, type TooltipState, type TooltipTrigger, XAxis, YAxis, YAxisRight, useChartTooltip };
|