@keneth80/k-chart 1.9.0 → 1.11.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 (133) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +208 -1
  3. package/docs/assets/kchart-hero.svg +110 -0
  4. package/docs/assets/kchart-icon.svg +40 -0
  5. package/docs/configuration-reference.md +395 -0
  6. package/docs/functional-api.md +164 -3
  7. package/examples/stackblitz-candlestick-basic/index.html +23 -0
  8. package/examples/stackblitz-candlestick-basic/package-lock.json +1435 -0
  9. package/examples/stackblitz-candlestick-basic/package.json +18 -0
  10. package/examples/stackblitz-candlestick-basic/src/main.ts +107 -0
  11. package/examples/stackblitz-candlestick-basic/src/style.css +16 -0
  12. package/examples/stackblitz-canvas-line-basic/index.html +23 -0
  13. package/examples/stackblitz-canvas-line-basic/package-lock.json +1435 -0
  14. package/examples/stackblitz-canvas-line-basic/package.json +18 -0
  15. package/examples/stackblitz-canvas-line-basic/src/main.ts +73 -0
  16. package/examples/stackblitz-canvas-line-basic/src/style.css +46 -0
  17. package/examples/stackblitz-column-basic/index.html +23 -0
  18. package/examples/stackblitz-column-basic/package-lock.json +1435 -0
  19. package/examples/stackblitz-column-basic/package.json +18 -0
  20. package/examples/stackblitz-column-basic/src/main.ts +128 -0
  21. package/examples/stackblitz-column-basic/src/style.css +41 -0
  22. package/examples/stackblitz-doughnut-basic/index.html +21 -0
  23. package/examples/stackblitz-doughnut-basic/package-lock.json +1435 -0
  24. package/examples/stackblitz-doughnut-basic/package.json +18 -0
  25. package/examples/stackblitz-doughnut-basic/src/main.ts +177 -0
  26. package/examples/stackblitz-doughnut-basic/src/style.css +43 -0
  27. package/examples/stackblitz-korea-region-map-basic/index.html +20 -0
  28. package/examples/stackblitz-korea-region-map-basic/package-lock.json +1434 -0
  29. package/examples/stackblitz-korea-region-map-basic/package.json +17 -0
  30. package/examples/stackblitz-korea-region-map-basic/src/main.ts +90 -0
  31. package/examples/stackblitz-korea-region-map-basic/src/style.css +57 -0
  32. package/examples/stackblitz-line-basic/index.html +23 -0
  33. package/examples/stackblitz-line-basic/package-lock.json +1435 -0
  34. package/examples/stackblitz-line-basic/package.json +18 -0
  35. package/examples/stackblitz-line-basic/src/main.ts +112 -0
  36. package/examples/stackblitz-line-basic/src/style.css +108 -0
  37. package/examples/stackblitz-multi-series-basic/index.html +1 -0
  38. package/examples/stackblitz-multi-series-basic/package-lock.json +1435 -0
  39. package/examples/stackblitz-multi-series-basic/package.json +9 -0
  40. package/examples/stackblitz-multi-series-basic/src/main.ts +29 -0
  41. package/examples/stackblitz-multi-series-basic/src/style.css +1 -0
  42. package/examples/stackblitz-options-basic/index.html +1 -0
  43. package/examples/stackblitz-options-basic/package-lock.json +1435 -0
  44. package/examples/stackblitz-options-basic/package.json +9 -0
  45. package/examples/stackblitz-options-basic/src/main.ts +32 -0
  46. package/examples/stackblitz-options-basic/src/style.css +1 -0
  47. package/examples/stackblitz-pie-basic/index.html +21 -0
  48. package/examples/stackblitz-pie-basic/package-lock.json +1435 -0
  49. package/examples/stackblitz-pie-basic/package.json +18 -0
  50. package/examples/stackblitz-pie-basic/src/main.ts +156 -0
  51. package/examples/stackblitz-pie-basic/src/style.css +43 -0
  52. package/examples/stackblitz-plot-basic/index.html +1 -0
  53. package/examples/stackblitz-plot-basic/package-lock.json +1435 -0
  54. package/examples/stackblitz-plot-basic/package.json +9 -0
  55. package/examples/stackblitz-plot-basic/src/main.ts +32 -0
  56. package/examples/stackblitz-plot-basic/src/style.css +1 -0
  57. package/examples/stackblitz-radial-basic/index.html +21 -0
  58. package/examples/stackblitz-radial-basic/package-lock.json +1435 -0
  59. package/examples/stackblitz-radial-basic/package.json +18 -0
  60. package/examples/stackblitz-radial-basic/src/main.ts +223 -0
  61. package/examples/stackblitz-radial-basic/src/style.css +87 -0
  62. package/examples/stackblitz-simple-api-basic/index.html +30 -0
  63. package/examples/stackblitz-simple-api-basic/package-lock.json +1435 -0
  64. package/examples/stackblitz-simple-api-basic/package.json +18 -0
  65. package/examples/stackblitz-simple-api-basic/src/main.ts +69 -0
  66. package/examples/stackblitz-simple-api-basic/src/style.css +127 -0
  67. package/examples/stackblitz-stacked-column-basic/index.html +23 -0
  68. package/examples/stackblitz-stacked-column-basic/package-lock.json +1435 -0
  69. package/examples/stackblitz-stacked-column-basic/package.json +18 -0
  70. package/examples/stackblitz-stacked-column-basic/src/main.ts +136 -0
  71. package/examples/stackblitz-stacked-column-basic/src/style.css +16 -0
  72. package/examples/stackblitz-three-wafer-basic/index.html +1 -0
  73. package/examples/stackblitz-three-wafer-basic/package-lock.json +1453 -0
  74. package/examples/stackblitz-three-wafer-basic/package.json +9 -0
  75. package/examples/stackblitz-three-wafer-basic/src/main.ts +29 -0
  76. package/examples/stackblitz-three-wafer-basic/src/style.css +1 -0
  77. package/examples/stackblitz-topology-basic/index.html +1 -0
  78. package/examples/stackblitz-topology-basic/package-lock.json +1435 -0
  79. package/examples/stackblitz-topology-basic/package.json +9 -0
  80. package/examples/stackblitz-topology-basic/src/main.ts +89 -0
  81. package/examples/stackblitz-topology-basic/src/style.css +1 -0
  82. package/examples/stackblitz-webgl-line-basic/index.html +23 -0
  83. package/examples/stackblitz-webgl-line-basic/package-lock.json +1435 -0
  84. package/examples/stackblitz-webgl-line-basic/package.json +18 -0
  85. package/examples/stackblitz-webgl-line-basic/src/main.ts +86 -0
  86. package/examples/stackblitz-webgl-line-basic/src/style.css +46 -0
  87. package/examples/stackblitz-worker-json-line/index.html +41 -0
  88. package/examples/stackblitz-worker-json-line/package-lock.json +1435 -0
  89. package/examples/stackblitz-worker-json-line/package.json +19 -0
  90. package/examples/stackblitz-worker-json-line/public/data/large-line.json +4322 -0
  91. package/examples/stackblitz-worker-json-line/src/kchart-render.worker.ts +4 -0
  92. package/examples/stackblitz-worker-json-line/src/main.ts +185 -0
  93. package/examples/stackblitz-worker-json-line/src/style.css +101 -0
  94. package/examples/stackblitz-world-country-map-basic/index.html +20 -0
  95. package/examples/stackblitz-world-country-map-basic/package-lock.json +1434 -0
  96. package/examples/stackblitz-world-country-map-basic/package.json +17 -0
  97. package/examples/stackblitz-world-country-map-basic/src/main.ts +64 -0
  98. package/examples/stackblitz-world-country-map-basic/src/style.css +57 -0
  99. package/lib/core/contracts.d.ts +72 -0
  100. package/lib/core/contracts.d.ts.map +1 -1
  101. package/lib/core/create-kchart.d.ts.map +1 -1
  102. package/lib/core/create-kchart.js +93 -4
  103. package/lib/core/create-kchart.js.map +1 -1
  104. package/lib/index.d.ts +1 -0
  105. package/lib/index.d.ts.map +1 -1
  106. package/lib/index.js +1 -0
  107. package/lib/index.js.map +1 -1
  108. package/lib/kchart.d.ts +1 -0
  109. package/lib/kchart.d.ts.map +1 -1
  110. package/lib/kchart.js +1 -0
  111. package/lib/kchart.js.map +1 -1
  112. package/lib/presets/index.d.ts +97 -0
  113. package/lib/presets/index.d.ts.map +1 -0
  114. package/lib/presets/index.js +481 -0
  115. package/lib/presets/index.js.map +1 -0
  116. package/lib/series/canvas-line.d.ts.map +1 -1
  117. package/lib/series/canvas-line.js +16 -11
  118. package/lib/series/canvas-line.js.map +1 -1
  119. package/lib/series/index.d.ts +1 -0
  120. package/lib/series/index.d.ts.map +1 -1
  121. package/lib/series/index.js +1 -0
  122. package/lib/series/index.js.map +1 -1
  123. package/lib/series/svg-line.d.ts.map +1 -1
  124. package/lib/series/svg-line.js +19 -3
  125. package/lib/series/svg-line.js.map +1 -1
  126. package/lib/series/svg-region-map.d.ts +4 -0
  127. package/lib/series/svg-region-map.d.ts.map +1 -0
  128. package/lib/series/svg-region-map.js +324 -0
  129. package/lib/series/svg-region-map.js.map +1 -0
  130. package/lib/series/webgl-line.d.ts.map +1 -1
  131. package/lib/series/webgl-line.js +10 -3
  132. package/lib/series/webgl-line.js.map +1 -1
  133. package/package.json +13 -2
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "kchart-korea-region-map-basic",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite --host 0.0.0.0",
8
+ "build": "vite build",
9
+ "preview": "vite preview --host 0.0.0.0"
10
+ },
11
+ "dependencies": {
12
+ "@keneth80/k-chart": "^1.11.0",
13
+ "typescript": "^6.0.3",
14
+ "vite": "^7.1.12"
15
+ },
16
+ "devDependencies": {}
17
+ }
@@ -0,0 +1,90 @@
1
+ import { createGeoRegionMapSeries, createKChart } from "@keneth80/k-chart";
2
+ import "./style.css";
3
+
4
+ type RegionDatum = {
5
+ name: string;
6
+ value: number;
7
+ color: string;
8
+ note: string;
9
+ };
10
+
11
+ const koreaRegions = {
12
+ type: "FeatureCollection",
13
+ features: [
14
+ { type: "Feature", properties: { name: "강원도" }, geometry: { type: "Polygon", coordinates: [[[127.35, 38.55], [129.42, 38.42], [129.35, 37.05], [128.45, 36.75], [127.25, 37.05], [127.35, 38.55]]] } },
15
+ { type: "Feature", properties: { name: "경기도" }, geometry: { type: "Polygon", coordinates: [[[126.34, 38.18], [127.68, 38.05], [127.72, 37.05], [126.92, 36.82], [126.32, 37.24], [126.34, 38.18]]] } },
16
+ { type: "Feature", properties: { name: "서울특별시" }, geometry: { type: "Polygon", coordinates: [[[126.78, 37.72], [127.18, 37.70], [127.18, 37.42], [126.80, 37.42], [126.78, 37.72]]] } },
17
+ { type: "Feature", properties: { name: "충청북도" }, geometry: { type: "Polygon", coordinates: [[[127.25, 37.15], [128.32, 36.9], [128.2, 36.1], [127.15, 35.92], [126.9, 36.72], [127.25, 37.15]]] } },
18
+ { type: "Feature", properties: { name: "충청남도" }, geometry: { type: "Polygon", coordinates: [[[126.1, 36.95], [127.1, 36.78], [127.2, 35.92], [126.15, 35.72], [125.8, 36.45], [126.1, 36.95]]] } },
19
+ { type: "Feature", properties: { name: "대전광역시" }, geometry: { type: "Polygon", coordinates: [[[127.25, 36.48], [127.55, 36.46], [127.55, 36.22], [127.24, 36.22], [127.25, 36.48]]] } },
20
+ { type: "Feature", properties: { name: "경상북도" }, geometry: { type: "Polygon", coordinates: [[[128.2, 36.85], [129.35, 36.95], [129.55, 35.55], [128.45, 35.25], [127.95, 36.05], [128.2, 36.85]]] } },
21
+ { type: "Feature", properties: { name: "대구광역시" }, geometry: { type: "Polygon", coordinates: [[[128.45, 35.98], [128.78, 35.95], [128.78, 35.72], [128.44, 35.72], [128.45, 35.98]]] } },
22
+ { type: "Feature", properties: { name: "전라북도" }, geometry: { type: "Polygon", coordinates: [[[126.35, 35.8], [127.65, 35.82], [127.75, 35.1], [126.35, 34.92], [126.0, 35.42], [126.35, 35.8]]] } },
23
+ { type: "Feature", properties: { name: "전라남도" }, geometry: { type: "Polygon", coordinates: [[[125.85, 35.0], [127.35, 35.05], [127.15, 34.22], [126.08, 33.95], [125.75, 34.48], [125.85, 35.0]]] } },
24
+ { type: "Feature", properties: { name: "광주광역시" }, geometry: { type: "Polygon", coordinates: [[[126.73, 35.28], [127.0, 35.26], [127.0, 35.06], [126.73, 35.06], [126.73, 35.28]]] } },
25
+ { type: "Feature", properties: { name: "경상남도" }, geometry: { type: "Polygon", coordinates: [[[127.55, 35.22], [128.88, 35.36], [129.25, 34.75], [128.1, 34.48], [127.35, 34.72], [127.55, 35.22]]] } },
26
+ { type: "Feature", properties: { name: "부산광역시" }, geometry: { type: "Polygon", coordinates: [[[129.0, 35.28], [129.28, 35.24], [129.28, 35.02], [129.02, 34.98], [129.0, 35.28]]] } },
27
+ { type: "Feature", properties: { name: "울산광역시" }, geometry: { type: "Polygon", coordinates: [[[129.18, 35.7], [129.48, 35.66], [129.48, 35.42], [129.18, 35.42], [129.18, 35.7]]] } },
28
+ { type: "Feature", properties: { name: "제주특별자치도" }, geometry: { type: "Polygon", coordinates: [[[126.1, 33.62], [126.95, 33.62], [126.95, 33.22], [126.1, 33.22], [126.1, 33.62]]] } }
29
+ ]
30
+ };
31
+
32
+ const data: RegionDatum[] = [
33
+ { name: "서울특별시", value: 92, color: "#2f73b8", note: "Capital area" },
34
+ { name: "경기도", value: 85, color: "#35995a", note: "Largest population" },
35
+ { name: "강원도", value: 48, color: "#e0005c", note: "Mountain tourism" },
36
+ { name: "충청북도", value: 52, color: "#65b946", note: "Inland region" },
37
+ { name: "충청남도", value: 58, color: "#41b434", note: "West coast" },
38
+ { name: "대전광역시", value: 66, color: "#2e9f68", note: "Science city" },
39
+ { name: "경상북도", value: 69, color: "#f05a1a", note: "Heritage route" },
40
+ { name: "대구광역시", value: 74, color: "#f36b21", note: "Metro city" },
41
+ { name: "전라북도", value: 57, color: "#8a1194", note: "Food route" },
42
+ { name: "전라남도", value: 63, color: "#38a6e8", note: "Island route" },
43
+ { name: "광주광역시", value: 61, color: "#36a8ee", note: "Culture city" },
44
+ { name: "경상남도", value: 71, color: "#55c2d6", note: "South coast" },
45
+ { name: "부산광역시", value: 82, color: "#202b84", note: "Harbor city" },
46
+ { name: "울산광역시", value: 67, color: "#5ecce0", note: "Industrial city" },
47
+ { name: "제주특별자치도", value: 79, color: "#72e4ff", note: "Island destination" }
48
+ ];
49
+
50
+ createKChart<RegionDatum>({
51
+ selector: "#chart",
52
+ data,
53
+ width: 1080,
54
+ height: 640,
55
+ margin: { top: 62, right: 36, bottom: 28, left: 36 },
56
+ title: { text: "Korea region choropleth", align: "left", fontSize: 15 },
57
+ grid: { visible: false },
58
+ legend: { visible: false },
59
+ tooltip: { visible: true },
60
+ axes: [],
61
+ series: [
62
+ createGeoRegionMapSeries<RegionDatum>({
63
+ selector: "korea-region",
64
+ displayName: "Korea Regions",
65
+ geoJson: koreaRegions,
66
+ dataKey: "name",
67
+ featureKey: "name",
68
+ labelKey: "name",
69
+ valueField: "value",
70
+ colorField: "color",
71
+ fitPadding: 44,
72
+ backgroundFill: "rgba(11, 16, 23, 0.26)",
73
+ stroke: "rgba(248, 251, 255, 0.92)",
74
+ strokeWidth: 1.4,
75
+ hoverStrokeWidth: 2.4,
76
+ labels: {
77
+ visible: true,
78
+ mode: "callout",
79
+ fill: "#edf3f8",
80
+ fontSize: 11,
81
+ offset: 18,
82
+ formatter: ({ label }) => label.replace("광역시", "").replace("특별시", "")
83
+ },
84
+ tooltip: {
85
+ formatter: ({ label, data: item, value }) =>
86
+ `<strong>${label}</strong><br/>score: ${value}<br/>${item?.note ?? ""}`
87
+ }
88
+ })
89
+ ]
90
+ }).render();
@@ -0,0 +1,57 @@
1
+ :root {
2
+ color-scheme: dark;
3
+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
4
+ background: #0b1017;
5
+ color: #edf3f8;
6
+ }
7
+
8
+ * {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ body {
13
+ margin: 0;
14
+ min-height: 100vh;
15
+ background:
16
+ radial-gradient(circle at 20% 10%, rgba(93, 184, 255, 0.16), transparent 30%),
17
+ linear-gradient(180deg, #17202b 0%, #0b1017 70%);
18
+ }
19
+
20
+ main {
21
+ min-height: 100vh;
22
+ display: grid;
23
+ place-items: center;
24
+ padding: 28px;
25
+ }
26
+
27
+ section {
28
+ width: min(1120px, 100%);
29
+ border: 1px solid rgba(219, 232, 242, 0.16);
30
+ border-radius: 12px;
31
+ background: rgba(21, 28, 38, 0.82);
32
+ box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
33
+ overflow: hidden;
34
+ }
35
+
36
+ section > div:first-child {
37
+ padding: 24px 28px 0;
38
+ }
39
+
40
+ p {
41
+ margin: 0 0 8px;
42
+ color: #8ea0ad;
43
+ font-size: 12px;
44
+ font-weight: 800;
45
+ text-transform: uppercase;
46
+ }
47
+
48
+ h1 {
49
+ margin: 0;
50
+ font-size: 26px;
51
+ }
52
+
53
+ #chart {
54
+ width: 100%;
55
+ min-height: 640px;
56
+ padding: 10px 16px 22px;
57
+ }
@@ -0,0 +1,23 @@
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 Line Basic</title>
7
+ </head>
8
+ <body>
9
+ <main class="page-shell">
10
+ <section class="intro">
11
+ <p class="eyebrow">StackBlitz starter</p>
12
+ <h1>KChart Line Basic</h1>
13
+ <p>Edit <code>src/main.ts</code> and the chart preview updates instantly.</p>
14
+ </section>
15
+
16
+ <section class="chart-panel">
17
+ <div id="chart"></div>
18
+ </section>
19
+ </main>
20
+
21
+ <script type="module" src="/src/main.ts"></script>
22
+ </body>
23
+ </html>