@keneth80/k-chart 1.26.0 → 1.27.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 +72 -0
- package/README.md +129 -1095
- package/docs/code-graph-handoff.md +19 -37
- package/docs/configuration-reference.md +8 -1
- package/docs/functional-api.md +77 -0
- package/docs/react-nextjs.md +62 -8
- package/docs/refactor-plan.md +39 -23
- package/docs/release.md +9 -4
- package/examples/stackblitz-calendar-heatmap-basic/index.html +37 -0
- package/examples/stackblitz-calendar-heatmap-basic/package-lock.json +1548 -0
- package/examples/stackblitz-calendar-heatmap-basic/package.json +18 -0
- package/examples/stackblitz-calendar-heatmap-basic/src/main.ts +172 -0
- package/examples/stackblitz-calendar-heatmap-basic/src/style.css +33 -0
- package/examples/stackblitz-calendar-heatmap-basic/src/vite-env.d.ts +1 -0
- package/examples/stackblitz-dual-axis-combo-basic/index.html +27 -0
- package/examples/stackblitz-dual-axis-combo-basic/package-lock.json +1548 -0
- package/examples/stackblitz-dual-axis-combo-basic/package.json +18 -0
- package/examples/stackblitz-dual-axis-combo-basic/src/main.ts +88 -0
- package/examples/stackblitz-dual-axis-combo-basic/src/style.css +31 -0
- package/examples/stackblitz-dual-axis-combo-basic/src/vite-env.d.ts +1 -0
- package/examples/stackblitz-hybrid-operations-dashboard/index.html +53 -0
- package/examples/stackblitz-hybrid-operations-dashboard/package-lock.json +1548 -0
- package/examples/stackblitz-hybrid-operations-dashboard/package.json +18 -0
- package/examples/stackblitz-hybrid-operations-dashboard/src/main.ts +181 -0
- package/examples/stackblitz-hybrid-operations-dashboard/src/style.css +52 -0
- package/examples/stackblitz-pareto-basic/index.html +22 -0
- package/examples/stackblitz-pareto-basic/package-lock.json +1548 -0
- package/examples/stackblitz-pareto-basic/package.json +18 -0
- package/examples/stackblitz-pareto-basic/src/main.ts +101 -0
- package/examples/stackblitz-pareto-basic/src/style.css +31 -0
- package/examples/stackblitz-pareto-basic/src/vite-env.d.ts +1 -0
- package/examples/stackblitz-simple-api-basic/package-lock.json +96 -4
- package/examples/stackblitz-simple-api-basic/package.json +1 -1
- package/examples/stackblitz-subcell-heatmap-basic/README.md +48 -0
- package/examples/stackblitz-subcell-heatmap-basic/index.html +13 -0
- package/examples/stackblitz-subcell-heatmap-basic/package-lock.json +1788 -0
- package/examples/stackblitz-subcell-heatmap-basic/package.json +23 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/app.ts +212 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/component.css +169 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/heatmap-demo-core.ts +505 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/heatmap-demo.ts +23 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/main.ts +15 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/maplibre-compat.ts +6 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/model.ts +242 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/raster.ts +121 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/style.css +15 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/synthetic.ts +72 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/vendor.d.ts +3 -0
- package/examples/stackblitz-subcell-heatmap-basic/src/vite-env.d.ts +1 -0
- package/examples/stackblitz-topology-basic/package-lock.json +96 -4
- package/examples/stackblitz-topology-basic/package.json +1 -1
- package/examples/stackblitz-us-transport-route/index.html +29 -0
- package/examples/stackblitz-us-transport-route/package.json +17 -0
- package/examples/stackblitz-us-transport-route/src/main.ts +211 -0
- package/examples/stackblitz-us-transport-route/src/style.css +178 -0
- package/examples/stackblitz-webgl-line-basic/package-lock.json +96 -4
- package/examples/stackblitz-webgl-line-basic/package.json +1 -1
- package/examples/stackblitz-world-activity-map/package.json +1 -1
- package/lib/core/contracts.d.ts +6 -2
- package/lib/core/contracts.d.ts.map +1 -1
- package/lib/series/svg-graph.d.ts +29 -0
- package/lib/series/svg-graph.d.ts.map +1 -1
- package/lib/series/svg-graph.js +509 -80
- package/lib/series/svg-graph.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kchart-stackblitz-dual-axis-combo-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 --noEmit && vite build",
|
|
9
|
+
"preview": "vite preview --host 0.0.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@keneth80/k-chart": "^1.26.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^6.0.3",
|
|
16
|
+
"vite": "^7.2.7"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createGroupedColumnSeries,
|
|
3
|
+
createKChart,
|
|
4
|
+
createLineSeries
|
|
5
|
+
} from '@keneth80/k-chart';
|
|
6
|
+
import './style.css';
|
|
7
|
+
|
|
8
|
+
interface PipelineMonth {
|
|
9
|
+
month: string;
|
|
10
|
+
pipeline: number;
|
|
11
|
+
winRate: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const data: PipelineMonth[] = [
|
|
15
|
+
{month: 'Jan', pipeline: 4.8, winRate: 31},
|
|
16
|
+
{month: 'Feb', pipeline: 5.3, winRate: 34},
|
|
17
|
+
{month: 'Mar', pipeline: 5.9, winRate: 38},
|
|
18
|
+
{month: 'Apr', pipeline: 5.5, winRate: 36},
|
|
19
|
+
{month: 'May', pipeline: 6.4, winRate: 41},
|
|
20
|
+
{month: 'Jun', pipeline: 6.9, winRate: 45},
|
|
21
|
+
{month: 'Jul', pipeline: 6.2, winRate: 43},
|
|
22
|
+
{month: 'Aug', pipeline: 7.1, winRate: 47},
|
|
23
|
+
{month: 'Sep', pipeline: 7.7, winRate: 51},
|
|
24
|
+
{month: 'Oct', pipeline: 7.4, winRate: 49},
|
|
25
|
+
{month: 'Nov', pipeline: 8.1, winRate: 54},
|
|
26
|
+
{month: 'Dec', pipeline: 8.6, winRate: 57}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const chart = createKChart<PipelineMonth>({
|
|
30
|
+
selector: '#chart',
|
|
31
|
+
data,
|
|
32
|
+
height: 470,
|
|
33
|
+
margin: {top: 86, right: 76, bottom: 56, left: 76},
|
|
34
|
+
title: {text: 'Pipeline and win rate', align: 'left', fontSize: 17},
|
|
35
|
+
grid: {visible: true, x: false, y: true, color: '#d9dee7', dasharray: '2 6'},
|
|
36
|
+
legend: {visible: true, placement: 'top', selectable: false, itemGap: 18},
|
|
37
|
+
tooltip: {
|
|
38
|
+
visible: true,
|
|
39
|
+
formatter: ({data: point, series, color}) => {
|
|
40
|
+
const value = series.yField === 'winRate'
|
|
41
|
+
? point.winRate + '%'
|
|
42
|
+
: '$' + point.pipeline.toFixed(1) + 'M';
|
|
43
|
+
return '<strong style="color:' + color + '">' + series.displayName + '</strong>' +
|
|
44
|
+
'<div>' + point.month + ': ' + value + '</div>';
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
axes: [
|
|
48
|
+
{field: 'month', type: 'string', placement: 'bottom', title: 'Month', tickCount: 6},
|
|
49
|
+
{
|
|
50
|
+
field: 'pipeline', type: 'number', placement: 'left', min: 0, max: 10,
|
|
51
|
+
title: 'Pipeline (USD millions)', tickCount: 6,
|
|
52
|
+
tickFormat: (value) => '$' + Number(value).toFixed(0) + 'M'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
field: 'winRate', type: 'number', placement: 'right', min: 0, max: 60,
|
|
56
|
+
title: 'Win rate', tickCount: 4,
|
|
57
|
+
tickFormat: (value) => Number(value).toFixed(0) + '%'
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
series: [
|
|
61
|
+
createGroupedColumnSeries<PipelineMonth>({
|
|
62
|
+
selector: 'qualified-pipeline',
|
|
63
|
+
displayName: 'Qualified pipeline ($M)',
|
|
64
|
+
xField: 'month',
|
|
65
|
+
segments: [{field: 'pipeline', label: 'Qualified pipeline ($M)', color: '#2463a7'}],
|
|
66
|
+
groupWidthRatio: 0.56,
|
|
67
|
+
opacity: 0.94,
|
|
68
|
+
radius: 3
|
|
69
|
+
}),
|
|
70
|
+
createLineSeries<PipelineMonth>({
|
|
71
|
+
selector: 'win-rate',
|
|
72
|
+
displayName: 'Win rate (%)',
|
|
73
|
+
xField: 'month',
|
|
74
|
+
yField: 'winRate',
|
|
75
|
+
color: '#d24f3f',
|
|
76
|
+
strokeWidth: 3,
|
|
77
|
+
curve: true,
|
|
78
|
+
dot: {radius: 4, fill: '#d24f3f', stroke: '#ffffff'}
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}).render();
|
|
82
|
+
|
|
83
|
+
const chartElement = document.querySelector<HTMLElement>('#chart');
|
|
84
|
+
if (chartElement) {
|
|
85
|
+
new ResizeObserver(() => chart.resize()).observe(chartElement);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
window.addEventListener('beforeunload', () => chart.destroy());
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
3
|
+
color: #182433;
|
|
4
|
+
background: #f3f5f7;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
* { box-sizing: border-box; }
|
|
8
|
+
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f5f7; }
|
|
9
|
+
.report-shell { width: min(1120px, calc(100vw - 32px)); margin: 0 auto; padding: 34px 0; }
|
|
10
|
+
.report-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
|
|
11
|
+
.eyebrow { margin: 0 0 7px; color: #2463a7; font-size: 12px; font-weight: 800; text-transform: uppercase; }
|
|
12
|
+
h1 { margin: 0; font-size: 34px; line-height: 1.12; }
|
|
13
|
+
.report-header p:last-child { margin: 10px 0 0; color: #5d6875; line-height: 1.55; }
|
|
14
|
+
.period { min-width: 132px; padding-left: 16px; border-left: 3px solid #d24f3f; }
|
|
15
|
+
.period span { display: block; color: #697480; font-size: 11px; }
|
|
16
|
+
.period strong { display: block; margin-top: 4px; font-size: 16px; }
|
|
17
|
+
.chart-panel { min-height: 510px; padding: 20px; overflow: hidden; border: 1px solid #d8dde5; border-radius: 8px; background: #ffffff; box-shadow: 0 16px 40px rgba(29, 44, 60, 0.08); }
|
|
18
|
+
#chart { width: 100%; height: 470px; }
|
|
19
|
+
#chart .kchart-svg text { font-family: inherit; }
|
|
20
|
+
#chart .domain, #chart .tick line { stroke: #aab3bf; }
|
|
21
|
+
#chart .tick text, #chart .kchart-axis-title { fill: #536170 !important; }
|
|
22
|
+
#chart .kchart-title { fill: #182433 !important; }
|
|
23
|
+
#chart .kchart-legend text { fill: #344454 !important; }
|
|
24
|
+
|
|
25
|
+
@media (max-width: 640px) {
|
|
26
|
+
.report-shell { width: calc(100vw - 20px); padding: 22px 0; }
|
|
27
|
+
.report-header { align-items: flex-start; flex-direction: column; gap: 14px; }
|
|
28
|
+
h1 { font-size: 28px; }
|
|
29
|
+
.chart-panel { min-height: 494px; padding: 8px; }
|
|
30
|
+
#chart { height: 470px; }
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,53 @@
|
|
|
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 Hybrid Operations Dashboard</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<main class="operations-dashboard">
|
|
10
|
+
<header class="operations-header">
|
|
11
|
+
<div>
|
|
12
|
+
<p>GLOBAL NETWORK / LIVE</p>
|
|
13
|
+
<h1>Operations control</h1>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="live-state"><i></i>Streaming normally</div>
|
|
16
|
+
</header>
|
|
17
|
+
|
|
18
|
+
<section class="kpi-strip" aria-label="Operations KPIs">
|
|
19
|
+
<article><span>ACTIVE REGIONS</span><strong>18</strong><small>3 continents</small></article>
|
|
20
|
+
<article><span>THROUGHPUT</span><strong>8.42</strong><small>Tb/s · +4.8%</small></article>
|
|
21
|
+
<article><span>GLOBAL SLA</span><strong>99.992%</strong><small>rolling 24h</small></article>
|
|
22
|
+
<article class="critical"><span>OPEN INCIDENTS</span><strong>3</strong><small>1 critical</small></article>
|
|
23
|
+
</section>
|
|
24
|
+
|
|
25
|
+
<section class="operations-main">
|
|
26
|
+
<div class="telemetry-panel">
|
|
27
|
+
<header class="section-heading">
|
|
28
|
+
<div><span>GLOBAL TELEMETRY</span><strong>Throughput and operating baseline</strong></div>
|
|
29
|
+
<div class="renderer-key" aria-label="Renderer layers">
|
|
30
|
+
<span class="webgl"><b>WebGL</b>14K points</span>
|
|
31
|
+
<span class="canvas"><b>Canvas</b>SLA baseline</span>
|
|
32
|
+
<span class="svg"><b>SVG</b>3 incidents</span>
|
|
33
|
+
</div>
|
|
34
|
+
</header>
|
|
35
|
+
<div id="chart" aria-label="Hybrid renderer telemetry chart"></div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<aside class="incident-panel">
|
|
39
|
+
<header class="section-heading">
|
|
40
|
+
<div><span>INCIDENT FEED</span><strong>Needs attention</strong></div>
|
|
41
|
+
<b>03</b>
|
|
42
|
+
</header>
|
|
43
|
+
<div id="incident-list" class="incident-list"></div>
|
|
44
|
+
<footer>
|
|
45
|
+
<span>Worker queue</span><strong>0 pending</strong>
|
|
46
|
+
<span>Frame delivery</span><strong>100%</strong>
|
|
47
|
+
</footer>
|
|
48
|
+
</aside>
|
|
49
|
+
</section>
|
|
50
|
+
</main>
|
|
51
|
+
<script type="module" src="/src/main.ts"></script>
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|