@cfasim-ui/charts 0.3.4 → 0.3.6
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/index.css +1 -1
- package/dist/index.js +392 -378
- 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, normalizeClass as u, normalizeProps as d, normalizeStyle as f, onMounted as p, onUnmounted as ee, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, toRaw as y, unref as b, useId as x, watch as
|
|
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, normalizeClass as u, normalizeProps as d, normalizeStyle as f, onMounted as p, onUnmounted as ee, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, toRaw as y, unref as b, useId as x, watch as te, withCtx as S, withModifiers as C } from "vue";
|
|
2
|
+
import { DropdownMenuContent as w, DropdownMenuItem as T, DropdownMenuPortal as E, DropdownMenuRoot as D, DropdownMenuTrigger as O, PopoverAnchor as k, PopoverContent as A, PopoverPortal as j, PopoverRoot as M } from "reka-ui";
|
|
3
|
+
import { geoAlbersUsa as ne, geoPath as N } from "d3-geo";
|
|
4
|
+
import { zoom as P } from "d3-zoom";
|
|
5
|
+
import { select as re } from "d3-selection";
|
|
6
|
+
import { feature as ie, 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 F = { class: "chart-menu-trigger-area" }, se = ["aria-label"], ce = /* @__PURE__ */ c({
|
|
9
9
|
__name: "ChartMenu",
|
|
10
10
|
props: { items: {} },
|
|
11
11
|
setup(t) {
|
|
12
|
-
return (r, c) => (m(), i("div",
|
|
12
|
+
return (r, c) => (m(), i("div", F, [t.items.length === 1 ? (m(), 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 I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__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, se)) : (m(), n(b(D), {
|
|
28
28
|
key: 1,
|
|
29
29
|
modal: !1
|
|
30
30
|
}, {
|
|
31
|
-
default:
|
|
31
|
+
default: S(() => [s(b(O), {
|
|
32
32
|
class: "chart-menu-button",
|
|
33
33
|
"aria-label": "Chart options"
|
|
34
34
|
}, {
|
|
35
|
-
default:
|
|
35
|
+
default: S(() => [...c[2] ||= [a("svg", {
|
|
36
36
|
width: "16",
|
|
37
37
|
height: "16",
|
|
38
38
|
viewBox: "0 0 16 16",
|
|
@@ -56,18 +56,18 @@ var I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__PUR
|
|
|
56
56
|
})
|
|
57
57
|
], -1)]]),
|
|
58
58
|
_: 1
|
|
59
|
-
}), s(b(
|
|
60
|
-
default:
|
|
59
|
+
}), s(b(E), null, {
|
|
60
|
+
default: S(() => [s(b(w), {
|
|
61
61
|
class: "chart-menu-content",
|
|
62
62
|
"side-offset": 4,
|
|
63
63
|
align: "end"
|
|
64
64
|
}, {
|
|
65
|
-
default:
|
|
65
|
+
default: S(() => [(m(!0), i(e, null, g(t.items, (e) => (m(), n(b(T), {
|
|
66
66
|
key: e.label,
|
|
67
67
|
class: "chart-menu-item",
|
|
68
68
|
onSelect: e.action
|
|
69
69
|
}, {
|
|
70
|
-
default:
|
|
70
|
+
default: S(() => [o(v(e.label), 1)]),
|
|
71
71
|
_: 2
|
|
72
72
|
}, 1032, ["onSelect"]))), 128))]),
|
|
73
73
|
_: 1
|
|
@@ -77,24 +77,24 @@ var I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__PUR
|
|
|
77
77
|
_: 1
|
|
78
78
|
}))]));
|
|
79
79
|
}
|
|
80
|
-
}),
|
|
80
|
+
}), I = (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
|
+
}, le = /* @__PURE__ */ I(ce, [["__scopeId", "data-v-fe2f6904"]]);
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/ChartMenu/download.ts
|
|
87
|
-
function
|
|
87
|
+
function L(e, t) {
|
|
88
88
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
89
89
|
r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ue(e, t) {
|
|
92
92
|
let n = e.cloneNode(!0);
|
|
93
93
|
n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
94
94
|
let r = new XMLSerializer().serializeToString(n);
|
|
95
|
-
|
|
95
|
+
L(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function de(e, t) {
|
|
98
98
|
let n = e.cloneNode(!0);
|
|
99
99
|
n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
100
100
|
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;
|
|
@@ -103,19 +103,19 @@ function le(e, t) {
|
|
|
103
103
|
e.width = s * 2, e.height = c * 2;
|
|
104
104
|
let n = e.getContext("2d");
|
|
105
105
|
n.scale(2, 2), n.drawImage(o, 0, 0, s, c), e.toBlob((e) => {
|
|
106
|
-
e &&
|
|
106
|
+
e && L(e, `${t}.png`);
|
|
107
107
|
}), URL.revokeObjectURL(a);
|
|
108
108
|
}, o.src = a;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
110
|
+
function fe(e, t) {
|
|
111
|
+
L(new Blob([e], { type: "text/csv" }), `${t}.csv`);
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/tooltip-position.ts
|
|
115
|
-
var
|
|
116
|
-
function
|
|
115
|
+
var R = 16, z = 8;
|
|
116
|
+
function pe(e, t, n, r, i, a) {
|
|
117
117
|
if (i === "none") return {
|
|
118
|
-
left: e +
|
|
118
|
+
left: e + R,
|
|
119
119
|
top: t
|
|
120
120
|
};
|
|
121
121
|
let o = i === "chart" && a ? {
|
|
@@ -128,74 +128,74 @@ function ue(e, t, n, r, i, a) {
|
|
|
128
128
|
right: window.innerWidth,
|
|
129
129
|
top: 0,
|
|
130
130
|
bottom: window.innerHeight
|
|
131
|
-
}, s = e +
|
|
131
|
+
}, s = e + R + n > o.right - z ? e - R - n : e + R, c = r / 2;
|
|
132
132
|
return {
|
|
133
133
|
left: s,
|
|
134
|
-
top: Math.min(Math.max(t, o.top +
|
|
134
|
+
top: Math.min(Math.max(t, o.top + z + c), o.bottom - z - c)
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
//#endregion
|
|
138
138
|
//#region src/LineChart/LineChart.vue?vue&type=script&setup=true&lang.ts
|
|
139
|
-
var
|
|
139
|
+
var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
|
|
140
140
|
"x1",
|
|
141
141
|
"y1",
|
|
142
142
|
"x2",
|
|
143
143
|
"y2",
|
|
144
144
|
"stroke",
|
|
145
145
|
"stroke-dasharray"
|
|
146
|
-
],
|
|
146
|
+
], H = [
|
|
147
147
|
"cx",
|
|
148
148
|
"cy",
|
|
149
149
|
"fill",
|
|
150
150
|
"fill-opacity",
|
|
151
151
|
"stroke"
|
|
152
|
-
],
|
|
152
|
+
], ge = ["x", "y"], _e = [
|
|
153
153
|
"x1",
|
|
154
154
|
"y1",
|
|
155
155
|
"x2",
|
|
156
156
|
"y2"
|
|
157
|
-
],
|
|
157
|
+
], ve = [
|
|
158
158
|
"x1",
|
|
159
159
|
"y1",
|
|
160
160
|
"x2",
|
|
161
161
|
"y2"
|
|
162
|
-
],
|
|
162
|
+
], ye = [
|
|
163
163
|
"x1",
|
|
164
164
|
"y1",
|
|
165
165
|
"x2",
|
|
166
166
|
"y2"
|
|
167
|
-
],
|
|
167
|
+
], be = [
|
|
168
168
|
"x1",
|
|
169
169
|
"y1",
|
|
170
170
|
"x2",
|
|
171
171
|
"y2"
|
|
172
|
-
],
|
|
172
|
+
], xe = ["x", "y"], Se = ["transform"], U = ["x", "y"], W = ["x", "y"], Ce = [
|
|
173
173
|
"d",
|
|
174
174
|
"fill",
|
|
175
175
|
"fill-opacity"
|
|
176
|
-
],
|
|
176
|
+
], we = [
|
|
177
177
|
"d",
|
|
178
178
|
"stroke",
|
|
179
179
|
"stroke-width",
|
|
180
180
|
"stroke-opacity",
|
|
181
181
|
"stroke-dasharray"
|
|
182
|
-
],
|
|
182
|
+
], Te = [
|
|
183
183
|
"cx",
|
|
184
184
|
"cy",
|
|
185
185
|
"r",
|
|
186
186
|
"fill",
|
|
187
187
|
"fill-opacity",
|
|
188
188
|
"stroke"
|
|
189
|
-
],
|
|
189
|
+
], Ee = [
|
|
190
190
|
"d",
|
|
191
191
|
"fill",
|
|
192
192
|
"fill-opacity"
|
|
193
|
-
],
|
|
193
|
+
], De = [
|
|
194
194
|
"d",
|
|
195
195
|
"stroke",
|
|
196
196
|
"stroke-width",
|
|
197
197
|
"stroke-dasharray"
|
|
198
|
-
],
|
|
198
|
+
], Oe = [
|
|
199
199
|
"x1",
|
|
200
200
|
"y1",
|
|
201
201
|
"x2",
|
|
@@ -203,7 +203,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
203
203
|
"stroke",
|
|
204
204
|
"stroke-width",
|
|
205
205
|
"stroke-dasharray"
|
|
206
|
-
],
|
|
206
|
+
], G = [
|
|
207
207
|
"x1",
|
|
208
208
|
"y1",
|
|
209
209
|
"x2",
|
|
@@ -211,44 +211,44 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
211
211
|
"stroke",
|
|
212
212
|
"stroke-width",
|
|
213
213
|
"stroke-dasharray"
|
|
214
|
-
],
|
|
214
|
+
], ke = [
|
|
215
215
|
"x1",
|
|
216
216
|
"y1",
|
|
217
217
|
"x2",
|
|
218
218
|
"y2"
|
|
219
|
-
],
|
|
219
|
+
], Ae = [
|
|
220
220
|
"x1",
|
|
221
221
|
"y1",
|
|
222
222
|
"x2",
|
|
223
223
|
"y2"
|
|
224
|
-
],
|
|
224
|
+
], je = [
|
|
225
225
|
"x1",
|
|
226
226
|
"y1",
|
|
227
227
|
"x2",
|
|
228
228
|
"y2"
|
|
229
|
-
],
|
|
229
|
+
], Me = [
|
|
230
230
|
"cx",
|
|
231
231
|
"cy",
|
|
232
232
|
"fill"
|
|
233
|
-
],
|
|
233
|
+
], Ne = [
|
|
234
234
|
"x",
|
|
235
235
|
"y",
|
|
236
236
|
"width",
|
|
237
237
|
"height"
|
|
238
|
-
],
|
|
238
|
+
], Pe = [
|
|
239
239
|
"cx",
|
|
240
240
|
"cy",
|
|
241
241
|
"fill",
|
|
242
242
|
"fill-opacity",
|
|
243
243
|
"stroke"
|
|
244
|
-
],
|
|
244
|
+
], Fe = [
|
|
245
245
|
"x",
|
|
246
246
|
"y",
|
|
247
247
|
"fill"
|
|
248
|
-
],
|
|
248
|
+
], Ie = ["x", "y"], Le = { class: "line-chart-tooltip" }, Re = {
|
|
249
249
|
key: 0,
|
|
250
250
|
class: "line-chart-tooltip-label"
|
|
251
|
-
},
|
|
251
|
+
}, ze = ["href", "download"], K = 20, q = 36, Be = 12, Ve = 7, He = 16, Ue = 50, J = /* @__PURE__ */ I(/* @__PURE__ */ c({
|
|
252
252
|
__name: "LineChart",
|
|
253
253
|
props: {
|
|
254
254
|
data: {},
|
|
@@ -280,31 +280,31 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
280
280
|
},
|
|
281
281
|
emits: ["hover"],
|
|
282
282
|
setup(s, { emit: c }) {
|
|
283
|
-
let u = s, y = c, b = h(null), x = h(null), S = h(0),
|
|
283
|
+
let u = s, y = c, b = h(null), x = h(null), S = h(0), w = null, T = null;
|
|
284
284
|
p(() => {
|
|
285
|
-
b.value && (S.value = b.value.clientWidth,
|
|
285
|
+
b.value && (S.value = b.value.clientWidth, w = new ResizeObserver((e) => {
|
|
286
286
|
let t = e[0];
|
|
287
287
|
t && (u.debounce ? (T && clearTimeout(T), T = setTimeout(() => {
|
|
288
288
|
S.value = t.contentRect.width;
|
|
289
289
|
}, u.debounce)) : S.value = t.contentRect.width);
|
|
290
|
-
}),
|
|
290
|
+
}), w.observe(b.value));
|
|
291
291
|
}), ee(() => {
|
|
292
|
-
|
|
292
|
+
w?.disconnect(), T && clearTimeout(T);
|
|
293
293
|
});
|
|
294
294
|
let E = t(() => u.width ?? (S.value || 400)), D = t(() => u.height ?? 200), O = t(() => M.value.some((e) => e.legend) || u.areaSections?.some((e) => e.legend === "inline" && (e.label || e.description))), k = t(() => ({
|
|
295
|
-
top: (u.title ? 30 : 10) + (O.value ?
|
|
295
|
+
top: (u.title ? 30 : 10) + (O.value ? K : 0),
|
|
296
296
|
right: 10,
|
|
297
297
|
bottom: u.xLabel ? 46 : 30,
|
|
298
298
|
left: u.yLabel ? 66 : 50
|
|
299
|
-
})), A = t(() => E.value - k.value.left - k.value.right), j = t(() => D.value - k.value.top - k.value.bottom), M = t(() => u.series && u.series.length > 0 ? u.series : u.data ? [{ data: u.data }] : []),
|
|
299
|
+
})), A = t(() => E.value - k.value.left - k.value.right), j = t(() => D.value - k.value.top - k.value.bottom), M = t(() => u.series && u.series.length > 0 ? u.series : u.data ? [{ data: u.data }] : []), ne = t(() => u.areas ?? []), N = t(() => {
|
|
300
300
|
let e = 0;
|
|
301
301
|
for (let t of M.value) t.data.length > e && (e = t.data.length);
|
|
302
|
-
for (let t of
|
|
302
|
+
for (let t of ne.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
|
|
303
303
|
return e;
|
|
304
|
-
}),
|
|
304
|
+
}), P = t(() => {
|
|
305
305
|
let e = Infinity, t = -Infinity;
|
|
306
306
|
for (let n of M.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
307
|
-
for (let n of
|
|
307
|
+
for (let n of ne.value) {
|
|
308
308
|
for (let r of n.upper) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
309
309
|
for (let r of n.lower) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
310
310
|
}
|
|
@@ -318,9 +318,9 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
318
318
|
range: 1
|
|
319
319
|
};
|
|
320
320
|
});
|
|
321
|
-
function
|
|
321
|
+
function re(e) {
|
|
322
322
|
if (e.length === 0) return "";
|
|
323
|
-
let { min: t, range: n } =
|
|
323
|
+
let { min: t, range: n } = P.value, r = N.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = "", c = !1;
|
|
324
324
|
for (let n = 0; n < e.length; n++) {
|
|
325
325
|
if (!isFinite(e[n])) {
|
|
326
326
|
c = !1;
|
|
@@ -331,18 +331,18 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
331
331
|
}
|
|
332
332
|
return s;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
let { min: t, range: n } =
|
|
334
|
+
function ie(e) {
|
|
335
|
+
let { min: t, range: n } = P.value, r = N.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = [];
|
|
336
336
|
for (let n = 0; n < e.length; n++) isFinite(e[n]) && s.push({
|
|
337
337
|
x: k.value.left + n * i,
|
|
338
338
|
y: o - (e[n] - t) * a
|
|
339
339
|
});
|
|
340
340
|
return s;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function ae(e, t) {
|
|
343
343
|
let n = Math.min(e.length, t.length);
|
|
344
344
|
if (n === 0) return "";
|
|
345
|
-
let { min: r, range: i } =
|
|
345
|
+
let { min: r, range: i } = P.value, a = N.value, o = A.value / (a - 1 || 1), s = j.value / i, c = k.value.top + j.value, l = (e) => k.value.left + e * o, u = (e) => c - (e - r) * s, d = [], f = [];
|
|
346
346
|
for (let r = 0; r < n; r++) isFinite(e[r]) && isFinite(t[r]) ? f.push(r) : f.length && (d.push(f), f = []);
|
|
347
347
|
f.length && d.push(f);
|
|
348
348
|
let p = "";
|
|
@@ -354,30 +354,30 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
354
354
|
}
|
|
355
355
|
return p;
|
|
356
356
|
}
|
|
357
|
-
function
|
|
358
|
-
let n =
|
|
357
|
+
function oe(e, t = !0) {
|
|
358
|
+
let n = N.value, r = A.value / (n - 1 || 1), i = k.value.top + j.value, a = (e) => k.value.left + e * r;
|
|
359
359
|
if (e.seriesIndex == null) {
|
|
360
360
|
let t = Math.max(0, e.startIndex), r = Math.min(n - 1, e.endIndex);
|
|
361
361
|
return t > r ? "" : `M${a(t)},${k.value.top}L${a(r)},${k.value.top}L${a(r)},${i}L${a(t)},${i}Z`;
|
|
362
362
|
}
|
|
363
363
|
let o = M.value[e.seriesIndex];
|
|
364
364
|
if (!o) return "";
|
|
365
|
-
let { min: s, range: c } =
|
|
365
|
+
let { min: s, range: c } = P.value, l = j.value / c, u = (e) => i - (e - s) * l, d = Math.max(0, e.startIndex), f = Math.min(o.data.length - 1, e.endIndex);
|
|
366
366
|
if (d > f) return "";
|
|
367
367
|
let p = `M${a(d)},${u(o.data[d])}`;
|
|
368
368
|
for (let e = d + 1; e <= f; e++) isFinite(o.data[e]) && (p += `L${a(e)},${u(o.data[e])}`);
|
|
369
369
|
return t && (p += `L${a(f)},${i}`, p += `L${a(d)},${i}`, p += "Z"), p;
|
|
370
370
|
}
|
|
371
|
-
let
|
|
371
|
+
let F = t(() => {
|
|
372
372
|
let e = u.areaSections;
|
|
373
373
|
if (!e?.length) return {
|
|
374
374
|
labels: [],
|
|
375
375
|
extraHeight: 0
|
|
376
376
|
};
|
|
377
|
-
let t =
|
|
377
|
+
let t = N.value, n = A.value / (t - 1 || 1), r = [];
|
|
378
378
|
for (let t of e) {
|
|
379
379
|
if (!t.label && !t.description || t.legend === "inline" || t.legend === !1) continue;
|
|
380
|
-
let e = k.value.left + (t.startIndex + t.endIndex) / 2 * n, i = t.label ?? "", a = t.description ?? "", o = Math.max(i.length, a.length) *
|
|
380
|
+
let e = k.value.left + (t.startIndex + t.endIndex) / 2 * n, i = t.label ?? "", a = t.description ?? "", o = Math.max(i.length, a.length) * Ve, s = t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor");
|
|
381
381
|
r.push({
|
|
382
382
|
cx: e,
|
|
383
383
|
labelText: i,
|
|
@@ -392,7 +392,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
392
392
|
let i = [];
|
|
393
393
|
for (let e of r) {
|
|
394
394
|
let t = e.cx - e.textWidth / 2, n = 0;
|
|
395
|
-
for (; n < i.length && !(t >= i[n] +
|
|
395
|
+
for (; n < i.length && !(t >= i[n] + He);) n++;
|
|
396
396
|
e.row = n;
|
|
397
397
|
let r = e.cx + e.textWidth / 2;
|
|
398
398
|
i[n] = Math.max(i[n] ?? -Infinity, r);
|
|
@@ -402,9 +402,9 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
402
402
|
extraHeight: 0
|
|
403
403
|
} : {
|
|
404
404
|
labels: r,
|
|
405
|
-
extraHeight: (Math.max(...r.map((e) => e.row)) + 1) *
|
|
405
|
+
extraHeight: (Math.max(...r.map((e) => e.row)) + 1) * q + Be
|
|
406
406
|
};
|
|
407
|
-
}),
|
|
407
|
+
}), se = t(() => {
|
|
408
408
|
let e = [];
|
|
409
409
|
for (let t of M.value) t.legend && e.push({
|
|
410
410
|
label: t.legend,
|
|
@@ -424,64 +424,64 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
424
424
|
});
|
|
425
425
|
}
|
|
426
426
|
return e;
|
|
427
|
-
}),
|
|
428
|
-
function
|
|
427
|
+
}), ce = t(() => D.value + F.value.extraHeight), I = t(() => k.value.top + j.value + k.value.bottom + Be);
|
|
428
|
+
function L(e, t) {
|
|
429
429
|
let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r, a;
|
|
430
430
|
return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function R(e) {
|
|
433
433
|
return Math.round(e) + .5;
|
|
434
434
|
}
|
|
435
|
-
let
|
|
436
|
-
function
|
|
437
|
-
return Math.abs(e) >= 1e3 ?
|
|
435
|
+
let z = new Intl.NumberFormat();
|
|
436
|
+
function J(e) {
|
|
437
|
+
return Math.abs(e) >= 1e3 ? z.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
|
|
438
438
|
}
|
|
439
|
-
let
|
|
440
|
-
let { min: e, max: t } =
|
|
439
|
+
let We = t(() => {
|
|
440
|
+
let { min: e, max: t } = P.value;
|
|
441
441
|
if (e === t) return [{
|
|
442
|
-
value:
|
|
443
|
-
y:
|
|
442
|
+
value: J(e),
|
|
443
|
+
y: R(k.value.top + j.value / 2)
|
|
444
444
|
}];
|
|
445
|
-
let n = Math.max(3, Math.floor(j.value / 50)), r =
|
|
445
|
+
let n = Math.max(3, Math.floor(j.value / 50)), r = L(t - e, n), i = Math.ceil(e / r) * r, a = [];
|
|
446
446
|
for (let n = i; n <= t; n += r) a.push({
|
|
447
|
-
value:
|
|
448
|
-
y:
|
|
447
|
+
value: J(n),
|
|
448
|
+
y: R(k.value.top + j.value - (n - e) / P.value.range * j.value)
|
|
449
449
|
});
|
|
450
450
|
return a;
|
|
451
|
-
}),
|
|
452
|
-
let e =
|
|
451
|
+
}), Ge = t(() => {
|
|
452
|
+
let e = N.value;
|
|
453
453
|
if (e <= 1) return [];
|
|
454
454
|
let t = u.xLabels;
|
|
455
455
|
if (t && t.length === e) {
|
|
456
456
|
let n = Math.max(3, Math.floor(A.value / 80)), r = Math.max(1, Math.round((e - 1) / n)), i = [];
|
|
457
457
|
for (let n = 0; n < e; n += r) i.push({
|
|
458
458
|
value: t[n],
|
|
459
|
-
x:
|
|
459
|
+
x: R(k.value.left + n / (e - 1) * A.value)
|
|
460
460
|
});
|
|
461
461
|
return i;
|
|
462
462
|
}
|
|
463
|
-
let n = u.xMin ?? 0, r = Math.max(3, Math.floor(A.value / 80)), i =
|
|
463
|
+
let n = u.xMin ?? 0, r = Math.max(3, Math.floor(A.value / 80)), i = L(e - 1, r), a = [];
|
|
464
464
|
for (let t = 0; t <= e - 1; t += i) {
|
|
465
465
|
let r = Math.round(t);
|
|
466
466
|
a.push({
|
|
467
|
-
value:
|
|
468
|
-
x:
|
|
467
|
+
value: J(r + n),
|
|
468
|
+
x: R(k.value.left + r / (e - 1) * A.value)
|
|
469
469
|
});
|
|
470
470
|
}
|
|
471
471
|
return a;
|
|
472
472
|
});
|
|
473
|
-
function
|
|
473
|
+
function Ke() {
|
|
474
474
|
return u.filename ? u.filename : typeof u.menu == "string" ? u.menu : "chart";
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function qe() {
|
|
477
477
|
return x.value;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function Je() {
|
|
480
480
|
if (typeof u.csv == "function") return u.csv();
|
|
481
481
|
if (typeof u.csv == "string") return u.csv;
|
|
482
482
|
let e = M.value;
|
|
483
483
|
if (e.length === 0) return "";
|
|
484
|
-
let t =
|
|
484
|
+
let t = N.value, n = [(e.length === 1 ? ["index", "value"] : ["index", ...e.map((e, t) => `series_${t}`)]).join(",")];
|
|
485
485
|
for (let r = 0; r < t; r++) {
|
|
486
486
|
let t = [r.toString()];
|
|
487
487
|
for (let n of e) t.push(r < n.data.length ? String(n.data[r]) : "");
|
|
@@ -489,21 +489,21 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
489
489
|
}
|
|
490
490
|
return n.join("\n");
|
|
491
491
|
}
|
|
492
|
-
let
|
|
493
|
-
if (
|
|
494
|
-
let e =
|
|
495
|
-
return k.value.left +
|
|
496
|
-
}),
|
|
497
|
-
let e =
|
|
492
|
+
let Y = h(null), Ye = h(!1), Xe = h(null), X = h(null), Z = h(null), Ze = t(() => !!u.tooltipData || !!u.tooltipTrigger), Qe = t(() => {
|
|
493
|
+
if (Y.value === null) return 0;
|
|
494
|
+
let e = N.value, t = A.value / (e - 1 || 1);
|
|
495
|
+
return k.value.left + Y.value * t;
|
|
496
|
+
}), $e = t(() => {
|
|
497
|
+
let e = Y.value;
|
|
498
498
|
if (e === null) return [];
|
|
499
|
-
let { min: t, range: n } =
|
|
499
|
+
let { min: t, range: n } = P.value, r = j.value / n, i = k.value.top + j.value;
|
|
500
500
|
return M.value.filter((t) => e < t.data.length && isFinite(t.data[e])).map((n) => ({
|
|
501
|
-
x:
|
|
501
|
+
x: Qe.value,
|
|
502
502
|
y: i - (n.data[e] - t) * r,
|
|
503
503
|
color: n.color ?? "currentColor"
|
|
504
504
|
}));
|
|
505
|
-
}),
|
|
506
|
-
let e =
|
|
505
|
+
}), Q = t(() => {
|
|
506
|
+
let e = Y.value;
|
|
507
507
|
return e === null ? null : {
|
|
508
508
|
index: e,
|
|
509
509
|
xLabel: u.xLabels?.[e],
|
|
@@ -515,68 +515,78 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
515
515
|
data: u.tooltipData?.[e] ?? null
|
|
516
516
|
};
|
|
517
517
|
});
|
|
518
|
-
function
|
|
518
|
+
function et(e) {
|
|
519
519
|
return "touches" in e ? e.touches[0] ?? null : e;
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function tt(e) {
|
|
522
522
|
let t = b.value?.getBoundingClientRect();
|
|
523
523
|
if (!t) return null;
|
|
524
|
-
let n =
|
|
524
|
+
let n = N.value;
|
|
525
525
|
if (n <= 1) return null;
|
|
526
526
|
let r = e - t.left, i = A.value / (n - 1 || 1), a = (r - k.value.left) / i;
|
|
527
527
|
return Math.round(Math.max(0, Math.min(n - 1, a)));
|
|
528
528
|
}
|
|
529
|
-
function
|
|
530
|
-
let
|
|
531
|
-
if (!n) return;
|
|
532
|
-
let r = b.value.getBoundingClientRect(), { left: i, top: a } = ue(e, t - (Ge.value ? ze : 0), n.offsetWidth, n.offsetHeight, u.tooltipClamp, r);
|
|
533
|
-
n.style.left = `${i - r.left}px`, n.style.top = `${a - r.top}px`;
|
|
534
|
-
}
|
|
535
|
-
function $e(e) {
|
|
536
|
-
let t = Xe(e);
|
|
529
|
+
function $(e) {
|
|
530
|
+
let t = et(e);
|
|
537
531
|
if (!t) return;
|
|
538
|
-
let n =
|
|
539
|
-
n !== null && (
|
|
532
|
+
let n = tt(t.clientX);
|
|
533
|
+
n !== null && (Y.value = n, X.value = {
|
|
534
|
+
clientX: t.clientX,
|
|
535
|
+
clientY: t.clientY
|
|
536
|
+
}, y("hover", { index: n }));
|
|
540
537
|
}
|
|
541
|
-
|
|
542
|
-
|
|
538
|
+
te([X, Y], () => {
|
|
539
|
+
if (Y.value === null || !X.value) {
|
|
540
|
+
Z.value = null;
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
let e = Xe.value, t = b.value;
|
|
544
|
+
if (!e || !t) return;
|
|
545
|
+
let n = t.getBoundingClientRect(), r = Ye.value ? Ue : 0, { left: i, top: a } = pe(X.value.clientX, X.value.clientY - r, e.offsetWidth, e.offsetHeight, u.tooltipClamp, n);
|
|
546
|
+
Z.value = {
|
|
547
|
+
left: i - n.left,
|
|
548
|
+
top: a - n.top
|
|
549
|
+
};
|
|
550
|
+
}, { flush: "post" });
|
|
551
|
+
function nt(e) {
|
|
552
|
+
$(e);
|
|
543
553
|
}
|
|
544
|
-
function
|
|
545
|
-
u.tooltipTrigger !== "click" && (
|
|
554
|
+
function rt() {
|
|
555
|
+
u.tooltipTrigger !== "click" && (Y.value = null, y("hover", null));
|
|
546
556
|
}
|
|
547
|
-
function
|
|
557
|
+
function it(e) {
|
|
548
558
|
if (u.tooltipTrigger !== "click") return;
|
|
549
|
-
let t =
|
|
559
|
+
let t = et(e);
|
|
550
560
|
if (!t) return;
|
|
551
|
-
let n =
|
|
552
|
-
n !== null && (
|
|
561
|
+
let n = tt(t.clientX);
|
|
562
|
+
n !== null && (Y.value = Y.value === n ? null : n, y("hover", Y.value === null ? null : { index: n }));
|
|
553
563
|
}
|
|
554
|
-
function
|
|
555
|
-
|
|
564
|
+
function at(e) {
|
|
565
|
+
Ye.value = !0, $(e);
|
|
556
566
|
}
|
|
557
|
-
function
|
|
558
|
-
$
|
|
567
|
+
function ot(e) {
|
|
568
|
+
$(e);
|
|
559
569
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
570
|
+
function st() {
|
|
571
|
+
Ye.value = !1, Y.value = null, y("hover", null);
|
|
562
572
|
}
|
|
563
|
-
let
|
|
564
|
-
let e =
|
|
573
|
+
let ct = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), lt = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(Je())}` : null), ut = t(() => {
|
|
574
|
+
let e = Ke(), t = [{
|
|
565
575
|
label: "Save as SVG",
|
|
566
576
|
action: () => {
|
|
567
|
-
let t =
|
|
568
|
-
t &&
|
|
577
|
+
let t = qe();
|
|
578
|
+
t && ue(t, e);
|
|
569
579
|
}
|
|
570
580
|
}, {
|
|
571
581
|
label: "Save as PNG",
|
|
572
582
|
action: () => {
|
|
573
|
-
let t =
|
|
574
|
-
t &&
|
|
583
|
+
let t = qe();
|
|
584
|
+
t && de(t, e);
|
|
575
585
|
}
|
|
576
586
|
}];
|
|
577
587
|
return u.downloadLink || t.push({
|
|
578
588
|
label: "Download CSV",
|
|
579
|
-
action: () =>
|
|
589
|
+
action: () => fe(Je(), e)
|
|
580
590
|
}), t;
|
|
581
591
|
});
|
|
582
592
|
return (t, c) => (m(), i("div", {
|
|
@@ -584,15 +594,15 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
584
594
|
ref: b,
|
|
585
595
|
class: "line-chart-wrapper"
|
|
586
596
|
}, [
|
|
587
|
-
s.menu ? (m(), n(
|
|
597
|
+
s.menu ? (m(), n(le, {
|
|
588
598
|
key: 0,
|
|
589
|
-
items:
|
|
599
|
+
items: ut.value
|
|
590
600
|
}, null, 8, ["items"])) : r("", !0),
|
|
591
601
|
(m(), i("svg", {
|
|
592
602
|
ref_key: "svgRef",
|
|
593
603
|
ref: x,
|
|
594
604
|
width: E.value,
|
|
595
|
-
height:
|
|
605
|
+
height: ce.value
|
|
596
606
|
}, [
|
|
597
607
|
s.title ? (m(), i("text", {
|
|
598
608
|
key: 0,
|
|
@@ -602,48 +612,48 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
602
612
|
"font-size": "14",
|
|
603
613
|
"font-weight": "600",
|
|
604
614
|
fill: "currentColor"
|
|
605
|
-
}, v(s.title), 9,
|
|
606
|
-
|
|
615
|
+
}, v(s.title), 9, me)) : r("", !0),
|
|
616
|
+
se.value.length > 0 ? (m(), i("g", he, [(m(!0), i(e, null, g(se.value, (t, n) => (m(), i(e, { key: "ileg" + n }, [t.type === "series" ? (m(), i("line", {
|
|
607
617
|
key: 0,
|
|
608
618
|
x1: k.value.left + n * 120,
|
|
609
|
-
y1: k.value.top -
|
|
619
|
+
y1: k.value.top - K / 2,
|
|
610
620
|
x2: k.value.left + n * 120 + 12,
|
|
611
|
-
y2: k.value.top -
|
|
621
|
+
y2: k.value.top - K / 2,
|
|
612
622
|
stroke: t.color,
|
|
613
623
|
"stroke-width": "2",
|
|
614
624
|
"stroke-dasharray": t.dashed ? "4 2" : void 0
|
|
615
|
-
}, null, 8,
|
|
625
|
+
}, null, 8, V)) : (m(), i("circle", {
|
|
616
626
|
key: 1,
|
|
617
627
|
cx: k.value.left + n * 120 + 4,
|
|
618
|
-
cy: k.value.top -
|
|
628
|
+
cy: k.value.top - K / 2,
|
|
619
629
|
r: "4",
|
|
620
630
|
fill: t.color,
|
|
621
631
|
"fill-opacity": t.fillOpacity,
|
|
622
632
|
stroke: t.color,
|
|
623
633
|
"stroke-width": "1.5"
|
|
624
|
-
}, null, 8,
|
|
634
|
+
}, null, 8, H)), a("text", {
|
|
625
635
|
x: k.value.left + n * 120 + 18,
|
|
626
|
-
y: k.value.top -
|
|
636
|
+
y: k.value.top - K / 2 + 4,
|
|
627
637
|
"font-size": "11",
|
|
628
638
|
fill: "currentColor"
|
|
629
|
-
}, v(t.label), 9,
|
|
639
|
+
}, v(t.label), 9, ge)], 64))), 128))])) : r("", !0),
|
|
630
640
|
a("line", {
|
|
631
|
-
x1:
|
|
632
|
-
y1:
|
|
633
|
-
x2:
|
|
634
|
-
y2:
|
|
641
|
+
x1: R(k.value.left),
|
|
642
|
+
y1: R(k.value.top),
|
|
643
|
+
x2: R(k.value.left),
|
|
644
|
+
y2: R(k.value.top + j.value),
|
|
635
645
|
stroke: "currentColor",
|
|
636
646
|
"stroke-opacity": "0.3"
|
|
637
|
-
}, null, 8,
|
|
647
|
+
}, null, 8, _e),
|
|
638
648
|
a("line", {
|
|
639
|
-
x1:
|
|
640
|
-
y1:
|
|
641
|
-
x2:
|
|
642
|
-
y2:
|
|
649
|
+
x1: R(k.value.left),
|
|
650
|
+
y1: R(k.value.top + j.value),
|
|
651
|
+
x2: R(k.value.left + A.value),
|
|
652
|
+
y2: R(k.value.top + j.value),
|
|
643
653
|
stroke: "currentColor",
|
|
644
654
|
"stroke-opacity": "0.3"
|
|
645
|
-
}, null, 8,
|
|
646
|
-
s.yGrid ? (m(!0), i(e, { key: 2 }, g(
|
|
655
|
+
}, null, 8, ve),
|
|
656
|
+
s.yGrid ? (m(!0), i(e, { key: 2 }, g(We.value, (e, t) => (m(), i("line", {
|
|
647
657
|
key: "yg" + t,
|
|
648
658
|
x1: k.value.left,
|
|
649
659
|
y1: e.y,
|
|
@@ -651,8 +661,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
651
661
|
y2: e.y,
|
|
652
662
|
stroke: "currentColor",
|
|
653
663
|
"stroke-opacity": "0.1"
|
|
654
|
-
}, null, 8,
|
|
655
|
-
s.xGrid ? (m(!0), i(e, { key: 3 }, g(
|
|
664
|
+
}, null, 8, ye))), 128)) : r("", !0),
|
|
665
|
+
s.xGrid ? (m(!0), i(e, { key: 3 }, g(Ge.value, (e, t) => (m(), i("line", {
|
|
656
666
|
key: "xg" + t,
|
|
657
667
|
x1: e.x,
|
|
658
668
|
y1: k.value.top,
|
|
@@ -660,8 +670,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
660
670
|
y2: k.value.top + j.value,
|
|
661
671
|
stroke: "currentColor",
|
|
662
672
|
"stroke-opacity": "0.1"
|
|
663
|
-
}, null, 8,
|
|
664
|
-
(m(!0), i(e, null, g(
|
|
673
|
+
}, null, 8, be))), 128)) : r("", !0),
|
|
674
|
+
(m(!0), i(e, null, g(We.value, (e, t) => (m(), i("text", {
|
|
665
675
|
key: "y" + t,
|
|
666
676
|
x: k.value.left - 6,
|
|
667
677
|
y: e.y,
|
|
@@ -670,7 +680,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
670
680
|
"font-size": "10",
|
|
671
681
|
fill: "currentColor",
|
|
672
682
|
"fill-opacity": "0.6"
|
|
673
|
-
}, v(e.value), 9,
|
|
683
|
+
}, v(e.value), 9, xe))), 128)),
|
|
674
684
|
s.yLabel ? (m(), i("text", {
|
|
675
685
|
key: 4,
|
|
676
686
|
x: 0,
|
|
@@ -679,8 +689,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
679
689
|
"text-anchor": "middle",
|
|
680
690
|
"font-size": "13",
|
|
681
691
|
fill: "currentColor"
|
|
682
|
-
}, v(s.yLabel), 9,
|
|
683
|
-
(m(!0), i(e, null, g(
|
|
692
|
+
}, v(s.yLabel), 9, Se)) : r("", !0),
|
|
693
|
+
(m(!0), i(e, null, g(Ge.value, (e, t) => (m(), i("text", {
|
|
684
694
|
key: "x" + t,
|
|
685
695
|
x: e.x,
|
|
686
696
|
y: k.value.top + j.value + 16,
|
|
@@ -688,7 +698,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
688
698
|
"font-size": "10",
|
|
689
699
|
fill: "currentColor",
|
|
690
700
|
"fill-opacity": "0.6"
|
|
691
|
-
}, v(e.value), 9,
|
|
701
|
+
}, v(e.value), 9, U))), 128)),
|
|
692
702
|
s.xLabel ? (m(), i("text", {
|
|
693
703
|
key: 5,
|
|
694
704
|
x: k.value.left + A.value / 2,
|
|
@@ -696,23 +706,23 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
696
706
|
"text-anchor": "middle",
|
|
697
707
|
"font-size": "13",
|
|
698
708
|
fill: "currentColor"
|
|
699
|
-
}, v(s.xLabel), 9,
|
|
700
|
-
(m(!0), i(e, null, g(
|
|
709
|
+
}, v(s.xLabel), 9, W)) : r("", !0),
|
|
710
|
+
(m(!0), i(e, null, g(ne.value, (e, t) => (m(), i("path", {
|
|
701
711
|
key: "area" + t,
|
|
702
|
-
d:
|
|
712
|
+
d: ae(e.upper, e.lower),
|
|
703
713
|
fill: e.color ?? "currentColor",
|
|
704
714
|
"fill-opacity": e.opacity ?? .2,
|
|
705
715
|
stroke: "none"
|
|
706
|
-
}, null, 8,
|
|
716
|
+
}, null, 8, Ce))), 128)),
|
|
707
717
|
(m(!0), i(e, null, g(M.value, (t, n) => (m(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (m(), i("path", {
|
|
708
718
|
key: 0,
|
|
709
|
-
d:
|
|
719
|
+
d: re(t.data),
|
|
710
720
|
fill: "none",
|
|
711
721
|
stroke: t.color ?? "currentColor",
|
|
712
722
|
"stroke-width": t.strokeWidth ?? 1.5,
|
|
713
723
|
"stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
|
|
714
724
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
715
|
-
}, null, 8,
|
|
725
|
+
}, null, 8, we)), t.dots ? (m(!0), i(e, { key: 1 }, g(ie(t.data), (e, n) => (m(), i("circle", {
|
|
716
726
|
key: n,
|
|
717
727
|
cx: e.x,
|
|
718
728
|
cy: e.y,
|
|
@@ -720,68 +730,68 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
720
730
|
fill: t.dotFill ?? t.color ?? "currentColor",
|
|
721
731
|
"fill-opacity": t.dotOpacity ?? t.opacity ?? s.lineOpacity,
|
|
722
732
|
stroke: t.dotStroke ?? "none"
|
|
723
|
-
}, null, 8,
|
|
733
|
+
}, null, 8, Te))), 128)) : r("", !0)], 64))), 128)),
|
|
724
734
|
(m(!0), i(e, null, g(s.areaSections ?? [], (t, n) => (m(), i(e, { key: "areasec" + n }, [
|
|
725
735
|
a("path", {
|
|
726
|
-
d:
|
|
736
|
+
d: oe(t),
|
|
727
737
|
fill: t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor"),
|
|
728
738
|
"fill-opacity": t.opacity ?? .15,
|
|
729
739
|
stroke: "none"
|
|
730
|
-
}, null, 8,
|
|
740
|
+
}, null, 8, Ee),
|
|
731
741
|
t.seriesIndex == null ? r("", !0) : (m(), i("path", {
|
|
732
742
|
key: 0,
|
|
733
|
-
d:
|
|
743
|
+
d: oe(t, !1),
|
|
734
744
|
fill: "none",
|
|
735
745
|
stroke: t.color ?? M.value[t.seriesIndex]?.color ?? "currentColor",
|
|
736
746
|
"stroke-width": t.strokeWidth ?? 2,
|
|
737
747
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
738
|
-
}, null, 8,
|
|
748
|
+
}, null, 8, De)),
|
|
739
749
|
t.seriesIndex == null ? (m(), i(e, { key: 1 }, [a("line", {
|
|
740
|
-
x1:
|
|
750
|
+
x1: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
|
|
741
751
|
y1: k.value.top,
|
|
742
|
-
x2:
|
|
752
|
+
x2: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
|
|
743
753
|
y2: k.value.top + j.value,
|
|
744
754
|
stroke: t.color ?? "#999",
|
|
745
755
|
"stroke-width": t.strokeWidth ?? 2,
|
|
746
756
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
747
|
-
}, null, 8,
|
|
748
|
-
x1:
|
|
757
|
+
}, null, 8, Oe), a("line", {
|
|
758
|
+
x1: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
|
|
749
759
|
y1: k.value.top,
|
|
750
|
-
x2:
|
|
760
|
+
x2: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
|
|
751
761
|
y2: k.value.top + j.value,
|
|
752
762
|
stroke: t.color ?? "#999",
|
|
753
763
|
"stroke-width": t.strokeWidth ?? 2,
|
|
754
764
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
755
|
-
}, null, 8,
|
|
765
|
+
}, null, 8, G)], 64)) : r("", !0),
|
|
756
766
|
a("line", {
|
|
757
|
-
x1:
|
|
767
|
+
x1: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
|
|
758
768
|
y1: k.value.top + j.value - 4,
|
|
759
|
-
x2:
|
|
769
|
+
x2: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
|
|
760
770
|
y2: k.value.top + j.value + 4,
|
|
761
771
|
stroke: "currentColor",
|
|
762
772
|
"stroke-opacity": "0.4"
|
|
763
|
-
}, null, 8,
|
|
773
|
+
}, null, 8, ke),
|
|
764
774
|
a("line", {
|
|
765
|
-
x1:
|
|
775
|
+
x1: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
|
|
766
776
|
y1: k.value.top + j.value - 4,
|
|
767
|
-
x2:
|
|
777
|
+
x2: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
|
|
768
778
|
y2: k.value.top + j.value + 4,
|
|
769
779
|
stroke: "currentColor",
|
|
770
780
|
"stroke-opacity": "0.4"
|
|
771
|
-
}, null, 8,
|
|
781
|
+
}, null, 8, Ae)
|
|
772
782
|
], 64))), 128)),
|
|
773
|
-
|
|
783
|
+
Ze.value && Y.value !== null ? (m(), i("line", {
|
|
774
784
|
key: 6,
|
|
775
|
-
x1:
|
|
785
|
+
x1: R(Qe.value),
|
|
776
786
|
y1: k.value.top,
|
|
777
|
-
x2:
|
|
787
|
+
x2: R(Qe.value),
|
|
778
788
|
y2: k.value.top + j.value,
|
|
779
789
|
stroke: "currentColor",
|
|
780
790
|
"stroke-opacity": "0.3",
|
|
781
791
|
"stroke-dasharray": "4 2",
|
|
782
792
|
"pointer-events": "none"
|
|
783
|
-
}, null, 8,
|
|
784
|
-
(m(!0), i(e, null, g(
|
|
793
|
+
}, null, 8, je)) : r("", !0),
|
|
794
|
+
(m(!0), i(e, null, g($e.value, (e, t) => (m(), i("circle", {
|
|
785
795
|
key: "hd" + t,
|
|
786
796
|
cx: e.x,
|
|
787
797
|
cy: e.y,
|
|
@@ -790,8 +800,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
790
800
|
stroke: "var(--color-bg-0, #fff)",
|
|
791
801
|
"stroke-width": "2",
|
|
792
802
|
"pointer-events": "none"
|
|
793
|
-
}, null, 8,
|
|
794
|
-
|
|
803
|
+
}, null, 8, Me))), 128)),
|
|
804
|
+
Ze.value ? (m(), i("rect", {
|
|
795
805
|
key: 7,
|
|
796
806
|
x: k.value.left,
|
|
797
807
|
y: k.value.top,
|
|
@@ -802,66 +812,70 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
802
812
|
cursor: "crosshair",
|
|
803
813
|
"touch-action": "none"
|
|
804
814
|
},
|
|
805
|
-
onMousemove:
|
|
806
|
-
onMouseleave:
|
|
807
|
-
onClick:
|
|
808
|
-
onTouchstart:
|
|
809
|
-
onTouchmove:
|
|
810
|
-
onTouchend:
|
|
811
|
-
}, null, 40,
|
|
812
|
-
(m(!0), i(e, null, g(
|
|
815
|
+
onMousemove: nt,
|
|
816
|
+
onMouseleave: rt,
|
|
817
|
+
onClick: it,
|
|
818
|
+
onTouchstart: C(at, ["prevent"]),
|
|
819
|
+
onTouchmove: C(ot, ["prevent"]),
|
|
820
|
+
onTouchend: st
|
|
821
|
+
}, null, 40, Ne)) : r("", !0),
|
|
822
|
+
(m(!0), i(e, null, g(F.value.labels, (e, t) => (m(), i("g", { key: "seclab" + t }, [
|
|
813
823
|
a("circle", {
|
|
814
824
|
cx: e.cx - e.textWidth / 2 - 2,
|
|
815
|
-
cy:
|
|
825
|
+
cy: I.value + e.row * q + 4,
|
|
816
826
|
r: "4",
|
|
817
827
|
fill: e.color,
|
|
818
828
|
"fill-opacity": e.fillOpacity,
|
|
819
829
|
stroke: e.color,
|
|
820
830
|
"stroke-width": "1.5"
|
|
821
|
-
}, null, 8,
|
|
831
|
+
}, null, 8, Pe),
|
|
822
832
|
e.labelText ? (m(), i("text", {
|
|
823
833
|
key: 0,
|
|
824
834
|
x: e.cx - e.textWidth / 2 + 8,
|
|
825
|
-
y:
|
|
835
|
+
y: I.value + e.row * q + 8,
|
|
826
836
|
"font-size": "11",
|
|
827
837
|
"font-weight": "600",
|
|
828
838
|
fill: e.color
|
|
829
|
-
}, v(e.labelText), 9,
|
|
839
|
+
}, v(e.labelText), 9, Fe)) : r("", !0),
|
|
830
840
|
e.descText ? (m(), i("text", {
|
|
831
841
|
key: 1,
|
|
832
842
|
x: e.cx - e.textWidth / 2 + 8,
|
|
833
|
-
y:
|
|
843
|
+
y: I.value + e.row * q + 22,
|
|
834
844
|
"font-size": "11",
|
|
835
845
|
fill: "currentColor",
|
|
836
846
|
"fill-opacity": "0.6"
|
|
837
|
-
}, v(e.descText), 9,
|
|
847
|
+
}, v(e.descText), 9, Ie)) : r("", !0)
|
|
838
848
|
]))), 128))
|
|
839
|
-
], 8,
|
|
840
|
-
|
|
849
|
+
], 8, B)),
|
|
850
|
+
Ze.value && Y.value !== null && Q.value ? (m(), i("div", {
|
|
841
851
|
key: 1,
|
|
842
852
|
ref_key: "tooltipRef",
|
|
843
|
-
ref:
|
|
853
|
+
ref: Xe,
|
|
844
854
|
class: "chart-tooltip-content",
|
|
845
|
-
style: {
|
|
855
|
+
style: f({
|
|
846
856
|
position: "absolute",
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
857
|
+
top: "0",
|
|
858
|
+
left: "0",
|
|
859
|
+
willChange: "transform",
|
|
860
|
+
transform: Z.value ? `translate3d(${Z.value.left}px, ${Z.value.top}px, 0) translateY(-50%)` : "translateY(-50%)",
|
|
861
|
+
visibility: Z.value ? "visible" : "hidden"
|
|
862
|
+
})
|
|
863
|
+
}, [_(t.$slots, "tooltip", d(l(Q.value)), () => [a("div", Le, [Q.value.xLabel ? (m(), i("div", Re, v(Q.value.xLabel), 1)) : r("", !0), (m(!0), i(e, null, g(Q.value.values, (e) => (m(), i("div", {
|
|
850
864
|
key: e.seriesIndex,
|
|
851
865
|
class: "line-chart-tooltip-row"
|
|
852
866
|
}, [a("span", {
|
|
853
867
|
class: "line-chart-tooltip-swatch",
|
|
854
868
|
style: f({ background: e.color })
|
|
855
|
-
}, null, 4), o(" " + v(isFinite(e.value) ?
|
|
856
|
-
|
|
869
|
+
}, null, 4), o(" " + v(isFinite(e.value) ? J(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
|
|
870
|
+
ct.value ? (m(), i("a", {
|
|
857
871
|
key: 2,
|
|
858
872
|
class: "line-chart-download-link",
|
|
859
|
-
href:
|
|
860
|
-
download: `${
|
|
861
|
-
}, v(
|
|
873
|
+
href: lt.value,
|
|
874
|
+
download: `${Ke()}.csv`
|
|
875
|
+
}, v(ct.value), 9, ze)) : r("", !0)
|
|
862
876
|
], 512));
|
|
863
877
|
}
|
|
864
|
-
}), [["__scopeId", "data-v-
|
|
878
|
+
}), [["__scopeId", "data-v-eb7e46c4"]]), We = {
|
|
865
879
|
"01013": "010259",
|
|
866
880
|
"01015": "010177",
|
|
867
881
|
"01029": "010177",
|
|
@@ -4022,7 +4036,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
4022
4036
|
51019: "510014",
|
|
4023
4037
|
"02158": "020820",
|
|
4024
4038
|
46102: "460957"
|
|
4025
|
-
},
|
|
4039
|
+
}, Ge = {
|
|
4026
4040
|
"010259": "Butler, AL",
|
|
4027
4041
|
"010177": "Calhoun (Anniston), AL - Cleburne, AL",
|
|
4028
4042
|
"010172": "Chambers, AL - Randolph, AL",
|
|
@@ -4972,25 +4986,25 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
4972
4986
|
560775: "Teton, WY - Lincoln, WY",
|
|
4973
4987
|
560792: "Uinta, WY",
|
|
4974
4988
|
560804: "Weston, WY"
|
|
4975
|
-
},
|
|
4989
|
+
}, Ke = ["width", "height"], qe = [
|
|
4976
4990
|
"data-feat-id",
|
|
4977
4991
|
"d",
|
|
4978
4992
|
"fill",
|
|
4979
4993
|
"stroke",
|
|
4980
4994
|
"stroke-width"
|
|
4981
|
-
],
|
|
4995
|
+
], Je = { key: 0 }, Y = ["d", "stroke"], Ye = ["transform"], Xe = {
|
|
4982
4996
|
key: 0,
|
|
4983
4997
|
y: 5,
|
|
4984
4998
|
"font-size": "13",
|
|
4985
4999
|
"font-weight": "600",
|
|
4986
5000
|
fill: "currentColor"
|
|
4987
|
-
},
|
|
5001
|
+
}, X = ["x", "fill"], Z = ["x"], Ze = {
|
|
4988
5002
|
key: 0,
|
|
4989
5003
|
y: 5,
|
|
4990
5004
|
"font-size": "13",
|
|
4991
5005
|
"font-weight": "600",
|
|
4992
5006
|
fill: "currentColor"
|
|
4993
|
-
},
|
|
5007
|
+
}, Qe = ["offset", "stop-color"], $e = ["x", "fill"], Q = ["x"], et = ["x"], tt = /* @__PURE__ */ I(/* @__PURE__ */ c({
|
|
4994
5008
|
__name: "ChoroplethMap",
|
|
4995
5009
|
props: {
|
|
4996
5010
|
topology: {},
|
|
@@ -5026,80 +5040,80 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5026
5040
|
},
|
|
5027
5041
|
emits: ["stateClick", "stateHover"],
|
|
5028
5042
|
setup(o, { emit: s }) {
|
|
5029
|
-
let c = o, l = s, d = `choropleth-gradient-${x()}`, f = h(null), _ = h(null), b = h(null),
|
|
5030
|
-
function
|
|
5031
|
-
if (
|
|
5043
|
+
let c = o, l = s, d = `choropleth-gradient-${x()}`, f = h(null), _ = h(null), b = h(null), S = h(0), C = null, w = null, T = !1, E = typeof window < "u" && "ontouchstart" in window, D = null, O = null;
|
|
5044
|
+
function k() {
|
|
5045
|
+
if (E) return;
|
|
5032
5046
|
let e = b.value;
|
|
5033
|
-
e && (e.addEventListener("click",
|
|
5047
|
+
e && (e.addEventListener("click", G), e.addEventListener("mouseover", G), e.addEventListener("mousemove", ke), e.addEventListener("mouseout", Ae));
|
|
5034
5048
|
}
|
|
5035
|
-
function
|
|
5049
|
+
function A() {
|
|
5036
5050
|
let e = b.value;
|
|
5037
|
-
e && (e.removeEventListener("click",
|
|
5051
|
+
e && (e.removeEventListener("click", G), e.removeEventListener("mouseover", G), e.removeEventListener("mousemove", ke), e.removeEventListener("mouseout", Ae));
|
|
5038
5052
|
}
|
|
5039
5053
|
p(() => {
|
|
5040
|
-
f.value && (
|
|
5054
|
+
f.value && (S.value = f.value.clientWidth, D = new ResizeObserver((e) => {
|
|
5041
5055
|
let t = e[0];
|
|
5042
|
-
t && (
|
|
5043
|
-
}),
|
|
5056
|
+
t && (S.value = t.contentRect.width);
|
|
5057
|
+
}), D.observe(f.value)), j(), k();
|
|
5044
5058
|
}), ee(() => {
|
|
5045
|
-
|
|
5059
|
+
D?.disconnect(), M(), A(), Ee();
|
|
5046
5060
|
});
|
|
5047
|
-
function
|
|
5061
|
+
function j() {
|
|
5048
5062
|
if (!_.value || !b.value || !c.zoom && !c.pan) return;
|
|
5049
|
-
let e =
|
|
5050
|
-
|
|
5051
|
-
|
|
5063
|
+
let e = re(_.value);
|
|
5064
|
+
O = P().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
|
|
5065
|
+
T = !0, Oe();
|
|
5052
5066
|
}).on("zoom", (e) => {
|
|
5053
5067
|
b.value && b.value.setAttribute("transform", e.transform);
|
|
5054
5068
|
}).on("end", () => {
|
|
5055
|
-
|
|
5056
|
-
}), c.pan ||
|
|
5069
|
+
T = !1;
|
|
5070
|
+
}), c.pan || O.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(O);
|
|
5057
5071
|
}
|
|
5058
|
-
function
|
|
5059
|
-
_.value &&
|
|
5072
|
+
function M() {
|
|
5073
|
+
_.value && O && (re(_.value).on(".zoom", null), O = null);
|
|
5060
5074
|
}
|
|
5061
|
-
|
|
5062
|
-
|
|
5075
|
+
te(() => [c.zoom, c.pan], () => {
|
|
5076
|
+
M(), A(), j(), k();
|
|
5063
5077
|
});
|
|
5064
|
-
let
|
|
5078
|
+
let F = t(() => c.width ?? (S.value || 600)), se = t(() => c.width && c.height ? c.height / c.width : .625), ce = t(() => F.value * se.value), I = t(() => {
|
|
5065
5079
|
let e = y(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
|
|
5066
5080
|
for (let e of t) {
|
|
5067
|
-
let t =
|
|
5081
|
+
let t = We[String(e.id).padStart(5, "0")];
|
|
5068
5082
|
t && (n.has(t) || n.set(t, []), n.get(t).push(e));
|
|
5069
5083
|
}
|
|
5070
5084
|
let r = [];
|
|
5071
5085
|
for (let [t, i] of n) r.push({
|
|
5072
5086
|
type: "Feature",
|
|
5073
5087
|
id: t,
|
|
5074
|
-
properties: { name:
|
|
5075
|
-
geometry:
|
|
5088
|
+
properties: { name: Ge[t] ?? t },
|
|
5089
|
+
geometry: ae(e, i)
|
|
5076
5090
|
});
|
|
5077
5091
|
return {
|
|
5078
5092
|
type: "FeatureCollection",
|
|
5079
5093
|
features: r
|
|
5080
5094
|
};
|
|
5081
|
-
}),
|
|
5082
|
-
if (c.geoType === "hsas") return
|
|
5095
|
+
}), L = t(() => {
|
|
5096
|
+
if (c.geoType === "hsas") return I.value;
|
|
5083
5097
|
if (c.geoType === "counties") {
|
|
5084
5098
|
let e = y(c.topology);
|
|
5085
|
-
return
|
|
5099
|
+
return ie(e, e.objects.counties);
|
|
5086
5100
|
}
|
|
5087
5101
|
let e = y(c.topology);
|
|
5088
|
-
return
|
|
5089
|
-
}),
|
|
5102
|
+
return ie(e, e.objects.states);
|
|
5103
|
+
}), fe = t(() => {
|
|
5090
5104
|
if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
|
|
5091
5105
|
let e = y(c.topology);
|
|
5092
|
-
return
|
|
5093
|
-
}),
|
|
5106
|
+
return oe(e, e.objects.states, (e, t) => e !== t);
|
|
5107
|
+
}), R = t(() => ne().fitExtent([[0, Ie.value], [F.value, ce.value + Ie.value]], L.value)), z = t(() => N(R.value)), B = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), me = t(() => {
|
|
5094
5108
|
let e = /* @__PURE__ */ new Map();
|
|
5095
5109
|
if (!c.data) return e;
|
|
5096
5110
|
for (let t of c.data) {
|
|
5097
5111
|
e.set(t.id, t.value);
|
|
5098
|
-
let n =
|
|
5112
|
+
let n = L.value.features.find((e) => e.properties?.name === t.id);
|
|
5099
5113
|
n?.id != null && e.set(String(n.id), t.value);
|
|
5100
5114
|
}
|
|
5101
5115
|
return e;
|
|
5102
|
-
}),
|
|
5116
|
+
}), he = t(() => {
|
|
5103
5117
|
if (!c.data || c.data.length === 0) return {
|
|
5104
5118
|
min: 0,
|
|
5105
5119
|
max: 1
|
|
@@ -5116,8 +5130,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5116
5130
|
min: 0,
|
|
5117
5131
|
max: 1
|
|
5118
5132
|
};
|
|
5119
|
-
}),
|
|
5120
|
-
function
|
|
5133
|
+
}), V = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), H = t(() => Array.isArray(c.colorScale) && !V.value), ge = t(() => H.value ? "" : c.colorScale?.min ?? "#e5f0fa"), _e = t(() => H.value ? "" : c.colorScale?.max ?? "#08519c");
|
|
5134
|
+
function ve(e) {
|
|
5121
5135
|
let t = e.replace("#", "");
|
|
5122
5136
|
return [
|
|
5123
5137
|
parseInt(t.slice(0, 2), 16),
|
|
@@ -5125,103 +5139,103 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5125
5139
|
parseInt(t.slice(4, 6), 16)
|
|
5126
5140
|
];
|
|
5127
5141
|
}
|
|
5128
|
-
function
|
|
5129
|
-
let [t, n, r] =
|
|
5142
|
+
function ye(e) {
|
|
5143
|
+
let [t, n, r] = ve(ge.value), [i, a, o] = ve(_e.value);
|
|
5130
5144
|
return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
|
|
5131
5145
|
}
|
|
5132
|
-
function
|
|
5146
|
+
function be(e) {
|
|
5133
5147
|
let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
|
|
5134
5148
|
for (let n of t) if (e >= n.min) return n.color;
|
|
5135
5149
|
return c.noDataColor;
|
|
5136
5150
|
}
|
|
5137
|
-
function
|
|
5151
|
+
function xe(e) {
|
|
5138
5152
|
let t = c.colorScale.find((t) => t.value === String(e));
|
|
5139
5153
|
return t ? t.color : c.noDataColor;
|
|
5140
5154
|
}
|
|
5141
|
-
function
|
|
5142
|
-
let t =
|
|
5155
|
+
function Se(e) {
|
|
5156
|
+
let t = me.value.get(String(e));
|
|
5143
5157
|
if (t == null) return c.noDataColor;
|
|
5144
|
-
if (
|
|
5145
|
-
if (
|
|
5146
|
-
let { min: n, max: r } =
|
|
5147
|
-
return
|
|
5158
|
+
if (V.value) return xe(t);
|
|
5159
|
+
if (H.value) return be(t);
|
|
5160
|
+
let { min: n, max: r } = he.value;
|
|
5161
|
+
return ye((t - n) / (r - n));
|
|
5148
5162
|
}
|
|
5149
|
-
function
|
|
5163
|
+
function U(e) {
|
|
5150
5164
|
return e.properties?.name ?? String(e.id);
|
|
5151
5165
|
}
|
|
5152
|
-
function
|
|
5153
|
-
return
|
|
5166
|
+
function W(e) {
|
|
5167
|
+
return me.value.get(String(e.id));
|
|
5154
5168
|
}
|
|
5155
|
-
let
|
|
5169
|
+
let Ce = t(() => {
|
|
5156
5170
|
let e = /* @__PURE__ */ new Map();
|
|
5157
|
-
for (let t of
|
|
5171
|
+
for (let t of L.value.features) e.set(String(t.id), t);
|
|
5158
5172
|
return e;
|
|
5159
5173
|
});
|
|
5160
|
-
function
|
|
5174
|
+
function we(e) {
|
|
5161
5175
|
let t = e;
|
|
5162
5176
|
for (; t && !t.dataset?.featId;) t = t.parentElement;
|
|
5163
5177
|
if (!t) return null;
|
|
5164
|
-
let n =
|
|
5178
|
+
let n = Ce.value.get(t.dataset.featId);
|
|
5165
5179
|
return n ? {
|
|
5166
5180
|
pathEl: t,
|
|
5167
5181
|
feat: n
|
|
5168
5182
|
} : null;
|
|
5169
5183
|
}
|
|
5170
|
-
function
|
|
5171
|
-
|
|
5172
|
-
let r =
|
|
5184
|
+
function Te(e, t, n) {
|
|
5185
|
+
w || (w = document.createElement("div"), w.className = "chart-tooltip-content", w.style.position = "fixed", w.style.transform = "translateY(-50%)", document.body.appendChild(w));
|
|
5186
|
+
let r = U(e), i = W(e), a = {
|
|
5173
5187
|
id: String(e.id),
|
|
5174
5188
|
name: r,
|
|
5175
5189
|
value: i
|
|
5176
5190
|
};
|
|
5177
|
-
c.tooltipFormat ?
|
|
5178
|
-
let o = f.value?.getBoundingClientRect(), { left: s, top: l } =
|
|
5179
|
-
|
|
5191
|
+
c.tooltipFormat ? w.innerHTML = c.tooltipFormat(a) : w.textContent = i == null ? r : `${r}: ${i}`;
|
|
5192
|
+
let o = f.value?.getBoundingClientRect(), { left: s, top: l } = pe(t, n, w.offsetWidth, w.offsetHeight, c.tooltipClamp, o);
|
|
5193
|
+
w.style.left = `${s}px`, w.style.top = `${l}px`;
|
|
5180
5194
|
}
|
|
5181
|
-
function
|
|
5182
|
-
|
|
5195
|
+
function Ee() {
|
|
5196
|
+
w &&= (w.remove(), null);
|
|
5183
5197
|
}
|
|
5184
|
-
function
|
|
5185
|
-
|
|
5198
|
+
function De(e, t) {
|
|
5199
|
+
C && C !== e && (C.setAttribute("stroke-width", String(B.value)), C.setAttribute("stroke", c.strokeColor)), C = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(B.value + 1)), e.setAttribute("stroke", "#555");
|
|
5186
5200
|
}
|
|
5187
|
-
function
|
|
5188
|
-
|
|
5201
|
+
function Oe() {
|
|
5202
|
+
C && (C.setAttribute("stroke-width", String(B.value)), C.setAttribute("stroke", c.strokeColor), C = null, l("stateHover", null)), Ee();
|
|
5189
5203
|
}
|
|
5190
|
-
function
|
|
5191
|
-
if (
|
|
5192
|
-
let t = e, n =
|
|
5204
|
+
function G(e) {
|
|
5205
|
+
if (T) return;
|
|
5206
|
+
let t = e, n = we(t.target);
|
|
5193
5207
|
n && (e.type === "click" ? l("stateClick", {
|
|
5194
5208
|
id: String(n.feat.id),
|
|
5195
|
-
name:
|
|
5196
|
-
value:
|
|
5197
|
-
}) : e.type === "mouseover" && (
|
|
5209
|
+
name: U(n.feat),
|
|
5210
|
+
value: W(n.feat)
|
|
5211
|
+
}) : e.type === "mouseover" && (De(n.pathEl, n.feat), c.tooltipTrigger && Te(n.feat, t.clientX, t.clientY), l("stateHover", {
|
|
5198
5212
|
id: String(n.feat.id),
|
|
5199
|
-
name:
|
|
5200
|
-
value:
|
|
5213
|
+
name: U(n.feat),
|
|
5214
|
+
value: W(n.feat)
|
|
5201
5215
|
})));
|
|
5202
5216
|
}
|
|
5203
|
-
function
|
|
5204
|
-
|
|
5217
|
+
function ke(e) {
|
|
5218
|
+
T || !w || (w.style.left = `${e.clientX + 16}px`, w.style.top = `${e.clientY}px`);
|
|
5205
5219
|
}
|
|
5206
|
-
function
|
|
5220
|
+
function Ae(e) {
|
|
5207
5221
|
let t = e.relatedTarget;
|
|
5208
|
-
t && b.value?.contains(t) ||
|
|
5222
|
+
t && b.value?.contains(t) || Oe();
|
|
5209
5223
|
}
|
|
5210
|
-
function
|
|
5224
|
+
function je() {
|
|
5211
5225
|
return typeof c.menu == "string" ? c.menu : "choropleth";
|
|
5212
5226
|
}
|
|
5213
|
-
let
|
|
5227
|
+
let Me = t(() => c.legend && (V.value || H.value || c.data)), Ne = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), Pe = t(() => c.title ? 24 : 0), Fe = t(() => Me.value ? 28 : 0), Ie = t(() => Pe.value + Fe.value), Le = t(() => ce.value + Ie.value), Re = t(() => Pe.value + 18), ze = t(() => {
|
|
5214
5228
|
let e = [];
|
|
5215
5229
|
for (let t = 0; t <= 10; t++) {
|
|
5216
5230
|
let n = t / 10;
|
|
5217
5231
|
e.push({
|
|
5218
5232
|
offset: `${(n * 100).toFixed(0)}%`,
|
|
5219
|
-
color:
|
|
5233
|
+
color: ye(n)
|
|
5220
5234
|
});
|
|
5221
5235
|
}
|
|
5222
5236
|
return e;
|
|
5223
|
-
}),
|
|
5224
|
-
let { min: e, max: t } =
|
|
5237
|
+
}), K = t(() => {
|
|
5238
|
+
let { min: e, max: t } = he.value, n = t - e, r = [];
|
|
5225
5239
|
for (let t = 1; t <= 3; t++) {
|
|
5226
5240
|
let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
|
|
5227
5241
|
r.push({
|
|
@@ -5230,44 +5244,44 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5230
5244
|
});
|
|
5231
5245
|
}
|
|
5232
5246
|
return r;
|
|
5233
|
-
}),
|
|
5247
|
+
}), q = t(() => {
|
|
5234
5248
|
let e = [];
|
|
5235
|
-
if (
|
|
5249
|
+
if (V.value) for (let t of c.colorScale) e.push({
|
|
5236
5250
|
key: t.value,
|
|
5237
5251
|
color: t.color,
|
|
5238
5252
|
label: t.value
|
|
5239
5253
|
});
|
|
5240
|
-
else if (
|
|
5254
|
+
else if (H.value) for (let t of Ne.value) e.push({
|
|
5241
5255
|
key: String(t.min),
|
|
5242
5256
|
color: t.color,
|
|
5243
5257
|
label: t.label ?? String(t.min)
|
|
5244
5258
|
});
|
|
5245
5259
|
return e;
|
|
5246
|
-
}),
|
|
5260
|
+
}), Be = t(() => {
|
|
5247
5261
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5248
|
-
for (let t of
|
|
5249
|
-
return e - (
|
|
5250
|
-
}),
|
|
5262
|
+
for (let t of q.value) e += 16 + t.label.length * 7 + 12;
|
|
5263
|
+
return e - (q.value.length > 0 ? 12 : 0);
|
|
5264
|
+
}), Ve = t(() => {
|
|
5251
5265
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5252
|
-
return
|
|
5266
|
+
return q.value.map((t) => {
|
|
5253
5267
|
let n = e;
|
|
5254
5268
|
return e += 16 + t.label.length * 7 + 12, n;
|
|
5255
5269
|
});
|
|
5256
|
-
}),
|
|
5257
|
-
if (
|
|
5270
|
+
}), He = t(() => {
|
|
5271
|
+
if (V.value || H.value) return (F.value - Be.value) / 2;
|
|
5258
5272
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5259
|
-
return (
|
|
5260
|
-
}),
|
|
5261
|
-
let e =
|
|
5273
|
+
return (F.value - e - 160) / 2;
|
|
5274
|
+
}), Ue = t(() => {
|
|
5275
|
+
let e = je();
|
|
5262
5276
|
return [{
|
|
5263
5277
|
label: "Save as SVG",
|
|
5264
5278
|
action: () => {
|
|
5265
|
-
_.value &&
|
|
5279
|
+
_.value && ue(_.value, e);
|
|
5266
5280
|
}
|
|
5267
5281
|
}, {
|
|
5268
5282
|
label: "Save as PNG",
|
|
5269
5283
|
action: () => {
|
|
5270
|
-
_.value &&
|
|
5284
|
+
_.value && de(_.value, e);
|
|
5271
5285
|
}
|
|
5272
5286
|
}];
|
|
5273
5287
|
});
|
|
@@ -5275,64 +5289,64 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5275
5289
|
ref_key: "containerRef",
|
|
5276
5290
|
ref: f,
|
|
5277
5291
|
class: u(["choropleth-wrapper", { pannable: o.pan }])
|
|
5278
|
-
}, [o.menu ? (m(), n(
|
|
5292
|
+
}, [o.menu ? (m(), n(le, {
|
|
5279
5293
|
key: 0,
|
|
5280
|
-
items:
|
|
5294
|
+
items: Ue.value
|
|
5281
5295
|
}, null, 8, ["items"])) : r("", !0), (m(), i("svg", {
|
|
5282
5296
|
ref_key: "svgRef",
|
|
5283
5297
|
ref: _,
|
|
5284
|
-
width:
|
|
5285
|
-
height:
|
|
5298
|
+
width: F.value,
|
|
5299
|
+
height: Le.value
|
|
5286
5300
|
}, [
|
|
5287
5301
|
a("g", {
|
|
5288
5302
|
ref_key: "mapGroupRef",
|
|
5289
5303
|
ref: b
|
|
5290
|
-
}, [(m(!0), i(e, null, g(
|
|
5304
|
+
}, [(m(!0), i(e, null, g(L.value.features, (e) => (m(), i("path", {
|
|
5291
5305
|
key: String(e.id),
|
|
5292
5306
|
"data-feat-id": String(e.id),
|
|
5293
|
-
d:
|
|
5294
|
-
fill:
|
|
5307
|
+
d: z.value(e) ?? void 0,
|
|
5308
|
+
fill: Se(e.id),
|
|
5295
5309
|
stroke: o.strokeColor,
|
|
5296
|
-
"stroke-width":
|
|
5310
|
+
"stroke-width": B.value,
|
|
5297
5311
|
class: "state-path"
|
|
5298
|
-
}, [o.tooltipTrigger ? r("", !0) : (m(), i("title",
|
|
5312
|
+
}, [o.tooltipTrigger ? r("", !0) : (m(), i("title", Je, v(U(e)) + v(W(e) == null ? "" : `: ${W(e)}`), 1))], 8, qe))), 128)), fe.value ? (m(), i("path", {
|
|
5299
5313
|
key: 0,
|
|
5300
|
-
d:
|
|
5314
|
+
d: z.value(fe.value) ?? void 0,
|
|
5301
5315
|
fill: "none",
|
|
5302
5316
|
stroke: o.strokeColor,
|
|
5303
5317
|
"stroke-width": 1,
|
|
5304
5318
|
"stroke-linejoin": "round",
|
|
5305
5319
|
"pointer-events": "none"
|
|
5306
|
-
}, null, 8,
|
|
5307
|
-
|
|
5320
|
+
}, null, 8, Y)) : r("", !0)], 512),
|
|
5321
|
+
Me.value ? (m(), i("g", {
|
|
5308
5322
|
key: 0,
|
|
5309
5323
|
class: "choropleth-legend",
|
|
5310
|
-
transform: `translate(${
|
|
5311
|
-
}, [
|
|
5312
|
-
x:
|
|
5324
|
+
transform: `translate(${He.value},${Re.value})`
|
|
5325
|
+
}, [V.value || H.value ? (m(), i(e, { key: 0 }, [o.legendTitle ? (m(), i("text", Xe, v(o.legendTitle), 1)) : r("", !0), (m(!0), i(e, null, g(q.value, (t, n) => (m(), i(e, { key: t.key }, [a("rect", {
|
|
5326
|
+
x: Ve.value[n],
|
|
5313
5327
|
y: -5,
|
|
5314
5328
|
width: "12",
|
|
5315
5329
|
height: "12",
|
|
5316
5330
|
rx: "3",
|
|
5317
5331
|
fill: t.color
|
|
5318
|
-
}, null, 8,
|
|
5319
|
-
x:
|
|
5332
|
+
}, null, 8, X), a("text", {
|
|
5333
|
+
x: Ve.value[n] + 16,
|
|
5320
5334
|
y: 5,
|
|
5321
5335
|
"font-size": "13",
|
|
5322
5336
|
fill: "currentColor"
|
|
5323
|
-
}, v(t.label), 9,
|
|
5324
|
-
o.legendTitle ? (m(), i("text",
|
|
5337
|
+
}, v(t.label), 9, Z)], 64))), 128))], 64)) : (m(), i(e, { key: 1 }, [
|
|
5338
|
+
o.legendTitle ? (m(), i("text", Ze, v(o.legendTitle), 1)) : r("", !0),
|
|
5325
5339
|
a("defs", null, [a("linearGradient", {
|
|
5326
5340
|
id: d,
|
|
5327
5341
|
x1: "0",
|
|
5328
5342
|
x2: "1",
|
|
5329
5343
|
y1: "0",
|
|
5330
5344
|
y2: "0"
|
|
5331
|
-
}, [(m(!0), i(e, null, g(
|
|
5345
|
+
}, [(m(!0), i(e, null, g(ze.value, (e) => (m(), i("stop", {
|
|
5332
5346
|
key: e.offset,
|
|
5333
5347
|
offset: e.offset,
|
|
5334
5348
|
"stop-color": e.color
|
|
5335
|
-
}, null, 8,
|
|
5349
|
+
}, null, 8, Qe))), 128))])]),
|
|
5336
5350
|
a("rect", {
|
|
5337
5351
|
x: o.legendTitle ? o.legendTitle.length * 8 + 12 : 0,
|
|
5338
5352
|
y: -6,
|
|
@@ -5340,8 +5354,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5340
5354
|
height: 12,
|
|
5341
5355
|
rx: "2",
|
|
5342
5356
|
fill: `url(#${d})`
|
|
5343
|
-
}, null, 8,
|
|
5344
|
-
(m(!0), i(e, null, g(
|
|
5357
|
+
}, null, 8, $e),
|
|
5358
|
+
(m(!0), i(e, null, g(K.value, (e) => (m(), i("text", {
|
|
5345
5359
|
key: e.value,
|
|
5346
5360
|
x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
|
|
5347
5361
|
y: 20,
|
|
@@ -5349,20 +5363,20 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5349
5363
|
fill: "currentColor",
|
|
5350
5364
|
opacity: "0.7",
|
|
5351
5365
|
"text-anchor": "middle"
|
|
5352
|
-
}, v(e.value), 9,
|
|
5353
|
-
], 64))], 8,
|
|
5366
|
+
}, v(e.value), 9, Q))), 128))
|
|
5367
|
+
], 64))], 8, Ye)) : r("", !0),
|
|
5354
5368
|
o.title ? (m(), i("text", {
|
|
5355
5369
|
key: 1,
|
|
5356
|
-
x:
|
|
5370
|
+
x: F.value / 2,
|
|
5357
5371
|
y: 18,
|
|
5358
5372
|
"text-anchor": "middle",
|
|
5359
5373
|
"font-size": "14",
|
|
5360
5374
|
"font-weight": "600",
|
|
5361
5375
|
fill: "currentColor"
|
|
5362
|
-
}, v(o.title), 9,
|
|
5363
|
-
], 8,
|
|
5376
|
+
}, v(o.title), 9, et)) : r("", !0)
|
|
5377
|
+
], 8, Ke))], 2));
|
|
5364
5378
|
}
|
|
5365
|
-
}), [["__scopeId", "data-v-25a20d5b"]]),
|
|
5379
|
+
}), [["__scopeId", "data-v-25a20d5b"]]), $ = /* @__PURE__ */ I(/* @__PURE__ */ c({
|
|
5366
5380
|
__name: "ChartTooltip",
|
|
5367
5381
|
props: {
|
|
5368
5382
|
x: {},
|
|
@@ -5382,12 +5396,12 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5382
5396
|
top: `${e.y}px`,
|
|
5383
5397
|
transform: "translateY(-50%)"
|
|
5384
5398
|
})
|
|
5385
|
-
}, [_(t.$slots, "default", {}, void 0, !0)], 4)) : e.mode === "click" ? (m(), n(b(
|
|
5399
|
+
}, [_(t.$slots, "default", {}, void 0, !0)], 4)) : e.mode === "click" ? (m(), n(b(M), {
|
|
5386
5400
|
key: 1,
|
|
5387
5401
|
open: e.open
|
|
5388
5402
|
}, {
|
|
5389
|
-
default:
|
|
5390
|
-
default:
|
|
5403
|
+
default: S(() => [s(b(k), { "as-child": "" }, {
|
|
5404
|
+
default: S(() => [a("div", {
|
|
5391
5405
|
class: "chart-tooltip-anchor",
|
|
5392
5406
|
style: f({
|
|
5393
5407
|
left: `${e.x}px`,
|
|
@@ -5395,8 +5409,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5395
5409
|
})
|
|
5396
5410
|
}, null, 4)]),
|
|
5397
5411
|
_: 1
|
|
5398
|
-
}), s(b(
|
|
5399
|
-
default:
|
|
5412
|
+
}), s(b(j), null, {
|
|
5413
|
+
default: S(() => [e.open ? (m(), n(b(A), {
|
|
5400
5414
|
key: 0,
|
|
5401
5415
|
class: "chart-tooltip-content",
|
|
5402
5416
|
side: "right",
|
|
@@ -5405,7 +5419,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5405
5419
|
onPointerDownOutside: o[0] ||= (e) => t.$emit("close"),
|
|
5406
5420
|
onEscapeKeyDown: o[1] ||= (e) => t.$emit("close")
|
|
5407
5421
|
}, {
|
|
5408
|
-
default:
|
|
5422
|
+
default: S(() => [_(t.$slots, "default", {}, void 0, !0)]),
|
|
5409
5423
|
_: 3
|
|
5410
5424
|
}, 8, ["side-offset"])) : r("", !0)]),
|
|
5411
5425
|
_: 3
|
|
@@ -5413,7 +5427,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5413
5427
|
_: 3
|
|
5414
5428
|
}, 8, ["open"])) : r("", !0);
|
|
5415
5429
|
}
|
|
5416
|
-
}), [["__scopeId", "data-v-44377f70"]]), nt = { class: "TableWrapper" }, rt = { class: "Table" }, it = ["href", "download"], at = /* @__PURE__ */
|
|
5430
|
+
}), [["__scopeId", "data-v-44377f70"]]), nt = { class: "TableWrapper" }, rt = { class: "Table" }, it = ["href", "download"], at = /* @__PURE__ */ I(/* @__PURE__ */ c({
|
|
5417
5431
|
__name: "DataTable",
|
|
5418
5432
|
props: {
|
|
5419
5433
|
data: {},
|
|
@@ -5479,7 +5493,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5479
5493
|
function x(e) {
|
|
5480
5494
|
return e.includes(",") || e.includes("\"") || e.includes("\n") ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
5481
5495
|
}
|
|
5482
|
-
function
|
|
5496
|
+
function te() {
|
|
5483
5497
|
if (typeof c.csv == "function") return c.csv();
|
|
5484
5498
|
if (typeof c.csv == "string") return c.csv;
|
|
5485
5499
|
let e = h.value, t = _.value, n = [e.map((e) => x(l(e.name))).join(",")];
|
|
@@ -5489,14 +5503,14 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5489
5503
|
}
|
|
5490
5504
|
return n.join("\n");
|
|
5491
5505
|
}
|
|
5492
|
-
let
|
|
5506
|
+
let S = t(() => c.downloadLink ? [] : [{
|
|
5493
5507
|
label: "Download CSV",
|
|
5494
|
-
action: () =>
|
|
5495
|
-
}]),
|
|
5496
|
-
return (t, s) => (m(), i("div", { class: u(["TableOuter", { "has-menu":
|
|
5497
|
-
|
|
5508
|
+
action: () => fe(te(), b())
|
|
5509
|
+
}]), C = t(() => c.downloadLink ? typeof c.downloadLink == "string" ? c.downloadLink : "Download data (CSV)" : null), w = t(() => c.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(te())}` : null), T = t(() => c.menu && S.value.length > 0);
|
|
5510
|
+
return (t, s) => (m(), i("div", { class: u(["TableOuter", { "has-menu": T.value }]) }, [
|
|
5511
|
+
T.value ? (m(), n(le, {
|
|
5498
5512
|
key: 0,
|
|
5499
|
-
items:
|
|
5513
|
+
items: S.value
|
|
5500
5514
|
}, null, 8, ["items"])) : r("", !0),
|
|
5501
5515
|
a("div", nt, [a("table", rt, [
|
|
5502
5516
|
a("colgroup", null, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("col", {
|
|
@@ -5513,14 +5527,14 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
|
|
|
5513
5527
|
style: f(p(e.name))
|
|
5514
5528
|
}, v(y(e, t - 1)), 7))), 128))]))), 128))])
|
|
5515
5529
|
])]),
|
|
5516
|
-
|
|
5530
|
+
C.value ? (m(), i("a", {
|
|
5517
5531
|
key: 1,
|
|
5518
5532
|
class: "data-table-download-link",
|
|
5519
|
-
href:
|
|
5533
|
+
href: w.value,
|
|
5520
5534
|
download: `${b()}.csv`
|
|
5521
|
-
}, v(
|
|
5535
|
+
}, v(C.value), 9, it)) : r("", !0)
|
|
5522
5536
|
], 2));
|
|
5523
5537
|
}
|
|
5524
5538
|
}), [["__scopeId", "data-v-505e2187"]]);
|
|
5525
5539
|
//#endregion
|
|
5526
|
-
export {
|
|
5540
|
+
export { $ as ChartTooltip, tt as ChoroplethMap, at as DataTable, J as LineChart };
|