@syncfusion/react-grid-chart 35.1.37

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 (47) hide show
  1. package/README.md +136 -0
  2. package/grid-chart.d.ts +4 -0
  3. package/grid-chart.js +4 -0
  4. package/index.d.ts +4 -0
  5. package/index.js +4 -0
  6. package/license +13 -0
  7. package/package.json +37 -0
  8. package/src/grid-chart/components/ColorPicker.d.ts +30 -0
  9. package/src/grid-chart/components/ColorPicker.js +39 -0
  10. package/src/grid-chart/components/index.d.ts +1 -0
  11. package/src/grid-chart/components/index.js +1 -0
  12. package/src/grid-chart/contexts/GridChartContext.d.ts +64 -0
  13. package/src/grid-chart/contexts/GridChartContext.js +140 -0
  14. package/src/grid-chart/contexts/index.d.ts +1 -0
  15. package/src/grid-chart/contexts/index.js +1 -0
  16. package/src/grid-chart/index.d.ts +5 -0
  17. package/src/grid-chart/index.js +5 -0
  18. package/src/grid-chart/types/grid-chart.interfaces.d.ts +1066 -0
  19. package/src/grid-chart/types/grid-chart.interfaces.js +1 -0
  20. package/src/grid-chart/types/index.d.ts +1 -0
  21. package/src/grid-chart/types/index.js +1 -0
  22. package/src/grid-chart/utils/index.d.ts +1 -0
  23. package/src/grid-chart/utils/index.js +1 -0
  24. package/src/grid-chart/utils/utils.d.ts +52 -0
  25. package/src/grid-chart/utils/utils.js +73 -0
  26. package/src/grid-chart/views/ChartPanel.d.ts +13 -0
  27. package/src/grid-chart/views/ChartPanel.js +67 -0
  28. package/src/grid-chart/views/ChartTab.d.ts +15 -0
  29. package/src/grid-chart/views/ChartTab.js +91 -0
  30. package/src/grid-chart/views/DataTab.d.ts +17 -0
  31. package/src/grid-chart/views/DataTab.js +77 -0
  32. package/src/grid-chart/views/ExportPanel.d.ts +15 -0
  33. package/src/grid-chart/views/ExportPanel.js +75 -0
  34. package/src/grid-chart/views/FormatTab.d.ts +20 -0
  35. package/src/grid-chart/views/FormatTab.js +135 -0
  36. package/src/grid-chart/views/GridChart.d.ts +42 -0
  37. package/src/grid-chart/views/GridChart.js +66 -0
  38. package/src/grid-chart/views/GridChartPanel.d.ts +13 -0
  39. package/src/grid-chart/views/GridChartPanel.js +35 -0
  40. package/src/grid-chart/views/PropertyPanel.d.ts +16 -0
  41. package/src/grid-chart/views/PropertyPanel.js +22 -0
  42. package/src/grid-chart/views/index.d.ts +8 -0
  43. package/src/grid-chart/views/index.js +8 -0
  44. package/src/index.d.ts +1 -0
  45. package/src/index.js +1 -0
  46. package/styles/material.css +0 -0
  47. package/styles/material.scss +0 -0
@@ -0,0 +1,1066 @@
1
+ import { Chart, IChart, IPieChart, PieChart } from '@syncfusion/react-charts';
2
+ import { Dialog } from '@syncfusion/react-popups';
3
+ import { ComponentProps, ComponentType, Dispatch, ReactElement, ReactNode, RefObject, SetStateAction, SVGProps } from 'react';
4
+ /**
5
+ * Defines the context type for the GridChart component.
6
+ * Provides centralized state management for chart configuration, formatting, and UI state.
7
+ * Used throughout the GridChart component tree via React Context API.
8
+ *
9
+ * @interface GridChartContextType
10
+ * @private
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * const context = useGridChartSettings();
15
+ * context.setChartInfo({ chart: 'Column', isChart: true, isPieChart: false });
16
+ * context.setFormat({ ...context.format, titleText: 'Sales Report' });
17
+ * ```
18
+ */
19
+ export interface GridChartContextType {
20
+ /**
21
+ * Reference to the current GridChart settings.
22
+ * Contains the chart configuration, data source, category, and series information.
23
+ *
24
+ * @type {RefObject<GridChartSettings>}
25
+ */
26
+ settings: RefObject<GridChartSettings>;
27
+ /**
28
+ * Current chart information including chart type and classification.
29
+ * Determines which UI elements and formatting options are available.
30
+ *
31
+ * @type {ChartInfo}
32
+ * @default { chart: 'Column', isChart: true, isPieChart: false }
33
+ */
34
+ chartInfo: ChartInfo;
35
+ /**
36
+ * State setter for updating chart information.
37
+ * Use to change the chart type and related metadata.
38
+ *
39
+ * @type {Dispatch<SetStateAction<ChartInfo>>}
40
+ */
41
+ setChartInfo: Dispatch<SetStateAction<ChartInfo>>;
42
+ /**
43
+ * Current field selected for the category (X-axis) of the chart.
44
+ * Used by column, bar, line, and area charts.
45
+ *
46
+ * @type {string}
47
+ * @default ''
48
+ */
49
+ categoryAxis: string;
50
+ /**
51
+ * State setter for updating the category axis field.
52
+ * Triggers chart re-render when changed.
53
+ *
54
+ * @type {Dispatch<SetStateAction<string>>}
55
+ */
56
+ setCategoryAxis: Dispatch<SetStateAction<string>>;
57
+ /**
58
+ * Array of field names selected as data series for the chart.
59
+ * Multiple series can be displayed simultaneously for comparison.
60
+ *
61
+ * @type {string[]}
62
+ * @default []
63
+ */
64
+ series: string[];
65
+ /**
66
+ * State setter for updating the series array.
67
+ * Used to add or remove data series from the chart.
68
+ *
69
+ * @type {Dispatch<SetStateAction<string[]>>}
70
+ */
71
+ setSeries: Dispatch<SetStateAction<string[]>>;
72
+ /**
73
+ * Current field selected for the value (Y-axis) of the chart.
74
+ * Used by pie charts and scatter charts.
75
+ *
76
+ * @type {string}
77
+ * @default ''
78
+ */
79
+ valueAxis: string;
80
+ /**
81
+ * State setter for updating the value axis field.
82
+ * Used primarily for pie and scatter chart configurations.
83
+ *
84
+ * @type {Dispatch<SetStateAction<string>>}
85
+ */
86
+ setValueAxis: Dispatch<SetStateAction<string>>;
87
+ /**
88
+ * Reference to the Syncfusion Chart component (for non-pie charts).
89
+ * Provides access to chart methods and properties for column, bar, line, area, and scatter charts.
90
+ *
91
+ * @type {RefObject<IChart>}
92
+ * @default null
93
+ */
94
+ chartRef: RefObject<IChart>;
95
+ /**
96
+ * Reference to the Syncfusion PieChart component (for pie charts).
97
+ * Provides access to pie chart-specific methods and properties.
98
+ *
99
+ * @type {RefObject<IPieChart>}
100
+ * @default null
101
+ */
102
+ pieChartRef: RefObject<IPieChart>;
103
+ /**
104
+ * Controls visibility of the property panel (side panel with formatting options).
105
+ * When true, the Format tab and other configuration options are displayed.
106
+ *
107
+ * @type {boolean}
108
+ * @default false
109
+ */
110
+ showSidePanel: boolean;
111
+ /**
112
+ * State setter for toggling the side panel visibility.
113
+ * Used to show/hide the property panel with formatting controls.
114
+ *
115
+ * @type {Dispatch<SetStateAction<boolean>>}
116
+ */
117
+ setShowSidePanel: Dispatch<SetStateAction<boolean>>;
118
+ /**
119
+ * Current formatting configuration for the chart.
120
+ * Includes margins, colors, fonts, and axis settings.
121
+ * Updated through the FormatTab component.
122
+ *
123
+ * @type {Format}
124
+ */
125
+ format: Format;
126
+ /**
127
+ * State setter for updating the chart format settings.
128
+ * Used to apply styling changes like colors, fonts, margins, and axis labels.
129
+ *
130
+ * @type {Dispatch<SetStateAction<Format>>}
131
+ */
132
+ setFormat: Dispatch<SetStateAction<Format>>;
133
+ }
134
+ /**
135
+ * Props for the GridChartProvider component.
136
+ * Wraps child components with GridChart context and provides initial settings.
137
+ *
138
+ * @interface GridChartProviderProps
139
+ * @private
140
+ *
141
+ * @example
142
+ * ```tsx
143
+ * <GridChartProvider settings={settingsRef}>
144
+ * <GridChartPanel />
145
+ * </GridChartProvider>
146
+ * ```
147
+ */
148
+ export interface GridChartProviderProps {
149
+ /**
150
+ * React elements to be wrapped with GridChart context.
151
+ * All child components have access to the GridChart context API.
152
+ *
153
+ * @type {ReactElement}
154
+ */
155
+ children: ReactElement;
156
+ /**
157
+ * Reference to the GridChart settings object.
158
+ * Shared with all child components via context.
159
+ *
160
+ * @type {RefObject<GridChartSettings>}
161
+ */
162
+ settings: RefObject<GridChartSettings>;
163
+ }
164
+ /**
165
+ * Supported chart types for the GridChart component.
166
+ * Each type renders different visual representations of the data.
167
+ *
168
+ * Chart Categories:
169
+ * * **Column/Bar**: Traditional vertical/horizontal bar charts with optional stacking
170
+ * * **Line/Area**: Trend visualization with optional stacking
171
+ * * **Pie**: Categorical data distribution
172
+ * * **Scatter**: Correlation between two numeric series
173
+ *
174
+ * @typedef {'Bar' | 'StackingBar' | 'StackingBar100' | 'Pie' | 'Column' | 'StackingColumn' | 'StackingColumn100' | 'Line' | 'StackingLine' | 'StackingLine100' | 'Area' | 'StackingArea' | 'StackingArea100' | 'Scatter'} ChartType
175
+ *
176
+ * @example
177
+ * ```tsx
178
+ * // Column chart (default)
179
+ * const settings: GridChartSettings = { chart: 'Column', ... };
180
+ *
181
+ * // Stacked column chart
182
+ * const stackedSettings: GridChartSettings = { chart: 'StackingColumn', ... };
183
+ *
184
+ * // Pie chart
185
+ * const pieSettings: GridChartSettings = { chart: 'Pie', ... };
186
+ * ```
187
+ */
188
+ export type ChartType = 'Bar' | 'StackingBar' | 'StackingBar100' | 'Pie' | 'Column' | 'StackingColumn' | 'StackingColumn100' | 'Line' | 'StackingLine' | 'StackingLine100' | 'Area' | 'StackingArea' | 'StackingArea100' | 'Scatter';
189
+ /**
190
+ * Supported export formats for the chart.
191
+ * Users can export charts in multiple file formats through the ExportPanel.
192
+ *
193
+ * Export Formats:
194
+ * * **Print**: Print to physical printer or PDF printer
195
+ * * **JPEG/PNG**: Raster image formats
196
+ * * **SVG**: Scalable vector graphics
197
+ * * **PDF**: Portable document format
198
+ * * **XLSX/CSV**: Spreadsheet and comma-separated values
199
+ *
200
+ * @typedef {'Print' | 'JPEG' | 'PNG' | 'SVG' | 'PDF' | 'XLSX' | 'CSV'} ChartExportItem
201
+ *
202
+ * @example
203
+ * ```tsx
204
+ * const settings: GridChartSettings = {
205
+ * enableExport: true,
206
+ * chartExportItems: ['PNG', 'PDF', 'XLSX', 'CSV']
207
+ * };
208
+ * ```
209
+ */
210
+ export type ChartExportItem = 'Print' | 'JPEG' | 'PNG' | 'SVG' | 'PDF' | 'XLSX' | 'CSV';
211
+ /**
212
+ * Configuration settings for the GridChart component.
213
+ * Defines the chart type, data source, display options, and customizations.
214
+ *
215
+ * @interface GridChartSettings
216
+ *
217
+ * @example
218
+ * ```tsx
219
+ * const gridChartRef = useRef<GridChartRef>(null);
220
+ *
221
+ * const settings: GridChartSettings = {
222
+ * chart: 'Column',
223
+ * dataSource: salesData,
224
+ * category: ['OrderDate'],
225
+ * series: ['Sales', 'Quantity'],
226
+ * enablePropertyPanel: true,
227
+ * enableExport: true,
228
+ * chartExportItems: ['PNG', 'PDF', 'XLSX']
229
+ * };
230
+ *
231
+ * gridChartRef.current?.show(settings);
232
+ * ```
233
+ */
234
+ export interface GridChartSettings {
235
+ /**
236
+ * The type of chart to display.
237
+ * Determines the visualization style and available formatting options.
238
+ *
239
+ * @type {ChartType}
240
+ * @required
241
+ *
242
+ * @example
243
+ * chart: 'Column' // or 'Bar', 'Pie', 'Line', etc.
244
+ */
245
+ chart: ChartType;
246
+ /**
247
+ * Array of data objects to populate the chart. Each object represents a data point in the chart.
248
+ *
249
+ * @type {Object[]}
250
+ * @required
251
+ *
252
+ * @example
253
+ * dataSource: [
254
+ * { OrderID: 10248, Sales: 32.38, OrderDate: '2024-01-01', Category: 'Electronics' },
255
+ * { OrderID: 10249, Sales: 11.61, OrderDate: '2024-01-02', Category: 'Furniture' }
256
+ * ]
257
+ */
258
+ dataSource: Object[];
259
+ /**
260
+ * Array of field names to use as categories on the chart's X-axis (or for pie charts, the category legend).
261
+ * Must reference valid fields from the dataSource objects.
262
+ *
263
+ * @type {string[]}
264
+ * @required
265
+ *
266
+ * @example
267
+ * category: ['OrderDate'] // or ['Category', 'Region']
268
+ */
269
+ category: string[];
270
+ /**
271
+ * Array of field names representing data series to visualize in the chart.
272
+ * Multiple series are displayed simultaneously for comparison.
273
+ *
274
+ * @type {string[]}
275
+ * @required
276
+ *
277
+ * @example
278
+ * series: ['Sales', 'Quantity'] // Display two metrics
279
+ */
280
+ series: string[];
281
+ /**
282
+ * Enables the property panel with chart types, data operations and format options (margins, colors, fonts, axes).
283
+ * When enabled, users can customize the chart appearance through the Format tab.
284
+ *
285
+ * @type {boolean}
286
+ * @default false
287
+ *
288
+ * @example
289
+ * enablePropertyPanel: true
290
+ */
291
+ enablePropertyPanel?: boolean;
292
+ /**
293
+ * Enables the export panel for exporting the chart in multiple formats.
294
+ * When enabled, users can export the chart as PNG, PDF, XLSX, etc.
295
+ *
296
+ * @type {boolean}
297
+ * @default false
298
+ *
299
+ * @example
300
+ * enableExport: true
301
+ */
302
+ enableExport?: boolean;
303
+ /**
304
+ * Array of export formats to make available in the export panel.
305
+ * Ignored if enableExport is false.
306
+ *
307
+ * @type {ChartExportItem[]}
308
+ * @default ['Print', 'PNG', 'JPEG', 'SVG', 'PDF', 'XLSX', 'CSV']
309
+ *
310
+ * @example
311
+ * chartExportItems: ['PNG', 'PDF', 'XLSX']
312
+ */
313
+ chartExportItems?: ChartExportItem[];
314
+ /**
315
+ * Custom props to pass directly to the Syncfusion Chart component.
316
+ * Applies to non-pie charts (Column, Bar, Line, Area, Scatter).
317
+ *
318
+ * @type {Partial<ComponentProps<typeof Chart>>}
319
+ * @default {}
320
+ *
321
+ * @example
322
+ * chartSettings: {
323
+ * border: { width: 2, color: '#000' }
324
+ * }
325
+ */
326
+ chartSettings?: Partial<ComponentProps<typeof Chart>>;
327
+ /**
328
+ * Custom ReactNode to render instead of the default chart.
329
+ * Overrides chart rendering for advanced customization.
330
+ *
331
+ * @type {ReactNode}
332
+ * @default null
333
+ */
334
+ chartNode?: ReactNode;
335
+ /**
336
+ * Custom props to pass directly to the Syncfusion PieChart component.
337
+ * Applies only to pie charts.
338
+ *
339
+ * @type {Partial<ComponentProps<typeof PieChart>>}
340
+ * @default {}
341
+ *
342
+ * @example
343
+ * pieChartSettings: {
344
+ * width: '100%',
345
+ * height: '100%'
346
+ * }
347
+ */
348
+ pieChartSettings?: Partial<ComponentProps<typeof PieChart>>;
349
+ /**
350
+ * Custom ReactNode to render instead of the default pie chart.
351
+ * Overrides pie chart rendering for advanced customization.
352
+ *
353
+ * @type {ReactNode}
354
+ * @default null
355
+ */
356
+ pieChartNode?: ReactNode;
357
+ /**
358
+ * Custom props to pass to the Dialog component wrapping the GridChart.
359
+ * Allows customization of dialog appearance, position, and behavior.
360
+ *
361
+ * @type {Partial<ComponentProps<typeof Dialog>>}
362
+ * @default { draggable: true, modal: true, width: '90%', height: '90%' }
363
+ *
364
+ * @example
365
+ * dialogSettings: {
366
+ * width: '1200px',
367
+ * height: '800px'
368
+ * }
369
+ */
370
+ dialogSettings?: Partial<ComponentProps<typeof Dialog>>;
371
+ }
372
+ /**
373
+ * Reference interface for the GridChart component.
374
+ * Provides imperative methods to control the GridChart from a parent component.
375
+ *
376
+ * @interface GridChartRef
377
+ *
378
+ * @example
379
+ * ```tsx
380
+ * const gridChartRef = useRef<GridChartRef>(null);
381
+ *
382
+ * // Show the chart with settings
383
+ * gridChartRef.current?.show({
384
+ * chart: 'Column',
385
+ * dataSource: data,
386
+ * category: ['Date'],
387
+ * series: ['Revenue']
388
+ * });
389
+ * ```
390
+ */
391
+ export interface GridChartRef {
392
+ /**
393
+ * Displays the GridChart dialog with the provided settings.
394
+ * Opens the dialog and configures the chart, data, and formatting options.
395
+ *
396
+ * @param {GridChartSettings} settings - Configuration settings for the chart
397
+ * @returns {void}
398
+ *
399
+ * @example
400
+ * ```tsx
401
+ * gridChartRef.current?.show({
402
+ * chart: 'Column',
403
+ * dataSource: salesData,
404
+ * category: ['OrderDate'],
405
+ * series: ['Sales', 'Quantity'],
406
+ * enablePropertyPanel: true,
407
+ * enableExport: true
408
+ * });
409
+ * ```
410
+ */
411
+ show: (settings: GridChartSettings) => void;
412
+ }
413
+ /**
414
+ * Props for the GridChart component.
415
+ *
416
+ * @interface GridChartProps
417
+ * @private
418
+ *
419
+ * @example
420
+ * ```tsx
421
+ * const gridChartRef = useRef<GridChartRef>(null);
422
+ * <GridChart ref={gridChartRef} />
423
+ * ```
424
+ */
425
+ export interface GridChartProps {
426
+ }
427
+ /**
428
+ * Represents a single chart option in the chart selection interface.
429
+ * Used to display chart choices in the ChartTab component.
430
+ *
431
+ * @interface ChartItem
432
+ * @private
433
+ *
434
+ * @example
435
+ * ```tsx
436
+ * const columnChartItem: ChartItem = {
437
+ * icon: ColumnChartIcon,
438
+ * label: 'Column',
439
+ * chart: 'Column'
440
+ * };
441
+ * ```
442
+ */
443
+ export interface ChartItem {
444
+ /**
445
+ * React component rendering the chart icon (SVG).
446
+ * Displayed in the chart selection UI.
447
+ *
448
+ * @type {ComponentType<SVGProps<SVGSVGElement>>}
449
+ */
450
+ icon: ComponentType<SVGProps<SVGSVGElement>>;
451
+ /**
452
+ * Human-readable label for the chart type.
453
+ * Displayed below the icon in the chart selection UI.
454
+ *
455
+ * @type {string}
456
+ *
457
+ * @example
458
+ * label: 'Column'
459
+ * label: 'Stacking Column'
460
+ * label: 'Pie'
461
+ */
462
+ label: string;
463
+ /**
464
+ * The chart type identifier.
465
+ * Determines which chart component is rendered when selected.
466
+ *
467
+ * @type {ChartType}
468
+ */
469
+ chart: ChartType;
470
+ }
471
+ /**
472
+ * Groups related chart items by category for organization in the chart selection interface.
473
+ * Categories are displayed as tabs or sections in the ChartTab component.
474
+ *
475
+ * @interface ChartCategory
476
+ * @private
477
+ *
478
+ * @example
479
+ * ```tsx
480
+ * const columnCategory: ChartCategory = {
481
+ * value: 'column',
482
+ * title: 'Column Charts',
483
+ * items: [
484
+ * { icon: ColumnIcon, label: 'Column', chart: 'Column' },
485
+ * { icon: StackingColumnIcon, label: 'Stacking Column', chart: 'StackingColumn' }
486
+ * ]
487
+ * };
488
+ * ```
489
+ */
490
+ export interface ChartCategory {
491
+ /**
492
+ * Unique identifier for the category.
493
+ * Used for internal referencing and tab selection.
494
+ *
495
+ * @type {string}
496
+ *
497
+ * @example
498
+ * value: 'column'
499
+ * value: 'pie'
500
+ * value: 'distribution'
501
+ */
502
+ value: string;
503
+ /**
504
+ * Display title for the category.
505
+ * Shown in the UI as a tab or section header.
506
+ *
507
+ * @type {string}
508
+ *
509
+ * @example
510
+ * title: 'Column Charts'
511
+ * title: 'Pie Charts'
512
+ * title: 'Comparison Charts'
513
+ */
514
+ title: string;
515
+ /**
516
+ * Array of chart items grouped under this category.
517
+ * Each item represents a specific chart type option.
518
+ *
519
+ * @type {ChartItem[]}
520
+ *
521
+ * @example
522
+ * items: [
523
+ * { icon: ColumnIcon, label: 'Column', chart: 'Column' },
524
+ * { icon: StackingColumnIcon, label: 'Stacking Column', chart: 'StackingColumn' },
525
+ * { icon: StackingColumn100Icon, label: '100% Stacking Column', chart: 'StackingColumn100' }
526
+ * ]
527
+ */
528
+ items: ChartItem[];
529
+ }
530
+ /**
531
+ * Metadata about the currently selected chart.
532
+ * Provides quick classification to determine chart-specific UI and formatting options.
533
+ *
534
+ * @interface ChartInfo
535
+ * @private
536
+ *
537
+ * @example
538
+ * ```tsx
539
+ * // Column chart
540
+ * const columnInfo: ChartInfo = {
541
+ * chart: 'Column',
542
+ * isChart: true,
543
+ * isPieChart: false
544
+ * };
545
+ *
546
+ * // Pie chart
547
+ * const pieInfo: ChartInfo = {
548
+ * chart: 'Pie',
549
+ * isChart: false,
550
+ * isPieChart: true
551
+ * };
552
+ * ```
553
+ */
554
+ export interface ChartInfo {
555
+ /**
556
+ * The currently selected chart type.
557
+ * Used to determine which chart component and settings to apply.
558
+ *
559
+ * @type {ChartType}
560
+ *
561
+ * @example
562
+ * chart: 'Column'
563
+ * chart: 'Pie'
564
+ * chart: 'Line'
565
+ */
566
+ chart: ChartType;
567
+ /**
568
+ * Flag indicating if the current chart is a regular chart (Column, Bar, Line, Area, Scatter).
569
+ * Used to conditionally display chart-specific formatting options like data labels and tooltips.
570
+ *
571
+ * @type {boolean}
572
+ * @default true for Column, Bar, Line, Area, Scatter; false for Pie
573
+ */
574
+ isChart: boolean;
575
+ /**
576
+ * Flag indicating if the current chart is a pie chart.
577
+ * Used to conditionally display pie-specific formatting options like data labels.
578
+ * Pie charts cannot display multiple series or have category/value axes.
579
+ *
580
+ * @type {boolean}
581
+ * @default true for Pie; false for all other chart types
582
+ */
583
+ isPieChart: boolean;
584
+ }
585
+ /**
586
+ * Styling configuration for a specific data series in the chart.
587
+ * Defines color and label visibility for individual series.
588
+ * Managed through the Format tab's Series Style section.
589
+ *
590
+ * @interface ChartSeriesStyle
591
+ * @private
592
+ *
593
+ * @example
594
+ * ```tsx
595
+ * const seriesStyle: ChartSeriesStyle = {
596
+ * series: 'Sales',
597
+ * fill: '#FF6B6B',
598
+ * enableDataLabel: true
599
+ * };
600
+ * ```
601
+ */
602
+ export interface ChartSeriesStyle {
603
+ /**
604
+ * The name of the data series.
605
+ * Must match a field name in the GridChartSettings.series array.
606
+ *
607
+ * @type {string}
608
+ *
609
+ * @example
610
+ * series: 'Sales'
611
+ * series: 'Quantity'
612
+ */
613
+ series: string;
614
+ /**
615
+ * Hex color code for the series bars/lines/areas in the chart.
616
+ * Used to visually distinguish between different series.
617
+ *
618
+ * @type {string}
619
+ * @default '#5470C6'
620
+ *
621
+ * @example
622
+ * fill: '#FF6B6B' // Red
623
+ * fill: '#4ECDC4' // Teal
624
+ * fill: '#95E1D3' // Mint
625
+ */
626
+ fill: string;
627
+ /**
628
+ * Controls whether data value labels are displayed above/on the series elements.
629
+ * When enabled, shows the actual numeric values on the chart.
630
+ *
631
+ * @type {boolean}
632
+ * @default false
633
+ *
634
+ * @example
635
+ * enableDataLabel: true // Show values on bars
636
+ * enableDataLabel: false // Hide values
637
+ */
638
+ enableDataLabel: boolean;
639
+ }
640
+ /**
641
+ * Comprehensive formatting settings for the chart.
642
+ * Covers all visual aspects including layout, text, colors, axes, and series styling.
643
+ * Updated through the FormatTab component and managed by the GridChart context.
644
+ *
645
+ * @interface Format
646
+ * @private
647
+ *
648
+ * @example
649
+ * ```tsx
650
+ * const defaultFormat: Format = {
651
+ * // Chart layout
652
+ * marginLeft: 10, marginRight: 10, marginTop: 10, marginBottom: 10,
653
+ * background: '#FFFFFF',
654
+ *
655
+ * // Title
656
+ * titleText: 'Sales Analysis',
657
+ * titleFontFamily: 'Arial',
658
+ * titleFontSize: '18',
659
+ * titleColor: '#000000',
660
+ *
661
+ * // Legend
662
+ * enableLegend: true,
663
+ * legendPosition: 'Bottom',
664
+ * legendFontFamily: 'Arial',
665
+ * legendFontSize: '12',
666
+ * legendColor: '#000000',
667
+ *
668
+ * // Series
669
+ * enableTooltip: true,
670
+ * enablePieChartDataLabel: false,
671
+ * chartSeriesStyle: [
672
+ * { series: 'Sales', fill: '#FF6B6B', enableDataLabel: false }
673
+ * ],
674
+ *
675
+ * // Axes
676
+ * categoryInverted: false,
677
+ * valueInverted: false,
678
+ * categoryTitleText: 'Date',
679
+ * categoryTitleFontFamily: 'Arial',
680
+ * categoryTitleFontSize: '14',
681
+ * categoryTitleColor: '#000000',
682
+ * categoryLabelFontFamily: 'Arial',
683
+ * categoryLabelFontSize: '12',
684
+ * categoryLabelColor: '#000000',
685
+ * categoryLabelRotation: 0,
686
+ * // ... similar for value axis
687
+ * };
688
+ * ```
689
+ */
690
+ export interface Format {
691
+ /**
692
+ * Left margin of the chart area in pixels.
693
+ * Controls spacing between the chart and left edge of the container.
694
+ *
695
+ * @type {number}
696
+ * @default 10
697
+ * @min 0
698
+ * @max 100
699
+ */
700
+ marginLeft: number;
701
+ /**
702
+ * Right margin of the chart area in pixels.
703
+ * Controls spacing between the chart and right edge of the container.
704
+ *
705
+ * @type {number}
706
+ * @default 10
707
+ * @min 0
708
+ * @max 100
709
+ */
710
+ marginRight: number;
711
+ /**
712
+ * Top margin of the chart area in pixels.
713
+ * Controls spacing between the chart and top edge of the container.
714
+ *
715
+ * @type {number}
716
+ * @default 10
717
+ * @min 0
718
+ * @max 100
719
+ */
720
+ marginTop: number;
721
+ /**
722
+ * Bottom margin of the chart area in pixels.
723
+ * Controls spacing between the chart and bottom edge of the container.
724
+ *
725
+ * @type {number}
726
+ * @default 10
727
+ * @min 0
728
+ * @max 100
729
+ */
730
+ marginBottom: number;
731
+ /**
732
+ * Background color of the chart area.
733
+ * Accepts hex color codes (#RRGGBB).
734
+ *
735
+ * @type {string}
736
+ * @default '#FFFFFF'
737
+ *
738
+ * @example
739
+ * background: '#FFFFFF' // White
740
+ * background: '#F5F5F5' // Light gray
741
+ * background: '#E8F4F8' // Light blue
742
+ */
743
+ background: string;
744
+ /**
745
+ * Main title text displayed at the top of the chart.
746
+ * Can be empty for no title.
747
+ *
748
+ * @type {string}
749
+ * @default ''
750
+ *
751
+ * @example
752
+ * titleText: 'Sales Analysis 2024'
753
+ */
754
+ titleText: string;
755
+ /**
756
+ * Font family for the main chart title.
757
+ * Examples: 'Arial', 'Georgia', 'Times New Roman', 'Trebuchet MS', 'Courier New', 'Lucida Console'.
758
+ *
759
+ * @type {string}
760
+ * @default 'Default'
761
+ */
762
+ titleFontFamily: string;
763
+ /**
764
+ * Font size for the main chart title in pixels (as string).
765
+ * Valid range: '11' to '20'.
766
+ *
767
+ * @type {string}
768
+ * @default '16'
769
+ */
770
+ titleFontSize: string;
771
+ /**
772
+ * Font color for the main chart title.
773
+ * Accepts hex color codes (#RRGGBB).
774
+ *
775
+ * @type {string}
776
+ * @default '#000000'
777
+ */
778
+ titleColor: string;
779
+ /**
780
+ * Subtitle text displayed below the main title.
781
+ * Can be empty for no subtitle.
782
+ *
783
+ * @type {string}
784
+ * @default ''
785
+ *
786
+ * @example
787
+ * subtitleText: 'Quarterly Revenue Report'
788
+ */
789
+ subtitleText: string;
790
+ /**
791
+ * Font family for the subtitle.
792
+ * Examples: 'Arial', 'Georgia', 'Times New Roman', 'Trebuchet MS', 'Courier New', 'Lucida Console'.
793
+ *
794
+ * @type {string}
795
+ * @default 'Default'
796
+ */
797
+ subtitleFontFamily: string;
798
+ /**
799
+ * Font size for the subtitle in pixels (as string).
800
+ * Valid range: '11' to '20'.
801
+ *
802
+ * @type {string}
803
+ * @default '14'
804
+ */
805
+ subtitleFontSize: string;
806
+ /**
807
+ * Font color for the subtitle.
808
+ * Accepts hex color codes (#RRGGBB).
809
+ *
810
+ * @type {string}
811
+ * @default '#666666'
812
+ */
813
+ subtitleColor: string;
814
+ /**
815
+ * Controls visibility of the legend in the chart.
816
+ * When true, displays a legend showing series names and colors.
817
+ *
818
+ * @type {boolean}
819
+ * @default true
820
+ *
821
+ * @example
822
+ * enableLegend: true // Show legend
823
+ * enableLegend: false // Hide legend
824
+ */
825
+ enableLegend: boolean;
826
+ /**
827
+ * Position of the legend relative to the chart.
828
+ * Valid positions: 'Auto', 'Top', 'Left', 'Bottom', 'Right'.
829
+ *
830
+ * @type {string}
831
+ * @default 'Bottom'
832
+ *
833
+ * @example
834
+ * legendPosition: 'Bottom' // Legend below chart
835
+ * legendPosition: 'Right' // Legend to the right
836
+ * legendPosition: 'Top' // Legend above chart
837
+ */
838
+ legendPosition: string;
839
+ /**
840
+ * Font family for the legend text.
841
+ * Examples: 'Arial', 'Georgia', 'Times New Roman', 'Trebuchet MS', 'Courier New', 'Lucida Console'.
842
+ *
843
+ * @type {string}
844
+ * @default 'Default'
845
+ */
846
+ legendFontFamily: string;
847
+ /**
848
+ * Font size for the legend text in pixels (as string).
849
+ * Valid range: '11' to '20'.
850
+ *
851
+ * @type {string}
852
+ * @default '12'
853
+ */
854
+ legendFontSize: string;
855
+ /**
856
+ * Font color for the legend text.
857
+ * Accepts hex color codes (#RRGGBB).
858
+ *
859
+ * @type {string}
860
+ * @default '#000000'
861
+ */
862
+ legendColor: string;
863
+ /**
864
+ * Controls visibility of tooltips when hovering over data points.
865
+ * Applies to all chart types.
866
+ *
867
+ * @type {boolean}
868
+ * @default true
869
+ *
870
+ * @example
871
+ * enableTooltip: true // Show tooltips on hover
872
+ * enableTooltip: false // No tooltips
873
+ */
874
+ enableTooltip: boolean;
875
+ /**
876
+ * Controls visibility of data labels on pie chart segments.
877
+ * Only applies to pie charts; ignored for other chart types.
878
+ *
879
+ * @type {boolean}
880
+ * @default false
881
+ *
882
+ * @example
883
+ * enablePieChartDataLabel: true // Show percentage/value on segments
884
+ * enablePieChartDataLabel: false // Hide labels
885
+ */
886
+ enablePieChartDataLabel: boolean;
887
+ /**
888
+ * Array of styling configurations for each data series.
889
+ * Each series can have its own color and data label visibility.
890
+ *
891
+ * @type {ChartSeriesStyle[]}
892
+ * @default [{ series: 'Series1', fill: '#5470C6', enableDataLabel: false }]
893
+ *
894
+ * @example
895
+ * chartSeriesStyle: [
896
+ * { series: 'Sales', fill: '#FF6B6B', enableDataLabel: true },
897
+ * { series: 'Quantity', fill: '#4ECDC4', enableDataLabel: false }
898
+ * ]
899
+ */
900
+ chartSeriesStyle: ChartSeriesStyle[];
901
+ /**
902
+ * Reverses the order of categories on the category (X) axis.
903
+ * Applies only to non-pie charts.
904
+ *
905
+ * @type {boolean}
906
+ * @default false
907
+ *
908
+ * @example
909
+ * categoryInverted: false // Normal order (left to right)
910
+ * categoryInverted: true // Reversed order (right to left)
911
+ */
912
+ categoryInverted: boolean;
913
+ /**
914
+ * Reverses the order of values on the value (Y) axis.
915
+ * Applies only to non-pie charts.
916
+ *
917
+ * @type {boolean}
918
+ * @default false
919
+ *
920
+ * @example
921
+ * valueInverted: false // Normal order (bottom to top)
922
+ * valueInverted: true // Reversed order (top to bottom)
923
+ */
924
+ valueInverted: boolean;
925
+ /**
926
+ * Title text for the category (X-axis) axis.
927
+ * Appears as a label next to the axis.
928
+ *
929
+ * @type {string}
930
+ * @default 'Category'
931
+ *
932
+ * @example
933
+ * categoryTitleText: 'Date'
934
+ * categoryTitleText: 'Product Name'
935
+ */
936
+ categoryTitleText: string;
937
+ /**
938
+ * Font family for the category axis title.
939
+ *
940
+ * @type {string}
941
+ * @default 'Default'
942
+ */
943
+ categoryTitleFontFamily: string;
944
+ /**
945
+ * Font size for the category axis title in pixels (as string).
946
+ * Valid range: '11' to '20'.
947
+ *
948
+ * @type {string}
949
+ * @default '14'
950
+ */
951
+ categoryTitleFontSize: string;
952
+ /**
953
+ * Font color for the category axis title.
954
+ *
955
+ * @type {string}
956
+ * @default '#000000'
957
+ */
958
+ categoryTitleColor: string;
959
+ /**
960
+ * Title text for the value (Y-axis) axis.
961
+ * Appears as a rotated label next to the axis.
962
+ *
963
+ * @type {string}
964
+ * @default 'Value'
965
+ *
966
+ * @example
967
+ * valueTitleText: 'Revenue ($)'
968
+ * valueTitleText: 'Units Sold'
969
+ */
970
+ valueTitleText: string;
971
+ /**
972
+ * Font family for the value axis title.
973
+ *
974
+ * @type {string}
975
+ * @default 'Default'
976
+ */
977
+ valueTitleFontFamily: string;
978
+ /**
979
+ * Font size for the value axis title in pixels (as string).
980
+ * Valid range: '11' to '20'.
981
+ *
982
+ * @type {string}
983
+ * @default '14'
984
+ */
985
+ valueTitleFontSize: string;
986
+ /**
987
+ * Font color for the value axis title.
988
+ *
989
+ * @type {string}
990
+ * @default '#000000'
991
+ */
992
+ valueTitleColor: string;
993
+ /**
994
+ * Font family for the category axis label text.
995
+ * Affects the appearance of tick labels on the X-axis.
996
+ *
997
+ * @type {string}
998
+ * @default 'Default'
999
+ */
1000
+ categoryLabelFontFamily: string;
1001
+ /**
1002
+ * Font size for the category axis labels in pixels (as string).
1003
+ * Valid range: '11' to '20'.
1004
+ *
1005
+ * @type {string}
1006
+ * @default '12'
1007
+ */
1008
+ categoryLabelFontSize: string;
1009
+ /**
1010
+ * Font color for the category axis labels.
1011
+ *
1012
+ * @type {string}
1013
+ * @default '#000000'
1014
+ */
1015
+ categoryLabelColor: string;
1016
+ /**
1017
+ * Rotation angle for the category axis labels in degrees.
1018
+ * Valid range: 0° to 315° in 45° increments (0, 45, 90, 135, 180, 225, 270, 315).
1019
+ * Useful for long category names to prevent overlap.
1020
+ *
1021
+ * @type {number}
1022
+ * @default 0
1023
+ *
1024
+ * @example
1025
+ * categoryLabelRotation: 0 // No rotation
1026
+ * categoryLabelRotation: 45 // 45-degree tilt
1027
+ * categoryLabelRotation: 90 // Vertical (90-degree rotation)
1028
+ */
1029
+ categoryLabelRotation: number;
1030
+ /**
1031
+ * Font family for the value axis label text.
1032
+ * Affects the appearance of tick labels on the Y-axis.
1033
+ *
1034
+ * @type {string}
1035
+ * @default 'Default'
1036
+ */
1037
+ valueLabelFontFamily: string;
1038
+ /**
1039
+ * Font size for the value axis labels in pixels (as string).
1040
+ * Valid range: '11' to '20'.
1041
+ *
1042
+ * @type {string}
1043
+ * @default '12'
1044
+ */
1045
+ valueLabelFontSize: string;
1046
+ /**
1047
+ * Font color for the value axis labels.
1048
+ *
1049
+ * @type {string}
1050
+ * @default '#000000'
1051
+ */
1052
+ valueLabelColor: string;
1053
+ /**
1054
+ * Rotation angle for the value axis labels in degrees.
1055
+ * Valid range: 0° to 315° in 45° increments (0, 45, 90, 135, 180, 225, 270, 315).
1056
+ * Rarely used for value axis labels but available for advanced customization.
1057
+ *
1058
+ * @type {number}
1059
+ * @default 0
1060
+ *
1061
+ * @example
1062
+ * valueLabelRotation: 0 // No rotation (default horizontal)
1063
+ * valueLabelRotation: 90 // Vertical rotation
1064
+ */
1065
+ valueLabelRotation: number;
1066
+ }