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