| 1 | // Data types for different chart types |
| 2 | type LabelValueData = { |
| 3 | label: string; |
| 4 | value: number; |
| 5 | }; |
| 6 | |
| 7 | type XYData = { |
| 8 | x: number; |
| 9 | y: number; |
| 10 | z?: number; // For bubble charts |
| 11 | }; |
| 12 | |
| 13 | // Multi-series data supports multiple value columns |
| 14 | export type MultiSeriesData = { |
| 15 | [key: string]: string | number; // Additional value columns |
| 16 | }; |
| 17 | |
| 18 | // Range data for range bar/area charts |
| 19 | type RangeData = { |
| 20 | category: string; |
| 21 | low: number; |
| 22 | high: number; |
| 23 | }; |
| 24 | |
| 25 | // Waterfall data with positive/negative amounts |
| 26 | type WaterfallData = { |
| 27 | category: string; |
| 28 | amount: number; |
| 29 | }; |
| 30 | |
| 31 | // OHLC data for financial charts (Candlestick, OHLC) |
| 32 | type OHLCData = { |
| 33 | date: string; |
| 34 | open: number; |
| 35 | high: number; |
| 36 | low: number; |
| 37 | close: number; |
| 38 | }; |
| 39 | |
| 40 | // Box plot statistical data |
| 41 | type BoxPlotData = { |
| 42 | category: string; |
| 43 | min: number; |
| 44 | q1: number; |
| 45 | median: number; |
| 46 | q3: number; |
| 47 | max: number; |
| 48 | }; |
| 49 | |
| 50 | // Hierarchical data for treemap/sunburst |
| 51 | type HierarchicalData = { |
| 52 | name: string; |
| 53 | value?: number; |
| 54 | children?: HierarchicalData[]; |
| 55 | }; |
| 56 | |
| 57 | // Flow data for sankey/chord charts |
| 58 | type FlowData = { |
| 59 | from: string; |
| 60 | to: string; |
| 61 | size: number; |
| 62 | }; |
| 63 | |
| 64 | // Funnel data (label + value) |
| 65 | type FunnelData = { |
| 66 | label: string; |
| 67 | value: number; |
| 68 | }; |
| 69 | |
| 70 | // Heatmap data with x, y coordinates and value |
| 71 | type HeatmapData = { |
| 72 | x: string; |
| 73 | y: string; |
| 74 | value: number; |
| 75 | }; |
| 76 | |
| 77 | // Histogram data (single values for binning) |
| 78 | type HistogramData = { |
| 79 | value: number; |
| 80 | }; |
| 81 | |
| 82 | // Gauge data (single numeric value or object with value) |
| 83 | type GaugeData = number | { value: number }; |
| 84 | |
| 85 | export type ChartDataType = |
| 86 | | LabelValueData[] |
| 87 | | XYData[] |
| 88 | | MultiSeriesData[] |
| 89 | | RangeData[] |
| 90 | | WaterfallData[] |
| 91 | | OHLCData[] |
| 92 | | BoxPlotData[] |
| 93 | | HierarchicalData[] |
| 94 | | FlowData[] |
| 95 | | FunnelData[] |
| 96 | | HeatmapData[] |
| 97 | | HistogramData[] |
| 98 | | GaugeData; |
| 99 | |
| 100 | // Chart data modes/categories - charts with same mode can convert to each other |
| 101 | export type ChartDataMode = |
| 102 | | "categorical" // Shared editor mode from presentation chart conversion categories |
| 103 | | "label-value" // Pie, Donut, Radar, RadialBar, Nightingale, Radial Column |
| 104 | | "xy" // Scatter |
| 105 | | "xyz" // Bubble |
| 106 | | "multi-series" // Bar, Line, Area, Composed |
| 107 | | "range" // Range Bar, Range Area |
| 108 | | "waterfall" // Waterfall |
| 109 | | "ohlc" // Candlestick, OHLC |
| 110 | | "box-plot" // Box Plot |
| 111 | | "hierarchical" // Treemap, Sunburst |
| 112 | | "flow" // Sankey, Chord |
| 113 | | "funnel" // Funnel, Cone Funnel, Pyramid |
| 114 | | "heatmap" // Heatmap |
| 115 | | "histogram" // Histogram |
| 116 | | "gauge"; // Radial Gauge, Linear Gauge |
| 117 | |
| 118 | // Available chart types for composed chart series |
| 119 | export type SeriesChartType = "bar" | "line" | "area" | "scatter"; |
| 120 |