@keneth80/k-chart 1.18.1 → 1.20.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 +33 -0
- package/README.md +30 -3
- package/ai/catalog.json +2291 -0
- package/ai/chart-plan.schema.json +372 -0
- package/ai/examples/intent-to-config.jsonl +32 -0
- package/ai/prompts/dashboard-system.md +42 -0
- package/docs/ai/agent-usage.md +79 -0
- package/docs/ai/chart-selection.md +65 -0
- package/docs/ai/index.md +195 -0
- package/docs/configuration-reference.md +34 -4
- package/docs/functional-api.md +27 -2
- package/examples/stackblitz-realtime-line-basic/src/main.ts +6 -0
- package/lib/ai/catalog.d.ts +4 -0
- package/lib/ai/catalog.d.ts.map +1 -0
- package/lib/ai/catalog.js +676 -0
- package/lib/ai/catalog.js.map +1 -0
- package/lib/ai/compiler.d.ts +63 -0
- package/lib/ai/compiler.d.ts.map +1 -0
- package/lib/ai/compiler.js +950 -0
- package/lib/ai/compiler.js.map +1 -0
- package/lib/ai/contracts.d.ts +117 -0
- package/lib/ai/contracts.d.ts.map +1 -0
- package/lib/ai/contracts.js +3 -0
- package/lib/ai/contracts.js.map +1 -0
- package/lib/ai/index.d.ts +6 -0
- package/lib/ai/index.d.ts.map +1 -0
- package/lib/ai/index.js +22 -0
- package/lib/ai/index.js.map +1 -0
- package/lib/ai/schema.d.ts +272 -0
- package/lib/ai/schema.d.ts.map +1 -0
- package/lib/ai/schema.js +199 -0
- package/lib/ai/schema.js.map +1 -0
- package/lib/ai/validate-plan.d.ts +5 -0
- package/lib/ai/validate-plan.d.ts.map +1 -0
- package/lib/ai/validate-plan.js +877 -0
- package/lib/ai/validate-plan.js.map +1 -0
- package/lib/core/animation.d.ts +8 -0
- package/lib/core/animation.d.ts.map +1 -0
- package/lib/core/animation.js +66 -0
- package/lib/core/animation.js.map +1 -0
- package/lib/core/contracts.d.ts +2 -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 +82 -10
- package/lib/core/create-kchart.js.map +1 -1
- package/lib/series/canvas-line.d.ts.map +1 -1
- package/lib/series/canvas-line.js +68 -64
- 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 +1 -0
- 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 +75 -71
- package/lib/series/webgl-line.js.map +1 -1
- package/lib/worker/render-worker.d.ts.map +1 -1
- package/lib/worker/render-worker.js +18 -6
- package/lib/worker/render-worker.js.map +1 -1
- package/llms.txt +37 -0
- package/package.json +19 -4
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/keneth80/k-chart/blob/main/ai/chart-plan.schema.json",
|
|
4
|
+
"title": "KChart AI ChartPlan",
|
|
5
|
+
"description": "Provider-neutral declarative plan compiled into a KChart configuration.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"$defs": {
|
|
9
|
+
"jsonValue": {
|
|
10
|
+
"anyOf": [
|
|
11
|
+
{
|
|
12
|
+
"type": [
|
|
13
|
+
"string",
|
|
14
|
+
"number",
|
|
15
|
+
"boolean",
|
|
16
|
+
"null"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"$ref": "#/$defs/jsonValue"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"$ref": "#/$defs/settings"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"settings": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"propertyNames": {
|
|
33
|
+
"not": {
|
|
34
|
+
"enum": [
|
|
35
|
+
"__proto__",
|
|
36
|
+
"prototype",
|
|
37
|
+
"constructor"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"additionalProperties": {
|
|
42
|
+
"$ref": "#/$defs/jsonValue"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"version",
|
|
48
|
+
"intent",
|
|
49
|
+
"data"
|
|
50
|
+
],
|
|
51
|
+
"anyOf": [
|
|
52
|
+
{
|
|
53
|
+
"required": [
|
|
54
|
+
"series"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"required": [
|
|
59
|
+
"adapters"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"properties": {
|
|
64
|
+
"version": {
|
|
65
|
+
"const": 1
|
|
66
|
+
},
|
|
67
|
+
"intent": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"minLength": 1
|
|
70
|
+
},
|
|
71
|
+
"title": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"data": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"required": [
|
|
78
|
+
"shape",
|
|
79
|
+
"fields"
|
|
80
|
+
],
|
|
81
|
+
"properties": {
|
|
82
|
+
"shape": {
|
|
83
|
+
"const": "records"
|
|
84
|
+
},
|
|
85
|
+
"rowCount": {
|
|
86
|
+
"type": "integer",
|
|
87
|
+
"minimum": 0
|
|
88
|
+
},
|
|
89
|
+
"fields": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"items": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"additionalProperties": false,
|
|
94
|
+
"required": [
|
|
95
|
+
"name",
|
|
96
|
+
"type"
|
|
97
|
+
],
|
|
98
|
+
"properties": {
|
|
99
|
+
"name": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1
|
|
102
|
+
},
|
|
103
|
+
"type": {
|
|
104
|
+
"enum": [
|
|
105
|
+
"number",
|
|
106
|
+
"number-array",
|
|
107
|
+
"time",
|
|
108
|
+
"string",
|
|
109
|
+
"boolean",
|
|
110
|
+
"latitude",
|
|
111
|
+
"longitude",
|
|
112
|
+
"geojson",
|
|
113
|
+
"url"
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"nullable": {
|
|
117
|
+
"type": "boolean"
|
|
118
|
+
},
|
|
119
|
+
"sampleValues": {
|
|
120
|
+
"type": "array",
|
|
121
|
+
"maxItems": 8,
|
|
122
|
+
"items": {
|
|
123
|
+
"anyOf": [
|
|
124
|
+
{
|
|
125
|
+
"type": [
|
|
126
|
+
"string",
|
|
127
|
+
"number",
|
|
128
|
+
"boolean",
|
|
129
|
+
"null"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "array",
|
|
134
|
+
"items": {
|
|
135
|
+
"type": "number"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"axes": {
|
|
147
|
+
"type": "array",
|
|
148
|
+
"items": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"additionalProperties": false,
|
|
151
|
+
"required": [
|
|
152
|
+
"field",
|
|
153
|
+
"type",
|
|
154
|
+
"placement"
|
|
155
|
+
],
|
|
156
|
+
"properties": {
|
|
157
|
+
"field": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"minLength": 1
|
|
160
|
+
},
|
|
161
|
+
"type": {
|
|
162
|
+
"enum": [
|
|
163
|
+
"number",
|
|
164
|
+
"time",
|
|
165
|
+
"string",
|
|
166
|
+
"point"
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
"placement": {
|
|
170
|
+
"enum": [
|
|
171
|
+
"top",
|
|
172
|
+
"right",
|
|
173
|
+
"bottom",
|
|
174
|
+
"left"
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
"title": {
|
|
178
|
+
"type": "string"
|
|
179
|
+
},
|
|
180
|
+
"min": {
|
|
181
|
+
"type": [
|
|
182
|
+
"number",
|
|
183
|
+
"string"
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"max": {
|
|
187
|
+
"type": [
|
|
188
|
+
"number",
|
|
189
|
+
"string"
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"tickCount": {
|
|
193
|
+
"type": "integer",
|
|
194
|
+
"minimum": 1
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"series": {
|
|
200
|
+
"type": "array",
|
|
201
|
+
"minItems": 1,
|
|
202
|
+
"items": {
|
|
203
|
+
"type": "object",
|
|
204
|
+
"additionalProperties": false,
|
|
205
|
+
"required": [
|
|
206
|
+
"capability",
|
|
207
|
+
"renderer",
|
|
208
|
+
"bindings"
|
|
209
|
+
],
|
|
210
|
+
"properties": {
|
|
211
|
+
"capability": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"minLength": 1
|
|
214
|
+
},
|
|
215
|
+
"renderer": {
|
|
216
|
+
"enum": [
|
|
217
|
+
"svg",
|
|
218
|
+
"canvas",
|
|
219
|
+
"webgl"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"displayName": {
|
|
223
|
+
"type": "string"
|
|
224
|
+
},
|
|
225
|
+
"bindings": {
|
|
226
|
+
"type": "array",
|
|
227
|
+
"items": {
|
|
228
|
+
"type": "object",
|
|
229
|
+
"additionalProperties": false,
|
|
230
|
+
"required": [
|
|
231
|
+
"role"
|
|
232
|
+
],
|
|
233
|
+
"properties": {
|
|
234
|
+
"role": {
|
|
235
|
+
"type": "string",
|
|
236
|
+
"minLength": 1
|
|
237
|
+
},
|
|
238
|
+
"field": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"minLength": 1
|
|
241
|
+
},
|
|
242
|
+
"fields": {
|
|
243
|
+
"type": "array",
|
|
244
|
+
"minItems": 1,
|
|
245
|
+
"items": {
|
|
246
|
+
"type": "string",
|
|
247
|
+
"minLength": 1
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"oneOf": [
|
|
252
|
+
{
|
|
253
|
+
"required": [
|
|
254
|
+
"field"
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"required": [
|
|
259
|
+
"fields"
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"settings": {
|
|
266
|
+
"$ref": "#/$defs/settings"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"adapters": {
|
|
272
|
+
"type": "array",
|
|
273
|
+
"minItems": 1,
|
|
274
|
+
"items": {
|
|
275
|
+
"type": "object",
|
|
276
|
+
"additionalProperties": false,
|
|
277
|
+
"required": [
|
|
278
|
+
"capability"
|
|
279
|
+
],
|
|
280
|
+
"properties": {
|
|
281
|
+
"capability": {
|
|
282
|
+
"type": "string",
|
|
283
|
+
"minLength": 1
|
|
284
|
+
},
|
|
285
|
+
"bindings": {
|
|
286
|
+
"type": "array",
|
|
287
|
+
"items": {
|
|
288
|
+
"type": "object",
|
|
289
|
+
"additionalProperties": false,
|
|
290
|
+
"required": [
|
|
291
|
+
"role"
|
|
292
|
+
],
|
|
293
|
+
"properties": {
|
|
294
|
+
"role": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"minLength": 1
|
|
297
|
+
},
|
|
298
|
+
"field": {
|
|
299
|
+
"type": "string",
|
|
300
|
+
"minLength": 1
|
|
301
|
+
},
|
|
302
|
+
"fields": {
|
|
303
|
+
"type": "array",
|
|
304
|
+
"minItems": 1,
|
|
305
|
+
"items": {
|
|
306
|
+
"type": "string",
|
|
307
|
+
"minLength": 1
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
"oneOf": [
|
|
312
|
+
{
|
|
313
|
+
"required": [
|
|
314
|
+
"field"
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"required": [
|
|
319
|
+
"fields"
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"settings": {
|
|
326
|
+
"$ref": "#/$defs/settings"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
"options": {
|
|
332
|
+
"type": "array",
|
|
333
|
+
"items": {
|
|
334
|
+
"type": "object",
|
|
335
|
+
"additionalProperties": false,
|
|
336
|
+
"required": [
|
|
337
|
+
"capability"
|
|
338
|
+
],
|
|
339
|
+
"properties": {
|
|
340
|
+
"capability": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"minLength": 1
|
|
343
|
+
},
|
|
344
|
+
"enabled": {
|
|
345
|
+
"type": "boolean"
|
|
346
|
+
},
|
|
347
|
+
"settings": {
|
|
348
|
+
"$ref": "#/$defs/settings"
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"theme": {
|
|
354
|
+
"enum": [
|
|
355
|
+
"dark",
|
|
356
|
+
"light"
|
|
357
|
+
]
|
|
358
|
+
},
|
|
359
|
+
"rationale": {
|
|
360
|
+
"type": "array",
|
|
361
|
+
"items": {
|
|
362
|
+
"type": "string"
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
"warnings": {
|
|
366
|
+
"type": "array",
|
|
367
|
+
"items": {
|
|
368
|
+
"type": "string"
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{"id":"trend-svg","prompt":"월별 매출 추이를 선으로 보여줘","expected":{"version":1,"intent":"monthly revenue trend","title":"월별 매출","data":{"shape":"records","fields":[{"name":"month","type":"time"},{"name":"revenue","type":"number"}],"rowCount":12},"axes":[{"field":"month","type":"time","placement":"bottom"},{"field":"revenue","type":"number","placement":"left"}],"series":[{"capability":"series.line.svg","renderer":"svg","bindings":[{"role":"x","field":"month"},{"role":"y","field":"revenue"}]}],"options":[{"capability":"option.tooltip"},{"capability":"option.grid"}],"theme":"dark","rationale":["작은 시계열이라 SVG가 적합합니다."]}}
|
|
2
|
+
{"id":"trend-webgl-million","prompt":"100만 건 센서 데이터를 빠르게 그려줘","expected":{"version":1,"intent":"million point sensor trend","data":{"shape":"records","fields":[{"name":"timestamp","type":"time"},{"name":"value","type":"number"}],"rowCount":1000000},"series":[{"capability":"series.line.webgl","renderer":"webgl","bindings":[{"role":"x","field":"timestamp"},{"role":"y","field":"value"}],"settings":{"downsample":true}}],"options":[{"capability":"option.downsample.lttb"},{"capability":"option.render-complete"}],"theme":"dark","rationale":["GPU 렌더링과 다운샘플링을 선택합니다."]}}
|
|
3
|
+
{"id":"trend-canvas-worker","prompt":"30만 건 라인을 워커에서 렌더링해줘","expected":{"version":1,"intent":"worker rendered canvas trend","data":{"shape":"records","fields":[{"name":"time","type":"time"},{"name":"signal","type":"number"}],"rowCount":300000},"series":[{"capability":"series.line.canvas","renderer":"canvas","bindings":[{"role":"x","field":"time"},{"role":"y","field":"signal"}],"settings":{"asyncRender":{"enabled":true}}}],"options":[{"capability":"option.render-complete"}],"rationale":["Canvas worker 경로를 사용합니다."]}}
|
|
4
|
+
{"id":"realtime-window","prompt":"최근 한 시간의 CPU를 자연스럽게 흐르는 실시간 차트로 보여줘","expected":{"version":1,"intent":"rolling one hour CPU telemetry","data":{"shape":"records","fields":[{"name":"timestamp","type":"time"},{"name":"cpu","type":"number"}],"rowCount":3600},"series":[{"capability":"recipe.realtime.rolling-window","renderer":"canvas","bindings":[{"role":"x","field":"timestamp"},{"role":"y","field":"cpu"}],"settings":{"windowMs":3600000}}],"options":[{"capability":"option.animation"},{"capability":"option.tooltip"}],"rationale":["고정 시간 구간과 updateData 재사용이 필요합니다."]}}
|
|
5
|
+
{"id":"column-simple","prompt":"제품별 판매량을 막대로 비교해줘","expected":{"version":1,"intent":"product sales comparison","data":{"shape":"records","fields":[{"name":"product","type":"string"},{"name":"sales","type":"number"}],"rowCount":8},"series":[{"capability":"preset.column","renderer":"svg","bindings":[{"role":"x","field":"product"},{"role":"y","field":"sales"}]}],"options":[{"capability":"option.tooltip"},{"capability":"option.grid"}]}}
|
|
6
|
+
{"id":"column-grouped","prompt":"분기별 웹과 앱 매출을 나란히 비교해줘","expected":{"version":1,"intent":"grouped channel revenue","data":{"shape":"records","fields":[{"name":"quarter","type":"string"},{"name":"web","type":"number"},{"name":"app","type":"number"}],"rowCount":4},"series":[{"capability":"series.column.grouped.svg","renderer":"svg","bindings":[{"role":"x","field":"quarter"},{"role":"segments","fields":["web","app"]}]}],"options":[{"capability":"option.legend"},{"capability":"option.tooltip"}]}}
|
|
7
|
+
{"id":"scatter-correlation","prompt":"키와 몸무게의 상관관계를 보여줘","expected":{"version":1,"intent":"height weight correlation","data":{"shape":"records","fields":[{"name":"height","type":"number"},{"name":"weight","type":"number"}],"rowCount":500},"series":[{"capability":"series.scatter.svg","renderer":"svg","bindings":[{"role":"x","field":"height"},{"role":"y","field":"weight"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
8
|
+
{"id":"bubble-three-variable","prompt":"매출, 이익률, 직원수를 버블로 비교해줘","expected":{"version":1,"intent":"three variable company comparison","data":{"shape":"records","fields":[{"name":"revenue","type":"number"},{"name":"margin","type":"number"},{"name":"employees","type":"number"}],"rowCount":80},"series":[{"capability":"series.bubble.svg","renderer":"svg","bindings":[{"role":"x","field":"revenue"},{"role":"y","field":"margin"},{"role":"radius","field":"employees"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
9
|
+
{"id":"canvas-points","prompt":"5만 개 실험 좌표를 점으로 그려줘","expected":{"version":1,"intent":"dense experiment scatter","data":{"shape":"records","fields":[{"name":"x","type":"number"},{"name":"y","type":"number"}],"rowCount":50000},"series":[{"capability":"series.point.canvas","renderer":"canvas","bindings":[{"role":"x","field":"x"},{"role":"y","field":"y"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
10
|
+
{"id":"webgl-points","prompt":"백만 개 위치를 GPU로 보여줘","expected":{"version":1,"intent":"million point gpu scatter","data":{"shape":"records","fields":[{"name":"x","type":"number"},{"name":"y","type":"number"}],"rowCount":1000000},"series":[{"capability":"series.point.webgl","renderer":"webgl","bindings":[{"role":"x","field":"x"},{"role":"y","field":"y"}]}],"options":[{"capability":"option.render-complete"}]}}
|
|
11
|
+
{"id":"candlestick","prompt":"전일 종가 대비 색상이 바뀌는 주식 캔들차트를 그려줘","expected":{"version":1,"intent":"previous close candlestick","data":{"shape":"records","fields":[{"name":"date","type":"time"},{"name":"open","type":"number"},{"name":"high","type":"number"},{"name":"low","type":"number"},{"name":"close","type":"number"},{"name":"previousClose","type":"number"}],"rowCount":250},"series":[{"capability":"series.candlestick.canvas","renderer":"canvas","bindings":[{"role":"x","field":"date"},{"role":"open","field":"open"},{"role":"high","field":"high"},{"role":"low","field":"low"},{"role":"close","field":"close"},{"role":"previousClose","field":"previousClose"}],"settings":{"colorMode":"previous-close"}}],"options":[{"capability":"option.zoom"},{"capability":"option.tooltip"}]}}
|
|
12
|
+
{"id":"box-plot","prompt":"팀별 응답시간 분포와 이상치를 비교해줘","expected":{"version":1,"intent":"latency distribution by team","data":{"shape":"records","fields":[{"name":"team","type":"string"},{"name":"min","type":"number"},{"name":"q1","type":"number"},{"name":"median","type":"number"},{"name":"q3","type":"number"},{"name":"max","type":"number"},{"name":"outliers","type":"number-array"}],"rowCount":8},"series":[{"capability":"series.box-plot.svg","renderer":"svg","bindings":[{"role":"x","field":"team"},{"role":"min","field":"min"},{"role":"q1","field":"q1"},{"role":"median","field":"median"},{"role":"q3","field":"q3"},{"role":"max","field":"max"},{"role":"outliers","field":"outliers"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
13
|
+
{"id":"histogram","prompt":"주문 금액의 빈도 분포를 히스토그램으로 보여줘","expected":{"version":1,"intent":"order amount histogram","data":{"shape":"records","fields":[{"name":"start","type":"number"},{"name":"end","type":"number"},{"name":"count","type":"number"}],"rowCount":20},"series":[{"capability":"series.histogram.svg","renderer":"svg","bindings":[{"role":"binStart","field":"start"},{"role":"binEnd","field":"end"},{"role":"value","field":"count"}]}],"options":[{"capability":"option.grid"}]}}
|
|
14
|
+
{"id":"area-volume","prompt":"시간별 트래픽 양을 면적으로 보여줘","expected":{"version":1,"intent":"traffic volume over time","data":{"shape":"records","fields":[{"name":"time","type":"time"},{"name":"volume","type":"number"}],"rowCount":1440},"series":[{"capability":"series.area.svg","renderer":"svg","bindings":[{"role":"x","field":"time"},{"role":"y","field":"volume"}]}],"options":[{"capability":"option.tooltip"},{"capability":"option.grid"}]}}
|
|
15
|
+
{"id":"bar-negative","prompt":"부서별 예산 증감을 양수와 음수 막대로 보여줘","expected":{"version":1,"intent":"department budget delta","data":{"shape":"records","fields":[{"name":"department","type":"string"},{"name":"delta","type":"number"}],"rowCount":12},"series":[{"capability":"series.bar.svg","renderer":"svg","bindings":[{"role":"x","field":"department"},{"role":"y","field":"delta"}]}],"options":[{"capability":"option.guide-line","settings":{"y":[{"value":0}]}}]}}
|
|
16
|
+
{"id":"treemap","prompt":"제품군별 매출 비중을 트리맵으로 보여줘","expected":{"version":1,"intent":"product portfolio treemap","data":{"shape":"records","fields":[{"name":"product","type":"string"},{"name":"revenue","type":"number"},{"name":"category","type":"string"}],"rowCount":60},"series":[{"capability":"series.treemap.svg","renderer":"svg","bindings":[{"role":"label","field":"product"},{"role":"value","field":"revenue"},{"role":"color","field":"category"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
17
|
+
{"id":"gauge","prompt":"가동률 87퍼센트를 KPI 게이지로 보여줘","expected":{"version":1,"intent":"availability KPI","data":{"shape":"records","fields":[{"name":"label","type":"string"},{"name":"availability","type":"number"}],"rowCount":1},"series":[{"capability":"series.gauge.svg","renderer":"svg","bindings":[{"role":"value","field":"availability"},{"role":"label","field":"label"}],"settings":{"min":0,"max":100}}],"options":[{"capability":"option.animation"}]}}
|
|
18
|
+
{"id":"waterfall","prompt":"기초 이익에서 항목별 증감과 최종 이익을 폭포차트로 보여줘","expected":{"version":1,"intent":"profit bridge waterfall","data":{"shape":"records","fields":[{"name":"item","type":"string"},{"name":"delta","type":"number"},{"name":"isTotal","type":"boolean"}],"rowCount":9},"series":[{"capability":"series.waterfall.svg","renderer":"svg","bindings":[{"role":"x","field":"item"},{"role":"value","field":"delta"},{"role":"total","field":"isTotal"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
19
|
+
{"id":"pie","prompt":"채널별 매출 비중을 파이차트로 보여줘","expected":{"version":1,"intent":"channel share pie","data":{"shape":"records","fields":[{"name":"channel","type":"string"},{"name":"share","type":"number"}],"rowCount":5},"series":[{"capability":"preset.pie","renderer":"svg","bindings":[{"role":"label","field":"channel"},{"role":"value","field":"share"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
20
|
+
{"id":"doughnut","prompt":"브라우저 점유율을 도넛차트로 보여줘","expected":{"version":1,"intent":"browser share doughnut","data":{"shape":"records","fields":[{"name":"browser","type":"string"},{"name":"users","type":"number"}],"rowCount":6},"series":[{"capability":"preset.doughnut","renderer":"svg","bindings":[{"role":"label","field":"browser"},{"role":"value","field":"users"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
21
|
+
{"id":"graph","prompt":"서비스 간 호출 관계를 노드 그래프로 보여줘","expected":{"version":1,"intent":"service dependency graph","data":{"shape":"records","fields":[{"name":"source","type":"string"},{"name":"target","type":"string"},{"name":"calls","type":"number"},{"name":"team","type":"string"}],"rowCount":180},"series":[{"capability":"series.graph.svg","renderer":"svg","bindings":[{"role":"source","field":"source"},{"role":"target","field":"target"},{"role":"value","field":"calls"},{"role":"category","field":"team"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
22
|
+
{"id":"tree","prompt":"조직의 상하 관계를 트리로 보여줘","expected":{"version":1,"intent":"organization tree","data":{"shape":"records","fields":[{"name":"id","type":"string"},{"name":"parentId","type":"string"},{"name":"name","type":"string"},{"name":"headcount","type":"number"}],"rowCount":120},"series":[{"capability":"series.tree.svg","renderer":"svg","bindings":[{"role":"id","field":"id"},{"role":"parent","field":"parentId"},{"role":"label","field":"name"},{"role":"value","field":"headcount"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
23
|
+
{"id":"sankey","prompt":"유입 채널에서 결제까지 사용자 흐름을 생키로 보여줘","expected":{"version":1,"intent":"conversion flow sankey","data":{"shape":"records","fields":[{"name":"source","type":"string"},{"name":"target","type":"string"},{"name":"users","type":"number"}],"rowCount":40},"series":[{"capability":"series.sankey.svg","renderer":"svg","bindings":[{"role":"source","field":"source"},{"role":"target","field":"target"},{"role":"value","field":"users"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
24
|
+
{"id":"globe","prompt":"서울 런던 뉴욕 위치를 돌릴 수 있는 지구본에 표시해줘","expected":{"version":1,"intent":"global city markers","data":{"shape":"records","fields":[{"name":"lat","type":"latitude"},{"name":"lon","type":"longitude"},{"name":"city","type":"string"}],"rowCount":3},"series":[{"capability":"series.globe.svg","renderer":"svg","bindings":[{"role":"latitude","field":"lat"},{"role":"longitude","field":"lon"},{"role":"label","field":"city"}],"settings":{"draggable":true,"zoom":true}}],"options":[{"capability":"option.tooltip"}]}}
|
|
25
|
+
{"id":"region-map","prompt":"한국 시도별 매출을 색상으로 표현하고 지도를 확대할 수 있게 해줘","expected":{"version":1,"intent":"Korea regional choropleth","data":{"shape":"records","fields":[{"name":"region","type":"string"},{"name":"sales","type":"number"}],"rowCount":17},"series":[{"capability":"series.geo-region-map.svg","renderer":"svg","bindings":[{"role":"regionKey","field":"region"},{"role":"value","field":"sales"}],"settings":{"zoom":true}}],"options":[{"capability":"option.tooltip"}]}}
|
|
26
|
+
{"id":"world-map","prompt":"국가별 사용자 수를 확대 가능한 세계지도에 표시해줘","expected":{"version":1,"intent":"country user choropleth","data":{"shape":"records","fields":[{"name":"country","type":"string"},{"name":"users","type":"number"}],"rowCount":190},"series":[{"capability":"series.world-country-map.svg","renderer":"svg","bindings":[{"role":"regionKey","field":"country"},{"role":"value","field":"users"}],"settings":{"zoom":true}}],"options":[{"capability":"option.tooltip"}]}}
|
|
27
|
+
{"id":"custom-circles","prompt":"스케일을 받아 각 데이터에 커스텀 원을 그려줘","expected":{"version":1,"intent":"custom functional circles","data":{"shape":"records","fields":[{"name":"x","type":"number"},{"name":"y","type":"number"}],"rowCount":50},"series":[{"capability":"series.custom","renderer":"svg","bindings":[{"role":"x","field":"x"},{"role":"y","field":"y"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
28
|
+
{"id":"stacked-recipe","prompt":"분기별 제품 매출을 누적 컬럼으로 보여줘","expected":{"version":1,"intent":"stacked product revenue","data":{"shape":"records","fields":[{"name":"quarter","type":"string"},{"name":"a","type":"number"},{"name":"b","type":"number"},{"name":"c","type":"number"}],"rowCount":4},"series":[{"capability":"recipe.column.stacked","renderer":"svg","bindings":[{"role":"x","field":"quarter"},{"role":"segments","fields":["a","b","c"]}]}],"options":[{"capability":"option.legend"},{"capability":"option.tooltip"}]}}
|
|
29
|
+
{"id":"radial-recipe","prompt":"품질 지표 세 개를 방사형 요약으로 보여줘","expected":{"version":1,"intent":"radial quality summary","data":{"shape":"records","fields":[{"name":"label","type":"string"},{"name":"yield","type":"number"},{"name":"quality","type":"number"},{"name":"speed","type":"number"}],"rowCount":1},"series":[{"capability":"recipe.radial.custom","renderer":"svg","bindings":[{"role":"label","field":"label"},{"role":"value","fields":["yield","quality","speed"]}]}],"options":[{"capability":"option.animation"}]}}
|
|
30
|
+
{"id":"topology-recipe","prompt":"서버와 장비 연결 관계를 그룹 토폴로지로 보여줘","expected":{"version":1,"intent":"infrastructure topology","data":{"shape":"records","fields":[{"name":"source","type":"string"},{"name":"target","type":"string"}],"rowCount":90},"series":[{"capability":"recipe.topology.custom","renderer":"svg","bindings":[{"role":"source","field":"source"},{"role":"target","field":"target"}]}],"options":[{"capability":"option.tooltip"}]}}
|
|
31
|
+
{"id":"multi-line","prompt":"온도와 습도를 같은 시간축에 두 개의 라인으로 보여줘","expected":{"version":1,"intent":"temperature and humidity trends","data":{"shape":"records","fields":[{"name":"time","type":"time"},{"name":"temperature","type":"number"},{"name":"humidity","type":"number"}],"rowCount":1440},"series":[{"capability":"series.line.svg","renderer":"svg","bindings":[{"role":"x","field":"time"},{"role":"y","field":"temperature"}],"displayName":"Temperature"},{"capability":"series.line.svg","renderer":"svg","bindings":[{"role":"x","field":"time"},{"role":"y","field":"humidity"}],"displayName":"Humidity"}],"options":[{"capability":"option.legend"},{"capability":"option.cursor-line"},{"capability":"option.tooltip"}]}}
|
|
32
|
+
{"id":"cesium-route-adapter","prompt":"서울에서 도쿄를 거쳐 샌프란시스코로 이동하는 3D 지구본 경로를 만들어줘","expected":{"version":1,"intent":"3D globe route","data":{"shape":"records","fields":[{"name":"latitude","type":"latitude"},{"name":"longitude","type":"longitude"},{"name":"name","type":"string"}],"rowCount":3},"adapters":[{"capability":"adapter.cesium.globe","bindings":[{"role":"latitude","field":"latitude"},{"role":"longitude","field":"longitude"}],"settings":{"route":true,"labelField":"name"}}],"theme":"dark","warnings":["Cesium imagery, terrain providers, and access tokens must be supplied by the application."]}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# KChart dashboard generation prompt
|
|
2
|
+
|
|
3
|
+
You are generating a production-oriented dashboard with KChart.
|
|
4
|
+
|
|
5
|
+
## Required process
|
|
6
|
+
|
|
7
|
+
1. Inspect the supplied data schema and analytical intent.
|
|
8
|
+
2. Read `ai/catalog.json`.
|
|
9
|
+
3. Select only catalog capability ids.
|
|
10
|
+
4. Produce a `ChartPlan` that conforms to `ai/chart-plan.schema.json`.
|
|
11
|
+
5. Validate the plan before compiling it.
|
|
12
|
+
6. Compile the plan through an application-owned capability registry.
|
|
13
|
+
7. Render the last valid configuration only.
|
|
14
|
+
8. Explain which capabilities, renderers, and options were selected.
|
|
15
|
+
|
|
16
|
+
## Hard constraints
|
|
17
|
+
|
|
18
|
+
- Do not emit or execute arbitrary JavaScript from model output.
|
|
19
|
+
- Do not invent KChart imports or factory names.
|
|
20
|
+
- Do not place formatter functions inside ChartPlan JSON.
|
|
21
|
+
- Use named, application-owned formatter presets when formatting is required.
|
|
22
|
+
- Keep realtime arrays bounded by duration or point count.
|
|
23
|
+
- Clean up chart controllers, timers, workers, observers, and listeners.
|
|
24
|
+
- Use dynamic imports for Three.js, CesiumJS, and MapLibre adapters in SSR applications.
|
|
25
|
+
- Never embed access tokens, map keys, or paid provider credentials.
|
|
26
|
+
|
|
27
|
+
## Dashboard quality
|
|
28
|
+
|
|
29
|
+
- Build the usable dashboard as the first screen.
|
|
30
|
+
- Use a quiet operational layout with clear visual hierarchy.
|
|
31
|
+
- Include loading, empty, and error states.
|
|
32
|
+
- Support responsive resizing without continuously increasing chart height.
|
|
33
|
+
- Use SVG for small interactive charts, Canvas for frequent or large updates, and WebGL for very large line or point data.
|
|
34
|
+
- Await KChart render completion before screenshot, export, or benchmark completion.
|
|
35
|
+
|
|
36
|
+
## Response shape
|
|
37
|
+
|
|
38
|
+
Return:
|
|
39
|
+
|
|
40
|
+
1. a JSON `ChartPlan`,
|
|
41
|
+
2. a short explanation of selections and warnings,
|
|
42
|
+
3. implementation code only after the plan validates.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Using KChart with coding agents
|
|
2
|
+
|
|
3
|
+
This guide applies to Cursor, Codex, and Claude Code. The canonical rules are the same for every tool; repository-specific files only point agents to these rules.
|
|
4
|
+
|
|
5
|
+
## Prompt context
|
|
6
|
+
|
|
7
|
+
Give the agent:
|
|
8
|
+
|
|
9
|
+
1. the data shape or a small representative sample,
|
|
10
|
+
2. the analytical question,
|
|
11
|
+
3. expected update frequency and maximum row count,
|
|
12
|
+
4. interaction requirements,
|
|
13
|
+
5. target framework and cleanup lifecycle.
|
|
14
|
+
|
|
15
|
+
Example:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
Build a responsive operations dashboard with KChart.
|
|
19
|
+
|
|
20
|
+
Data:
|
|
21
|
+
- timestamp: ISO date
|
|
22
|
+
- cpu, memory, requests: number
|
|
23
|
+
- up to 3,600 retained rows, one update per second
|
|
24
|
+
|
|
25
|
+
Requirements:
|
|
26
|
+
- rolling one-hour Canvas line chart
|
|
27
|
+
- selectable legend and tooltip
|
|
28
|
+
- dark/light theme
|
|
29
|
+
- no unbounded arrays
|
|
30
|
+
- destroy timers and the chart controller on unmount
|
|
31
|
+
- explain the selected renderer and options
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Shared agent instruction
|
|
35
|
+
|
|
36
|
+
Add this to a consuming repository's agent instruction file:
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
When implementing charts:
|
|
40
|
+
|
|
41
|
+
- Use `@keneth80/k-chart` public exports only.
|
|
42
|
+
- Read KChart `llms.txt`, `docs/ai/chart-selection.md`, and `ai/catalog.json`.
|
|
43
|
+
- Select a capability from the catalog before writing code.
|
|
44
|
+
- Prefer presets for simple line, column, pie, and doughnut charts.
|
|
45
|
+
- Use `createKChart` plus functional series for composed or custom visualization.
|
|
46
|
+
- Never invent factory names.
|
|
47
|
+
- Keep realtime buffers bounded and destroy controllers on unmount.
|
|
48
|
+
- Use `whenRenderComplete()` before export or performance measurement.
|
|
49
|
+
- Dynamically import browser-only MapLibre, Cesium, and Three adapters in SSR frameworks.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Codex
|
|
53
|
+
|
|
54
|
+
Codex reads `AGENTS.md`. Put project-wide instructions at the repository root and narrower instructions in subdirectories when a dashboard package needs different rules.
|
|
55
|
+
|
|
56
|
+
The KChart repository's root `AGENTS.md` points to the canonical AI docs and includes validation commands. In a consuming project, include the shared instruction above and add exact build and test commands.
|
|
57
|
+
|
|
58
|
+
## Claude Code
|
|
59
|
+
|
|
60
|
+
Claude Code reads `CLAUDE.md`. Keep it short and reference the same canonical documents instead of copying the catalog into the file.
|
|
61
|
+
|
|
62
|
+
For local exceptions that must not be committed, use the tool's supported local instruction mechanism rather than placing tokens, provider keys, or private data in `CLAUDE.md`.
|
|
63
|
+
|
|
64
|
+
## Cursor
|
|
65
|
+
|
|
66
|
+
Use `.cursor/rules/*.mdc`; `.cursorrules` is legacy. A KChart rule should be focused, auto-attached to chart files where possible, and reference this guide plus `ai/catalog.json`.
|
|
67
|
+
|
|
68
|
+
The repository includes `.cursor/rules/kchart.mdc` as a starting point.
|
|
69
|
+
|
|
70
|
+
## Verification checklist
|
|
71
|
+
|
|
72
|
+
- TypeScript compilation passes.
|
|
73
|
+
- The selected capability exists in `ai/catalog.json`.
|
|
74
|
+
- Every required data role is bound to a real field.
|
|
75
|
+
- The renderer is supported by the capability.
|
|
76
|
+
- Loading, empty, error, resize, and cleanup states are handled.
|
|
77
|
+
- No model-generated code is evaluated.
|
|
78
|
+
- Large-data and realtime examples have bounded memory.
|
|
79
|
+
- Browser-only adapters are not executed during SSR.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Chart and renderer selection
|
|
2
|
+
|
|
3
|
+
Use intent and data shape before visual style. The capability ids below are stable identifiers for AI plans; import names remain available in `ai/catalog.json`.
|
|
4
|
+
|
|
5
|
+
## Intent to capability
|
|
6
|
+
|
|
7
|
+
| User intent | Preferred capability | Notes |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| Ordered trend | `preset.line` or `series.line.svg` | Use a time or numeric x-axis |
|
|
10
|
+
| Large trend | `series.line.canvas` | Supports LTTB and worker rendering |
|
|
11
|
+
| Very large trend | `series.line.webgl` | Prefer explicit domains and LTTB |
|
|
12
|
+
| Category comparison | `preset.column` or `series.bar.svg` | Keep categories scannable |
|
|
13
|
+
| Multi-field comparison | `series.column.grouped.svg` | Avoid too many segments |
|
|
14
|
+
| Part-to-whole | `preset.pie`, `preset.doughnut` | Prefer at most seven slices |
|
|
15
|
+
| Numeric distribution | `series.histogram.svg` | Input must already be binned |
|
|
16
|
+
| Summary and outliers | `series.box-plot.svg` | Requires five-number summary |
|
|
17
|
+
| Correlation | `series.scatter.svg` | Use Canvas/WebGL points for dense data |
|
|
18
|
+
| Financial OHLC | `series.candlestick.canvas` | Supports previous-close coloring |
|
|
19
|
+
| Running contribution | `series.waterfall.svg` | Mark totals explicitly |
|
|
20
|
+
| Hierarchy | `series.tree.svg`, `series.treemap.svg` | Tree for structure, treemap for magnitude |
|
|
21
|
+
| Relationship network | `series.graph.svg` | Source, target, and edge value |
|
|
22
|
+
| Weighted flow | `series.sankey.svg` | Source, target, and flow value |
|
|
23
|
+
| KPI against range | `series.gauge.svg` | One current value |
|
|
24
|
+
| Country or region comparison | `series.geo-region-map.svg` | Requires trusted geographic data |
|
|
25
|
+
| Global locations | `series.globe.svg` | Latitude and longitude in degrees |
|
|
26
|
+
| Domain-specific marks | `series.custom` | Application owns the render function |
|
|
27
|
+
|
|
28
|
+
## Renderer selection
|
|
29
|
+
|
|
30
|
+
### SVG
|
|
31
|
+
|
|
32
|
+
Choose SVG when the visible mark count is modest and individual elements need rich interaction, labels, accessibility hooks, or inspection in the DOM.
|
|
33
|
+
|
|
34
|
+
### Canvas
|
|
35
|
+
|
|
36
|
+
Choose Canvas for large or frequently updating line and point datasets. Canvas line can move rendering to an OffscreenCanvas worker when a worker factory is supplied. Await the render completion signal before taking screenshots or benchmark timestamps.
|
|
37
|
+
|
|
38
|
+
### WebGL
|
|
39
|
+
|
|
40
|
+
Choose WebGL for very large line and point data. KChart uses GPU buffers for these first-class series. Tooltip hit testing and custom interaction can require separate CPU-side logic.
|
|
41
|
+
|
|
42
|
+
## Axis and zoom rules
|
|
43
|
+
|
|
44
|
+
- Use `time` only for Date values or values deterministically converted to Date.
|
|
45
|
+
- Use `number` for continuous quantitative axes.
|
|
46
|
+
- Use `string` or `point` for categories.
|
|
47
|
+
- Do not recommend numeric zoom for a categorical x-axis unless the consuming application defines categorical paging.
|
|
48
|
+
- Explicit `axis.min` and `axis.max` avoid unnecessary domain discovery for known large-data domains.
|
|
49
|
+
|
|
50
|
+
## Realtime rules
|
|
51
|
+
|
|
52
|
+
- Keep a fixed duration or maximum point count.
|
|
53
|
+
- Reuse the controller's update methods instead of recreating the chart.
|
|
54
|
+
- Destroy intervals, workers, observers, and the controller on unmount.
|
|
55
|
+
- Use update animation with reduced-motion support.
|
|
56
|
+
- Separate data arrival frequency from visual frame frequency when events arrive faster than the display can update.
|
|
57
|
+
|
|
58
|
+
## Honest fallback
|
|
59
|
+
|
|
60
|
+
If no capability satisfies the request, return a warning and either:
|
|
61
|
+
|
|
62
|
+
1. select `series.custom` with a human-readable implementation requirement, or
|
|
63
|
+
2. decline to generate a chart.
|
|
64
|
+
|
|
65
|
+
Do not invent a factory or claim a recipe is a first-class series.
|