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