@keneth80/k-chart 1.9.0 → 1.10.0
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/CHANGELOG.md +22 -0
- package/README.md +204 -1
- package/docs/assets/kchart-hero.svg +110 -0
- package/docs/assets/kchart-icon.svg +40 -0
- package/docs/configuration-reference.md +395 -0
- package/docs/functional-api.md +103 -3
- package/examples/stackblitz-candlestick-basic/index.html +23 -0
- package/examples/stackblitz-candlestick-basic/package-lock.json +1435 -0
- package/examples/stackblitz-candlestick-basic/package.json +18 -0
- package/examples/stackblitz-candlestick-basic/src/main.ts +107 -0
- package/examples/stackblitz-candlestick-basic/src/style.css +16 -0
- package/examples/stackblitz-canvas-line-basic/index.html +23 -0
- package/examples/stackblitz-canvas-line-basic/package-lock.json +1435 -0
- package/examples/stackblitz-canvas-line-basic/package.json +18 -0
- package/examples/stackblitz-canvas-line-basic/src/main.ts +73 -0
- package/examples/stackblitz-canvas-line-basic/src/style.css +46 -0
- package/examples/stackblitz-column-basic/index.html +23 -0
- package/examples/stackblitz-column-basic/package-lock.json +1435 -0
- package/examples/stackblitz-column-basic/package.json +18 -0
- package/examples/stackblitz-column-basic/src/main.ts +128 -0
- package/examples/stackblitz-column-basic/src/style.css +41 -0
- package/examples/stackblitz-doughnut-basic/index.html +21 -0
- package/examples/stackblitz-doughnut-basic/package-lock.json +1435 -0
- package/examples/stackblitz-doughnut-basic/package.json +18 -0
- package/examples/stackblitz-doughnut-basic/src/main.ts +177 -0
- package/examples/stackblitz-doughnut-basic/src/style.css +43 -0
- package/examples/stackblitz-line-basic/index.html +23 -0
- package/examples/stackblitz-line-basic/package-lock.json +1435 -0
- package/examples/stackblitz-line-basic/package.json +18 -0
- package/examples/stackblitz-line-basic/src/main.ts +112 -0
- package/examples/stackblitz-line-basic/src/style.css +108 -0
- package/examples/stackblitz-multi-series-basic/index.html +1 -0
- package/examples/stackblitz-multi-series-basic/package-lock.json +1435 -0
- package/examples/stackblitz-multi-series-basic/package.json +9 -0
- package/examples/stackblitz-multi-series-basic/src/main.ts +29 -0
- package/examples/stackblitz-multi-series-basic/src/style.css +1 -0
- package/examples/stackblitz-options-basic/index.html +1 -0
- package/examples/stackblitz-options-basic/package-lock.json +1435 -0
- package/examples/stackblitz-options-basic/package.json +9 -0
- package/examples/stackblitz-options-basic/src/main.ts +32 -0
- package/examples/stackblitz-options-basic/src/style.css +1 -0
- package/examples/stackblitz-pie-basic/index.html +21 -0
- package/examples/stackblitz-pie-basic/package-lock.json +1435 -0
- package/examples/stackblitz-pie-basic/package.json +18 -0
- package/examples/stackblitz-pie-basic/src/main.ts +156 -0
- package/examples/stackblitz-pie-basic/src/style.css +43 -0
- package/examples/stackblitz-plot-basic/index.html +1 -0
- package/examples/stackblitz-plot-basic/package-lock.json +1435 -0
- package/examples/stackblitz-plot-basic/package.json +9 -0
- package/examples/stackblitz-plot-basic/src/main.ts +32 -0
- package/examples/stackblitz-plot-basic/src/style.css +1 -0
- package/examples/stackblitz-radial-basic/index.html +21 -0
- package/examples/stackblitz-radial-basic/package-lock.json +1435 -0
- package/examples/stackblitz-radial-basic/package.json +18 -0
- package/examples/stackblitz-radial-basic/src/main.ts +223 -0
- package/examples/stackblitz-radial-basic/src/style.css +87 -0
- package/examples/stackblitz-simple-api-basic/index.html +30 -0
- package/examples/stackblitz-simple-api-basic/package-lock.json +1435 -0
- package/examples/stackblitz-simple-api-basic/package.json +18 -0
- package/examples/stackblitz-simple-api-basic/src/main.ts +69 -0
- package/examples/stackblitz-simple-api-basic/src/style.css +127 -0
- package/examples/stackblitz-stacked-column-basic/index.html +23 -0
- package/examples/stackblitz-stacked-column-basic/package-lock.json +1435 -0
- package/examples/stackblitz-stacked-column-basic/package.json +18 -0
- package/examples/stackblitz-stacked-column-basic/src/main.ts +136 -0
- package/examples/stackblitz-stacked-column-basic/src/style.css +16 -0
- package/examples/stackblitz-three-wafer-basic/index.html +1 -0
- package/examples/stackblitz-three-wafer-basic/package-lock.json +1453 -0
- package/examples/stackblitz-three-wafer-basic/package.json +9 -0
- package/examples/stackblitz-three-wafer-basic/src/main.ts +29 -0
- package/examples/stackblitz-three-wafer-basic/src/style.css +1 -0
- package/examples/stackblitz-topology-basic/index.html +1 -0
- package/examples/stackblitz-topology-basic/package-lock.json +1435 -0
- package/examples/stackblitz-topology-basic/package.json +9 -0
- package/examples/stackblitz-topology-basic/src/main.ts +89 -0
- package/examples/stackblitz-topology-basic/src/style.css +1 -0
- package/examples/stackblitz-webgl-line-basic/index.html +23 -0
- package/examples/stackblitz-webgl-line-basic/package-lock.json +1435 -0
- package/examples/stackblitz-webgl-line-basic/package.json +18 -0
- package/examples/stackblitz-webgl-line-basic/src/main.ts +86 -0
- package/examples/stackblitz-webgl-line-basic/src/style.css +46 -0
- package/examples/stackblitz-worker-json-line/index.html +41 -0
- package/examples/stackblitz-worker-json-line/package-lock.json +1435 -0
- package/examples/stackblitz-worker-json-line/package.json +19 -0
- package/examples/stackblitz-worker-json-line/public/data/large-line.json +4322 -0
- package/examples/stackblitz-worker-json-line/src/kchart-render.worker.ts +4 -0
- package/examples/stackblitz-worker-json-line/src/main.ts +185 -0
- package/examples/stackblitz-worker-json-line/src/style.css +101 -0
- package/lib/core/contracts.d.ts +22 -0
- package/lib/core/contracts.d.ts.map +1 -1
- package/lib/core/create-kchart.d.ts.map +1 -1
- package/lib/core/create-kchart.js +93 -4
- package/lib/core/create-kchart.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/kchart.d.ts +1 -0
- package/lib/kchart.d.ts.map +1 -1
- package/lib/kchart.js +1 -0
- package/lib/kchart.js.map +1 -1
- package/lib/presets/index.d.ts +97 -0
- package/lib/presets/index.d.ts.map +1 -0
- package/lib/presets/index.js +481 -0
- package/lib/presets/index.js.map +1 -0
- package/lib/series/canvas-line.d.ts.map +1 -1
- package/lib/series/canvas-line.js +16 -11
- package/lib/series/canvas-line.js.map +1 -1
- package/lib/series/svg-line.d.ts.map +1 -1
- package/lib/series/svg-line.js +19 -3
- package/lib/series/svg-line.js.map +1 -1
- package/lib/series/webgl-line.d.ts.map +1 -1
- package/lib/series/webgl-line.js +10 -3
- package/lib/series/webgl-line.js.map +1 -1
- package/package.json +13 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kchart-stackblitz-radial-basic",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite --host 0.0.0.0",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"preview": "vite preview --host 0.0.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@keneth80/k-chart": "^1.9.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^6.0.3",
|
|
16
|
+
"vite": "^7.2.7"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createCustomSeries, createKChart, type KChartSeries } from '@keneth80/k-chart';
|
|
2
|
+
import './style.css';
|
|
3
|
+
|
|
4
|
+
interface CapabilityPoint {
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
volume: number;
|
|
8
|
+
extra: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const data: CapabilityPoint[] = [
|
|
12
|
+
{ label: 'Reliability', value: 62, volume: 55, extra: 48 },
|
|
13
|
+
{ label: 'Latency', value: 48, volume: 62, extra: 36 },
|
|
14
|
+
{ label: 'Throughput', value: 68, volume: 42, extra: 58 },
|
|
15
|
+
{ label: 'Quality', value: 54, volume: 49, extra: 64 },
|
|
16
|
+
{ label: 'Cost', value: 46, volume: 58, extra: 42 },
|
|
17
|
+
{ label: 'Coverage', value: 59, volume: 37, extra: 55 }
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const createRadialMetricSeries = (
|
|
21
|
+
selector: string,
|
|
22
|
+
displayName: string,
|
|
23
|
+
yField: 'value' | 'volume' | 'extra',
|
|
24
|
+
color: string,
|
|
25
|
+
drawFrame = false
|
|
26
|
+
): KChartSeries<CapabilityPoint> => {
|
|
27
|
+
const maxValue = 72;
|
|
28
|
+
const pointRadius = 4;
|
|
29
|
+
|
|
30
|
+
const polarPoint = (
|
|
31
|
+
index: number,
|
|
32
|
+
count: number,
|
|
33
|
+
value: number,
|
|
34
|
+
centerX: number,
|
|
35
|
+
centerY: number,
|
|
36
|
+
radius: number
|
|
37
|
+
): [number, number] => {
|
|
38
|
+
const angle = (Math.PI * 2 * index) / Math.max(count, 1) - Math.PI / 2;
|
|
39
|
+
const distance = radius * Math.max(0, Math.min(value / maxValue, 1));
|
|
40
|
+
return [
|
|
41
|
+
centerX + Math.cos(angle) * distance,
|
|
42
|
+
centerY + Math.sin(angle) * distance
|
|
43
|
+
];
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const labelPoint = (
|
|
47
|
+
index: number,
|
|
48
|
+
count: number,
|
|
49
|
+
centerX: number,
|
|
50
|
+
centerY: number,
|
|
51
|
+
radius: number
|
|
52
|
+
): [number, number] => {
|
|
53
|
+
const angle = (Math.PI * 2 * index) / Math.max(count, 1) - Math.PI / 2;
|
|
54
|
+
return [
|
|
55
|
+
centerX + Math.cos(angle) * (radius + 26),
|
|
56
|
+
centerY + Math.sin(angle) * (radius + 26)
|
|
57
|
+
];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return createCustomSeries<CapabilityPoint>({
|
|
61
|
+
selector,
|
|
62
|
+
displayName,
|
|
63
|
+
xField: 'label',
|
|
64
|
+
yField,
|
|
65
|
+
color,
|
|
66
|
+
render({ group, data: points, plotSize }) {
|
|
67
|
+
const centerX = plotSize.width / 2;
|
|
68
|
+
const centerY = plotSize.height / 2 + 12;
|
|
69
|
+
const radius = Math.max(96, Math.min(plotSize.width, plotSize.height) * 0.34);
|
|
70
|
+
|
|
71
|
+
if (drawFrame) {
|
|
72
|
+
group.selectAll<SVGCircleElement, number>('circle.radial-ring')
|
|
73
|
+
.data([0.2, 0.4, 0.6, 0.8, 1])
|
|
74
|
+
.join('circle')
|
|
75
|
+
.attr('class', 'radial-ring')
|
|
76
|
+
.attr('cx', centerX)
|
|
77
|
+
.attr('cy', centerY)
|
|
78
|
+
.attr('r', (value) => radius * value)
|
|
79
|
+
.style('fill', 'none')
|
|
80
|
+
.style('stroke', 'rgba(203, 213, 225, 0.18)')
|
|
81
|
+
.style('stroke-dasharray', '2 6');
|
|
82
|
+
|
|
83
|
+
group.selectAll<SVGLineElement, CapabilityPoint>('line.radial-spoke')
|
|
84
|
+
.data(points)
|
|
85
|
+
.join('line')
|
|
86
|
+
.attr('class', 'radial-spoke')
|
|
87
|
+
.attr('x1', centerX)
|
|
88
|
+
.attr('y1', centerY)
|
|
89
|
+
.attr('x2', (_point, index) => labelPoint(index, points.length, centerX, centerY, radius - 4)[0])
|
|
90
|
+
.attr('y2', (_point, index) => labelPoint(index, points.length, centerX, centerY, radius - 4)[1])
|
|
91
|
+
.style('stroke', 'rgba(203, 213, 225, 0.14)');
|
|
92
|
+
|
|
93
|
+
group.selectAll<SVGTextElement, CapabilityPoint>('text.radial-label')
|
|
94
|
+
.data(points)
|
|
95
|
+
.join('text')
|
|
96
|
+
.attr('class', 'radial-label')
|
|
97
|
+
.attr('x', (_point, index) => labelPoint(index, points.length, centerX, centerY, radius)[0])
|
|
98
|
+
.attr('y', (_point, index) => labelPoint(index, points.length, centerX, centerY, radius)[1])
|
|
99
|
+
.attr('text-anchor', 'middle')
|
|
100
|
+
.attr('dominant-baseline', 'middle')
|
|
101
|
+
.style('fill', 'rgba(226, 232, 240, 0.86)')
|
|
102
|
+
.style('font-size', '12px')
|
|
103
|
+
.style('font-weight', 700)
|
|
104
|
+
.text((point) => point.label);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const path = points
|
|
108
|
+
.map((point, index) => {
|
|
109
|
+
const [x, y] = polarPoint(index, points.length, Number(point[yField]), centerX, centerY, radius);
|
|
110
|
+
return `${index === 0 ? 'M' : 'L'}${x},${y}`;
|
|
111
|
+
})
|
|
112
|
+
.join(' ');
|
|
113
|
+
|
|
114
|
+
group.selectAll<SVGPathElement, CapabilityPoint[]>('path.radial-area')
|
|
115
|
+
.data([points])
|
|
116
|
+
.join('path')
|
|
117
|
+
.attr('class', `radial-area ${selector}`)
|
|
118
|
+
.attr('d', `${path} Z`)
|
|
119
|
+
.style('fill', color)
|
|
120
|
+
.style('fill-opacity', 0.16)
|
|
121
|
+
.style('stroke', color)
|
|
122
|
+
.style('stroke-width', 2.6)
|
|
123
|
+
.style('filter', 'drop-shadow(0 0 10px rgba(125, 211, 252, 0.14))');
|
|
124
|
+
|
|
125
|
+
group.selectAll<SVGCircleElement, CapabilityPoint>('circle.radial-point')
|
|
126
|
+
.data(points)
|
|
127
|
+
.join('circle')
|
|
128
|
+
.attr('class', `radial-point ${selector}`)
|
|
129
|
+
.attr('cx', (point, index) => polarPoint(index, points.length, Number(point[yField]), centerX, centerY, radius)[0])
|
|
130
|
+
.attr('cy', (point, index) => polarPoint(index, points.length, Number(point[yField]), centerX, centerY, radius)[1])
|
|
131
|
+
.attr('r', pointRadius)
|
|
132
|
+
.style('fill', color)
|
|
133
|
+
.style('stroke', '#f8fafc')
|
|
134
|
+
.style('stroke-width', 1.2);
|
|
135
|
+
},
|
|
136
|
+
tooltip({ data: points, plotSize, seriesGroup, mouseX, mouseY }) {
|
|
137
|
+
const centerX = plotSize.width / 2;
|
|
138
|
+
const centerY = plotSize.height / 2 + 12;
|
|
139
|
+
const radius = Math.max(96, Math.min(plotSize.width, plotSize.height) * 0.34);
|
|
140
|
+
|
|
141
|
+
seriesGroup.selectAll<SVGCircleElement, CapabilityPoint>(`circle.${selector}`)
|
|
142
|
+
.attr('r', pointRadius)
|
|
143
|
+
.style('stroke-width', 1.2);
|
|
144
|
+
|
|
145
|
+
let closest: { point: CapabilityPoint; x: number; y: number; distance: number } | undefined;
|
|
146
|
+
points.forEach((point, index) => {
|
|
147
|
+
const [x, y] = polarPoint(index, points.length, Number(point[yField]), centerX, centerY, radius);
|
|
148
|
+
const distance = Math.hypot(mouseX - x, mouseY - y);
|
|
149
|
+
if (!closest || distance < closest.distance) {
|
|
150
|
+
closest = { point, x, y, distance };
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
if (!closest || closest.distance > 18) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
seriesGroup.selectAll<SVGCircleElement, CapabilityPoint>(`circle.${selector}`)
|
|
159
|
+
.filter((point) => point === closest?.point)
|
|
160
|
+
.attr('r', 6)
|
|
161
|
+
.style('stroke-width', 2);
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
data: closest.point,
|
|
165
|
+
x: closest.x,
|
|
166
|
+
y: closest.y,
|
|
167
|
+
distance: closest.distance,
|
|
168
|
+
color,
|
|
169
|
+
html: `<strong style="color:${color}">${displayName}</strong><br/>${closest.point.label}: ${Number(closest.point[yField]).toFixed(1)}`
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
clearTooltip({ seriesGroup }) {
|
|
173
|
+
seriesGroup.selectAll<SVGCircleElement, CapabilityPoint>(`circle.${selector}`)
|
|
174
|
+
.attr('r', pointRadius)
|
|
175
|
+
.style('stroke-width', 1.2);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const chart = createKChart<CapabilityPoint>({
|
|
181
|
+
selector: '#chart',
|
|
182
|
+
data,
|
|
183
|
+
width: 920,
|
|
184
|
+
height: 500,
|
|
185
|
+
margin: { top: 88, right: 36, bottom: 42, left: 36 },
|
|
186
|
+
colors: ['#5db8ff', '#56d08f', '#f3b45b'],
|
|
187
|
+
title: {
|
|
188
|
+
text: 'Radial Capability Comparison',
|
|
189
|
+
align: 'left',
|
|
190
|
+
fontSize: 18
|
|
191
|
+
},
|
|
192
|
+
grid: {
|
|
193
|
+
visible: false
|
|
194
|
+
},
|
|
195
|
+
legend: {
|
|
196
|
+
visible: true,
|
|
197
|
+
placement: 'top',
|
|
198
|
+
selectable: true
|
|
199
|
+
},
|
|
200
|
+
tooltip: {
|
|
201
|
+
visible: true
|
|
202
|
+
},
|
|
203
|
+
axes: [],
|
|
204
|
+
series: [
|
|
205
|
+
createRadialMetricSeries('radial-current', 'Current', 'value', '#5db8ff', true),
|
|
206
|
+
createRadialMetricSeries('radial-target', 'Target', 'volume', '#56d08f'),
|
|
207
|
+
createRadialMetricSeries('radial-risk', 'Risk', 'extra', '#f3b45b')
|
|
208
|
+
]
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
chart.render();
|
|
212
|
+
|
|
213
|
+
window.addEventListener('resize', () => {
|
|
214
|
+
const panel = document.querySelector<HTMLElement>('.chart-panel');
|
|
215
|
+
if (!panel) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
chart.resize({
|
|
220
|
+
width: Math.max(panel.clientWidth - 48, 320),
|
|
221
|
+
height: 500
|
|
222
|
+
});
|
|
223
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: dark;
|
|
3
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
4
|
+
background: #0b1120;
|
|
5
|
+
color: #e5edf7;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
* {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
min-width: 320px;
|
|
15
|
+
min-height: 100vh;
|
|
16
|
+
background:
|
|
17
|
+
radial-gradient(circle at 20% 10%, rgba(93, 184, 255, 0.18), transparent 32rem),
|
|
18
|
+
radial-gradient(circle at 80% 0%, rgba(86, 208, 143, 0.12), transparent 28rem),
|
|
19
|
+
#0b1120;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.page-shell {
|
|
23
|
+
width: min(1120px, calc(100vw - 32px));
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
padding: 40px 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.intro {
|
|
29
|
+
margin-bottom: 18px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.eyebrow {
|
|
33
|
+
margin: 0 0 8px;
|
|
34
|
+
color: #7dd3fc;
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
font-weight: 700;
|
|
37
|
+
letter-spacing: 0.08em;
|
|
38
|
+
text-transform: uppercase;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
h1 {
|
|
42
|
+
margin: 0;
|
|
43
|
+
font-size: clamp(28px, 5vw, 52px);
|
|
44
|
+
line-height: 1.05;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.intro p:last-child {
|
|
48
|
+
margin: 12px 0 0;
|
|
49
|
+
color: #b8c5d6;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.chart-panel {
|
|
53
|
+
min-height: 560px;
|
|
54
|
+
padding: 24px;
|
|
55
|
+
border: 1px solid rgba(148, 163, 184, 0.24);
|
|
56
|
+
border-radius: 12px;
|
|
57
|
+
background: linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.82));
|
|
58
|
+
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#chart {
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 500px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#chart .kchart-svg text {
|
|
67
|
+
font-family: inherit;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#chart .kchart-title {
|
|
71
|
+
fill: #f8fafc;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#chart .kchart-legend text {
|
|
75
|
+
fill: #dbeafe;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (max-width: 720px) {
|
|
79
|
+
.page-shell {
|
|
80
|
+
width: min(100vw - 20px, 1120px);
|
|
81
|
+
padding: 24px 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.chart-panel {
|
|
85
|
+
padding: 12px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>KChart Simple API</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<main class="page-shell">
|
|
10
|
+
<section class="intro">
|
|
11
|
+
<p class="eyebrow">StackBlitz starter</p>
|
|
12
|
+
<h1>KChart Simple API</h1>
|
|
13
|
+
<p>Start with <code>createLineChart</code>, then switch to <code>chartConfig(...)</code> when you need composition.</p>
|
|
14
|
+
</section>
|
|
15
|
+
|
|
16
|
+
<section class="chart-grid">
|
|
17
|
+
<article class="chart-panel">
|
|
18
|
+
<h2>Preset function</h2>
|
|
19
|
+
<div id="line-chart"></div>
|
|
20
|
+
</article>
|
|
21
|
+
<article class="chart-panel">
|
|
22
|
+
<h2>Builder function</h2>
|
|
23
|
+
<div id="column-chart"></div>
|
|
24
|
+
</article>
|
|
25
|
+
</section>
|
|
26
|
+
</main>
|
|
27
|
+
|
|
28
|
+
<script type="module" src="/src/main.ts"></script>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|