@allternit/viz 0.1.0 → 0.1.1
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +4 -12
- package/src/index.ts +2 -2
- package/src/types.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/dist/charts/canvas-renderer.d.ts.bak +0 -40
- package/dist/charts/canvas-renderer.js.bak +0 -580
- package/dist/charts/svg-renderer.d.ts.bak +0 -21
- package/dist/charts/svg-renderer.js.bak +0 -285
- package/dist/index.d.ts.bak +0 -34
- package/dist/index.js.bak +0 -35
- package/dist/types.d.ts.bak +0 -342
- package/dist/types.js.bak +0 -39
- package/dist/utils/data-processor.d.ts.bak +0 -64
- package/dist/utils/data-processor.js.bak +0 -326
- package/src/charts/canvas-renderer.ts.bak +0 -735
- package/src/charts/svg-renderer.test.ts.bak +0 -837
- package/src/charts/svg-renderer.ts.bak +0 -380
- package/src/index.ts.bak +0 -64
- package/src/types.ts.bak +0 -410
- package/src/utils/data-processor.test.ts.bak +0 -720
- package/src/utils/data-processor.ts.bak +0 -420
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SVG Chart Renderer
|
|
3
|
-
*
|
|
4
|
-
* Renders charts to SVG format.
|
|
5
|
-
*/
|
|
6
|
-
import { palettes } from '../types';
|
|
7
|
-
/**
|
|
8
|
-
* Create SVG chart renderer
|
|
9
|
-
*/
|
|
10
|
-
export function createSVGRenderer() {
|
|
11
|
-
const defaultWidth = 800;
|
|
12
|
-
const defaultHeight = 400;
|
|
13
|
-
const margin = { top: 60, right: 40, bottom: 60, left: 80 };
|
|
14
|
-
/**
|
|
15
|
-
* Render chart to SVG
|
|
16
|
-
*/
|
|
17
|
-
function render(config, series) {
|
|
18
|
-
const width = config.width || defaultWidth;
|
|
19
|
-
const height = config.height || defaultHeight;
|
|
20
|
-
const palette = palettes[config.theme || 'default'];
|
|
21
|
-
const chartWidth = width - margin.left - margin.right;
|
|
22
|
-
const chartHeight = height - margin.top - margin.bottom;
|
|
23
|
-
let svg = `<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" xmlns="http://www.w3.org/2000/svg">\n`;
|
|
24
|
-
// Background
|
|
25
|
-
svg += ` <rect width="${width}" height="${height}" fill="${palette.background[0]}" />\n`;
|
|
26
|
-
// Title
|
|
27
|
-
if (config.title) {
|
|
28
|
-
svg += ` <text x="${width / 2}" y="30" text-anchor="middle" font-family="sans-serif" font-size="18" font-weight="bold" fill="${palette.text.primary}">${escapeHtml(config.title)}</text>\n`;
|
|
29
|
-
}
|
|
30
|
-
// Chart group
|
|
31
|
-
svg += ` <g transform="translate(${margin.left}, ${margin.top})">\n`;
|
|
32
|
-
// Render based on chart type
|
|
33
|
-
switch (config.type) {
|
|
34
|
-
case 'bar':
|
|
35
|
-
svg += renderBarChart(chartWidth, chartHeight, series, palette, config);
|
|
36
|
-
break;
|
|
37
|
-
case 'line':
|
|
38
|
-
svg += renderLineChart(chartWidth, chartHeight, series, palette, config);
|
|
39
|
-
break;
|
|
40
|
-
case 'pie':
|
|
41
|
-
case 'donut':
|
|
42
|
-
svg += renderPieChart(chartWidth, chartHeight, series, palette, config);
|
|
43
|
-
break;
|
|
44
|
-
case 'area':
|
|
45
|
-
svg += renderAreaChart(chartWidth, chartHeight, series, palette, config);
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
svg += renderPlaceholder(chartWidth, chartHeight, config.type);
|
|
49
|
-
}
|
|
50
|
-
// Axes
|
|
51
|
-
if (['bar', 'line', 'area'].includes(config.type)) {
|
|
52
|
-
svg += renderAxes(chartWidth, chartHeight, series, config, palette);
|
|
53
|
-
}
|
|
54
|
-
svg += ` </g>\n`;
|
|
55
|
-
svg += `</svg>`;
|
|
56
|
-
return svg;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Render bar chart
|
|
60
|
-
*/
|
|
61
|
-
function renderBarChart(width, height, series, palette, config) {
|
|
62
|
-
let svg = '';
|
|
63
|
-
if (series.length === 0)
|
|
64
|
-
return svg;
|
|
65
|
-
const allData = series.flatMap(s => s.data);
|
|
66
|
-
const maxValue = Math.max(...allData.map(d => (d.y || d.value || 0)));
|
|
67
|
-
const categories = [...new Set(allData.map(d => d.x || d.name))];
|
|
68
|
-
const barWidth = (width / categories.length) * 0.6 / series.length;
|
|
69
|
-
const scaleY = height / (maxValue * 1.1);
|
|
70
|
-
series.forEach((s, seriesIndex) => {
|
|
71
|
-
const color = s.color || palette.primary[seriesIndex % palette.primary.length];
|
|
72
|
-
s.data.forEach((point, pointIndex) => {
|
|
73
|
-
const value = (point.y || point.value || 0);
|
|
74
|
-
const barHeight = value * scaleY;
|
|
75
|
-
const x = (pointIndex + 0.2) * (width / categories.length) + seriesIndex * barWidth;
|
|
76
|
-
const y = height - barHeight;
|
|
77
|
-
svg += ` <rect x="${x}" y="${y}" width="${barWidth}" height="${barHeight}" fill="${color}" />\n`;
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
return svg;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Render line chart
|
|
84
|
-
*/
|
|
85
|
-
function renderLineChart(width, height, series, palette, config) {
|
|
86
|
-
let svg = '';
|
|
87
|
-
if (series.length === 0)
|
|
88
|
-
return svg;
|
|
89
|
-
const allData = series.flatMap(s => s.data);
|
|
90
|
-
const maxValue = Math.max(...allData.map(d => (d.y || 0)));
|
|
91
|
-
const scaleX = width / (allData.length - 1 || 1);
|
|
92
|
-
const scaleY = height / (maxValue * 1.1);
|
|
93
|
-
series.forEach((s, seriesIndex) => {
|
|
94
|
-
const color = s.color || palette.primary[seriesIndex % palette.primary.length];
|
|
95
|
-
// Generate path
|
|
96
|
-
let path = '';
|
|
97
|
-
s.data.forEach((point, index) => {
|
|
98
|
-
const x = index * scaleX;
|
|
99
|
-
const y = height - (point.y || 0) * scaleY;
|
|
100
|
-
path += index === 0 ? `M ${x} ${y}` : ` L ${x} ${y}`;
|
|
101
|
-
});
|
|
102
|
-
svg += ` <path d="${path}" fill="none" stroke="${color}" stroke-width="2" />\n`;
|
|
103
|
-
// Data points
|
|
104
|
-
if (config.dataLabels) {
|
|
105
|
-
s.data.forEach((point, index) => {
|
|
106
|
-
const x = index * scaleX;
|
|
107
|
-
const y = height - (point.y || 0) * scaleY;
|
|
108
|
-
svg += ` <circle cx="${x}" cy="${y}" r="4" fill="${color}" />\n`;
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
return svg;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Render pie/donut chart
|
|
116
|
-
*/
|
|
117
|
-
function renderPieChart(width, height, series, palette, config) {
|
|
118
|
-
let svg = '';
|
|
119
|
-
if (series.length === 0)
|
|
120
|
-
return svg;
|
|
121
|
-
const data = series[0].data;
|
|
122
|
-
const total = data.reduce((sum, d) => sum + (d.y || d.value || 0), 0);
|
|
123
|
-
const centerX = width / 2;
|
|
124
|
-
const centerY = height / 2;
|
|
125
|
-
const radius = Math.min(width, height) / 2 * 0.8;
|
|
126
|
-
const innerRadius = config.type === 'donut' ? radius * 0.5 : 0;
|
|
127
|
-
let currentAngle = -Math.PI / 2;
|
|
128
|
-
data.forEach((point, index) => {
|
|
129
|
-
const value = (point.y || point.value || 0);
|
|
130
|
-
const angle = (value / total) * 2 * Math.PI;
|
|
131
|
-
const color = palette.primary[index % palette.primary.length];
|
|
132
|
-
const x1 = centerX + Math.cos(currentAngle) * radius;
|
|
133
|
-
const y1 = centerY + Math.sin(currentAngle) * radius;
|
|
134
|
-
const x2 = centerX + Math.cos(currentAngle + angle) * radius;
|
|
135
|
-
const y2 = centerY + Math.sin(currentAngle + angle) * radius;
|
|
136
|
-
const largeArc = angle > Math.PI ? 1 : 0;
|
|
137
|
-
if (innerRadius > 0) {
|
|
138
|
-
// Donut
|
|
139
|
-
const ix1 = centerX + Math.cos(currentAngle) * innerRadius;
|
|
140
|
-
const iy1 = centerY + Math.sin(currentAngle) * innerRadius;
|
|
141
|
-
const ix2 = centerX + Math.cos(currentAngle + angle) * innerRadius;
|
|
142
|
-
const iy2 = centerY + Math.sin(currentAngle + angle) * innerRadius;
|
|
143
|
-
svg += ` <path d="M ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} L ${ix2} ${iy2} A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${ix1} ${iy1} Z" fill="${color}" />\n`;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
// Pie
|
|
147
|
-
svg += ` <path d="M ${centerX} ${centerY} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z" fill="${color}" />\n`;
|
|
148
|
-
}
|
|
149
|
-
currentAngle += angle;
|
|
150
|
-
});
|
|
151
|
-
return svg;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Render area chart
|
|
155
|
-
*/
|
|
156
|
-
function renderAreaChart(width, height, series, palette, config) {
|
|
157
|
-
let svg = '';
|
|
158
|
-
if (series.length === 0)
|
|
159
|
-
return svg;
|
|
160
|
-
const allData = series.flatMap(s => s.data);
|
|
161
|
-
const maxValue = Math.max(...allData.map(d => (d.y || 0)));
|
|
162
|
-
const scaleX = width / (allData.length - 1 || 1);
|
|
163
|
-
const scaleY = height / (maxValue * 1.1);
|
|
164
|
-
series.forEach((s, seriesIndex) => {
|
|
165
|
-
const color = s.color || palette.primary[seriesIndex % palette.primary.length];
|
|
166
|
-
const fillColor = color + '40'; // 25% opacity
|
|
167
|
-
// Generate area path
|
|
168
|
-
let path = '';
|
|
169
|
-
s.data.forEach((point, index) => {
|
|
170
|
-
const x = index * scaleX;
|
|
171
|
-
const y = height - (point.y || 0) * scaleY;
|
|
172
|
-
path += index === 0 ? `M ${x} ${y}` : ` L ${x} ${y}`;
|
|
173
|
-
});
|
|
174
|
-
// Close the area
|
|
175
|
-
path += ` L ${width} ${height} L 0 ${height} Z`;
|
|
176
|
-
svg += ` <path d="${path}" fill="${fillColor}" stroke="${color}" stroke-width="2" />\n`;
|
|
177
|
-
});
|
|
178
|
-
return svg;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Render placeholder for unsupported chart types
|
|
182
|
-
*/
|
|
183
|
-
function renderPlaceholder(width, height, type) {
|
|
184
|
-
return ` <rect x="${width / 4}" y="${height / 3}" width="${width / 2}" height="${height / 3}" fill="#e5e7eb" rx="8" />\n <text x="${width / 2}" y="${height / 2}" text-anchor="middle" font-family="sans-serif" font-size="14" fill="#6b7280">${type} chart</text>\n`;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Render axes
|
|
188
|
-
*/
|
|
189
|
-
function renderAxes(width, height, series, config, palette) {
|
|
190
|
-
let svg = '';
|
|
191
|
-
// Y-axis
|
|
192
|
-
svg += ` <line x1="0" y1="0" x2="0" y2="${height}" stroke="${palette.background[2]}" stroke-width="1" />\n`;
|
|
193
|
-
// X-axis
|
|
194
|
-
svg += ` <line x1="0" y1="${height}" x2="${width}" y2="${height}" stroke="${palette.background[2]}" stroke-width="1" />\n`;
|
|
195
|
-
// Y-axis labels
|
|
196
|
-
const yAxis = config.yAxis || {};
|
|
197
|
-
const maxValue = Math.max(...series.flatMap(s => s.data.map(d => (d.y || 0))));
|
|
198
|
-
const steps = 5;
|
|
199
|
-
for (let i = 0; i <= steps; i++) {
|
|
200
|
-
const value = (maxValue / steps) * i;
|
|
201
|
-
const y = height - (height / steps) * i;
|
|
202
|
-
svg += ` <text x="-10" y="${y + 4}" text-anchor="end" font-family="sans-serif" font-size="12" fill="${palette.text.secondary}">${Math.round(value)}</text>\n`;
|
|
203
|
-
// Grid line
|
|
204
|
-
if (config.xAxis?.grid?.enabled !== false && i > 0) {
|
|
205
|
-
svg += ` <line x1="0" y1="${y}" x2="${width}" y2="${y}" stroke="${palette.background[2]}" stroke-width="1" stroke-dasharray="4,4" />\n`;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
// Axis titles
|
|
209
|
-
if (yAxis.title) {
|
|
210
|
-
svg += ` <text x="${-margin.left + 20}" y="${height / 2}" transform="rotate(-90, ${-margin.left + 20}, ${height / 2})" text-anchor="middle" font-family="sans-serif" font-size="12" fill="${palette.text.secondary}">${escapeHtml(yAxis.title)}</text>\n`;
|
|
211
|
-
}
|
|
212
|
-
if (config.xAxis?.title) {
|
|
213
|
-
svg += ` <text x="${width / 2}" y="${height + 40}" text-anchor="middle" font-family="sans-serif" font-size="12" fill="${palette.text.secondary}">${escapeHtml(config.xAxis.title)}</text>\n`;
|
|
214
|
-
}
|
|
215
|
-
return svg;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Escape HTML special characters
|
|
219
|
-
*/
|
|
220
|
-
function escapeHtml(text) {
|
|
221
|
-
return text
|
|
222
|
-
.replace(/&/g, '&')
|
|
223
|
-
.replace(/</g, '<')
|
|
224
|
-
.replace(/>/g, '>')
|
|
225
|
-
.replace(/"/g, '"')
|
|
226
|
-
.replace(/'/g, ''');
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Get chart metadata
|
|
230
|
-
*/
|
|
231
|
-
function getMetadata(type) {
|
|
232
|
-
const metadata = {
|
|
233
|
-
line: {
|
|
234
|
-
type: 'line',
|
|
235
|
-
name: 'Line Chart',
|
|
236
|
-
description: 'Show trends over time or categories',
|
|
237
|
-
axes: ['x', 'y'],
|
|
238
|
-
dataStructure: 'Array of { x, y } points',
|
|
239
|
-
useCases: ['Time series', 'Trends', 'Progress over time'],
|
|
240
|
-
},
|
|
241
|
-
bar: {
|
|
242
|
-
type: 'bar',
|
|
243
|
-
name: 'Bar Chart',
|
|
244
|
-
description: 'Compare values across categories',
|
|
245
|
-
axes: ['x', 'y'],
|
|
246
|
-
dataStructure: 'Array of { x, y } points',
|
|
247
|
-
useCases: ['Comparisons', 'Rankings', 'Category distribution'],
|
|
248
|
-
},
|
|
249
|
-
pie: {
|
|
250
|
-
type: 'pie',
|
|
251
|
-
name: 'Pie Chart',
|
|
252
|
-
description: 'Show part-to-whole relationships',
|
|
253
|
-
axes: [],
|
|
254
|
-
dataStructure: 'Array of { name, value }',
|
|
255
|
-
useCases: ['Composition', 'Percentage distribution'],
|
|
256
|
-
},
|
|
257
|
-
donut: {
|
|
258
|
-
type: 'donut',
|
|
259
|
-
name: 'Donut Chart',
|
|
260
|
-
description: 'Show part-to-whole with center space',
|
|
261
|
-
axes: [],
|
|
262
|
-
dataStructure: 'Array of { name, value }',
|
|
263
|
-
useCases: ['Composition', 'Percentage distribution'],
|
|
264
|
-
},
|
|
265
|
-
area: {
|
|
266
|
-
type: 'area',
|
|
267
|
-
name: 'Area Chart',
|
|
268
|
-
description: 'Show cumulative totals over time',
|
|
269
|
-
axes: ['x', 'y'],
|
|
270
|
-
dataStructure: 'Array of { x, y } points',
|
|
271
|
-
useCases: ['Volume over time', 'Cumulative data'],
|
|
272
|
-
},
|
|
273
|
-
};
|
|
274
|
-
return metadata[type] || metadata.line;
|
|
275
|
-
}
|
|
276
|
-
return {
|
|
277
|
-
render,
|
|
278
|
-
getMetadata,
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Global SVG renderer instance
|
|
283
|
-
*/
|
|
284
|
-
export const globalSVGRenderer = createSVGRenderer();
|
|
285
|
-
//# sourceMappingURL=svg-renderer.js.map
|
package/dist/index.d.ts.bak
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A2R Data Visualization
|
|
3
|
-
*
|
|
4
|
-
* Charts, graphs, and dashboards for A2R platform.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { createSVGRenderer, createDashboard } from '@allternit/viz';
|
|
9
|
-
*
|
|
10
|
-
* const renderer = createSVGRenderer();
|
|
11
|
-
*
|
|
12
|
-
* const svg = renderer.render({
|
|
13
|
-
* type: 'bar',
|
|
14
|
-
* title: 'Sales by Month',
|
|
15
|
-
* width: 800,
|
|
16
|
-
* height: 400,
|
|
17
|
-
* }, [
|
|
18
|
-
* {
|
|
19
|
-
* id: 'sales',
|
|
20
|
-
* name: 'Sales',
|
|
21
|
-
* data: [
|
|
22
|
-
* { x: 'Jan', y: 100 },
|
|
23
|
-
* { x: 'Feb', y: 150 },
|
|
24
|
-
* { x: 'Mar', y: 200 },
|
|
25
|
-
* ],
|
|
26
|
-
* },
|
|
27
|
-
* ]);
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export type { ChartType, ChartConfig, AxisConfig, LegendConfig, TooltipConfig, DataSeries, DataPoint, DashboardConfig, WidgetConfig, GridPosition, MetricConfig, TableConfig, TableColumn, DataSource, DataTransform, ChartMetadata, ChartPalette, ExportOptions, VizEvent, } from './types';
|
|
31
|
-
export { palettes } from './types';
|
|
32
|
-
export { createSVGRenderer, globalSVGRenderer, type SVGRenderer, } from './charts/svg-renderer';
|
|
33
|
-
export declare const VERSION = "0.1.0";
|
|
34
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js.bak
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A2R Data Visualization
|
|
3
|
-
*
|
|
4
|
-
* Charts, graphs, and dashboards for A2R platform.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { createSVGRenderer, createDashboard } from '@allternit/viz';
|
|
9
|
-
*
|
|
10
|
-
* const renderer = createSVGRenderer();
|
|
11
|
-
*
|
|
12
|
-
* const svg = renderer.render({
|
|
13
|
-
* type: 'bar',
|
|
14
|
-
* title: 'Sales by Month',
|
|
15
|
-
* width: 800,
|
|
16
|
-
* height: 400,
|
|
17
|
-
* }, [
|
|
18
|
-
* {
|
|
19
|
-
* id: 'sales',
|
|
20
|
-
* name: 'Sales',
|
|
21
|
-
* data: [
|
|
22
|
-
* { x: 'Jan', y: 100 },
|
|
23
|
-
* { x: 'Feb', y: 150 },
|
|
24
|
-
* { x: 'Mar', y: 200 },
|
|
25
|
-
* ],
|
|
26
|
-
* },
|
|
27
|
-
* ]);
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export { palettes } from './types';
|
|
31
|
-
// Charts
|
|
32
|
-
export { createSVGRenderer, globalSVGRenderer, } from './charts/svg-renderer';
|
|
33
|
-
// Version
|
|
34
|
-
export const VERSION = '0.1.0';
|
|
35
|
-
//# sourceMappingURL=index.js.map
|
package/dist/types.d.ts.bak
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A2R Data Visualization Types
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Chart Types
|
|
6
|
-
*/
|
|
7
|
-
export type ChartType = 'line' | 'bar' | 'column' | 'area' | 'pie' | 'donut' | 'scatter' | 'bubble' | 'radar' | 'heatmap' | 'treemap' | 'sankey' | 'gauge' | 'candlestick';
|
|
8
|
-
/**
|
|
9
|
-
* Chart Configuration
|
|
10
|
-
*/
|
|
11
|
-
export interface ChartConfig {
|
|
12
|
-
/** Chart type */
|
|
13
|
-
type: ChartType;
|
|
14
|
-
/** Chart title */
|
|
15
|
-
title?: string;
|
|
16
|
-
/** Chart subtitle */
|
|
17
|
-
subtitle?: string;
|
|
18
|
-
/** Width in pixels */
|
|
19
|
-
width?: number;
|
|
20
|
-
/** Height in pixels */
|
|
21
|
-
height?: number;
|
|
22
|
-
/** X-axis configuration */
|
|
23
|
-
xAxis?: AxisConfig;
|
|
24
|
-
/** Y-axis configuration */
|
|
25
|
-
yAxis?: AxisConfig;
|
|
26
|
-
/** Legend configuration */
|
|
27
|
-
legend?: LegendConfig;
|
|
28
|
-
/** Tooltip configuration */
|
|
29
|
-
tooltip?: TooltipConfig;
|
|
30
|
-
/** Chart colors */
|
|
31
|
-
colors?: string[];
|
|
32
|
-
/** Theme */
|
|
33
|
-
theme?: 'light' | 'dark';
|
|
34
|
-
/** Enable animations */
|
|
35
|
-
animation?: boolean;
|
|
36
|
-
/** Enable stacking (for bar/area) */
|
|
37
|
-
stacking?: boolean;
|
|
38
|
-
/** Show data labels */
|
|
39
|
-
dataLabels?: boolean;
|
|
40
|
-
/** Chart-specific options */
|
|
41
|
-
options?: Record<string, unknown>;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Axis Configuration
|
|
45
|
-
*/
|
|
46
|
-
export interface AxisConfig {
|
|
47
|
-
/** Axis title */
|
|
48
|
-
title?: string;
|
|
49
|
-
/** Axis type */
|
|
50
|
-
type?: 'category' | 'number' | 'datetime' | 'logarithmic';
|
|
51
|
-
/** Minimum value */
|
|
52
|
-
min?: number;
|
|
53
|
-
/** Maximum value */
|
|
54
|
-
max?: number;
|
|
55
|
-
/** Tick interval */
|
|
56
|
-
tickInterval?: number;
|
|
57
|
-
/** Label format */
|
|
58
|
-
labelFormat?: string;
|
|
59
|
-
/** Categories (for category axis) */
|
|
60
|
-
categories?: string[];
|
|
61
|
-
/** Grid lines */
|
|
62
|
-
grid?: GridConfig;
|
|
63
|
-
/** Opposite side */
|
|
64
|
-
opposite?: boolean;
|
|
65
|
-
/** Reversed */
|
|
66
|
-
reversed?: boolean;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Grid Configuration
|
|
70
|
-
*/
|
|
71
|
-
export interface GridConfig {
|
|
72
|
-
/** Show grid */
|
|
73
|
-
enabled?: boolean;
|
|
74
|
-
/** Grid color */
|
|
75
|
-
color?: string;
|
|
76
|
-
/** Dash style */
|
|
77
|
-
dashStyle?: string;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Legend Configuration
|
|
81
|
-
*/
|
|
82
|
-
export interface LegendConfig {
|
|
83
|
-
/** Show legend */
|
|
84
|
-
enabled?: boolean;
|
|
85
|
-
/** Legend position */
|
|
86
|
-
position?: 'top' | 'bottom' | 'left' | 'right';
|
|
87
|
-
/** Legend alignment */
|
|
88
|
-
align?: 'left' | 'center' | 'right';
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Tooltip Configuration
|
|
92
|
-
*/
|
|
93
|
-
export interface TooltipConfig {
|
|
94
|
-
/** Show tooltip */
|
|
95
|
-
enabled?: boolean;
|
|
96
|
-
/** Shared tooltip */
|
|
97
|
-
shared?: boolean;
|
|
98
|
-
/** Follow cursor */
|
|
99
|
-
followCursor?: boolean;
|
|
100
|
-
/** Formatter function */
|
|
101
|
-
formatter?: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Data Series
|
|
105
|
-
*/
|
|
106
|
-
export interface DataSeries {
|
|
107
|
-
/** Series ID */
|
|
108
|
-
id: string;
|
|
109
|
-
/** Series name */
|
|
110
|
-
name: string;
|
|
111
|
-
/** Series type (can override chart type) */
|
|
112
|
-
type?: ChartType;
|
|
113
|
-
/** Series data */
|
|
114
|
-
data: DataPoint[];
|
|
115
|
-
/** Series color */
|
|
116
|
-
color?: string;
|
|
117
|
-
/** Y-axis index (for multi-axis) */
|
|
118
|
-
yAxis?: number;
|
|
119
|
-
/** Series options */
|
|
120
|
-
options?: Record<string, unknown>;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Data Point
|
|
124
|
-
*/
|
|
125
|
-
export interface DataPoint {
|
|
126
|
-
/** X value */
|
|
127
|
-
x?: string | number | Date;
|
|
128
|
-
/** Y value */
|
|
129
|
-
y?: number;
|
|
130
|
-
/** Category name (for pie/donut) */
|
|
131
|
-
name?: string;
|
|
132
|
-
/** Value (for pie/donut) */
|
|
133
|
-
value?: number;
|
|
134
|
-
/** Additional properties */
|
|
135
|
-
[key: string]: unknown;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Dashboard Configuration
|
|
139
|
-
*/
|
|
140
|
-
export interface DashboardConfig {
|
|
141
|
-
/** Dashboard ID */
|
|
142
|
-
id: string;
|
|
143
|
-
/** Dashboard title */
|
|
144
|
-
title: string;
|
|
145
|
-
/** Layout grid columns */
|
|
146
|
-
columns?: number;
|
|
147
|
-
/** Widgets */
|
|
148
|
-
widgets: WidgetConfig[];
|
|
149
|
-
/** Refresh interval (seconds) */
|
|
150
|
-
refreshInterval?: number;
|
|
151
|
-
/** Theme */
|
|
152
|
-
theme?: 'light' | 'dark';
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Widget Configuration
|
|
156
|
-
*/
|
|
157
|
-
export interface WidgetConfig {
|
|
158
|
-
/** Widget ID */
|
|
159
|
-
id: string;
|
|
160
|
-
/** Widget type */
|
|
161
|
-
type: 'chart' | 'metric' | 'table' | 'text' | 'image';
|
|
162
|
-
/** Widget title */
|
|
163
|
-
title?: string;
|
|
164
|
-
/** Grid position */
|
|
165
|
-
position: GridPosition;
|
|
166
|
-
/** Widget data source */
|
|
167
|
-
dataSource?: DataSource;
|
|
168
|
-
/** Widget-specific config */
|
|
169
|
-
config?: ChartConfig | MetricConfig | TableConfig;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Grid Position
|
|
173
|
-
*/
|
|
174
|
-
export interface GridPosition {
|
|
175
|
-
/** Column start (1-based) */
|
|
176
|
-
x: number;
|
|
177
|
-
/** Row start (1-based) */
|
|
178
|
-
y: number;
|
|
179
|
-
/** Width in columns */
|
|
180
|
-
w: number;
|
|
181
|
-
/** Height in rows */
|
|
182
|
-
h: number;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Metric Configuration
|
|
186
|
-
*/
|
|
187
|
-
export interface MetricConfig {
|
|
188
|
-
/** Metric value format */
|
|
189
|
-
format?: 'number' | 'currency' | 'percentage' | 'duration';
|
|
190
|
-
/** Decimal places */
|
|
191
|
-
decimals?: number;
|
|
192
|
-
/** Prefix */
|
|
193
|
-
prefix?: string;
|
|
194
|
-
/** Suffix */
|
|
195
|
-
suffix?: string;
|
|
196
|
-
/** Comparison to previous period */
|
|
197
|
-
comparison?: boolean;
|
|
198
|
-
/** Trend indicator */
|
|
199
|
-
trend?: 'up' | 'down' | 'neutral';
|
|
200
|
-
/** Color by trend */
|
|
201
|
-
colorByTrend?: boolean;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Table Configuration
|
|
205
|
-
*/
|
|
206
|
-
export interface TableConfig {
|
|
207
|
-
/** Columns */
|
|
208
|
-
columns: TableColumn[];
|
|
209
|
-
/** Enable pagination */
|
|
210
|
-
pagination?: boolean;
|
|
211
|
-
/** Page size */
|
|
212
|
-
pageSize?: number;
|
|
213
|
-
/** Enable sorting */
|
|
214
|
-
sortable?: boolean;
|
|
215
|
-
/** Enable filtering */
|
|
216
|
-
filterable?: boolean;
|
|
217
|
-
/** Enable search */
|
|
218
|
-
searchable?: boolean;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Table Column
|
|
222
|
-
*/
|
|
223
|
-
export interface TableColumn {
|
|
224
|
-
/** Column ID */
|
|
225
|
-
id: string;
|
|
226
|
-
/** Column header */
|
|
227
|
-
header: string;
|
|
228
|
-
/** Column type */
|
|
229
|
-
type?: 'text' | 'number' | 'date' | 'currency' | 'percentage' | 'badge';
|
|
230
|
-
/** Column width */
|
|
231
|
-
width?: number | string;
|
|
232
|
-
/** Align */
|
|
233
|
-
align?: 'left' | 'center' | 'right';
|
|
234
|
-
/** Format string */
|
|
235
|
-
format?: string;
|
|
236
|
-
/** Sortable */
|
|
237
|
-
sortable?: boolean;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Data Source
|
|
241
|
-
*/
|
|
242
|
-
export interface DataSource {
|
|
243
|
-
/** Source type */
|
|
244
|
-
type: 'static' | 'api' | 'websocket' | 'query';
|
|
245
|
-
/** Source configuration */
|
|
246
|
-
config: Record<string, unknown>;
|
|
247
|
-
/** Data transform pipeline */
|
|
248
|
-
transforms?: DataTransform[];
|
|
249
|
-
/** Polling interval (seconds) */
|
|
250
|
-
pollingInterval?: number;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Data Transform
|
|
254
|
-
*/
|
|
255
|
-
export interface DataTransform {
|
|
256
|
-
/** Transform type */
|
|
257
|
-
type: 'filter' | 'map' | 'reduce' | 'aggregate' | 'sort' | 'limit';
|
|
258
|
-
/** Transform configuration */
|
|
259
|
-
config: Record<string, unknown>;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Chart Renderer
|
|
263
|
-
*/
|
|
264
|
-
export interface ChartRenderer {
|
|
265
|
-
/** Render chart to SVG */
|
|
266
|
-
renderSVG(config: ChartConfig, series: DataSeries[]): string;
|
|
267
|
-
/** Render chart to Canvas */
|
|
268
|
-
renderCanvas(config: ChartConfig, series: DataSeries[]): HTMLCanvasElement;
|
|
269
|
-
/** Get chart metadata */
|
|
270
|
-
getMetadata(type: ChartType): ChartMetadata;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Chart Metadata
|
|
274
|
-
*/
|
|
275
|
-
export interface ChartMetadata {
|
|
276
|
-
/** Chart type */
|
|
277
|
-
type: ChartType;
|
|
278
|
-
/** Display name */
|
|
279
|
-
name: string;
|
|
280
|
-
/** Description */
|
|
281
|
-
description: string;
|
|
282
|
-
/** Supported axes */
|
|
283
|
-
axes: ('x' | 'y' | 'z')[];
|
|
284
|
-
/** Required data structure */
|
|
285
|
-
dataStructure: string;
|
|
286
|
-
/** Use cases */
|
|
287
|
-
useCases: string[];
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Export Options
|
|
291
|
-
*/
|
|
292
|
-
export interface ExportOptions {
|
|
293
|
-
/** Export format */
|
|
294
|
-
format: 'png' | 'svg' | 'pdf' | 'csv' | 'json';
|
|
295
|
-
/** Export filename */
|
|
296
|
-
filename?: string;
|
|
297
|
-
/** Export dimensions */
|
|
298
|
-
width?: number;
|
|
299
|
-
height?: number;
|
|
300
|
-
/** Background color */
|
|
301
|
-
backgroundColor?: string;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Visualization Event
|
|
305
|
-
*/
|
|
306
|
-
export interface VizEvent {
|
|
307
|
-
/** Event type */
|
|
308
|
-
type: 'click' | 'hover' | 'select' | 'zoom' | 'pan';
|
|
309
|
-
/** Target element */
|
|
310
|
-
target: string;
|
|
311
|
-
/** Event data */
|
|
312
|
-
data: Record<string, unknown>;
|
|
313
|
-
/** Timestamp */
|
|
314
|
-
timestamp: number;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Chart Palette
|
|
318
|
-
*/
|
|
319
|
-
export interface ChartPalette {
|
|
320
|
-
/** Primary colors */
|
|
321
|
-
primary: string[];
|
|
322
|
-
/** Secondary colors */
|
|
323
|
-
secondary: string[];
|
|
324
|
-
/** Semantic colors */
|
|
325
|
-
semantic: {
|
|
326
|
-
success: string;
|
|
327
|
-
warning: string;
|
|
328
|
-
error: string;
|
|
329
|
-
info: string;
|
|
330
|
-
};
|
|
331
|
-
/** Background colors */
|
|
332
|
-
background: string[];
|
|
333
|
-
/** Text colors */
|
|
334
|
-
text: {
|
|
335
|
-
primary: string;
|
|
336
|
-
secondary: string;
|
|
337
|
-
muted: string;
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
/** Predefined palettes */
|
|
341
|
-
export declare const palettes: Record<string, ChartPalette>;
|
|
342
|
-
//# sourceMappingURL=types.d.ts.map
|