@cfasim-ui/charts 0.3.1 → 0.3.3
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/LineChart/LineChart.d.ts +25 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +522 -292
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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, 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 S, withCtx as C, withModifiers as w } from "vue";
|
|
2
2
|
import { DropdownMenuContent as T, DropdownMenuItem as E, DropdownMenuPortal as D, DropdownMenuRoot as O, DropdownMenuTrigger as k, PopoverAnchor as A, PopoverContent as j, PopoverPortal as M, PopoverRoot as N } from "reka-ui";
|
|
3
|
-
import { geoAlbersUsa as P, geoPath as
|
|
4
|
-
import { zoom as
|
|
5
|
-
import { select as
|
|
6
|
-
import { feature as
|
|
3
|
+
import { geoAlbersUsa as P, geoPath as F } from "d3-geo";
|
|
4
|
+
import { zoom as te } from "d3-zoom";
|
|
5
|
+
import { select as ne } from "d3-selection";
|
|
6
|
+
import { feature as re, merge as ie, mesh as ae } from "topojson-client";
|
|
7
7
|
//#region src/ChartMenu/ChartMenu.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var
|
|
8
|
+
var I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__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", I, [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,7 +24,7 @@ var L = { class: "chart-menu-trigger-area" }, R = ["aria-label"], z = /* @__PURE
|
|
|
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, oe)) : (m(), n(b(O), {
|
|
28
28
|
key: 1,
|
|
29
29
|
modal: !1
|
|
30
30
|
}, {
|
|
@@ -77,24 +77,24 @@ var L = { class: "chart-menu-trigger-area" }, R = ["aria-label"], z = /* @__PURE
|
|
|
77
77
|
_: 1
|
|
78
78
|
}))]));
|
|
79
79
|
}
|
|
80
|
-
}),
|
|
80
|
+
}), R = (e, t) => {
|
|
81
81
|
let n = e.__vccOpts || e;
|
|
82
82
|
for (let [e, r] of t) n[e] = r;
|
|
83
83
|
return n;
|
|
84
|
-
},
|
|
84
|
+
}, se = /* @__PURE__ */ R(L, [["__scopeId", "data-v-fe2f6904"]]);
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/ChartMenu/download.ts
|
|
87
|
-
function
|
|
87
|
+
function z(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 ce(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
|
+
z(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function le(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,75 +103,134 @@ function se(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 && z(e, `${t}.png`);
|
|
107
107
|
}), URL.revokeObjectURL(a);
|
|
108
108
|
}, o.src = a;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
110
|
+
function B(e, t) {
|
|
111
|
+
z(new Blob([e], { type: "text/csv" }), `${t}.csv`);
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/LineChart/LineChart.vue?vue&type=script&setup=true&lang.ts
|
|
115
|
-
var
|
|
115
|
+
var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
116
|
+
"x1",
|
|
117
|
+
"y1",
|
|
118
|
+
"x2",
|
|
119
|
+
"y2",
|
|
120
|
+
"stroke",
|
|
121
|
+
"stroke-dasharray"
|
|
122
|
+
], pe = [
|
|
123
|
+
"cx",
|
|
124
|
+
"cy",
|
|
125
|
+
"fill",
|
|
126
|
+
"fill-opacity",
|
|
127
|
+
"stroke"
|
|
128
|
+
], H = ["x", "y"], U = [
|
|
116
129
|
"x1",
|
|
117
130
|
"y1",
|
|
118
131
|
"x2",
|
|
119
132
|
"y2"
|
|
120
|
-
],
|
|
133
|
+
], me = [
|
|
121
134
|
"x1",
|
|
122
135
|
"y1",
|
|
123
136
|
"x2",
|
|
124
137
|
"y2"
|
|
125
|
-
],
|
|
138
|
+
], he = [
|
|
126
139
|
"x1",
|
|
127
140
|
"y1",
|
|
128
141
|
"x2",
|
|
129
142
|
"y2"
|
|
130
|
-
],
|
|
143
|
+
], ge = [
|
|
131
144
|
"x1",
|
|
132
145
|
"y1",
|
|
133
146
|
"x2",
|
|
134
147
|
"y2"
|
|
135
|
-
],
|
|
148
|
+
], _e = ["x", "y"], ve = ["transform"], ye = ["x", "y"], be = ["x", "y"], W = [
|
|
136
149
|
"d",
|
|
137
150
|
"fill",
|
|
138
151
|
"fill-opacity"
|
|
139
|
-
],
|
|
152
|
+
], G = [
|
|
140
153
|
"d",
|
|
141
154
|
"stroke",
|
|
142
155
|
"stroke-width",
|
|
143
156
|
"stroke-opacity",
|
|
144
157
|
"stroke-dasharray"
|
|
145
|
-
],
|
|
158
|
+
], xe = [
|
|
146
159
|
"cx",
|
|
147
160
|
"cy",
|
|
148
161
|
"r",
|
|
149
162
|
"fill",
|
|
150
163
|
"fill-opacity",
|
|
151
164
|
"stroke"
|
|
152
|
-
],
|
|
165
|
+
], Se = [
|
|
166
|
+
"d",
|
|
167
|
+
"fill",
|
|
168
|
+
"fill-opacity"
|
|
169
|
+
], Ce = [
|
|
170
|
+
"d",
|
|
171
|
+
"stroke",
|
|
172
|
+
"stroke-width",
|
|
173
|
+
"stroke-dasharray"
|
|
174
|
+
], we = [
|
|
175
|
+
"x1",
|
|
176
|
+
"y1",
|
|
177
|
+
"x2",
|
|
178
|
+
"y2",
|
|
179
|
+
"stroke",
|
|
180
|
+
"stroke-width",
|
|
181
|
+
"stroke-dasharray"
|
|
182
|
+
], Te = [
|
|
183
|
+
"x1",
|
|
184
|
+
"y1",
|
|
185
|
+
"x2",
|
|
186
|
+
"y2",
|
|
187
|
+
"stroke",
|
|
188
|
+
"stroke-width",
|
|
189
|
+
"stroke-dasharray"
|
|
190
|
+
], Ee = [
|
|
153
191
|
"x1",
|
|
154
192
|
"y1",
|
|
155
193
|
"x2",
|
|
156
194
|
"y2"
|
|
157
195
|
], K = [
|
|
196
|
+
"x1",
|
|
197
|
+
"y1",
|
|
198
|
+
"x2",
|
|
199
|
+
"y2"
|
|
200
|
+
], De = [
|
|
201
|
+
"x1",
|
|
202
|
+
"y1",
|
|
203
|
+
"x2",
|
|
204
|
+
"y2"
|
|
205
|
+
], Oe = [
|
|
158
206
|
"cx",
|
|
159
207
|
"cy",
|
|
160
208
|
"fill"
|
|
161
|
-
],
|
|
209
|
+
], ke = [
|
|
162
210
|
"x",
|
|
163
211
|
"y",
|
|
164
212
|
"width",
|
|
165
213
|
"height"
|
|
166
|
-
],
|
|
214
|
+
], Ae = [
|
|
215
|
+
"cx",
|
|
216
|
+
"cy",
|
|
217
|
+
"fill",
|
|
218
|
+
"fill-opacity",
|
|
219
|
+
"stroke"
|
|
220
|
+
], je = [
|
|
221
|
+
"x",
|
|
222
|
+
"y",
|
|
223
|
+
"fill"
|
|
224
|
+
], Me = ["x", "y"], Ne = { class: "line-chart-tooltip" }, q = {
|
|
167
225
|
key: 0,
|
|
168
226
|
class: "line-chart-tooltip-label"
|
|
169
|
-
},
|
|
227
|
+
}, Pe = ["href", "download"], J = 20, Y = 36, Fe = 12, X = 7, Ie = 16, Le = 50, Re = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
170
228
|
__name: "LineChart",
|
|
171
229
|
props: {
|
|
172
230
|
data: {},
|
|
173
231
|
series: {},
|
|
174
232
|
areas: {},
|
|
233
|
+
areaSections: {},
|
|
175
234
|
width: {},
|
|
176
235
|
height: {},
|
|
177
236
|
lineOpacity: { default: 1 },
|
|
@@ -207,20 +266,20 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
207
266
|
}), ee(() => {
|
|
208
267
|
C?.disconnect(), T && clearTimeout(T);
|
|
209
268
|
});
|
|
210
|
-
let E = t(() => u.width ?? (S.value || 400)), D = t(() => u.height ?? 200), O = t(() => ({
|
|
211
|
-
top: u.title ? 30 : 10,
|
|
269
|
+
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(() => ({
|
|
270
|
+
top: (u.title ? 30 : 10) + (O.value ? J : 0),
|
|
212
271
|
right: 10,
|
|
213
272
|
bottom: u.xLabel ? 46 : 30,
|
|
214
273
|
left: u.yLabel ? 66 : 50
|
|
215
|
-
})),
|
|
274
|
+
})), 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 }] : []), N = t(() => u.areas ?? []), P = t(() => {
|
|
216
275
|
let e = 0;
|
|
217
|
-
for (let t of
|
|
218
|
-
for (let t of
|
|
276
|
+
for (let t of M.value) t.data.length > e && (e = t.data.length);
|
|
277
|
+
for (let t of N.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
|
|
219
278
|
return e;
|
|
220
|
-
}),
|
|
279
|
+
}), F = t(() => {
|
|
221
280
|
let e = Infinity, t = -Infinity;
|
|
222
|
-
for (let n of
|
|
223
|
-
for (let n of
|
|
281
|
+
for (let n of M.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
282
|
+
for (let n of N.value) {
|
|
224
283
|
for (let r of n.upper) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
225
284
|
for (let r of n.lower) isFinite(r) && (r < e && (e = r), r > t && (t = r));
|
|
226
285
|
}
|
|
@@ -236,21 +295,21 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
236
295
|
});
|
|
237
296
|
function te(e) {
|
|
238
297
|
if (e.length === 0) return "";
|
|
239
|
-
let { min: t, range: n } =
|
|
298
|
+
let { min: t, range: n } = F.value, r = P.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = "", c = !1;
|
|
240
299
|
for (let n = 0; n < e.length; n++) {
|
|
241
300
|
if (!isFinite(e[n])) {
|
|
242
301
|
c = !1;
|
|
243
302
|
continue;
|
|
244
303
|
}
|
|
245
|
-
let r =
|
|
304
|
+
let r = k.value.left + n * i, l = o - (e[n] - t) * a;
|
|
246
305
|
s += c ? `L${r},${l}` : `M${r},${l}`, c = !0;
|
|
247
306
|
}
|
|
248
307
|
return s;
|
|
249
308
|
}
|
|
250
309
|
function ne(e) {
|
|
251
|
-
let { min: t, range: n } =
|
|
310
|
+
let { min: t, range: n } = F.value, r = P.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = [];
|
|
252
311
|
for (let n = 0; n < e.length; n++) isFinite(e[n]) && s.push({
|
|
253
|
-
x:
|
|
312
|
+
x: k.value.left + n * i,
|
|
254
313
|
y: o - (e[n] - t) * a
|
|
255
314
|
});
|
|
256
315
|
return s;
|
|
@@ -258,7 +317,7 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
258
317
|
function re(e, t) {
|
|
259
318
|
let n = Math.min(e.length, t.length);
|
|
260
319
|
if (n === 0) return "";
|
|
261
|
-
let { min: r, range: i } =
|
|
320
|
+
let { min: r, range: i } = F.value, a = P.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 = [];
|
|
262
321
|
for (let r = 0; r < n; r++) isFinite(e[r]) && isFinite(t[r]) ? f.push(r) : f.length && (d.push(f), f = []);
|
|
263
322
|
f.length && d.push(f);
|
|
264
323
|
let p = "";
|
|
@@ -270,63 +329,134 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
270
329
|
}
|
|
271
330
|
return p;
|
|
272
331
|
}
|
|
273
|
-
function
|
|
332
|
+
function ie(e, t = !0) {
|
|
333
|
+
let n = P.value, r = A.value / (n - 1 || 1), i = k.value.top + j.value, a = (e) => k.value.left + e * r;
|
|
334
|
+
if (e.seriesIndex == null) {
|
|
335
|
+
let t = Math.max(0, e.startIndex), r = Math.min(n - 1, e.endIndex);
|
|
336
|
+
return t > r ? "" : `M${a(t)},${k.value.top}L${a(r)},${k.value.top}L${a(r)},${i}L${a(t)},${i}Z`;
|
|
337
|
+
}
|
|
338
|
+
let o = M.value[e.seriesIndex];
|
|
339
|
+
if (!o) return "";
|
|
340
|
+
let { min: s, range: c } = F.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);
|
|
341
|
+
if (d > f) return "";
|
|
342
|
+
let p = `M${a(d)},${u(o.data[d])}`;
|
|
343
|
+
for (let e = d + 1; e <= f; e++) isFinite(o.data[e]) && (p += `L${a(e)},${u(o.data[e])}`);
|
|
344
|
+
return t && (p += `L${a(f)},${i}`, p += `L${a(d)},${i}`, p += "Z"), p;
|
|
345
|
+
}
|
|
346
|
+
let ae = t(() => {
|
|
347
|
+
let e = u.areaSections;
|
|
348
|
+
if (!e?.length) return {
|
|
349
|
+
labels: [],
|
|
350
|
+
extraHeight: 0
|
|
351
|
+
};
|
|
352
|
+
let t = P.value, n = A.value / (t - 1 || 1), r = [];
|
|
353
|
+
for (let t of e) {
|
|
354
|
+
if (!t.label && !t.description || t.legend === "inline" || t.legend === !1) continue;
|
|
355
|
+
let e = k.value.left + (t.startIndex + t.endIndex) / 2 * n, i = t.label ?? "", a = t.description ?? "", o = Math.max(i.length, a.length) * X, s = t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor");
|
|
356
|
+
r.push({
|
|
357
|
+
cx: e,
|
|
358
|
+
labelText: i,
|
|
359
|
+
descText: a,
|
|
360
|
+
textWidth: o,
|
|
361
|
+
row: 0,
|
|
362
|
+
color: s,
|
|
363
|
+
fillOpacity: t.opacity ?? .15
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
r.sort((e, t) => e.cx - t.cx);
|
|
367
|
+
let i = [];
|
|
368
|
+
for (let e of r) {
|
|
369
|
+
let t = e.cx - e.textWidth / 2, n = 0;
|
|
370
|
+
for (; n < i.length && !(t >= i[n] + Ie);) n++;
|
|
371
|
+
e.row = n;
|
|
372
|
+
let r = e.cx + e.textWidth / 2;
|
|
373
|
+
i[n] = Math.max(i[n] ?? -Infinity, r);
|
|
374
|
+
}
|
|
375
|
+
return r.length === 0 ? {
|
|
376
|
+
labels: [],
|
|
377
|
+
extraHeight: 0
|
|
378
|
+
} : {
|
|
379
|
+
labels: r,
|
|
380
|
+
extraHeight: (Math.max(...r.map((e) => e.row)) + 1) * Y + Fe
|
|
381
|
+
};
|
|
382
|
+
}), I = t(() => {
|
|
383
|
+
let e = [];
|
|
384
|
+
for (let t of M.value) t.legend && e.push({
|
|
385
|
+
label: t.legend,
|
|
386
|
+
color: t.color ?? "currentColor",
|
|
387
|
+
type: "series",
|
|
388
|
+
dashed: t.dashed
|
|
389
|
+
});
|
|
390
|
+
let t = u.areaSections;
|
|
391
|
+
if (t) for (let n of t) {
|
|
392
|
+
if (n.legend !== "inline" || !n.label && !n.description) continue;
|
|
393
|
+
let t = [n.label, n.description].filter(Boolean).join(" "), r = n.color ?? (n.seriesIndex == null ? "#999" : M.value[n.seriesIndex]?.color ?? "currentColor");
|
|
394
|
+
e.push({
|
|
395
|
+
label: t,
|
|
396
|
+
color: r,
|
|
397
|
+
type: "section",
|
|
398
|
+
fillOpacity: n.opacity ?? .15
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return e;
|
|
402
|
+
}), oe = t(() => D.value + ae.value.extraHeight), L = t(() => k.value.top + j.value + k.value.bottom + Fe);
|
|
403
|
+
function R(e, t) {
|
|
274
404
|
let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r, a;
|
|
275
405
|
return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
|
|
276
406
|
}
|
|
277
|
-
function
|
|
407
|
+
function z(e) {
|
|
278
408
|
return Math.round(e) + .5;
|
|
279
409
|
}
|
|
280
|
-
let
|
|
281
|
-
function
|
|
282
|
-
return Math.abs(e) >= 1e3 ?
|
|
410
|
+
let Re = new Intl.NumberFormat();
|
|
411
|
+
function Z(e) {
|
|
412
|
+
return Math.abs(e) >= 1e3 ? Re.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
|
|
283
413
|
}
|
|
284
|
-
let
|
|
285
|
-
let { min: e, max: t } =
|
|
414
|
+
let ze = t(() => {
|
|
415
|
+
let { min: e, max: t } = F.value;
|
|
286
416
|
if (e === t) return [{
|
|
287
|
-
value:
|
|
288
|
-
y:
|
|
417
|
+
value: Z(e),
|
|
418
|
+
y: z(k.value.top + j.value / 2)
|
|
289
419
|
}];
|
|
290
|
-
let n = Math.max(3, Math.floor(
|
|
420
|
+
let n = Math.max(3, Math.floor(j.value / 50)), r = R(t - e, n), i = Math.ceil(e / r) * r, a = [];
|
|
291
421
|
for (let n = i; n <= t; n += r) a.push({
|
|
292
|
-
value:
|
|
293
|
-
y:
|
|
422
|
+
value: Z(n),
|
|
423
|
+
y: z(k.value.top + j.value - (n - e) / F.value.range * j.value)
|
|
294
424
|
});
|
|
295
425
|
return a;
|
|
296
|
-
}),
|
|
297
|
-
let e =
|
|
426
|
+
}), Be = t(() => {
|
|
427
|
+
let e = P.value;
|
|
298
428
|
if (e <= 1) return [];
|
|
299
429
|
let t = u.xLabels;
|
|
300
430
|
if (t && t.length === e) {
|
|
301
|
-
let n = Math.max(3, Math.floor(
|
|
431
|
+
let n = Math.max(3, Math.floor(A.value / 80)), r = Math.max(1, Math.round((e - 1) / n)), i = [];
|
|
302
432
|
for (let n = 0; n < e; n += r) i.push({
|
|
303
433
|
value: t[n],
|
|
304
|
-
x:
|
|
434
|
+
x: z(k.value.left + n / (e - 1) * A.value)
|
|
305
435
|
});
|
|
306
436
|
return i;
|
|
307
437
|
}
|
|
308
|
-
let n = u.xMin ?? 0, r = Math.max(3, Math.floor(
|
|
438
|
+
let n = u.xMin ?? 0, r = Math.max(3, Math.floor(A.value / 80)), i = R(e - 1, r), a = [];
|
|
309
439
|
for (let t = 0; t <= e - 1; t += i) {
|
|
310
440
|
let r = Math.round(t);
|
|
311
441
|
a.push({
|
|
312
|
-
value:
|
|
313
|
-
x:
|
|
442
|
+
value: Z(r + n),
|
|
443
|
+
x: z(k.value.left + r / (e - 1) * A.value)
|
|
314
444
|
});
|
|
315
445
|
}
|
|
316
446
|
return a;
|
|
317
447
|
});
|
|
318
|
-
function
|
|
448
|
+
function Ve() {
|
|
319
449
|
return u.filename ? u.filename : typeof u.menu == "string" ? u.menu : "chart";
|
|
320
450
|
}
|
|
321
|
-
function
|
|
451
|
+
function He() {
|
|
322
452
|
return x.value;
|
|
323
453
|
}
|
|
324
|
-
function
|
|
454
|
+
function Ue() {
|
|
325
455
|
if (typeof u.csv == "function") return u.csv();
|
|
326
456
|
if (typeof u.csv == "string") return u.csv;
|
|
327
|
-
let e =
|
|
457
|
+
let e = M.value;
|
|
328
458
|
if (e.length === 0) return "";
|
|
329
|
-
let t =
|
|
459
|
+
let t = P.value, n = [(e.length === 1 ? ["index", "value"] : ["index", ...e.map((e, t) => `series_${t}`)]).join(",")];
|
|
330
460
|
for (let r = 0; r < t; r++) {
|
|
331
461
|
let t = [r.toString()];
|
|
332
462
|
for (let n of e) t.push(r < n.data.length ? String(n.data[r]) : "");
|
|
@@ -334,25 +464,25 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
334
464
|
}
|
|
335
465
|
return n.join("\n");
|
|
336
466
|
}
|
|
337
|
-
let
|
|
338
|
-
if (
|
|
339
|
-
let e =
|
|
340
|
-
return
|
|
341
|
-
}),
|
|
342
|
-
let e =
|
|
467
|
+
let Q = h(null), We = h(!1), Ge = h(null), Ke = t(() => !!u.tooltipData || !!u.tooltipTrigger), qe = t(() => {
|
|
468
|
+
if (Q.value === null) return 0;
|
|
469
|
+
let e = P.value, t = A.value / (e - 1 || 1);
|
|
470
|
+
return k.value.left + Q.value * t;
|
|
471
|
+
}), Je = t(() => {
|
|
472
|
+
let e = Q.value;
|
|
343
473
|
if (e === null) return [];
|
|
344
|
-
let { min: t, range: n } =
|
|
345
|
-
return
|
|
346
|
-
x:
|
|
474
|
+
let { min: t, range: n } = F.value, r = j.value / n, i = k.value.top + j.value;
|
|
475
|
+
return M.value.filter((t) => e < t.data.length && isFinite(t.data[e])).map((n) => ({
|
|
476
|
+
x: qe.value,
|
|
347
477
|
y: i - (n.data[e] - t) * r,
|
|
348
478
|
color: n.color ?? "currentColor"
|
|
349
479
|
}));
|
|
350
|
-
}),
|
|
351
|
-
let e =
|
|
480
|
+
}), $ = t(() => {
|
|
481
|
+
let e = Q.value;
|
|
352
482
|
return e === null ? null : {
|
|
353
483
|
index: e,
|
|
354
484
|
xLabel: u.xLabels?.[e],
|
|
355
|
-
values:
|
|
485
|
+
values: M.value.map((t, n) => ({
|
|
356
486
|
value: t.data[e],
|
|
357
487
|
color: t.color ?? "currentColor",
|
|
358
488
|
seriesIndex: n
|
|
@@ -360,68 +490,68 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
360
490
|
data: u.tooltipData?.[e] ?? null
|
|
361
491
|
};
|
|
362
492
|
});
|
|
363
|
-
function
|
|
493
|
+
function Ye(e) {
|
|
364
494
|
return "touches" in e ? e.touches[0] ?? null : e;
|
|
365
495
|
}
|
|
366
|
-
function
|
|
496
|
+
function Xe(e) {
|
|
367
497
|
let t = b.value?.getBoundingClientRect();
|
|
368
498
|
if (!t) return null;
|
|
369
|
-
let n =
|
|
499
|
+
let n = P.value;
|
|
370
500
|
if (n <= 1) return null;
|
|
371
|
-
let r = e - t.left, i =
|
|
501
|
+
let r = e - t.left, i = A.value / (n - 1 || 1), a = (r - k.value.left) / i;
|
|
372
502
|
return Math.round(Math.max(0, Math.min(n - 1, a)));
|
|
373
503
|
}
|
|
374
|
-
function
|
|
375
|
-
let n =
|
|
504
|
+
function Ze(e, t) {
|
|
505
|
+
let n = Ge.value;
|
|
376
506
|
if (!n) return;
|
|
377
|
-
let r = b.value.getBoundingClientRect(), i =
|
|
507
|
+
let r = b.value.getBoundingClientRect(), i = We.value ? Le : 0, a = e - r.left, o = Math.max(0, t - r.top - i);
|
|
378
508
|
n.style.left = `${a + 16}px`, n.style.top = `${o}px`;
|
|
379
509
|
}
|
|
380
|
-
function
|
|
381
|
-
let t =
|
|
510
|
+
function Qe(e) {
|
|
511
|
+
let t = Ye(e);
|
|
382
512
|
if (!t) return;
|
|
383
|
-
let n =
|
|
384
|
-
n !== null && (
|
|
513
|
+
let n = Xe(t.clientX);
|
|
514
|
+
n !== null && (Q.value = n, Ze(t.clientX, t.clientY), y("hover", { index: n }));
|
|
385
515
|
}
|
|
386
|
-
function
|
|
387
|
-
|
|
516
|
+
function $e(e) {
|
|
517
|
+
Qe(e);
|
|
388
518
|
}
|
|
389
|
-
function
|
|
390
|
-
u.tooltipTrigger !== "click" && (
|
|
519
|
+
function et() {
|
|
520
|
+
u.tooltipTrigger !== "click" && (Q.value = null, y("hover", null));
|
|
391
521
|
}
|
|
392
|
-
function
|
|
522
|
+
function tt(e) {
|
|
393
523
|
if (u.tooltipTrigger !== "click") return;
|
|
394
|
-
let t =
|
|
524
|
+
let t = Ye(e);
|
|
395
525
|
if (!t) return;
|
|
396
|
-
let n =
|
|
397
|
-
n !== null && (
|
|
526
|
+
let n = Xe(t.clientX);
|
|
527
|
+
n !== null && (Q.value = Q.value === n ? null : n, y("hover", Q.value === null ? null : { index: n }));
|
|
398
528
|
}
|
|
399
|
-
function
|
|
400
|
-
|
|
529
|
+
function nt(e) {
|
|
530
|
+
We.value = !0, Qe(e);
|
|
401
531
|
}
|
|
402
|
-
function
|
|
403
|
-
|
|
532
|
+
function rt(e) {
|
|
533
|
+
Qe(e);
|
|
404
534
|
}
|
|
405
|
-
function
|
|
406
|
-
|
|
535
|
+
function it() {
|
|
536
|
+
We.value = !1, Q.value = null, y("hover", null);
|
|
407
537
|
}
|
|
408
|
-
let
|
|
409
|
-
let e =
|
|
538
|
+
let at = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), ot = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(Ue())}` : null), st = t(() => {
|
|
539
|
+
let e = Ve(), t = [{
|
|
410
540
|
label: "Save as SVG",
|
|
411
541
|
action: () => {
|
|
412
|
-
let t =
|
|
413
|
-
t &&
|
|
542
|
+
let t = He();
|
|
543
|
+
t && ce(t, e);
|
|
414
544
|
}
|
|
415
545
|
}, {
|
|
416
546
|
label: "Save as PNG",
|
|
417
547
|
action: () => {
|
|
418
|
-
let t =
|
|
419
|
-
t &&
|
|
548
|
+
let t = He();
|
|
549
|
+
t && le(t, e);
|
|
420
550
|
}
|
|
421
551
|
}];
|
|
422
552
|
return u.downloadLink || t.push({
|
|
423
553
|
label: "Download CSV",
|
|
424
|
-
action: () =>
|
|
554
|
+
action: () => B(Ue(), e)
|
|
425
555
|
}), t;
|
|
426
556
|
});
|
|
427
557
|
return (t, c) => (m(), i("div", {
|
|
@@ -429,15 +559,15 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
429
559
|
ref: b,
|
|
430
560
|
class: "line-chart-wrapper"
|
|
431
561
|
}, [
|
|
432
|
-
s.menu ? (m(), n(
|
|
562
|
+
s.menu ? (m(), n(se, {
|
|
433
563
|
key: 0,
|
|
434
|
-
items:
|
|
564
|
+
items: st.value
|
|
435
565
|
}, null, 8, ["items"])) : r("", !0),
|
|
436
566
|
(m(), i("svg", {
|
|
437
567
|
ref_key: "svgRef",
|
|
438
568
|
ref: x,
|
|
439
569
|
width: E.value,
|
|
440
|
-
height:
|
|
570
|
+
height: oe.value
|
|
441
571
|
}, [
|
|
442
572
|
s.title ? (m(), i("text", {
|
|
443
573
|
key: 0,
|
|
@@ -447,85 +577,109 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
447
577
|
"font-size": "14",
|
|
448
578
|
"font-weight": "600",
|
|
449
579
|
fill: "currentColor"
|
|
450
|
-
}, v(s.title), 9,
|
|
580
|
+
}, v(s.title), 9, de)) : r("", !0),
|
|
581
|
+
I.value.length > 0 ? (m(), i("g", V, [(m(!0), i(e, null, g(I.value, (t, n) => (m(), i(e, { key: "ileg" + n }, [t.type === "series" ? (m(), i("line", {
|
|
582
|
+
key: 0,
|
|
583
|
+
x1: k.value.left + n * 120,
|
|
584
|
+
y1: k.value.top - J / 2,
|
|
585
|
+
x2: k.value.left + n * 120 + 12,
|
|
586
|
+
y2: k.value.top - J / 2,
|
|
587
|
+
stroke: t.color,
|
|
588
|
+
"stroke-width": "2",
|
|
589
|
+
"stroke-dasharray": t.dashed ? "4 2" : void 0
|
|
590
|
+
}, null, 8, fe)) : (m(), i("circle", {
|
|
591
|
+
key: 1,
|
|
592
|
+
cx: k.value.left + n * 120 + 4,
|
|
593
|
+
cy: k.value.top - J / 2,
|
|
594
|
+
r: "4",
|
|
595
|
+
fill: t.color,
|
|
596
|
+
"fill-opacity": t.fillOpacity,
|
|
597
|
+
stroke: t.color,
|
|
598
|
+
"stroke-width": "1.5"
|
|
599
|
+
}, null, 8, pe)), a("text", {
|
|
600
|
+
x: k.value.left + n * 120 + 18,
|
|
601
|
+
y: k.value.top - J / 2 + 4,
|
|
602
|
+
"font-size": "11",
|
|
603
|
+
fill: "currentColor"
|
|
604
|
+
}, v(t.label), 9, H)], 64))), 128))])) : r("", !0),
|
|
451
605
|
a("line", {
|
|
452
|
-
x1:
|
|
453
|
-
y1:
|
|
454
|
-
x2:
|
|
455
|
-
y2:
|
|
606
|
+
x1: z(k.value.left),
|
|
607
|
+
y1: z(k.value.top),
|
|
608
|
+
x2: z(k.value.left),
|
|
609
|
+
y2: z(k.value.top + j.value),
|
|
456
610
|
stroke: "currentColor",
|
|
457
611
|
"stroke-opacity": "0.3"
|
|
458
612
|
}, null, 8, U),
|
|
459
613
|
a("line", {
|
|
460
|
-
x1:
|
|
461
|
-
y1:
|
|
462
|
-
x2:
|
|
463
|
-
y2:
|
|
614
|
+
x1: z(k.value.left),
|
|
615
|
+
y1: z(k.value.top + j.value),
|
|
616
|
+
x2: z(k.value.left + A.value),
|
|
617
|
+
y2: z(k.value.top + j.value),
|
|
464
618
|
stroke: "currentColor",
|
|
465
619
|
"stroke-opacity": "0.3"
|
|
466
|
-
}, null, 8,
|
|
467
|
-
s.yGrid ? (m(!0), i(e, { key:
|
|
620
|
+
}, null, 8, me),
|
|
621
|
+
s.yGrid ? (m(!0), i(e, { key: 2 }, g(ze.value, (e, t) => (m(), i("line", {
|
|
468
622
|
key: "yg" + t,
|
|
469
|
-
x1:
|
|
623
|
+
x1: k.value.left,
|
|
470
624
|
y1: e.y,
|
|
471
|
-
x2:
|
|
625
|
+
x2: k.value.left + A.value,
|
|
472
626
|
y2: e.y,
|
|
473
627
|
stroke: "currentColor",
|
|
474
628
|
"stroke-opacity": "0.1"
|
|
475
|
-
}, null, 8,
|
|
476
|
-
s.xGrid ? (m(!0), i(e, { key:
|
|
629
|
+
}, null, 8, he))), 128)) : r("", !0),
|
|
630
|
+
s.xGrid ? (m(!0), i(e, { key: 3 }, g(Be.value, (e, t) => (m(), i("line", {
|
|
477
631
|
key: "xg" + t,
|
|
478
632
|
x1: e.x,
|
|
479
|
-
y1:
|
|
633
|
+
y1: k.value.top,
|
|
480
634
|
x2: e.x,
|
|
481
|
-
y2:
|
|
635
|
+
y2: k.value.top + j.value,
|
|
482
636
|
stroke: "currentColor",
|
|
483
637
|
"stroke-opacity": "0.1"
|
|
484
|
-
}, null, 8,
|
|
485
|
-
(m(!0), i(e, null, g(
|
|
638
|
+
}, null, 8, ge))), 128)) : r("", !0),
|
|
639
|
+
(m(!0), i(e, null, g(ze.value, (e, t) => (m(), i("text", {
|
|
486
640
|
key: "y" + t,
|
|
487
|
-
x:
|
|
641
|
+
x: k.value.left - 6,
|
|
488
642
|
y: e.y,
|
|
489
643
|
"text-anchor": "end",
|
|
490
644
|
"dominant-baseline": "middle",
|
|
491
645
|
"font-size": "10",
|
|
492
646
|
fill: "currentColor",
|
|
493
647
|
"fill-opacity": "0.6"
|
|
494
|
-
}, v(e.value), 9,
|
|
648
|
+
}, v(e.value), 9, _e))), 128)),
|
|
495
649
|
s.yLabel ? (m(), i("text", {
|
|
496
|
-
key:
|
|
650
|
+
key: 4,
|
|
497
651
|
x: 0,
|
|
498
652
|
y: 0,
|
|
499
|
-
transform: `translate(14, ${
|
|
653
|
+
transform: `translate(14, ${k.value.top + j.value / 2}) rotate(-90)`,
|
|
500
654
|
"text-anchor": "middle",
|
|
501
655
|
"font-size": "13",
|
|
502
656
|
fill: "currentColor"
|
|
503
|
-
}, v(s.yLabel), 9,
|
|
504
|
-
(m(!0), i(e, null, g(
|
|
657
|
+
}, v(s.yLabel), 9, ve)) : r("", !0),
|
|
658
|
+
(m(!0), i(e, null, g(Be.value, (e, t) => (m(), i("text", {
|
|
505
659
|
key: "x" + t,
|
|
506
660
|
x: e.x,
|
|
507
|
-
y:
|
|
661
|
+
y: k.value.top + j.value + 16,
|
|
508
662
|
"text-anchor": "middle",
|
|
509
663
|
"font-size": "10",
|
|
510
664
|
fill: "currentColor",
|
|
511
665
|
"fill-opacity": "0.6"
|
|
512
|
-
}, v(e.value), 9,
|
|
666
|
+
}, v(e.value), 9, ye))), 128)),
|
|
513
667
|
s.xLabel ? (m(), i("text", {
|
|
514
|
-
key:
|
|
515
|
-
x:
|
|
668
|
+
key: 5,
|
|
669
|
+
x: k.value.left + A.value / 2,
|
|
516
670
|
y: D.value - 4,
|
|
517
671
|
"text-anchor": "middle",
|
|
518
672
|
"font-size": "13",
|
|
519
673
|
fill: "currentColor"
|
|
520
|
-
}, v(s.xLabel), 9,
|
|
521
|
-
(m(!0), i(e, null, g(
|
|
674
|
+
}, v(s.xLabel), 9, be)) : r("", !0),
|
|
675
|
+
(m(!0), i(e, null, g(N.value, (e, t) => (m(), i("path", {
|
|
522
676
|
key: "area" + t,
|
|
523
677
|
d: re(e.upper, e.lower),
|
|
524
678
|
fill: e.color ?? "currentColor",
|
|
525
679
|
"fill-opacity": e.opacity ?? .2,
|
|
526
680
|
stroke: "none"
|
|
527
|
-
}, null, 8,
|
|
528
|
-
(m(!0), i(e, null, g(
|
|
681
|
+
}, null, 8, W))), 128)),
|
|
682
|
+
(m(!0), i(e, null, g(M.value, (t, n) => (m(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (m(), i("path", {
|
|
529
683
|
key: 0,
|
|
530
684
|
d: te(t.data),
|
|
531
685
|
fill: "none",
|
|
@@ -533,7 +687,7 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
533
687
|
"stroke-width": t.strokeWidth ?? 1.5,
|
|
534
688
|
"stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
|
|
535
689
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
536
|
-
}, null, 8,
|
|
690
|
+
}, null, 8, G)), t.dots ? (m(!0), i(e, { key: 1 }, g(ne(t.data), (e, n) => (m(), i("circle", {
|
|
537
691
|
key: n,
|
|
538
692
|
cx: e.x,
|
|
539
693
|
cy: e.y,
|
|
@@ -541,19 +695,68 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
541
695
|
fill: t.dotFill ?? t.color ?? "currentColor",
|
|
542
696
|
"fill-opacity": t.dotOpacity ?? t.opacity ?? s.lineOpacity,
|
|
543
697
|
stroke: t.dotStroke ?? "none"
|
|
544
|
-
}, null, 8,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
698
|
+
}, null, 8, xe))), 128)) : r("", !0)], 64))), 128)),
|
|
699
|
+
(m(!0), i(e, null, g(s.areaSections ?? [], (t, n) => (m(), i(e, { key: "areasec" + n }, [
|
|
700
|
+
a("path", {
|
|
701
|
+
d: ie(t),
|
|
702
|
+
fill: t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor"),
|
|
703
|
+
"fill-opacity": t.opacity ?? .15,
|
|
704
|
+
stroke: "none"
|
|
705
|
+
}, null, 8, Se),
|
|
706
|
+
t.seriesIndex == null ? r("", !0) : (m(), i("path", {
|
|
707
|
+
key: 0,
|
|
708
|
+
d: ie(t, !1),
|
|
709
|
+
fill: "none",
|
|
710
|
+
stroke: t.color ?? M.value[t.seriesIndex]?.color ?? "currentColor",
|
|
711
|
+
"stroke-width": t.strokeWidth ?? 2,
|
|
712
|
+
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
713
|
+
}, null, 8, Ce)),
|
|
714
|
+
t.seriesIndex == null ? (m(), i(e, { key: 1 }, [a("line", {
|
|
715
|
+
x1: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
|
|
716
|
+
y1: k.value.top,
|
|
717
|
+
x2: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
|
|
718
|
+
y2: k.value.top + j.value,
|
|
719
|
+
stroke: t.color ?? "#999",
|
|
720
|
+
"stroke-width": t.strokeWidth ?? 2,
|
|
721
|
+
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
722
|
+
}, null, 8, we), a("line", {
|
|
723
|
+
x1: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
|
|
724
|
+
y1: k.value.top,
|
|
725
|
+
x2: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
|
|
726
|
+
y2: k.value.top + j.value,
|
|
727
|
+
stroke: t.color ?? "#999",
|
|
728
|
+
"stroke-width": t.strokeWidth ?? 2,
|
|
729
|
+
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
730
|
+
}, null, 8, Te)], 64)) : r("", !0),
|
|
731
|
+
a("line", {
|
|
732
|
+
x1: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
|
|
733
|
+
y1: k.value.top + j.value - 4,
|
|
734
|
+
x2: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
|
|
735
|
+
y2: k.value.top + j.value + 4,
|
|
736
|
+
stroke: "currentColor",
|
|
737
|
+
"stroke-opacity": "0.4"
|
|
738
|
+
}, null, 8, Ee),
|
|
739
|
+
a("line", {
|
|
740
|
+
x1: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
|
|
741
|
+
y1: k.value.top + j.value - 4,
|
|
742
|
+
x2: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
|
|
743
|
+
y2: k.value.top + j.value + 4,
|
|
744
|
+
stroke: "currentColor",
|
|
745
|
+
"stroke-opacity": "0.4"
|
|
746
|
+
}, null, 8, K)
|
|
747
|
+
], 64))), 128)),
|
|
748
|
+
Ke.value && Q.value !== null ? (m(), i("line", {
|
|
749
|
+
key: 6,
|
|
750
|
+
x1: z(qe.value),
|
|
751
|
+
y1: k.value.top,
|
|
752
|
+
x2: z(qe.value),
|
|
753
|
+
y2: k.value.top + j.value,
|
|
551
754
|
stroke: "currentColor",
|
|
552
755
|
"stroke-opacity": "0.3",
|
|
553
756
|
"stroke-dasharray": "4 2",
|
|
554
757
|
"pointer-events": "none"
|
|
555
|
-
}, null, 8,
|
|
556
|
-
(m(!0), i(e, null, g(
|
|
758
|
+
}, null, 8, De)) : r("", !0),
|
|
759
|
+
(m(!0), i(e, null, g(Je.value, (e, t) => (m(), i("circle", {
|
|
557
760
|
key: "hd" + t,
|
|
558
761
|
cx: e.x,
|
|
559
762
|
cy: e.y,
|
|
@@ -562,51 +765,78 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
562
765
|
stroke: "var(--color-bg-0, #fff)",
|
|
563
766
|
"stroke-width": "2",
|
|
564
767
|
"pointer-events": "none"
|
|
565
|
-
}, null, 8,
|
|
566
|
-
|
|
567
|
-
key:
|
|
568
|
-
x:
|
|
569
|
-
y:
|
|
570
|
-
width:
|
|
571
|
-
height:
|
|
768
|
+
}, null, 8, Oe))), 128)),
|
|
769
|
+
Ke.value ? (m(), i("rect", {
|
|
770
|
+
key: 7,
|
|
771
|
+
x: k.value.left,
|
|
772
|
+
y: k.value.top,
|
|
773
|
+
width: A.value,
|
|
774
|
+
height: j.value,
|
|
572
775
|
fill: "transparent",
|
|
573
776
|
style: {
|
|
574
777
|
cursor: "crosshair",
|
|
575
778
|
"touch-action": "none"
|
|
576
779
|
},
|
|
577
|
-
onMousemove:
|
|
578
|
-
onMouseleave:
|
|
579
|
-
onClick:
|
|
580
|
-
onTouchstart: w(
|
|
581
|
-
onTouchmove: w(
|
|
582
|
-
onTouchend:
|
|
583
|
-
}, null, 40,
|
|
584
|
-
|
|
585
|
-
|
|
780
|
+
onMousemove: $e,
|
|
781
|
+
onMouseleave: et,
|
|
782
|
+
onClick: tt,
|
|
783
|
+
onTouchstart: w(nt, ["prevent"]),
|
|
784
|
+
onTouchmove: w(rt, ["prevent"]),
|
|
785
|
+
onTouchend: it
|
|
786
|
+
}, null, 40, ke)) : r("", !0),
|
|
787
|
+
(m(!0), i(e, null, g(ae.value.labels, (e, t) => (m(), i("g", { key: "seclab" + t }, [
|
|
788
|
+
a("circle", {
|
|
789
|
+
cx: e.cx - e.textWidth / 2 - 2,
|
|
790
|
+
cy: L.value + e.row * Y + 4,
|
|
791
|
+
r: "4",
|
|
792
|
+
fill: e.color,
|
|
793
|
+
"fill-opacity": e.fillOpacity,
|
|
794
|
+
stroke: e.color,
|
|
795
|
+
"stroke-width": "1.5"
|
|
796
|
+
}, null, 8, Ae),
|
|
797
|
+
e.labelText ? (m(), i("text", {
|
|
798
|
+
key: 0,
|
|
799
|
+
x: e.cx - e.textWidth / 2 + 8,
|
|
800
|
+
y: L.value + e.row * Y + 8,
|
|
801
|
+
"font-size": "11",
|
|
802
|
+
"font-weight": "600",
|
|
803
|
+
fill: e.color
|
|
804
|
+
}, v(e.labelText), 9, je)) : r("", !0),
|
|
805
|
+
e.descText ? (m(), i("text", {
|
|
806
|
+
key: 1,
|
|
807
|
+
x: e.cx - e.textWidth / 2 + 8,
|
|
808
|
+
y: L.value + e.row * Y + 22,
|
|
809
|
+
"font-size": "11",
|
|
810
|
+
fill: "currentColor",
|
|
811
|
+
"fill-opacity": "0.6"
|
|
812
|
+
}, v(e.descText), 9, Me)) : r("", !0)
|
|
813
|
+
]))), 128))
|
|
814
|
+
], 8, ue)),
|
|
815
|
+
Ke.value && Q.value !== null && $.value ? (m(), i("div", {
|
|
586
816
|
key: 1,
|
|
587
817
|
ref_key: "tooltipRef",
|
|
588
|
-
ref:
|
|
818
|
+
ref: Ge,
|
|
589
819
|
class: "chart-tooltip-content",
|
|
590
820
|
style: {
|
|
591
821
|
position: "absolute",
|
|
592
822
|
transform: "translateY(-50%)"
|
|
593
823
|
}
|
|
594
|
-
}, [_(t.$slots, "tooltip", d(l(
|
|
824
|
+
}, [_(t.$slots, "tooltip", d(l($.value)), () => [a("div", Ne, [$.value.xLabel ? (m(), i("div", q, v($.value.xLabel), 1)) : r("", !0), (m(!0), i(e, null, g($.value.values, (e) => (m(), i("div", {
|
|
595
825
|
key: e.seriesIndex,
|
|
596
826
|
class: "line-chart-tooltip-row"
|
|
597
827
|
}, [a("span", {
|
|
598
828
|
class: "line-chart-tooltip-swatch",
|
|
599
829
|
style: f({ background: e.color })
|
|
600
|
-
}, null, 4), o(" " + v(isFinite(e.value) ?
|
|
601
|
-
|
|
830
|
+
}, null, 4), o(" " + v(isFinite(e.value) ? Z(e.value) : "—"), 1)]))), 128))])], !0)], 512)) : r("", !0),
|
|
831
|
+
at.value ? (m(), i("a", {
|
|
602
832
|
key: 2,
|
|
603
833
|
class: "line-chart-download-link",
|
|
604
|
-
href:
|
|
605
|
-
download: `${
|
|
606
|
-
}, v(
|
|
834
|
+
href: ot.value,
|
|
835
|
+
download: `${Ve()}.csv`
|
|
836
|
+
}, v(at.value), 9, Pe)) : r("", !0)
|
|
607
837
|
], 512));
|
|
608
838
|
}
|
|
609
|
-
}), [["__scopeId", "data-v-
|
|
839
|
+
}), [["__scopeId", "data-v-24787fb7"]]), Z = {
|
|
610
840
|
"01013": "010259",
|
|
611
841
|
"01015": "010177",
|
|
612
842
|
"01029": "010177",
|
|
@@ -3767,7 +3997,7 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
3767
3997
|
51019: "510014",
|
|
3768
3998
|
"02158": "020820",
|
|
3769
3999
|
46102: "460957"
|
|
3770
|
-
},
|
|
4000
|
+
}, ze = {
|
|
3771
4001
|
"010259": "Butler, AL",
|
|
3772
4002
|
"010177": "Calhoun (Anniston), AL - Cleburne, AL",
|
|
3773
4003
|
"010172": "Chambers, AL - Randolph, AL",
|
|
@@ -4717,25 +4947,25 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
4717
4947
|
560775: "Teton, WY - Lincoln, WY",
|
|
4718
4948
|
560792: "Uinta, WY",
|
|
4719
4949
|
560804: "Weston, WY"
|
|
4720
|
-
},
|
|
4950
|
+
}, Be = ["width", "height"], Ve = [
|
|
4721
4951
|
"data-feat-id",
|
|
4722
4952
|
"d",
|
|
4723
4953
|
"fill",
|
|
4724
4954
|
"stroke",
|
|
4725
4955
|
"stroke-width"
|
|
4726
|
-
],
|
|
4956
|
+
], He = { key: 0 }, Ue = ["d", "stroke"], Q = ["transform"], We = {
|
|
4727
4957
|
key: 0,
|
|
4728
4958
|
y: 5,
|
|
4729
4959
|
"font-size": "13",
|
|
4730
4960
|
"font-weight": "600",
|
|
4731
4961
|
fill: "currentColor"
|
|
4732
|
-
},
|
|
4962
|
+
}, Ge = ["x", "fill"], Ke = ["x"], qe = {
|
|
4733
4963
|
key: 0,
|
|
4734
4964
|
y: 5,
|
|
4735
4965
|
"font-size": "13",
|
|
4736
4966
|
"font-weight": "600",
|
|
4737
4967
|
fill: "currentColor"
|
|
4738
|
-
},
|
|
4968
|
+
}, Je = ["offset", "stop-color"], $ = ["x", "fill"], Ye = ["x"], Xe = ["x"], Ze = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
4739
4969
|
__name: "ChoroplethMap",
|
|
4740
4970
|
props: {
|
|
4741
4971
|
topology: {},
|
|
@@ -4774,11 +5004,11 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
4774
5004
|
function A() {
|
|
4775
5005
|
if (D) return;
|
|
4776
5006
|
let e = b.value;
|
|
4777
|
-
e && (e.addEventListener("click",
|
|
5007
|
+
e && (e.addEventListener("click", K), e.addEventListener("mouseover", K), e.addEventListener("mousemove", De), e.addEventListener("mouseout", Oe));
|
|
4778
5008
|
}
|
|
4779
5009
|
function j() {
|
|
4780
5010
|
let e = b.value;
|
|
4781
|
-
e && (e.removeEventListener("click",
|
|
5011
|
+
e && (e.removeEventListener("click", K), e.removeEventListener("mouseover", K), e.removeEventListener("mousemove", De), e.removeEventListener("mouseout", Oe));
|
|
4782
5012
|
}
|
|
4783
5013
|
p(() => {
|
|
4784
5014
|
f.value && (C.value = f.value.clientWidth, O = new ResizeObserver((e) => {
|
|
@@ -4786,13 +5016,13 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
4786
5016
|
t && (C.value = t.contentRect.width);
|
|
4787
5017
|
}), O.observe(f.value)), M(), A();
|
|
4788
5018
|
}), ee(() => {
|
|
4789
|
-
O?.disconnect(), N(), j(),
|
|
5019
|
+
O?.disconnect(), N(), j(), we();
|
|
4790
5020
|
});
|
|
4791
5021
|
function M() {
|
|
4792
5022
|
if (!_.value || !b.value || !c.zoom && !c.pan) return;
|
|
4793
|
-
let e =
|
|
4794
|
-
k =
|
|
4795
|
-
E = !0,
|
|
5023
|
+
let e = ne(_.value);
|
|
5024
|
+
k = te().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
|
|
5025
|
+
E = !0, Ee();
|
|
4796
5026
|
}).on("zoom", (e) => {
|
|
4797
5027
|
b.value && b.value.setAttribute("transform", e.transform);
|
|
4798
5028
|
}).on("end", () => {
|
|
@@ -4800,50 +5030,50 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
4800
5030
|
}), c.pan || k.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(k);
|
|
4801
5031
|
}
|
|
4802
5032
|
function N() {
|
|
4803
|
-
_.value && k && (
|
|
5033
|
+
_.value && k && (ne(_.value).on(".zoom", null), k = null);
|
|
4804
5034
|
}
|
|
4805
5035
|
S(() => [c.zoom, c.pan], () => {
|
|
4806
5036
|
N(), j(), M(), A();
|
|
4807
5037
|
});
|
|
4808
|
-
let
|
|
5038
|
+
let I = t(() => c.width ?? (C.value || 600)), oe = t(() => c.width && c.height ? c.height / c.width : .625), L = t(() => I.value * oe.value), R = t(() => {
|
|
4809
5039
|
let e = y(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
|
|
4810
5040
|
for (let e of t) {
|
|
4811
|
-
let t =
|
|
5041
|
+
let t = Z[String(e.id).padStart(5, "0")];
|
|
4812
5042
|
t && (n.has(t) || n.set(t, []), n.get(t).push(e));
|
|
4813
5043
|
}
|
|
4814
5044
|
let r = [];
|
|
4815
5045
|
for (let [t, i] of n) r.push({
|
|
4816
5046
|
type: "Feature",
|
|
4817
5047
|
id: t,
|
|
4818
|
-
properties: { name:
|
|
4819
|
-
geometry:
|
|
5048
|
+
properties: { name: ze[t] ?? t },
|
|
5049
|
+
geometry: ie(e, i)
|
|
4820
5050
|
});
|
|
4821
5051
|
return {
|
|
4822
5052
|
type: "FeatureCollection",
|
|
4823
5053
|
features: r
|
|
4824
5054
|
};
|
|
4825
|
-
}),
|
|
4826
|
-
if (c.geoType === "hsas") return
|
|
5055
|
+
}), z = t(() => {
|
|
5056
|
+
if (c.geoType === "hsas") return R.value;
|
|
4827
5057
|
if (c.geoType === "counties") {
|
|
4828
5058
|
let e = y(c.topology);
|
|
4829
|
-
return
|
|
5059
|
+
return re(e, e.objects.counties);
|
|
4830
5060
|
}
|
|
4831
5061
|
let e = y(c.topology);
|
|
4832
|
-
return
|
|
4833
|
-
}),
|
|
5062
|
+
return re(e, e.objects.states);
|
|
5063
|
+
}), B = t(() => {
|
|
4834
5064
|
if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
|
|
4835
5065
|
let e = y(c.topology);
|
|
4836
|
-
return
|
|
4837
|
-
}),
|
|
5066
|
+
return ae(e, e.objects.states, (e, t) => e !== t);
|
|
5067
|
+
}), ue = t(() => P().fitExtent([[0, q.value], [I.value, L.value + q.value]], z.value)), de = t(() => F(ue.value)), V = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), fe = t(() => {
|
|
4838
5068
|
let e = /* @__PURE__ */ new Map();
|
|
4839
5069
|
if (!c.data) return e;
|
|
4840
5070
|
for (let t of c.data) {
|
|
4841
5071
|
e.set(t.id, t.value);
|
|
4842
|
-
let n =
|
|
5072
|
+
let n = z.value.features.find((e) => e.properties?.name === t.id);
|
|
4843
5073
|
n?.id != null && e.set(String(n.id), t.value);
|
|
4844
5074
|
}
|
|
4845
5075
|
return e;
|
|
4846
|
-
}),
|
|
5076
|
+
}), pe = t(() => {
|
|
4847
5077
|
if (!c.data || c.data.length === 0) return {
|
|
4848
5078
|
min: 0,
|
|
4849
5079
|
max: 1
|
|
@@ -4860,8 +5090,8 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
4860
5090
|
min: 0,
|
|
4861
5091
|
max: 1
|
|
4862
5092
|
};
|
|
4863
|
-
}),
|
|
4864
|
-
function
|
|
5093
|
+
}), H = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), U = t(() => Array.isArray(c.colorScale) && !H.value), me = t(() => U.value ? "" : c.colorScale?.min ?? "#e5f0fa"), he = t(() => U.value ? "" : c.colorScale?.max ?? "#08519c");
|
|
5094
|
+
function ge(e) {
|
|
4865
5095
|
let t = e.replace("#", "");
|
|
4866
5096
|
return [
|
|
4867
5097
|
parseInt(t.slice(0, 2), 16),
|
|
@@ -4869,101 +5099,101 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
4869
5099
|
parseInt(t.slice(4, 6), 16)
|
|
4870
5100
|
];
|
|
4871
5101
|
}
|
|
4872
|
-
function
|
|
4873
|
-
let [t, n, r] = me
|
|
5102
|
+
function _e(e) {
|
|
5103
|
+
let [t, n, r] = ge(me.value), [i, a, o] = ge(he.value);
|
|
4874
5104
|
return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
|
|
4875
5105
|
}
|
|
4876
|
-
function
|
|
5106
|
+
function ve(e) {
|
|
4877
5107
|
let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
|
|
4878
5108
|
for (let n of t) if (e >= n.min) return n.color;
|
|
4879
5109
|
return c.noDataColor;
|
|
4880
5110
|
}
|
|
4881
|
-
function
|
|
5111
|
+
function ye(e) {
|
|
4882
5112
|
let t = c.colorScale.find((t) => t.value === String(e));
|
|
4883
5113
|
return t ? t.color : c.noDataColor;
|
|
4884
5114
|
}
|
|
4885
|
-
function
|
|
4886
|
-
let t =
|
|
5115
|
+
function be(e) {
|
|
5116
|
+
let t = fe.value.get(String(e));
|
|
4887
5117
|
if (t == null) return c.noDataColor;
|
|
4888
|
-
if (
|
|
4889
|
-
if (
|
|
4890
|
-
let { min: n, max: r } =
|
|
4891
|
-
return
|
|
5118
|
+
if (H.value) return ye(t);
|
|
5119
|
+
if (U.value) return ve(t);
|
|
5120
|
+
let { min: n, max: r } = pe.value;
|
|
5121
|
+
return _e((t - n) / (r - n));
|
|
4892
5122
|
}
|
|
4893
|
-
function
|
|
5123
|
+
function W(e) {
|
|
4894
5124
|
return e.properties?.name ?? String(e.id);
|
|
4895
5125
|
}
|
|
4896
|
-
function
|
|
4897
|
-
return
|
|
5126
|
+
function G(e) {
|
|
5127
|
+
return fe.value.get(String(e.id));
|
|
4898
5128
|
}
|
|
4899
|
-
let
|
|
5129
|
+
let xe = t(() => {
|
|
4900
5130
|
let e = /* @__PURE__ */ new Map();
|
|
4901
|
-
for (let t of
|
|
5131
|
+
for (let t of z.value.features) e.set(String(t.id), t);
|
|
4902
5132
|
return e;
|
|
4903
5133
|
});
|
|
4904
|
-
function
|
|
5134
|
+
function Se(e) {
|
|
4905
5135
|
let t = e;
|
|
4906
5136
|
for (; t && !t.dataset?.featId;) t = t.parentElement;
|
|
4907
5137
|
if (!t) return null;
|
|
4908
|
-
let n =
|
|
5138
|
+
let n = xe.value.get(t.dataset.featId);
|
|
4909
5139
|
return n ? {
|
|
4910
5140
|
pathEl: t,
|
|
4911
5141
|
feat: n
|
|
4912
5142
|
} : null;
|
|
4913
5143
|
}
|
|
4914
|
-
function
|
|
5144
|
+
function Ce(e, t, n) {
|
|
4915
5145
|
T || (T = document.createElement("div"), T.className = "chart-tooltip-content", T.style.position = "fixed", T.style.transform = "translateY(-50%)", document.body.appendChild(T));
|
|
4916
|
-
let r =
|
|
5146
|
+
let r = W(e), i = G(e), a = {
|
|
4917
5147
|
id: String(e.id),
|
|
4918
5148
|
name: r,
|
|
4919
5149
|
value: i
|
|
4920
5150
|
};
|
|
4921
5151
|
c.tooltipFormat ? T.innerHTML = c.tooltipFormat(a) : T.textContent = i == null ? r : `${r}: ${i}`, T.style.left = `${t + 16}px`, T.style.top = `${n}px`;
|
|
4922
5152
|
}
|
|
4923
|
-
function
|
|
5153
|
+
function we() {
|
|
4924
5154
|
T &&= (T.remove(), null);
|
|
4925
5155
|
}
|
|
4926
|
-
function
|
|
4927
|
-
w && w !== e && (w.setAttribute("stroke-width", String(
|
|
5156
|
+
function Te(e, t) {
|
|
5157
|
+
w && w !== e && (w.setAttribute("stroke-width", String(V.value)), w.setAttribute("stroke", c.strokeColor)), w = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(V.value + 1)), e.setAttribute("stroke", "#555");
|
|
4928
5158
|
}
|
|
4929
|
-
function
|
|
4930
|
-
w && (w.setAttribute("stroke-width", String(
|
|
5159
|
+
function Ee() {
|
|
5160
|
+
w && (w.setAttribute("stroke-width", String(V.value)), w.setAttribute("stroke", c.strokeColor), w = null, l("stateHover", null)), we();
|
|
4931
5161
|
}
|
|
4932
|
-
function
|
|
5162
|
+
function K(e) {
|
|
4933
5163
|
if (E) return;
|
|
4934
|
-
let t = e, n =
|
|
5164
|
+
let t = e, n = Se(t.target);
|
|
4935
5165
|
n && (e.type === "click" ? l("stateClick", {
|
|
4936
5166
|
id: String(n.feat.id),
|
|
4937
|
-
name:
|
|
4938
|
-
value:
|
|
4939
|
-
}) : e.type === "mouseover" && (
|
|
5167
|
+
name: W(n.feat),
|
|
5168
|
+
value: G(n.feat)
|
|
5169
|
+
}) : e.type === "mouseover" && (Te(n.pathEl, n.feat), c.tooltipTrigger && Ce(n.feat, t.clientX, t.clientY), l("stateHover", {
|
|
4940
5170
|
id: String(n.feat.id),
|
|
4941
|
-
name:
|
|
4942
|
-
value:
|
|
5171
|
+
name: W(n.feat),
|
|
5172
|
+
value: G(n.feat)
|
|
4943
5173
|
})));
|
|
4944
5174
|
}
|
|
4945
|
-
function
|
|
5175
|
+
function De(e) {
|
|
4946
5176
|
E || !T || (T.style.left = `${e.clientX + 16}px`, T.style.top = `${e.clientY}px`);
|
|
4947
5177
|
}
|
|
4948
|
-
function
|
|
5178
|
+
function Oe(e) {
|
|
4949
5179
|
let t = e.relatedTarget;
|
|
4950
|
-
t && b.value?.contains(t) ||
|
|
5180
|
+
t && b.value?.contains(t) || Ee();
|
|
4951
5181
|
}
|
|
4952
|
-
function
|
|
5182
|
+
function ke() {
|
|
4953
5183
|
return typeof c.menu == "string" ? c.menu : "choropleth";
|
|
4954
5184
|
}
|
|
4955
|
-
let
|
|
5185
|
+
let Ae = t(() => c.legend && (H.value || U.value || c.data)), je = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), Me = t(() => c.title ? 24 : 0), Ne = t(() => Ae.value ? 28 : 0), q = t(() => Me.value + Ne.value), Pe = t(() => L.value + q.value), J = t(() => Me.value + 18), Y = t(() => {
|
|
4956
5186
|
let e = [];
|
|
4957
5187
|
for (let t = 0; t <= 10; t++) {
|
|
4958
5188
|
let n = t / 10;
|
|
4959
5189
|
e.push({
|
|
4960
5190
|
offset: `${(n * 100).toFixed(0)}%`,
|
|
4961
|
-
color:
|
|
5191
|
+
color: _e(n)
|
|
4962
5192
|
});
|
|
4963
5193
|
}
|
|
4964
5194
|
return e;
|
|
4965
|
-
}),
|
|
4966
|
-
let { min: e, max: t } =
|
|
5195
|
+
}), Fe = t(() => {
|
|
5196
|
+
let { min: e, max: t } = pe.value, n = t - e, r = [];
|
|
4967
5197
|
for (let t = 1; t <= 3; t++) {
|
|
4968
5198
|
let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
|
|
4969
5199
|
r.push({
|
|
@@ -4972,44 +5202,44 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
4972
5202
|
});
|
|
4973
5203
|
}
|
|
4974
5204
|
return r;
|
|
4975
|
-
}),
|
|
5205
|
+
}), X = t(() => {
|
|
4976
5206
|
let e = [];
|
|
4977
|
-
if (
|
|
5207
|
+
if (H.value) for (let t of c.colorScale) e.push({
|
|
4978
5208
|
key: t.value,
|
|
4979
5209
|
color: t.color,
|
|
4980
5210
|
label: t.value
|
|
4981
5211
|
});
|
|
4982
|
-
else if (
|
|
5212
|
+
else if (U.value) for (let t of je.value) e.push({
|
|
4983
5213
|
key: String(t.min),
|
|
4984
5214
|
color: t.color,
|
|
4985
5215
|
label: t.label ?? String(t.min)
|
|
4986
5216
|
});
|
|
4987
5217
|
return e;
|
|
4988
|
-
}),
|
|
5218
|
+
}), Ie = t(() => {
|
|
4989
5219
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
4990
|
-
for (let t of
|
|
4991
|
-
return e - (
|
|
4992
|
-
}),
|
|
5220
|
+
for (let t of X.value) e += 16 + t.label.length * 7 + 12;
|
|
5221
|
+
return e - (X.value.length > 0 ? 12 : 0);
|
|
5222
|
+
}), Le = t(() => {
|
|
4993
5223
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
4994
|
-
return
|
|
5224
|
+
return X.value.map((t) => {
|
|
4995
5225
|
let n = e;
|
|
4996
5226
|
return e += 16 + t.label.length * 7 + 12, n;
|
|
4997
5227
|
});
|
|
4998
|
-
}),
|
|
4999
|
-
if (
|
|
5228
|
+
}), Re = t(() => {
|
|
5229
|
+
if (H.value || U.value) return (I.value - Ie.value) / 2;
|
|
5000
5230
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5001
|
-
return (
|
|
5231
|
+
return (I.value - e - 160) / 2;
|
|
5002
5232
|
}), Ze = t(() => {
|
|
5003
|
-
let e =
|
|
5233
|
+
let e = ke();
|
|
5004
5234
|
return [{
|
|
5005
5235
|
label: "Save as SVG",
|
|
5006
5236
|
action: () => {
|
|
5007
|
-
_.value &&
|
|
5237
|
+
_.value && ce(_.value, e);
|
|
5008
5238
|
}
|
|
5009
5239
|
}, {
|
|
5010
5240
|
label: "Save as PNG",
|
|
5011
5241
|
action: () => {
|
|
5012
|
-
_.value &&
|
|
5242
|
+
_.value && le(_.value, e);
|
|
5013
5243
|
}
|
|
5014
5244
|
}];
|
|
5015
5245
|
});
|
|
@@ -5017,64 +5247,64 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
5017
5247
|
ref_key: "containerRef",
|
|
5018
5248
|
ref: f,
|
|
5019
5249
|
class: u(["choropleth-wrapper", { pannable: o.pan }])
|
|
5020
|
-
}, [o.menu ? (m(), n(
|
|
5250
|
+
}, [o.menu ? (m(), n(se, {
|
|
5021
5251
|
key: 0,
|
|
5022
5252
|
items: Ze.value
|
|
5023
5253
|
}, null, 8, ["items"])) : r("", !0), (m(), i("svg", {
|
|
5024
5254
|
ref_key: "svgRef",
|
|
5025
5255
|
ref: _,
|
|
5026
|
-
width:
|
|
5027
|
-
height:
|
|
5256
|
+
width: I.value,
|
|
5257
|
+
height: Pe.value
|
|
5028
5258
|
}, [
|
|
5029
5259
|
a("g", {
|
|
5030
5260
|
ref_key: "mapGroupRef",
|
|
5031
5261
|
ref: b
|
|
5032
|
-
}, [(m(!0), i(e, null, g(
|
|
5262
|
+
}, [(m(!0), i(e, null, g(z.value.features, (e) => (m(), i("path", {
|
|
5033
5263
|
key: String(e.id),
|
|
5034
5264
|
"data-feat-id": String(e.id),
|
|
5035
|
-
d:
|
|
5036
|
-
fill:
|
|
5265
|
+
d: de.value(e) ?? void 0,
|
|
5266
|
+
fill: be(e.id),
|
|
5037
5267
|
stroke: o.strokeColor,
|
|
5038
|
-
"stroke-width":
|
|
5268
|
+
"stroke-width": V.value,
|
|
5039
5269
|
class: "state-path"
|
|
5040
|
-
}, [o.tooltipTrigger ? r("", !0) : (m(), i("title",
|
|
5270
|
+
}, [o.tooltipTrigger ? r("", !0) : (m(), i("title", He, v(W(e)) + v(G(e) == null ? "" : `: ${G(e)}`), 1))], 8, Ve))), 128)), B.value ? (m(), i("path", {
|
|
5041
5271
|
key: 0,
|
|
5042
|
-
d:
|
|
5272
|
+
d: de.value(B.value) ?? void 0,
|
|
5043
5273
|
fill: "none",
|
|
5044
5274
|
stroke: o.strokeColor,
|
|
5045
5275
|
"stroke-width": 1,
|
|
5046
5276
|
"stroke-linejoin": "round",
|
|
5047
5277
|
"pointer-events": "none"
|
|
5048
|
-
}, null, 8,
|
|
5049
|
-
|
|
5278
|
+
}, null, 8, Ue)) : r("", !0)], 512),
|
|
5279
|
+
Ae.value ? (m(), i("g", {
|
|
5050
5280
|
key: 0,
|
|
5051
5281
|
class: "choropleth-legend",
|
|
5052
|
-
transform: `translate(${
|
|
5053
|
-
}, [
|
|
5054
|
-
x:
|
|
5282
|
+
transform: `translate(${Re.value},${J.value})`
|
|
5283
|
+
}, [H.value || U.value ? (m(), i(e, { key: 0 }, [o.legendTitle ? (m(), i("text", We, v(o.legendTitle), 1)) : r("", !0), (m(!0), i(e, null, g(X.value, (t, n) => (m(), i(e, { key: t.key }, [a("rect", {
|
|
5284
|
+
x: Le.value[n],
|
|
5055
5285
|
y: -5,
|
|
5056
5286
|
width: "12",
|
|
5057
5287
|
height: "12",
|
|
5058
5288
|
rx: "3",
|
|
5059
5289
|
fill: t.color
|
|
5060
|
-
}, null, 8,
|
|
5061
|
-
x:
|
|
5290
|
+
}, null, 8, Ge), a("text", {
|
|
5291
|
+
x: Le.value[n] + 16,
|
|
5062
5292
|
y: 5,
|
|
5063
5293
|
"font-size": "13",
|
|
5064
5294
|
fill: "currentColor"
|
|
5065
|
-
}, v(t.label), 9,
|
|
5066
|
-
o.legendTitle ? (m(), i("text",
|
|
5295
|
+
}, v(t.label), 9, Ke)], 64))), 128))], 64)) : (m(), i(e, { key: 1 }, [
|
|
5296
|
+
o.legendTitle ? (m(), i("text", qe, v(o.legendTitle), 1)) : r("", !0),
|
|
5067
5297
|
a("defs", null, [a("linearGradient", {
|
|
5068
5298
|
id: d,
|
|
5069
5299
|
x1: "0",
|
|
5070
5300
|
x2: "1",
|
|
5071
5301
|
y1: "0",
|
|
5072
5302
|
y2: "0"
|
|
5073
|
-
}, [(m(!0), i(e, null, g(
|
|
5303
|
+
}, [(m(!0), i(e, null, g(Y.value, (e) => (m(), i("stop", {
|
|
5074
5304
|
key: e.offset,
|
|
5075
5305
|
offset: e.offset,
|
|
5076
5306
|
"stop-color": e.color
|
|
5077
|
-
}, null, 8,
|
|
5307
|
+
}, null, 8, Je))), 128))])]),
|
|
5078
5308
|
a("rect", {
|
|
5079
5309
|
x: o.legendTitle ? o.legendTitle.length * 8 + 12 : 0,
|
|
5080
5310
|
y: -6,
|
|
@@ -5082,8 +5312,8 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
5082
5312
|
height: 12,
|
|
5083
5313
|
rx: "2",
|
|
5084
5314
|
fill: `url(#${d})`
|
|
5085
|
-
}, null, 8,
|
|
5086
|
-
(m(!0), i(e, null, g(
|
|
5315
|
+
}, null, 8, $),
|
|
5316
|
+
(m(!0), i(e, null, g(Fe.value, (e) => (m(), i("text", {
|
|
5087
5317
|
key: e.value,
|
|
5088
5318
|
x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
|
|
5089
5319
|
y: 20,
|
|
@@ -5091,20 +5321,20 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
5091
5321
|
fill: "currentColor",
|
|
5092
5322
|
opacity: "0.7",
|
|
5093
5323
|
"text-anchor": "middle"
|
|
5094
|
-
}, v(e.value), 9,
|
|
5095
|
-
], 64))], 8,
|
|
5324
|
+
}, v(e.value), 9, Ye))), 128))
|
|
5325
|
+
], 64))], 8, Q)) : r("", !0),
|
|
5096
5326
|
o.title ? (m(), i("text", {
|
|
5097
5327
|
key: 1,
|
|
5098
|
-
x:
|
|
5328
|
+
x: I.value / 2,
|
|
5099
5329
|
y: 18,
|
|
5100
5330
|
"text-anchor": "middle",
|
|
5101
5331
|
"font-size": "14",
|
|
5102
5332
|
"font-weight": "600",
|
|
5103
5333
|
fill: "currentColor"
|
|
5104
|
-
}, v(o.title), 9,
|
|
5105
|
-
], 8,
|
|
5334
|
+
}, v(o.title), 9, Xe)) : r("", !0)
|
|
5335
|
+
], 8, Be))], 2));
|
|
5106
5336
|
}
|
|
5107
|
-
}), [["__scopeId", "data-v-ffaf1671"]]),
|
|
5337
|
+
}), [["__scopeId", "data-v-ffaf1671"]]), Qe = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
5108
5338
|
__name: "ChartTooltip",
|
|
5109
5339
|
props: {
|
|
5110
5340
|
x: {},
|
|
@@ -5155,7 +5385,7 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
5155
5385
|
_: 3
|
|
5156
5386
|
}, 8, ["open"])) : r("", !0);
|
|
5157
5387
|
}
|
|
5158
|
-
}), [["__scopeId", "data-v-44377f70"]]), $ = { class: "TableWrapper" },
|
|
5388
|
+
}), [["__scopeId", "data-v-44377f70"]]), $e = { class: "TableWrapper" }, et = { class: "Table" }, tt = ["href", "download"], nt = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
5159
5389
|
__name: "DataTable",
|
|
5160
5390
|
props: {
|
|
5161
5391
|
data: {},
|
|
@@ -5233,14 +5463,14 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
5233
5463
|
}
|
|
5234
5464
|
let C = t(() => c.downloadLink ? [] : [{
|
|
5235
5465
|
label: "Download CSV",
|
|
5236
|
-
action: () =>
|
|
5466
|
+
action: () => B(S(), b())
|
|
5237
5467
|
}]), w = t(() => c.downloadLink ? typeof c.downloadLink == "string" ? c.downloadLink : "Download data (CSV)" : null), T = t(() => c.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(S())}` : null), E = t(() => c.menu && C.value.length > 0);
|
|
5238
5468
|
return (t, s) => (m(), i("div", { class: u(["TableOuter", { "has-menu": E.value }]) }, [
|
|
5239
|
-
E.value ? (m(), n(
|
|
5469
|
+
E.value ? (m(), n(se, {
|
|
5240
5470
|
key: 0,
|
|
5241
5471
|
items: C.value
|
|
5242
5472
|
}, null, 8, ["items"])) : r("", !0),
|
|
5243
|
-
a("div",
|
|
5473
|
+
a("div", $e, [a("table", et, [
|
|
5244
5474
|
a("colgroup", null, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("col", {
|
|
5245
5475
|
key: e.name,
|
|
5246
5476
|
style: f(d(e.name))
|
|
@@ -5260,9 +5490,9 @@ var ce = ["width", "height"], le = ["x"], U = [
|
|
|
5260
5490
|
class: "data-table-download-link",
|
|
5261
5491
|
href: T.value,
|
|
5262
5492
|
download: `${b()}.csv`
|
|
5263
|
-
}, v(w.value), 9,
|
|
5493
|
+
}, v(w.value), 9, tt)) : r("", !0)
|
|
5264
5494
|
], 2));
|
|
5265
5495
|
}
|
|
5266
5496
|
}), [["__scopeId", "data-v-505e2187"]]);
|
|
5267
5497
|
//#endregion
|
|
5268
|
-
export {
|
|
5498
|
+
export { Qe as ChartTooltip, Ze as ChoroplethMap, nt as DataTable, Re as LineChart };
|