mviz 1.4.2
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/README.md +174 -0
- package/dist/charts/area.d.ts +14 -0
- package/dist/charts/area.d.ts.map +1 -0
- package/dist/charts/area.js +137 -0
- package/dist/charts/area.js.map +1 -0
- package/dist/charts/bar.d.ts +14 -0
- package/dist/charts/bar.d.ts.map +1 -0
- package/dist/charts/bar.js +191 -0
- package/dist/charts/bar.js.map +1 -0
- package/dist/charts/boxplot.d.ts +14 -0
- package/dist/charts/boxplot.d.ts.map +1 -0
- package/dist/charts/boxplot.js +79 -0
- package/dist/charts/boxplot.js.map +1 -0
- package/dist/charts/bubble.d.ts +14 -0
- package/dist/charts/bubble.d.ts.map +1 -0
- package/dist/charts/bubble.js +127 -0
- package/dist/charts/bubble.js.map +1 -0
- package/dist/charts/calendar.d.ts +14 -0
- package/dist/charts/calendar.d.ts.map +1 -0
- package/dist/charts/calendar.js +94 -0
- package/dist/charts/calendar.js.map +1 -0
- package/dist/charts/combo.d.ts +14 -0
- package/dist/charts/combo.d.ts.map +1 -0
- package/dist/charts/combo.js +163 -0
- package/dist/charts/combo.js.map +1 -0
- package/dist/charts/dumbbell.d.ts +17 -0
- package/dist/charts/dumbbell.d.ts.map +1 -0
- package/dist/charts/dumbbell.js +368 -0
- package/dist/charts/dumbbell.js.map +1 -0
- package/dist/charts/funnel.d.ts +14 -0
- package/dist/charts/funnel.d.ts.map +1 -0
- package/dist/charts/funnel.js +145 -0
- package/dist/charts/funnel.js.map +1 -0
- package/dist/charts/heatmap.d.ts +14 -0
- package/dist/charts/heatmap.d.ts.map +1 -0
- package/dist/charts/heatmap.js +202 -0
- package/dist/charts/heatmap.js.map +1 -0
- package/dist/charts/histogram.d.ts +14 -0
- package/dist/charts/histogram.d.ts.map +1 -0
- package/dist/charts/histogram.js +103 -0
- package/dist/charts/histogram.js.map +1 -0
- package/dist/charts/index.d.ts +40 -0
- package/dist/charts/index.d.ts.map +1 -0
- package/dist/charts/index.js +42 -0
- package/dist/charts/index.js.map +1 -0
- package/dist/charts/line.d.ts +14 -0
- package/dist/charts/line.d.ts.map +1 -0
- package/dist/charts/line.js +134 -0
- package/dist/charts/line.js.map +1 -0
- package/dist/charts/pie.d.ts +14 -0
- package/dist/charts/pie.d.ts.map +1 -0
- package/dist/charts/pie.js +75 -0
- package/dist/charts/pie.js.map +1 -0
- package/dist/charts/registry.d.ts +36 -0
- package/dist/charts/registry.d.ts.map +1 -0
- package/dist/charts/registry.js +55 -0
- package/dist/charts/registry.js.map +1 -0
- package/dist/charts/sankey.d.ts +14 -0
- package/dist/charts/sankey.d.ts.map +1 -0
- package/dist/charts/sankey.js +74 -0
- package/dist/charts/sankey.js.map +1 -0
- package/dist/charts/scatter.d.ts +14 -0
- package/dist/charts/scatter.d.ts.map +1 -0
- package/dist/charts/scatter.js +130 -0
- package/dist/charts/scatter.js.map +1 -0
- package/dist/charts/sparkline.d.ts +19 -0
- package/dist/charts/sparkline.d.ts.map +1 -0
- package/dist/charts/sparkline.js +154 -0
- package/dist/charts/sparkline.js.map +1 -0
- package/dist/charts/waterfall.d.ts +14 -0
- package/dist/charts/waterfall.d.ts.map +1 -0
- package/dist/charts/waterfall.js +232 -0
- package/dist/charts/waterfall.js.map +1 -0
- package/dist/charts/xmr.d.ts +14 -0
- package/dist/charts/xmr.d.ts.map +1 -0
- package/dist/charts/xmr.js +456 -0
- package/dist/charts/xmr.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +120 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/alert.d.ts +10 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +65 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/big_value.d.ts +10 -0
- package/dist/components/big_value.d.ts.map +1 -0
- package/dist/components/big_value.js +78 -0
- package/dist/components/big_value.js.map +1 -0
- package/dist/components/delta.d.ts +10 -0
- package/dist/components/delta.d.ts.map +1 -0
- package/dist/components/delta.js +83 -0
- package/dist/components/delta.js.map +1 -0
- package/dist/components/empty_space.d.ts +10 -0
- package/dist/components/empty_space.d.ts.map +1 -0
- package/dist/components/empty_space.js +29 -0
- package/dist/components/empty_space.js.map +1 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +23 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/note.d.ts +10 -0
- package/dist/components/note.d.ts.map +1 -0
- package/dist/components/note.js +66 -0
- package/dist/components/note.js.map +1 -0
- package/dist/components/registry.d.ts +24 -0
- package/dist/components/registry.d.ts.map +1 -0
- package/dist/components/registry.js +36 -0
- package/dist/components/registry.js.map +1 -0
- package/dist/components/table.d.ts +90 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +610 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/text.d.ts +10 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +46 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/textarea.d.ts +10 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +79 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/core/colors.d.ts +45 -0
- package/dist/core/colors.d.ts.map +1 -0
- package/dist/core/colors.js +93 -0
- package/dist/core/colors.js.map +1 -0
- package/dist/core/css.d.ts +20 -0
- package/dist/core/css.d.ts.map +1 -0
- package/dist/core/css.js +97 -0
- package/dist/core/css.js.map +1 -0
- package/dist/core/exceptions.d.ts +59 -0
- package/dist/core/exceptions.d.ts.map +1 -0
- package/dist/core/exceptions.js +100 -0
- package/dist/core/exceptions.js.map +1 -0
- package/dist/core/formatting.d.ts +53 -0
- package/dist/core/formatting.d.ts.map +1 -0
- package/dist/core/formatting.js +491 -0
- package/dist/core/formatting.js.map +1 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +10 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/serializer.d.ts +29 -0
- package/dist/core/serializer.d.ts.map +1 -0
- package/dist/core/serializer.js +84 -0
- package/dist/core/serializer.js.map +1 -0
- package/dist/core/themes.d.ts +138 -0
- package/dist/core/themes.d.ts.map +1 -0
- package/dist/core/themes.js +484 -0
- package/dist/core/themes.js.map +1 -0
- package/dist/core/version-check.d.ts +23 -0
- package/dist/core/version-check.d.ts.map +1 -0
- package/dist/core/version-check.js +163 -0
- package/dist/core/version-check.js.map +1 -0
- package/dist/generate_test_harness.d.ts +13 -0
- package/dist/generate_test_harness.d.ts.map +1 -0
- package/dist/generate_test_harness.js +35 -0
- package/dist/generate_test_harness.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/converter.d.ts +22 -0
- package/dist/layout/converter.d.ts.map +1 -0
- package/dist/layout/converter.js +46 -0
- package/dist/layout/converter.js.map +1 -0
- package/dist/layout/csv.d.ts +15 -0
- package/dist/layout/csv.d.ts.map +1 -0
- package/dist/layout/csv.js +88 -0
- package/dist/layout/csv.js.map +1 -0
- package/dist/layout/dispatcher.d.ts +13 -0
- package/dist/layout/dispatcher.d.ts.map +1 -0
- package/dist/layout/dispatcher.js +47 -0
- package/dist/layout/dispatcher.js.map +1 -0
- package/dist/layout/index.d.ts +8 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +8 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/parser.d.ts +19 -0
- package/dist/layout/parser.d.ts.map +1 -0
- package/dist/layout/parser.js +888 -0
- package/dist/layout/parser.js.map +1 -0
- package/dist/layout/templates.d.ts +32 -0
- package/dist/layout/templates.d.ts.map +1 -0
- package/dist/layout/templates.js +1016 -0
- package/dist/layout/templates.js.map +1 -0
- package/dist/types.d.ts +144 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +14 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heatmap chart generator
|
|
3
|
+
*/
|
|
4
|
+
import { PALETTE, FONT_SIZE_XXS, getThemeColors } from '../core/themes.js';
|
|
5
|
+
import { wrapHtml } from '../core/serializer.js';
|
|
6
|
+
import { registerChart, registerOptions } from './registry.js';
|
|
7
|
+
import { inferFormat } from '../core/formatting.js';
|
|
8
|
+
/**
|
|
9
|
+
* Parse a formatted string value like "1.9k" or "$2.5m" to a number.
|
|
10
|
+
* Returns the original value if parsing fails.
|
|
11
|
+
*/
|
|
12
|
+
function parseFormattedValue(value) {
|
|
13
|
+
if (typeof value === 'number') {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
// Remove currency symbols and whitespace
|
|
18
|
+
const cleaned = value.replace(/[$,\s]/g, '').toLowerCase();
|
|
19
|
+
// Match number with optional suffix (k, m, b)
|
|
20
|
+
const match = cleaned.match(/^(-?\d+\.?\d*)(k|m|b)?$/);
|
|
21
|
+
if (match) {
|
|
22
|
+
const num = parseFloat(match[1]);
|
|
23
|
+
const suffix = match[2];
|
|
24
|
+
if (suffix === 'k')
|
|
25
|
+
return num * 1000;
|
|
26
|
+
if (suffix === 'm')
|
|
27
|
+
return num * 1000000;
|
|
28
|
+
if (suffix === 'b')
|
|
29
|
+
return num * 1000000000;
|
|
30
|
+
return num;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generate a label formatter for heatmap cells.
|
|
37
|
+
* Heatmap data is [x, y, value], so we access params.value[2].
|
|
38
|
+
*/
|
|
39
|
+
function getHeatmapLabelFormatter(fmt) {
|
|
40
|
+
if (fmt === null || fmt === undefined) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
// Smart auto-formatting for heatmap labels
|
|
44
|
+
if (fmt === 'auto' || fmt === 'usd_auto') {
|
|
45
|
+
const isCurrency = fmt === 'usd_auto' ? 'true' : 'false';
|
|
46
|
+
return {
|
|
47
|
+
_js_: `function(params) {
|
|
48
|
+
var v = params.value[2];
|
|
49
|
+
if (v == null) return '';
|
|
50
|
+
var abs = Math.abs(v);
|
|
51
|
+
var neg = v < 0;
|
|
52
|
+
var p = ${isCurrency} ? '$' : '';
|
|
53
|
+
var r;
|
|
54
|
+
if (abs >= 1e9) {
|
|
55
|
+
var s = abs / 1e9;
|
|
56
|
+
r = s >= 100 ? p + s.toFixed(1) + 'b' : s >= 10 ? p + s.toFixed(2) + 'b' : p + s.toFixed(3) + 'b';
|
|
57
|
+
} else if (abs >= 1e6) {
|
|
58
|
+
var s = abs / 1e6;
|
|
59
|
+
r = s >= 100 ? p + s.toFixed(1) + 'm' : s >= 10 ? p + s.toFixed(2) + 'm' : p + s.toFixed(3) + 'm';
|
|
60
|
+
} else if (abs >= 1e4) {
|
|
61
|
+
var s = abs / 1e3;
|
|
62
|
+
r = s >= 100 ? p + s.toFixed(1) + 'k' : p + s.toFixed(2) + 'k';
|
|
63
|
+
} else if (abs >= 1e3) {
|
|
64
|
+
r = p + abs.toLocaleString('en-US', {maximumFractionDigits: 0});
|
|
65
|
+
} else {
|
|
66
|
+
r = abs === Math.floor(abs) ? p + abs : p + abs.toFixed(2);
|
|
67
|
+
}
|
|
68
|
+
return neg ? '(' + r + ')' : r;
|
|
69
|
+
}`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// Format-specific formatters
|
|
73
|
+
const formatExprs = {
|
|
74
|
+
usd: "'$' + params.value[2].toLocaleString()",
|
|
75
|
+
usd0k: "'$' + (params.value[2]/1000).toFixed(0) + 'k'",
|
|
76
|
+
usd0m: "'$' + (params.value[2]/1000000).toFixed(1) + 'm'",
|
|
77
|
+
pct: "(params.value[2] * 100).toFixed(1) + '%'",
|
|
78
|
+
pct0: "(params.value[2] * 100).toFixed(0) + '%'",
|
|
79
|
+
pct1: "(params.value[2] * 100).toFixed(1) + '%'",
|
|
80
|
+
num0: "params.value[2].toLocaleString()",
|
|
81
|
+
num1: "params.value[2].toFixed(1)",
|
|
82
|
+
num0k: "(params.value[2]/1000).toFixed(0) + 'k'",
|
|
83
|
+
num0m: "(params.value[2]/1000000).toFixed(1) + 'm'",
|
|
84
|
+
};
|
|
85
|
+
const expr = formatExprs[fmt];
|
|
86
|
+
if (expr) {
|
|
87
|
+
return { _js_: `function(params) { return ${expr}; }` };
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Build ECharts options for a heatmap
|
|
93
|
+
*/
|
|
94
|
+
export function buildHeatmapOptions(spec) {
|
|
95
|
+
const data = (spec.data ?? []);
|
|
96
|
+
const xCategories = spec.xCategories ?? [];
|
|
97
|
+
const yCategories = spec.yCategories ?? [];
|
|
98
|
+
const theme = (spec.theme ?? 'light');
|
|
99
|
+
const colors = getThemeColors(theme);
|
|
100
|
+
// Convert data to [x, y, value] format
|
|
101
|
+
// Data can be: [[x, y, value], ...] array format or [{x, y, value}, ...] object format
|
|
102
|
+
// Values may be pre-formatted strings like "1.9k" which need parsing
|
|
103
|
+
let heatmapData;
|
|
104
|
+
if (data.length > 0 && !Array.isArray(data[0]) && typeof data[0] === 'object') {
|
|
105
|
+
// Object format: {x, y, value}
|
|
106
|
+
heatmapData = data.map((d) => [
|
|
107
|
+
(d.x ?? 0),
|
|
108
|
+
(d.y ?? 0),
|
|
109
|
+
parseFormattedValue(d.value),
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// Array format: [x, y, value] - parse the value in case it's a string
|
|
114
|
+
heatmapData = data.map((d) => [
|
|
115
|
+
d[0],
|
|
116
|
+
d[1],
|
|
117
|
+
parseFormattedValue(d[2]),
|
|
118
|
+
]);
|
|
119
|
+
}
|
|
120
|
+
const values = heatmapData.map((d) => d[2]);
|
|
121
|
+
const minVal = values.length > 0 ? Math.min(...values) : 0;
|
|
122
|
+
const maxVal = values.length > 0 ? Math.max(...values) : 100;
|
|
123
|
+
// Calculate left margin based on longest y-axis label
|
|
124
|
+
const maxLabelLen = yCategories.reduce((max, label) => Math.max(max, String(label).length), 0);
|
|
125
|
+
const leftMarginPx = Math.max(60, maxLabelLen * 7 + 16);
|
|
126
|
+
// Infer format for labels
|
|
127
|
+
const sampleValue = values[0] ?? 0;
|
|
128
|
+
const valueFormat = spec.format ?? inferFormat('value', sampleValue);
|
|
129
|
+
const labelFormatter = getHeatmapLabelFormatter(valueFormat);
|
|
130
|
+
// Build label config
|
|
131
|
+
const labelConfig = { show: true, color: colors.text };
|
|
132
|
+
if (labelFormatter) {
|
|
133
|
+
labelConfig.formatter = labelFormatter;
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
backgroundColor: 'transparent',
|
|
137
|
+
animation: false,
|
|
138
|
+
tooltip: {
|
|
139
|
+
trigger: 'item',
|
|
140
|
+
position: 'top',
|
|
141
|
+
backgroundColor: colors.paper,
|
|
142
|
+
borderColor: colors.border,
|
|
143
|
+
textStyle: { color: colors.text },
|
|
144
|
+
},
|
|
145
|
+
grid: {
|
|
146
|
+
left: leftMarginPx,
|
|
147
|
+
right: '4%',
|
|
148
|
+
top: '8%',
|
|
149
|
+
bottom: '15%',
|
|
150
|
+
},
|
|
151
|
+
xAxis: {
|
|
152
|
+
type: 'category',
|
|
153
|
+
data: xCategories,
|
|
154
|
+
splitArea: { show: true },
|
|
155
|
+
axisLine: { show: false },
|
|
156
|
+
axisTick: { show: false },
|
|
157
|
+
axisLabel: { color: colors.text, fontSize: FONT_SIZE_XXS },
|
|
158
|
+
},
|
|
159
|
+
yAxis: {
|
|
160
|
+
type: 'category',
|
|
161
|
+
data: yCategories,
|
|
162
|
+
splitArea: { show: true },
|
|
163
|
+
axisLine: { show: false },
|
|
164
|
+
axisTick: { show: false },
|
|
165
|
+
axisLabel: { color: colors.text, fontSize: FONT_SIZE_XXS },
|
|
166
|
+
},
|
|
167
|
+
visualMap: {
|
|
168
|
+
min: minVal,
|
|
169
|
+
max: maxVal,
|
|
170
|
+
show: false,
|
|
171
|
+
inRange: {
|
|
172
|
+
color: [colors.background, PALETTE[0]],
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
series: [
|
|
176
|
+
{
|
|
177
|
+
type: 'heatmap',
|
|
178
|
+
data: heatmapData,
|
|
179
|
+
label: labelConfig,
|
|
180
|
+
itemStyle: {
|
|
181
|
+
borderColor: theme === 'light' ? '#e8e8e8' : '#333333',
|
|
182
|
+
borderWidth: 1,
|
|
183
|
+
},
|
|
184
|
+
emphasis: {
|
|
185
|
+
itemStyle: { shadowBlur: 10, shadowColor: 'rgba(0, 0, 0, 0.5)' },
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Generate a heatmap chart
|
|
193
|
+
*/
|
|
194
|
+
function generateHeatmap(spec) {
|
|
195
|
+
const height = typeof spec.height === 'number' ? spec.height : 450;
|
|
196
|
+
return wrapHtml('chart', buildHeatmapOptions(spec), '', '100%', height);
|
|
197
|
+
}
|
|
198
|
+
// Register the chart
|
|
199
|
+
registerChart('heatmap')(generateHeatmap);
|
|
200
|
+
registerOptions('heatmap')(buildHeatmapOptions);
|
|
201
|
+
export { generateHeatmap };
|
|
202
|
+
//# sourceMappingURL=heatmap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heatmap.js","sourceRoot":"","sources":["../../charts/heatmap.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBA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|
|
1
|
+
/**
|
|
2
|
+
* Histogram chart generator
|
|
3
|
+
*/
|
|
4
|
+
import type { ChartSpec } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build ECharts options for a histogram
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildHistogramOptions(spec: ChartSpec): Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a histogram chart
|
|
11
|
+
*/
|
|
12
|
+
declare function generateHistogram(spec: ChartSpec): string;
|
|
13
|
+
export { generateHistogram };
|
|
14
|
+
//# sourceMappingURL=histogram.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"histogram.d.ts","sourceRoot":"","sources":["../../charts/histogram.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AAK/D;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuF9E;AAED;;GAEG;AACH,iBAAS,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAGlD;AAMD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Histogram chart generator
|
|
3
|
+
*/
|
|
4
|
+
import { DEFAULT_CHART_HEIGHT, getThemeColors, getPalette } from '../core/themes.js';
|
|
5
|
+
import { wrapHtml } from '../core/serializer.js';
|
|
6
|
+
import { registerChart, registerOptions } from './registry.js';
|
|
7
|
+
/**
|
|
8
|
+
* Build ECharts options for a histogram
|
|
9
|
+
*/
|
|
10
|
+
export function buildHistogramOptions(spec) {
|
|
11
|
+
const data = (spec.data ?? []);
|
|
12
|
+
const valueField = spec.value ?? 'value';
|
|
13
|
+
const bins = typeof spec.bins === 'number' ? spec.bins : 10;
|
|
14
|
+
const theme = (spec.theme ?? 'light');
|
|
15
|
+
const colors = getThemeColors(theme);
|
|
16
|
+
const palette = getPalette(theme);
|
|
17
|
+
// Extract values
|
|
18
|
+
const values = data.map((d) => {
|
|
19
|
+
if (typeof d === 'number')
|
|
20
|
+
return d;
|
|
21
|
+
return typeof d[valueField] === 'number' ? d[valueField] : 0;
|
|
22
|
+
});
|
|
23
|
+
if (values.length === 0) {
|
|
24
|
+
return {
|
|
25
|
+
backgroundColor: 'transparent',
|
|
26
|
+
series: [],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
// Calculate histogram bins
|
|
30
|
+
const minVal = Math.min(...values);
|
|
31
|
+
const maxVal = Math.max(...values);
|
|
32
|
+
const binWidth = (maxVal - minVal) / bins || 1;
|
|
33
|
+
const histogram = new Array(bins).fill(0);
|
|
34
|
+
for (const v of values) {
|
|
35
|
+
const binIdx = Math.min(Math.floor((v - minVal) / binWidth), bins - 1);
|
|
36
|
+
if (histogram[binIdx] !== undefined) {
|
|
37
|
+
histogram[binIdx]++;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const binLabels = Array.from({ length: bins }, (_, i) => (minVal + i * binWidth).toFixed(1));
|
|
41
|
+
return {
|
|
42
|
+
backgroundColor: 'transparent',
|
|
43
|
+
animation: false,
|
|
44
|
+
color: palette,
|
|
45
|
+
tooltip: {
|
|
46
|
+
trigger: 'axis',
|
|
47
|
+
axisPointer: { type: 'shadow' },
|
|
48
|
+
backgroundColor: colors.paper,
|
|
49
|
+
borderColor: colors.border,
|
|
50
|
+
textStyle: { color: colors.text },
|
|
51
|
+
},
|
|
52
|
+
grid: {
|
|
53
|
+
left: '2%',
|
|
54
|
+
right: '2%',
|
|
55
|
+
top: '6%',
|
|
56
|
+
bottom: '8%',
|
|
57
|
+
containLabel: true,
|
|
58
|
+
},
|
|
59
|
+
xAxis: {
|
|
60
|
+
type: 'category',
|
|
61
|
+
data: binLabels,
|
|
62
|
+
axisLine: { show: false },
|
|
63
|
+
axisTick: { show: false },
|
|
64
|
+
axisLabel: {
|
|
65
|
+
color: colors.textSecondary,
|
|
66
|
+
interval: 0,
|
|
67
|
+
rotate: 45,
|
|
68
|
+
overflow: 'truncate',
|
|
69
|
+
ellipsis: '...',
|
|
70
|
+
width: 100,
|
|
71
|
+
hideOverlap: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
yAxis: {
|
|
75
|
+
type: 'value',
|
|
76
|
+
axisLine: { show: false },
|
|
77
|
+
axisTick: { show: false },
|
|
78
|
+
axisLabel: { color: colors.textSecondary },
|
|
79
|
+
splitLine: { lineStyle: { color: colors.border, type: [2, 3], opacity: 0.6 } },
|
|
80
|
+
},
|
|
81
|
+
series: [
|
|
82
|
+
{
|
|
83
|
+
type: 'bar',
|
|
84
|
+
data: histogram,
|
|
85
|
+
barWidth: '95%',
|
|
86
|
+
barGap: '0%',
|
|
87
|
+
itemStyle: { color: palette[0] },
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Generate a histogram chart
|
|
94
|
+
*/
|
|
95
|
+
function generateHistogram(spec) {
|
|
96
|
+
const height = typeof spec.height === 'number' ? spec.height : DEFAULT_CHART_HEIGHT;
|
|
97
|
+
return wrapHtml('chart', buildHistogramOptions(spec), '', '100%', height);
|
|
98
|
+
}
|
|
99
|
+
// Register the chart
|
|
100
|
+
registerChart('histogram')(generateHistogram);
|
|
101
|
+
registerOptions('histogram')(buildHistogramOptions);
|
|
102
|
+
export { generateHistogram };
|
|
103
|
+
//# sourceMappingURL=histogram.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"histogram.js","sourceRoot":"","sources":["../../charts/histogram.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAA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AAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Charts module exports
|
|
3
|
+
*/
|
|
4
|
+
export * from './registry.js';
|
|
5
|
+
export { getOptionsBuilder } from './registry.js';
|
|
6
|
+
import './bar.js';
|
|
7
|
+
import './line.js';
|
|
8
|
+
import './pie.js';
|
|
9
|
+
import './scatter.js';
|
|
10
|
+
import './area.js';
|
|
11
|
+
import './sparkline.js';
|
|
12
|
+
import './histogram.js';
|
|
13
|
+
import './heatmap.js';
|
|
14
|
+
import './bubble.js';
|
|
15
|
+
import './boxplot.js';
|
|
16
|
+
import './calendar.js';
|
|
17
|
+
import './funnel.js';
|
|
18
|
+
import './sankey.js';
|
|
19
|
+
import './combo.js';
|
|
20
|
+
import './waterfall.js';
|
|
21
|
+
import './xmr.js';
|
|
22
|
+
import './dumbbell.js';
|
|
23
|
+
export { buildBarOptions, generateBarChart } from './bar.js';
|
|
24
|
+
export { buildLineOptions, generateLineChart } from './line.js';
|
|
25
|
+
export { buildPieOptions, generatePieChart } from './pie.js';
|
|
26
|
+
export { buildScatterOptions, generateScatterChart } from './scatter.js';
|
|
27
|
+
export { buildAreaOptions, generateAreaChart } from './area.js';
|
|
28
|
+
export { buildSparklineOptions, generateSparkline, generatePctBar } from './sparkline.js';
|
|
29
|
+
export { buildHistogramOptions, generateHistogram } from './histogram.js';
|
|
30
|
+
export { buildHeatmapOptions, generateHeatmap } from './heatmap.js';
|
|
31
|
+
export { buildBubbleOptions, generateBubble } from './bubble.js';
|
|
32
|
+
export { buildBoxplotOptions, generateBoxplot } from './boxplot.js';
|
|
33
|
+
export { buildCalendarOptions, generateCalendar } from './calendar.js';
|
|
34
|
+
export { buildFunnelOptions, generateFunnel } from './funnel.js';
|
|
35
|
+
export { buildSankeyOptions, generateSankey } from './sankey.js';
|
|
36
|
+
export { buildComboOptions, generateCombo } from './combo.js';
|
|
37
|
+
export { buildWaterfallOptions, generateWaterfall } from './waterfall.js';
|
|
38
|
+
export { buildXmrOptions, generateXmr } from './xmr.js';
|
|
39
|
+
export { buildDumbbellOptions, generateDumbbell } from './dumbbell.js';
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../charts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,UAAU,CAAC;AAClB,OAAO,WAAW,CAAC;AACnB,OAAO,UAAU,CAAC;AAClB,OAAO,cAAc,CAAC;AACtB,OAAO,WAAW,CAAC;AACnB,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AACtB,OAAO,aAAa,CAAC;AACrB,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC;AACrB,OAAO,YAAY,CAAC;AACpB,OAAO,gBAAgB,CAAC;AACxB,OAAO,UAAU,CAAC;AAClB,OAAO,eAAe,CAAC;AAGvB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Charts module exports
|
|
3
|
+
*/
|
|
4
|
+
export * from './registry.js';
|
|
5
|
+
export { getOptionsBuilder } from './registry.js';
|
|
6
|
+
// Import chart modules to trigger registration
|
|
7
|
+
import './bar.js';
|
|
8
|
+
import './line.js';
|
|
9
|
+
import './pie.js';
|
|
10
|
+
import './scatter.js';
|
|
11
|
+
import './area.js';
|
|
12
|
+
import './sparkline.js';
|
|
13
|
+
import './histogram.js';
|
|
14
|
+
import './heatmap.js';
|
|
15
|
+
import './bubble.js';
|
|
16
|
+
import './boxplot.js';
|
|
17
|
+
import './calendar.js';
|
|
18
|
+
import './funnel.js';
|
|
19
|
+
import './sankey.js';
|
|
20
|
+
import './combo.js';
|
|
21
|
+
import './waterfall.js';
|
|
22
|
+
import './xmr.js';
|
|
23
|
+
import './dumbbell.js';
|
|
24
|
+
// Re-export chart builders for direct use
|
|
25
|
+
export { buildBarOptions, generateBarChart } from './bar.js';
|
|
26
|
+
export { buildLineOptions, generateLineChart } from './line.js';
|
|
27
|
+
export { buildPieOptions, generatePieChart } from './pie.js';
|
|
28
|
+
export { buildScatterOptions, generateScatterChart } from './scatter.js';
|
|
29
|
+
export { buildAreaOptions, generateAreaChart } from './area.js';
|
|
30
|
+
export { buildSparklineOptions, generateSparkline, generatePctBar } from './sparkline.js';
|
|
31
|
+
export { buildHistogramOptions, generateHistogram } from './histogram.js';
|
|
32
|
+
export { buildHeatmapOptions, generateHeatmap } from './heatmap.js';
|
|
33
|
+
export { buildBubbleOptions, generateBubble } from './bubble.js';
|
|
34
|
+
export { buildBoxplotOptions, generateBoxplot } from './boxplot.js';
|
|
35
|
+
export { buildCalendarOptions, generateCalendar } from './calendar.js';
|
|
36
|
+
export { buildFunnelOptions, generateFunnel } from './funnel.js';
|
|
37
|
+
export { buildSankeyOptions, generateSankey } from './sankey.js';
|
|
38
|
+
export { buildComboOptions, generateCombo } from './combo.js';
|
|
39
|
+
export { buildWaterfallOptions, generateWaterfall } from './waterfall.js';
|
|
40
|
+
export { buildXmrOptions, generateXmr } from './xmr.js';
|
|
41
|
+
export { buildDumbbellOptions, generateDumbbell } from './dumbbell.js';
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../charts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,+CAA+C;AAC/C,OAAO,UAAU,CAAC;AAClB,OAAO,WAAW,CAAC;AACnB,OAAO,UAAU,CAAC;AAClB,OAAO,cAAc,CAAC;AACtB,OAAO,WAAW,CAAC;AACnB,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AACtB,OAAO,aAAa,CAAC;AACrB,OAAO,cAAc,CA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;AACxD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line chart generator
|
|
3
|
+
*/
|
|
4
|
+
import type { ChartSpec } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build ECharts options for a line chart
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildLineOptions(spec: ChartSpec): Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a line chart
|
|
11
|
+
*/
|
|
12
|
+
declare function generateLineChart(spec: ChartSpec): string;
|
|
13
|
+
export { generateLineChart };
|
|
14
|
+
//# sourceMappingURL=line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../charts/line.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAgC,MAAM,aAAa,CAAC;AAY3E;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyHzE;AAED;;GAEG;AACH,iBAAS,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAGlD;AAMD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Line chart generator
|
|
3
|
+
*/
|
|
4
|
+
import { FONT_SIZE_TINY, DEFAULT_CHART_HEIGHT, getThemeColors, getPalette, } from '../core/themes.js';
|
|
5
|
+
import { wrapHtml } from '../core/serializer.js';
|
|
6
|
+
import { registerChart, registerOptions } from './registry.js';
|
|
7
|
+
import { inferFormat, getAxisFormatterJs, inferAxisType } from '../core/formatting.js';
|
|
8
|
+
/**
|
|
9
|
+
* Build ECharts options for a line chart
|
|
10
|
+
*/
|
|
11
|
+
export function buildLineOptions(spec) {
|
|
12
|
+
const data = (spec.data ?? []);
|
|
13
|
+
const x = spec.x ?? 'name';
|
|
14
|
+
const y = spec.y ?? 'value';
|
|
15
|
+
const theme = (spec.theme ?? 'light');
|
|
16
|
+
const smooth = spec.smooth === true;
|
|
17
|
+
const colors = getThemeColors(theme);
|
|
18
|
+
const yKeys = Array.isArray(y) ? y : [y];
|
|
19
|
+
const categories = data.map((d) => d[x]);
|
|
20
|
+
const palette = getPalette(theme);
|
|
21
|
+
// Infer format for value axis based on first y field name
|
|
22
|
+
const firstYKey = yKeys[0] ?? 'value';
|
|
23
|
+
const sampleValue = data.length > 0 && data[0] ? data[0][firstYKey] ?? 0 : 0;
|
|
24
|
+
const valueFormat = spec.format ?? inferFormat(firstYKey, sampleValue);
|
|
25
|
+
const axisFormatter = getAxisFormatterJs(valueFormat);
|
|
26
|
+
// Detect x-axis type: time, value, or category
|
|
27
|
+
// User can override with xAxisType in spec
|
|
28
|
+
const xAxisType = spec.xAxisType ?? inferAxisType(categories);
|
|
29
|
+
// More right margin needed for end labels on multi-series
|
|
30
|
+
const hasEndLabels = yKeys.length > 1;
|
|
31
|
+
// Get axis label config based on axis type
|
|
32
|
+
const xAxisLabelConfig = xAxisType === 'category'
|
|
33
|
+
? { interval: 0, rotate: 45, overflow: 'truncate', ellipsis: '...', width: 100 }
|
|
34
|
+
: xAxisType === 'time'
|
|
35
|
+
? {
|
|
36
|
+
hideOverlap: true,
|
|
37
|
+
formatter: {
|
|
38
|
+
_js_: `function(value) {
|
|
39
|
+
var d = new Date(value);
|
|
40
|
+
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
|
|
41
|
+
return months[d.getMonth()] + ' ' + d.getDate();
|
|
42
|
+
}`,
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
: { hideOverlap: true };
|
|
46
|
+
const option = {
|
|
47
|
+
backgroundColor: 'transparent',
|
|
48
|
+
animation: false,
|
|
49
|
+
color: palette,
|
|
50
|
+
tooltip: {
|
|
51
|
+
trigger: 'axis',
|
|
52
|
+
backgroundColor: colors.paper,
|
|
53
|
+
borderColor: colors.border,
|
|
54
|
+
textStyle: { color: colors.text },
|
|
55
|
+
},
|
|
56
|
+
grid: {
|
|
57
|
+
left: '2%',
|
|
58
|
+
right: hasEndLabels ? '18%' : '2%',
|
|
59
|
+
top: '6%',
|
|
60
|
+
bottom: '8%',
|
|
61
|
+
containLabel: true,
|
|
62
|
+
},
|
|
63
|
+
xAxis: {
|
|
64
|
+
type: xAxisType,
|
|
65
|
+
// Only set data array for category axes; time/value axes get data in series
|
|
66
|
+
data: xAxisType === 'category' ? categories.map(String) : undefined,
|
|
67
|
+
boundaryGap: false,
|
|
68
|
+
axisLine: { show: false },
|
|
69
|
+
axisTick: { show: false },
|
|
70
|
+
axisLabel: {
|
|
71
|
+
color: colors.textSecondary,
|
|
72
|
+
...xAxisLabelConfig,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
yAxis: {
|
|
76
|
+
type: 'value',
|
|
77
|
+
axisLine: { show: false },
|
|
78
|
+
axisTick: { show: false },
|
|
79
|
+
axisLabel: {
|
|
80
|
+
color: colors.textSecondary,
|
|
81
|
+
...(axisFormatter && { formatter: axisFormatter }),
|
|
82
|
+
},
|
|
83
|
+
splitLine: { lineStyle: { color: colors.border, type: [2, 3], opacity: 0.6 } },
|
|
84
|
+
},
|
|
85
|
+
series: [],
|
|
86
|
+
};
|
|
87
|
+
// Apply yMin/yMax
|
|
88
|
+
if (spec.yMin !== undefined) {
|
|
89
|
+
option.yAxis.min = spec.yMin;
|
|
90
|
+
}
|
|
91
|
+
if (spec.yMax !== undefined) {
|
|
92
|
+
option.yAxis.max = spec.yMax;
|
|
93
|
+
}
|
|
94
|
+
// Build series
|
|
95
|
+
for (let i = 0; i < yKeys.length; i++) {
|
|
96
|
+
const key = yKeys[i];
|
|
97
|
+
// Format series data based on axis type
|
|
98
|
+
const seriesData = xAxisType === 'category'
|
|
99
|
+
? data.map((d) => d[key] ?? 0) // Category axis: just y values
|
|
100
|
+
: data.map((d) => [d[x], d[key] ?? 0]); // Time/value axes: [x, y] pairs
|
|
101
|
+
option.series.push({
|
|
102
|
+
name: key,
|
|
103
|
+
type: 'line',
|
|
104
|
+
data: seriesData,
|
|
105
|
+
smooth,
|
|
106
|
+
symbol: 'none',
|
|
107
|
+
lineStyle: { width: 2 },
|
|
108
|
+
itemStyle: { color: palette[i % palette.length] },
|
|
109
|
+
endLabel: {
|
|
110
|
+
show: yKeys.length > 1,
|
|
111
|
+
formatter: '{a}',
|
|
112
|
+
color: palette[i % palette.length],
|
|
113
|
+
fontSize: FONT_SIZE_TINY,
|
|
114
|
+
offset: [5, 0],
|
|
115
|
+
},
|
|
116
|
+
labelLayout: {
|
|
117
|
+
moveOverlap: 'shiftY',
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return option;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Generate a line chart
|
|
125
|
+
*/
|
|
126
|
+
function generateLineChart(spec) {
|
|
127
|
+
const height = typeof spec.height === 'number' ? spec.height : DEFAULT_CHART_HEIGHT;
|
|
128
|
+
return wrapHtml('chart', buildLineOptions(spec), '', '100%', height);
|
|
129
|
+
}
|
|
130
|
+
// Register the chart
|
|
131
|
+
registerChart('line')(generateLineChart);
|
|
132
|
+
registerOptions('line')(buildLineOptions);
|
|
133
|
+
export { generateLineChart };
|
|
134
|
+
//# sourceMappingURL=line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../charts/line.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC/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AAiB,CAAC,CAAC;AACzC,eAAe,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pie chart generator
|
|
3
|
+
*/
|
|
4
|
+
import type { ChartSpec } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build ECharts options for a pie or donut chart
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildPieOptions(spec: ChartSpec): Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a pie chart
|
|
11
|
+
*/
|
|
12
|
+
declare function generatePieChart(spec: ChartSpec): string;
|
|
13
|
+
export { generatePieChart };
|
|
14
|
+
//# sourceMappingURL=pie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie.d.ts","sourceRoot":"","sources":["../../charts/pie.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AAK/D;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyDxE;AAED;;GAEG;AACH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAGjD;AAMD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|