@cfasim-ui/charts 0.4.0 → 0.4.1
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 +11 -2
- package/dist/ChartMenu/ChartMenu.d.ts +5 -1
- package/dist/ChoroplethMap/ChoroplethMap.d.ts +6 -0
- package/dist/DataTable/DataTable.d.ts +10 -8
- package/dist/LineChart/LineChart.d.ts +11 -2
- package/dist/index.css +1 -1
- package/dist/index.js +417 -396
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,30 +1,22 @@
|
|
|
1
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
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
|
|
4
|
-
import { zoom as
|
|
5
|
-
import { select as
|
|
6
|
-
import { feature as
|
|
3
|
+
import { geoAlbersUsa as M, geoPath as N } from "d3-geo";
|
|
4
|
+
import { zoom as P } from "d3-zoom";
|
|
5
|
+
import { select as F } from "d3-selection";
|
|
6
|
+
import { feature as I, merge as L, mesh as ie } from "topojson-client";
|
|
7
7
|
//#region src/ChartMenu/ChartMenu.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var
|
|
8
|
+
var R = { class: "chart-menu-trigger-area" }, ae = ["aria-label"], z = /* @__PURE__ */ c({
|
|
9
9
|
__name: "ChartMenu",
|
|
10
|
-
props: {
|
|
10
|
+
props: {
|
|
11
|
+
items: {},
|
|
12
|
+
forceDropdown: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: !1
|
|
15
|
+
}
|
|
16
|
+
},
|
|
11
17
|
setup(t) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class: "chart-menu-button chart-menu-single",
|
|
15
|
-
"aria-label": t.items[0].label,
|
|
16
|
-
onClick: c[0] ||= (...e) => t.items[0].action && t.items[0].action(...e)
|
|
17
|
-
}, [...c[1] ||= [a("svg", {
|
|
18
|
-
width: "14",
|
|
19
|
-
height: "14",
|
|
20
|
-
viewBox: "0 0 14 14",
|
|
21
|
-
fill: "none",
|
|
22
|
-
stroke: "currentColor",
|
|
23
|
-
"stroke-width": "1.5",
|
|
24
|
-
"stroke-linecap": "round",
|
|
25
|
-
"stroke-linejoin": "round",
|
|
26
|
-
"aria-hidden": "true"
|
|
27
|
-
}, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8, L)) : (h(), n(x(E), {
|
|
18
|
+
let r = t, c = () => r.forceDropdown || r.items.length > 1;
|
|
19
|
+
return (r, l) => (h(), i("div", R, [c() ? (h(), n(x(E), {
|
|
28
20
|
key: 1,
|
|
29
21
|
modal: !1
|
|
30
22
|
}, {
|
|
@@ -32,7 +24,7 @@ var I = { class: "chart-menu-trigger-area" }, L = ["aria-label"], se = /* @__PUR
|
|
|
32
24
|
class: "chart-menu-button",
|
|
33
25
|
"aria-label": "Chart options"
|
|
34
26
|
}, {
|
|
35
|
-
default: C(() => [...
|
|
27
|
+
default: C(() => [...l[2] ||= [a("svg", {
|
|
36
28
|
width: "16",
|
|
37
29
|
height: "16",
|
|
38
30
|
viewBox: "0 0 16 16",
|
|
@@ -75,46 +67,61 @@ var I = { class: "chart-menu-trigger-area" }, L = ["aria-label"], se = /* @__PUR
|
|
|
75
67
|
_: 1
|
|
76
68
|
})]),
|
|
77
69
|
_: 1
|
|
78
|
-
}))
|
|
70
|
+
})) : (h(), i("button", {
|
|
71
|
+
key: 0,
|
|
72
|
+
class: "chart-menu-button chart-menu-single",
|
|
73
|
+
"aria-label": t.items[0].label,
|
|
74
|
+
onClick: l[0] ||= (...e) => t.items[0].action && t.items[0].action(...e)
|
|
75
|
+
}, [...l[1] ||= [a("svg", {
|
|
76
|
+
width: "14",
|
|
77
|
+
height: "14",
|
|
78
|
+
viewBox: "0 0 14 14",
|
|
79
|
+
fill: "none",
|
|
80
|
+
stroke: "currentColor",
|
|
81
|
+
"stroke-width": "1.5",
|
|
82
|
+
"stroke-linecap": "round",
|
|
83
|
+
"stroke-linejoin": "round",
|
|
84
|
+
"aria-hidden": "true"
|
|
85
|
+
}, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8, ae))]));
|
|
79
86
|
}
|
|
80
|
-
}),
|
|
87
|
+
}), B = (e, t) => {
|
|
81
88
|
let n = e.__vccOpts || e;
|
|
82
89
|
for (let [e, r] of t) n[e] = r;
|
|
83
90
|
return n;
|
|
84
|
-
},
|
|
91
|
+
}, oe = /* @__PURE__ */ B(z, [["__scopeId", "data-v-b3c563e8"]]);
|
|
85
92
|
//#endregion
|
|
86
93
|
//#region src/_shared/axes.ts
|
|
87
|
-
function
|
|
94
|
+
function V(e) {
|
|
88
95
|
return Math.round(e) + .5;
|
|
89
96
|
}
|
|
90
|
-
function
|
|
97
|
+
function H(e, t) {
|
|
91
98
|
let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r, a;
|
|
92
99
|
return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
|
|
93
100
|
}
|
|
94
|
-
function
|
|
101
|
+
function se(e, t, n) {
|
|
95
102
|
if (!(n > 0) || !isFinite(n)) return [];
|
|
96
103
|
let r = [], i = Math.ceil(e / n) * n;
|
|
97
104
|
for (let e = 0, a = i; a <= t + 1e-9 && e < 1e3; e++, a = i + e * n) r.push(a);
|
|
98
105
|
return r;
|
|
99
106
|
}
|
|
100
|
-
var
|
|
101
|
-
function
|
|
102
|
-
return Math.abs(e) >= 1e3 ?
|
|
107
|
+
var U = new Intl.NumberFormat();
|
|
108
|
+
function W(e) {
|
|
109
|
+
return Math.abs(e) >= 1e3 ? U.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
|
|
103
110
|
}
|
|
104
111
|
//#endregion
|
|
105
112
|
//#region src/_shared/computeTicks.ts
|
|
106
|
-
function
|
|
113
|
+
function ce(e) {
|
|
107
114
|
let { min: t, max: n, ticks: r } = e;
|
|
108
115
|
if (t === n) return [];
|
|
109
116
|
let i = e.displayOffset ?? 0;
|
|
110
117
|
if (Array.isArray(r)) return r.map((e) => e - i).filter((e) => e >= t && e <= n);
|
|
111
|
-
if (typeof r == "number") return
|
|
112
|
-
let a = Math.max(3, Math.floor(e.targetTickCount ?? 3)), o =
|
|
113
|
-
return
|
|
118
|
+
if (typeof r == "number") return se(t + i, n + i, r).map((e) => e - i);
|
|
119
|
+
let a = Math.max(3, Math.floor(e.targetTickCount ?? 3)), o = H(n - t, a);
|
|
120
|
+
return se(t + i, n + i, o).map((e) => e - i);
|
|
114
121
|
}
|
|
115
122
|
//#endregion
|
|
116
123
|
//#region src/_shared/useChartSize.ts
|
|
117
|
-
function
|
|
124
|
+
function G(e = {}) {
|
|
118
125
|
let t = g(null), n = g(0), r = null, i = null;
|
|
119
126
|
return ee(() => {
|
|
120
127
|
t.value && (n.value = t.value.clientWidth, r = new ResizeObserver((t) => {
|
|
@@ -132,7 +139,7 @@ function W(e = {}) {
|
|
|
132
139
|
measuredWidth: n
|
|
133
140
|
};
|
|
134
141
|
}
|
|
135
|
-
function
|
|
142
|
+
function K(e) {
|
|
136
143
|
let n = t(() => ({
|
|
137
144
|
top: (e.title() ? 30 : 10) + (e.hasInlineLegend() ? 20 : 0),
|
|
138
145
|
right: 10,
|
|
@@ -147,10 +154,10 @@ function G(e) {
|
|
|
147
154
|
}
|
|
148
155
|
//#endregion
|
|
149
156
|
//#region src/tooltip-position.ts
|
|
150
|
-
var
|
|
151
|
-
function
|
|
157
|
+
var q = 16, J = 8;
|
|
158
|
+
function le(e, t, n, r, i, a) {
|
|
152
159
|
if (i === "none") return {
|
|
153
|
-
left: e +
|
|
160
|
+
left: e + q,
|
|
154
161
|
top: t
|
|
155
162
|
};
|
|
156
163
|
let o = i === "chart" && a ? {
|
|
@@ -163,10 +170,10 @@ function J(e, t, n, r, i, a) {
|
|
|
163
170
|
right: window.innerWidth,
|
|
164
171
|
top: 0,
|
|
165
172
|
bottom: window.innerHeight
|
|
166
|
-
}, s = e +
|
|
173
|
+
}, s = e + q + n > o.right - J ? e - q - n : e + q, c = r / 2;
|
|
167
174
|
return {
|
|
168
175
|
left: s,
|
|
169
|
-
top: Math.min(Math.max(t, o.top +
|
|
176
|
+
top: Math.min(Math.max(t, o.top + J + c), o.bottom - J - c)
|
|
170
177
|
};
|
|
171
178
|
}
|
|
172
179
|
//#endregion
|
|
@@ -192,7 +199,7 @@ function ue(e) {
|
|
|
192
199
|
}
|
|
193
200
|
let s = i.value, c = e.containerRef.value;
|
|
194
201
|
if (!s || !c) return;
|
|
195
|
-
let l = c.getBoundingClientRect(), u = r.value ? t : 0, d = e.clamp?.() ?? "chart", { left: f, top: p } =
|
|
202
|
+
let l = c.getBoundingClientRect(), u = r.value ? t : 0, d = e.clamp?.() ?? "chart", { left: f, top: p } = le(a.value.clientX, a.value.clientY - u, s.offsetWidth, s.offsetHeight, d, l);
|
|
196
203
|
o.value = {
|
|
197
204
|
left: f - l.left,
|
|
198
205
|
top: p - l.top
|
|
@@ -242,13 +249,13 @@ function Y(e, t) {
|
|
|
242
249
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
243
250
|
r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
|
|
244
251
|
}
|
|
245
|
-
function
|
|
252
|
+
function de(e, t) {
|
|
246
253
|
let n = e.cloneNode(!0);
|
|
247
254
|
n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
248
255
|
let r = new XMLSerializer().serializeToString(n);
|
|
249
256
|
Y(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
|
|
250
257
|
}
|
|
251
|
-
function
|
|
258
|
+
function X(e, t) {
|
|
252
259
|
let n = e.cloneNode(!0);
|
|
253
260
|
n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
254
261
|
let r = new XMLSerializer().serializeToString(n), i = new Blob([r], { type: "image/svg+xml;charset=utf-8" }), a = URL.createObjectURL(i), o = new Image(), s = e.width.baseVal.value || e.clientWidth, c = e.height.baseVal.value || e.clientHeight;
|
|
@@ -261,12 +268,12 @@ function de(e, t) {
|
|
|
261
268
|
}), URL.revokeObjectURL(a);
|
|
262
269
|
}, o.src = a;
|
|
263
270
|
}
|
|
264
|
-
function
|
|
271
|
+
function fe(e, t) {
|
|
265
272
|
Y(new Blob([e], { type: "text/csv" }), `${t}.csv`);
|
|
266
273
|
}
|
|
267
274
|
//#endregion
|
|
268
275
|
//#region src/_shared/useChartMenu.ts
|
|
269
|
-
function
|
|
276
|
+
function pe(e) {
|
|
270
277
|
let n = g(null);
|
|
271
278
|
function r() {
|
|
272
279
|
let t = e.filename();
|
|
@@ -280,17 +287,17 @@ function fe(e) {
|
|
|
280
287
|
let t = r(), i = [{
|
|
281
288
|
label: "Save as SVG",
|
|
282
289
|
action: () => {
|
|
283
|
-
n.value &&
|
|
290
|
+
n.value && de(n.value, t);
|
|
284
291
|
}
|
|
285
292
|
}, {
|
|
286
293
|
label: "Save as PNG",
|
|
287
294
|
action: () => {
|
|
288
|
-
n.value &&
|
|
295
|
+
n.value && X(n.value, t);
|
|
289
296
|
}
|
|
290
297
|
}];
|
|
291
298
|
return e.downloadLink() || i.push({
|
|
292
299
|
label: "Download CSV",
|
|
293
|
-
action: () =>
|
|
300
|
+
action: () => fe(e.getCsv(), t)
|
|
294
301
|
}), i;
|
|
295
302
|
}),
|
|
296
303
|
downloadLinkText: t(() => {
|
|
@@ -303,7 +310,7 @@ function fe(e) {
|
|
|
303
310
|
}
|
|
304
311
|
//#endregion
|
|
305
312
|
//#region src/_shared/seriesCsv.ts
|
|
306
|
-
function
|
|
313
|
+
function me(e) {
|
|
307
314
|
if (e.length === 0) return "";
|
|
308
315
|
let t = 0;
|
|
309
316
|
for (let n of e) n.data.length > t && (t = n.data.length);
|
|
@@ -315,7 +322,7 @@ function pe(e) {
|
|
|
315
322
|
}
|
|
316
323
|
return i.join("\n");
|
|
317
324
|
}
|
|
318
|
-
function
|
|
325
|
+
function Z(e, t, n = "category") {
|
|
319
326
|
if (t.length === 0 || e.length === 0) return "";
|
|
320
327
|
let r = [(t.length === 1 ? [n, t[0].label || "value"] : [n, ...t.map((e, t) => e.label || `series_${t}`)]).join(",")];
|
|
321
328
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -343,12 +350,12 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
343
350
|
"fill",
|
|
344
351
|
"fill-opacity",
|
|
345
352
|
"stroke"
|
|
346
|
-
], be = ["x", "y"],
|
|
353
|
+
], be = ["x", "y"], xe = [
|
|
347
354
|
"x1",
|
|
348
355
|
"y1",
|
|
349
356
|
"x2",
|
|
350
357
|
"y2"
|
|
351
|
-
],
|
|
358
|
+
], $ = [
|
|
352
359
|
"x1",
|
|
353
360
|
"y1",
|
|
354
361
|
"x2",
|
|
@@ -446,7 +453,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
446
453
|
], He = ["x", "y"], Ue = { class: "line-chart-tooltip" }, We = {
|
|
447
454
|
key: 0,
|
|
448
455
|
class: "line-chart-tooltip-label"
|
|
449
|
-
}, Ge = ["href", "download"], Ke = 36, qe = 12, Je = 7, Ye = 16, Xe = /* @__PURE__ */
|
|
456
|
+
}, Ge = ["href", "download"], Ke = 36, qe = 12, Je = 7, Ye = 16, Xe = /* @__PURE__ */ B(/* @__PURE__ */ c({
|
|
450
457
|
__name: "LineChart",
|
|
451
458
|
props: {
|
|
452
459
|
y: {},
|
|
@@ -467,6 +474,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
467
474
|
yTicks: {},
|
|
468
475
|
xTickFormat: {},
|
|
469
476
|
yTickFormat: {},
|
|
477
|
+
tooltipValueFormat: {},
|
|
470
478
|
xLabels: {},
|
|
471
479
|
debounce: {},
|
|
472
480
|
menu: {
|
|
@@ -484,7 +492,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
484
492
|
},
|
|
485
493
|
emits: ["hover"],
|
|
486
494
|
setup(s, { emit: c }) {
|
|
487
|
-
let d = s, ee = c, { containerRef: m, measuredWidth: g } =
|
|
495
|
+
let d = s, ee = c, { containerRef: m, measuredWidth: g } = G({ debounce: () => d.debounce }), b = t(() => d.width ?? (g.value || 400)), S = t(() => d.height ?? 200), ne = t(() => O.value.some((e) => e.legend) || d.areaSections?.some((e) => e.legend === "inline" && (e.label || e.description)) || !1), { padding: C, innerW: w, innerH: T } = K({
|
|
488
496
|
title: () => d.title,
|
|
489
497
|
xLabel: () => d.xLabel,
|
|
490
498
|
yLabel: () => d.yLabel,
|
|
@@ -498,35 +506,38 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
498
506
|
data: e.y ?? e.data ?? re
|
|
499
507
|
};
|
|
500
508
|
}
|
|
501
|
-
|
|
509
|
+
function D(e) {
|
|
510
|
+
return d.tooltipValueFormat ? d.tooltipValueFormat(e) : d.yTickFormat ? d.yTickFormat(e) : W(e);
|
|
511
|
+
}
|
|
512
|
+
let O = t(() => {
|
|
502
513
|
if (d.series && d.series.length > 0) return d.series.map(E);
|
|
503
514
|
let e = d.y ?? d.data;
|
|
504
515
|
return e ? [{
|
|
505
516
|
data: e,
|
|
506
517
|
x: d.x
|
|
507
518
|
}] : [];
|
|
508
|
-
}),
|
|
519
|
+
}), k = t(() => d.areas ?? []), A = t(() => {
|
|
509
520
|
let e = 0;
|
|
510
|
-
for (let t of
|
|
511
|
-
for (let t of
|
|
521
|
+
for (let t of O.value) t.data.length > e && (e = t.data.length);
|
|
522
|
+
for (let t of k.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
|
|
512
523
|
return e;
|
|
513
|
-
}),
|
|
514
|
-
function
|
|
524
|
+
}), j = t(() => O.value.some((e) => e.x != null) || k.value.some((e) => e.x != null));
|
|
525
|
+
function M(e, t) {
|
|
515
526
|
return e.x ? Number(e.x[t]) : t;
|
|
516
527
|
}
|
|
517
|
-
function
|
|
528
|
+
function N(e, t) {
|
|
518
529
|
return e.x ? Number(e.x[t]) : t;
|
|
519
530
|
}
|
|
520
|
-
let
|
|
531
|
+
let P = t(() => j.value ? 0 : d.xMin ?? 0), F = t(() => {
|
|
521
532
|
let e = Infinity, t = -Infinity;
|
|
522
|
-
for (let n of
|
|
523
|
-
let i =
|
|
533
|
+
for (let n of O.value) for (let r = 0; r < n.data.length; r++) {
|
|
534
|
+
let i = M(n, r);
|
|
524
535
|
isFinite(i) && (i < e && (e = i), i > t && (t = i));
|
|
525
536
|
}
|
|
526
|
-
for (let n of
|
|
537
|
+
for (let n of k.value) {
|
|
527
538
|
let r = Math.max(n.upper.length, n.lower.length);
|
|
528
539
|
for (let i = 0; i < r; i++) {
|
|
529
|
-
let r =
|
|
540
|
+
let r = N(n, i);
|
|
530
541
|
isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
531
542
|
}
|
|
532
543
|
}
|
|
@@ -538,14 +549,14 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
538
549
|
max: 0
|
|
539
550
|
};
|
|
540
551
|
});
|
|
541
|
-
function
|
|
542
|
-
let { min: t, max: n } =
|
|
552
|
+
function I(e) {
|
|
553
|
+
let { min: t, max: n } = F.value, r = n - t || 1;
|
|
543
554
|
return C.value.left + (e - t) / r * w.value;
|
|
544
555
|
}
|
|
545
|
-
let
|
|
556
|
+
let L = t(() => {
|
|
546
557
|
let e = Infinity, t = -Infinity;
|
|
547
|
-
for (let n of
|
|
548
|
-
for (let n of
|
|
558
|
+
for (let n of O.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
559
|
+
for (let n of k.value) {
|
|
549
560
|
for (let r of n.upper) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
550
561
|
for (let r of n.lower) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
551
562
|
}
|
|
@@ -559,66 +570,66 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
559
570
|
range: 1
|
|
560
571
|
};
|
|
561
572
|
});
|
|
562
|
-
function
|
|
573
|
+
function ie(e) {
|
|
563
574
|
let t = e.data;
|
|
564
575
|
if (t.length === 0) return "";
|
|
565
|
-
let { min: n, range: r } =
|
|
576
|
+
let { min: n, range: r } = L.value, i = T.value / r, a = C.value.top + T.value, o = "", s = !1;
|
|
566
577
|
for (let r = 0; r < t.length; r++) {
|
|
567
|
-
let c =
|
|
578
|
+
let c = M(e, r);
|
|
568
579
|
if (!isFinite(t[r]) || !isFinite(c)) {
|
|
569
580
|
s = !1;
|
|
570
581
|
continue;
|
|
571
582
|
}
|
|
572
|
-
let l =
|
|
583
|
+
let l = I(c), u = a - (t[r] - n) * i;
|
|
573
584
|
o += s ? `L${l},${u}` : `M${l},${u}`, s = !0;
|
|
574
585
|
}
|
|
575
586
|
return o;
|
|
576
587
|
}
|
|
577
|
-
function
|
|
578
|
-
let t = e.data, { min: n, range: r } =
|
|
588
|
+
function R(e) {
|
|
589
|
+
let t = e.data, { min: n, range: r } = L.value, i = T.value / r, a = C.value.top + T.value, o = [];
|
|
579
590
|
for (let r = 0; r < t.length; r++) {
|
|
580
|
-
let s =
|
|
591
|
+
let s = M(e, r);
|
|
581
592
|
!isFinite(t[r]) || !isFinite(s) || o.push({
|
|
582
|
-
x:
|
|
593
|
+
x: I(s),
|
|
583
594
|
y: a - (t[r] - n) * i
|
|
584
595
|
});
|
|
585
596
|
}
|
|
586
597
|
return o;
|
|
587
598
|
}
|
|
588
|
-
function
|
|
599
|
+
function ae(e) {
|
|
589
600
|
let t = Math.min(e.upper.length, e.lower.length);
|
|
590
601
|
if (t === 0) return "";
|
|
591
|
-
let { min: n, range: r } =
|
|
592
|
-
for (let n = 0; n < t; n++) isFinite(e.upper[n]) && isFinite(e.lower[n]) && isFinite(
|
|
602
|
+
let { min: n, range: r } = L.value, i = T.value / r, a = C.value.top + T.value, o = (e) => a - (e - n) * i, s = [], c = [];
|
|
603
|
+
for (let n = 0; n < t; n++) isFinite(e.upper[n]) && isFinite(e.lower[n]) && isFinite(N(e, n)) ? c.push(n) : c.length && (s.push(c), c = []);
|
|
593
604
|
c.length && s.push(c);
|
|
594
605
|
let l = "";
|
|
595
606
|
for (let t of s) {
|
|
596
|
-
l += `M${
|
|
597
|
-
for (let n = 1; n < t.length; n++) l += `L${
|
|
598
|
-
for (let n = t.length - 1; n >= 0; n--) l += `L${
|
|
607
|
+
l += `M${I(N(e, t[0]))},${o(e.upper[t[0]])}`;
|
|
608
|
+
for (let n = 1; n < t.length; n++) l += `L${I(N(e, t[n]))},${o(e.upper[t[n]])}`;
|
|
609
|
+
for (let n = t.length - 1; n >= 0; n--) l += `L${I(N(e, t[n]))},${o(e.lower[t[n]])}`;
|
|
599
610
|
l += "Z";
|
|
600
611
|
}
|
|
601
612
|
return l;
|
|
602
613
|
}
|
|
603
|
-
function
|
|
604
|
-
let n = t === "start" ? e.startIndex : e.endIndex, r = e.seriesIndex != null &&
|
|
605
|
-
return
|
|
614
|
+
function z(e, t) {
|
|
615
|
+
let n = t === "start" ? e.startIndex : e.endIndex, r = e.seriesIndex != null && O.value[e.seriesIndex] || O.value[0];
|
|
616
|
+
return I(r ? M(r, n) : n);
|
|
606
617
|
}
|
|
607
|
-
function
|
|
618
|
+
function B(e, t = !0) {
|
|
608
619
|
let n = C.value.top + T.value;
|
|
609
620
|
if (e.seriesIndex == null) {
|
|
610
|
-
let t =
|
|
621
|
+
let t = z(e, "start"), r = z(e, "end");
|
|
611
622
|
return t > r ? "" : `M${t},${C.value.top}L${r},${C.value.top}L${r},${n}L${t},${n}Z`;
|
|
612
623
|
}
|
|
613
|
-
let r =
|
|
624
|
+
let r = O.value[e.seriesIndex];
|
|
614
625
|
if (!r) return "";
|
|
615
|
-
let { min: i, range: a } =
|
|
626
|
+
let { min: i, range: a } = L.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);
|
|
616
627
|
if (c > l) return "";
|
|
617
|
-
let u = `M${
|
|
618
|
-
for (let e = c + 1; e <= l; e++) isFinite(r.data[e]) && (u += `L${
|
|
619
|
-
return t && (u += `L${
|
|
628
|
+
let u = `M${I(M(r, c))},${s(r.data[c])}`;
|
|
629
|
+
for (let e = c + 1; e <= l; e++) isFinite(r.data[e]) && (u += `L${I(M(r, e))},${s(r.data[e])}`);
|
|
630
|
+
return t && (u += `L${I(M(r, l))},${n}`, u += `L${I(M(r, c))},${n}`, u += "Z"), u;
|
|
620
631
|
}
|
|
621
|
-
let
|
|
632
|
+
let H = t(() => {
|
|
622
633
|
let e = d.areaSections;
|
|
623
634
|
if (!e?.length) return {
|
|
624
635
|
labels: [],
|
|
@@ -627,7 +638,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
627
638
|
let t = [], n = C.value.left + w.value;
|
|
628
639
|
for (let r of e) {
|
|
629
640
|
if (!r.label && !r.description || r.legend === "inline" || r.legend === !1) continue;
|
|
630
|
-
let e = r.label ?? "", i = r.description ?? "", a = Math.max(e.length, i.length) * Je, o =
|
|
641
|
+
let e = r.label ?? "", i = r.description ?? "", a = Math.max(e.length, i.length) * Je, o = z(r, "start") + a / 2 + 2, s = n - a / 2 - 8, c = Math.min(o, s), l = r.color ?? (r.seriesIndex == null ? "#999" : O.value[r.seriesIndex]?.color ?? "currentColor");
|
|
631
642
|
t.push({
|
|
632
643
|
cx: c,
|
|
633
644
|
labelText: e,
|
|
@@ -654,9 +665,9 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
654
665
|
labels: t,
|
|
655
666
|
extraHeight: (Math.max(...t.map((e) => e.row)) + 1) * Ke + qe
|
|
656
667
|
};
|
|
657
|
-
}),
|
|
668
|
+
}), se = t(() => {
|
|
658
669
|
let e = [];
|
|
659
|
-
for (let t of
|
|
670
|
+
for (let t of O.value) t.legend && e.push({
|
|
660
671
|
label: t.legend,
|
|
661
672
|
color: t.color ?? "currentColor",
|
|
662
673
|
type: "series",
|
|
@@ -665,7 +676,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
665
676
|
let t = d.areaSections;
|
|
666
677
|
if (t) for (let n of t) {
|
|
667
678
|
if (n.legend !== "inline" || !n.label && !n.description) continue;
|
|
668
|
-
let t = [n.label, n.description].filter(Boolean).join(" "), r = n.color ?? (n.seriesIndex == null ? "#999" :
|
|
679
|
+
let t = [n.label, n.description].filter(Boolean).join(" "), r = n.color ?? (n.seriesIndex == null ? "#999" : O.value[n.seriesIndex]?.color ?? "currentColor");
|
|
669
680
|
e.push({
|
|
670
681
|
label: t,
|
|
671
682
|
color: r,
|
|
@@ -674,12 +685,12 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
674
685
|
});
|
|
675
686
|
}
|
|
676
687
|
return e;
|
|
677
|
-
}),
|
|
678
|
-
let { min: e, max: t } =
|
|
688
|
+
}), U = t(() => S.value + H.value.extraHeight), q = t(() => C.value.top + T.value + C.value.bottom + qe), J = t(() => {
|
|
689
|
+
let { min: e, max: t } = L.value, n = (t) => V(C.value.top + T.value - (t - e) / L.value.range * T.value), r = (e) => d.yTickFormat ? d.yTickFormat(e) : W(e);
|
|
679
690
|
return e === t ? [{
|
|
680
691
|
value: r(e),
|
|
681
|
-
y:
|
|
682
|
-
}] :
|
|
692
|
+
y: V(C.value.top + T.value / 2)
|
|
693
|
+
}] : ce({
|
|
683
694
|
min: e,
|
|
684
695
|
max: t,
|
|
685
696
|
ticks: d.yTicks,
|
|
@@ -688,18 +699,18 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
688
699
|
value: r(e),
|
|
689
700
|
y: n(e)
|
|
690
701
|
}));
|
|
691
|
-
}),
|
|
692
|
-
let { min: e, max: t } =
|
|
702
|
+
}), le = t(() => {
|
|
703
|
+
let { min: e, max: t } = F.value;
|
|
693
704
|
if (e === t) return [];
|
|
694
|
-
let n =
|
|
705
|
+
let n = P.value, r = A.value, i = (e, t) => {
|
|
695
706
|
let r = e + n;
|
|
696
|
-
return d.xTickFormat ? d.xTickFormat(r, t) : !
|
|
707
|
+
return d.xTickFormat ? d.xTickFormat(r, t) : !j.value && d.xLabels && Number.isInteger(e) && e >= 0 && e < d.xLabels.length ? d.xLabels[e] : W(r);
|
|
697
708
|
}, a;
|
|
698
|
-
if (d.xTicks == null && !
|
|
709
|
+
if (d.xTicks == null && !j.value && d.xLabels && d.xLabels.length === r) {
|
|
699
710
|
let e = Math.max(3, Math.floor(w.value / 80)), t = Math.max(1, Math.round((r - 1) / e));
|
|
700
711
|
a = [];
|
|
701
712
|
for (let e = 0; e < r; e += t) a.push(e);
|
|
702
|
-
} else a =
|
|
713
|
+
} else a = ce({
|
|
703
714
|
min: e,
|
|
704
715
|
max: t,
|
|
705
716
|
ticks: d.xTicks,
|
|
@@ -708,7 +719,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
708
719
|
});
|
|
709
720
|
let o = C.value.left, s = C.value.left + w.value;
|
|
710
721
|
return a.map((e, t) => {
|
|
711
|
-
let n =
|
|
722
|
+
let n = V(I(e)), r = "middle";
|
|
712
723
|
return n - o <= 1 ? r = "start" : s - n <= 1 && (r = "end"), {
|
|
713
724
|
value: i(e, t),
|
|
714
725
|
x: n,
|
|
@@ -716,48 +727,48 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
716
727
|
};
|
|
717
728
|
});
|
|
718
729
|
});
|
|
719
|
-
function
|
|
720
|
-
return typeof d.csv == "function" ? d.csv() : typeof d.csv == "string" ? d.csv :
|
|
730
|
+
function Y() {
|
|
731
|
+
return typeof d.csv == "function" ? d.csv() : typeof d.csv == "string" ? d.csv : me(O.value);
|
|
721
732
|
}
|
|
722
|
-
let
|
|
723
|
-
let e =
|
|
724
|
-
return e === null || !t ? null :
|
|
725
|
-
}),
|
|
733
|
+
let de = t(() => !!d.tooltipData || !!d.tooltipTrigger), X = t(() => {
|
|
734
|
+
let e = Qe.value, t = O.value[0];
|
|
735
|
+
return e === null || !t ? null : M(t, e);
|
|
736
|
+
}), fe = t(() => X.value === null ? 0 : I(X.value));
|
|
726
737
|
function Z(e, t) {
|
|
727
738
|
let n = e.data.length;
|
|
728
739
|
if (n === 0) return null;
|
|
729
740
|
let r = 0, i = Infinity;
|
|
730
741
|
for (let a = 0; a < n; a++) {
|
|
731
|
-
let n =
|
|
742
|
+
let n = M(e, a);
|
|
732
743
|
if (!isFinite(n)) continue;
|
|
733
744
|
let o = Math.abs(n - t);
|
|
734
745
|
o < i && (i = o, r = a);
|
|
735
746
|
}
|
|
736
747
|
return i === Infinity ? null : r;
|
|
737
748
|
}
|
|
738
|
-
let
|
|
749
|
+
let Q = t(() => {
|
|
739
750
|
let e = X.value;
|
|
740
751
|
if (e === null) return [];
|
|
741
|
-
let { min: t, range: n } =
|
|
742
|
-
for (let n of
|
|
752
|
+
let { min: t, range: n } = L.value, r = T.value / n, i = C.value.top + T.value, a = [];
|
|
753
|
+
for (let n of O.value) {
|
|
743
754
|
let o = Z(n, e);
|
|
744
755
|
if (o === null) continue;
|
|
745
756
|
let s = n.data[o];
|
|
746
757
|
isFinite(s) && a.push({
|
|
747
|
-
x:
|
|
758
|
+
x: I(M(n, o)),
|
|
748
759
|
y: i - (s - t) * r,
|
|
749
760
|
color: n.color ?? "currentColor"
|
|
750
761
|
});
|
|
751
762
|
}
|
|
752
763
|
return a;
|
|
753
|
-
}),
|
|
754
|
-
let e =
|
|
764
|
+
}), Xe = t(() => {
|
|
765
|
+
let e = Qe.value, t = X.value;
|
|
755
766
|
if (e === null || t === null) return null;
|
|
756
|
-
let n = t +
|
|
757
|
-
return r = d.xTickFormat ? d.xTickFormat(n, e) :
|
|
767
|
+
let n = t + P.value, r;
|
|
768
|
+
return r = d.xTickFormat ? d.xTickFormat(n, e) : j.value ? W(n) : d.xLabels?.[e], {
|
|
758
769
|
index: e,
|
|
759
770
|
xLabel: r,
|
|
760
|
-
values:
|
|
771
|
+
values: O.value.map((e, n) => {
|
|
761
772
|
let r = Z(e, t);
|
|
762
773
|
return {
|
|
763
774
|
value: r === null ? NaN : Number(e.data[r]),
|
|
@@ -768,25 +779,25 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
768
779
|
data: d.tooltipData?.[e] ?? null
|
|
769
780
|
};
|
|
770
781
|
});
|
|
771
|
-
function
|
|
782
|
+
function Ze(e) {
|
|
772
783
|
let t = m.value?.getBoundingClientRect();
|
|
773
784
|
if (!t) return null;
|
|
774
|
-
let n =
|
|
785
|
+
let n = O.value[0];
|
|
775
786
|
if (!n || n.data.length === 0) return null;
|
|
776
|
-
let { min: r, max: i } =
|
|
787
|
+
let { min: r, max: i } = F.value, a = i - r || 1;
|
|
777
788
|
return Z(n, r + (e - t.left - C.value.left) / w.value * a);
|
|
778
789
|
}
|
|
779
|
-
let { hoverIndex:
|
|
780
|
-
enabled: () =>
|
|
790
|
+
let { hoverIndex: Qe, tooltipRef: $e, tooltipPos: et, handlers: tt } = ue({
|
|
791
|
+
enabled: () => de.value,
|
|
781
792
|
trigger: () => d.tooltipTrigger,
|
|
782
793
|
clamp: () => d.tooltipClamp,
|
|
783
|
-
pointerToIndex:
|
|
794
|
+
pointerToIndex: Ze,
|
|
784
795
|
containerRef: m,
|
|
785
796
|
onHover: (e) => ee("hover", e)
|
|
786
|
-
}), { svgRef:
|
|
797
|
+
}), { svgRef: nt, items: rt, downloadLinkText: it, csvHref: at, resolvedFilename: ot } = pe({
|
|
787
798
|
filename: () => d.filename,
|
|
788
799
|
legacyMenuLabel: () => d.menu,
|
|
789
|
-
getCsv:
|
|
800
|
+
getCsv: Y,
|
|
790
801
|
downloadLink: () => d.downloadLink
|
|
791
802
|
});
|
|
792
803
|
return (t, c) => (h(), i("div", {
|
|
@@ -794,15 +805,15 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
794
805
|
ref: m,
|
|
795
806
|
class: "line-chart-wrapper"
|
|
796
807
|
}, [
|
|
797
|
-
s.menu ? (h(), n(
|
|
808
|
+
s.menu ? (h(), n(oe, {
|
|
798
809
|
key: 0,
|
|
799
|
-
items: x(
|
|
810
|
+
items: x(rt)
|
|
800
811
|
}, null, 8, ["items"])) : r("", !0),
|
|
801
812
|
(h(), i("svg", {
|
|
802
813
|
ref_key: "svgRef",
|
|
803
|
-
ref:
|
|
814
|
+
ref: nt,
|
|
804
815
|
width: b.value,
|
|
805
|
-
height:
|
|
816
|
+
height: U.value
|
|
806
817
|
}, [
|
|
807
818
|
s.title ? (h(), i("text", {
|
|
808
819
|
key: 0,
|
|
@@ -813,7 +824,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
813
824
|
"font-weight": "600",
|
|
814
825
|
fill: "currentColor"
|
|
815
826
|
}, y(s.title), 9, ge)) : r("", !0),
|
|
816
|
-
|
|
827
|
+
se.value.length > 0 ? (h(), i("g", _e, [(h(!0), i(e, null, _(se.value, (t, n) => (h(), i(e, { key: "ileg" + n }, [t.type === "series" ? (h(), i("line", {
|
|
817
828
|
key: 0,
|
|
818
829
|
x1: x(C).left + n * 120,
|
|
819
830
|
y1: x(C).top - x(20) / 2,
|
|
@@ -838,22 +849,22 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
838
849
|
fill: "currentColor"
|
|
839
850
|
}, y(t.label), 9, be)], 64))), 128))])) : r("", !0),
|
|
840
851
|
a("line", {
|
|
841
|
-
x1: x(
|
|
842
|
-
y1: x(
|
|
843
|
-
x2: x(
|
|
844
|
-
y2: x(
|
|
852
|
+
x1: x(V)(x(C).left),
|
|
853
|
+
y1: x(V)(x(C).top),
|
|
854
|
+
x2: x(V)(x(C).left),
|
|
855
|
+
y2: x(V)(x(C).top + x(T)),
|
|
845
856
|
stroke: "currentColor",
|
|
846
857
|
"stroke-opacity": "0.3"
|
|
847
|
-
}, null, 8,
|
|
858
|
+
}, null, 8, xe),
|
|
848
859
|
a("line", {
|
|
849
|
-
x1: x(
|
|
850
|
-
y1: x(
|
|
851
|
-
x2: x(
|
|
852
|
-
y2: x(
|
|
860
|
+
x1: x(V)(x(C).left),
|
|
861
|
+
y1: x(V)(x(C).top + x(T)),
|
|
862
|
+
x2: x(V)(x(C).left + x(w)),
|
|
863
|
+
y2: x(V)(x(C).top + x(T)),
|
|
853
864
|
stroke: "currentColor",
|
|
854
865
|
"stroke-opacity": "0.3"
|
|
855
|
-
}, null, 8,
|
|
856
|
-
s.yGrid ? (h(!0), i(e, { key: 2 }, _(
|
|
866
|
+
}, null, 8, $),
|
|
867
|
+
s.yGrid ? (h(!0), i(e, { key: 2 }, _(J.value, (e, t) => (h(), i("line", {
|
|
857
868
|
key: "yg" + t,
|
|
858
869
|
x1: x(C).left,
|
|
859
870
|
y1: e.y,
|
|
@@ -862,7 +873,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
862
873
|
stroke: "currentColor",
|
|
863
874
|
"stroke-opacity": "0.1"
|
|
864
875
|
}, null, 8, Se))), 128)) : r("", !0),
|
|
865
|
-
s.xGrid ? (h(!0), i(e, { key: 3 }, _(
|
|
876
|
+
s.xGrid ? (h(!0), i(e, { key: 3 }, _(le.value, (e, t) => (h(), i("line", {
|
|
866
877
|
key: "xg" + t,
|
|
867
878
|
x1: e.x,
|
|
868
879
|
y1: x(C).top,
|
|
@@ -871,7 +882,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
871
882
|
stroke: "currentColor",
|
|
872
883
|
"stroke-opacity": "0.1"
|
|
873
884
|
}, null, 8, Ce))), 128)) : r("", !0),
|
|
874
|
-
(h(!0), i(e, null, _(
|
|
885
|
+
(h(!0), i(e, null, _(J.value, (e, t) => (h(), i("text", {
|
|
875
886
|
key: "y" + t,
|
|
876
887
|
"data-testid": "y-tick",
|
|
877
888
|
x: x(C).left - 6,
|
|
@@ -891,7 +902,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
891
902
|
"font-size": "13",
|
|
892
903
|
fill: "currentColor"
|
|
893
904
|
}, y(s.yLabel), 9, Te)) : r("", !0),
|
|
894
|
-
(h(!0), i(e, null, _(
|
|
905
|
+
(h(!0), i(e, null, _(le.value, (e, t) => (h(), i("text", {
|
|
895
906
|
key: "x" + t,
|
|
896
907
|
"data-testid": "x-tick",
|
|
897
908
|
x: e.x,
|
|
@@ -909,22 +920,22 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
909
920
|
"font-size": "13",
|
|
910
921
|
fill: "currentColor"
|
|
911
922
|
}, y(s.xLabel), 9, De)) : r("", !0),
|
|
912
|
-
(h(!0), i(e, null, _(
|
|
923
|
+
(h(!0), i(e, null, _(k.value, (e, t) => (h(), i("path", {
|
|
913
924
|
key: "area" + t,
|
|
914
|
-
d:
|
|
925
|
+
d: ae(e),
|
|
915
926
|
fill: e.color ?? "currentColor",
|
|
916
927
|
"fill-opacity": e.opacity ?? .2,
|
|
917
928
|
stroke: "none"
|
|
918
929
|
}, null, 8, Oe))), 128)),
|
|
919
|
-
(h(!0), i(e, null, _(
|
|
930
|
+
(h(!0), i(e, null, _(O.value, (t, n) => (h(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (h(), i("path", {
|
|
920
931
|
key: 0,
|
|
921
|
-
d:
|
|
932
|
+
d: ie(t),
|
|
922
933
|
fill: "none",
|
|
923
934
|
stroke: t.color ?? "currentColor",
|
|
924
935
|
"stroke-width": t.strokeWidth ?? 1.5,
|
|
925
936
|
"stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
|
|
926
937
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
927
|
-
}, null, 8, ke)), t.dots ? (h(!0), i(e, { key: 1 }, _(
|
|
938
|
+
}, null, 8, ke)), t.dots ? (h(!0), i(e, { key: 1 }, _(R(t), (e, n) => (h(), i("circle", {
|
|
928
939
|
key: n,
|
|
929
940
|
cx: e.x,
|
|
930
941
|
cy: e.y,
|
|
@@ -935,65 +946,65 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
935
946
|
}, null, 8, Ae))), 128)) : r("", !0)], 64))), 128)),
|
|
936
947
|
(h(!0), i(e, null, _(s.areaSections ?? [], (t, n) => (h(), i(e, { key: "areasec" + n }, [
|
|
937
948
|
a("path", {
|
|
938
|
-
d:
|
|
939
|
-
fill: t.color ?? (t.seriesIndex == null ? "#999" :
|
|
949
|
+
d: B(t),
|
|
950
|
+
fill: t.color ?? (t.seriesIndex == null ? "#999" : O.value[t.seriesIndex]?.color ?? "currentColor"),
|
|
940
951
|
"fill-opacity": t.opacity ?? .15,
|
|
941
952
|
stroke: "none"
|
|
942
953
|
}, null, 8, je),
|
|
943
954
|
t.seriesIndex == null ? r("", !0) : (h(), i("path", {
|
|
944
955
|
key: 0,
|
|
945
|
-
d:
|
|
956
|
+
d: B(t, !1),
|
|
946
957
|
fill: "none",
|
|
947
|
-
stroke: t.color ??
|
|
958
|
+
stroke: t.color ?? O.value[t.seriesIndex]?.color ?? "currentColor",
|
|
948
959
|
"stroke-width": t.strokeWidth ?? 2,
|
|
949
960
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
950
961
|
}, null, 8, Me)),
|
|
951
962
|
t.seriesIndex == null ? (h(), i(e, { key: 1 }, [a("line", {
|
|
952
|
-
x1: x(
|
|
963
|
+
x1: x(V)(z(t, "start")),
|
|
953
964
|
y1: x(C).top,
|
|
954
|
-
x2: x(
|
|
965
|
+
x2: x(V)(z(t, "start")),
|
|
955
966
|
y2: x(C).top + x(T),
|
|
956
967
|
stroke: t.color ?? "#999",
|
|
957
968
|
"stroke-width": t.strokeWidth ?? 2,
|
|
958
969
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
959
970
|
}, null, 8, Ne), a("line", {
|
|
960
|
-
x1: x(
|
|
971
|
+
x1: x(V)(z(t, "end")),
|
|
961
972
|
y1: x(C).top,
|
|
962
|
-
x2: x(
|
|
973
|
+
x2: x(V)(z(t, "end")),
|
|
963
974
|
y2: x(C).top + x(T),
|
|
964
975
|
stroke: t.color ?? "#999",
|
|
965
976
|
"stroke-width": t.strokeWidth ?? 2,
|
|
966
977
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
967
978
|
}, null, 8, Pe)], 64)) : r("", !0),
|
|
968
979
|
a("line", {
|
|
969
|
-
x1: x(
|
|
980
|
+
x1: x(V)(z(t, "start")),
|
|
970
981
|
y1: x(C).top + x(T) - 4,
|
|
971
|
-
x2: x(
|
|
982
|
+
x2: x(V)(z(t, "start")),
|
|
972
983
|
y2: x(C).top + x(T) + 4,
|
|
973
984
|
stroke: "currentColor",
|
|
974
985
|
"stroke-opacity": "0.4"
|
|
975
986
|
}, null, 8, Fe),
|
|
976
987
|
a("line", {
|
|
977
|
-
x1: x(
|
|
988
|
+
x1: x(V)(z(t, "end")),
|
|
978
989
|
y1: x(C).top + x(T) - 4,
|
|
979
|
-
x2: x(
|
|
990
|
+
x2: x(V)(z(t, "end")),
|
|
980
991
|
y2: x(C).top + x(T) + 4,
|
|
981
992
|
stroke: "currentColor",
|
|
982
993
|
"stroke-opacity": "0.4"
|
|
983
994
|
}, null, 8, Ie)
|
|
984
995
|
], 64))), 128)),
|
|
985
|
-
|
|
996
|
+
de.value && x(Qe) !== null ? (h(), i("line", {
|
|
986
997
|
key: 6,
|
|
987
|
-
x1: x(
|
|
998
|
+
x1: x(V)(fe.value),
|
|
988
999
|
y1: x(C).top,
|
|
989
|
-
x2: x(
|
|
1000
|
+
x2: x(V)(fe.value),
|
|
990
1001
|
y2: x(C).top + x(T),
|
|
991
1002
|
stroke: "currentColor",
|
|
992
1003
|
"stroke-opacity": "0.3",
|
|
993
1004
|
"stroke-dasharray": "4 2",
|
|
994
1005
|
"pointer-events": "none"
|
|
995
1006
|
}, null, 8, Le)) : r("", !0),
|
|
996
|
-
(h(!0), i(e, null, _(
|
|
1007
|
+
(h(!0), i(e, null, _(Q.value, (e, t) => (h(), i("circle", {
|
|
997
1008
|
key: "hd" + t,
|
|
998
1009
|
cx: e.x,
|
|
999
1010
|
cy: e.y,
|
|
@@ -1003,7 +1014,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1003
1014
|
"stroke-width": "2",
|
|
1004
1015
|
"pointer-events": "none"
|
|
1005
1016
|
}, null, 8, Re))), 128)),
|
|
1006
|
-
|
|
1017
|
+
de.value ? (h(), i("rect", u({
|
|
1007
1018
|
key: 7,
|
|
1008
1019
|
x: x(C).left,
|
|
1009
1020
|
y: x(C).top,
|
|
@@ -1014,11 +1025,11 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1014
1025
|
cursor: "crosshair",
|
|
1015
1026
|
"touch-action": "none"
|
|
1016
1027
|
}
|
|
1017
|
-
}, te(x(
|
|
1018
|
-
(h(!0), i(e, null, _(
|
|
1028
|
+
}, te(x(tt), !0)), null, 16, ze)) : r("", !0),
|
|
1029
|
+
(h(!0), i(e, null, _(H.value.labels, (e, t) => (h(), i("g", { key: "seclab" + t }, [
|
|
1019
1030
|
a("circle", {
|
|
1020
1031
|
cx: e.cx - e.textWidth / 2 - 2,
|
|
1021
|
-
cy:
|
|
1032
|
+
cy: q.value + e.row * Ke + 4,
|
|
1022
1033
|
r: "4",
|
|
1023
1034
|
fill: e.color,
|
|
1024
1035
|
"fill-opacity": e.fillOpacity,
|
|
@@ -1028,7 +1039,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1028
1039
|
e.labelText ? (h(), i("text", {
|
|
1029
1040
|
key: 0,
|
|
1030
1041
|
x: e.cx - e.textWidth / 2 + 8,
|
|
1031
|
-
y:
|
|
1042
|
+
y: q.value + e.row * Ke + 8,
|
|
1032
1043
|
"font-size": "11",
|
|
1033
1044
|
"font-weight": "600",
|
|
1034
1045
|
fill: e.color
|
|
@@ -1036,42 +1047,42 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1036
1047
|
e.descText ? (h(), i("text", {
|
|
1037
1048
|
key: 1,
|
|
1038
1049
|
x: e.cx - e.textWidth / 2 + 8,
|
|
1039
|
-
y:
|
|
1050
|
+
y: q.value + e.row * Ke + 22,
|
|
1040
1051
|
"font-size": "11",
|
|
1041
1052
|
fill: "currentColor",
|
|
1042
1053
|
"fill-opacity": "0.6"
|
|
1043
1054
|
}, y(e.descText), 9, He)) : r("", !0)
|
|
1044
1055
|
]))), 128))
|
|
1045
1056
|
], 8, he)),
|
|
1046
|
-
|
|
1057
|
+
de.value && x(Qe) !== null && Xe.value ? (h(), i("div", {
|
|
1047
1058
|
key: 1,
|
|
1048
1059
|
ref_key: "tooltipRef",
|
|
1049
|
-
ref:
|
|
1060
|
+
ref: $e,
|
|
1050
1061
|
class: "chart-tooltip-content",
|
|
1051
1062
|
style: p({
|
|
1052
1063
|
position: "absolute",
|
|
1053
1064
|
top: "0",
|
|
1054
1065
|
left: "0",
|
|
1055
1066
|
willChange: "transform",
|
|
1056
|
-
transform: x(
|
|
1057
|
-
visibility: x(
|
|
1067
|
+
transform: x(et) ? `translate3d(${x(et).left}px, ${x(et).top}px, 0) translateY(-50%)` : "translateY(-50%)",
|
|
1068
|
+
visibility: x(et) ? "visible" : "hidden"
|
|
1058
1069
|
})
|
|
1059
|
-
}, [v(t.$slots, "tooltip", f(l(
|
|
1070
|
+
}, [v(t.$slots, "tooltip", f(l(Xe.value)), () => [a("div", Ue, [Xe.value.xLabel ? (h(), i("div", We, y(Xe.value.xLabel), 1)) : r("", !0), (h(!0), i(e, null, _(Xe.value.values, (e) => (h(), i("div", {
|
|
1060
1071
|
key: e.seriesIndex,
|
|
1061
1072
|
class: "line-chart-tooltip-row"
|
|
1062
1073
|
}, [a("span", {
|
|
1063
1074
|
class: "line-chart-tooltip-swatch",
|
|
1064
1075
|
style: p({ background: e.color })
|
|
1065
|
-
}, null, 4), o(" " + y(isFinite(e.value) ?
|
|
1066
|
-
x(
|
|
1076
|
+
}, null, 4), o(" " + y(isFinite(e.value) ? D(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
|
|
1077
|
+
x(it) ? (h(), i("a", {
|
|
1067
1078
|
key: 2,
|
|
1068
1079
|
class: "line-chart-download-link",
|
|
1069
|
-
href: x(
|
|
1070
|
-
download: `${x(
|
|
1071
|
-
}, y(x(
|
|
1080
|
+
href: x(at),
|
|
1081
|
+
download: `${x(ot)()}.csv`
|
|
1082
|
+
}, y(x(it)), 9, Ge)) : r("", !0)
|
|
1072
1083
|
], 512));
|
|
1073
1084
|
}
|
|
1074
|
-
}), [["__scopeId", "data-v-
|
|
1085
|
+
}), [["__scopeId", "data-v-083d1c2f"]]), Ze = ["width", "height"], Qe = ["x"], $e = { key: 1 }, et = [
|
|
1075
1086
|
"x",
|
|
1076
1087
|
"y",
|
|
1077
1088
|
"fill"
|
|
@@ -1116,7 +1127,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1116
1127
|
], mt = { class: "bar-chart-tooltip" }, ht = {
|
|
1117
1128
|
key: 0,
|
|
1118
1129
|
class: "bar-chart-tooltip-label"
|
|
1119
|
-
}, gt = ["href", "download"], _t = /* @__PURE__ */
|
|
1130
|
+
}, gt = ["href", "download"], _t = /* @__PURE__ */ B(/* @__PURE__ */ c({
|
|
1120
1131
|
__name: "BarChart",
|
|
1121
1132
|
props: {
|
|
1122
1133
|
data: {},
|
|
@@ -1133,6 +1144,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1133
1144
|
valueMin: { default: 0 },
|
|
1134
1145
|
valueTicks: {},
|
|
1135
1146
|
valueTickFormat: {},
|
|
1147
|
+
tooltipValueFormat: {},
|
|
1136
1148
|
categoryFormat: {},
|
|
1137
1149
|
barPadding: { default: .2 },
|
|
1138
1150
|
groupGap: { default: 1 },
|
|
@@ -1154,7 +1166,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1154
1166
|
},
|
|
1155
1167
|
emits: ["hover"],
|
|
1156
1168
|
setup(s, { emit: c }) {
|
|
1157
|
-
let d = s, ee = c, { containerRef: m, measuredWidth: g } =
|
|
1169
|
+
let d = s, ee = c, { containerRef: m, measuredWidth: g } = G({ 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 } = K({
|
|
1158
1170
|
title: () => d.title,
|
|
1159
1171
|
xLabel: () => d.xLabel,
|
|
1160
1172
|
yLabel: () => d.yLabel,
|
|
@@ -1208,28 +1220,28 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1208
1220
|
max: t,
|
|
1209
1221
|
range: r
|
|
1210
1222
|
};
|
|
1211
|
-
}), M = t(() => A.value ? w.value : T.value),
|
|
1223
|
+
}), M = t(() => A.value ? w.value : T.value), N = t(() => A.value ? T.value : w.value), P = t(() => {
|
|
1212
1224
|
let e = O.value;
|
|
1213
1225
|
return e > 0 ? M.value / e : 0;
|
|
1214
|
-
}),
|
|
1226
|
+
}), F = t(() => P.value * (1 - d.barPadding)), I = t(() => {
|
|
1215
1227
|
let e = D.value.length;
|
|
1216
1228
|
if (e === 0) return 0;
|
|
1217
|
-
if (d.layout === "stacked" || e === 1) return
|
|
1229
|
+
if (d.layout === "stacked" || e === 1) return F.value;
|
|
1218
1230
|
let t = d.groupGap * (e - 1);
|
|
1219
|
-
return Math.max(1, (
|
|
1231
|
+
return Math.max(1, (F.value - t) / e);
|
|
1220
1232
|
});
|
|
1221
|
-
function
|
|
1222
|
-
return (A.value ? C.value.left : C.value.top) + e *
|
|
1233
|
+
function L(e) {
|
|
1234
|
+
return (A.value ? C.value.left : C.value.top) + e * P.value;
|
|
1223
1235
|
}
|
|
1224
|
-
let
|
|
1236
|
+
let ie = t(() => {
|
|
1225
1237
|
let { min: e, max: t } = j.value, n = d.valueMin ?? 0;
|
|
1226
|
-
return
|
|
1238
|
+
return R(Math.max(e, Math.min(t, n)));
|
|
1227
1239
|
});
|
|
1228
|
-
function
|
|
1229
|
-
let { min: t, range: n } = j.value, r =
|
|
1240
|
+
function R(e) {
|
|
1241
|
+
let { min: t, range: n } = j.value, r = N.value / n;
|
|
1230
1242
|
return A.value ? C.value.top + T.value - (e - t) * r : C.value.left + (e - t) * r;
|
|
1231
1243
|
}
|
|
1232
|
-
function
|
|
1244
|
+
function ae(e, t, n, r, i, a, o, s, c) {
|
|
1233
1245
|
let l = Math.min(e, t), u = Math.abs(e - t);
|
|
1234
1246
|
return A.value ? {
|
|
1235
1247
|
x: n,
|
|
@@ -1253,29 +1265,29 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1253
1265
|
seriesIndex: c
|
|
1254
1266
|
};
|
|
1255
1267
|
}
|
|
1256
|
-
let
|
|
1268
|
+
let z = t(() => {
|
|
1257
1269
|
let e = [], t = D.value, n = t.length;
|
|
1258
1270
|
if (n === 0) return e;
|
|
1259
|
-
let r = O.value, i =
|
|
1271
|
+
let r = O.value, i = P.value, a = F.value, o = I.value, s = (i - a) / 2, c = ie.value;
|
|
1260
1272
|
for (let i = 0; i < r; i++) {
|
|
1261
|
-
let r =
|
|
1273
|
+
let r = L(i) + s;
|
|
1262
1274
|
if (d.layout === "stacked") {
|
|
1263
1275
|
let o = 0, s = 0;
|
|
1264
1276
|
for (let c = 0; c < n; c++) {
|
|
1265
1277
|
let n = t[c], l = Number(n.data[i] ?? NaN);
|
|
1266
1278
|
if (!isFinite(l)) continue;
|
|
1267
1279
|
let u = l >= 0 ? o : s, d = u + l;
|
|
1268
|
-
e.push(
|
|
1280
|
+
e.push(ae(R(u), R(d), r, a, n.color ?? H(c), n.opacity ?? 1, l, i, c)), l >= 0 ? o = d : s = d;
|
|
1269
1281
|
}
|
|
1270
1282
|
} else for (let a = 0; a < n; a++) {
|
|
1271
1283
|
let s = t[a], l = Number(s.data[i] ?? NaN);
|
|
1272
1284
|
if (!isFinite(l)) continue;
|
|
1273
1285
|
let u = r + (n === 1 ? 0 : a * (o + d.groupGap));
|
|
1274
|
-
e.push(
|
|
1286
|
+
e.push(ae(c, R(l), u, o, s.color ?? H(a), s.opacity ?? 1, l, i, a));
|
|
1275
1287
|
}
|
|
1276
1288
|
}
|
|
1277
1289
|
return e;
|
|
1278
|
-
}),
|
|
1290
|
+
}), B = [
|
|
1279
1291
|
"var(--color-primary, #3b82f6)",
|
|
1280
1292
|
"var(--color-accent, #f59e0b)",
|
|
1281
1293
|
"var(--color-success, #10b981)",
|
|
@@ -1283,29 +1295,32 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1283
1295
|
"var(--color-info, #6366f1)",
|
|
1284
1296
|
"var(--color-warning, #d97706)"
|
|
1285
1297
|
];
|
|
1286
|
-
function
|
|
1287
|
-
return
|
|
1298
|
+
function H(e) {
|
|
1299
|
+
return B[e % B.length];
|
|
1288
1300
|
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1301
|
+
function se(e) {
|
|
1302
|
+
return d.tooltipValueFormat ? d.tooltipValueFormat(e) : d.valueTickFormat ? d.valueTickFormat(e) : W(e);
|
|
1303
|
+
}
|
|
1304
|
+
let U = t(() => {
|
|
1305
|
+
let { min: e, max: t } = j.value, n = (e) => d.valueTickFormat ? d.valueTickFormat(e) : W(e);
|
|
1291
1306
|
if (e === t) return [{
|
|
1292
1307
|
value: n(e),
|
|
1293
|
-
pos:
|
|
1308
|
+
pos: V(R(e))
|
|
1294
1309
|
}];
|
|
1295
1310
|
let r = A.value ? 50 : 80;
|
|
1296
|
-
return
|
|
1311
|
+
return ce({
|
|
1297
1312
|
min: e,
|
|
1298
1313
|
max: t,
|
|
1299
1314
|
ticks: d.valueTicks,
|
|
1300
|
-
targetTickCount:
|
|
1315
|
+
targetTickCount: N.value / r
|
|
1301
1316
|
}).map((e) => ({
|
|
1302
1317
|
value: n(e),
|
|
1303
|
-
pos:
|
|
1318
|
+
pos: V(R(e))
|
|
1304
1319
|
}));
|
|
1305
|
-
}),
|
|
1320
|
+
}), q = t(() => {
|
|
1306
1321
|
let e = [], t = O.value, n = (e, t) => d.categoryFormat ? d.categoryFormat(e, t) : e;
|
|
1307
1322
|
for (let r = 0; r < t; r++) {
|
|
1308
|
-
let t =
|
|
1323
|
+
let t = L(r) + P.value / 2;
|
|
1309
1324
|
e.push({
|
|
1310
1325
|
label: n(k.value[r], r),
|
|
1311
1326
|
pos: t,
|
|
@@ -1313,56 +1328,56 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1313
1328
|
});
|
|
1314
1329
|
}
|
|
1315
1330
|
return e;
|
|
1316
|
-
}),
|
|
1331
|
+
}), J = t(() => {
|
|
1317
1332
|
let e = [];
|
|
1318
1333
|
return D.value.forEach((t, n) => {
|
|
1319
1334
|
t.legend && e.push({
|
|
1320
1335
|
label: t.legend,
|
|
1321
|
-
color: t.color ??
|
|
1336
|
+
color: t.color ?? H(n)
|
|
1322
1337
|
});
|
|
1323
1338
|
}), e;
|
|
1324
1339
|
});
|
|
1325
|
-
function
|
|
1340
|
+
function le() {
|
|
1326
1341
|
if (typeof d.csv == "function") return d.csv();
|
|
1327
1342
|
if (typeof d.csv == "string") return d.csv;
|
|
1328
1343
|
let e = D.value.map((e) => ({
|
|
1329
1344
|
label: e.legend,
|
|
1330
1345
|
data: e.data
|
|
1331
1346
|
}));
|
|
1332
|
-
return
|
|
1347
|
+
return Z(k.value, e);
|
|
1333
1348
|
}
|
|
1334
|
-
let
|
|
1335
|
-
function
|
|
1349
|
+
let Y = t(() => !!d.tooltipData || !!d.tooltipTrigger);
|
|
1350
|
+
function de(e, t) {
|
|
1336
1351
|
let n = m.value?.getBoundingClientRect();
|
|
1337
1352
|
if (!n) return null;
|
|
1338
1353
|
let r = O.value;
|
|
1339
|
-
if (r === 0 ||
|
|
1354
|
+
if (r === 0 || P.value === 0) return null;
|
|
1340
1355
|
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 /
|
|
1356
|
+
return Math.max(0, Math.min(r - 1, Math.floor(i / P.value)));
|
|
1342
1357
|
}
|
|
1343
|
-
let { hoverIndex: X, tooltipRef:
|
|
1344
|
-
enabled: () =>
|
|
1358
|
+
let { hoverIndex: X, tooltipRef: fe, tooltipPos: me, handlers: Q } = ue({
|
|
1359
|
+
enabled: () => Y.value,
|
|
1345
1360
|
trigger: () => d.tooltipTrigger,
|
|
1346
1361
|
clamp: () => d.tooltipClamp,
|
|
1347
|
-
pointerToIndex:
|
|
1362
|
+
pointerToIndex: de,
|
|
1348
1363
|
containerRef: m,
|
|
1349
1364
|
onHover: (e) => ee("hover", e)
|
|
1350
|
-
}), { svgRef:
|
|
1365
|
+
}), { svgRef: he, items: ge, downloadLinkText: _e, csvHref: ve, resolvedFilename: ye } = pe({
|
|
1351
1366
|
filename: () => d.filename,
|
|
1352
1367
|
legacyMenuLabel: () => d.menu,
|
|
1353
|
-
getCsv:
|
|
1368
|
+
getCsv: le,
|
|
1354
1369
|
downloadLink: () => d.downloadLink
|
|
1355
|
-
}),
|
|
1370
|
+
}), be = t(() => {
|
|
1356
1371
|
let e = X.value;
|
|
1357
1372
|
if (e !== null) return k.value[e];
|
|
1358
|
-
}),
|
|
1373
|
+
}), xe = t(() => {
|
|
1359
1374
|
let e = X.value;
|
|
1360
1375
|
return e === null ? null : {
|
|
1361
1376
|
index: e,
|
|
1362
1377
|
category: k.value[e] ?? String(e),
|
|
1363
1378
|
values: D.value.map((t, n) => ({
|
|
1364
1379
|
value: Number(t.data[e] ?? NaN),
|
|
1365
|
-
color: t.color ??
|
|
1380
|
+
color: t.color ?? H(n),
|
|
1366
1381
|
seriesIndex: n
|
|
1367
1382
|
})),
|
|
1368
1383
|
data: d.tooltipData?.[e] ?? null
|
|
@@ -1370,17 +1385,17 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1370
1385
|
}), $ = t(() => {
|
|
1371
1386
|
let e = X.value;
|
|
1372
1387
|
if (e === null) return null;
|
|
1373
|
-
let t =
|
|
1388
|
+
let t = L(e);
|
|
1374
1389
|
return A.value ? {
|
|
1375
1390
|
x: t,
|
|
1376
1391
|
y: C.value.top,
|
|
1377
|
-
w:
|
|
1392
|
+
w: P.value,
|
|
1378
1393
|
h: T.value
|
|
1379
1394
|
} : {
|
|
1380
1395
|
x: C.value.left,
|
|
1381
1396
|
y: t,
|
|
1382
1397
|
w: w.value,
|
|
1383
|
-
h:
|
|
1398
|
+
h: P.value
|
|
1384
1399
|
};
|
|
1385
1400
|
});
|
|
1386
1401
|
return (t, c) => (h(), i("div", {
|
|
@@ -1388,13 +1403,13 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1388
1403
|
ref: m,
|
|
1389
1404
|
class: "bar-chart-wrapper"
|
|
1390
1405
|
}, [
|
|
1391
|
-
s.menu ? (h(), n(
|
|
1406
|
+
s.menu ? (h(), n(oe, {
|
|
1392
1407
|
key: 0,
|
|
1393
|
-
items: x(
|
|
1408
|
+
items: x(ge)
|
|
1394
1409
|
}, null, 8, ["items"])) : r("", !0),
|
|
1395
1410
|
(h(), i("svg", {
|
|
1396
1411
|
ref_key: "svgRef",
|
|
1397
|
-
ref:
|
|
1412
|
+
ref: he,
|
|
1398
1413
|
width: b.value,
|
|
1399
1414
|
height: S.value
|
|
1400
1415
|
}, [
|
|
@@ -1407,7 +1422,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1407
1422
|
"font-weight": "600",
|
|
1408
1423
|
fill: "currentColor"
|
|
1409
1424
|
}, y(s.title), 9, Qe)) : r("", !0),
|
|
1410
|
-
|
|
1425
|
+
J.value.length > 0 ? (h(), i("g", $e, [(h(!0), i(e, null, _(J.value, (t, n) => (h(), i(e, { key: "ileg" + n }, [a("rect", {
|
|
1411
1426
|
x: x(C).left + n * 120,
|
|
1412
1427
|
y: x(C).top - x(20) / 2 - 5,
|
|
1413
1428
|
width: "12",
|
|
@@ -1420,22 +1435,22 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1420
1435
|
fill: "currentColor"
|
|
1421
1436
|
}, y(t.label), 9, tt)], 64))), 128))])) : r("", !0),
|
|
1422
1437
|
a("line", {
|
|
1423
|
-
x1: x(
|
|
1424
|
-
y1: x(
|
|
1425
|
-
x2: x(
|
|
1426
|
-
y2: x(
|
|
1438
|
+
x1: x(V)(x(C).left),
|
|
1439
|
+
y1: x(V)(x(C).top),
|
|
1440
|
+
x2: x(V)(x(C).left),
|
|
1441
|
+
y2: x(V)(x(C).top + x(T)),
|
|
1427
1442
|
stroke: "currentColor",
|
|
1428
1443
|
"stroke-opacity": "0.3"
|
|
1429
1444
|
}, null, 8, nt),
|
|
1430
1445
|
a("line", {
|
|
1431
|
-
x1: x(
|
|
1432
|
-
y1: x(
|
|
1433
|
-
x2: x(
|
|
1434
|
-
y2: x(
|
|
1446
|
+
x1: x(V)(x(C).left),
|
|
1447
|
+
y1: x(V)(x(C).top + x(T)),
|
|
1448
|
+
x2: x(V)(x(C).left + x(w)),
|
|
1449
|
+
y2: x(V)(x(C).top + x(T)),
|
|
1435
1450
|
stroke: "currentColor",
|
|
1436
1451
|
"stroke-opacity": "0.3"
|
|
1437
1452
|
}, null, 8, rt),
|
|
1438
|
-
s.valueGrid ? (h(!0), i(e, { key: 2 }, _(
|
|
1453
|
+
s.valueGrid ? (h(!0), i(e, { key: 2 }, _(U.value, (e, t) => (h(), i("line", {
|
|
1439
1454
|
key: "vg" + t,
|
|
1440
1455
|
x1: A.value ? x(C).left : e.pos,
|
|
1441
1456
|
y1: A.value ? e.pos : x(C).top,
|
|
@@ -1444,7 +1459,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1444
1459
|
stroke: "currentColor",
|
|
1445
1460
|
"stroke-opacity": "0.1"
|
|
1446
1461
|
}, null, 8, it))), 128)) : r("", !0),
|
|
1447
|
-
$.value &&
|
|
1462
|
+
$.value && Y.value ? (h(), i("rect", {
|
|
1448
1463
|
key: 3,
|
|
1449
1464
|
x: $.value.x,
|
|
1450
1465
|
y: $.value.y,
|
|
@@ -1454,7 +1469,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1454
1469
|
"fill-opacity": "0.06",
|
|
1455
1470
|
"pointer-events": "none"
|
|
1456
1471
|
}, null, 8, at)) : r("", !0),
|
|
1457
|
-
A.value ? (h(!0), i(e, { key: 4 }, _(
|
|
1472
|
+
A.value ? (h(!0), i(e, { key: 4 }, _(U.value, (e, t) => (h(), i("text", {
|
|
1458
1473
|
key: "vt" + t,
|
|
1459
1474
|
"data-testid": "value-tick",
|
|
1460
1475
|
x: x(C).left - 6,
|
|
@@ -1464,7 +1479,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1464
1479
|
"font-size": "10",
|
|
1465
1480
|
fill: "currentColor",
|
|
1466
1481
|
"fill-opacity": "0.6"
|
|
1467
|
-
}, y(e.value), 9, ot))), 128)) : (h(!0), i(e, { key: 5 }, _(
|
|
1482
|
+
}, y(e.value), 9, ot))), 128)) : (h(!0), i(e, { key: 5 }, _(U.value, (e, t) => (h(), i("text", {
|
|
1468
1483
|
key: "vt" + t,
|
|
1469
1484
|
"data-testid": "value-tick",
|
|
1470
1485
|
x: e.pos,
|
|
@@ -1483,7 +1498,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1483
1498
|
"font-size": "13",
|
|
1484
1499
|
fill: "currentColor"
|
|
1485
1500
|
}, y(s.yLabel), 9, ct)) : r("", !0),
|
|
1486
|
-
A.value ? (h(!0), i(e, { key: 7 }, _(
|
|
1501
|
+
A.value ? (h(!0), i(e, { key: 7 }, _(q.value, (e, t) => (h(), i("text", {
|
|
1487
1502
|
key: "ct" + t,
|
|
1488
1503
|
"data-testid": "category-tick",
|
|
1489
1504
|
x: e.pos,
|
|
@@ -1492,7 +1507,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1492
1507
|
"font-size": "10",
|
|
1493
1508
|
fill: "currentColor",
|
|
1494
1509
|
"fill-opacity": "0.6"
|
|
1495
|
-
}, y(e.label), 9, lt))), 128)) : (h(!0), i(e, { key: 8 }, _(
|
|
1510
|
+
}, y(e.label), 9, lt))), 128)) : (h(!0), i(e, { key: 8 }, _(q.value, (e, t) => (h(), i("text", {
|
|
1496
1511
|
key: "ct" + t,
|
|
1497
1512
|
"data-testid": "category-tick",
|
|
1498
1513
|
x: x(C).left - 6,
|
|
@@ -1511,7 +1526,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1511
1526
|
"font-size": "13",
|
|
1512
1527
|
fill: "currentColor"
|
|
1513
1528
|
}, y(s.xLabel), 9, dt)) : r("", !0),
|
|
1514
|
-
(h(!0), i(e, null, _(
|
|
1529
|
+
(h(!0), i(e, null, _(z.value, (e, t) => (h(), i("rect", {
|
|
1515
1530
|
key: "bar" + t,
|
|
1516
1531
|
"data-testid": "bar",
|
|
1517
1532
|
"data-category": e.categoryIndex,
|
|
@@ -1523,7 +1538,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1523
1538
|
fill: e.color,
|
|
1524
1539
|
"fill-opacity": e.opacity
|
|
1525
1540
|
}, null, 8, ft))), 128)),
|
|
1526
|
-
|
|
1541
|
+
Y.value ? (h(), i("rect", u({
|
|
1527
1542
|
key: 10,
|
|
1528
1543
|
x: x(C).left,
|
|
1529
1544
|
y: x(C).top,
|
|
@@ -1534,37 +1549,37 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
1534
1549
|
cursor: "crosshair",
|
|
1535
1550
|
"touch-action": "none"
|
|
1536
1551
|
}
|
|
1537
|
-
}, te(x(
|
|
1552
|
+
}, te(x(Q), !0)), null, 16, pt)) : r("", !0)
|
|
1538
1553
|
], 8, Ze)),
|
|
1539
|
-
|
|
1554
|
+
Y.value && x(X) !== null && xe.value ? (h(), i("div", {
|
|
1540
1555
|
key: 1,
|
|
1541
1556
|
ref_key: "tooltipRef",
|
|
1542
|
-
ref:
|
|
1557
|
+
ref: fe,
|
|
1543
1558
|
class: "chart-tooltip-content",
|
|
1544
1559
|
style: p({
|
|
1545
1560
|
position: "absolute",
|
|
1546
1561
|
top: "0",
|
|
1547
1562
|
left: "0",
|
|
1548
1563
|
willChange: "transform",
|
|
1549
|
-
transform: x(
|
|
1550
|
-
visibility: x(
|
|
1564
|
+
transform: x(me) ? `translate3d(${x(me).left}px, ${x(me).top}px, 0) translateY(-50%)` : "translateY(-50%)",
|
|
1565
|
+
visibility: x(me) ? "visible" : "hidden"
|
|
1551
1566
|
})
|
|
1552
|
-
}, [v(t.$slots, "tooltip", f(l(
|
|
1567
|
+
}, [v(t.$slots, "tooltip", f(l(xe.value)), () => [a("div", mt, [be.value ? (h(), i("div", ht, y(be.value), 1)) : r("", !0), (h(!0), i(e, null, _(xe.value.values, (e) => (h(), i("div", {
|
|
1553
1568
|
key: e.seriesIndex,
|
|
1554
1569
|
class: "bar-chart-tooltip-row"
|
|
1555
1570
|
}, [a("span", {
|
|
1556
1571
|
class: "bar-chart-tooltip-swatch",
|
|
1557
1572
|
style: p({ background: e.color })
|
|
1558
|
-
}, null, 4), o(" " + y(isFinite(e.value) ?
|
|
1559
|
-
x(
|
|
1573
|
+
}, null, 4), o(" " + y(isFinite(e.value) ? se(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
|
|
1574
|
+
x(_e) ? (h(), i("a", {
|
|
1560
1575
|
key: 2,
|
|
1561
1576
|
class: "bar-chart-download-link",
|
|
1562
|
-
href: x(
|
|
1563
|
-
download: `${x(
|
|
1564
|
-
}, y(x(
|
|
1577
|
+
href: x(ve),
|
|
1578
|
+
download: `${x(ye)()}.csv`
|
|
1579
|
+
}, y(x(_e)), 9, gt)) : r("", !0)
|
|
1565
1580
|
], 512));
|
|
1566
1581
|
}
|
|
1567
|
-
}), [["__scopeId", "data-v-
|
|
1582
|
+
}), [["__scopeId", "data-v-4f604d9f"]]), vt = {
|
|
1568
1583
|
"01013": "010259",
|
|
1569
1584
|
"01015": "010177",
|
|
1570
1585
|
"01029": "010177",
|
|
@@ -5693,7 +5708,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5693
5708
|
"font-size": "13",
|
|
5694
5709
|
"font-weight": "600",
|
|
5695
5710
|
fill: "currentColor"
|
|
5696
|
-
}, kt = ["offset", "stop-color"], At = ["x", "fill"], jt = ["x"], Mt = ["x"], Nt = /* @__PURE__ */
|
|
5711
|
+
}, kt = ["offset", "stop-color"], At = ["x", "fill"], jt = ["x"], Mt = ["x"], Nt = /* @__PURE__ */ B(/* @__PURE__ */ c({
|
|
5697
5712
|
__name: "ChoroplethMap",
|
|
5698
5713
|
props: {
|
|
5699
5714
|
topology: {},
|
|
@@ -5725,6 +5740,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5725
5740
|
},
|
|
5726
5741
|
tooltipTrigger: {},
|
|
5727
5742
|
tooltipFormat: {},
|
|
5743
|
+
tooltipValueFormat: {},
|
|
5728
5744
|
tooltipClamp: { default: "chart" }
|
|
5729
5745
|
},
|
|
5730
5746
|
emits: ["stateClick", "stateHover"],
|
|
@@ -5733,11 +5749,11 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5733
5749
|
function D() {
|
|
5734
5750
|
if (T) return;
|
|
5735
5751
|
let e = v.value;
|
|
5736
|
-
e && (e.addEventListener("click", $), e.addEventListener("mouseover", $), e.addEventListener("mousemove",
|
|
5752
|
+
e && (e.addEventListener("click", $), e.addEventListener("mouseover", $), e.addEventListener("mousemove", Se), e.addEventListener("mouseout", Ce));
|
|
5737
5753
|
}
|
|
5738
5754
|
function O() {
|
|
5739
5755
|
let e = v.value;
|
|
5740
|
-
e && (e.removeEventListener("click", $), e.removeEventListener("mouseover", $), e.removeEventListener("mousemove",
|
|
5756
|
+
e && (e.removeEventListener("click", $), e.removeEventListener("mouseover", $), e.removeEventListener("mousemove", Se), e.removeEventListener("mouseout", Ce));
|
|
5741
5757
|
}
|
|
5742
5758
|
ee(() => {
|
|
5743
5759
|
f.value && (te.value = f.value.clientWidth, re = new ResizeObserver((e) => {
|
|
@@ -5745,13 +5761,13 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5745
5761
|
t && (te.value = t.contentRect.width);
|
|
5746
5762
|
}), re.observe(f.value)), k(), D();
|
|
5747
5763
|
}), m(() => {
|
|
5748
|
-
re?.disconnect(), A(), O(),
|
|
5764
|
+
re?.disconnect(), A(), O(), ye();
|
|
5749
5765
|
});
|
|
5750
5766
|
function k() {
|
|
5751
5767
|
if (!p.value || !v.value || !c.zoom && !c.pan) return;
|
|
5752
|
-
let e =
|
|
5753
|
-
E =
|
|
5754
|
-
w = !0,
|
|
5768
|
+
let e = F(p.value);
|
|
5769
|
+
E = P().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
|
|
5770
|
+
w = !0, xe();
|
|
5755
5771
|
}).on("zoom", (e) => {
|
|
5756
5772
|
v.value && v.value.setAttribute("transform", e.transform);
|
|
5757
5773
|
}).on("end", () => {
|
|
@@ -5759,12 +5775,12 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5759
5775
|
}), c.pan || E.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(E);
|
|
5760
5776
|
}
|
|
5761
5777
|
function A() {
|
|
5762
|
-
p.value && E && (
|
|
5778
|
+
p.value && E && (F(p.value).on(".zoom", null), E = null);
|
|
5763
5779
|
}
|
|
5764
5780
|
ne(() => [c.zoom, c.pan], () => {
|
|
5765
5781
|
A(), O(), k(), D();
|
|
5766
5782
|
});
|
|
5767
|
-
let j = t(() => c.width ?? (te.value || 600)),
|
|
5783
|
+
let j = t(() => c.width ?? (te.value || 600)), R = t(() => c.width && c.height ? c.height / c.width : .625), ae = t(() => j.value * R.value), z = t(() => {
|
|
5768
5784
|
let e = b(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
|
|
5769
5785
|
for (let e of t) {
|
|
5770
5786
|
let t = vt[String(e.id).padStart(5, "0")];
|
|
@@ -5775,34 +5791,34 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5775
5791
|
type: "Feature",
|
|
5776
5792
|
id: t,
|
|
5777
5793
|
properties: { name: yt[t] ?? t },
|
|
5778
|
-
geometry:
|
|
5794
|
+
geometry: L(e, i)
|
|
5779
5795
|
});
|
|
5780
5796
|
return {
|
|
5781
5797
|
type: "FeatureCollection",
|
|
5782
5798
|
features: r
|
|
5783
5799
|
};
|
|
5784
|
-
}),
|
|
5785
|
-
if (c.geoType === "hsas") return
|
|
5800
|
+
}), B = t(() => {
|
|
5801
|
+
if (c.geoType === "hsas") return z.value;
|
|
5786
5802
|
if (c.geoType === "counties") {
|
|
5787
5803
|
let e = b(c.topology);
|
|
5788
|
-
return
|
|
5804
|
+
return I(e, e.objects.counties);
|
|
5789
5805
|
}
|
|
5790
5806
|
let e = b(c.topology);
|
|
5791
|
-
return
|
|
5792
|
-
}),
|
|
5807
|
+
return I(e, e.objects.states);
|
|
5808
|
+
}), V = t(() => {
|
|
5793
5809
|
if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
|
|
5794
5810
|
let e = b(c.topology);
|
|
5795
|
-
return
|
|
5796
|
-
}),
|
|
5811
|
+
return ie(e, e.objects.states, (e, t) => e !== t);
|
|
5812
|
+
}), H = t(() => M().fitExtent([[0, ke.value], [j.value, ae.value + ke.value]], B.value)), se = t(() => N(H.value)), U = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), W = t(() => {
|
|
5797
5813
|
let e = /* @__PURE__ */ new Map();
|
|
5798
5814
|
if (!c.data) return e;
|
|
5799
5815
|
for (let t of c.data) {
|
|
5800
5816
|
e.set(t.id, t.value);
|
|
5801
|
-
let n =
|
|
5817
|
+
let n = B.value.features.find((e) => e.properties?.name === t.id);
|
|
5802
5818
|
n?.id != null && e.set(String(n.id), t.value);
|
|
5803
5819
|
}
|
|
5804
5820
|
return e;
|
|
5805
|
-
}),
|
|
5821
|
+
}), ce = t(() => {
|
|
5806
5822
|
if (!c.data || c.data.length === 0) return {
|
|
5807
5823
|
min: 0,
|
|
5808
5824
|
max: 1
|
|
@@ -5819,7 +5835,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5819
5835
|
min: 0,
|
|
5820
5836
|
max: 1
|
|
5821
5837
|
};
|
|
5822
|
-
}),
|
|
5838
|
+
}), G = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), K = t(() => Array.isArray(c.colorScale) && !G.value), q = t(() => K.value ? "" : c.colorScale?.min ?? "#e5f0fa"), J = t(() => K.value ? "" : c.colorScale?.max ?? "#08519c");
|
|
5823
5839
|
function ue(e) {
|
|
5824
5840
|
let t = e.replace("#", "");
|
|
5825
5841
|
return [
|
|
@@ -5829,91 +5845,94 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5829
5845
|
];
|
|
5830
5846
|
}
|
|
5831
5847
|
function Y(e) {
|
|
5832
|
-
let [t, n, r] = ue(
|
|
5848
|
+
let [t, n, r] = ue(q.value), [i, a, o] = ue(J.value);
|
|
5833
5849
|
return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
|
|
5834
5850
|
}
|
|
5835
|
-
function
|
|
5851
|
+
function fe(e) {
|
|
5836
5852
|
let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
|
|
5837
5853
|
for (let n of t) if (e >= n.min) return n.color;
|
|
5838
5854
|
return c.noDataColor;
|
|
5839
5855
|
}
|
|
5840
|
-
function
|
|
5856
|
+
function pe(e) {
|
|
5841
5857
|
let t = c.colorScale.find((t) => t.value === String(e));
|
|
5842
5858
|
return t ? t.color : c.noDataColor;
|
|
5843
5859
|
}
|
|
5844
|
-
function
|
|
5845
|
-
let t =
|
|
5860
|
+
function me(e) {
|
|
5861
|
+
let t = W.value.get(String(e));
|
|
5846
5862
|
if (t == null) return c.noDataColor;
|
|
5847
|
-
if (
|
|
5848
|
-
if (
|
|
5849
|
-
let { min: n, max: r } =
|
|
5863
|
+
if (G.value) return pe(t);
|
|
5864
|
+
if (K.value) return fe(t);
|
|
5865
|
+
let { min: n, max: r } = ce.value;
|
|
5850
5866
|
return Y((t - n) / (r - n));
|
|
5851
5867
|
}
|
|
5852
|
-
function
|
|
5868
|
+
function Z(e) {
|
|
5853
5869
|
return e.properties?.name ?? String(e.id);
|
|
5854
5870
|
}
|
|
5855
5871
|
function Q(e) {
|
|
5856
|
-
return
|
|
5872
|
+
return W.value.get(String(e.id));
|
|
5857
5873
|
}
|
|
5858
|
-
|
|
5874
|
+
function he(e) {
|
|
5875
|
+
return e == null ? "" : typeof e == "number" && c.tooltipValueFormat ? c.tooltipValueFormat(e) : String(e);
|
|
5876
|
+
}
|
|
5877
|
+
let ge = t(() => {
|
|
5859
5878
|
let e = /* @__PURE__ */ new Map();
|
|
5860
|
-
for (let t of
|
|
5879
|
+
for (let t of B.value.features) e.set(String(t.id), t);
|
|
5861
5880
|
return e;
|
|
5862
5881
|
});
|
|
5863
|
-
function
|
|
5882
|
+
function _e(e) {
|
|
5864
5883
|
let t = e;
|
|
5865
5884
|
for (; t && !t.dataset?.featId;) t = t.parentElement;
|
|
5866
5885
|
if (!t) return null;
|
|
5867
|
-
let n =
|
|
5886
|
+
let n = ge.value.get(t.dataset.featId);
|
|
5868
5887
|
return n ? {
|
|
5869
5888
|
pathEl: t,
|
|
5870
5889
|
feat: n
|
|
5871
5890
|
} : null;
|
|
5872
5891
|
}
|
|
5873
|
-
function
|
|
5892
|
+
function ve(e, t, n) {
|
|
5874
5893
|
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 =
|
|
5894
|
+
let r = Z(e), i = Q(e), a = {
|
|
5876
5895
|
id: String(e.id),
|
|
5877
5896
|
name: r,
|
|
5878
5897
|
value: i
|
|
5879
5898
|
};
|
|
5880
|
-
c.tooltipFormat ? C.innerHTML = c.tooltipFormat(a) :
|
|
5881
|
-
let o = f.value?.getBoundingClientRect(), { left: s, top: l } =
|
|
5899
|
+
c.tooltipFormat ? C.innerHTML = c.tooltipFormat(a) : i == null ? C.textContent = r : C.textContent = `${r}: ${he(i)}`;
|
|
5900
|
+
let o = f.value?.getBoundingClientRect(), { left: s, top: l } = le(t, n, C.offsetWidth, C.offsetHeight, c.tooltipClamp, o);
|
|
5882
5901
|
C.style.left = `${s}px`, C.style.top = `${l}px`;
|
|
5883
5902
|
}
|
|
5884
|
-
function
|
|
5903
|
+
function ye() {
|
|
5885
5904
|
C &&= (C.remove(), null);
|
|
5886
5905
|
}
|
|
5887
|
-
function
|
|
5888
|
-
x && x !== e && (x.setAttribute("stroke-width", String(
|
|
5906
|
+
function be(e, t) {
|
|
5907
|
+
x && x !== e && (x.setAttribute("stroke-width", String(U.value)), x.setAttribute("stroke", c.strokeColor)), x = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(U.value + 1)), e.setAttribute("stroke", "#555");
|
|
5889
5908
|
}
|
|
5890
|
-
function
|
|
5891
|
-
x && (x.setAttribute("stroke-width", String(
|
|
5909
|
+
function xe() {
|
|
5910
|
+
x && (x.setAttribute("stroke-width", String(U.value)), x.setAttribute("stroke", c.strokeColor), x = null, l("stateHover", null)), ye();
|
|
5892
5911
|
}
|
|
5893
5912
|
function $(e) {
|
|
5894
5913
|
if (w) return;
|
|
5895
|
-
let t = e, n =
|
|
5914
|
+
let t = e, n = _e(t.target);
|
|
5896
5915
|
n && (e.type === "click" ? l("stateClick", {
|
|
5897
5916
|
id: String(n.feat.id),
|
|
5898
|
-
name:
|
|
5917
|
+
name: Z(n.feat),
|
|
5899
5918
|
value: Q(n.feat)
|
|
5900
|
-
}) : e.type === "mouseover" && (
|
|
5919
|
+
}) : e.type === "mouseover" && (be(n.pathEl, n.feat), c.tooltipTrigger && ve(n.feat, t.clientX, t.clientY), l("stateHover", {
|
|
5901
5920
|
id: String(n.feat.id),
|
|
5902
|
-
name:
|
|
5921
|
+
name: Z(n.feat),
|
|
5903
5922
|
value: Q(n.feat)
|
|
5904
5923
|
})));
|
|
5905
5924
|
}
|
|
5906
|
-
function
|
|
5925
|
+
function Se(e) {
|
|
5907
5926
|
w || !C || (C.style.left = `${e.clientX + 16}px`, C.style.top = `${e.clientY}px`);
|
|
5908
5927
|
}
|
|
5909
|
-
function
|
|
5928
|
+
function Ce(e) {
|
|
5910
5929
|
let t = e.relatedTarget;
|
|
5911
|
-
t && v.value?.contains(t) ||
|
|
5930
|
+
t && v.value?.contains(t) || xe();
|
|
5912
5931
|
}
|
|
5913
|
-
function
|
|
5932
|
+
function we() {
|
|
5914
5933
|
return typeof c.menu == "string" ? c.menu : "choropleth";
|
|
5915
5934
|
}
|
|
5916
|
-
let
|
|
5935
|
+
let Te = t(() => c.legend && (G.value || K.value || c.data)), Ee = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), De = t(() => c.title ? 24 : 0), Oe = t(() => Te.value ? 28 : 0), ke = t(() => De.value + Oe.value), Ae = t(() => ae.value + ke.value), je = t(() => De.value + 18), Me = t(() => {
|
|
5917
5936
|
let e = [];
|
|
5918
5937
|
for (let t = 0; t <= 10; t++) {
|
|
5919
5938
|
let n = t / 10;
|
|
@@ -5923,8 +5942,8 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5923
5942
|
});
|
|
5924
5943
|
}
|
|
5925
5944
|
return e;
|
|
5926
|
-
}),
|
|
5927
|
-
let { min: e, max: t } =
|
|
5945
|
+
}), Ne = t(() => {
|
|
5946
|
+
let { min: e, max: t } = ce.value, n = t - e, r = [];
|
|
5928
5947
|
for (let t = 1; t <= 3; t++) {
|
|
5929
5948
|
let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
|
|
5930
5949
|
r.push({
|
|
@@ -5933,44 +5952,44 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5933
5952
|
});
|
|
5934
5953
|
}
|
|
5935
5954
|
return r;
|
|
5936
|
-
}),
|
|
5955
|
+
}), Pe = t(() => {
|
|
5937
5956
|
let e = [];
|
|
5938
|
-
if (
|
|
5957
|
+
if (G.value) for (let t of c.colorScale) e.push({
|
|
5939
5958
|
key: t.value,
|
|
5940
5959
|
color: t.color,
|
|
5941
5960
|
label: t.value
|
|
5942
5961
|
});
|
|
5943
|
-
else if (
|
|
5962
|
+
else if (K.value) for (let t of Ee.value) e.push({
|
|
5944
5963
|
key: String(t.min),
|
|
5945
5964
|
color: t.color,
|
|
5946
5965
|
label: t.label ?? String(t.min)
|
|
5947
5966
|
});
|
|
5948
5967
|
return e;
|
|
5949
|
-
}), Pe = t(() => {
|
|
5950
|
-
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5951
|
-
for (let t of Ne.value) e += 16 + t.label.length * 7 + 12;
|
|
5952
|
-
return e - (Ne.value.length > 0 ? 12 : 0);
|
|
5953
5968
|
}), Fe = t(() => {
|
|
5954
5969
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5955
|
-
|
|
5970
|
+
for (let t of Pe.value) e += 16 + t.label.length * 7 + 12;
|
|
5971
|
+
return e - (Pe.value.length > 0 ? 12 : 0);
|
|
5972
|
+
}), Ie = t(() => {
|
|
5973
|
+
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5974
|
+
return Pe.value.map((t) => {
|
|
5956
5975
|
let n = e;
|
|
5957
5976
|
return e += 16 + t.label.length * 7 + 12, n;
|
|
5958
5977
|
});
|
|
5959
|
-
}),
|
|
5960
|
-
if (
|
|
5978
|
+
}), Le = t(() => {
|
|
5979
|
+
if (G.value || K.value) return (j.value - Fe.value) / 2;
|
|
5961
5980
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5962
5981
|
return (j.value - e - 160) / 2;
|
|
5963
|
-
}),
|
|
5964
|
-
let e =
|
|
5982
|
+
}), Re = t(() => {
|
|
5983
|
+
let e = we();
|
|
5965
5984
|
return [{
|
|
5966
5985
|
label: "Save as SVG",
|
|
5967
5986
|
action: () => {
|
|
5968
|
-
p.value &&
|
|
5987
|
+
p.value && de(p.value, e);
|
|
5969
5988
|
}
|
|
5970
5989
|
}, {
|
|
5971
5990
|
label: "Save as PNG",
|
|
5972
5991
|
action: () => {
|
|
5973
|
-
p.value &&
|
|
5992
|
+
p.value && X(p.value, e);
|
|
5974
5993
|
}
|
|
5975
5994
|
}];
|
|
5976
5995
|
});
|
|
@@ -5978,48 +5997,48 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
5978
5997
|
ref_key: "containerRef",
|
|
5979
5998
|
ref: f,
|
|
5980
5999
|
class: d(["choropleth-wrapper", { pannable: o.pan }])
|
|
5981
|
-
}, [o.menu ? (h(), n(
|
|
6000
|
+
}, [o.menu ? (h(), n(oe, {
|
|
5982
6001
|
key: 0,
|
|
5983
|
-
items:
|
|
6002
|
+
items: Re.value
|
|
5984
6003
|
}, null, 8, ["items"])) : r("", !0), (h(), i("svg", {
|
|
5985
6004
|
ref_key: "svgRef",
|
|
5986
6005
|
ref: p,
|
|
5987
6006
|
width: j.value,
|
|
5988
|
-
height:
|
|
6007
|
+
height: Ae.value
|
|
5989
6008
|
}, [
|
|
5990
6009
|
a("g", {
|
|
5991
6010
|
ref_key: "mapGroupRef",
|
|
5992
6011
|
ref: v
|
|
5993
|
-
}, [(h(!0), i(e, null, _(
|
|
6012
|
+
}, [(h(!0), i(e, null, _(B.value.features, (e) => (h(), i("path", {
|
|
5994
6013
|
key: String(e.id),
|
|
5995
6014
|
"data-feat-id": String(e.id),
|
|
5996
|
-
d:
|
|
5997
|
-
fill:
|
|
6015
|
+
d: se.value(e) ?? void 0,
|
|
6016
|
+
fill: me(e.id),
|
|
5998
6017
|
stroke: o.strokeColor,
|
|
5999
|
-
"stroke-width":
|
|
6018
|
+
"stroke-width": U.value,
|
|
6000
6019
|
class: "state-path"
|
|
6001
|
-
}, [o.tooltipTrigger ? r("", !0) : (h(), i("title", St, y(
|
|
6020
|
+
}, [o.tooltipTrigger ? r("", !0) : (h(), i("title", St, y(Z(e)) + y(Q(e) == null ? "" : `: ${he(Q(e))}`), 1))], 8, xt))), 128)), V.value ? (h(), i("path", {
|
|
6002
6021
|
key: 0,
|
|
6003
|
-
d:
|
|
6022
|
+
d: se.value(V.value) ?? void 0,
|
|
6004
6023
|
fill: "none",
|
|
6005
6024
|
stroke: o.strokeColor,
|
|
6006
6025
|
"stroke-width": 1,
|
|
6007
6026
|
"stroke-linejoin": "round",
|
|
6008
6027
|
"pointer-events": "none"
|
|
6009
6028
|
}, null, 8, Ct)) : r("", !0)], 512),
|
|
6010
|
-
|
|
6029
|
+
Te.value ? (h(), i("g", {
|
|
6011
6030
|
key: 0,
|
|
6012
6031
|
class: "choropleth-legend",
|
|
6013
|
-
transform: `translate(${
|
|
6014
|
-
}, [
|
|
6015
|
-
x:
|
|
6032
|
+
transform: `translate(${Le.value},${je.value})`
|
|
6033
|
+
}, [G.value || K.value ? (h(), i(e, { key: 0 }, [o.legendTitle ? (h(), i("text", Tt, y(o.legendTitle), 1)) : r("", !0), (h(!0), i(e, null, _(Pe.value, (t, n) => (h(), i(e, { key: t.key }, [a("rect", {
|
|
6034
|
+
x: Ie.value[n],
|
|
6016
6035
|
y: -5,
|
|
6017
6036
|
width: "12",
|
|
6018
6037
|
height: "12",
|
|
6019
6038
|
rx: "3",
|
|
6020
6039
|
fill: t.color
|
|
6021
6040
|
}, null, 8, Et), a("text", {
|
|
6022
|
-
x:
|
|
6041
|
+
x: Ie.value[n] + 16,
|
|
6023
6042
|
y: 5,
|
|
6024
6043
|
"font-size": "13",
|
|
6025
6044
|
fill: "currentColor"
|
|
@@ -6031,7 +6050,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
6031
6050
|
x2: "1",
|
|
6032
6051
|
y1: "0",
|
|
6033
6052
|
y2: "0"
|
|
6034
|
-
}, [(h(!0), i(e, null, _(
|
|
6053
|
+
}, [(h(!0), i(e, null, _(Me.value, (e) => (h(), i("stop", {
|
|
6035
6054
|
key: e.offset,
|
|
6036
6055
|
offset: e.offset,
|
|
6037
6056
|
"stop-color": e.color
|
|
@@ -6044,7 +6063,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
6044
6063
|
rx: "2",
|
|
6045
6064
|
fill: `url(#${u})`
|
|
6046
6065
|
}, null, 8, At),
|
|
6047
|
-
(h(!0), i(e, null, _(
|
|
6066
|
+
(h(!0), i(e, null, _(Ne.value, (e) => (h(), i("text", {
|
|
6048
6067
|
key: e.value,
|
|
6049
6068
|
x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
|
|
6050
6069
|
y: 20,
|
|
@@ -6065,7 +6084,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
6065
6084
|
}, y(o.title), 9, Mt)) : r("", !0)
|
|
6066
6085
|
], 8, bt))], 2));
|
|
6067
6086
|
}
|
|
6068
|
-
}), [["__scopeId", "data-v-
|
|
6087
|
+
}), [["__scopeId", "data-v-105ba317"]]), Pt = /* @__PURE__ */ B(/* @__PURE__ */ c({
|
|
6069
6088
|
__name: "ChartTooltip",
|
|
6070
6089
|
props: {
|
|
6071
6090
|
x: {},
|
|
@@ -6116,7 +6135,7 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
6116
6135
|
_: 3
|
|
6117
6136
|
}, 8, ["open"])) : r("", !0);
|
|
6118
6137
|
}
|
|
6119
|
-
}), [["__scopeId", "data-v-44377f70"]]), Ft = { class: "TableWrapper" }, It =
|
|
6138
|
+
}), [["__scopeId", "data-v-44377f70"]]), Ft = { class: "TableWrapper" }, It = /* @__PURE__ */ B(/* @__PURE__ */ c({
|
|
6120
6139
|
__name: "DataTable",
|
|
6121
6140
|
props: {
|
|
6122
6141
|
data: {},
|
|
@@ -6128,7 +6147,11 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
6128
6147
|
},
|
|
6129
6148
|
csv: {},
|
|
6130
6149
|
filename: {},
|
|
6131
|
-
|
|
6150
|
+
downloadMenuLink: { default: "Download" },
|
|
6151
|
+
fullWidth: {
|
|
6152
|
+
type: Boolean,
|
|
6153
|
+
default: !1
|
|
6154
|
+
}
|
|
6132
6155
|
},
|
|
6133
6156
|
setup(o) {
|
|
6134
6157
|
let s = {
|
|
@@ -6141,7 +6164,10 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
6141
6164
|
}
|
|
6142
6165
|
function u(e) {
|
|
6143
6166
|
let t = c.columnConfig?.[e]?.width;
|
|
6144
|
-
if (t == null) return
|
|
6167
|
+
if (t == null) return c.fullWidth ? void 0 : {
|
|
6168
|
+
width: s.medium,
|
|
6169
|
+
minWidth: s.medium
|
|
6170
|
+
};
|
|
6145
6171
|
let n = typeof t == "number" ? `${t}px` : s[t];
|
|
6146
6172
|
return {
|
|
6147
6173
|
width: n,
|
|
@@ -6192,38 +6218,33 @@ var he = ["width", "height"], ge = ["x"], _e = { key: 1 }, ve = [
|
|
|
6192
6218
|
}
|
|
6193
6219
|
return n.join("\n");
|
|
6194
6220
|
}
|
|
6195
|
-
let S = t(() =>
|
|
6196
|
-
label:
|
|
6197
|
-
action: () =>
|
|
6198
|
-
}]), ne = t(() => c.
|
|
6199
|
-
return (t, s) => (h(), i("div", { class: d(["TableOuter", {
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
class: "data-table-download-link",
|
|
6222
|
-
href: C.value,
|
|
6223
|
-
download: `${te()}.csv`
|
|
6224
|
-
}, y(ne.value), 9, Lt)) : r("", !0)
|
|
6225
|
-
], 2));
|
|
6221
|
+
let S = t(() => [{
|
|
6222
|
+
label: c.downloadMenuLink,
|
|
6223
|
+
action: () => fe(x(), te())
|
|
6224
|
+
}]), ne = t(() => !!c.menu);
|
|
6225
|
+
return (t, s) => (h(), i("div", { class: d(["TableOuter", {
|
|
6226
|
+
"full-width": o.fullWidth,
|
|
6227
|
+
"has-menu": ne.value
|
|
6228
|
+
}]) }, [ne.value ? (h(), n(oe, {
|
|
6229
|
+
key: 0,
|
|
6230
|
+
items: S.value,
|
|
6231
|
+
"force-dropdown": ""
|
|
6232
|
+
}, null, 8, ["items"])) : r("", !0), a("div", Ft, [a("table", { class: d(["Table", { "full-width": o.fullWidth }]) }, [
|
|
6233
|
+
a("colgroup", null, [(h(!0), i(e, null, _(m.value, (e) => (h(), i("col", {
|
|
6234
|
+
key: e.name,
|
|
6235
|
+
style: p(u(e.name))
|
|
6236
|
+
}, null, 4))), 128))]),
|
|
6237
|
+
a("thead", null, [a("tr", null, [(h(!0), i(e, null, _(m.value, (e) => (h(), i("th", {
|
|
6238
|
+
key: e.name,
|
|
6239
|
+
style: p(f(e.name))
|
|
6240
|
+
}, y(l(e.name)), 5))), 128))])]),
|
|
6241
|
+
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", {
|
|
6242
|
+
key: e.name,
|
|
6243
|
+
class: d(o.columnConfig?.[e.name]?.cellClass),
|
|
6244
|
+
style: p(f(e.name))
|
|
6245
|
+
}, y(v(e, t - 1)), 7))), 128))]))), 128))])
|
|
6246
|
+
], 2)])], 2));
|
|
6226
6247
|
}
|
|
6227
|
-
}), [["__scopeId", "data-v-
|
|
6248
|
+
}), [["__scopeId", "data-v-d5c290dc"]]);
|
|
6228
6249
|
//#endregion
|
|
6229
|
-
export { _t as BarChart, Pt as ChartTooltip, Nt as ChoroplethMap,
|
|
6250
|
+
export { _t as BarChart, Pt as ChartTooltip, Nt as ChoroplethMap, It as DataTable, Xe as LineChart };
|