@@ -18,17 +18,20 @@ export const ChartTypeSchema = z.enum([
1818 'column' ,
1919 'grouped-bar' ,
2020 'stacked-bar' ,
21+ 'bi-polar-bar' ,
2122
2223 // Trend
2324 'line' ,
2425 'area' ,
2526 'stacked-area' ,
2627 'step-line' ,
28+ 'spline' ,
2729
2830 // Distribution
2931 'pie' ,
3032 'donut' ,
3133 'funnel' ,
34+ 'pyramid' ,
3235
3336 // Relationship
3437 'scatter' ,
@@ -38,22 +41,28 @@ export const ChartTypeSchema = z.enum([
3841 'treemap' ,
3942 'sunburst' ,
4043 'sankey' ,
44+ 'word-cloud' ,
4145
4246 // Performance
4347 'gauge' ,
48+ 'solid-gauge' ,
4449 'metric' ,
4550 'kpi' ,
51+ 'bullet' ,
4652
4753 // Geo
4854 'choropleth' ,
4955 'bubble-map' ,
56+ 'gl-map' ,
5057
5158 // Advanced
5259 'heatmap' ,
5360 'radar' ,
5461 'waterfall' ,
5562 'box-plot' ,
5663 'violin' ,
64+ 'candlestick' ,
65+ 'stock' ,
5766
5867 // Tabular
5968 'table' ,
@@ -62,17 +71,116 @@ export const ChartTypeSchema = z.enum([
6271
6372export type ChartType = z . infer < typeof ChartTypeSchema > ;
6473
74+ /**
75+ * Chart Axis Schema
76+ * Definition for X and Y axes
77+ */
78+ export const ChartAxisSchema = z . object ( {
79+ /** Data field to map to this axis */
80+ field : z . string ( ) . describe ( 'Data field key' ) ,
81+
82+ /** Axis title */
83+ title : z . string ( ) . optional ( ) . describe ( 'Axis display title' ) ,
84+
85+ /** Value formatting (d3-format or similar) */
86+ format : z . string ( ) . optional ( ) . describe ( 'Value format string (e.g., "$0,0.00")' ) ,
87+
88+ /** Axis scale settings */
89+ min : z . number ( ) . optional ( ) . describe ( 'Minimum value' ) ,
90+ max : z . number ( ) . optional ( ) . describe ( 'Maximum value' ) ,
91+ stepSize : z . number ( ) . optional ( ) . describe ( 'Step size for ticks' ) ,
92+
93+ /** Appearance */
94+ showGridLines : z . boolean ( ) . default ( true ) ,
95+ position : z . enum ( [ 'left' , 'right' , 'top' , 'bottom' ] ) . optional ( ) . describe ( 'Axis position' ) ,
96+
97+ /** Logarithmic scale */
98+ logarithmic : z . boolean ( ) . default ( false ) ,
99+ } ) ;
100+
101+ /**
102+ * Chart Series Schema
103+ * Defines a single data series in the chart
104+ */
105+ export const ChartSeriesSchema = z . object ( {
106+ /** Field name for values */
107+ name : z . string ( ) . describe ( 'Field name or series identifier' ) ,
108+
109+ /** Display label */
110+ label : z . string ( ) . optional ( ) . describe ( 'Series display label' ) ,
111+
112+ /** Series type override (combo charts) */
113+ type : ChartTypeSchema . optional ( ) . describe ( 'Override chart type for this series' ) ,
114+
115+ /** Specific color */
116+ color : z . string ( ) . optional ( ) . describe ( 'Series color (hex/rgb/token)' ) ,
117+
118+ /** Stacking group */
119+ stack : z . string ( ) . optional ( ) . describe ( 'Stack identifier to group series' ) ,
120+
121+ /** Axis binding */
122+ yAxis : z . enum ( [ 'left' , 'right' ] ) . default ( 'left' ) . describe ( 'Bind to specific Y-Axis' ) ,
123+ } ) ;
124+
125+ /**
126+ * Chart Annotation Schema
127+ * Static lines or regions to highlight data
128+ */
129+ export const ChartAnnotationSchema = z . object ( {
130+ type : z . enum ( [ 'line' , 'region' ] ) . default ( 'line' ) ,
131+ axis : z . enum ( [ 'x' , 'y' ] ) . default ( 'y' ) ,
132+ value : z . union ( [ z . number ( ) , z . string ( ) ] ) . describe ( 'Start value' ) ,
133+ endValue : z . union ( [ z . number ( ) , z . string ( ) ] ) . optional ( ) . describe ( 'End value for regions' ) ,
134+ color : z . string ( ) . optional ( ) ,
135+ label : z . string ( ) . optional ( ) ,
136+ style : z . enum ( [ 'solid' , 'dashed' , 'dotted' ] ) . default ( 'dashed' ) ,
137+ } ) ;
138+
139+ /**
140+ * Chart Interaction Schema
141+ */
142+ export const ChartInteractionSchema = z . object ( {
143+ tooltips : z . boolean ( ) . default ( true ) ,
144+ zoom : z . boolean ( ) . default ( false ) ,
145+ brush : z . boolean ( ) . default ( false ) ,
146+ clickAction : z . string ( ) . optional ( ) . describe ( 'Action ID to trigger on click' ) ,
147+ } ) ;
148+
65149/**
66150 * Chart Configuration Base
67151 * Common configuration for all chart types
68152 */
69153export const ChartConfigSchema = z . object ( {
154+ /** Chart Type */
70155 type : ChartTypeSchema ,
156+
157+ /** Titles */
71158 title : z . string ( ) . optional ( ) . describe ( 'Chart title' ) ,
72- description : z . string ( ) . optional ( ) . describe ( 'Chart description' ) ,
73- showLegend : z . boolean ( ) . optional ( ) . default ( true ) . describe ( 'Display legend' ) ,
74- showDataLabels : z . boolean ( ) . optional ( ) . default ( false ) . describe ( 'Display data labels on chart' ) ,
75- colors : z . array ( z . string ( ) ) . optional ( ) . describe ( 'Custom color palette' ) ,
159+ subtitle : z . string ( ) . optional ( ) . describe ( 'Chart subtitle' ) ,
160+ description : z . string ( ) . optional ( ) . describe ( 'Accessibility description' ) ,
161+
162+ /** Axes Mapping */
163+ xAxis : ChartAxisSchema . optional ( ) . describe ( 'X-Axis configuration' ) ,
164+ yAxis : z . array ( ChartAxisSchema ) . optional ( ) . describe ( 'Y-Axis configuration (support dual axis)' ) ,
165+
166+ /** Series Configuration */
167+ series : z . array ( ChartSeriesSchema ) . optional ( ) . describe ( 'Defined series configuration' ) ,
168+
169+ /** Appearance */
170+ colors : z . array ( z . string ( ) ) . optional ( ) . describe ( 'Color palette' ) ,
171+ height : z . number ( ) . optional ( ) . describe ( 'Fixed height in pixels' ) ,
172+
173+ /** Components */
174+ showLegend : z . boolean ( ) . default ( true ) . describe ( 'Display legend' ) ,
175+ showDataLabels : z . boolean ( ) . default ( false ) . describe ( 'Display data labels' ) ,
176+
177+ /** Annotations & Reference Lines */
178+ annotations : z . array ( ChartAnnotationSchema ) . optional ( ) ,
179+
180+ /** Interactions */
181+ interaction : ChartInteractionSchema . optional ( ) ,
76182} ) ;
77183
78184export type ChartConfig = z . infer < typeof ChartConfigSchema > ;
185+ export type ChartAxis = z . infer < typeof ChartAxisSchema > ;
186+ export type ChartSeries = z . infer < typeof ChartSeriesSchema > ;
0 commit comments