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