@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,211 @@
|
|
|
1
|
+
import maplibregl, { type Map } from "maplibre-gl";
|
|
2
|
+
import "maplibre-gl/dist/maplibre-gl.css";
|
|
3
|
+
import "./style.css";
|
|
4
|
+
|
|
5
|
+
type Stop = {
|
|
6
|
+
id: string;
|
|
7
|
+
order: number;
|
|
8
|
+
name: string;
|
|
9
|
+
coordinates: [number, number];
|
|
10
|
+
role: "start" | "waypoint" | "transfer" | "arrival";
|
|
11
|
+
detail: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Route = {
|
|
15
|
+
id: string;
|
|
16
|
+
mode: "sea" | "road" | "rail" | "air";
|
|
17
|
+
label: string;
|
|
18
|
+
color: string;
|
|
19
|
+
badge: string;
|
|
20
|
+
points: [number, number][];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const stops: Stop[] = [
|
|
24
|
+
{ id: "seattle", order: 1, name: "Seattle", coordinates: [-122.3321, 47.6062], role: "start", detail: "Pacific origin terminal" },
|
|
25
|
+
{ id: "san-francisco", order: 2, name: "San Francisco", coordinates: [-122.4194, 37.7749], role: "waypoint", detail: "Sea-to-road transfer" },
|
|
26
|
+
{ id: "denver", order: 3, name: "Denver", coordinates: [-104.9903, 39.7392], role: "transfer", detail: "Road-to-rail transfer" },
|
|
27
|
+
{ id: "chicago", order: 4, name: "Chicago", coordinates: [-87.6298, 41.8781], role: "transfer", detail: "Rail-to-air transfer" },
|
|
28
|
+
{ id: "new-york", order: 5, name: "New York", coordinates: [-74.006, 40.7128], role: "arrival", detail: "East Coast destination" }
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const routes: Route[] = [
|
|
32
|
+
{
|
|
33
|
+
id: "pacific-sea",
|
|
34
|
+
mode: "sea",
|
|
35
|
+
label: "Coastal shipping",
|
|
36
|
+
color: "#22d3ee",
|
|
37
|
+
badge: "SEA",
|
|
38
|
+
points: [[-122.3321, 47.6062], [-125.1, 44.8], [-124.7, 41.3], [-122.4194, 37.7749]]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "western-road",
|
|
42
|
+
mode: "road",
|
|
43
|
+
label: "Interstate road",
|
|
44
|
+
color: "#f59e0b",
|
|
45
|
+
badge: "ROAD",
|
|
46
|
+
points: [[-122.4194, 37.7749], [-118.8, 38.8], [-113.5, 40.2], [-109.2, 39.5], [-104.9903, 39.7392]]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "central-rail",
|
|
50
|
+
mode: "rail",
|
|
51
|
+
label: "Freight rail",
|
|
52
|
+
color: "#34d399",
|
|
53
|
+
badge: "RAIL",
|
|
54
|
+
points: [[-104.9903, 39.7392], [-100.4, 40.1], [-95.9, 41.2], [-91.5, 41.5], [-87.6298, 41.8781]]
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "eastern-air",
|
|
58
|
+
mode: "air",
|
|
59
|
+
label: "Express air",
|
|
60
|
+
color: "#a78bfa",
|
|
61
|
+
badge: "AIR",
|
|
62
|
+
points: [[-87.6298, 41.8781], [-74.006, 40.7128]]
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const stopColors: Record<Stop["role"], string> = {
|
|
67
|
+
start: "#22c55e",
|
|
68
|
+
waypoint: "#38bdf8",
|
|
69
|
+
transfer: "#f59e0b",
|
|
70
|
+
arrival: "#fb7185"
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const lab = document.querySelector<HTMLElement>(".route-lab");
|
|
74
|
+
const mapContainer = document.querySelector<HTMLElement>("#map");
|
|
75
|
+
const overlay = document.querySelector<SVGSVGElement>("#route-overlay");
|
|
76
|
+
const legend = document.querySelector<HTMLElement>("#route-legend");
|
|
77
|
+
const callout = document.querySelector<HTMLElement>("#route-callout");
|
|
78
|
+
const animationToggle = document.querySelector<HTMLButtonElement>("#animation-toggle");
|
|
79
|
+
|
|
80
|
+
if (!lab || !mapContainer || !overlay || !legend || !callout || !animationToggle) {
|
|
81
|
+
throw new Error("The route example container is incomplete.");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const svgNode = <K extends keyof SVGElementTagNameMap>(name: K): SVGElementTagNameMap[K] =>
|
|
85
|
+
document.createElementNS("http://www.w3.org/2000/svg", name);
|
|
86
|
+
|
|
87
|
+
const projectPath = (map: Map, route: Route): string => {
|
|
88
|
+
const projected = route.points.map((coordinates) => map.project(coordinates));
|
|
89
|
+
if (route.mode === "air") {
|
|
90
|
+
const [start, end] = projected;
|
|
91
|
+
const lift = Math.min(72, Math.abs(end.x - start.x) * 0.14);
|
|
92
|
+
return `M ${start.x} ${start.y} Q ${(start.x + end.x) / 2} ${Math.min(start.y, end.y) - lift} ${end.x} ${end.y}`;
|
|
93
|
+
}
|
|
94
|
+
return projected.map((point, index) => `${index ? "L" : "M"} ${point.x} ${point.y}`).join(" ");
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const showStop = (stop: Stop) => {
|
|
98
|
+
callout.replaceChildren();
|
|
99
|
+
const number = document.createElement("i");
|
|
100
|
+
number.style.backgroundColor = stopColors[stop.role];
|
|
101
|
+
number.textContent = String(stop.order);
|
|
102
|
+
const content = document.createElement("div");
|
|
103
|
+
const name = document.createElement("strong");
|
|
104
|
+
name.textContent = stop.name;
|
|
105
|
+
const detail = document.createElement("span");
|
|
106
|
+
detail.textContent = stop.detail;
|
|
107
|
+
content.append(name, detail);
|
|
108
|
+
callout.append(number, content);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
legend.innerHTML = `<strong>Transport modes</strong>${routes.map((route) => `
|
|
112
|
+
<div><i style="background:${route.color}"></i><b>${route.badge}</b><span>${route.label}</span></div>
|
|
113
|
+
`).join("")}`;
|
|
114
|
+
showStop(stops[3]);
|
|
115
|
+
|
|
116
|
+
const map = new maplibregl.Map({
|
|
117
|
+
container: mapContainer,
|
|
118
|
+
style: "https://tiles.openfreemap.org/styles/liberty",
|
|
119
|
+
bounds: [[-127.5, 32], [-69, 51.5]],
|
|
120
|
+
fitBoundsOptions: {
|
|
121
|
+
padding: { top: 76, right: 72, bottom: 46, left: 64 },
|
|
122
|
+
duration: 0
|
|
123
|
+
},
|
|
124
|
+
minZoom: 2.2,
|
|
125
|
+
maxZoom: 8,
|
|
126
|
+
attributionControl: { compact: true }
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
map.addControl(new maplibregl.NavigationControl({ showCompass: false }), "bottom-right");
|
|
130
|
+
|
|
131
|
+
const renderOverlay = () => {
|
|
132
|
+
const { width, height } = mapContainer.getBoundingClientRect();
|
|
133
|
+
overlay.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
134
|
+
overlay.replaceChildren();
|
|
135
|
+
|
|
136
|
+
routes.forEach((route) => {
|
|
137
|
+
const pathData = projectPath(map, route);
|
|
138
|
+
const path = svgNode("path");
|
|
139
|
+
path.setAttribute("d", pathData);
|
|
140
|
+
path.setAttribute("class", `route-path route-path-${route.mode}`);
|
|
141
|
+
path.setAttribute("stroke", route.color);
|
|
142
|
+
path.setAttribute("vector-effect", "non-scaling-stroke");
|
|
143
|
+
const flow = svgNode("path");
|
|
144
|
+
flow.setAttribute("d", pathData);
|
|
145
|
+
flow.setAttribute("class", "route-flow");
|
|
146
|
+
flow.setAttribute("vector-effect", "non-scaling-stroke");
|
|
147
|
+
overlay.append(path, flow);
|
|
148
|
+
|
|
149
|
+
const middle = map.project(route.points[Math.floor(route.points.length / 2)]);
|
|
150
|
+
const badge = svgNode("g");
|
|
151
|
+
badge.setAttribute("class", "route-mode-badge");
|
|
152
|
+
badge.setAttribute("transform", `translate(${middle.x} ${middle.y})`);
|
|
153
|
+
const circle = svgNode("circle");
|
|
154
|
+
circle.setAttribute("r", "20");
|
|
155
|
+
circle.setAttribute("fill", route.color);
|
|
156
|
+
const text = svgNode("text");
|
|
157
|
+
text.setAttribute("text-anchor", "middle");
|
|
158
|
+
text.setAttribute("dy", "4");
|
|
159
|
+
text.textContent = route.badge;
|
|
160
|
+
badge.append(circle, text);
|
|
161
|
+
overlay.append(badge);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
stops.forEach((stop) => {
|
|
165
|
+
const point = map.project(stop.coordinates);
|
|
166
|
+
const marker = svgNode("g");
|
|
167
|
+
marker.setAttribute("class", "route-stop");
|
|
168
|
+
marker.setAttribute("transform", `translate(${point.x} ${point.y})`);
|
|
169
|
+
marker.setAttribute("role", "button");
|
|
170
|
+
marker.setAttribute("tabindex", "0");
|
|
171
|
+
marker.setAttribute("aria-label", `${stop.order}. ${stop.name}: ${stop.detail}`);
|
|
172
|
+
const pin = svgNode("path");
|
|
173
|
+
pin.setAttribute("d", "M 0 18 C -5 11 -14 2 -14 -8 A 14 14 0 1 1 14 -8 C 14 2 5 11 0 18 Z");
|
|
174
|
+
pin.setAttribute("fill", stopColors[stop.role]);
|
|
175
|
+
const number = svgNode("text");
|
|
176
|
+
number.setAttribute("text-anchor", "middle");
|
|
177
|
+
number.setAttribute("dy", "-3");
|
|
178
|
+
number.textContent = String(stop.order);
|
|
179
|
+
const label = svgNode("text");
|
|
180
|
+
label.setAttribute("class", "route-stop-label");
|
|
181
|
+
label.setAttribute("x", "19");
|
|
182
|
+
label.setAttribute("dy", "5");
|
|
183
|
+
label.textContent = stop.name;
|
|
184
|
+
marker.append(pin, number, label);
|
|
185
|
+
marker.addEventListener("click", () => showStop(stop));
|
|
186
|
+
marker.addEventListener("keydown", (event) => {
|
|
187
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
showStop(stop);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
overlay.append(marker);
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
map.on("load", renderOverlay);
|
|
197
|
+
map.on("move", renderOverlay);
|
|
198
|
+
map.on("resize", renderOverlay);
|
|
199
|
+
new ResizeObserver(() => {
|
|
200
|
+
map.resize();
|
|
201
|
+
renderOverlay();
|
|
202
|
+
}).observe(mapContainer);
|
|
203
|
+
|
|
204
|
+
animationToggle.addEventListener("click", () => {
|
|
205
|
+
const isAnimating = lab.classList.toggle("is-route-animating");
|
|
206
|
+
animationToggle.setAttribute("aria-pressed", String(isAnimating));
|
|
207
|
+
const icon = animationToggle.querySelector("i");
|
|
208
|
+
if (icon) {
|
|
209
|
+
icon.textContent = isAnimating ? "II" : ">";
|
|
210
|
+
}
|
|
211
|
+
});
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@500;700;800&display=swap");
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
font-family: Inter, ui-sans-serif, system-ui, sans-serif;
|
|
5
|
+
color: #edf3f8;
|
|
6
|
+
background: #07111b;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
* { box-sizing: border-box; }
|
|
10
|
+
html, body { width: 100%; height: 100%; margin: 0; }
|
|
11
|
+
button { font: inherit; }
|
|
12
|
+
|
|
13
|
+
.route-lab {
|
|
14
|
+
position: relative;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
min-height: 560px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
background: #0b1722;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.route-map,
|
|
23
|
+
.route-overlay {
|
|
24
|
+
position: absolute;
|
|
25
|
+
inset: 0;
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.route-overlay {
|
|
31
|
+
z-index: 2;
|
|
32
|
+
pointer-events: none;
|
|
33
|
+
overflow: visible;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.route-path {
|
|
37
|
+
fill: none;
|
|
38
|
+
stroke-width: 7;
|
|
39
|
+
stroke-linecap: round;
|
|
40
|
+
stroke-linejoin: round;
|
|
41
|
+
filter: drop-shadow(0 2px 4px rgba(3, 10, 18, .62));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.route-path-air { stroke-dasharray: 12 9; }
|
|
45
|
+
|
|
46
|
+
.route-flow {
|
|
47
|
+
fill: none;
|
|
48
|
+
stroke: rgba(255, 255, 255, .9);
|
|
49
|
+
stroke-width: 2;
|
|
50
|
+
stroke-linecap: round;
|
|
51
|
+
stroke-dasharray: 3 20;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.is-route-animating .route-flow { animation: route-flow 1.15s linear infinite; }
|
|
55
|
+
@keyframes route-flow { to { stroke-dashoffset: -46; } }
|
|
56
|
+
|
|
57
|
+
.route-mode-badge text,
|
|
58
|
+
.route-stop text {
|
|
59
|
+
fill: #fff;
|
|
60
|
+
font-size: 10px;
|
|
61
|
+
font-weight: 800;
|
|
62
|
+
paint-order: stroke;
|
|
63
|
+
stroke: rgba(6, 16, 25, .72);
|
|
64
|
+
stroke-width: 2px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.route-mode-badge circle {
|
|
68
|
+
stroke: #fff;
|
|
69
|
+
stroke-width: 2px;
|
|
70
|
+
filter: drop-shadow(0 4px 8px rgba(3, 10, 18, .42));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.route-stop { pointer-events: auto; cursor: pointer; outline: none; }
|
|
74
|
+
.route-stop path { stroke: #fff; stroke-width: 3px; filter: drop-shadow(0 3px 5px rgba(3, 10, 18, .58)); }
|
|
75
|
+
.route-stop:hover path, .route-stop:focus path { stroke-width: 5px; }
|
|
76
|
+
.route-stop .route-stop-label { font-size: 12px; stroke-width: 3px; }
|
|
77
|
+
|
|
78
|
+
.route-toolbar,
|
|
79
|
+
.route-legend,
|
|
80
|
+
.route-callout {
|
|
81
|
+
position: absolute;
|
|
82
|
+
z-index: 4;
|
|
83
|
+
border: 1px solid rgba(231, 241, 248, .22);
|
|
84
|
+
border-radius: 8px;
|
|
85
|
+
background: rgba(7, 17, 27, .87);
|
|
86
|
+
box-shadow: 0 12px 34px rgba(2, 8, 15, .26);
|
|
87
|
+
backdrop-filter: blur(12px);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.route-toolbar {
|
|
91
|
+
top: 14px;
|
|
92
|
+
right: 14px;
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
gap: 22px;
|
|
96
|
+
padding: 10px 11px 10px 14px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.route-toolbar > div, .route-callout > div { display: grid; gap: 2px; }
|
|
100
|
+
.route-toolbar strong, .route-legend strong, .route-callout strong { color: #f8fbff; font-size: 13px; }
|
|
101
|
+
.route-toolbar span, .route-callout span { color: #a8bac7; font-size: 11px; }
|
|
102
|
+
|
|
103
|
+
#animation-toggle {
|
|
104
|
+
display: inline-flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: 8px;
|
|
107
|
+
min-height: 34px;
|
|
108
|
+
border: 1px solid rgba(143, 216, 255, .3);
|
|
109
|
+
border-radius: 7px;
|
|
110
|
+
background: rgba(93, 184, 255, .15);
|
|
111
|
+
color: #e9f7ff;
|
|
112
|
+
padding: 7px 10px;
|
|
113
|
+
font-size: 11px;
|
|
114
|
+
font-weight: 800;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#animation-toggle i {
|
|
118
|
+
display: grid;
|
|
119
|
+
width: 19px;
|
|
120
|
+
height: 19px;
|
|
121
|
+
place-items: center;
|
|
122
|
+
border-radius: 50%;
|
|
123
|
+
background: #5db8ff;
|
|
124
|
+
color: #07111b;
|
|
125
|
+
font-size: 8px;
|
|
126
|
+
font-style: normal;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.route-legend {
|
|
130
|
+
left: 14px;
|
|
131
|
+
bottom: 14px;
|
|
132
|
+
display: grid;
|
|
133
|
+
gap: 8px;
|
|
134
|
+
width: 180px;
|
|
135
|
+
padding: 13px 14px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.route-legend > div {
|
|
139
|
+
display: grid;
|
|
140
|
+
grid-template-columns: 22px 38px minmax(0, 1fr);
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: 5px;
|
|
143
|
+
color: #b8c8d2;
|
|
144
|
+
font-size: 10px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.route-legend i { width: 20px; height: 4px; border-radius: 2px; }
|
|
148
|
+
.route-legend b { color: #f8fbff; font-size: 9px; }
|
|
149
|
+
|
|
150
|
+
.route-callout {
|
|
151
|
+
top: 78px;
|
|
152
|
+
right: 14px;
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
gap: 10px;
|
|
156
|
+
min-width: 190px;
|
|
157
|
+
padding: 10px 12px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.route-callout > i {
|
|
161
|
+
display: grid;
|
|
162
|
+
width: 29px;
|
|
163
|
+
height: 29px;
|
|
164
|
+
place-items: center;
|
|
165
|
+
border-radius: 50%;
|
|
166
|
+
color: #07111b;
|
|
167
|
+
font-size: 12px;
|
|
168
|
+
font-style: normal;
|
|
169
|
+
font-weight: 900;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (max-width: 680px) {
|
|
173
|
+
.route-toolbar { left: 8px; right: 8px; top: 8px; justify-content: space-between; }
|
|
174
|
+
.route-toolbar > div span, .route-callout span { display: none; }
|
|
175
|
+
.route-legend { left: 8px; bottom: 8px; width: 140px; padding: 10px; }
|
|
176
|
+
.route-legend > div { grid-template-columns: 18px 30px minmax(0, 1fr); gap: 3px; }
|
|
177
|
+
.route-callout { top: 60px; right: 8px; min-width: 0; }
|
|
178
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"name": "kchart-stackblitz-webgl-line-basic",
|
|
9
9
|
"version": "0.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@keneth80/k-chart": "^1.
|
|
11
|
+
"@keneth80/k-chart": "^1.26.1"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"typescript": "^6.0.3",
|
|
@@ -458,14 +458,18 @@
|
|
|
458
458
|
}
|
|
459
459
|
},
|
|
460
460
|
"node_modules/@keneth80/k-chart": {
|
|
461
|
-
"version": "1.
|
|
462
|
-
"resolved": "https://registry.npmjs.org/@keneth80/k-chart/-/k-chart-1.
|
|
463
|
-
"integrity": "sha512-
|
|
461
|
+
"version": "1.26.1",
|
|
462
|
+
"resolved": "https://registry.npmjs.org/@keneth80/k-chart/-/k-chart-1.26.1.tgz",
|
|
463
|
+
"integrity": "sha512-UbAabIe1bsN0oXCecT7HWbJaHc2Mgu7F+aO6iT0v+ukEwKB91xCX5sLcOEsCiLcmXGcWe6UDwym6zhpojowuMg==",
|
|
464
464
|
"license": "MIT",
|
|
465
465
|
"dependencies": {
|
|
466
466
|
"d3-array": "^3.2.4",
|
|
467
467
|
"d3-axis": "^3.0.0",
|
|
468
|
+
"d3-brush": "^3.0.0",
|
|
469
|
+
"d3-force": "^3.0.0",
|
|
468
470
|
"d3-geo": "^3.1.1",
|
|
471
|
+
"d3-hierarchy": "^3.1.2",
|
|
472
|
+
"d3-sankey": "^0.12.3",
|
|
469
473
|
"d3-scale": "^4.0.2",
|
|
470
474
|
"d3-scale-chromatic": "^3.1.0",
|
|
471
475
|
"d3-selection": "^3.0.0",
|
|
@@ -898,6 +902,22 @@
|
|
|
898
902
|
"node": ">=12"
|
|
899
903
|
}
|
|
900
904
|
},
|
|
905
|
+
"node_modules/d3-brush": {
|
|
906
|
+
"version": "3.0.0",
|
|
907
|
+
"resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz",
|
|
908
|
+
"integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==",
|
|
909
|
+
"license": "ISC",
|
|
910
|
+
"dependencies": {
|
|
911
|
+
"d3-dispatch": "1 - 3",
|
|
912
|
+
"d3-drag": "2 - 3",
|
|
913
|
+
"d3-interpolate": "1 - 3",
|
|
914
|
+
"d3-selection": "3",
|
|
915
|
+
"d3-transition": "3"
|
|
916
|
+
},
|
|
917
|
+
"engines": {
|
|
918
|
+
"node": ">=12"
|
|
919
|
+
}
|
|
920
|
+
},
|
|
901
921
|
"node_modules/d3-color": {
|
|
902
922
|
"version": "3.1.0",
|
|
903
923
|
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
|
|
@@ -938,6 +958,20 @@
|
|
|
938
958
|
"node": ">=12"
|
|
939
959
|
}
|
|
940
960
|
},
|
|
961
|
+
"node_modules/d3-force": {
|
|
962
|
+
"version": "3.0.0",
|
|
963
|
+
"resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz",
|
|
964
|
+
"integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==",
|
|
965
|
+
"license": "ISC",
|
|
966
|
+
"dependencies": {
|
|
967
|
+
"d3-dispatch": "1 - 3",
|
|
968
|
+
"d3-quadtree": "1 - 3",
|
|
969
|
+
"d3-timer": "1 - 3"
|
|
970
|
+
},
|
|
971
|
+
"engines": {
|
|
972
|
+
"node": ">=12"
|
|
973
|
+
}
|
|
974
|
+
},
|
|
941
975
|
"node_modules/d3-format": {
|
|
942
976
|
"version": "3.1.2",
|
|
943
977
|
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz",
|
|
@@ -959,6 +993,15 @@
|
|
|
959
993
|
"node": ">=12"
|
|
960
994
|
}
|
|
961
995
|
},
|
|
996
|
+
"node_modules/d3-hierarchy": {
|
|
997
|
+
"version": "3.1.2",
|
|
998
|
+
"resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz",
|
|
999
|
+
"integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==",
|
|
1000
|
+
"license": "ISC",
|
|
1001
|
+
"engines": {
|
|
1002
|
+
"node": ">=12"
|
|
1003
|
+
}
|
|
1004
|
+
},
|
|
962
1005
|
"node_modules/d3-interpolate": {
|
|
963
1006
|
"version": "3.0.1",
|
|
964
1007
|
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
|
|
@@ -980,6 +1023,55 @@
|
|
|
980
1023
|
"node": ">=12"
|
|
981
1024
|
}
|
|
982
1025
|
},
|
|
1026
|
+
"node_modules/d3-quadtree": {
|
|
1027
|
+
"version": "3.0.1",
|
|
1028
|
+
"resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz",
|
|
1029
|
+
"integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==",
|
|
1030
|
+
"license": "ISC",
|
|
1031
|
+
"engines": {
|
|
1032
|
+
"node": ">=12"
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
"node_modules/d3-sankey": {
|
|
1036
|
+
"version": "0.12.3",
|
|
1037
|
+
"resolved": "https://registry.npmjs.org/d3-sankey/-/d3-sankey-0.12.3.tgz",
|
|
1038
|
+
"integrity": "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==",
|
|
1039
|
+
"license": "BSD-3-Clause",
|
|
1040
|
+
"dependencies": {
|
|
1041
|
+
"d3-array": "1 - 2",
|
|
1042
|
+
"d3-shape": "^1.2.0"
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
"node_modules/d3-sankey/node_modules/d3-array": {
|
|
1046
|
+
"version": "2.12.1",
|
|
1047
|
+
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz",
|
|
1048
|
+
"integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==",
|
|
1049
|
+
"license": "BSD-3-Clause",
|
|
1050
|
+
"dependencies": {
|
|
1051
|
+
"internmap": "^1.0.0"
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
"node_modules/d3-sankey/node_modules/d3-path": {
|
|
1055
|
+
"version": "1.0.9",
|
|
1056
|
+
"resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz",
|
|
1057
|
+
"integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==",
|
|
1058
|
+
"license": "BSD-3-Clause"
|
|
1059
|
+
},
|
|
1060
|
+
"node_modules/d3-sankey/node_modules/d3-shape": {
|
|
1061
|
+
"version": "1.3.7",
|
|
1062
|
+
"resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz",
|
|
1063
|
+
"integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==",
|
|
1064
|
+
"license": "BSD-3-Clause",
|
|
1065
|
+
"dependencies": {
|
|
1066
|
+
"d3-path": "1"
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
"node_modules/d3-sankey/node_modules/internmap": {
|
|
1070
|
+
"version": "1.0.1",
|
|
1071
|
+
"resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz",
|
|
1072
|
+
"integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==",
|
|
1073
|
+
"license": "ISC"
|
|
1074
|
+
},
|
|
983
1075
|
"node_modules/d3-scale": {
|
|
984
1076
|
"version": "4.0.2",
|
|
985
1077
|
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
|
package/lib/core/contracts.d.ts
CHANGED
|
@@ -314,7 +314,7 @@ export interface KChartWaterfallSeriesConfiguration<T = any> {
|
|
|
314
314
|
showZero?: boolean;
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
export type KChartGraphLayout = 'force' | 'circular';
|
|
317
|
+
export type KChartGraphLayout = 'force' | 'circular' | 'layered';
|
|
318
318
|
export type KChartGraphRoamMode = 'move' | 'scale' | 'both' | 'disabled';
|
|
319
319
|
export type KChartGraphSelectMode = 'single' | 'multiple' | 'disabled';
|
|
320
320
|
export type KChartGraphEdgeSymbols = 'none-none' | 'none-arrow' | 'circle-circle' | 'circle-arrow';
|
|
@@ -349,20 +349,24 @@ export interface KChartGraphSeriesConfiguration<T = any> {
|
|
|
349
349
|
categoryField?: keyof T & string;
|
|
350
350
|
categorySide?: 'source' | 'target' | 'both';
|
|
351
351
|
layout?: KChartGraphLayout;
|
|
352
|
+
nodeRank?: number | ((node: KChartGraphNode<T>, index: number) => number);
|
|
352
353
|
directed?: boolean;
|
|
353
354
|
edgeSymbols?: KChartGraphEdgeSymbols;
|
|
354
355
|
color?: string;
|
|
355
356
|
palette?: string[];
|
|
357
|
+
nodeColor?: string | ((node: KChartGraphNode<T>, index: number) => string);
|
|
356
358
|
nodeMinRadius?: number;
|
|
357
359
|
nodeMaxRadius?: number;
|
|
358
360
|
nodeStroke?: string;
|
|
359
361
|
nodeStrokeWidth?: number;
|
|
360
362
|
nodeOpacity?: number;
|
|
361
|
-
edgeColor?: string;
|
|
363
|
+
edgeColor?: string | ((edge: KChartGraphEdge<T>, index: number) => string);
|
|
364
|
+
edgeDash?: string | null | ((edge: KChartGraphEdge<T>, index: number) => string | null);
|
|
362
365
|
edgeMinWidth?: number;
|
|
363
366
|
edgeMaxWidth?: number;
|
|
364
367
|
edgeOpacity?: number;
|
|
365
368
|
chargeStrength?: number;
|
|
369
|
+
gravity?: number;
|
|
366
370
|
linkDistance?: number;
|
|
367
371
|
collisionPadding?: number;
|
|
368
372
|
iterations?: number;
|