@cfasim-ui/charts 0.3.18 → 0.4.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/dist/BarChart/BarChart.d.ts +131 -0
- package/dist/BarChart/BarChart.spec.d.ts +1 -0
- package/dist/BarChart/BarChart.test.d.ts +1 -0
- package/dist/LineChart/LineChart.d.ts +2 -1
- package/dist/_shared/axes.d.ts +18 -0
- package/dist/_shared/axes.test.d.ts +1 -0
- package/dist/_shared/computeTicks.d.ts +21 -0
- package/dist/_shared/computeTicks.test.d.ts +1 -0
- package/dist/_shared/index.d.ts +7 -0
- package/dist/_shared/seriesCsv.d.ts +20 -0
- package/dist/_shared/seriesCsv.test.d.ts +1 -0
- package/dist/_shared/useChartMenu.d.ts +22 -0
- package/dist/_shared/useChartPadding.d.ts +26 -0
- package/dist/_shared/useChartSize.d.ts +16 -0
- package/dist/_shared/useChartTooltip.d.ts +66 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1201 -618
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l,
|
|
2
|
-
import { DropdownMenuContent as
|
|
3
|
-
import { geoAlbersUsa as
|
|
4
|
-
import { zoom as
|
|
5
|
-
import { select as
|
|
6
|
-
import { feature as
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, mergeProps as u, normalizeClass as d, normalizeProps as f, normalizeStyle as p, onMounted as ee, onUnmounted as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, toHandlers as te, toRaw as b, unref as x, useId as S, watch as ne, withCtx as C } from "vue";
|
|
2
|
+
import { DropdownMenuContent as w, DropdownMenuItem as T, DropdownMenuPortal as re, DropdownMenuRoot as E, DropdownMenuTrigger as D, PopoverAnchor as O, PopoverContent as k, PopoverPortal as A, PopoverRoot as j } from "reka-ui";
|
|
3
|
+
import { geoAlbersUsa as M, geoPath as ie } from "d3-geo";
|
|
4
|
+
import { zoom as N } from "d3-zoom";
|
|
5
|
+
import { select as P } from "d3-selection";
|
|
6
|
+
import { feature as F, merge as ae, mesh as oe } from "topojson-client";
|
|
7
7
|
//#region src/ChartMenu/ChartMenu.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var
|
|
8
|
+
var I = { class: "chart-menu-trigger-area" }, L = ["aria-label"], se = /* @__PURE__ */ c({
|
|
9
9
|
__name: "ChartMenu",
|
|
10
10
|
props: { items: {} },
|
|
11
11
|
setup(t) {
|
|
12
|
-
return (r, c) => (
|
|
12
|
+
return (r, c) => (h(), i("div", I, [t.items.length === 1 ? (h(), i("button", {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "chart-menu-button chart-menu-single",
|
|
15
15
|
"aria-label": t.items[0].label,
|
|
@@ -24,15 +24,15 @@ var P = { class: "chart-menu-trigger-area" }, ce = ["aria-label"], F = /* @__PUR
|
|
|
24
24
|
"stroke-linecap": "round",
|
|
25
25
|
"stroke-linejoin": "round",
|
|
26
26
|
"aria-hidden": "true"
|
|
27
|
-
}, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8,
|
|
27
|
+
}, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8, L)) : (h(), n(x(E), {
|
|
28
28
|
key: 1,
|
|
29
29
|
modal: !1
|
|
30
30
|
}, {
|
|
31
|
-
default:
|
|
31
|
+
default: C(() => [s(x(D), {
|
|
32
32
|
class: "chart-menu-button",
|
|
33
33
|
"aria-label": "Chart options"
|
|
34
34
|
}, {
|
|
35
|
-
default:
|
|
35
|
+
default: C(() => [...c[2] ||= [a("svg", {
|
|
36
36
|
width: "16",
|
|
37
37
|
height: "16",
|
|
38
38
|
viewBox: "0 0 16 16",
|
|
@@ -56,18 +56,18 @@ var P = { class: "chart-menu-trigger-area" }, ce = ["aria-label"], F = /* @__PUR
|
|
|
56
56
|
})
|
|
57
57
|
], -1)]]),
|
|
58
58
|
_: 1
|
|
59
|
-
}), s(
|
|
60
|
-
default:
|
|
59
|
+
}), s(x(re), null, {
|
|
60
|
+
default: C(() => [s(x(w), {
|
|
61
61
|
class: "chart-menu-content",
|
|
62
62
|
"side-offset": 4,
|
|
63
63
|
align: "end"
|
|
64
64
|
}, {
|
|
65
|
-
default:
|
|
65
|
+
default: C(() => [(h(!0), i(e, null, _(t.items, (e) => (h(), n(x(T), {
|
|
66
66
|
key: e.label,
|
|
67
67
|
class: "chart-menu-item",
|
|
68
68
|
onSelect: e.action
|
|
69
69
|
}, {
|
|
70
|
-
default:
|
|
70
|
+
default: C(() => [o(y(e.label), 1)]),
|
|
71
71
|
_: 2
|
|
72
72
|
}, 1032, ["onSelect"]))), 128))]),
|
|
73
73
|
_: 1
|
|
@@ -77,22 +77,176 @@ var P = { class: "chart-menu-trigger-area" }, ce = ["aria-label"], F = /* @__PUR
|
|
|
77
77
|
_: 1
|
|
78
78
|
}))]));
|
|
79
79
|
}
|
|
80
|
-
}),
|
|
80
|
+
}), R = (e, t) => {
|
|
81
81
|
let n = e.__vccOpts || e;
|
|
82
82
|
for (let [e, r] of t) n[e] = r;
|
|
83
83
|
return n;
|
|
84
|
-
},
|
|
84
|
+
}, ce = /* @__PURE__ */ R(se, [["__scopeId", "data-v-fe2f6904"]]);
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/_shared/axes.ts
|
|
87
|
+
function z(e) {
|
|
88
|
+
return Math.round(e) + .5;
|
|
89
|
+
}
|
|
90
|
+
function B(e, t) {
|
|
91
|
+
let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r, a;
|
|
92
|
+
return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
|
|
93
|
+
}
|
|
94
|
+
function V(e, t, n) {
|
|
95
|
+
if (!(n > 0) || !isFinite(n)) return [];
|
|
96
|
+
let r = [], i = Math.ceil(e / n) * n;
|
|
97
|
+
for (let e = 0, a = i; a <= t + 1e-9 && e < 1e3; e++, a = i + e * n) r.push(a);
|
|
98
|
+
return r;
|
|
99
|
+
}
|
|
100
|
+
var H = new Intl.NumberFormat();
|
|
101
|
+
function U(e) {
|
|
102
|
+
return Math.abs(e) >= 1e3 ? H.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/_shared/computeTicks.ts
|
|
106
|
+
function le(e) {
|
|
107
|
+
let { min: t, max: n, ticks: r } = e;
|
|
108
|
+
if (t === n) return [];
|
|
109
|
+
let i = e.displayOffset ?? 0;
|
|
110
|
+
if (Array.isArray(r)) return r.map((e) => e - i).filter((e) => e >= t && e <= n);
|
|
111
|
+
if (typeof r == "number") return V(t + i, n + i, r).map((e) => e - i);
|
|
112
|
+
let a = Math.max(3, Math.floor(e.targetTickCount ?? 3)), o = B(n - t, a);
|
|
113
|
+
return V(t + i, n + i, o).map((e) => e - i);
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/_shared/useChartSize.ts
|
|
117
|
+
function W(e = {}) {
|
|
118
|
+
let t = g(null), n = g(0), r = null, i = null;
|
|
119
|
+
return ee(() => {
|
|
120
|
+
t.value && (n.value = t.value.clientWidth, r = new ResizeObserver((t) => {
|
|
121
|
+
let r = t[0];
|
|
122
|
+
if (!r) return;
|
|
123
|
+
let a = e.debounce?.();
|
|
124
|
+
a ? (i && clearTimeout(i), i = setTimeout(() => {
|
|
125
|
+
n.value = r.contentRect.width;
|
|
126
|
+
}, a)) : n.value = r.contentRect.width;
|
|
127
|
+
}), r.observe(t.value));
|
|
128
|
+
}), m(() => {
|
|
129
|
+
r?.disconnect(), i && clearTimeout(i);
|
|
130
|
+
}), {
|
|
131
|
+
containerRef: t,
|
|
132
|
+
measuredWidth: n
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function G(e) {
|
|
136
|
+
let n = t(() => ({
|
|
137
|
+
top: (e.title() ? 30 : 10) + (e.hasInlineLegend() ? 20 : 0),
|
|
138
|
+
right: 10,
|
|
139
|
+
bottom: e.xLabel() ? 46 : 30,
|
|
140
|
+
left: e.yLabel() ? 66 : 50
|
|
141
|
+
}));
|
|
142
|
+
return {
|
|
143
|
+
padding: n,
|
|
144
|
+
innerW: t(() => e.width() - n.value.left - n.value.right),
|
|
145
|
+
innerH: t(() => e.height() - n.value.top - n.value.bottom)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/tooltip-position.ts
|
|
150
|
+
var K = 16, q = 8;
|
|
151
|
+
function J(e, t, n, r, i, a) {
|
|
152
|
+
if (i === "none") return {
|
|
153
|
+
left: e + K,
|
|
154
|
+
top: t
|
|
155
|
+
};
|
|
156
|
+
let o = i === "chart" && a ? {
|
|
157
|
+
left: a.left,
|
|
158
|
+
right: a.right,
|
|
159
|
+
top: a.top,
|
|
160
|
+
bottom: a.bottom
|
|
161
|
+
} : {
|
|
162
|
+
left: 0,
|
|
163
|
+
right: window.innerWidth,
|
|
164
|
+
top: 0,
|
|
165
|
+
bottom: window.innerHeight
|
|
166
|
+
}, s = e + K + n > o.right - q ? e - K - n : e + K, c = r / 2;
|
|
167
|
+
return {
|
|
168
|
+
left: s,
|
|
169
|
+
top: Math.min(Math.max(t, o.top + q + c), o.bottom - q - c)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/_shared/useChartTooltip.ts
|
|
174
|
+
function ue(e) {
|
|
175
|
+
let t = e.touchYOffset ?? 50, n = g(null), r = g(!1), i = g(null), a = g(null), o = g(null);
|
|
176
|
+
function s(e) {
|
|
177
|
+
return "touches" in e ? e.touches[0] ?? null : e;
|
|
178
|
+
}
|
|
179
|
+
function c(t) {
|
|
180
|
+
let r = s(t);
|
|
181
|
+
if (!r) return;
|
|
182
|
+
let i = e.pointerToIndex(r.clientX, r.clientY);
|
|
183
|
+
i !== null && (n.value = i, a.value = {
|
|
184
|
+
clientX: r.clientX,
|
|
185
|
+
clientY: r.clientY
|
|
186
|
+
}, e.onHover?.({ index: i }));
|
|
187
|
+
}
|
|
188
|
+
ne([a, n], () => {
|
|
189
|
+
if (n.value === null || !a.value) {
|
|
190
|
+
o.value = null;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
let s = i.value, c = e.containerRef.value;
|
|
194
|
+
if (!s || !c) return;
|
|
195
|
+
let l = c.getBoundingClientRect(), u = r.value ? t : 0, d = e.clamp?.() ?? "chart", { left: f, top: p } = J(a.value.clientX, a.value.clientY - u, s.offsetWidth, s.offsetHeight, d, l);
|
|
196
|
+
o.value = {
|
|
197
|
+
left: f - l.left,
|
|
198
|
+
top: p - l.top
|
|
199
|
+
};
|
|
200
|
+
}, { flush: "post" });
|
|
201
|
+
function l(t) {
|
|
202
|
+
e.enabled() && c(t);
|
|
203
|
+
}
|
|
204
|
+
function u() {
|
|
205
|
+
e.enabled() && e.trigger?.() !== "click" && (n.value = null, e.onHover?.(null));
|
|
206
|
+
}
|
|
207
|
+
function d(t) {
|
|
208
|
+
if (!e.enabled() || e.trigger?.() !== "click") return;
|
|
209
|
+
let r = s(t);
|
|
210
|
+
if (!r) return;
|
|
211
|
+
let i = e.pointerToIndex(r.clientX, r.clientY);
|
|
212
|
+
i !== null && (n.value = n.value === i ? null : i, e.onHover?.(n.value === null ? null : { index: i }));
|
|
213
|
+
}
|
|
214
|
+
function f(t) {
|
|
215
|
+
e.enabled() && (t.preventDefault(), r.value = !0, c(t));
|
|
216
|
+
}
|
|
217
|
+
function p(t) {
|
|
218
|
+
e.enabled() && (t.preventDefault(), c(t));
|
|
219
|
+
}
|
|
220
|
+
function ee() {
|
|
221
|
+
e.enabled() && (r.value = !1, n.value = null, e.onHover?.(null));
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
hoverIndex: n,
|
|
225
|
+
isTouching: r,
|
|
226
|
+
pointer: a,
|
|
227
|
+
tooltipRef: i,
|
|
228
|
+
tooltipPos: o,
|
|
229
|
+
handlers: {
|
|
230
|
+
mousemove: l,
|
|
231
|
+
mouseleave: u,
|
|
232
|
+
click: d,
|
|
233
|
+
touchstart: f,
|
|
234
|
+
touchmove: p,
|
|
235
|
+
touchend: ee
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
85
239
|
//#endregion
|
|
86
240
|
//#region src/ChartMenu/download.ts
|
|
87
|
-
function
|
|
241
|
+
function Y(e, t) {
|
|
88
242
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
89
243
|
r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
|
|
90
244
|
}
|
|
91
|
-
function
|
|
245
|
+
function X(e, t) {
|
|
92
246
|
let n = e.cloneNode(!0);
|
|
93
247
|
n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
94
248
|
let r = new XMLSerializer().serializeToString(n);
|
|
95
|
-
|
|
249
|
+
Y(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
|
|
96
250
|
}
|
|
97
251
|
function de(e, t) {
|
|
98
252
|
let n = e.cloneNode(!0);
|
|
@@ -103,103 +257,143 @@ function de(e, t) {
|
|
|
103
257
|
e.width = s * 2, e.height = c * 2;
|
|
104
258
|
let n = e.getContext("2d");
|
|
105
259
|
n.scale(2, 2), n.drawImage(o, 0, 0, s, c), e.toBlob((e) => {
|
|
106
|
-
e &&
|
|
260
|
+
e && Y(e, `${t}.png`);
|
|
107
261
|
}), URL.revokeObjectURL(a);
|
|
108
262
|
}, o.src = a;
|
|
109
263
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
264
|
+
function Z(e, t) {
|
|
265
|
+
Y(new Blob([e], { type: "text/csv" }), `${t}.csv`);
|
|
112
266
|
}
|
|
113
267
|
//#endregion
|
|
114
|
-
//#region src/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
right: a.right,
|
|
124
|
-
top: a.top,
|
|
125
|
-
bottom: a.bottom
|
|
126
|
-
} : {
|
|
127
|
-
left: 0,
|
|
128
|
-
right: window.innerWidth,
|
|
129
|
-
top: 0,
|
|
130
|
-
bottom: window.innerHeight
|
|
131
|
-
}, s = e + R + n > o.right - z ? e - R - n : e + R, c = r / 2;
|
|
268
|
+
//#region src/_shared/useChartMenu.ts
|
|
269
|
+
function fe(e) {
|
|
270
|
+
let n = g(null);
|
|
271
|
+
function r() {
|
|
272
|
+
let t = e.filename();
|
|
273
|
+
if (t) return t;
|
|
274
|
+
let n = e.legacyMenuLabel();
|
|
275
|
+
return typeof n == "string" ? n : "chart";
|
|
276
|
+
}
|
|
132
277
|
return {
|
|
133
|
-
|
|
134
|
-
|
|
278
|
+
svgRef: n,
|
|
279
|
+
items: t(() => {
|
|
280
|
+
let t = r(), i = [{
|
|
281
|
+
label: "Save as SVG",
|
|
282
|
+
action: () => {
|
|
283
|
+
n.value && X(n.value, t);
|
|
284
|
+
}
|
|
285
|
+
}, {
|
|
286
|
+
label: "Save as PNG",
|
|
287
|
+
action: () => {
|
|
288
|
+
n.value && de(n.value, t);
|
|
289
|
+
}
|
|
290
|
+
}];
|
|
291
|
+
return e.downloadLink() || i.push({
|
|
292
|
+
label: "Download CSV",
|
|
293
|
+
action: () => Z(e.getCsv(), t)
|
|
294
|
+
}), i;
|
|
295
|
+
}),
|
|
296
|
+
downloadLinkText: t(() => {
|
|
297
|
+
let t = e.downloadLink();
|
|
298
|
+
return t ? typeof t == "string" ? t : "Download data (CSV)" : null;
|
|
299
|
+
}),
|
|
300
|
+
csvHref: t(() => e.downloadLink() ? `data:text/csv;charset=utf-8,${encodeURIComponent(e.getCsv())}` : null),
|
|
301
|
+
resolvedFilename: r
|
|
135
302
|
};
|
|
136
303
|
}
|
|
137
304
|
//#endregion
|
|
305
|
+
//#region src/_shared/seriesCsv.ts
|
|
306
|
+
function pe(e) {
|
|
307
|
+
if (e.length === 0) return "";
|
|
308
|
+
let t = 0;
|
|
309
|
+
for (let n of e) n.data.length > t && (t = n.data.length);
|
|
310
|
+
let n = e.every((t) => t.x === e[0].x) ? e[0].x : void 0, r = n ? "x" : "index", i = [(e.length === 1 ? [r, "value"] : [r, ...e.map((e, t) => `series_${t}`)]).join(",")];
|
|
311
|
+
for (let r = 0; r < t; r++) {
|
|
312
|
+
let t = [n ? String(n[r]) : r.toString()];
|
|
313
|
+
for (let n of e) t.push(r < n.data.length ? String(n.data[r]) : "");
|
|
314
|
+
i.push(t.join(","));
|
|
315
|
+
}
|
|
316
|
+
return i.join("\n");
|
|
317
|
+
}
|
|
318
|
+
function me(e, t, n = "category") {
|
|
319
|
+
if (t.length === 0 || e.length === 0) return "";
|
|
320
|
+
let r = [(t.length === 1 ? [n, t[0].label || "value"] : [n, ...t.map((e, t) => e.label || `series_${t}`)]).join(",")];
|
|
321
|
+
for (let n = 0; n < e.length; n++) {
|
|
322
|
+
let i = [Q(e[n])];
|
|
323
|
+
for (let e of t) i.push(n < e.data.length ? String(e.data[n]) : "");
|
|
324
|
+
r.push(i.join(","));
|
|
325
|
+
}
|
|
326
|
+
return r.join("\n");
|
|
327
|
+
}
|
|
328
|
+
function Q(e) {
|
|
329
|
+
return e.includes(",") || e.includes("\"") || e.includes("\n") ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
138
332
|
//#region src/LineChart/LineChart.vue?vue&type=script&setup=true&lang.ts
|
|
139
|
-
var
|
|
333
|
+
var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
140
334
|
"x1",
|
|
141
335
|
"y1",
|
|
142
336
|
"x2",
|
|
143
337
|
"y2",
|
|
144
338
|
"stroke",
|
|
145
339
|
"stroke-dasharray"
|
|
146
|
-
],
|
|
340
|
+
], ye = [
|
|
147
341
|
"cx",
|
|
148
342
|
"cy",
|
|
149
343
|
"fill",
|
|
150
344
|
"fill-opacity",
|
|
151
345
|
"stroke"
|
|
152
|
-
],
|
|
346
|
+
], be = ["x", "y"], $ = [
|
|
153
347
|
"x1",
|
|
154
348
|
"y1",
|
|
155
349
|
"x2",
|
|
156
350
|
"y2"
|
|
157
|
-
],
|
|
351
|
+
], xe = [
|
|
158
352
|
"x1",
|
|
159
353
|
"y1",
|
|
160
354
|
"x2",
|
|
161
355
|
"y2"
|
|
162
|
-
],
|
|
356
|
+
], Se = [
|
|
163
357
|
"x1",
|
|
164
358
|
"y1",
|
|
165
359
|
"x2",
|
|
166
360
|
"y2"
|
|
167
|
-
],
|
|
361
|
+
], Ce = [
|
|
168
362
|
"x1",
|
|
169
363
|
"y1",
|
|
170
364
|
"x2",
|
|
171
365
|
"y2"
|
|
172
|
-
],
|
|
366
|
+
], we = ["x", "y"], Te = ["transform"], Ee = [
|
|
173
367
|
"x",
|
|
174
368
|
"y",
|
|
175
369
|
"text-anchor"
|
|
176
|
-
],
|
|
370
|
+
], De = ["x", "y"], Oe = [
|
|
177
371
|
"d",
|
|
178
372
|
"fill",
|
|
179
373
|
"fill-opacity"
|
|
180
|
-
],
|
|
374
|
+
], ke = [
|
|
181
375
|
"d",
|
|
182
376
|
"stroke",
|
|
183
377
|
"stroke-width",
|
|
184
378
|
"stroke-opacity",
|
|
185
379
|
"stroke-dasharray"
|
|
186
|
-
],
|
|
380
|
+
], Ae = [
|
|
187
381
|
"cx",
|
|
188
382
|
"cy",
|
|
189
383
|
"r",
|
|
190
384
|
"fill",
|
|
191
385
|
"fill-opacity",
|
|
192
386
|
"stroke"
|
|
193
|
-
],
|
|
387
|
+
], je = [
|
|
194
388
|
"d",
|
|
195
389
|
"fill",
|
|
196
390
|
"fill-opacity"
|
|
197
|
-
],
|
|
391
|
+
], Me = [
|
|
198
392
|
"d",
|
|
199
393
|
"stroke",
|
|
200
394
|
"stroke-width",
|
|
201
395
|
"stroke-dasharray"
|
|
202
|
-
],
|
|
396
|
+
], Ne = [
|
|
203
397
|
"x1",
|
|
204
398
|
"y1",
|
|
205
399
|
"x2",
|
|
@@ -207,7 +401,7 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
207
401
|
"stroke",
|
|
208
402
|
"stroke-width",
|
|
209
403
|
"stroke-dasharray"
|
|
210
|
-
],
|
|
404
|
+
], Pe = [
|
|
211
405
|
"x1",
|
|
212
406
|
"y1",
|
|
213
407
|
"x2",
|
|
@@ -215,44 +409,44 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
215
409
|
"stroke",
|
|
216
410
|
"stroke-width",
|
|
217
411
|
"stroke-dasharray"
|
|
218
|
-
],
|
|
412
|
+
], Fe = [
|
|
219
413
|
"x1",
|
|
220
414
|
"y1",
|
|
221
415
|
"x2",
|
|
222
416
|
"y2"
|
|
223
|
-
],
|
|
417
|
+
], Ie = [
|
|
224
418
|
"x1",
|
|
225
419
|
"y1",
|
|
226
420
|
"x2",
|
|
227
421
|
"y2"
|
|
228
|
-
],
|
|
422
|
+
], Le = [
|
|
229
423
|
"x1",
|
|
230
424
|
"y1",
|
|
231
425
|
"x2",
|
|
232
426
|
"y2"
|
|
233
|
-
],
|
|
427
|
+
], Re = [
|
|
234
428
|
"cx",
|
|
235
429
|
"cy",
|
|
236
430
|
"fill"
|
|
237
|
-
],
|
|
431
|
+
], ze = [
|
|
238
432
|
"x",
|
|
239
433
|
"y",
|
|
240
434
|
"width",
|
|
241
435
|
"height"
|
|
242
|
-
],
|
|
436
|
+
], Be = [
|
|
243
437
|
"cx",
|
|
244
438
|
"cy",
|
|
245
439
|
"fill",
|
|
246
440
|
"fill-opacity",
|
|
247
441
|
"stroke"
|
|
248
|
-
],
|
|
442
|
+
], Ve = [
|
|
249
443
|
"x",
|
|
250
444
|
"y",
|
|
251
445
|
"fill"
|
|
252
|
-
],
|
|
446
|
+
], He = ["x", "y"], Ue = { class: "line-chart-tooltip" }, We = {
|
|
253
447
|
key: 0,
|
|
254
448
|
class: "line-chart-tooltip-label"
|
|
255
|
-
},
|
|
449
|
+
}, Ge = ["href", "download"], Ke = 36, qe = 12, Je = 7, Ye = 16, Xe = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
256
450
|
__name: "LineChart",
|
|
257
451
|
props: {
|
|
258
452
|
y: {},
|
|
@@ -290,58 +484,49 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
290
484
|
},
|
|
291
485
|
emits: ["hover"],
|
|
292
486
|
setup(s, { emit: c }) {
|
|
293
|
-
let
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
S?.disconnect(), C && clearTimeout(C);
|
|
303
|
-
});
|
|
304
|
-
let ie = t(() => u.width ?? (b.value || 400)), w = t(() => u.height ?? 200), T = t(() => k.value.some((e) => e.legend) || u.areaSections?.some((e) => e.legend === "inline" && (e.label || e.description))), E = t(() => ({
|
|
305
|
-
top: (u.title ? 30 : 10) + (T.value ? K : 0),
|
|
306
|
-
right: 10,
|
|
307
|
-
bottom: u.xLabel ? 46 : 30,
|
|
308
|
-
left: u.yLabel ? 66 : 50
|
|
309
|
-
})), D = t(() => ie.value - E.value.left - E.value.right), O = t(() => w.value - E.value.top - E.value.bottom), ae = [];
|
|
310
|
-
function oe(e) {
|
|
487
|
+
let d = s, ee = c, { containerRef: m, measuredWidth: g } = W({ debounce: () => d.debounce }), b = t(() => d.width ?? (g.value || 400)), S = t(() => d.height ?? 200), ne = t(() => D.value.some((e) => e.legend) || d.areaSections?.some((e) => e.legend === "inline" && (e.label || e.description)) || !1), { padding: C, innerW: w, innerH: T } = G({
|
|
488
|
+
title: () => d.title,
|
|
489
|
+
xLabel: () => d.xLabel,
|
|
490
|
+
yLabel: () => d.yLabel,
|
|
491
|
+
hasInlineLegend: () => ne.value,
|
|
492
|
+
width: () => b.value,
|
|
493
|
+
height: () => S.value
|
|
494
|
+
}), re = [];
|
|
495
|
+
function E(e) {
|
|
311
496
|
return {
|
|
312
497
|
...e,
|
|
313
|
-
data: e.y ?? e.data ??
|
|
498
|
+
data: e.y ?? e.data ?? re
|
|
314
499
|
};
|
|
315
500
|
}
|
|
316
|
-
let
|
|
317
|
-
if (
|
|
318
|
-
let e =
|
|
501
|
+
let D = t(() => {
|
|
502
|
+
if (d.series && d.series.length > 0) return d.series.map(E);
|
|
503
|
+
let e = d.y ?? d.data;
|
|
319
504
|
return e ? [{
|
|
320
505
|
data: e,
|
|
321
|
-
x:
|
|
506
|
+
x: d.x
|
|
322
507
|
}] : [];
|
|
323
|
-
}),
|
|
508
|
+
}), O = t(() => d.areas ?? []), k = t(() => {
|
|
324
509
|
let e = 0;
|
|
325
|
-
for (let t of
|
|
326
|
-
for (let t of
|
|
510
|
+
for (let t of D.value) t.data.length > e && (e = t.data.length);
|
|
511
|
+
for (let t of O.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
|
|
327
512
|
return e;
|
|
328
|
-
}),
|
|
329
|
-
function
|
|
513
|
+
}), A = t(() => D.value.some((e) => e.x != null) || O.value.some((e) => e.x != null));
|
|
514
|
+
function j(e, t) {
|
|
330
515
|
return e.x ? Number(e.x[t]) : t;
|
|
331
516
|
}
|
|
332
|
-
function
|
|
517
|
+
function M(e, t) {
|
|
333
518
|
return e.x ? Number(e.x[t]) : t;
|
|
334
519
|
}
|
|
335
|
-
let
|
|
520
|
+
let ie = t(() => A.value ? 0 : d.xMin ?? 0), N = t(() => {
|
|
336
521
|
let e = Infinity, t = -Infinity;
|
|
337
|
-
for (let n of
|
|
338
|
-
let i =
|
|
522
|
+
for (let n of D.value) for (let r = 0; r < n.data.length; r++) {
|
|
523
|
+
let i = j(n, r);
|
|
339
524
|
isFinite(i) && (i < e && (e = i), i > t && (t = i));
|
|
340
525
|
}
|
|
341
|
-
for (let n of
|
|
526
|
+
for (let n of O.value) {
|
|
342
527
|
let r = Math.max(n.upper.length, n.lower.length);
|
|
343
528
|
for (let i = 0; i < r; i++) {
|
|
344
|
-
let r =
|
|
529
|
+
let r = M(n, i);
|
|
345
530
|
isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
346
531
|
}
|
|
347
532
|
}
|
|
@@ -353,18 +538,18 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
353
538
|
max: 0
|
|
354
539
|
};
|
|
355
540
|
});
|
|
356
|
-
function
|
|
357
|
-
let { min: t, max: n } =
|
|
358
|
-
return
|
|
541
|
+
function P(e) {
|
|
542
|
+
let { min: t, max: n } = N.value, r = n - t || 1;
|
|
543
|
+
return C.value.left + (e - t) / r * w.value;
|
|
359
544
|
}
|
|
360
|
-
let
|
|
545
|
+
let F = t(() => {
|
|
361
546
|
let e = Infinity, t = -Infinity;
|
|
362
|
-
for (let n of
|
|
363
|
-
for (let n of
|
|
547
|
+
for (let n of D.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
548
|
+
for (let n of O.value) {
|
|
364
549
|
for (let r of n.upper) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
365
550
|
for (let r of n.lower) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
366
551
|
}
|
|
367
|
-
return isFinite(e) ? (
|
|
552
|
+
return isFinite(e) ? (d.yMin != null && d.yMin < e && (e = d.yMin), {
|
|
368
553
|
min: e,
|
|
369
554
|
max: t,
|
|
370
555
|
range: t - e || 1
|
|
@@ -374,75 +559,75 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
374
559
|
range: 1
|
|
375
560
|
};
|
|
376
561
|
});
|
|
377
|
-
function
|
|
562
|
+
function ae(e) {
|
|
378
563
|
let t = e.data;
|
|
379
564
|
if (t.length === 0) return "";
|
|
380
|
-
let { min: n, range: r } =
|
|
565
|
+
let { min: n, range: r } = F.value, i = T.value / r, a = C.value.top + T.value, o = "", s = !1;
|
|
381
566
|
for (let r = 0; r < t.length; r++) {
|
|
382
|
-
let c =
|
|
567
|
+
let c = j(e, r);
|
|
383
568
|
if (!isFinite(t[r]) || !isFinite(c)) {
|
|
384
569
|
s = !1;
|
|
385
570
|
continue;
|
|
386
571
|
}
|
|
387
|
-
let l =
|
|
572
|
+
let l = P(c), u = a - (t[r] - n) * i;
|
|
388
573
|
o += s ? `L${l},${u}` : `M${l},${u}`, s = !0;
|
|
389
574
|
}
|
|
390
575
|
return o;
|
|
391
576
|
}
|
|
392
|
-
function
|
|
393
|
-
let t = e.data, { min: n, range: r } =
|
|
577
|
+
function oe(e) {
|
|
578
|
+
let t = e.data, { min: n, range: r } = F.value, i = T.value / r, a = C.value.top + T.value, o = [];
|
|
394
579
|
for (let r = 0; r < t.length; r++) {
|
|
395
|
-
let s =
|
|
580
|
+
let s = j(e, r);
|
|
396
581
|
!isFinite(t[r]) || !isFinite(s) || o.push({
|
|
397
|
-
x:
|
|
582
|
+
x: P(s),
|
|
398
583
|
y: a - (t[r] - n) * i
|
|
399
584
|
});
|
|
400
585
|
}
|
|
401
586
|
return o;
|
|
402
587
|
}
|
|
403
|
-
function
|
|
588
|
+
function I(e) {
|
|
404
589
|
let t = Math.min(e.upper.length, e.lower.length);
|
|
405
590
|
if (t === 0) return "";
|
|
406
|
-
let { min: n, range: r } =
|
|
407
|
-
for (let n = 0; n < t; n++) isFinite(e.upper[n]) && isFinite(e.lower[n]) && isFinite(
|
|
591
|
+
let { min: n, range: r } = F.value, i = T.value / r, a = C.value.top + T.value, o = (e) => a - (e - n) * i, s = [], c = [];
|
|
592
|
+
for (let n = 0; n < t; n++) isFinite(e.upper[n]) && isFinite(e.lower[n]) && isFinite(M(e, n)) ? c.push(n) : c.length && (s.push(c), c = []);
|
|
408
593
|
c.length && s.push(c);
|
|
409
594
|
let l = "";
|
|
410
595
|
for (let t of s) {
|
|
411
|
-
l += `M${
|
|
412
|
-
for (let n = 1; n < t.length; n++) l += `L${
|
|
413
|
-
for (let n = t.length - 1; n >= 0; n--) l += `L${
|
|
596
|
+
l += `M${P(M(e, t[0]))},${o(e.upper[t[0]])}`;
|
|
597
|
+
for (let n = 1; n < t.length; n++) l += `L${P(M(e, t[n]))},${o(e.upper[t[n]])}`;
|
|
598
|
+
for (let n = t.length - 1; n >= 0; n--) l += `L${P(M(e, t[n]))},${o(e.lower[t[n]])}`;
|
|
414
599
|
l += "Z";
|
|
415
600
|
}
|
|
416
601
|
return l;
|
|
417
602
|
}
|
|
418
|
-
function
|
|
419
|
-
let n = t === "start" ? e.startIndex : e.endIndex, r = e.seriesIndex != null &&
|
|
420
|
-
return
|
|
603
|
+
function L(e, t) {
|
|
604
|
+
let n = t === "start" ? e.startIndex : e.endIndex, r = e.seriesIndex != null && D.value[e.seriesIndex] || D.value[0];
|
|
605
|
+
return P(r ? j(r, n) : n);
|
|
421
606
|
}
|
|
422
|
-
function
|
|
423
|
-
let n =
|
|
607
|
+
function se(e, t = !0) {
|
|
608
|
+
let n = C.value.top + T.value;
|
|
424
609
|
if (e.seriesIndex == null) {
|
|
425
|
-
let t =
|
|
426
|
-
return t > r ? "" : `M${t},${
|
|
610
|
+
let t = L(e, "start"), r = L(e, "end");
|
|
611
|
+
return t > r ? "" : `M${t},${C.value.top}L${r},${C.value.top}L${r},${n}L${t},${n}Z`;
|
|
427
612
|
}
|
|
428
|
-
let r =
|
|
613
|
+
let r = D.value[e.seriesIndex];
|
|
429
614
|
if (!r) return "";
|
|
430
|
-
let { min: i, range: a } =
|
|
615
|
+
let { min: i, range: a } = F.value, o = T.value / a, s = (e) => n - (e - i) * o, c = Math.max(0, e.startIndex), l = Math.min(r.data.length - 1, e.endIndex);
|
|
431
616
|
if (c > l) return "";
|
|
432
|
-
let u = `M${
|
|
433
|
-
for (let e = c + 1; e <= l; e++) isFinite(r.data[e]) && (u += `L${
|
|
434
|
-
return t && (u += `L${
|
|
617
|
+
let u = `M${P(j(r, c))},${s(r.data[c])}`;
|
|
618
|
+
for (let e = c + 1; e <= l; e++) isFinite(r.data[e]) && (u += `L${P(j(r, e))},${s(r.data[e])}`);
|
|
619
|
+
return t && (u += `L${P(j(r, l))},${n}`, u += `L${P(j(r, c))},${n}`, u += "Z"), u;
|
|
435
620
|
}
|
|
436
|
-
let
|
|
437
|
-
let e =
|
|
621
|
+
let R = t(() => {
|
|
622
|
+
let e = d.areaSections;
|
|
438
623
|
if (!e?.length) return {
|
|
439
624
|
labels: [],
|
|
440
625
|
extraHeight: 0
|
|
441
626
|
};
|
|
442
|
-
let t = [], n =
|
|
627
|
+
let t = [], n = C.value.left + w.value;
|
|
443
628
|
for (let r of e) {
|
|
444
629
|
if (!r.label && !r.description || r.legend === "inline" || r.legend === !1) continue;
|
|
445
|
-
let e = r.label ?? "", i = r.description ?? "", a = Math.max(e.length, i.length) *
|
|
630
|
+
let e = r.label ?? "", i = r.description ?? "", a = Math.max(e.length, i.length) * Je, o = L(r, "start") + a / 2 + 2, s = n - a / 2 - 8, c = Math.min(o, s), l = r.color ?? (r.seriesIndex == null ? "#999" : D.value[r.seriesIndex]?.color ?? "currentColor");
|
|
446
631
|
t.push({
|
|
447
632
|
cx: c,
|
|
448
633
|
labelText: e,
|
|
@@ -457,7 +642,7 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
457
642
|
let r = [];
|
|
458
643
|
for (let e of t) {
|
|
459
644
|
let t = e.cx - e.textWidth / 2, n = 0;
|
|
460
|
-
for (; n < r.length && !(t >= r[n] +
|
|
645
|
+
for (; n < r.length && !(t >= r[n] + Ye);) n++;
|
|
461
646
|
e.row = n;
|
|
462
647
|
let i = e.cx + e.textWidth / 2;
|
|
463
648
|
r[n] = Math.max(r[n] ?? -Infinity, i);
|
|
@@ -467,20 +652,20 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
467
652
|
extraHeight: 0
|
|
468
653
|
} : {
|
|
469
654
|
labels: t,
|
|
470
|
-
extraHeight: (Math.max(...t.map((e) => e.row)) + 1) *
|
|
655
|
+
extraHeight: (Math.max(...t.map((e) => e.row)) + 1) * Ke + qe
|
|
471
656
|
};
|
|
472
|
-
}),
|
|
657
|
+
}), B = t(() => {
|
|
473
658
|
let e = [];
|
|
474
|
-
for (let t of
|
|
659
|
+
for (let t of D.value) t.legend && e.push({
|
|
475
660
|
label: t.legend,
|
|
476
661
|
color: t.color ?? "currentColor",
|
|
477
662
|
type: "series",
|
|
478
663
|
dashed: t.dashed
|
|
479
664
|
});
|
|
480
|
-
let t =
|
|
665
|
+
let t = d.areaSections;
|
|
481
666
|
if (t) for (let n of t) {
|
|
482
667
|
if (n.legend !== "inline" || !n.label && !n.description) continue;
|
|
483
|
-
let t = [n.label, n.description].filter(Boolean).join(" "), r = n.color ?? (n.seriesIndex == null ? "#999" :
|
|
668
|
+
let t = [n.label, n.description].filter(Boolean).join(" "), r = n.color ?? (n.seriesIndex == null ? "#999" : D.value[n.seriesIndex]?.color ?? "currentColor");
|
|
484
669
|
e.push({
|
|
485
670
|
label: t,
|
|
486
671
|
color: r,
|
|
@@ -489,61 +674,41 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
489
674
|
});
|
|
490
675
|
}
|
|
491
676
|
return e;
|
|
492
|
-
}),
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
|
|
496
|
-
}
|
|
497
|
-
function Y(e) {
|
|
498
|
-
return Math.round(e) + .5;
|
|
499
|
-
}
|
|
500
|
-
let Xe = new Intl.NumberFormat();
|
|
501
|
-
function X(e) {
|
|
502
|
-
return Math.abs(e) >= 1e3 ? Xe.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
|
|
503
|
-
}
|
|
504
|
-
function Ze(e, t, n) {
|
|
505
|
-
if (!(n > 0) || !isFinite(n)) return [];
|
|
506
|
-
let r = [], i = Math.ceil(e / n) * n;
|
|
507
|
-
for (let e = 0, a = i; a <= t + 1e-9 && e < 1e3; e++, a = i + e * n) r.push(a);
|
|
508
|
-
return r;
|
|
509
|
-
}
|
|
510
|
-
let Qe = t(() => {
|
|
511
|
-
let { min: e, max: t } = I.value, n = (t) => Y(E.value.top + O.value - (t - e) / I.value.range * O.value), r = (e) => u.yTickFormat ? u.yTickFormat(e) : X(e);
|
|
512
|
-
if (e === t) return [{
|
|
677
|
+
}), V = t(() => S.value + R.value.extraHeight), H = t(() => C.value.top + T.value + C.value.bottom + qe), K = t(() => {
|
|
678
|
+
let { min: e, max: t } = F.value, n = (t) => z(C.value.top + T.value - (t - e) / F.value.range * T.value), r = (e) => d.yTickFormat ? d.yTickFormat(e) : U(e);
|
|
679
|
+
return e === t ? [{
|
|
513
680
|
value: r(e),
|
|
514
|
-
y:
|
|
515
|
-
}]
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
i = Ze(e, t, Ye(t - e, n));
|
|
522
|
-
}
|
|
523
|
-
return i.map((e) => ({
|
|
681
|
+
y: z(C.value.top + T.value / 2)
|
|
682
|
+
}] : le({
|
|
683
|
+
min: e,
|
|
684
|
+
max: t,
|
|
685
|
+
ticks: d.yTicks,
|
|
686
|
+
targetTickCount: T.value / 50
|
|
687
|
+
}).map((e) => ({
|
|
524
688
|
value: r(e),
|
|
525
689
|
y: n(e)
|
|
526
690
|
}));
|
|
527
|
-
}),
|
|
528
|
-
let { min: e, max: t } =
|
|
691
|
+
}), q = t(() => {
|
|
692
|
+
let { min: e, max: t } = N.value;
|
|
529
693
|
if (e === t) return [];
|
|
530
|
-
let n =
|
|
694
|
+
let n = ie.value, r = k.value, i = (e, t) => {
|
|
531
695
|
let r = e + n;
|
|
532
|
-
return
|
|
696
|
+
return d.xTickFormat ? d.xTickFormat(r, t) : !A.value && d.xLabels && Number.isInteger(e) && e >= 0 && e < d.xLabels.length ? d.xLabels[e] : U(r);
|
|
533
697
|
}, a;
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
else if (!j.value && u.xLabels && u.xLabels.length === r) {
|
|
537
|
-
let e = Math.max(3, Math.floor(D.value / 80)), t = Math.max(1, Math.round((r - 1) / e));
|
|
698
|
+
if (d.xTicks == null && !A.value && d.xLabels && d.xLabels.length === r) {
|
|
699
|
+
let e = Math.max(3, Math.floor(w.value / 80)), t = Math.max(1, Math.round((r - 1) / e));
|
|
538
700
|
a = [];
|
|
539
701
|
for (let e = 0; e < r; e += t) a.push(e);
|
|
540
|
-
} else {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
702
|
+
} else a = le({
|
|
703
|
+
min: e,
|
|
704
|
+
max: t,
|
|
705
|
+
ticks: d.xTicks,
|
|
706
|
+
targetTickCount: w.value / 80,
|
|
707
|
+
displayOffset: n
|
|
708
|
+
});
|
|
709
|
+
let o = C.value.left, s = C.value.left + w.value;
|
|
545
710
|
return a.map((e, t) => {
|
|
546
|
-
let n =
|
|
711
|
+
let n = z(P(e)), r = "middle";
|
|
547
712
|
return n - o <= 1 ? r = "start" : s - n <= 1 && (r = "end"), {
|
|
548
713
|
value: i(e, t),
|
|
549
714
|
x: n,
|
|
@@ -551,284 +716,215 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
551
716
|
};
|
|
552
717
|
});
|
|
553
718
|
});
|
|
554
|
-
function
|
|
555
|
-
return
|
|
556
|
-
}
|
|
557
|
-
function tt() {
|
|
558
|
-
return y.value;
|
|
559
|
-
}
|
|
560
|
-
function nt() {
|
|
561
|
-
if (typeof u.csv == "function") return u.csv();
|
|
562
|
-
if (typeof u.csv == "string") return u.csv;
|
|
563
|
-
let e = k.value;
|
|
564
|
-
if (e.length === 0) return "";
|
|
565
|
-
let t = se.value, n = e.every((t) => t.x === e[0].x) ? e[0].x : void 0, r = n ? "x" : "index", i = [(e.length === 1 ? [r, "value"] : [r, ...e.map((e, t) => `series_${t}`)]).join(",")];
|
|
566
|
-
for (let r = 0; r < t; r++) {
|
|
567
|
-
let t = [n ? String(n[r]) : r.toString()];
|
|
568
|
-
for (let n of e) t.push(r < n.data.length ? String(n.data[r]) : "");
|
|
569
|
-
i.push(t.join(","));
|
|
570
|
-
}
|
|
571
|
-
return i.join("\n");
|
|
719
|
+
function J() {
|
|
720
|
+
return typeof d.csv == "function" ? d.csv() : typeof d.csv == "string" ? d.csv : pe(D.value);
|
|
572
721
|
}
|
|
573
|
-
let
|
|
574
|
-
let e =
|
|
575
|
-
return e === null || !t ? null :
|
|
576
|
-
}),
|
|
577
|
-
function
|
|
722
|
+
let Y = t(() => !!d.tooltipData || !!d.tooltipTrigger), X = t(() => {
|
|
723
|
+
let e = Ze.value, t = D.value[0];
|
|
724
|
+
return e === null || !t ? null : j(t, e);
|
|
725
|
+
}), de = t(() => X.value === null ? 0 : P(X.value));
|
|
726
|
+
function Z(e, t) {
|
|
578
727
|
let n = e.data.length;
|
|
579
728
|
if (n === 0) return null;
|
|
580
729
|
let r = 0, i = Infinity;
|
|
581
730
|
for (let a = 0; a < n; a++) {
|
|
582
|
-
let n =
|
|
731
|
+
let n = j(e, a);
|
|
583
732
|
if (!isFinite(n)) continue;
|
|
584
733
|
let o = Math.abs(n - t);
|
|
585
734
|
o < i && (i = o, r = a);
|
|
586
735
|
}
|
|
587
736
|
return i === Infinity ? null : r;
|
|
588
737
|
}
|
|
589
|
-
let
|
|
590
|
-
let e =
|
|
738
|
+
let me = t(() => {
|
|
739
|
+
let e = X.value;
|
|
591
740
|
if (e === null) return [];
|
|
592
|
-
let { min: t, range: n } =
|
|
593
|
-
for (let n of
|
|
594
|
-
let o =
|
|
741
|
+
let { min: t, range: n } = F.value, r = T.value / n, i = C.value.top + T.value, a = [];
|
|
742
|
+
for (let n of D.value) {
|
|
743
|
+
let o = Z(n, e);
|
|
595
744
|
if (o === null) continue;
|
|
596
745
|
let s = n.data[o];
|
|
597
746
|
isFinite(s) && a.push({
|
|
598
|
-
x:
|
|
747
|
+
x: P(j(n, o)),
|
|
599
748
|
y: i - (s - t) * r,
|
|
600
749
|
color: n.color ?? "currentColor"
|
|
601
750
|
});
|
|
602
751
|
}
|
|
603
752
|
return a;
|
|
604
|
-
}),
|
|
605
|
-
let e =
|
|
753
|
+
}), Q = t(() => {
|
|
754
|
+
let e = Ze.value, t = X.value;
|
|
606
755
|
if (e === null || t === null) return null;
|
|
607
|
-
let n = t +
|
|
608
|
-
return r =
|
|
756
|
+
let n = t + ie.value, r;
|
|
757
|
+
return r = d.xTickFormat ? d.xTickFormat(n, e) : A.value ? U(n) : d.xLabels?.[e], {
|
|
609
758
|
index: e,
|
|
610
759
|
xLabel: r,
|
|
611
|
-
values:
|
|
612
|
-
let r =
|
|
760
|
+
values: D.value.map((e, n) => {
|
|
761
|
+
let r = Z(e, t);
|
|
613
762
|
return {
|
|
614
763
|
value: r === null ? NaN : Number(e.data[r]),
|
|
615
764
|
color: e.color ?? "currentColor",
|
|
616
765
|
seriesIndex: n
|
|
617
766
|
};
|
|
618
767
|
}),
|
|
619
|
-
data:
|
|
768
|
+
data: d.tooltipData?.[e] ?? null
|
|
620
769
|
};
|
|
621
770
|
});
|
|
622
|
-
function
|
|
623
|
-
|
|
624
|
-
}
|
|
625
|
-
function ft(e) {
|
|
626
|
-
let t = v.value?.getBoundingClientRect();
|
|
771
|
+
function Xe(e) {
|
|
772
|
+
let t = m.value?.getBoundingClientRect();
|
|
627
773
|
if (!t) return null;
|
|
628
|
-
let n =
|
|
774
|
+
let n = D.value[0];
|
|
629
775
|
if (!n || n.data.length === 0) return null;
|
|
630
|
-
let { min: r, max: i } =
|
|
631
|
-
return
|
|
776
|
+
let { min: r, max: i } = N.value, a = i - r || 1;
|
|
777
|
+
return Z(n, r + (e - t.left - C.value.left) / w.value * a);
|
|
632
778
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
let e = it.value, t = v.value;
|
|
648
|
-
if (!e || !t) return;
|
|
649
|
-
let n = t.getBoundingClientRect(), r = rt.value ? Ue : 0, { left: i, top: a } = pe(Q.value.clientX, Q.value.clientY - r, e.offsetWidth, e.offsetHeight, u.tooltipClamp, n);
|
|
650
|
-
$.value = {
|
|
651
|
-
left: i - n.left,
|
|
652
|
-
top: a - n.top
|
|
653
|
-
};
|
|
654
|
-
}, { flush: "post" });
|
|
655
|
-
function mt(e) {
|
|
656
|
-
pt(e);
|
|
657
|
-
}
|
|
658
|
-
function ht() {
|
|
659
|
-
u.tooltipTrigger !== "click" && (Z.value = null, _("hover", null));
|
|
660
|
-
}
|
|
661
|
-
function gt(e) {
|
|
662
|
-
if (u.tooltipTrigger !== "click") return;
|
|
663
|
-
let t = dt(e);
|
|
664
|
-
if (!t) return;
|
|
665
|
-
let n = ft(t.clientX);
|
|
666
|
-
n !== null && (Z.value = Z.value === n ? null : n, _("hover", Z.value === null ? null : { index: n }));
|
|
667
|
-
}
|
|
668
|
-
function _t(e) {
|
|
669
|
-
rt.value = !0, pt(e);
|
|
670
|
-
}
|
|
671
|
-
function vt(e) {
|
|
672
|
-
pt(e);
|
|
673
|
-
}
|
|
674
|
-
function yt() {
|
|
675
|
-
rt.value = !1, Z.value = null, _("hover", null);
|
|
676
|
-
}
|
|
677
|
-
let bt = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), xt = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(nt())}` : null), St = t(() => {
|
|
678
|
-
let e = et(), t = [{
|
|
679
|
-
label: "Save as SVG",
|
|
680
|
-
action: () => {
|
|
681
|
-
let t = tt();
|
|
682
|
-
t && ue(t, e);
|
|
683
|
-
}
|
|
684
|
-
}, {
|
|
685
|
-
label: "Save as PNG",
|
|
686
|
-
action: () => {
|
|
687
|
-
let t = tt();
|
|
688
|
-
t && de(t, e);
|
|
689
|
-
}
|
|
690
|
-
}];
|
|
691
|
-
return u.downloadLink || t.push({
|
|
692
|
-
label: "Download CSV",
|
|
693
|
-
action: () => fe(nt(), e)
|
|
694
|
-
}), t;
|
|
779
|
+
let { hoverIndex: Ze, tooltipRef: Qe, tooltipPos: $e, handlers: et } = ue({
|
|
780
|
+
enabled: () => Y.value,
|
|
781
|
+
trigger: () => d.tooltipTrigger,
|
|
782
|
+
clamp: () => d.tooltipClamp,
|
|
783
|
+
pointerToIndex: Xe,
|
|
784
|
+
containerRef: m,
|
|
785
|
+
onHover: (e) => ee("hover", e)
|
|
786
|
+
}), { svgRef: tt, items: nt, downloadLinkText: rt, csvHref: it, resolvedFilename: at } = fe({
|
|
787
|
+
filename: () => d.filename,
|
|
788
|
+
legacyMenuLabel: () => d.menu,
|
|
789
|
+
getCsv: J,
|
|
790
|
+
downloadLink: () => d.downloadLink
|
|
695
791
|
});
|
|
696
|
-
return (t, c) => (
|
|
792
|
+
return (t, c) => (h(), i("div", {
|
|
697
793
|
ref_key: "containerRef",
|
|
698
|
-
ref:
|
|
794
|
+
ref: m,
|
|
699
795
|
class: "line-chart-wrapper"
|
|
700
796
|
}, [
|
|
701
|
-
s.menu ? (
|
|
797
|
+
s.menu ? (h(), n(ce, {
|
|
702
798
|
key: 0,
|
|
703
|
-
items:
|
|
799
|
+
items: x(nt)
|
|
704
800
|
}, null, 8, ["items"])) : r("", !0),
|
|
705
|
-
(
|
|
801
|
+
(h(), i("svg", {
|
|
706
802
|
ref_key: "svgRef",
|
|
707
|
-
ref:
|
|
708
|
-
width:
|
|
709
|
-
height:
|
|
803
|
+
ref: tt,
|
|
804
|
+
width: b.value,
|
|
805
|
+
height: V.value
|
|
710
806
|
}, [
|
|
711
|
-
s.title ? (
|
|
807
|
+
s.title ? (h(), i("text", {
|
|
712
808
|
key: 0,
|
|
713
|
-
x:
|
|
809
|
+
x: b.value / 2,
|
|
714
810
|
y: 18,
|
|
715
811
|
"text-anchor": "middle",
|
|
716
812
|
"font-size": "14",
|
|
717
813
|
"font-weight": "600",
|
|
718
814
|
fill: "currentColor"
|
|
719
|
-
},
|
|
720
|
-
|
|
815
|
+
}, y(s.title), 9, ge)) : r("", !0),
|
|
816
|
+
B.value.length > 0 ? (h(), i("g", _e, [(h(!0), i(e, null, _(B.value, (t, n) => (h(), i(e, { key: "ileg" + n }, [t.type === "series" ? (h(), i("line", {
|
|
721
817
|
key: 0,
|
|
722
|
-
x1:
|
|
723
|
-
y1:
|
|
724
|
-
x2:
|
|
725
|
-
y2:
|
|
818
|
+
x1: x(C).left + n * 120,
|
|
819
|
+
y1: x(C).top - x(20) / 2,
|
|
820
|
+
x2: x(C).left + n * 120 + 12,
|
|
821
|
+
y2: x(C).top - x(20) / 2,
|
|
726
822
|
stroke: t.color,
|
|
727
823
|
"stroke-width": "2",
|
|
728
824
|
"stroke-dasharray": t.dashed ? "4 2" : void 0
|
|
729
|
-
}, null, 8,
|
|
825
|
+
}, null, 8, ve)) : (h(), i("circle", {
|
|
730
826
|
key: 1,
|
|
731
|
-
cx:
|
|
732
|
-
cy:
|
|
827
|
+
cx: x(C).left + n * 120 + 4,
|
|
828
|
+
cy: x(C).top - x(20) / 2,
|
|
733
829
|
r: "4",
|
|
734
830
|
fill: t.color,
|
|
735
831
|
"fill-opacity": t.fillOpacity,
|
|
736
832
|
stroke: t.color,
|
|
737
833
|
"stroke-width": "1.5"
|
|
738
|
-
}, null, 8,
|
|
739
|
-
x:
|
|
740
|
-
y:
|
|
834
|
+
}, null, 8, ye)), a("text", {
|
|
835
|
+
x: x(C).left + n * 120 + 18,
|
|
836
|
+
y: x(C).top - x(20) / 2 + 4,
|
|
741
837
|
"font-size": "11",
|
|
742
838
|
fill: "currentColor"
|
|
743
|
-
},
|
|
839
|
+
}, y(t.label), 9, be)], 64))), 128))])) : r("", !0),
|
|
744
840
|
a("line", {
|
|
745
|
-
x1:
|
|
746
|
-
y1:
|
|
747
|
-
x2:
|
|
748
|
-
y2:
|
|
841
|
+
x1: x(z)(x(C).left),
|
|
842
|
+
y1: x(z)(x(C).top),
|
|
843
|
+
x2: x(z)(x(C).left),
|
|
844
|
+
y2: x(z)(x(C).top + x(T)),
|
|
749
845
|
stroke: "currentColor",
|
|
750
846
|
"stroke-opacity": "0.3"
|
|
751
|
-
}, null, 8,
|
|
847
|
+
}, null, 8, $),
|
|
752
848
|
a("line", {
|
|
753
|
-
x1:
|
|
754
|
-
y1:
|
|
755
|
-
x2:
|
|
756
|
-
y2:
|
|
849
|
+
x1: x(z)(x(C).left),
|
|
850
|
+
y1: x(z)(x(C).top + x(T)),
|
|
851
|
+
x2: x(z)(x(C).left + x(w)),
|
|
852
|
+
y2: x(z)(x(C).top + x(T)),
|
|
757
853
|
stroke: "currentColor",
|
|
758
854
|
"stroke-opacity": "0.3"
|
|
759
|
-
}, null, 8,
|
|
760
|
-
s.yGrid ? (
|
|
855
|
+
}, null, 8, xe),
|
|
856
|
+
s.yGrid ? (h(!0), i(e, { key: 2 }, _(K.value, (e, t) => (h(), i("line", {
|
|
761
857
|
key: "yg" + t,
|
|
762
|
-
x1:
|
|
858
|
+
x1: x(C).left,
|
|
763
859
|
y1: e.y,
|
|
764
|
-
x2:
|
|
860
|
+
x2: x(C).left + x(w),
|
|
765
861
|
y2: e.y,
|
|
766
862
|
stroke: "currentColor",
|
|
767
863
|
"stroke-opacity": "0.1"
|
|
768
|
-
}, null, 8,
|
|
769
|
-
s.xGrid ? (
|
|
864
|
+
}, null, 8, Se))), 128)) : r("", !0),
|
|
865
|
+
s.xGrid ? (h(!0), i(e, { key: 3 }, _(q.value, (e, t) => (h(), i("line", {
|
|
770
866
|
key: "xg" + t,
|
|
771
867
|
x1: e.x,
|
|
772
|
-
y1:
|
|
868
|
+
y1: x(C).top,
|
|
773
869
|
x2: e.x,
|
|
774
|
-
y2:
|
|
870
|
+
y2: x(C).top + x(T),
|
|
775
871
|
stroke: "currentColor",
|
|
776
872
|
"stroke-opacity": "0.1"
|
|
777
|
-
}, null, 8,
|
|
778
|
-
(
|
|
873
|
+
}, null, 8, Ce))), 128)) : r("", !0),
|
|
874
|
+
(h(!0), i(e, null, _(K.value, (e, t) => (h(), i("text", {
|
|
779
875
|
key: "y" + t,
|
|
780
876
|
"data-testid": "y-tick",
|
|
781
|
-
x:
|
|
877
|
+
x: x(C).left - 6,
|
|
782
878
|
y: e.y,
|
|
783
879
|
"text-anchor": "end",
|
|
784
880
|
"dominant-baseline": "middle",
|
|
785
881
|
"font-size": "10",
|
|
786
882
|
fill: "currentColor",
|
|
787
883
|
"fill-opacity": "0.6"
|
|
788
|
-
},
|
|
789
|
-
s.yLabel ? (
|
|
884
|
+
}, y(e.value), 9, we))), 128)),
|
|
885
|
+
s.yLabel ? (h(), i("text", {
|
|
790
886
|
key: 4,
|
|
791
887
|
x: 0,
|
|
792
888
|
y: 0,
|
|
793
|
-
transform: `translate(14, ${
|
|
889
|
+
transform: `translate(14, ${x(C).top + x(T) / 2}) rotate(-90)`,
|
|
794
890
|
"text-anchor": "middle",
|
|
795
891
|
"font-size": "13",
|
|
796
892
|
fill: "currentColor"
|
|
797
|
-
},
|
|
798
|
-
(
|
|
893
|
+
}, y(s.yLabel), 9, Te)) : r("", !0),
|
|
894
|
+
(h(!0), i(e, null, _(q.value, (e, t) => (h(), i("text", {
|
|
799
895
|
key: "x" + t,
|
|
800
896
|
"data-testid": "x-tick",
|
|
801
897
|
x: e.x,
|
|
802
|
-
y:
|
|
898
|
+
y: x(C).top + x(T) + 16,
|
|
803
899
|
"text-anchor": e.anchor,
|
|
804
900
|
"font-size": "10",
|
|
805
901
|
fill: "currentColor",
|
|
806
902
|
"fill-opacity": "0.6"
|
|
807
|
-
},
|
|
808
|
-
s.xLabel ? (
|
|
903
|
+
}, y(e.value), 9, Ee))), 128)),
|
|
904
|
+
s.xLabel ? (h(), i("text", {
|
|
809
905
|
key: 5,
|
|
810
|
-
x:
|
|
811
|
-
y:
|
|
906
|
+
x: x(C).left + x(w) / 2,
|
|
907
|
+
y: S.value - 4,
|
|
812
908
|
"text-anchor": "middle",
|
|
813
909
|
"font-size": "13",
|
|
814
910
|
fill: "currentColor"
|
|
815
|
-
},
|
|
816
|
-
(
|
|
911
|
+
}, y(s.xLabel), 9, De)) : r("", !0),
|
|
912
|
+
(h(!0), i(e, null, _(O.value, (e, t) => (h(), i("path", {
|
|
817
913
|
key: "area" + t,
|
|
818
|
-
d:
|
|
914
|
+
d: I(e),
|
|
819
915
|
fill: e.color ?? "currentColor",
|
|
820
916
|
"fill-opacity": e.opacity ?? .2,
|
|
821
917
|
stroke: "none"
|
|
822
|
-
}, null, 8,
|
|
823
|
-
(
|
|
918
|
+
}, null, 8, Oe))), 128)),
|
|
919
|
+
(h(!0), i(e, null, _(D.value, (t, n) => (h(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (h(), i("path", {
|
|
824
920
|
key: 0,
|
|
825
|
-
d:
|
|
921
|
+
d: ae(t),
|
|
826
922
|
fill: "none",
|
|
827
923
|
stroke: t.color ?? "currentColor",
|
|
828
924
|
"stroke-width": t.strokeWidth ?? 1.5,
|
|
829
925
|
"stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
|
|
830
926
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
831
|
-
}, null, 8,
|
|
927
|
+
}, null, 8, ke)), t.dots ? (h(!0), i(e, { key: 1 }, _(oe(t), (e, n) => (h(), i("circle", {
|
|
832
928
|
key: n,
|
|
833
929
|
cx: e.x,
|
|
834
930
|
cy: e.y,
|
|
@@ -836,68 +932,68 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
836
932
|
fill: t.dotFill ?? t.color ?? "currentColor",
|
|
837
933
|
"fill-opacity": t.dotOpacity ?? t.opacity ?? s.lineOpacity,
|
|
838
934
|
stroke: t.dotStroke ?? "none"
|
|
839
|
-
}, null, 8,
|
|
840
|
-
(
|
|
935
|
+
}, null, 8, Ae))), 128)) : r("", !0)], 64))), 128)),
|
|
936
|
+
(h(!0), i(e, null, _(s.areaSections ?? [], (t, n) => (h(), i(e, { key: "areasec" + n }, [
|
|
841
937
|
a("path", {
|
|
842
|
-
d:
|
|
843
|
-
fill: t.color ?? (t.seriesIndex == null ? "#999" :
|
|
938
|
+
d: se(t),
|
|
939
|
+
fill: t.color ?? (t.seriesIndex == null ? "#999" : D.value[t.seriesIndex]?.color ?? "currentColor"),
|
|
844
940
|
"fill-opacity": t.opacity ?? .15,
|
|
845
941
|
stroke: "none"
|
|
846
|
-
}, null, 8,
|
|
847
|
-
t.seriesIndex == null ? r("", !0) : (
|
|
942
|
+
}, null, 8, je),
|
|
943
|
+
t.seriesIndex == null ? r("", !0) : (h(), i("path", {
|
|
848
944
|
key: 0,
|
|
849
|
-
d:
|
|
945
|
+
d: se(t, !1),
|
|
850
946
|
fill: "none",
|
|
851
|
-
stroke: t.color ??
|
|
947
|
+
stroke: t.color ?? D.value[t.seriesIndex]?.color ?? "currentColor",
|
|
852
948
|
"stroke-width": t.strokeWidth ?? 2,
|
|
853
949
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
854
|
-
}, null, 8,
|
|
855
|
-
t.seriesIndex == null ? (
|
|
856
|
-
x1:
|
|
857
|
-
y1:
|
|
858
|
-
x2:
|
|
859
|
-
y2:
|
|
950
|
+
}, null, 8, Me)),
|
|
951
|
+
t.seriesIndex == null ? (h(), i(e, { key: 1 }, [a("line", {
|
|
952
|
+
x1: x(z)(L(t, "start")),
|
|
953
|
+
y1: x(C).top,
|
|
954
|
+
x2: x(z)(L(t, "start")),
|
|
955
|
+
y2: x(C).top + x(T),
|
|
860
956
|
stroke: t.color ?? "#999",
|
|
861
957
|
"stroke-width": t.strokeWidth ?? 2,
|
|
862
958
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
863
|
-
}, null, 8,
|
|
864
|
-
x1:
|
|
865
|
-
y1:
|
|
866
|
-
x2:
|
|
867
|
-
y2:
|
|
959
|
+
}, null, 8, Ne), a("line", {
|
|
960
|
+
x1: x(z)(L(t, "end")),
|
|
961
|
+
y1: x(C).top,
|
|
962
|
+
x2: x(z)(L(t, "end")),
|
|
963
|
+
y2: x(C).top + x(T),
|
|
868
964
|
stroke: t.color ?? "#999",
|
|
869
965
|
"stroke-width": t.strokeWidth ?? 2,
|
|
870
966
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
871
|
-
}, null, 8,
|
|
967
|
+
}, null, 8, Pe)], 64)) : r("", !0),
|
|
872
968
|
a("line", {
|
|
873
|
-
x1:
|
|
874
|
-
y1:
|
|
875
|
-
x2:
|
|
876
|
-
y2:
|
|
969
|
+
x1: x(z)(L(t, "start")),
|
|
970
|
+
y1: x(C).top + x(T) - 4,
|
|
971
|
+
x2: x(z)(L(t, "start")),
|
|
972
|
+
y2: x(C).top + x(T) + 4,
|
|
877
973
|
stroke: "currentColor",
|
|
878
974
|
"stroke-opacity": "0.4"
|
|
879
|
-
}, null, 8,
|
|
975
|
+
}, null, 8, Fe),
|
|
880
976
|
a("line", {
|
|
881
|
-
x1:
|
|
882
|
-
y1:
|
|
883
|
-
x2:
|
|
884
|
-
y2:
|
|
977
|
+
x1: x(z)(L(t, "end")),
|
|
978
|
+
y1: x(C).top + x(T) - 4,
|
|
979
|
+
x2: x(z)(L(t, "end")),
|
|
980
|
+
y2: x(C).top + x(T) + 4,
|
|
885
981
|
stroke: "currentColor",
|
|
886
982
|
"stroke-opacity": "0.4"
|
|
887
|
-
}, null, 8,
|
|
983
|
+
}, null, 8, Ie)
|
|
888
984
|
], 64))), 128)),
|
|
889
|
-
|
|
985
|
+
Y.value && x(Ze) !== null ? (h(), i("line", {
|
|
890
986
|
key: 6,
|
|
891
|
-
x1:
|
|
892
|
-
y1:
|
|
893
|
-
x2:
|
|
894
|
-
y2:
|
|
987
|
+
x1: x(z)(de.value),
|
|
988
|
+
y1: x(C).top,
|
|
989
|
+
x2: x(z)(de.value),
|
|
990
|
+
y2: x(C).top + x(T),
|
|
895
991
|
stroke: "currentColor",
|
|
896
992
|
"stroke-opacity": "0.3",
|
|
897
993
|
"stroke-dasharray": "4 2",
|
|
898
994
|
"pointer-events": "none"
|
|
899
|
-
}, null, 8,
|
|
900
|
-
(
|
|
995
|
+
}, null, 8, Le)) : r("", !0),
|
|
996
|
+
(h(!0), i(e, null, _(me.value, (e, t) => (h(), i("circle", {
|
|
901
997
|
key: "hd" + t,
|
|
902
998
|
cx: e.x,
|
|
903
999
|
cy: e.y,
|
|
@@ -906,82 +1002,569 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
906
1002
|
stroke: "var(--color-bg-0, #fff)",
|
|
907
1003
|
"stroke-width": "2",
|
|
908
1004
|
"pointer-events": "none"
|
|
909
|
-
}, null, 8,
|
|
910
|
-
|
|
1005
|
+
}, null, 8, Re))), 128)),
|
|
1006
|
+
Y.value ? (h(), i("rect", u({
|
|
911
1007
|
key: 7,
|
|
912
|
-
x:
|
|
913
|
-
y:
|
|
914
|
-
width:
|
|
915
|
-
height:
|
|
1008
|
+
x: x(C).left,
|
|
1009
|
+
y: x(C).top,
|
|
1010
|
+
width: x(w),
|
|
1011
|
+
height: x(T),
|
|
916
1012
|
fill: "transparent",
|
|
917
1013
|
style: {
|
|
918
1014
|
cursor: "crosshair",
|
|
919
1015
|
"touch-action": "none"
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
onClick: gt,
|
|
924
|
-
onTouchstart: x(_t, ["prevent"]),
|
|
925
|
-
onTouchmove: x(vt, ["prevent"]),
|
|
926
|
-
onTouchend: yt
|
|
927
|
-
}, null, 40, Ne)) : r("", !0),
|
|
928
|
-
(f(!0), i(e, null, m(Ge.value.labels, (e, t) => (f(), i("g", { key: "seclab" + t }, [
|
|
1016
|
+
}
|
|
1017
|
+
}, te(x(et), !0)), null, 16, ze)) : r("", !0),
|
|
1018
|
+
(h(!0), i(e, null, _(R.value.labels, (e, t) => (h(), i("g", { key: "seclab" + t }, [
|
|
929
1019
|
a("circle", {
|
|
930
1020
|
cx: e.cx - e.textWidth / 2 - 2,
|
|
931
|
-
cy:
|
|
1021
|
+
cy: H.value + e.row * Ke + 4,
|
|
932
1022
|
r: "4",
|
|
933
1023
|
fill: e.color,
|
|
934
1024
|
"fill-opacity": e.fillOpacity,
|
|
935
1025
|
stroke: e.color,
|
|
936
1026
|
"stroke-width": "1.5"
|
|
937
|
-
}, null, 8,
|
|
938
|
-
e.labelText ? (
|
|
1027
|
+
}, null, 8, Be),
|
|
1028
|
+
e.labelText ? (h(), i("text", {
|
|
939
1029
|
key: 0,
|
|
940
1030
|
x: e.cx - e.textWidth / 2 + 8,
|
|
941
|
-
y:
|
|
1031
|
+
y: H.value + e.row * Ke + 8,
|
|
942
1032
|
"font-size": "11",
|
|
943
1033
|
"font-weight": "600",
|
|
944
1034
|
fill: e.color
|
|
945
|
-
},
|
|
946
|
-
e.descText ? (
|
|
1035
|
+
}, y(e.labelText), 9, Ve)) : r("", !0),
|
|
1036
|
+
e.descText ? (h(), i("text", {
|
|
947
1037
|
key: 1,
|
|
948
1038
|
x: e.cx - e.textWidth / 2 + 8,
|
|
949
|
-
y:
|
|
1039
|
+
y: H.value + e.row * Ke + 22,
|
|
950
1040
|
"font-size": "11",
|
|
951
1041
|
fill: "currentColor",
|
|
952
1042
|
"fill-opacity": "0.6"
|
|
953
|
-
},
|
|
1043
|
+
}, y(e.descText), 9, He)) : r("", !0)
|
|
954
1044
|
]))), 128))
|
|
955
|
-
], 8,
|
|
956
|
-
|
|
1045
|
+
], 8, he)),
|
|
1046
|
+
Y.value && x(Ze) !== null && Q.value ? (h(), i("div", {
|
|
957
1047
|
key: 1,
|
|
958
1048
|
ref_key: "tooltipRef",
|
|
959
|
-
ref:
|
|
1049
|
+
ref: Qe,
|
|
960
1050
|
class: "chart-tooltip-content",
|
|
961
|
-
style:
|
|
1051
|
+
style: p({
|
|
962
1052
|
position: "absolute",
|
|
963
1053
|
top: "0",
|
|
964
1054
|
left: "0",
|
|
965
1055
|
willChange: "transform",
|
|
966
|
-
transform:
|
|
967
|
-
visibility:
|
|
1056
|
+
transform: x($e) ? `translate3d(${x($e).left}px, ${x($e).top}px, 0) translateY(-50%)` : "translateY(-50%)",
|
|
1057
|
+
visibility: x($e) ? "visible" : "hidden"
|
|
968
1058
|
})
|
|
969
|
-
}, [
|
|
1059
|
+
}, [v(t.$slots, "tooltip", f(l(Q.value)), () => [a("div", Ue, [Q.value.xLabel ? (h(), i("div", We, y(Q.value.xLabel), 1)) : r("", !0), (h(!0), i(e, null, _(Q.value.values, (e) => (h(), i("div", {
|
|
970
1060
|
key: e.seriesIndex,
|
|
971
1061
|
class: "line-chart-tooltip-row"
|
|
972
1062
|
}, [a("span", {
|
|
973
1063
|
class: "line-chart-tooltip-swatch",
|
|
974
|
-
style:
|
|
975
|
-
}, null, 4), o(" " +
|
|
976
|
-
|
|
1064
|
+
style: p({ background: e.color })
|
|
1065
|
+
}, null, 4), o(" " + y(isFinite(e.value) ? x(U)(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
|
|
1066
|
+
x(rt) ? (h(), i("a", {
|
|
977
1067
|
key: 2,
|
|
978
1068
|
class: "line-chart-download-link",
|
|
979
|
-
href:
|
|
980
|
-
download: `${
|
|
981
|
-
},
|
|
1069
|
+
href: x(it),
|
|
1070
|
+
download: `${x(at)()}.csv`
|
|
1071
|
+
}, y(x(rt)), 9, Ge)) : r("", !0)
|
|
1072
|
+
], 512));
|
|
1073
|
+
}
|
|
1074
|
+
}), [["__scopeId", "data-v-d66a19bd"]]), Ze = ["width", "height"], Qe = ["x"], $e = { key: 1 }, et = [
|
|
1075
|
+
"x",
|
|
1076
|
+
"y",
|
|
1077
|
+
"fill"
|
|
1078
|
+
], tt = ["x", "y"], nt = [
|
|
1079
|
+
"x1",
|
|
1080
|
+
"y1",
|
|
1081
|
+
"x2",
|
|
1082
|
+
"y2"
|
|
1083
|
+
], rt = [
|
|
1084
|
+
"x1",
|
|
1085
|
+
"y1",
|
|
1086
|
+
"x2",
|
|
1087
|
+
"y2"
|
|
1088
|
+
], it = [
|
|
1089
|
+
"x1",
|
|
1090
|
+
"y1",
|
|
1091
|
+
"x2",
|
|
1092
|
+
"y2"
|
|
1093
|
+
], at = [
|
|
1094
|
+
"x",
|
|
1095
|
+
"y",
|
|
1096
|
+
"width",
|
|
1097
|
+
"height"
|
|
1098
|
+
], ot = ["x", "y"], st = ["x", "y"], ct = ["transform"], lt = [
|
|
1099
|
+
"x",
|
|
1100
|
+
"y",
|
|
1101
|
+
"text-anchor"
|
|
1102
|
+
], ut = ["x", "y"], dt = ["x", "y"], ft = [
|
|
1103
|
+
"data-category",
|
|
1104
|
+
"data-series",
|
|
1105
|
+
"x",
|
|
1106
|
+
"y",
|
|
1107
|
+
"width",
|
|
1108
|
+
"height",
|
|
1109
|
+
"fill",
|
|
1110
|
+
"fill-opacity"
|
|
1111
|
+
], pt = [
|
|
1112
|
+
"x",
|
|
1113
|
+
"y",
|
|
1114
|
+
"width",
|
|
1115
|
+
"height"
|
|
1116
|
+
], mt = { class: "bar-chart-tooltip" }, ht = {
|
|
1117
|
+
key: 0,
|
|
1118
|
+
class: "bar-chart-tooltip-label"
|
|
1119
|
+
}, gt = ["href", "download"], _t = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
1120
|
+
__name: "BarChart",
|
|
1121
|
+
props: {
|
|
1122
|
+
data: {},
|
|
1123
|
+
y: {},
|
|
1124
|
+
series: {},
|
|
1125
|
+
categories: {},
|
|
1126
|
+
orientation: { default: "vertical" },
|
|
1127
|
+
layout: { default: "grouped" },
|
|
1128
|
+
width: {},
|
|
1129
|
+
height: {},
|
|
1130
|
+
title: {},
|
|
1131
|
+
xLabel: {},
|
|
1132
|
+
yLabel: {},
|
|
1133
|
+
valueMin: { default: 0 },
|
|
1134
|
+
valueTicks: {},
|
|
1135
|
+
valueTickFormat: {},
|
|
1136
|
+
categoryFormat: {},
|
|
1137
|
+
barPadding: { default: .2 },
|
|
1138
|
+
groupGap: { default: 1 },
|
|
1139
|
+
debounce: {},
|
|
1140
|
+
menu: {
|
|
1141
|
+
type: [Boolean, String],
|
|
1142
|
+
default: !0
|
|
1143
|
+
},
|
|
1144
|
+
valueGrid: {
|
|
1145
|
+
type: Boolean,
|
|
1146
|
+
default: !0
|
|
1147
|
+
},
|
|
1148
|
+
tooltipData: {},
|
|
1149
|
+
tooltipTrigger: {},
|
|
1150
|
+
tooltipClamp: { default: "chart" },
|
|
1151
|
+
csv: {},
|
|
1152
|
+
filename: {},
|
|
1153
|
+
downloadLink: { type: [Boolean, String] }
|
|
1154
|
+
},
|
|
1155
|
+
emits: ["hover"],
|
|
1156
|
+
setup(s, { emit: c }) {
|
|
1157
|
+
let d = s, ee = c, { containerRef: m, measuredWidth: g } = W({ debounce: () => d.debounce }), b = t(() => d.width ?? (g.value || 400)), S = t(() => d.height ?? 200), ne = t(() => D.value.some((e) => e.legend)), { padding: C, innerW: w, innerH: T } = G({
|
|
1158
|
+
title: () => d.title,
|
|
1159
|
+
xLabel: () => d.xLabel,
|
|
1160
|
+
yLabel: () => d.yLabel,
|
|
1161
|
+
hasInlineLegend: () => ne.value,
|
|
1162
|
+
width: () => b.value,
|
|
1163
|
+
height: () => S.value
|
|
1164
|
+
}), re = [];
|
|
1165
|
+
function E(e) {
|
|
1166
|
+
return {
|
|
1167
|
+
data: e.y ?? e.data ?? re,
|
|
1168
|
+
color: e.color,
|
|
1169
|
+
opacity: e.opacity,
|
|
1170
|
+
legend: e.legend
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
let D = t(() => {
|
|
1174
|
+
if (d.series && d.series.length > 0) return d.series.map(E);
|
|
1175
|
+
let e = d.y ?? d.data;
|
|
1176
|
+
return e ? [{ data: e }] : [];
|
|
1177
|
+
}), O = t(() => {
|
|
1178
|
+
let e = d.categories?.length ?? 0;
|
|
1179
|
+
for (let t of D.value) t.data.length > e && (e = t.data.length);
|
|
1180
|
+
return e;
|
|
1181
|
+
}), k = t(() => {
|
|
1182
|
+
let e = O.value, t = Array(e);
|
|
1183
|
+
for (let n = 0; n < e; n++) t[n] = d.categories?.[n] ?? String(n);
|
|
1184
|
+
return t;
|
|
1185
|
+
}), A = t(() => d.orientation === "vertical"), j = t(() => {
|
|
1186
|
+
let e = Infinity, t = -Infinity;
|
|
1187
|
+
if (d.layout === "stacked") {
|
|
1188
|
+
let n = O.value;
|
|
1189
|
+
for (let r = 0; r < n; r++) {
|
|
1190
|
+
let n = 0, i = 0;
|
|
1191
|
+
for (let e of D.value) {
|
|
1192
|
+
if (r >= e.data.length) continue;
|
|
1193
|
+
let t = Number(e.data[r]);
|
|
1194
|
+
isFinite(t) && (t >= 0 ? n += t : i += t);
|
|
1195
|
+
}
|
|
1196
|
+
n > t && (t = n), i < e && (e = i);
|
|
1197
|
+
}
|
|
1198
|
+
} else for (let n of D.value) for (let r of n.data) {
|
|
1199
|
+
let n = Number(r);
|
|
1200
|
+
isFinite(n) && (n < e && (e = n), n > t && (t = n));
|
|
1201
|
+
}
|
|
1202
|
+
isFinite(e) || (e = 0), isFinite(t) || (t = 0);
|
|
1203
|
+
let n = d.valueMin ?? 0;
|
|
1204
|
+
n < e && (e = n);
|
|
1205
|
+
let r = t - e || 1;
|
|
1206
|
+
return {
|
|
1207
|
+
min: e,
|
|
1208
|
+
max: t,
|
|
1209
|
+
range: r
|
|
1210
|
+
};
|
|
1211
|
+
}), M = t(() => A.value ? w.value : T.value), ie = t(() => A.value ? T.value : w.value), N = t(() => {
|
|
1212
|
+
let e = O.value;
|
|
1213
|
+
return e > 0 ? M.value / e : 0;
|
|
1214
|
+
}), P = t(() => N.value * (1 - d.barPadding)), F = t(() => {
|
|
1215
|
+
let e = D.value.length;
|
|
1216
|
+
if (e === 0) return 0;
|
|
1217
|
+
if (d.layout === "stacked" || e === 1) return P.value;
|
|
1218
|
+
let t = d.groupGap * (e - 1);
|
|
1219
|
+
return Math.max(1, (P.value - t) / e);
|
|
1220
|
+
});
|
|
1221
|
+
function ae(e) {
|
|
1222
|
+
return (A.value ? C.value.left : C.value.top) + e * N.value;
|
|
1223
|
+
}
|
|
1224
|
+
let oe = t(() => {
|
|
1225
|
+
let { min: e, max: t } = j.value, n = d.valueMin ?? 0;
|
|
1226
|
+
return I(Math.max(e, Math.min(t, n)));
|
|
1227
|
+
});
|
|
1228
|
+
function I(e) {
|
|
1229
|
+
let { min: t, range: n } = j.value, r = ie.value / n;
|
|
1230
|
+
return A.value ? C.value.top + T.value - (e - t) * r : C.value.left + (e - t) * r;
|
|
1231
|
+
}
|
|
1232
|
+
function L(e, t, n, r, i, a, o, s, c) {
|
|
1233
|
+
let l = Math.min(e, t), u = Math.abs(e - t);
|
|
1234
|
+
return A.value ? {
|
|
1235
|
+
x: n,
|
|
1236
|
+
y: l,
|
|
1237
|
+
w: r,
|
|
1238
|
+
h: u,
|
|
1239
|
+
color: i,
|
|
1240
|
+
opacity: a,
|
|
1241
|
+
value: o,
|
|
1242
|
+
categoryIndex: s,
|
|
1243
|
+
seriesIndex: c
|
|
1244
|
+
} : {
|
|
1245
|
+
x: l,
|
|
1246
|
+
y: n,
|
|
1247
|
+
w: u,
|
|
1248
|
+
h: r,
|
|
1249
|
+
color: i,
|
|
1250
|
+
opacity: a,
|
|
1251
|
+
value: o,
|
|
1252
|
+
categoryIndex: s,
|
|
1253
|
+
seriesIndex: c
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
let se = t(() => {
|
|
1257
|
+
let e = [], t = D.value, n = t.length;
|
|
1258
|
+
if (n === 0) return e;
|
|
1259
|
+
let r = O.value, i = N.value, a = P.value, o = F.value, s = (i - a) / 2, c = oe.value;
|
|
1260
|
+
for (let i = 0; i < r; i++) {
|
|
1261
|
+
let r = ae(i) + s;
|
|
1262
|
+
if (d.layout === "stacked") {
|
|
1263
|
+
let o = 0, s = 0;
|
|
1264
|
+
for (let c = 0; c < n; c++) {
|
|
1265
|
+
let n = t[c], l = Number(n.data[i] ?? NaN);
|
|
1266
|
+
if (!isFinite(l)) continue;
|
|
1267
|
+
let u = l >= 0 ? o : s, d = u + l;
|
|
1268
|
+
e.push(L(I(u), I(d), r, a, n.color ?? B(c), n.opacity ?? 1, l, i, c)), l >= 0 ? o = d : s = d;
|
|
1269
|
+
}
|
|
1270
|
+
} else for (let a = 0; a < n; a++) {
|
|
1271
|
+
let s = t[a], l = Number(s.data[i] ?? NaN);
|
|
1272
|
+
if (!isFinite(l)) continue;
|
|
1273
|
+
let u = r + (n === 1 ? 0 : a * (o + d.groupGap));
|
|
1274
|
+
e.push(L(c, I(l), u, o, s.color ?? B(a), s.opacity ?? 1, l, i, a));
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return e;
|
|
1278
|
+
}), R = [
|
|
1279
|
+
"var(--color-primary, #3b82f6)",
|
|
1280
|
+
"var(--color-accent, #f59e0b)",
|
|
1281
|
+
"var(--color-success, #10b981)",
|
|
1282
|
+
"var(--color-danger, #ef4444)",
|
|
1283
|
+
"var(--color-info, #6366f1)",
|
|
1284
|
+
"var(--color-warning, #d97706)"
|
|
1285
|
+
];
|
|
1286
|
+
function B(e) {
|
|
1287
|
+
return R[e % R.length];
|
|
1288
|
+
}
|
|
1289
|
+
let V = t(() => {
|
|
1290
|
+
let { min: e, max: t } = j.value, n = (e) => d.valueTickFormat ? d.valueTickFormat(e) : U(e);
|
|
1291
|
+
if (e === t) return [{
|
|
1292
|
+
value: n(e),
|
|
1293
|
+
pos: z(I(e))
|
|
1294
|
+
}];
|
|
1295
|
+
let r = A.value ? 50 : 80;
|
|
1296
|
+
return le({
|
|
1297
|
+
min: e,
|
|
1298
|
+
max: t,
|
|
1299
|
+
ticks: d.valueTicks,
|
|
1300
|
+
targetTickCount: ie.value / r
|
|
1301
|
+
}).map((e) => ({
|
|
1302
|
+
value: n(e),
|
|
1303
|
+
pos: z(I(e))
|
|
1304
|
+
}));
|
|
1305
|
+
}), H = t(() => {
|
|
1306
|
+
let e = [], t = O.value, n = (e, t) => d.categoryFormat ? d.categoryFormat(e, t) : e;
|
|
1307
|
+
for (let r = 0; r < t; r++) {
|
|
1308
|
+
let t = ae(r) + N.value / 2;
|
|
1309
|
+
e.push({
|
|
1310
|
+
label: n(k.value[r], r),
|
|
1311
|
+
pos: t,
|
|
1312
|
+
anchor: "middle"
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
return e;
|
|
1316
|
+
}), K = t(() => {
|
|
1317
|
+
let e = [];
|
|
1318
|
+
return D.value.forEach((t, n) => {
|
|
1319
|
+
t.legend && e.push({
|
|
1320
|
+
label: t.legend,
|
|
1321
|
+
color: t.color ?? B(n)
|
|
1322
|
+
});
|
|
1323
|
+
}), e;
|
|
1324
|
+
});
|
|
1325
|
+
function q() {
|
|
1326
|
+
if (typeof d.csv == "function") return d.csv();
|
|
1327
|
+
if (typeof d.csv == "string") return d.csv;
|
|
1328
|
+
let e = D.value.map((e) => ({
|
|
1329
|
+
label: e.legend,
|
|
1330
|
+
data: e.data
|
|
1331
|
+
}));
|
|
1332
|
+
return me(k.value, e);
|
|
1333
|
+
}
|
|
1334
|
+
let J = t(() => !!d.tooltipData || !!d.tooltipTrigger);
|
|
1335
|
+
function Y(e, t) {
|
|
1336
|
+
let n = m.value?.getBoundingClientRect();
|
|
1337
|
+
if (!n) return null;
|
|
1338
|
+
let r = O.value;
|
|
1339
|
+
if (r === 0 || N.value === 0) return null;
|
|
1340
|
+
let i = A.value ? e - n.left - C.value.left : t - n.top - C.value.top;
|
|
1341
|
+
return Math.max(0, Math.min(r - 1, Math.floor(i / N.value)));
|
|
1342
|
+
}
|
|
1343
|
+
let { hoverIndex: X, tooltipRef: de, tooltipPos: Z, handlers: pe } = ue({
|
|
1344
|
+
enabled: () => J.value,
|
|
1345
|
+
trigger: () => d.tooltipTrigger,
|
|
1346
|
+
clamp: () => d.tooltipClamp,
|
|
1347
|
+
pointerToIndex: Y,
|
|
1348
|
+
containerRef: m,
|
|
1349
|
+
onHover: (e) => ee("hover", e)
|
|
1350
|
+
}), { svgRef: Q, items: he, downloadLinkText: ge, csvHref: _e, resolvedFilename: ve } = fe({
|
|
1351
|
+
filename: () => d.filename,
|
|
1352
|
+
legacyMenuLabel: () => d.menu,
|
|
1353
|
+
getCsv: q,
|
|
1354
|
+
downloadLink: () => d.downloadLink
|
|
1355
|
+
}), ye = t(() => {
|
|
1356
|
+
let e = X.value;
|
|
1357
|
+
if (e !== null) return k.value[e];
|
|
1358
|
+
}), be = t(() => {
|
|
1359
|
+
let e = X.value;
|
|
1360
|
+
return e === null ? null : {
|
|
1361
|
+
index: e,
|
|
1362
|
+
category: k.value[e] ?? String(e),
|
|
1363
|
+
values: D.value.map((t, n) => ({
|
|
1364
|
+
value: Number(t.data[e] ?? NaN),
|
|
1365
|
+
color: t.color ?? B(n),
|
|
1366
|
+
seriesIndex: n
|
|
1367
|
+
})),
|
|
1368
|
+
data: d.tooltipData?.[e] ?? null
|
|
1369
|
+
};
|
|
1370
|
+
}), $ = t(() => {
|
|
1371
|
+
let e = X.value;
|
|
1372
|
+
if (e === null) return null;
|
|
1373
|
+
let t = ae(e);
|
|
1374
|
+
return A.value ? {
|
|
1375
|
+
x: t,
|
|
1376
|
+
y: C.value.top,
|
|
1377
|
+
w: N.value,
|
|
1378
|
+
h: T.value
|
|
1379
|
+
} : {
|
|
1380
|
+
x: C.value.left,
|
|
1381
|
+
y: t,
|
|
1382
|
+
w: w.value,
|
|
1383
|
+
h: N.value
|
|
1384
|
+
};
|
|
1385
|
+
});
|
|
1386
|
+
return (t, c) => (h(), i("div", {
|
|
1387
|
+
ref_key: "containerRef",
|
|
1388
|
+
ref: m,
|
|
1389
|
+
class: "bar-chart-wrapper"
|
|
1390
|
+
}, [
|
|
1391
|
+
s.menu ? (h(), n(ce, {
|
|
1392
|
+
key: 0,
|
|
1393
|
+
items: x(he)
|
|
1394
|
+
}, null, 8, ["items"])) : r("", !0),
|
|
1395
|
+
(h(), i("svg", {
|
|
1396
|
+
ref_key: "svgRef",
|
|
1397
|
+
ref: Q,
|
|
1398
|
+
width: b.value,
|
|
1399
|
+
height: S.value
|
|
1400
|
+
}, [
|
|
1401
|
+
s.title ? (h(), i("text", {
|
|
1402
|
+
key: 0,
|
|
1403
|
+
x: b.value / 2,
|
|
1404
|
+
y: 18,
|
|
1405
|
+
"text-anchor": "middle",
|
|
1406
|
+
"font-size": "14",
|
|
1407
|
+
"font-weight": "600",
|
|
1408
|
+
fill: "currentColor"
|
|
1409
|
+
}, y(s.title), 9, Qe)) : r("", !0),
|
|
1410
|
+
K.value.length > 0 ? (h(), i("g", $e, [(h(!0), i(e, null, _(K.value, (t, n) => (h(), i(e, { key: "ileg" + n }, [a("rect", {
|
|
1411
|
+
x: x(C).left + n * 120,
|
|
1412
|
+
y: x(C).top - x(20) / 2 - 5,
|
|
1413
|
+
width: "12",
|
|
1414
|
+
height: "10",
|
|
1415
|
+
fill: t.color
|
|
1416
|
+
}, null, 8, et), a("text", {
|
|
1417
|
+
x: x(C).left + n * 120 + 18,
|
|
1418
|
+
y: x(C).top - x(20) / 2 + 4,
|
|
1419
|
+
"font-size": "11",
|
|
1420
|
+
fill: "currentColor"
|
|
1421
|
+
}, y(t.label), 9, tt)], 64))), 128))])) : r("", !0),
|
|
1422
|
+
a("line", {
|
|
1423
|
+
x1: x(z)(x(C).left),
|
|
1424
|
+
y1: x(z)(x(C).top),
|
|
1425
|
+
x2: x(z)(x(C).left),
|
|
1426
|
+
y2: x(z)(x(C).top + x(T)),
|
|
1427
|
+
stroke: "currentColor",
|
|
1428
|
+
"stroke-opacity": "0.3"
|
|
1429
|
+
}, null, 8, nt),
|
|
1430
|
+
a("line", {
|
|
1431
|
+
x1: x(z)(x(C).left),
|
|
1432
|
+
y1: x(z)(x(C).top + x(T)),
|
|
1433
|
+
x2: x(z)(x(C).left + x(w)),
|
|
1434
|
+
y2: x(z)(x(C).top + x(T)),
|
|
1435
|
+
stroke: "currentColor",
|
|
1436
|
+
"stroke-opacity": "0.3"
|
|
1437
|
+
}, null, 8, rt),
|
|
1438
|
+
s.valueGrid ? (h(!0), i(e, { key: 2 }, _(V.value, (e, t) => (h(), i("line", {
|
|
1439
|
+
key: "vg" + t,
|
|
1440
|
+
x1: A.value ? x(C).left : e.pos,
|
|
1441
|
+
y1: A.value ? e.pos : x(C).top,
|
|
1442
|
+
x2: A.value ? x(C).left + x(w) : e.pos,
|
|
1443
|
+
y2: A.value ? e.pos : x(C).top + x(T),
|
|
1444
|
+
stroke: "currentColor",
|
|
1445
|
+
"stroke-opacity": "0.1"
|
|
1446
|
+
}, null, 8, it))), 128)) : r("", !0),
|
|
1447
|
+
$.value && J.value ? (h(), i("rect", {
|
|
1448
|
+
key: 3,
|
|
1449
|
+
x: $.value.x,
|
|
1450
|
+
y: $.value.y,
|
|
1451
|
+
width: $.value.w,
|
|
1452
|
+
height: $.value.h,
|
|
1453
|
+
fill: "currentColor",
|
|
1454
|
+
"fill-opacity": "0.06",
|
|
1455
|
+
"pointer-events": "none"
|
|
1456
|
+
}, null, 8, at)) : r("", !0),
|
|
1457
|
+
A.value ? (h(!0), i(e, { key: 4 }, _(V.value, (e, t) => (h(), i("text", {
|
|
1458
|
+
key: "vt" + t,
|
|
1459
|
+
"data-testid": "value-tick",
|
|
1460
|
+
x: x(C).left - 6,
|
|
1461
|
+
y: e.pos,
|
|
1462
|
+
"text-anchor": "end",
|
|
1463
|
+
"dominant-baseline": "middle",
|
|
1464
|
+
"font-size": "10",
|
|
1465
|
+
fill: "currentColor",
|
|
1466
|
+
"fill-opacity": "0.6"
|
|
1467
|
+
}, y(e.value), 9, ot))), 128)) : (h(!0), i(e, { key: 5 }, _(V.value, (e, t) => (h(), i("text", {
|
|
1468
|
+
key: "vt" + t,
|
|
1469
|
+
"data-testid": "value-tick",
|
|
1470
|
+
x: e.pos,
|
|
1471
|
+
y: x(C).top + x(T) + 16,
|
|
1472
|
+
"text-anchor": "middle",
|
|
1473
|
+
"font-size": "10",
|
|
1474
|
+
fill: "currentColor",
|
|
1475
|
+
"fill-opacity": "0.6"
|
|
1476
|
+
}, y(e.value), 9, st))), 128)),
|
|
1477
|
+
s.yLabel ? (h(), i("text", {
|
|
1478
|
+
key: 6,
|
|
1479
|
+
x: 0,
|
|
1480
|
+
y: 0,
|
|
1481
|
+
transform: `translate(14, ${x(C).top + x(T) / 2}) rotate(-90)`,
|
|
1482
|
+
"text-anchor": "middle",
|
|
1483
|
+
"font-size": "13",
|
|
1484
|
+
fill: "currentColor"
|
|
1485
|
+
}, y(s.yLabel), 9, ct)) : r("", !0),
|
|
1486
|
+
A.value ? (h(!0), i(e, { key: 7 }, _(H.value, (e, t) => (h(), i("text", {
|
|
1487
|
+
key: "ct" + t,
|
|
1488
|
+
"data-testid": "category-tick",
|
|
1489
|
+
x: e.pos,
|
|
1490
|
+
y: x(C).top + x(T) + 16,
|
|
1491
|
+
"text-anchor": e.anchor,
|
|
1492
|
+
"font-size": "10",
|
|
1493
|
+
fill: "currentColor",
|
|
1494
|
+
"fill-opacity": "0.6"
|
|
1495
|
+
}, y(e.label), 9, lt))), 128)) : (h(!0), i(e, { key: 8 }, _(H.value, (e, t) => (h(), i("text", {
|
|
1496
|
+
key: "ct" + t,
|
|
1497
|
+
"data-testid": "category-tick",
|
|
1498
|
+
x: x(C).left - 6,
|
|
1499
|
+
y: e.pos,
|
|
1500
|
+
"text-anchor": "end",
|
|
1501
|
+
"dominant-baseline": "middle",
|
|
1502
|
+
"font-size": "10",
|
|
1503
|
+
fill: "currentColor",
|
|
1504
|
+
"fill-opacity": "0.6"
|
|
1505
|
+
}, y(e.label), 9, ut))), 128)),
|
|
1506
|
+
s.xLabel ? (h(), i("text", {
|
|
1507
|
+
key: 9,
|
|
1508
|
+
x: x(C).left + x(w) / 2,
|
|
1509
|
+
y: S.value - 4,
|
|
1510
|
+
"text-anchor": "middle",
|
|
1511
|
+
"font-size": "13",
|
|
1512
|
+
fill: "currentColor"
|
|
1513
|
+
}, y(s.xLabel), 9, dt)) : r("", !0),
|
|
1514
|
+
(h(!0), i(e, null, _(se.value, (e, t) => (h(), i("rect", {
|
|
1515
|
+
key: "bar" + t,
|
|
1516
|
+
"data-testid": "bar",
|
|
1517
|
+
"data-category": e.categoryIndex,
|
|
1518
|
+
"data-series": e.seriesIndex,
|
|
1519
|
+
x: e.x,
|
|
1520
|
+
y: e.y,
|
|
1521
|
+
width: e.w,
|
|
1522
|
+
height: e.h,
|
|
1523
|
+
fill: e.color,
|
|
1524
|
+
"fill-opacity": e.opacity
|
|
1525
|
+
}, null, 8, ft))), 128)),
|
|
1526
|
+
J.value ? (h(), i("rect", u({
|
|
1527
|
+
key: 10,
|
|
1528
|
+
x: x(C).left,
|
|
1529
|
+
y: x(C).top,
|
|
1530
|
+
width: x(w),
|
|
1531
|
+
height: x(T),
|
|
1532
|
+
fill: "transparent",
|
|
1533
|
+
style: {
|
|
1534
|
+
cursor: "crosshair",
|
|
1535
|
+
"touch-action": "none"
|
|
1536
|
+
}
|
|
1537
|
+
}, te(x(pe), !0)), null, 16, pt)) : r("", !0)
|
|
1538
|
+
], 8, Ze)),
|
|
1539
|
+
J.value && x(X) !== null && be.value ? (h(), i("div", {
|
|
1540
|
+
key: 1,
|
|
1541
|
+
ref_key: "tooltipRef",
|
|
1542
|
+
ref: de,
|
|
1543
|
+
class: "chart-tooltip-content",
|
|
1544
|
+
style: p({
|
|
1545
|
+
position: "absolute",
|
|
1546
|
+
top: "0",
|
|
1547
|
+
left: "0",
|
|
1548
|
+
willChange: "transform",
|
|
1549
|
+
transform: x(Z) ? `translate3d(${x(Z).left}px, ${x(Z).top}px, 0) translateY(-50%)` : "translateY(-50%)",
|
|
1550
|
+
visibility: x(Z) ? "visible" : "hidden"
|
|
1551
|
+
})
|
|
1552
|
+
}, [v(t.$slots, "tooltip", f(l(be.value)), () => [a("div", mt, [ye.value ? (h(), i("div", ht, y(ye.value), 1)) : r("", !0), (h(!0), i(e, null, _(be.value.values, (e) => (h(), i("div", {
|
|
1553
|
+
key: e.seriesIndex,
|
|
1554
|
+
class: "bar-chart-tooltip-row"
|
|
1555
|
+
}, [a("span", {
|
|
1556
|
+
class: "bar-chart-tooltip-swatch",
|
|
1557
|
+
style: p({ background: e.color })
|
|
1558
|
+
}, null, 4), o(" " + y(isFinite(e.value) ? x(U)(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
|
|
1559
|
+
x(ge) ? (h(), i("a", {
|
|
1560
|
+
key: 2,
|
|
1561
|
+
class: "bar-chart-download-link",
|
|
1562
|
+
href: x(_e),
|
|
1563
|
+
download: `${x(ve)()}.csv`
|
|
1564
|
+
}, y(x(ge)), 9, gt)) : r("", !0)
|
|
982
1565
|
], 512));
|
|
983
1566
|
}
|
|
984
|
-
}), [["__scopeId", "data-v-
|
|
1567
|
+
}), [["__scopeId", "data-v-c2d91885"]]), vt = {
|
|
985
1568
|
"01013": "010259",
|
|
986
1569
|
"01015": "010177",
|
|
987
1570
|
"01029": "010177",
|
|
@@ -4142,7 +4725,7 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
4142
4725
|
51019: "510014",
|
|
4143
4726
|
"02158": "020820",
|
|
4144
4727
|
46102: "460957"
|
|
4145
|
-
},
|
|
4728
|
+
}, yt = {
|
|
4146
4729
|
"010259": "Butler, AL",
|
|
4147
4730
|
"010177": "Calhoun (Anniston), AL - Cleburne, AL",
|
|
4148
4731
|
"010172": "Chambers, AL - Randolph, AL",
|
|
@@ -5092,25 +5675,25 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5092
5675
|
560775: "Teton, WY - Lincoln, WY",
|
|
5093
5676
|
560792: "Uinta, WY",
|
|
5094
5677
|
560804: "Weston, WY"
|
|
5095
|
-
},
|
|
5678
|
+
}, bt = ["width", "height"], xt = [
|
|
5096
5679
|
"data-feat-id",
|
|
5097
5680
|
"d",
|
|
5098
5681
|
"fill",
|
|
5099
5682
|
"stroke",
|
|
5100
5683
|
"stroke-width"
|
|
5101
|
-
],
|
|
5684
|
+
], St = { key: 0 }, Ct = ["d", "stroke"], wt = ["transform"], Tt = {
|
|
5102
5685
|
key: 0,
|
|
5103
5686
|
y: 5,
|
|
5104
5687
|
"font-size": "13",
|
|
5105
5688
|
"font-weight": "600",
|
|
5106
5689
|
fill: "currentColor"
|
|
5107
|
-
},
|
|
5690
|
+
}, Et = ["x", "fill"], Dt = ["x"], Ot = {
|
|
5108
5691
|
key: 0,
|
|
5109
5692
|
y: 5,
|
|
5110
5693
|
"font-size": "13",
|
|
5111
5694
|
"font-weight": "600",
|
|
5112
5695
|
fill: "currentColor"
|
|
5113
|
-
},
|
|
5696
|
+
}, kt = ["offset", "stop-color"], At = ["x", "fill"], jt = ["x"], Mt = ["x"], Nt = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
5114
5697
|
__name: "ChoroplethMap",
|
|
5115
5698
|
props: {
|
|
5116
5699
|
topology: {},
|
|
@@ -5146,80 +5729,80 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5146
5729
|
},
|
|
5147
5730
|
emits: ["stateClick", "stateHover"],
|
|
5148
5731
|
setup(o, { emit: s }) {
|
|
5149
|
-
let c = o, l = s,
|
|
5150
|
-
function
|
|
5151
|
-
if (
|
|
5732
|
+
let c = o, l = s, u = `choropleth-gradient-${S()}`, f = g(null), p = g(null), v = g(null), te = g(0), x = null, C = null, w = !1, T = typeof window < "u" && "ontouchstart" in window, re = null, E = null;
|
|
5733
|
+
function D() {
|
|
5734
|
+
if (T) return;
|
|
5152
5735
|
let e = v.value;
|
|
5153
|
-
e && (e.addEventListener("click",
|
|
5736
|
+
e && (e.addEventListener("click", $), e.addEventListener("mouseover", $), e.addEventListener("mousemove", xe), e.addEventListener("mouseout", Se));
|
|
5154
5737
|
}
|
|
5155
|
-
function
|
|
5738
|
+
function O() {
|
|
5156
5739
|
let e = v.value;
|
|
5157
|
-
e && (e.removeEventListener("click",
|
|
5740
|
+
e && (e.removeEventListener("click", $), e.removeEventListener("mouseover", $), e.removeEventListener("mousemove", xe), e.removeEventListener("mouseout", Se));
|
|
5158
5741
|
}
|
|
5159
|
-
|
|
5160
|
-
|
|
5742
|
+
ee(() => {
|
|
5743
|
+
f.value && (te.value = f.value.clientWidth, re = new ResizeObserver((e) => {
|
|
5161
5744
|
let t = e[0];
|
|
5162
|
-
t && (
|
|
5163
|
-
}),
|
|
5164
|
-
}),
|
|
5165
|
-
|
|
5745
|
+
t && (te.value = t.contentRect.width);
|
|
5746
|
+
}), re.observe(f.value)), k(), D();
|
|
5747
|
+
}), m(() => {
|
|
5748
|
+
re?.disconnect(), A(), O(), ve();
|
|
5166
5749
|
});
|
|
5167
|
-
function
|
|
5168
|
-
if (!
|
|
5169
|
-
let e =
|
|
5170
|
-
|
|
5171
|
-
|
|
5750
|
+
function k() {
|
|
5751
|
+
if (!p.value || !v.value || !c.zoom && !c.pan) return;
|
|
5752
|
+
let e = P(p.value);
|
|
5753
|
+
E = N().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
|
|
5754
|
+
w = !0, be();
|
|
5172
5755
|
}).on("zoom", (e) => {
|
|
5173
5756
|
v.value && v.value.setAttribute("transform", e.transform);
|
|
5174
5757
|
}).on("end", () => {
|
|
5175
|
-
|
|
5176
|
-
}), c.pan ||
|
|
5758
|
+
w = !1;
|
|
5759
|
+
}), c.pan || E.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(E);
|
|
5177
5760
|
}
|
|
5178
|
-
function
|
|
5179
|
-
|
|
5761
|
+
function A() {
|
|
5762
|
+
p.value && E && (P(p.value).on(".zoom", null), E = null);
|
|
5180
5763
|
}
|
|
5181
|
-
|
|
5182
|
-
|
|
5764
|
+
ne(() => [c.zoom, c.pan], () => {
|
|
5765
|
+
A(), O(), k(), D();
|
|
5183
5766
|
});
|
|
5184
|
-
let
|
|
5185
|
-
let e =
|
|
5767
|
+
let j = t(() => c.width ?? (te.value || 600)), I = t(() => c.width && c.height ? c.height / c.width : .625), L = t(() => j.value * I.value), se = t(() => {
|
|
5768
|
+
let e = b(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
|
|
5186
5769
|
for (let e of t) {
|
|
5187
|
-
let t =
|
|
5770
|
+
let t = vt[String(e.id).padStart(5, "0")];
|
|
5188
5771
|
t && (n.has(t) || n.set(t, []), n.get(t).push(e));
|
|
5189
5772
|
}
|
|
5190
5773
|
let r = [];
|
|
5191
5774
|
for (let [t, i] of n) r.push({
|
|
5192
5775
|
type: "Feature",
|
|
5193
5776
|
id: t,
|
|
5194
|
-
properties: { name:
|
|
5195
|
-
geometry:
|
|
5777
|
+
properties: { name: yt[t] ?? t },
|
|
5778
|
+
geometry: ae(e, i)
|
|
5196
5779
|
});
|
|
5197
5780
|
return {
|
|
5198
5781
|
type: "FeatureCollection",
|
|
5199
5782
|
features: r
|
|
5200
5783
|
};
|
|
5201
|
-
}),
|
|
5202
|
-
if (c.geoType === "hsas") return
|
|
5784
|
+
}), R = t(() => {
|
|
5785
|
+
if (c.geoType === "hsas") return se.value;
|
|
5203
5786
|
if (c.geoType === "counties") {
|
|
5204
|
-
let e =
|
|
5205
|
-
return
|
|
5787
|
+
let e = b(c.topology);
|
|
5788
|
+
return F(e, e.objects.counties);
|
|
5206
5789
|
}
|
|
5207
|
-
let e =
|
|
5208
|
-
return
|
|
5209
|
-
}),
|
|
5790
|
+
let e = b(c.topology);
|
|
5791
|
+
return F(e, e.objects.states);
|
|
5792
|
+
}), z = t(() => {
|
|
5210
5793
|
if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
|
|
5211
|
-
let e =
|
|
5212
|
-
return
|
|
5213
|
-
}),
|
|
5794
|
+
let e = b(c.topology);
|
|
5795
|
+
return oe(e, e.objects.states, (e, t) => e !== t);
|
|
5796
|
+
}), B = t(() => M().fitExtent([[0, Oe.value], [j.value, L.value + Oe.value]], R.value)), V = t(() => ie(B.value)), H = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), U = t(() => {
|
|
5214
5797
|
let e = /* @__PURE__ */ new Map();
|
|
5215
5798
|
if (!c.data) return e;
|
|
5216
5799
|
for (let t of c.data) {
|
|
5217
5800
|
e.set(t.id, t.value);
|
|
5218
|
-
let n =
|
|
5801
|
+
let n = R.value.features.find((e) => e.properties?.name === t.id);
|
|
5219
5802
|
n?.id != null && e.set(String(n.id), t.value);
|
|
5220
5803
|
}
|
|
5221
5804
|
return e;
|
|
5222
|
-
}),
|
|
5805
|
+
}), le = t(() => {
|
|
5223
5806
|
if (!c.data || c.data.length === 0) return {
|
|
5224
5807
|
min: 0,
|
|
5225
5808
|
max: 1
|
|
@@ -5236,8 +5819,8 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5236
5819
|
min: 0,
|
|
5237
5820
|
max: 1
|
|
5238
5821
|
};
|
|
5239
|
-
}),
|
|
5240
|
-
function
|
|
5822
|
+
}), W = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), G = t(() => Array.isArray(c.colorScale) && !W.value), K = t(() => G.value ? "" : c.colorScale?.min ?? "#e5f0fa"), q = t(() => G.value ? "" : c.colorScale?.max ?? "#08519c");
|
|
5823
|
+
function ue(e) {
|
|
5241
5824
|
let t = e.replace("#", "");
|
|
5242
5825
|
return [
|
|
5243
5826
|
parseInt(t.slice(0, 2), 16),
|
|
@@ -5245,103 +5828,103 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5245
5828
|
parseInt(t.slice(4, 6), 16)
|
|
5246
5829
|
];
|
|
5247
5830
|
}
|
|
5248
|
-
function
|
|
5249
|
-
let [t, n, r] =
|
|
5831
|
+
function Y(e) {
|
|
5832
|
+
let [t, n, r] = ue(K.value), [i, a, o] = ue(q.value);
|
|
5250
5833
|
return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
|
|
5251
5834
|
}
|
|
5252
|
-
function
|
|
5835
|
+
function Z(e) {
|
|
5253
5836
|
let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
|
|
5254
5837
|
for (let n of t) if (e >= n.min) return n.color;
|
|
5255
5838
|
return c.noDataColor;
|
|
5256
5839
|
}
|
|
5257
|
-
function
|
|
5840
|
+
function fe(e) {
|
|
5258
5841
|
let t = c.colorScale.find((t) => t.value === String(e));
|
|
5259
5842
|
return t ? t.color : c.noDataColor;
|
|
5260
5843
|
}
|
|
5261
|
-
function
|
|
5262
|
-
let t =
|
|
5844
|
+
function pe(e) {
|
|
5845
|
+
let t = U.value.get(String(e));
|
|
5263
5846
|
if (t == null) return c.noDataColor;
|
|
5264
|
-
if (
|
|
5265
|
-
if (
|
|
5266
|
-
let { min: n, max: r } =
|
|
5267
|
-
return
|
|
5847
|
+
if (W.value) return fe(t);
|
|
5848
|
+
if (G.value) return Z(t);
|
|
5849
|
+
let { min: n, max: r } = le.value;
|
|
5850
|
+
return Y((t - n) / (r - n));
|
|
5268
5851
|
}
|
|
5269
|
-
function
|
|
5852
|
+
function me(e) {
|
|
5270
5853
|
return e.properties?.name ?? String(e.id);
|
|
5271
5854
|
}
|
|
5272
|
-
function
|
|
5273
|
-
return
|
|
5855
|
+
function Q(e) {
|
|
5856
|
+
return U.value.get(String(e.id));
|
|
5274
5857
|
}
|
|
5275
|
-
let
|
|
5858
|
+
let he = t(() => {
|
|
5276
5859
|
let e = /* @__PURE__ */ new Map();
|
|
5277
|
-
for (let t of
|
|
5860
|
+
for (let t of R.value.features) e.set(String(t.id), t);
|
|
5278
5861
|
return e;
|
|
5279
5862
|
});
|
|
5280
|
-
function
|
|
5863
|
+
function ge(e) {
|
|
5281
5864
|
let t = e;
|
|
5282
5865
|
for (; t && !t.dataset?.featId;) t = t.parentElement;
|
|
5283
5866
|
if (!t) return null;
|
|
5284
|
-
let n =
|
|
5867
|
+
let n = he.value.get(t.dataset.featId);
|
|
5285
5868
|
return n ? {
|
|
5286
5869
|
pathEl: t,
|
|
5287
5870
|
feat: n
|
|
5288
5871
|
} : null;
|
|
5289
5872
|
}
|
|
5290
|
-
function
|
|
5291
|
-
|
|
5292
|
-
let r =
|
|
5873
|
+
function _e(e, t, n) {
|
|
5874
|
+
C || (C = document.createElement("div"), C.className = "chart-tooltip-content", C.style.position = "fixed", C.style.transform = "translateY(-50%)", document.body.appendChild(C));
|
|
5875
|
+
let r = me(e), i = Q(e), a = {
|
|
5293
5876
|
id: String(e.id),
|
|
5294
5877
|
name: r,
|
|
5295
5878
|
value: i
|
|
5296
5879
|
};
|
|
5297
|
-
c.tooltipFormat ?
|
|
5298
|
-
let o =
|
|
5299
|
-
|
|
5880
|
+
c.tooltipFormat ? C.innerHTML = c.tooltipFormat(a) : C.textContent = i == null ? r : `${r}: ${i}`;
|
|
5881
|
+
let o = f.value?.getBoundingClientRect(), { left: s, top: l } = J(t, n, C.offsetWidth, C.offsetHeight, c.tooltipClamp, o);
|
|
5882
|
+
C.style.left = `${s}px`, C.style.top = `${l}px`;
|
|
5300
5883
|
}
|
|
5301
|
-
function
|
|
5302
|
-
|
|
5884
|
+
function ve() {
|
|
5885
|
+
C &&= (C.remove(), null);
|
|
5303
5886
|
}
|
|
5304
|
-
function
|
|
5305
|
-
x && x !== e && (x.setAttribute("stroke-width", String(
|
|
5887
|
+
function ye(e, t) {
|
|
5888
|
+
x && x !== e && (x.setAttribute("stroke-width", String(H.value)), x.setAttribute("stroke", c.strokeColor)), x = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(H.value + 1)), e.setAttribute("stroke", "#555");
|
|
5306
5889
|
}
|
|
5307
|
-
function
|
|
5308
|
-
x && (x.setAttribute("stroke-width", String(
|
|
5890
|
+
function be() {
|
|
5891
|
+
x && (x.setAttribute("stroke-width", String(H.value)), x.setAttribute("stroke", c.strokeColor), x = null, l("stateHover", null)), ve();
|
|
5309
5892
|
}
|
|
5310
|
-
function
|
|
5311
|
-
if (
|
|
5312
|
-
let t = e, n =
|
|
5893
|
+
function $(e) {
|
|
5894
|
+
if (w) return;
|
|
5895
|
+
let t = e, n = ge(t.target);
|
|
5313
5896
|
n && (e.type === "click" ? l("stateClick", {
|
|
5314
5897
|
id: String(n.feat.id),
|
|
5315
|
-
name:
|
|
5316
|
-
value:
|
|
5317
|
-
}) : e.type === "mouseover" && (
|
|
5898
|
+
name: me(n.feat),
|
|
5899
|
+
value: Q(n.feat)
|
|
5900
|
+
}) : e.type === "mouseover" && (ye(n.pathEl, n.feat), c.tooltipTrigger && _e(n.feat, t.clientX, t.clientY), l("stateHover", {
|
|
5318
5901
|
id: String(n.feat.id),
|
|
5319
|
-
name:
|
|
5320
|
-
value:
|
|
5902
|
+
name: me(n.feat),
|
|
5903
|
+
value: Q(n.feat)
|
|
5321
5904
|
})));
|
|
5322
5905
|
}
|
|
5323
|
-
function
|
|
5324
|
-
|
|
5906
|
+
function xe(e) {
|
|
5907
|
+
w || !C || (C.style.left = `${e.clientX + 16}px`, C.style.top = `${e.clientY}px`);
|
|
5325
5908
|
}
|
|
5326
|
-
function
|
|
5909
|
+
function Se(e) {
|
|
5327
5910
|
let t = e.relatedTarget;
|
|
5328
|
-
t && v.value?.contains(t) ||
|
|
5911
|
+
t && v.value?.contains(t) || be();
|
|
5329
5912
|
}
|
|
5330
|
-
function
|
|
5913
|
+
function Ce() {
|
|
5331
5914
|
return typeof c.menu == "string" ? c.menu : "choropleth";
|
|
5332
5915
|
}
|
|
5333
|
-
let
|
|
5916
|
+
let we = t(() => c.legend && (W.value || G.value || c.data)), Te = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), Ee = t(() => c.title ? 24 : 0), De = t(() => we.value ? 28 : 0), Oe = t(() => Ee.value + De.value), ke = t(() => L.value + Oe.value), Ae = t(() => Ee.value + 18), je = t(() => {
|
|
5334
5917
|
let e = [];
|
|
5335
5918
|
for (let t = 0; t <= 10; t++) {
|
|
5336
5919
|
let n = t / 10;
|
|
5337
5920
|
e.push({
|
|
5338
5921
|
offset: `${(n * 100).toFixed(0)}%`,
|
|
5339
|
-
color:
|
|
5922
|
+
color: Y(n)
|
|
5340
5923
|
});
|
|
5341
5924
|
}
|
|
5342
5925
|
return e;
|
|
5343
|
-
}),
|
|
5344
|
-
let { min: e, max: t } =
|
|
5926
|
+
}), Me = t(() => {
|
|
5927
|
+
let { min: e, max: t } = le.value, n = t - e, r = [];
|
|
5345
5928
|
for (let t = 1; t <= 3; t++) {
|
|
5346
5929
|
let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
|
|
5347
5930
|
r.push({
|
|
@@ -5350,118 +5933,118 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5350
5933
|
});
|
|
5351
5934
|
}
|
|
5352
5935
|
return r;
|
|
5353
|
-
}),
|
|
5936
|
+
}), Ne = t(() => {
|
|
5354
5937
|
let e = [];
|
|
5355
|
-
if (
|
|
5938
|
+
if (W.value) for (let t of c.colorScale) e.push({
|
|
5356
5939
|
key: t.value,
|
|
5357
5940
|
color: t.color,
|
|
5358
5941
|
label: t.value
|
|
5359
5942
|
});
|
|
5360
|
-
else if (
|
|
5943
|
+
else if (G.value) for (let t of Te.value) e.push({
|
|
5361
5944
|
key: String(t.min),
|
|
5362
5945
|
color: t.color,
|
|
5363
5946
|
label: t.label ?? String(t.min)
|
|
5364
5947
|
});
|
|
5365
5948
|
return e;
|
|
5366
|
-
}),
|
|
5949
|
+
}), Pe = t(() => {
|
|
5367
5950
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5368
|
-
for (let t of
|
|
5369
|
-
return e - (
|
|
5370
|
-
}),
|
|
5951
|
+
for (let t of Ne.value) e += 16 + t.label.length * 7 + 12;
|
|
5952
|
+
return e - (Ne.value.length > 0 ? 12 : 0);
|
|
5953
|
+
}), Fe = t(() => {
|
|
5371
5954
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5372
|
-
return
|
|
5955
|
+
return Ne.value.map((t) => {
|
|
5373
5956
|
let n = e;
|
|
5374
5957
|
return e += 16 + t.label.length * 7 + 12, n;
|
|
5375
5958
|
});
|
|
5376
|
-
}),
|
|
5377
|
-
if (
|
|
5959
|
+
}), Ie = t(() => {
|
|
5960
|
+
if (W.value || G.value) return (j.value - Pe.value) / 2;
|
|
5378
5961
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5379
|
-
return (
|
|
5380
|
-
}),
|
|
5381
|
-
let e =
|
|
5962
|
+
return (j.value - e - 160) / 2;
|
|
5963
|
+
}), Le = t(() => {
|
|
5964
|
+
let e = Ce();
|
|
5382
5965
|
return [{
|
|
5383
5966
|
label: "Save as SVG",
|
|
5384
5967
|
action: () => {
|
|
5385
|
-
|
|
5968
|
+
p.value && X(p.value, e);
|
|
5386
5969
|
}
|
|
5387
5970
|
}, {
|
|
5388
5971
|
label: "Save as PNG",
|
|
5389
5972
|
action: () => {
|
|
5390
|
-
|
|
5973
|
+
p.value && de(p.value, e);
|
|
5391
5974
|
}
|
|
5392
5975
|
}];
|
|
5393
5976
|
});
|
|
5394
|
-
return (t, s) => (
|
|
5977
|
+
return (t, s) => (h(), i("div", {
|
|
5395
5978
|
ref_key: "containerRef",
|
|
5396
|
-
ref:
|
|
5397
|
-
class:
|
|
5398
|
-
}, [o.menu ? (
|
|
5979
|
+
ref: f,
|
|
5980
|
+
class: d(["choropleth-wrapper", { pannable: o.pan }])
|
|
5981
|
+
}, [o.menu ? (h(), n(ce, {
|
|
5399
5982
|
key: 0,
|
|
5400
|
-
items:
|
|
5401
|
-
}, null, 8, ["items"])) : r("", !0), (
|
|
5983
|
+
items: Le.value
|
|
5984
|
+
}, null, 8, ["items"])) : r("", !0), (h(), i("svg", {
|
|
5402
5985
|
ref_key: "svgRef",
|
|
5403
|
-
ref:
|
|
5404
|
-
width:
|
|
5405
|
-
height:
|
|
5986
|
+
ref: p,
|
|
5987
|
+
width: j.value,
|
|
5988
|
+
height: ke.value
|
|
5406
5989
|
}, [
|
|
5407
5990
|
a("g", {
|
|
5408
5991
|
ref_key: "mapGroupRef",
|
|
5409
5992
|
ref: v
|
|
5410
|
-
}, [(
|
|
5993
|
+
}, [(h(!0), i(e, null, _(R.value.features, (e) => (h(), i("path", {
|
|
5411
5994
|
key: String(e.id),
|
|
5412
5995
|
"data-feat-id": String(e.id),
|
|
5413
|
-
d:
|
|
5414
|
-
fill:
|
|
5996
|
+
d: V.value(e) ?? void 0,
|
|
5997
|
+
fill: pe(e.id),
|
|
5415
5998
|
stroke: o.strokeColor,
|
|
5416
|
-
"stroke-width":
|
|
5999
|
+
"stroke-width": H.value,
|
|
5417
6000
|
class: "state-path"
|
|
5418
|
-
}, [o.tooltipTrigger ? r("", !0) : (
|
|
6001
|
+
}, [o.tooltipTrigger ? r("", !0) : (h(), i("title", St, y(me(e)) + y(Q(e) == null ? "" : `: ${Q(e)}`), 1))], 8, xt))), 128)), z.value ? (h(), i("path", {
|
|
5419
6002
|
key: 0,
|
|
5420
|
-
d:
|
|
6003
|
+
d: V.value(z.value) ?? void 0,
|
|
5421
6004
|
fill: "none",
|
|
5422
6005
|
stroke: o.strokeColor,
|
|
5423
6006
|
"stroke-width": 1,
|
|
5424
6007
|
"stroke-linejoin": "round",
|
|
5425
6008
|
"pointer-events": "none"
|
|
5426
|
-
}, null, 8,
|
|
5427
|
-
|
|
6009
|
+
}, null, 8, Ct)) : r("", !0)], 512),
|
|
6010
|
+
we.value ? (h(), i("g", {
|
|
5428
6011
|
key: 0,
|
|
5429
6012
|
class: "choropleth-legend",
|
|
5430
|
-
transform: `translate(${
|
|
5431
|
-
}, [
|
|
5432
|
-
x:
|
|
6013
|
+
transform: `translate(${Ie.value},${Ae.value})`
|
|
6014
|
+
}, [W.value || G.value ? (h(), i(e, { key: 0 }, [o.legendTitle ? (h(), i("text", Tt, y(o.legendTitle), 1)) : r("", !0), (h(!0), i(e, null, _(Ne.value, (t, n) => (h(), i(e, { key: t.key }, [a("rect", {
|
|
6015
|
+
x: Fe.value[n],
|
|
5433
6016
|
y: -5,
|
|
5434
6017
|
width: "12",
|
|
5435
6018
|
height: "12",
|
|
5436
6019
|
rx: "3",
|
|
5437
6020
|
fill: t.color
|
|
5438
|
-
}, null, 8,
|
|
5439
|
-
x:
|
|
6021
|
+
}, null, 8, Et), a("text", {
|
|
6022
|
+
x: Fe.value[n] + 16,
|
|
5440
6023
|
y: 5,
|
|
5441
6024
|
"font-size": "13",
|
|
5442
6025
|
fill: "currentColor"
|
|
5443
|
-
},
|
|
5444
|
-
o.legendTitle ? (
|
|
6026
|
+
}, y(t.label), 9, Dt)], 64))), 128))], 64)) : (h(), i(e, { key: 1 }, [
|
|
6027
|
+
o.legendTitle ? (h(), i("text", Ot, y(o.legendTitle), 1)) : r("", !0),
|
|
5445
6028
|
a("defs", null, [a("linearGradient", {
|
|
5446
|
-
id:
|
|
6029
|
+
id: u,
|
|
5447
6030
|
x1: "0",
|
|
5448
6031
|
x2: "1",
|
|
5449
6032
|
y1: "0",
|
|
5450
6033
|
y2: "0"
|
|
5451
|
-
}, [(
|
|
6034
|
+
}, [(h(!0), i(e, null, _(je.value, (e) => (h(), i("stop", {
|
|
5452
6035
|
key: e.offset,
|
|
5453
6036
|
offset: e.offset,
|
|
5454
6037
|
"stop-color": e.color
|
|
5455
|
-
}, null, 8,
|
|
6038
|
+
}, null, 8, kt))), 128))])]),
|
|
5456
6039
|
a("rect", {
|
|
5457
6040
|
x: o.legendTitle ? o.legendTitle.length * 8 + 12 : 0,
|
|
5458
6041
|
y: -6,
|
|
5459
6042
|
width: 160,
|
|
5460
6043
|
height: 12,
|
|
5461
6044
|
rx: "2",
|
|
5462
|
-
fill: `url(#${
|
|
5463
|
-
}, null, 8,
|
|
5464
|
-
(
|
|
6045
|
+
fill: `url(#${u})`
|
|
6046
|
+
}, null, 8, At),
|
|
6047
|
+
(h(!0), i(e, null, _(Me.value, (e) => (h(), i("text", {
|
|
5465
6048
|
key: e.value,
|
|
5466
6049
|
x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
|
|
5467
6050
|
y: 20,
|
|
@@ -5469,20 +6052,20 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5469
6052
|
fill: "currentColor",
|
|
5470
6053
|
opacity: "0.7",
|
|
5471
6054
|
"text-anchor": "middle"
|
|
5472
|
-
},
|
|
5473
|
-
], 64))], 8,
|
|
5474
|
-
o.title ? (
|
|
6055
|
+
}, y(e.value), 9, jt))), 128))
|
|
6056
|
+
], 64))], 8, wt)) : r("", !0),
|
|
6057
|
+
o.title ? (h(), i("text", {
|
|
5475
6058
|
key: 1,
|
|
5476
|
-
x:
|
|
6059
|
+
x: j.value / 2,
|
|
5477
6060
|
y: 18,
|
|
5478
6061
|
"text-anchor": "middle",
|
|
5479
6062
|
"font-size": "14",
|
|
5480
6063
|
"font-weight": "600",
|
|
5481
6064
|
fill: "currentColor"
|
|
5482
|
-
},
|
|
5483
|
-
], 8,
|
|
6065
|
+
}, y(o.title), 9, Mt)) : r("", !0)
|
|
6066
|
+
], 8, bt))], 2));
|
|
5484
6067
|
}
|
|
5485
|
-
}), [["__scopeId", "data-v-25a20d5b"]]),
|
|
6068
|
+
}), [["__scopeId", "data-v-25a20d5b"]]), Pt = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
5486
6069
|
__name: "ChartTooltip",
|
|
5487
6070
|
props: {
|
|
5488
6071
|
x: {},
|
|
@@ -5493,30 +6076,30 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5493
6076
|
},
|
|
5494
6077
|
emits: ["close"],
|
|
5495
6078
|
setup(e) {
|
|
5496
|
-
return (t, o) => e.mode === "hover" && e.open ? (
|
|
6079
|
+
return (t, o) => e.mode === "hover" && e.open ? (h(), i("div", {
|
|
5497
6080
|
key: 0,
|
|
5498
6081
|
class: "chart-tooltip-content",
|
|
5499
|
-
style:
|
|
6082
|
+
style: p({
|
|
5500
6083
|
position: "absolute",
|
|
5501
6084
|
left: `${e.x + e.sideOffset}px`,
|
|
5502
6085
|
top: `${e.y}px`,
|
|
5503
6086
|
transform: "translateY(-50%)"
|
|
5504
6087
|
})
|
|
5505
|
-
}, [
|
|
6088
|
+
}, [v(t.$slots, "default", {}, void 0, !0)], 4)) : e.mode === "click" ? (h(), n(x(j), {
|
|
5506
6089
|
key: 1,
|
|
5507
6090
|
open: e.open
|
|
5508
6091
|
}, {
|
|
5509
|
-
default:
|
|
5510
|
-
default:
|
|
6092
|
+
default: C(() => [s(x(O), { "as-child": "" }, {
|
|
6093
|
+
default: C(() => [a("div", {
|
|
5511
6094
|
class: "chart-tooltip-anchor",
|
|
5512
|
-
style:
|
|
6095
|
+
style: p({
|
|
5513
6096
|
left: `${e.x}px`,
|
|
5514
6097
|
top: `${e.y}px`
|
|
5515
6098
|
})
|
|
5516
6099
|
}, null, 4)]),
|
|
5517
6100
|
_: 1
|
|
5518
|
-
}), s(
|
|
5519
|
-
default:
|
|
6101
|
+
}), s(x(A), null, {
|
|
6102
|
+
default: C(() => [e.open ? (h(), n(x(k), {
|
|
5520
6103
|
key: 0,
|
|
5521
6104
|
class: "chart-tooltip-content",
|
|
5522
6105
|
side: "right",
|
|
@@ -5525,7 +6108,7 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5525
6108
|
onPointerDownOutside: o[0] ||= (e) => t.$emit("close"),
|
|
5526
6109
|
onEscapeKeyDown: o[1] ||= (e) => t.$emit("close")
|
|
5527
6110
|
}, {
|
|
5528
|
-
default:
|
|
6111
|
+
default: C(() => [v(t.$slots, "default", {}, void 0, !0)]),
|
|
5529
6112
|
_: 3
|
|
5530
6113
|
}, 8, ["side-offset"])) : r("", !0)]),
|
|
5531
6114
|
_: 3
|
|
@@ -5533,7 +6116,7 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5533
6116
|
_: 3
|
|
5534
6117
|
}, 8, ["open"])) : r("", !0);
|
|
5535
6118
|
}
|
|
5536
|
-
}), [["__scopeId", "data-v-44377f70"]]),
|
|
6119
|
+
}), [["__scopeId", "data-v-44377f70"]]), Ft = { class: "TableWrapper" }, It = { class: "Table" }, Lt = ["href", "download"], Rt = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
5537
6120
|
__name: "DataTable",
|
|
5538
6121
|
props: {
|
|
5539
6122
|
data: {},
|
|
@@ -5556,7 +6139,7 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5556
6139
|
function l(e) {
|
|
5557
6140
|
return c.columnConfig?.[e]?.label ?? e;
|
|
5558
6141
|
}
|
|
5559
|
-
function
|
|
6142
|
+
function u(e) {
|
|
5560
6143
|
let t = c.columnConfig?.[e]?.width;
|
|
5561
6144
|
if (t == null) return;
|
|
5562
6145
|
let n = typeof t == "number" ? `${t}px` : s[t];
|
|
@@ -5565,16 +6148,16 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5565
6148
|
minWidth: n
|
|
5566
6149
|
};
|
|
5567
6150
|
}
|
|
5568
|
-
function
|
|
6151
|
+
function f(e) {
|
|
5569
6152
|
let t = c.columnConfig?.[e]?.align;
|
|
5570
6153
|
if (t) return { textAlign: t };
|
|
5571
6154
|
}
|
|
5572
|
-
function
|
|
6155
|
+
function ee(e) {
|
|
5573
6156
|
return typeof e.column == "function";
|
|
5574
6157
|
}
|
|
5575
|
-
let
|
|
6158
|
+
let m = t(() => {
|
|
5576
6159
|
let e = c.data;
|
|
5577
|
-
return
|
|
6160
|
+
return ee(e) ? e.columns.map((t) => ({
|
|
5578
6161
|
name: t.name,
|
|
5579
6162
|
values: e.column(t.name),
|
|
5580
6163
|
enumLabels: t.enumLabels
|
|
@@ -5582,65 +6165,65 @@ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
|
5582
6165
|
name: e,
|
|
5583
6166
|
values: t
|
|
5584
6167
|
}));
|
|
5585
|
-
}),
|
|
5586
|
-
let e =
|
|
6168
|
+
}), g = t(() => {
|
|
6169
|
+
let e = m.value;
|
|
5587
6170
|
if (e.length === 0) return 0;
|
|
5588
6171
|
let t = 0;
|
|
5589
6172
|
for (let n of e) t = Math.max(t, n.values.length);
|
|
5590
6173
|
return c.maxRows ? Math.min(t, c.maxRows) : t;
|
|
5591
6174
|
});
|
|
5592
|
-
function
|
|
6175
|
+
function v(e, t) {
|
|
5593
6176
|
let n = e.values[t];
|
|
5594
6177
|
return n == null ? "" : e.enumLabels && typeof n == "number" ? e.enumLabels[n] ?? String(n) : typeof n == "number" ? Number.isInteger(n) ? n.toString() : n.toFixed(4) : typeof n == "boolean" ? n ? "true" : "false" : String(n);
|
|
5595
6178
|
}
|
|
5596
|
-
function
|
|
6179
|
+
function te() {
|
|
5597
6180
|
return c.filename ? c.filename : typeof c.menu == "string" ? c.menu : "data";
|
|
5598
6181
|
}
|
|
5599
|
-
function
|
|
6182
|
+
function b(e) {
|
|
5600
6183
|
return e.includes(",") || e.includes("\"") || e.includes("\n") ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
5601
6184
|
}
|
|
5602
|
-
function
|
|
6185
|
+
function x() {
|
|
5603
6186
|
if (typeof c.csv == "function") return c.csv();
|
|
5604
6187
|
if (typeof c.csv == "string") return c.csv;
|
|
5605
|
-
let e =
|
|
6188
|
+
let e = m.value, t = g.value, n = [e.map((e) => b(l(e.name))).join(",")];
|
|
5606
6189
|
for (let r = 0; r < t; r++) {
|
|
5607
|
-
let t = e.map((e) =>
|
|
6190
|
+
let t = e.map((e) => b(v(e, r)));
|
|
5608
6191
|
n.push(t.join(","));
|
|
5609
6192
|
}
|
|
5610
6193
|
return n.join("\n");
|
|
5611
6194
|
}
|
|
5612
|
-
let
|
|
6195
|
+
let S = t(() => c.downloadLink ? [] : [{
|
|
5613
6196
|
label: "Download CSV",
|
|
5614
|
-
action: () =>
|
|
5615
|
-
}]),
|
|
5616
|
-
return (t, s) => (
|
|
5617
|
-
|
|
6197
|
+
action: () => Z(x(), te())
|
|
6198
|
+
}]), ne = t(() => c.downloadLink ? typeof c.downloadLink == "string" ? c.downloadLink : "Download data (CSV)" : null), C = t(() => c.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(x())}` : null), w = t(() => c.menu && S.value.length > 0);
|
|
6199
|
+
return (t, s) => (h(), i("div", { class: d(["TableOuter", { "has-menu": w.value }]) }, [
|
|
6200
|
+
w.value ? (h(), n(ce, {
|
|
5618
6201
|
key: 0,
|
|
5619
|
-
items:
|
|
6202
|
+
items: S.value
|
|
5620
6203
|
}, null, 8, ["items"])) : r("", !0),
|
|
5621
|
-
a("div",
|
|
5622
|
-
a("colgroup", null, [(
|
|
6204
|
+
a("div", Ft, [a("table", It, [
|
|
6205
|
+
a("colgroup", null, [(h(!0), i(e, null, _(m.value, (e) => (h(), i("col", {
|
|
5623
6206
|
key: e.name,
|
|
5624
|
-
style:
|
|
6207
|
+
style: p(u(e.name))
|
|
5625
6208
|
}, null, 4))), 128))]),
|
|
5626
|
-
a("thead", null, [a("tr", null, [(
|
|
6209
|
+
a("thead", null, [a("tr", null, [(h(!0), i(e, null, _(m.value, (e) => (h(), i("th", {
|
|
5627
6210
|
key: e.name,
|
|
5628
|
-
style:
|
|
5629
|
-
},
|
|
5630
|
-
a("tbody", null, [(
|
|
6211
|
+
style: p(f(e.name))
|
|
6212
|
+
}, y(l(e.name)), 5))), 128))])]),
|
|
6213
|
+
a("tbody", null, [(h(!0), i(e, null, _(g.value, (t) => (h(), i("tr", { key: t }, [(h(!0), i(e, null, _(m.value, (e) => (h(), i("td", {
|
|
5631
6214
|
key: e.name,
|
|
5632
|
-
class:
|
|
5633
|
-
style:
|
|
5634
|
-
},
|
|
6215
|
+
class: d(o.columnConfig?.[e.name]?.cellClass),
|
|
6216
|
+
style: p(f(e.name))
|
|
6217
|
+
}, y(v(e, t - 1)), 7))), 128))]))), 128))])
|
|
5635
6218
|
])]),
|
|
5636
|
-
|
|
6219
|
+
ne.value ? (h(), i("a", {
|
|
5637
6220
|
key: 1,
|
|
5638
6221
|
class: "data-table-download-link",
|
|
5639
|
-
href:
|
|
5640
|
-
download: `${
|
|
5641
|
-
},
|
|
6222
|
+
href: C.value,
|
|
6223
|
+
download: `${te()}.csv`
|
|
6224
|
+
}, y(ne.value), 9, Lt)) : r("", !0)
|
|
5642
6225
|
], 2));
|
|
5643
6226
|
}
|
|
5644
6227
|
}), [["__scopeId", "data-v-505e2187"]]);
|
|
5645
6228
|
//#endregion
|
|
5646
|
-
export {
|
|
6229
|
+
export { _t as BarChart, Pt as ChartTooltip, Nt as ChoroplethMap, Rt as DataTable, Xe as LineChart };
|