@keneth80/k-chart 1.22.0 → 1.24.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +30 -11
  3. package/docs/configuration-reference.md +37 -1
  4. package/docs/functional-api.md +6 -1
  5. package/examples/stackblitz-area-basic/index.html +21 -0
  6. package/examples/stackblitz-area-basic/package-lock.json +1531 -0
  7. package/examples/stackblitz-area-basic/package.json +18 -0
  8. package/examples/stackblitz-area-basic/src/main.ts +65 -0
  9. package/examples/stackblitz-area-basic/src/style.css +83 -0
  10. package/examples/stackblitz-area-basic/src/vite-env.d.ts +1 -0
  11. package/examples/stackblitz-box-plot-basic/index.html +21 -0
  12. package/examples/stackblitz-box-plot-basic/package-lock.json +1531 -0
  13. package/examples/stackblitz-box-plot-basic/package.json +18 -0
  14. package/examples/stackblitz-box-plot-basic/src/main.ts +69 -0
  15. package/examples/stackblitz-box-plot-basic/src/style.css +83 -0
  16. package/examples/stackblitz-box-plot-basic/src/vite-env.d.ts +1 -0
  17. package/examples/stackblitz-bubble-basic/index.html +21 -0
  18. package/examples/stackblitz-bubble-basic/package-lock.json +1531 -0
  19. package/examples/stackblitz-bubble-basic/package.json +18 -0
  20. package/examples/stackblitz-bubble-basic/src/main.ts +64 -0
  21. package/examples/stackblitz-bubble-basic/src/style.css +83 -0
  22. package/examples/stackblitz-bubble-basic/src/vite-env.d.ts +1 -0
  23. package/examples/stackblitz-gauge-basic/index.html +21 -0
  24. package/examples/stackblitz-gauge-basic/package-lock.json +1531 -0
  25. package/examples/stackblitz-gauge-basic/package.json +18 -0
  26. package/examples/stackblitz-gauge-basic/src/main.ts +55 -0
  27. package/examples/stackblitz-gauge-basic/src/style.css +83 -0
  28. package/examples/stackblitz-gauge-basic/src/vite-env.d.ts +1 -0
  29. package/examples/stackblitz-grouped-column-basic/index.html +26 -0
  30. package/examples/stackblitz-grouped-column-basic/package-lock.json +1531 -0
  31. package/examples/stackblitz-grouped-column-basic/package.json +18 -0
  32. package/examples/stackblitz-grouped-column-basic/src/main.ts +61 -0
  33. package/examples/stackblitz-grouped-column-basic/src/style.css +83 -0
  34. package/examples/stackblitz-grouped-column-basic/src/vite-env.d.ts +1 -0
  35. package/examples/stackblitz-histogram-basic/index.html +21 -0
  36. package/examples/stackblitz-histogram-basic/package-lock.json +1531 -0
  37. package/examples/stackblitz-histogram-basic/package.json +18 -0
  38. package/examples/stackblitz-histogram-basic/src/main.ts +64 -0
  39. package/examples/stackblitz-histogram-basic/src/style.css +83 -0
  40. package/examples/stackblitz-histogram-basic/src/vite-env.d.ts +1 -0
  41. package/examples/stackblitz-horizontal-bar-basic/index.html +21 -0
  42. package/examples/stackblitz-horizontal-bar-basic/package-lock.json +1531 -0
  43. package/examples/stackblitz-horizontal-bar-basic/package.json +18 -0
  44. package/examples/stackblitz-horizontal-bar-basic/src/main.ts +58 -0
  45. package/examples/stackblitz-horizontal-bar-basic/src/style.css +83 -0
  46. package/examples/stackblitz-horizontal-bar-basic/src/vite-env.d.ts +1 -0
  47. package/examples/stackblitz-scatter-basic/index.html +21 -0
  48. package/examples/stackblitz-scatter-basic/package-lock.json +1531 -0
  49. package/examples/stackblitz-scatter-basic/package.json +18 -0
  50. package/examples/stackblitz-scatter-basic/src/main.ts +66 -0
  51. package/examples/stackblitz-scatter-basic/src/style.css +83 -0
  52. package/examples/stackblitz-scatter-basic/src/vite-env.d.ts +1 -0
  53. package/examples/stackblitz-three-constellation-basic/index.html +41 -0
  54. package/examples/stackblitz-three-constellation-basic/package-lock.json +1607 -0
  55. package/examples/stackblitz-three-constellation-basic/package.json +22 -0
  56. package/examples/stackblitz-three-constellation-basic/src/main.ts +374 -0
  57. package/examples/stackblitz-three-constellation-basic/src/style.css +173 -0
  58. package/examples/stackblitz-waterfall-basic/index.html +26 -0
  59. package/examples/stackblitz-waterfall-basic/package-lock.json +1531 -0
  60. package/examples/stackblitz-waterfall-basic/package.json +18 -0
  61. package/examples/stackblitz-waterfall-basic/src/main.ts +75 -0
  62. package/examples/stackblitz-waterfall-basic/src/style.css +83 -0
  63. package/examples/stackblitz-waterfall-basic/src/vite-env.d.ts +1 -0
  64. package/lib/core/contracts.d.ts +24 -1
  65. package/lib/core/contracts.d.ts.map +1 -1
  66. package/lib/core/create-kchart.d.ts +9 -0
  67. package/lib/core/create-kchart.d.ts.map +1 -1
  68. package/lib/core/create-kchart.js +221 -6
  69. package/lib/core/create-kchart.js.map +1 -1
  70. package/lib/options/index.d.ts +1 -0
  71. package/lib/options/index.d.ts.map +1 -1
  72. package/lib/options/index.js +1 -0
  73. package/lib/options/index.js.map +1 -1
  74. package/lib/options/range-navigator.d.ts +33 -0
  75. package/lib/options/range-navigator.d.ts.map +1 -0
  76. package/lib/options/range-navigator.js +283 -0
  77. package/lib/options/range-navigator.js.map +1 -0
  78. package/lib/series/svg-bar.d.ts +5 -0
  79. package/lib/series/svg-bar.d.ts.map +1 -1
  80. package/lib/series/svg-bar.js +39 -10
  81. package/lib/series/svg-bar.js.map +1 -1
  82. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.24.0 - 2026-08-26
4
+
5
+ ### Added
6
+
7
+ - Added the `rangeNavigator` configuration and
8
+ `createRangeNavigatorOption()` factory for number/time axes, providing a
9
+ compact overview chart with a draggable D3 brush selection.
10
+ - Added a GitHub Contributors-style weekly commit example with columns, a
11
+ right-side contribution axis, and an interactive bottom range navigator.
12
+
13
+ ### Changed
14
+
15
+ - Reserved navigator-aware bottom margins only for supported continuous axes
16
+ and preserved a minimum axis footer for labels and titles.
17
+ - Kept the selected navigator range synchronized across data updates,
18
+ including reversed, partially overlapping, disjoint, and endpoint-touching
19
+ domains.
20
+
21
+ ### Fixed
22
+
23
+ - Kept grouped endpoint columns inside the plot by clamping their complete
24
+ rendered width, including minimum bar widths and segment gaps.
25
+ - Prevented callback-triggered updates or destruction from scheduling a stale
26
+ duplicate navigator render.
27
+
28
+ ### Tests
29
+
30
+ - Added range normalization, pixel conversion, data-domain reconciliation,
31
+ navigator layout, and dense grouped-column geometry regression coverage.
32
+
33
+ ## 1.23.0 - 2026-08-25
34
+
35
+ ### Added
36
+
37
+ - Added the remaining StackBlitz-ready starters for area, grouped and
38
+ horizontal bars, scatter, bubble, box plot, histogram, gauge, waterfall,
39
+ and the Three.js constellation example.
40
+
41
+ ### Changed
42
+
43
+ - Coalesced wheel and drag zoom rendering to the latest state once per
44
+ animation frame, preventing repeated full-series projection while preserving
45
+ immediate zoom callbacks and a final render at gesture end.
46
+
47
+ ### Tests
48
+
49
+ - Added zoom scheduling lifecycle coverage, including overlapping gesture
50
+ boundaries and authoritative-render cancellation. Three 60-second 300k-point
51
+ S3 runs completed with zero long tasks; the final reviewed build recorded a
52
+ 50 ms worst frame, down from the previously published multi-second stall.
53
+
3
54
  ## 1.22.0 - 2026-08-20
4
55
 
5
56
  ### Added
package/README.md CHANGED
@@ -18,7 +18,6 @@
18
18
  <a href="https://www.npmjs.com/package/@keneth80/k-chart"><img alt="npm" src="https://img.shields.io/npm/v/%40keneth80%2Fk-chart?style=for-the-badge&label=npm&color=0ea5e9"></a>
19
19
  <a href="https://github.com/keneth80/k-chart/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/keneth80/k-chart?style=for-the-badge&color=22c55e"></a>
20
20
  <a href="https://k-chart-playground.vercel.app/"><img alt="Playground" src="https://img.shields.io/badge/Live_Playground-open-8b5cf6?style=for-the-badge"></a>
21
- <a href="https://k-chart-bench.vercel.app/"><img alt="Benchmark" src="https://img.shields.io/badge/Live_Benchmark-view-f59e0b?style=for-the-badge"></a>
22
21
  </p>
23
22
 
24
23
  <p align="center">
@@ -37,8 +36,6 @@
37
36
  <p align="center">
38
37
  <a href="https://k-chart-playground.vercel.app/"><strong>Open Playground</strong></a>
39
38
  ·
40
- <a href="https://k-chart-bench.vercel.app/"><strong>View Benchmark</strong></a>
41
- ·
42
39
  <a href="#quick-start"><strong>Quick Start</strong></a>
43
40
  ·
44
41
  <a href="docs/functional-api.md"><strong>API Guide</strong></a>
@@ -144,7 +141,6 @@ KChart의 성능 방향은 “모든 기능을 하나의 거대한 chart object
144
141
  - 수천에서 수만 개의 point를 빠르게 그려야 하면 Canvas series를 사용합니다.
145
142
  - 더 큰 line/point 데이터나 잦은 viewport 변경이 있으면 WebGL series와 LTTB downsampling을 조합합니다.
146
143
  - 3D, 지도, 지구본은 optional adapter package로 분리해 필요한 화면에서만 로드합니다.
147
- - 재현 가능한 렌더링 측정 결과와 조건은 [KChart Benchmark](https://k-chart-bench.vercel.app/)에서 확인할 수 있습니다.
148
144
 
149
145
  ## Core Concept
150
146
 
@@ -251,12 +247,6 @@ npm install @keneth80/k-chart
251
247
 
252
248
  The playground demonstrates the React wrapper, chart examples, configuration editor, and AI Builder flow.
253
249
 
254
- ## Benchmark
255
-
256
- - Live benchmark: [https://k-chart-bench.vercel.app/](https://k-chart-bench.vercel.app/)
257
-
258
- The benchmark publishes reproducible KChart rendering measurements alongside the dataset size, browser environment, runtime version, and measurement methodology.
259
-
260
250
  ## Local Development
261
251
 
262
252
  ```bash
@@ -295,7 +285,7 @@ responsibility:
295
285
  src/
296
286
  ├── core/ # contracts, state, layers, scales, and chart lifecycle
297
287
  ├── series/ # SVG, Canvas, WebGL, candlestick, and globe renderers
298
- ├── options/ # spec area, fixed guide line, and cursor line
288
+ ├── options/ # spec area, guide/cursor line, range navigator, and tooltip notes
299
289
  ├── worker/ # OffscreenCanvas worker entry
300
290
  └── utils/ # renderer-independent algorithms such as LTTB
301
291
  ```
@@ -1032,6 +1022,35 @@ createKChart({
1032
1022
 
1033
1023
  `createCursorLineOption`은 마우스 위치를 따라 가장 가까운 x 위치의 series 값을 읽어 보여주는 inspect overlay입니다. 기존 `specAreas`, `guideLines`, `cursorGuide`, `guideLine` 직접 필드는 호환을 위해 남아 있지만, 새 코드에서는 `options` 배열을 권장합니다.
1034
1024
 
1025
+ ## Range Navigator
1026
+
1027
+ 긴 number/time 시계열은 `rangeNavigator`로 전체 추세를 유지하면서 선택 구간만 메인 차트에 표시할 수 있습니다. 하단 overview 높이와 간격은 자동으로 margin에 반영되며, 문자열/point 축에서는 활성화되지 않습니다.
1028
+
1029
+ ```ts
1030
+ createKChart({
1031
+ selector: '#chart',
1032
+ data: weeklyCommits,
1033
+ axes: [
1034
+ {field: 'week', type: 'time', placement: 'bottom'},
1035
+ {field: 'commits', type: 'number', placement: 'right', min: 0}
1036
+ ],
1037
+ series: [createGroupedColumnSeries({
1038
+ selector: 'weekly-commits',
1039
+ displayName: 'Commits',
1040
+ xField: 'week',
1041
+ segments: [{field: 'commits', color: '#2f81f7'}]
1042
+ })],
1043
+ rangeNavigator: {
1044
+ xField: 'week',
1045
+ yField: 'commits',
1046
+ height: 58,
1047
+ gap: 14
1048
+ }
1049
+ }).render();
1050
+ ```
1051
+
1052
+ `createRangeNavigatorOption(...)`으로 같은 설정을 `options` 배열에 넣을 수도 있습니다. brush 선택 후 `onRangeChange`는 number 축이면 숫자, time 축이면 `Date` 두 개로 구성된 domain을 전달합니다.
1053
+
1035
1054
  `tooltip.formatter` can be used when the default series/x/y text is not enough.
1036
1055
 
1037
1056
  ```ts
@@ -28,7 +28,7 @@ createKChart({
28
28
  | `data` | `T[]` | yes | - | 차트 전체 데이터입니다. 모든 series와 axis domain 계산이 이 배열을 기준으로 동작합니다. |
29
29
  | `axes` | `KChartAxis<T>[]` | yes | - | x/y/top/right scale과 axis 정의입니다. |
30
30
  | `series` | `KChartSeries<T>[]` | yes | - | 렌더링할 series 목록입니다. |
31
- | `options` | `KChartOption<T>[]` | no | `[]` | spec area, guide line, cursor line, tooltip note 등 plugin형 옵션입니다. |
31
+ | `options` | `KChartOption<T>[]` | no | `[]` | spec area, guide line, cursor line, range navigator, tooltip note 등 plugin형 옵션입니다. |
32
32
  | `width` | `number` | no | container width or `320` | 전체 SVG/canvas width입니다. |
33
33
  | `height` | `number` | no | container height or `240` | 전체 SVG/canvas height입니다. |
34
34
  | `margin` | `Partial<KChartMargin>` | no | `{ top: 24, right: 24, bottom: 36, left: 44 }` | plot 영역 바깥 여백입니다. title, top legend, option label이 있으면 top margin은 자동 보정될 수 있습니다. |
@@ -39,6 +39,7 @@ createKChart({
39
39
  | `legend` | `KChartLegendConfiguration` | no | visible top legend | series 표시/숨김 범례 설정입니다. |
40
40
  | `tooltip` | `KChartTooltipConfiguration<T>` | no | basic tooltip | nearest point tooltip 설정입니다. |
41
41
  | `zoom` | `KChartZoomConfiguration<T>` | no | disabled | number/time 축 zoom, pan, 영역 선택 zoom 설정입니다. |
42
+ | `rangeNavigator` | `KChartRangeNavigatorConfiguration<T>` | no | disabled | 전체 number/time x축 개요와 하단 brush를 표시하고 선택 구간을 메인 차트에 반영합니다. |
42
43
  | `animation` | `boolean \| KChartAnimationConfiguration` | no | disabled | series enter animation과 연속 축의 data update transition을 설정합니다. |
43
44
  | `specAreas` | `KChartSpecAreaConfiguration[]` | no | `[]` | 기존 호환 필드입니다. 새 코드는 `createSpecAreaOption(...)` 사용을 권장합니다. |
44
45
  | `guideLines` | `KChartGuideLinesConfiguration` | no | - | 기존 호환 필드입니다. 새 코드는 `createGuideLineOption(...)` 사용을 권장합니다. |
@@ -206,6 +207,41 @@ setInterval(() => {
206
207
  | `devices` | `'pc' \| 'mobile' \| 'all'` | `mobile` | 어떤 입력 장치에서 반응할지 정합니다. |
207
208
  | `minTouches` | `number` | `1` | gesture 처리에 필요한 최소 touch 수입니다. |
208
209
 
210
+ ## Range Navigator Configuration
211
+
212
+ `rangeNavigator`는 전체 number/time x축을 작은 overview로 유지하고, 하단 brush에서 선택한 구간만 메인 차트에 표시합니다. 문자열/point 축에서는 렌더링하지 않습니다. 필요한 하단 여백은 `height + gap`만큼 자동 확보됩니다.
213
+
214
+ | Field | Type | Default | Description |
215
+ | --- | --- | --- | --- |
216
+ | `visible` | `boolean` | `true` | navigator 표시 여부입니다. |
217
+ | `xField` | `keyof T & string` | 첫 number/time 가로축 | overview와 선택 domain에 사용할 x field입니다. |
218
+ | `yField` | `keyof T & string` | 첫 series y field | overview 선/영역에 사용할 y field입니다. |
219
+ | `height` | `number` | `52` | overview와 brush의 높이(px), 최소 24입니다. |
220
+ | `gap` | `number` | `14` | 메인 plot 아래와 navigator 사이 간격(px)입니다. |
221
+ | `stroke` / `fill` | `string` | blue theme | overview 선과 영역 색상입니다. |
222
+ | `selectionFill` / `handleFill` | `string` | theme defaults | 선택 영역과 양쪽 handle 색상입니다. |
223
+ | `onRangeChange` | `(range) => void` | - | 사용자가 brush를 놓은 뒤 선택된 `[min, max]` domain을 받습니다. time 축에서는 `Date` 값입니다. |
224
+
225
+ ```ts
226
+ createKChart({
227
+ data: weeklyCommits,
228
+ axes: [
229
+ {field: 'week', type: 'time', placement: 'bottom'},
230
+ {field: 'commits', type: 'number', placement: 'right'}
231
+ ],
232
+ series: [createGroupedColumnSeries({
233
+ selector: 'commits',
234
+ xField: 'week',
235
+ segments: [{field: 'commits', color: '#2f81f7'}]
236
+ })],
237
+ rangeNavigator: {
238
+ xField: 'week',
239
+ yField: 'commits',
240
+ height: 58
241
+ }
242
+ });
243
+ ```
244
+
209
245
  ## Series Common Contract
210
246
 
211
247
  모든 series factory는 최종적으로 `KChartSeries<T>`를 반환합니다.
@@ -1015,6 +1015,11 @@ createKChart({
1015
1015
  createCursorLineOption({
1016
1016
  valueFormat: (value: number) => Number(value).toFixed(1)
1017
1017
  }),
1018
+ createRangeNavigatorOption<Point>({
1019
+ xField: 'time',
1020
+ yField: 'value',
1021
+ height: 56
1022
+ }),
1018
1023
  createTooltipNoteOption<Point>({
1019
1024
  maxNotes: 8,
1020
1025
  onChange: (notes) => console.info(notes)
@@ -1023,7 +1028,7 @@ createKChart({
1023
1028
  });
1024
1029
  ```
1025
1030
 
1026
- 기존 `specAreas`, `guideLines`, `cursorGuide`, `guideLine` 직접 필드도 호환됩니다. 새 코드에서는 option factory 사용을 권장합니다.
1031
+ `createRangeNavigatorOption(...)`은 number/time x축의 전체 overview와 brush를 추가합니다. 같은 설정을 `rangeNavigator` 직접 필드로 지정해도 됩니다. 기존 `specAreas`, `guideLines`, `cursorGuide`, `guideLine` 직접 필드도 호환됩니다. 새 코드에서는 option factory 사용을 권장합니다.
1027
1032
 
1028
1033
  ## Custom Series
1029
1034
 
@@ -0,0 +1,21 @@
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 Area Basic</title>
7
+ </head>
8
+ <body>
9
+ <main class="page-shell">
10
+ <header class="intro">
11
+ <p class="eyebrow">Operations overview</p>
12
+ <h1>Weekly energy demand</h1>
13
+ <p>Grid load climbs through the summer peak before easing into early autumn.</p>
14
+ </header>
15
+ <section class="chart-panel">
16
+ <div id="chart"></div>
17
+ </section>
18
+ </main>
19
+ <script type="module" src="/src/main.ts"></script>
20
+ </body>
21
+ </html>