@cfasim-ui/charts 0.3.3 → 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 +7 -0
- package/dist/index.css +1 -1
- package/dist/index.js +245 -217
- package/dist/tooltip-position.d.ts +13 -0
- package/package.json +2 -2
|
@@ -56,6 +56,12 @@ type __VLS_Props = {
|
|
|
56
56
|
name: string;
|
|
57
57
|
value?: number | string;
|
|
58
58
|
}) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Boundary for tooltip flip/clamp. `"none"` always places to the right of
|
|
61
|
+
* the pointer with no clamping. `"chart"` (default) uses the map
|
|
62
|
+
* container's bounding box. `"window"` uses the viewport.
|
|
63
|
+
*/
|
|
64
|
+
tooltipClamp?: "none" | "chart" | "window";
|
|
59
65
|
};
|
|
60
66
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
61
67
|
stateClick: (state: {
|
|
@@ -82,6 +88,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
82
88
|
}>, {
|
|
83
89
|
legend: boolean;
|
|
84
90
|
menu: boolean | string;
|
|
91
|
+
tooltipClamp: "none" | "chart" | "window";
|
|
85
92
|
geoType: GeoType;
|
|
86
93
|
noDataColor: string;
|
|
87
94
|
strokeColor: string;
|
|
@@ -64,6 +64,12 @@ type __VLS_Props = {
|
|
|
64
64
|
tooltipData?: unknown[];
|
|
65
65
|
/** Tooltip activation mode. Default: 'hover' */
|
|
66
66
|
tooltipTrigger?: "hover" | "click";
|
|
67
|
+
/**
|
|
68
|
+
* Boundary for tooltip flip/clamp. `"none"` always places to the right of
|
|
69
|
+
* the pointer with no clamping. `"chart"` (default) uses the chart
|
|
70
|
+
* container's bounding box. `"window"` uses the viewport.
|
|
71
|
+
*/
|
|
72
|
+
tooltipClamp?: "none" | "chart" | "window";
|
|
67
73
|
/**
|
|
68
74
|
* Custom CSV content for the Download CSV menu item. Can be a raw CSV
|
|
69
75
|
* string or a function returning one. When omitted, CSV is generated
|
|
@@ -123,6 +129,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
123
129
|
}>, {
|
|
124
130
|
menu: boolean | string;
|
|
125
131
|
lineOpacity: number;
|
|
132
|
+
tooltipClamp: "none" | "chart" | "window";
|
|
126
133
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
127
134
|
containerRef: HTMLDivElement;
|
|
128
135
|
svgRef: SVGSVGElement;
|
package/dist/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.chart-menu-trigger-area[data-v-fe2f6904]{z-index:1;position:absolute;top:0;right:0}.chart-menu-button[data-v-fe2f6904]{border:1px solid var(--color-border);background:var(--color-bg-0,#fff);width:28px;height:28px;color:var(--color-text-secondary);cursor:pointer;opacity:0;border-radius:.25em;justify-content:center;align-items:center;transition:opacity .15s;display:flex}.chart-menu-button[data-state=open][data-v-fe2f6904]{opacity:1}.chart-menu-button[data-v-fe2f6904]:hover{background:var(--color-bg-1,#0000000d);color:var(--color-text)}.chart-menu-content{z-index:100;background:var(--color-bg-0);border:1px solid var(--color-border);border-radius:.25em;min-width:140px;padding:.25em;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.chart-menu-item{font-size:var(--font-size-sm);cursor:pointer;-webkit-user-select:none;user-select:none;white-space:nowrap;border-radius:.25em;outline:none;align-items:center;padding:.375em .5em;display:flex}.chart-menu-item[data-highlighted]{background:var(--color-primary);color:#fff}.line-chart-wrapper[data-v-
|
|
1
|
+
.chart-menu-trigger-area[data-v-fe2f6904]{z-index:1;position:absolute;top:0;right:0}.chart-menu-button[data-v-fe2f6904]{border:1px solid var(--color-border);background:var(--color-bg-0,#fff);width:28px;height:28px;color:var(--color-text-secondary);cursor:pointer;opacity:0;border-radius:.25em;justify-content:center;align-items:center;transition:opacity .15s;display:flex}.chart-menu-button[data-state=open][data-v-fe2f6904]{opacity:1}.chart-menu-button[data-v-fe2f6904]:hover{background:var(--color-bg-1,#0000000d);color:var(--color-text)}.chart-menu-content{z-index:100;background:var(--color-bg-0);border:1px solid var(--color-border);border-radius:.25em;min-width:140px;padding:.25em;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.chart-menu-item{font-size:var(--font-size-sm);cursor:pointer;-webkit-user-select:none;user-select:none;white-space:nowrap;border-radius:.25em;outline:none;align-items:center;padding:.375em .5em;display:flex}.chart-menu-item[data-highlighted]{background:var(--color-primary);color:#fff}.line-chart-wrapper[data-v-d1434a63]{width:100%;position:relative}.line-chart-wrapper[data-v-d1434a63]:hover .chart-menu-button{opacity:1}.line-chart-tooltip-label[data-v-d1434a63]{margin-bottom:.25em;font-weight:600}.line-chart-tooltip-row[data-v-d1434a63]{align-items:center;gap:.375em;display:flex}.line-chart-download-link[data-v-d1434a63]{text-align:right;font-size:var(--font-size-sm);margin-top:.25em;display:block}.line-chart-tooltip-swatch[data-v-d1434a63]{border-radius:50%;flex-shrink:0;width:.625em;height:.625em;display:inline-block}.choropleth-wrapper[data-v-25a20d5b]{width:100%;position:relative}.choropleth-wrapper.pannable svg[data-v-25a20d5b]{cursor:grab}.choropleth-wrapper.pannable svg[data-v-25a20d5b]:active{cursor:grabbing}.choropleth-wrapper[data-v-25a20d5b]:hover .chart-menu-button{opacity:1}.state-path[data-v-25a20d5b]{cursor:pointer}.chart-tooltip-anchor[data-v-44377f70]{pointer-events:none;width:1px;height:1px;position:absolute}.chart-tooltip-content{z-index:100;background:var(--color-bg-0,#fff);border:1px solid var(--color-border,#e5e7eb);font-size:var(--font-size-sm,.875rem);pointer-events:none;border-radius:.375em;padding:.5em .75em;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.TableOuter[data-v-505e2187]{display:inline-block;position:relative}.TableOuter.has-menu[data-v-505e2187]{margin-top:32px}.TableOuter[data-v-505e2187] .chart-menu-trigger-area{top:-32px;right:0}.TableOuter[data-v-505e2187]:hover .chart-menu-button{opacity:1}.TableWrapper[data-v-505e2187]{font-size:var(--font-size-sm);overflow-x:auto}.Table[data-v-505e2187]{border-collapse:collapse;font-variant-numeric:tabular-nums;border:1px solid var(--color-border);margin:0;display:table}.Table tr[data-v-505e2187],.Table th[data-v-505e2187],.Table td[data-v-505e2187]{background:0 0;border:none}.Table th[data-v-505e2187],.Table td[data-v-505e2187]{white-space:nowrap;padding:.75em 1.25em}.Table th[data-v-505e2187]{border-bottom:1px solid var(--color-border-header);font-weight:600;position:sticky;top:0}.Table tbody td[data-v-505e2187]{border-bottom:1px solid var(--color-border)}.Table tbody tr:last-child td[data-v-505e2187]{border-bottom:none}.data-table-download-link[data-v-505e2187]{text-align:right;font-size:var(--font-size-sm);margin-top:.25em;display:block}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/index.js
CHANGED
|
@@ -111,67 +111,91 @@ function B(e, t) {
|
|
|
111
111
|
z(new Blob([e], { type: "text/csv" }), `${t}.csv`);
|
|
112
112
|
}
|
|
113
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
|
+
};
|
|
136
|
+
}
|
|
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 = [
|
|
116
140
|
"x1",
|
|
117
141
|
"y1",
|
|
118
142
|
"x2",
|
|
119
143
|
"y2",
|
|
120
144
|
"stroke",
|
|
121
145
|
"stroke-dasharray"
|
|
122
|
-
],
|
|
146
|
+
], G = [
|
|
123
147
|
"cx",
|
|
124
148
|
"cy",
|
|
125
149
|
"fill",
|
|
126
150
|
"fill-opacity",
|
|
127
151
|
"stroke"
|
|
128
|
-
],
|
|
152
|
+
], pe = ["x", "y"], me = [
|
|
129
153
|
"x1",
|
|
130
154
|
"y1",
|
|
131
155
|
"x2",
|
|
132
156
|
"y2"
|
|
133
|
-
],
|
|
157
|
+
], he = [
|
|
134
158
|
"x1",
|
|
135
159
|
"y1",
|
|
136
160
|
"x2",
|
|
137
161
|
"y2"
|
|
138
|
-
],
|
|
162
|
+
], ge = [
|
|
139
163
|
"x1",
|
|
140
164
|
"y1",
|
|
141
165
|
"x2",
|
|
142
166
|
"y2"
|
|
143
|
-
],
|
|
167
|
+
], _e = [
|
|
144
168
|
"x1",
|
|
145
169
|
"y1",
|
|
146
170
|
"x2",
|
|
147
171
|
"y2"
|
|
148
|
-
],
|
|
172
|
+
], ve = ["x", "y"], ye = ["transform"], K = ["x", "y"], q = ["x", "y"], be = [
|
|
149
173
|
"d",
|
|
150
174
|
"fill",
|
|
151
175
|
"fill-opacity"
|
|
152
|
-
],
|
|
176
|
+
], xe = [
|
|
153
177
|
"d",
|
|
154
178
|
"stroke",
|
|
155
179
|
"stroke-width",
|
|
156
180
|
"stroke-opacity",
|
|
157
181
|
"stroke-dasharray"
|
|
158
|
-
],
|
|
182
|
+
], Se = [
|
|
159
183
|
"cx",
|
|
160
184
|
"cy",
|
|
161
185
|
"r",
|
|
162
186
|
"fill",
|
|
163
187
|
"fill-opacity",
|
|
164
188
|
"stroke"
|
|
165
|
-
],
|
|
189
|
+
], Ce = [
|
|
166
190
|
"d",
|
|
167
191
|
"fill",
|
|
168
192
|
"fill-opacity"
|
|
169
|
-
],
|
|
193
|
+
], we = [
|
|
170
194
|
"d",
|
|
171
195
|
"stroke",
|
|
172
196
|
"stroke-width",
|
|
173
197
|
"stroke-dasharray"
|
|
174
|
-
],
|
|
198
|
+
], Te = [
|
|
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
|
+
], J = [
|
|
183
207
|
"x1",
|
|
184
208
|
"y1",
|
|
185
209
|
"x2",
|
|
@@ -192,39 +216,39 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
192
216
|
"y1",
|
|
193
217
|
"x2",
|
|
194
218
|
"y2"
|
|
195
|
-
],
|
|
219
|
+
], De = [
|
|
196
220
|
"x1",
|
|
197
221
|
"y1",
|
|
198
222
|
"x2",
|
|
199
223
|
"y2"
|
|
200
|
-
],
|
|
224
|
+
], Oe = [
|
|
201
225
|
"x1",
|
|
202
226
|
"y1",
|
|
203
227
|
"x2",
|
|
204
228
|
"y2"
|
|
205
|
-
],
|
|
229
|
+
], ke = [
|
|
206
230
|
"cx",
|
|
207
231
|
"cy",
|
|
208
232
|
"fill"
|
|
209
|
-
],
|
|
233
|
+
], Ae = [
|
|
210
234
|
"x",
|
|
211
235
|
"y",
|
|
212
236
|
"width",
|
|
213
237
|
"height"
|
|
214
|
-
],
|
|
238
|
+
], je = [
|
|
215
239
|
"cx",
|
|
216
240
|
"cy",
|
|
217
241
|
"fill",
|
|
218
242
|
"fill-opacity",
|
|
219
243
|
"stroke"
|
|
220
|
-
],
|
|
244
|
+
], Me = [
|
|
221
245
|
"x",
|
|
222
246
|
"y",
|
|
223
247
|
"fill"
|
|
224
|
-
],
|
|
248
|
+
], Y = ["x", "y"], Ne = { class: "line-chart-tooltip" }, Pe = {
|
|
225
249
|
key: 0,
|
|
226
250
|
class: "line-chart-tooltip-label"
|
|
227
|
-
},
|
|
251
|
+
}, Fe = ["href", "download"], X = 20, Z = 36, Ie = 12, Le = 7, Re = 16, ze = 50, Be = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
228
252
|
__name: "LineChart",
|
|
229
253
|
props: {
|
|
230
254
|
data: {},
|
|
@@ -249,6 +273,7 @@ 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] }
|
|
@@ -267,7 +292,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
267
292
|
C?.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 ? X : 0),
|
|
271
296
|
right: 10,
|
|
272
297
|
bottom: u.xLabel ? 46 : 30,
|
|
273
298
|
left: u.yLabel ? 66 : 50
|
|
@@ -352,7 +377,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
352
377
|
let t = P.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) * Le, 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] + Re);) 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,7 +402,7 @@ 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) * Z + Ie
|
|
381
406
|
};
|
|
382
407
|
}), I = t(() => {
|
|
383
408
|
let e = [];
|
|
@@ -399,7 +424,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
399
424
|
});
|
|
400
425
|
}
|
|
401
426
|
return e;
|
|
402
|
-
}), oe = t(() => D.value + ae.value.extraHeight), L = t(() => k.value.top + j.value + k.value.bottom +
|
|
427
|
+
}), oe = t(() => D.value + ae.value.extraHeight), L = t(() => k.value.top + j.value + k.value.bottom + Ie);
|
|
403
428
|
function R(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;
|
|
@@ -407,23 +432,23 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
407
432
|
function z(e) {
|
|
408
433
|
return Math.round(e) + .5;
|
|
409
434
|
}
|
|
410
|
-
let
|
|
411
|
-
function
|
|
412
|
-
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);
|
|
413
438
|
}
|
|
414
|
-
let
|
|
439
|
+
let Be = t(() => {
|
|
415
440
|
let { min: e, max: t } = F.value;
|
|
416
441
|
if (e === t) return [{
|
|
417
|
-
value:
|
|
442
|
+
value: H(e),
|
|
418
443
|
y: z(k.value.top + j.value / 2)
|
|
419
444
|
}];
|
|
420
445
|
let n = Math.max(3, Math.floor(j.value / 50)), r = R(t - e, n), i = Math.ceil(e / r) * r, a = [];
|
|
421
446
|
for (let n = i; n <= t; n += r) a.push({
|
|
422
|
-
value:
|
|
447
|
+
value: H(n),
|
|
423
448
|
y: z(k.value.top + j.value - (n - e) / F.value.range * j.value)
|
|
424
449
|
});
|
|
425
450
|
return a;
|
|
426
|
-
}),
|
|
451
|
+
}), Ve = t(() => {
|
|
427
452
|
let e = P.value;
|
|
428
453
|
if (e <= 1) return [];
|
|
429
454
|
let t = u.xLabels;
|
|
@@ -439,19 +464,19 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
439
464
|
for (let t = 0; t <= e - 1; t += i) {
|
|
440
465
|
let r = Math.round(t);
|
|
441
466
|
a.push({
|
|
442
|
-
value:
|
|
467
|
+
value: H(r + n),
|
|
443
468
|
x: z(k.value.left + r / (e - 1) * A.value)
|
|
444
469
|
});
|
|
445
470
|
}
|
|
446
471
|
return a;
|
|
447
472
|
});
|
|
448
|
-
function
|
|
473
|
+
function He() {
|
|
449
474
|
return u.filename ? u.filename : typeof u.menu == "string" ? u.menu : "chart";
|
|
450
475
|
}
|
|
451
|
-
function
|
|
476
|
+
function Ue() {
|
|
452
477
|
return x.value;
|
|
453
478
|
}
|
|
454
|
-
function
|
|
479
|
+
function We() {
|
|
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;
|
|
@@ -464,16 +489,16 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
464
489
|
}
|
|
465
490
|
return n.join("\n");
|
|
466
491
|
}
|
|
467
|
-
let Q = h(null),
|
|
492
|
+
let Q = h(null), Ge = h(!1), Ke = h(null), qe = t(() => !!u.tooltipData || !!u.tooltipTrigger), Je = t(() => {
|
|
468
493
|
if (Q.value === null) return 0;
|
|
469
494
|
let e = P.value, t = A.value / (e - 1 || 1);
|
|
470
495
|
return k.value.left + Q.value * t;
|
|
471
|
-
}),
|
|
496
|
+
}), Ye = t(() => {
|
|
472
497
|
let e = Q.value;
|
|
473
498
|
if (e === null) return [];
|
|
474
499
|
let { min: t, range: n } = F.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: Je.value,
|
|
477
502
|
y: i - (n.data[e] - t) * r,
|
|
478
503
|
color: n.color ?? "currentColor"
|
|
479
504
|
}));
|
|
@@ -490,10 +515,10 @@ 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 Xe(e) {
|
|
494
519
|
return "touches" in e ? e.touches[0] ?? null : e;
|
|
495
520
|
}
|
|
496
|
-
function
|
|
521
|
+
function Ze(e) {
|
|
497
522
|
let t = b.value?.getBoundingClientRect();
|
|
498
523
|
if (!t) return null;
|
|
499
524
|
let n = P.value;
|
|
@@ -501,57 +526,57 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
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 n =
|
|
529
|
+
function Qe(e, t) {
|
|
530
|
+
let n = Ke.value;
|
|
506
531
|
if (!n) return;
|
|
507
|
-
let r = b.value.getBoundingClientRect(),
|
|
508
|
-
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`;
|
|
509
534
|
}
|
|
510
|
-
function
|
|
511
|
-
let t =
|
|
535
|
+
function $e(e) {
|
|
536
|
+
let t = Xe(e);
|
|
512
537
|
if (!t) return;
|
|
513
|
-
let n =
|
|
514
|
-
n !== null && (Q.value = n,
|
|
538
|
+
let n = Ze(t.clientX);
|
|
539
|
+
n !== null && (Q.value = n, Qe(t.clientX, t.clientY), y("hover", { index: n }));
|
|
515
540
|
}
|
|
516
|
-
function
|
|
517
|
-
|
|
541
|
+
function et(e) {
|
|
542
|
+
$e(e);
|
|
518
543
|
}
|
|
519
|
-
function
|
|
544
|
+
function tt() {
|
|
520
545
|
u.tooltipTrigger !== "click" && (Q.value = null, y("hover", null));
|
|
521
546
|
}
|
|
522
|
-
function
|
|
547
|
+
function nt(e) {
|
|
523
548
|
if (u.tooltipTrigger !== "click") return;
|
|
524
|
-
let t =
|
|
549
|
+
let t = Xe(e);
|
|
525
550
|
if (!t) return;
|
|
526
|
-
let n =
|
|
551
|
+
let n = Ze(t.clientX);
|
|
527
552
|
n !== null && (Q.value = Q.value === n ? null : n, y("hover", Q.value === null ? null : { index: n }));
|
|
528
553
|
}
|
|
529
|
-
function nt(e) {
|
|
530
|
-
We.value = !0, Qe(e);
|
|
531
|
-
}
|
|
532
554
|
function rt(e) {
|
|
533
|
-
|
|
555
|
+
Ge.value = !0, $e(e);
|
|
556
|
+
}
|
|
557
|
+
function it(e) {
|
|
558
|
+
$e(e);
|
|
534
559
|
}
|
|
535
|
-
function
|
|
536
|
-
|
|
560
|
+
function at() {
|
|
561
|
+
Ge.value = !1, Q.value = null, y("hover", null);
|
|
537
562
|
}
|
|
538
|
-
let
|
|
539
|
-
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 = [{
|
|
540
565
|
label: "Save as SVG",
|
|
541
566
|
action: () => {
|
|
542
|
-
let t =
|
|
567
|
+
let t = Ue();
|
|
543
568
|
t && ce(t, e);
|
|
544
569
|
}
|
|
545
570
|
}, {
|
|
546
571
|
label: "Save as PNG",
|
|
547
572
|
action: () => {
|
|
548
|
-
let t =
|
|
573
|
+
let t = Ue();
|
|
549
574
|
t && le(t, e);
|
|
550
575
|
}
|
|
551
576
|
}];
|
|
552
577
|
return u.downloadLink || t.push({
|
|
553
578
|
label: "Download CSV",
|
|
554
|
-
action: () => B(
|
|
579
|
+
action: () => B(We(), e)
|
|
555
580
|
}), t;
|
|
556
581
|
});
|
|
557
582
|
return (t, c) => (m(), i("div", {
|
|
@@ -561,7 +586,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
561
586
|
}, [
|
|
562
587
|
s.menu ? (m(), n(se, {
|
|
563
588
|
key: 0,
|
|
564
|
-
items:
|
|
589
|
+
items: ct.value
|
|
565
590
|
}, null, 8, ["items"])) : r("", !0),
|
|
566
591
|
(m(), i("svg", {
|
|
567
592
|
ref_key: "svgRef",
|
|
@@ -578,30 +603,30 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
578
603
|
"font-weight": "600",
|
|
579
604
|
fill: "currentColor"
|
|
580
605
|
}, v(s.title), 9, de)) : r("", !0),
|
|
581
|
-
I.value.length > 0 ? (m(), i("g",
|
|
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", {
|
|
582
607
|
key: 0,
|
|
583
608
|
x1: k.value.left + n * 120,
|
|
584
|
-
y1: k.value.top -
|
|
609
|
+
y1: k.value.top - X / 2,
|
|
585
610
|
x2: k.value.left + n * 120 + 12,
|
|
586
|
-
y2: k.value.top -
|
|
611
|
+
y2: k.value.top - X / 2,
|
|
587
612
|
stroke: t.color,
|
|
588
613
|
"stroke-width": "2",
|
|
589
614
|
"stroke-dasharray": t.dashed ? "4 2" : void 0
|
|
590
|
-
}, null, 8,
|
|
615
|
+
}, null, 8, W)) : (m(), i("circle", {
|
|
591
616
|
key: 1,
|
|
592
617
|
cx: k.value.left + n * 120 + 4,
|
|
593
|
-
cy: k.value.top -
|
|
618
|
+
cy: k.value.top - X / 2,
|
|
594
619
|
r: "4",
|
|
595
620
|
fill: t.color,
|
|
596
621
|
"fill-opacity": t.fillOpacity,
|
|
597
622
|
stroke: t.color,
|
|
598
623
|
"stroke-width": "1.5"
|
|
599
|
-
}, null, 8,
|
|
624
|
+
}, null, 8, G)), a("text", {
|
|
600
625
|
x: k.value.left + n * 120 + 18,
|
|
601
|
-
y: k.value.top -
|
|
626
|
+
y: k.value.top - X / 2 + 4,
|
|
602
627
|
"font-size": "11",
|
|
603
628
|
fill: "currentColor"
|
|
604
|
-
}, v(t.label), 9,
|
|
629
|
+
}, v(t.label), 9, pe)], 64))), 128))])) : r("", !0),
|
|
605
630
|
a("line", {
|
|
606
631
|
x1: z(k.value.left),
|
|
607
632
|
y1: z(k.value.top),
|
|
@@ -609,7 +634,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
609
634
|
y2: z(k.value.top + j.value),
|
|
610
635
|
stroke: "currentColor",
|
|
611
636
|
"stroke-opacity": "0.3"
|
|
612
|
-
}, null, 8,
|
|
637
|
+
}, null, 8, me),
|
|
613
638
|
a("line", {
|
|
614
639
|
x1: z(k.value.left),
|
|
615
640
|
y1: z(k.value.top + j.value),
|
|
@@ -617,8 +642,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
617
642
|
y2: z(k.value.top + j.value),
|
|
618
643
|
stroke: "currentColor",
|
|
619
644
|
"stroke-opacity": "0.3"
|
|
620
|
-
}, null, 8,
|
|
621
|
-
s.yGrid ? (m(!0), i(e, { key: 2 }, g(
|
|
645
|
+
}, null, 8, he),
|
|
646
|
+
s.yGrid ? (m(!0), i(e, { key: 2 }, g(Be.value, (e, t) => (m(), i("line", {
|
|
622
647
|
key: "yg" + t,
|
|
623
648
|
x1: k.value.left,
|
|
624
649
|
y1: e.y,
|
|
@@ -626,8 +651,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
626
651
|
y2: e.y,
|
|
627
652
|
stroke: "currentColor",
|
|
628
653
|
"stroke-opacity": "0.1"
|
|
629
|
-
}, null, 8,
|
|
630
|
-
s.xGrid ? (m(!0), i(e, { key: 3 }, g(
|
|
654
|
+
}, null, 8, ge))), 128)) : r("", !0),
|
|
655
|
+
s.xGrid ? (m(!0), i(e, { key: 3 }, g(Ve.value, (e, t) => (m(), i("line", {
|
|
631
656
|
key: "xg" + t,
|
|
632
657
|
x1: e.x,
|
|
633
658
|
y1: k.value.top,
|
|
@@ -635,8 +660,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
635
660
|
y2: k.value.top + j.value,
|
|
636
661
|
stroke: "currentColor",
|
|
637
662
|
"stroke-opacity": "0.1"
|
|
638
|
-
}, null, 8,
|
|
639
|
-
(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", {
|
|
640
665
|
key: "y" + t,
|
|
641
666
|
x: k.value.left - 6,
|
|
642
667
|
y: e.y,
|
|
@@ -645,7 +670,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
645
670
|
"font-size": "10",
|
|
646
671
|
fill: "currentColor",
|
|
647
672
|
"fill-opacity": "0.6"
|
|
648
|
-
}, v(e.value), 9,
|
|
673
|
+
}, v(e.value), 9, ve))), 128)),
|
|
649
674
|
s.yLabel ? (m(), i("text", {
|
|
650
675
|
key: 4,
|
|
651
676
|
x: 0,
|
|
@@ -654,8 +679,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
654
679
|
"text-anchor": "middle",
|
|
655
680
|
"font-size": "13",
|
|
656
681
|
fill: "currentColor"
|
|
657
|
-
}, v(s.yLabel), 9,
|
|
658
|
-
(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", {
|
|
659
684
|
key: "x" + t,
|
|
660
685
|
x: e.x,
|
|
661
686
|
y: k.value.top + j.value + 16,
|
|
@@ -663,7 +688,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
663
688
|
"font-size": "10",
|
|
664
689
|
fill: "currentColor",
|
|
665
690
|
"fill-opacity": "0.6"
|
|
666
|
-
}, v(e.value), 9,
|
|
691
|
+
}, v(e.value), 9, K))), 128)),
|
|
667
692
|
s.xLabel ? (m(), i("text", {
|
|
668
693
|
key: 5,
|
|
669
694
|
x: k.value.left + A.value / 2,
|
|
@@ -671,14 +696,14 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
671
696
|
"text-anchor": "middle",
|
|
672
697
|
"font-size": "13",
|
|
673
698
|
fill: "currentColor"
|
|
674
|
-
}, v(s.xLabel), 9,
|
|
699
|
+
}, v(s.xLabel), 9, q)) : r("", !0),
|
|
675
700
|
(m(!0), i(e, null, g(N.value, (e, t) => (m(), i("path", {
|
|
676
701
|
key: "area" + t,
|
|
677
702
|
d: re(e.upper, e.lower),
|
|
678
703
|
fill: e.color ?? "currentColor",
|
|
679
704
|
"fill-opacity": e.opacity ?? .2,
|
|
680
705
|
stroke: "none"
|
|
681
|
-
}, null, 8,
|
|
706
|
+
}, null, 8, be))), 128)),
|
|
682
707
|
(m(!0), i(e, null, g(M.value, (t, n) => (m(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (m(), i("path", {
|
|
683
708
|
key: 0,
|
|
684
709
|
d: te(t.data),
|
|
@@ -687,7 +712,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
687
712
|
"stroke-width": t.strokeWidth ?? 1.5,
|
|
688
713
|
"stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
|
|
689
714
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
690
|
-
}, null, 8,
|
|
715
|
+
}, null, 8, xe)), t.dots ? (m(!0), i(e, { key: 1 }, g(ne(t.data), (e, n) => (m(), i("circle", {
|
|
691
716
|
key: n,
|
|
692
717
|
cx: e.x,
|
|
693
718
|
cy: e.y,
|
|
@@ -695,14 +720,14 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
695
720
|
fill: t.dotFill ?? t.color ?? "currentColor",
|
|
696
721
|
"fill-opacity": t.dotOpacity ?? t.opacity ?? s.lineOpacity,
|
|
697
722
|
stroke: t.dotStroke ?? "none"
|
|
698
|
-
}, null, 8,
|
|
723
|
+
}, null, 8, Se))), 128)) : r("", !0)], 64))), 128)),
|
|
699
724
|
(m(!0), i(e, null, g(s.areaSections ?? [], (t, n) => (m(), i(e, { key: "areasec" + n }, [
|
|
700
725
|
a("path", {
|
|
701
726
|
d: ie(t),
|
|
702
727
|
fill: t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor"),
|
|
703
728
|
"fill-opacity": t.opacity ?? .15,
|
|
704
729
|
stroke: "none"
|
|
705
|
-
}, null, 8,
|
|
730
|
+
}, null, 8, Ce),
|
|
706
731
|
t.seriesIndex == null ? r("", !0) : (m(), i("path", {
|
|
707
732
|
key: 0,
|
|
708
733
|
d: ie(t, !1),
|
|
@@ -710,7 +735,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
710
735
|
stroke: t.color ?? M.value[t.seriesIndex]?.color ?? "currentColor",
|
|
711
736
|
"stroke-width": t.strokeWidth ?? 2,
|
|
712
737
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
713
|
-
}, null, 8,
|
|
738
|
+
}, null, 8, we)),
|
|
714
739
|
t.seriesIndex == null ? (m(), i(e, { key: 1 }, [a("line", {
|
|
715
740
|
x1: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
|
|
716
741
|
y1: k.value.top,
|
|
@@ -719,7 +744,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
719
744
|
stroke: t.color ?? "#999",
|
|
720
745
|
"stroke-width": t.strokeWidth ?? 2,
|
|
721
746
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
722
|
-
}, null, 8,
|
|
747
|
+
}, null, 8, Te), a("line", {
|
|
723
748
|
x1: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
|
|
724
749
|
y1: k.value.top,
|
|
725
750
|
x2: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
|
|
@@ -727,7 +752,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
727
752
|
stroke: t.color ?? "#999",
|
|
728
753
|
"stroke-width": t.strokeWidth ?? 2,
|
|
729
754
|
"stroke-dasharray": t.dashed ? "6 3" : void 0
|
|
730
|
-
}, null, 8,
|
|
755
|
+
}, null, 8, J)], 64)) : r("", !0),
|
|
731
756
|
a("line", {
|
|
732
757
|
x1: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
|
|
733
758
|
y1: k.value.top + j.value - 4,
|
|
@@ -743,20 +768,20 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
743
768
|
y2: k.value.top + j.value + 4,
|
|
744
769
|
stroke: "currentColor",
|
|
745
770
|
"stroke-opacity": "0.4"
|
|
746
|
-
}, null, 8,
|
|
771
|
+
}, null, 8, De)
|
|
747
772
|
], 64))), 128)),
|
|
748
|
-
|
|
773
|
+
qe.value && Q.value !== null ? (m(), i("line", {
|
|
749
774
|
key: 6,
|
|
750
|
-
x1: z(
|
|
775
|
+
x1: z(Je.value),
|
|
751
776
|
y1: k.value.top,
|
|
752
|
-
x2: z(
|
|
777
|
+
x2: z(Je.value),
|
|
753
778
|
y2: k.value.top + j.value,
|
|
754
779
|
stroke: "currentColor",
|
|
755
780
|
"stroke-opacity": "0.3",
|
|
756
781
|
"stroke-dasharray": "4 2",
|
|
757
782
|
"pointer-events": "none"
|
|
758
|
-
}, null, 8,
|
|
759
|
-
(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", {
|
|
760
785
|
key: "hd" + t,
|
|
761
786
|
cx: e.x,
|
|
762
787
|
cy: e.y,
|
|
@@ -765,8 +790,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
765
790
|
stroke: "var(--color-bg-0, #fff)",
|
|
766
791
|
"stroke-width": "2",
|
|
767
792
|
"pointer-events": "none"
|
|
768
|
-
}, null, 8,
|
|
769
|
-
|
|
793
|
+
}, null, 8, ke))), 128)),
|
|
794
|
+
qe.value ? (m(), i("rect", {
|
|
770
795
|
key: 7,
|
|
771
796
|
x: k.value.left,
|
|
772
797
|
y: k.value.top,
|
|
@@ -777,66 +802,66 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
777
802
|
cursor: "crosshair",
|
|
778
803
|
"touch-action": "none"
|
|
779
804
|
},
|
|
780
|
-
onMousemove:
|
|
781
|
-
onMouseleave:
|
|
782
|
-
onClick:
|
|
783
|
-
onTouchstart: w(
|
|
784
|
-
onTouchmove: w(
|
|
785
|
-
onTouchend:
|
|
786
|
-
}, null, 40,
|
|
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),
|
|
787
812
|
(m(!0), i(e, null, g(ae.value.labels, (e, t) => (m(), i("g", { key: "seclab" + t }, [
|
|
788
813
|
a("circle", {
|
|
789
814
|
cx: e.cx - e.textWidth / 2 - 2,
|
|
790
|
-
cy: L.value + e.row *
|
|
815
|
+
cy: L.value + e.row * Z + 4,
|
|
791
816
|
r: "4",
|
|
792
817
|
fill: e.color,
|
|
793
818
|
"fill-opacity": e.fillOpacity,
|
|
794
819
|
stroke: e.color,
|
|
795
820
|
"stroke-width": "1.5"
|
|
796
|
-
}, null, 8,
|
|
821
|
+
}, null, 8, je),
|
|
797
822
|
e.labelText ? (m(), i("text", {
|
|
798
823
|
key: 0,
|
|
799
824
|
x: e.cx - e.textWidth / 2 + 8,
|
|
800
|
-
y: L.value + e.row *
|
|
825
|
+
y: L.value + e.row * Z + 8,
|
|
801
826
|
"font-size": "11",
|
|
802
827
|
"font-weight": "600",
|
|
803
828
|
fill: e.color
|
|
804
|
-
}, v(e.labelText), 9,
|
|
829
|
+
}, v(e.labelText), 9, Me)) : r("", !0),
|
|
805
830
|
e.descText ? (m(), i("text", {
|
|
806
831
|
key: 1,
|
|
807
832
|
x: e.cx - e.textWidth / 2 + 8,
|
|
808
|
-
y: L.value + e.row *
|
|
833
|
+
y: L.value + e.row * Z + 22,
|
|
809
834
|
"font-size": "11",
|
|
810
835
|
fill: "currentColor",
|
|
811
836
|
"fill-opacity": "0.6"
|
|
812
|
-
}, v(e.descText), 9,
|
|
837
|
+
}, v(e.descText), 9, Y)) : r("", !0)
|
|
813
838
|
]))), 128))
|
|
814
|
-
], 8,
|
|
815
|
-
|
|
839
|
+
], 8, U)),
|
|
840
|
+
qe.value && Q.value !== null && $.value ? (m(), i("div", {
|
|
816
841
|
key: 1,
|
|
817
842
|
ref_key: "tooltipRef",
|
|
818
|
-
ref:
|
|
843
|
+
ref: Ke,
|
|
819
844
|
class: "chart-tooltip-content",
|
|
820
845
|
style: {
|
|
821
846
|
position: "absolute",
|
|
822
847
|
transform: "translateY(-50%)"
|
|
823
848
|
}
|
|
824
|
-
}, [_(t.$slots, "tooltip", d(l($.value)), () => [a("div", Ne, [$.value.xLabel ? (m(), i("div",
|
|
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", {
|
|
825
850
|
key: e.seriesIndex,
|
|
826
851
|
class: "line-chart-tooltip-row"
|
|
827
852
|
}, [a("span", {
|
|
828
853
|
class: "line-chart-tooltip-swatch",
|
|
829
854
|
style: f({ background: e.color })
|
|
830
|
-
}, null, 4), o(" " + v(isFinite(e.value) ?
|
|
831
|
-
|
|
855
|
+
}, null, 4), o(" " + v(isFinite(e.value) ? H(e.value) : "—"), 1)]))), 128))])], !0)], 512)) : r("", !0),
|
|
856
|
+
ot.value ? (m(), i("a", {
|
|
832
857
|
key: 2,
|
|
833
858
|
class: "line-chart-download-link",
|
|
834
|
-
href:
|
|
835
|
-
download: `${
|
|
836
|
-
}, v(
|
|
859
|
+
href: st.value,
|
|
860
|
+
download: `${He()}.csv`
|
|
861
|
+
}, v(ot.value), 9, Fe)) : r("", !0)
|
|
837
862
|
], 512));
|
|
838
863
|
}
|
|
839
|
-
}), [["__scopeId", "data-v-
|
|
864
|
+
}), [["__scopeId", "data-v-d1434a63"]]), Ve = {
|
|
840
865
|
"01013": "010259",
|
|
841
866
|
"01015": "010177",
|
|
842
867
|
"01029": "010177",
|
|
@@ -3997,7 +4022,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
3997
4022
|
51019: "510014",
|
|
3998
4023
|
"02158": "020820",
|
|
3999
4024
|
46102: "460957"
|
|
4000
|
-
},
|
|
4025
|
+
}, He = {
|
|
4001
4026
|
"010259": "Butler, AL",
|
|
4002
4027
|
"010177": "Calhoun (Anniston), AL - Cleburne, AL",
|
|
4003
4028
|
"010172": "Chambers, AL - Randolph, AL",
|
|
@@ -4947,25 +4972,25 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
4947
4972
|
560775: "Teton, WY - Lincoln, WY",
|
|
4948
4973
|
560792: "Uinta, WY",
|
|
4949
4974
|
560804: "Weston, WY"
|
|
4950
|
-
},
|
|
4975
|
+
}, Ue = ["width", "height"], We = [
|
|
4951
4976
|
"data-feat-id",
|
|
4952
4977
|
"d",
|
|
4953
4978
|
"fill",
|
|
4954
4979
|
"stroke",
|
|
4955
4980
|
"stroke-width"
|
|
4956
|
-
],
|
|
4981
|
+
], Q = { key: 0 }, Ge = ["d", "stroke"], Ke = ["transform"], qe = {
|
|
4957
4982
|
key: 0,
|
|
4958
4983
|
y: 5,
|
|
4959
4984
|
"font-size": "13",
|
|
4960
4985
|
"font-weight": "600",
|
|
4961
4986
|
fill: "currentColor"
|
|
4962
|
-
},
|
|
4987
|
+
}, Je = ["x", "fill"], Ye = ["x"], $ = {
|
|
4963
4988
|
key: 0,
|
|
4964
4989
|
y: 5,
|
|
4965
4990
|
"font-size": "13",
|
|
4966
4991
|
"font-weight": "600",
|
|
4967
4992
|
fill: "currentColor"
|
|
4968
|
-
},
|
|
4993
|
+
}, Xe = ["offset", "stop-color"], Ze = ["x", "fill"], Qe = ["x"], $e = ["x"], et = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
4969
4994
|
__name: "ChoroplethMap",
|
|
4970
4995
|
props: {
|
|
4971
4996
|
topology: {},
|
|
@@ -4996,7 +5021,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
4996
5021
|
default: !1
|
|
4997
5022
|
},
|
|
4998
5023
|
tooltipTrigger: {},
|
|
4999
|
-
tooltipFormat: {}
|
|
5024
|
+
tooltipFormat: {},
|
|
5025
|
+
tooltipClamp: { default: "chart" }
|
|
5000
5026
|
},
|
|
5001
5027
|
emits: ["stateClick", "stateHover"],
|
|
5002
5028
|
setup(o, { emit: s }) {
|
|
@@ -5004,11 +5030,11 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5004
5030
|
function A() {
|
|
5005
5031
|
if (D) return;
|
|
5006
5032
|
let e = b.value;
|
|
5007
|
-
e && (e.addEventListener("click",
|
|
5033
|
+
e && (e.addEventListener("click", J), e.addEventListener("mouseover", J), e.addEventListener("mousemove", Ee), e.addEventListener("mouseout", De));
|
|
5008
5034
|
}
|
|
5009
5035
|
function j() {
|
|
5010
5036
|
let e = b.value;
|
|
5011
|
-
e && (e.removeEventListener("click",
|
|
5037
|
+
e && (e.removeEventListener("click", J), e.removeEventListener("mouseover", J), e.removeEventListener("mousemove", Ee), e.removeEventListener("mouseout", De));
|
|
5012
5038
|
}
|
|
5013
5039
|
p(() => {
|
|
5014
5040
|
f.value && (C.value = f.value.clientWidth, O = new ResizeObserver((e) => {
|
|
@@ -5016,13 +5042,13 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5016
5042
|
t && (C.value = t.contentRect.width);
|
|
5017
5043
|
}), O.observe(f.value)), M(), A();
|
|
5018
5044
|
}), ee(() => {
|
|
5019
|
-
O?.disconnect(), N(), j(),
|
|
5045
|
+
O?.disconnect(), N(), j(), Ce();
|
|
5020
5046
|
});
|
|
5021
5047
|
function M() {
|
|
5022
5048
|
if (!_.value || !b.value || !c.zoom && !c.pan) return;
|
|
5023
5049
|
let e = ne(_.value);
|
|
5024
5050
|
k = te().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
|
|
5025
|
-
E = !0,
|
|
5051
|
+
E = !0, Te();
|
|
5026
5052
|
}).on("zoom", (e) => {
|
|
5027
5053
|
b.value && b.value.setAttribute("transform", e.transform);
|
|
5028
5054
|
}).on("end", () => {
|
|
@@ -5038,14 +5064,14 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5038
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(() => {
|
|
5039
5065
|
let e = y(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
|
|
5040
5066
|
for (let e of t) {
|
|
5041
|
-
let t =
|
|
5067
|
+
let t = Ve[String(e.id).padStart(5, "0")];
|
|
5042
5068
|
t && (n.has(t) || n.set(t, []), n.get(t).push(e));
|
|
5043
5069
|
}
|
|
5044
5070
|
let r = [];
|
|
5045
5071
|
for (let [t, i] of n) r.push({
|
|
5046
5072
|
type: "Feature",
|
|
5047
5073
|
id: t,
|
|
5048
|
-
properties: { name:
|
|
5074
|
+
properties: { name: He[t] ?? t },
|
|
5049
5075
|
geometry: ie(e, i)
|
|
5050
5076
|
});
|
|
5051
5077
|
return {
|
|
@@ -5064,7 +5090,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5064
5090
|
if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
|
|
5065
5091
|
let e = y(c.topology);
|
|
5066
5092
|
return ae(e, e.objects.states, (e, t) => e !== t);
|
|
5067
|
-
}),
|
|
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(() => {
|
|
5068
5094
|
let e = /* @__PURE__ */ new Map();
|
|
5069
5095
|
if (!c.data) return e;
|
|
5070
5096
|
for (let t of c.data) {
|
|
@@ -5073,7 +5099,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5073
5099
|
n?.id != null && e.set(String(n.id), t.value);
|
|
5074
5100
|
}
|
|
5075
5101
|
return e;
|
|
5076
|
-
}),
|
|
5102
|
+
}), fe = t(() => {
|
|
5077
5103
|
if (!c.data || c.data.length === 0) return {
|
|
5078
5104
|
min: 0,
|
|
5079
5105
|
max: 1
|
|
@@ -5090,8 +5116,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5090
5116
|
min: 0,
|
|
5091
5117
|
max: 1
|
|
5092
5118
|
};
|
|
5093
|
-
}),
|
|
5094
|
-
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) {
|
|
5095
5121
|
let t = e.replace("#", "");
|
|
5096
5122
|
return [
|
|
5097
5123
|
parseInt(t.slice(0, 2), 16),
|
|
@@ -5099,101 +5125,103 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5099
5125
|
parseInt(t.slice(4, 6), 16)
|
|
5100
5126
|
];
|
|
5101
5127
|
}
|
|
5102
|
-
function
|
|
5103
|
-
let [t, n, r] =
|
|
5128
|
+
function ge(e) {
|
|
5129
|
+
let [t, n, r] = he(pe.value), [i, a, o] = he(me.value);
|
|
5104
5130
|
return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
|
|
5105
5131
|
}
|
|
5106
|
-
function
|
|
5132
|
+
function _e(e) {
|
|
5107
5133
|
let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
|
|
5108
5134
|
for (let n of t) if (e >= n.min) return n.color;
|
|
5109
5135
|
return c.noDataColor;
|
|
5110
5136
|
}
|
|
5111
|
-
function
|
|
5137
|
+
function ve(e) {
|
|
5112
5138
|
let t = c.colorScale.find((t) => t.value === String(e));
|
|
5113
5139
|
return t ? t.color : c.noDataColor;
|
|
5114
5140
|
}
|
|
5115
|
-
function
|
|
5116
|
-
let t =
|
|
5141
|
+
function ye(e) {
|
|
5142
|
+
let t = de.value.get(String(e));
|
|
5117
5143
|
if (t == null) return c.noDataColor;
|
|
5118
|
-
if (
|
|
5119
|
-
if (
|
|
5120
|
-
let { min: n, max: r } =
|
|
5121
|
-
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));
|
|
5122
5148
|
}
|
|
5123
|
-
function
|
|
5149
|
+
function K(e) {
|
|
5124
5150
|
return e.properties?.name ?? String(e.id);
|
|
5125
5151
|
}
|
|
5126
|
-
function
|
|
5127
|
-
return
|
|
5152
|
+
function q(e) {
|
|
5153
|
+
return de.value.get(String(e.id));
|
|
5128
5154
|
}
|
|
5129
|
-
let
|
|
5155
|
+
let be = t(() => {
|
|
5130
5156
|
let e = /* @__PURE__ */ new Map();
|
|
5131
5157
|
for (let t of z.value.features) e.set(String(t.id), t);
|
|
5132
5158
|
return e;
|
|
5133
5159
|
});
|
|
5134
|
-
function
|
|
5160
|
+
function xe(e) {
|
|
5135
5161
|
let t = e;
|
|
5136
5162
|
for (; t && !t.dataset?.featId;) t = t.parentElement;
|
|
5137
5163
|
if (!t) return null;
|
|
5138
|
-
let n =
|
|
5164
|
+
let n = be.value.get(t.dataset.featId);
|
|
5139
5165
|
return n ? {
|
|
5140
5166
|
pathEl: t,
|
|
5141
5167
|
feat: n
|
|
5142
5168
|
} : null;
|
|
5143
5169
|
}
|
|
5144
|
-
function
|
|
5170
|
+
function Se(e, t, n) {
|
|
5145
5171
|
T || (T = document.createElement("div"), T.className = "chart-tooltip-content", T.style.position = "fixed", T.style.transform = "translateY(-50%)", document.body.appendChild(T));
|
|
5146
|
-
let r =
|
|
5172
|
+
let r = K(e), i = q(e), a = {
|
|
5147
5173
|
id: String(e.id),
|
|
5148
5174
|
name: r,
|
|
5149
5175
|
value: i
|
|
5150
5176
|
};
|
|
5151
|
-
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`;
|
|
5152
5180
|
}
|
|
5153
|
-
function
|
|
5181
|
+
function Ce() {
|
|
5154
5182
|
T &&= (T.remove(), null);
|
|
5155
5183
|
}
|
|
5156
|
-
function
|
|
5157
|
-
w && w !== e && (w.setAttribute("stroke-width", String(
|
|
5184
|
+
function we(e, t) {
|
|
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");
|
|
5158
5186
|
}
|
|
5159
|
-
function
|
|
5160
|
-
w && (w.setAttribute("stroke-width", String(
|
|
5187
|
+
function Te() {
|
|
5188
|
+
w && (w.setAttribute("stroke-width", String(U.value)), w.setAttribute("stroke", c.strokeColor), w = null, l("stateHover", null)), Ce();
|
|
5161
5189
|
}
|
|
5162
|
-
function
|
|
5190
|
+
function J(e) {
|
|
5163
5191
|
if (E) return;
|
|
5164
|
-
let t = e, n =
|
|
5192
|
+
let t = e, n = xe(t.target);
|
|
5165
5193
|
n && (e.type === "click" ? l("stateClick", {
|
|
5166
5194
|
id: String(n.feat.id),
|
|
5167
|
-
name:
|
|
5168
|
-
value:
|
|
5169
|
-
}) : e.type === "mouseover" && (
|
|
5195
|
+
name: K(n.feat),
|
|
5196
|
+
value: q(n.feat)
|
|
5197
|
+
}) : e.type === "mouseover" && (we(n.pathEl, n.feat), c.tooltipTrigger && Se(n.feat, t.clientX, t.clientY), l("stateHover", {
|
|
5170
5198
|
id: String(n.feat.id),
|
|
5171
|
-
name:
|
|
5172
|
-
value:
|
|
5199
|
+
name: K(n.feat),
|
|
5200
|
+
value: q(n.feat)
|
|
5173
5201
|
})));
|
|
5174
5202
|
}
|
|
5175
|
-
function
|
|
5203
|
+
function Ee(e) {
|
|
5176
5204
|
E || !T || (T.style.left = `${e.clientX + 16}px`, T.style.top = `${e.clientY}px`);
|
|
5177
5205
|
}
|
|
5178
|
-
function
|
|
5206
|
+
function De(e) {
|
|
5179
5207
|
let t = e.relatedTarget;
|
|
5180
|
-
t && b.value?.contains(t) ||
|
|
5208
|
+
t && b.value?.contains(t) || Te();
|
|
5181
5209
|
}
|
|
5182
|
-
function
|
|
5210
|
+
function Oe() {
|
|
5183
5211
|
return typeof c.menu == "string" ? c.menu : "choropleth";
|
|
5184
5212
|
}
|
|
5185
|
-
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(() => {
|
|
5186
5214
|
let e = [];
|
|
5187
5215
|
for (let t = 0; t <= 10; t++) {
|
|
5188
5216
|
let n = t / 10;
|
|
5189
5217
|
e.push({
|
|
5190
5218
|
offset: `${(n * 100).toFixed(0)}%`,
|
|
5191
|
-
color:
|
|
5219
|
+
color: ge(n)
|
|
5192
5220
|
});
|
|
5193
5221
|
}
|
|
5194
5222
|
return e;
|
|
5195
|
-
}),
|
|
5196
|
-
let { min: e, max: t } =
|
|
5223
|
+
}), X = t(() => {
|
|
5224
|
+
let { min: e, max: t } = fe.value, n = t - e, r = [];
|
|
5197
5225
|
for (let t = 1; t <= 3; t++) {
|
|
5198
5226
|
let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
|
|
5199
5227
|
r.push({
|
|
@@ -5202,14 +5230,14 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5202
5230
|
});
|
|
5203
5231
|
}
|
|
5204
5232
|
return r;
|
|
5205
|
-
}),
|
|
5233
|
+
}), Z = t(() => {
|
|
5206
5234
|
let e = [];
|
|
5207
|
-
if (
|
|
5235
|
+
if (W.value) for (let t of c.colorScale) e.push({
|
|
5208
5236
|
key: t.value,
|
|
5209
5237
|
color: t.color,
|
|
5210
5238
|
label: t.value
|
|
5211
5239
|
});
|
|
5212
|
-
else if (
|
|
5240
|
+
else if (G.value) for (let t of Ae.value) e.push({
|
|
5213
5241
|
key: String(t.min),
|
|
5214
5242
|
color: t.color,
|
|
5215
5243
|
label: t.label ?? String(t.min)
|
|
@@ -5217,20 +5245,20 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5217
5245
|
return e;
|
|
5218
5246
|
}), Ie = t(() => {
|
|
5219
5247
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5220
|
-
for (let t of
|
|
5221
|
-
return e - (
|
|
5248
|
+
for (let t of Z.value) e += 16 + t.label.length * 7 + 12;
|
|
5249
|
+
return e - (Z.value.length > 0 ? 12 : 0);
|
|
5222
5250
|
}), Le = t(() => {
|
|
5223
5251
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5224
|
-
return
|
|
5252
|
+
return Z.value.map((t) => {
|
|
5225
5253
|
let n = e;
|
|
5226
5254
|
return e += 16 + t.label.length * 7 + 12, n;
|
|
5227
5255
|
});
|
|
5228
5256
|
}), Re = t(() => {
|
|
5229
|
-
if (
|
|
5257
|
+
if (W.value || G.value) return (I.value - Ie.value) / 2;
|
|
5230
5258
|
let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
|
|
5231
5259
|
return (I.value - e - 160) / 2;
|
|
5232
|
-
}),
|
|
5233
|
-
let e =
|
|
5260
|
+
}), ze = t(() => {
|
|
5261
|
+
let e = Oe();
|
|
5234
5262
|
return [{
|
|
5235
5263
|
label: "Save as SVG",
|
|
5236
5264
|
action: () => {
|
|
@@ -5249,12 +5277,12 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5249
5277
|
class: u(["choropleth-wrapper", { pannable: o.pan }])
|
|
5250
5278
|
}, [o.menu ? (m(), n(se, {
|
|
5251
5279
|
key: 0,
|
|
5252
|
-
items:
|
|
5280
|
+
items: ze.value
|
|
5253
5281
|
}, null, 8, ["items"])) : r("", !0), (m(), i("svg", {
|
|
5254
5282
|
ref_key: "svgRef",
|
|
5255
5283
|
ref: _,
|
|
5256
5284
|
width: I.value,
|
|
5257
|
-
height:
|
|
5285
|
+
height: Ne.value
|
|
5258
5286
|
}, [
|
|
5259
5287
|
a("g", {
|
|
5260
5288
|
ref_key: "mapGroupRef",
|
|
@@ -5262,49 +5290,49 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5262
5290
|
}, [(m(!0), i(e, null, g(z.value.features, (e) => (m(), i("path", {
|
|
5263
5291
|
key: String(e.id),
|
|
5264
5292
|
"data-feat-id": String(e.id),
|
|
5265
|
-
d:
|
|
5266
|
-
fill:
|
|
5293
|
+
d: H.value(e) ?? void 0,
|
|
5294
|
+
fill: ye(e.id),
|
|
5267
5295
|
stroke: o.strokeColor,
|
|
5268
|
-
"stroke-width":
|
|
5296
|
+
"stroke-width": U.value,
|
|
5269
5297
|
class: "state-path"
|
|
5270
|
-
}, [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", {
|
|
5271
5299
|
key: 0,
|
|
5272
|
-
d:
|
|
5300
|
+
d: H.value(B.value) ?? void 0,
|
|
5273
5301
|
fill: "none",
|
|
5274
5302
|
stroke: o.strokeColor,
|
|
5275
5303
|
"stroke-width": 1,
|
|
5276
5304
|
"stroke-linejoin": "round",
|
|
5277
5305
|
"pointer-events": "none"
|
|
5278
|
-
}, null, 8,
|
|
5279
|
-
|
|
5306
|
+
}, null, 8, Ge)) : r("", !0)], 512),
|
|
5307
|
+
ke.value ? (m(), i("g", {
|
|
5280
5308
|
key: 0,
|
|
5281
5309
|
class: "choropleth-legend",
|
|
5282
|
-
transform: `translate(${Re.value},${
|
|
5283
|
-
}, [
|
|
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", {
|
|
5284
5312
|
x: Le.value[n],
|
|
5285
5313
|
y: -5,
|
|
5286
5314
|
width: "12",
|
|
5287
5315
|
height: "12",
|
|
5288
5316
|
rx: "3",
|
|
5289
5317
|
fill: t.color
|
|
5290
|
-
}, null, 8,
|
|
5318
|
+
}, null, 8, Je), a("text", {
|
|
5291
5319
|
x: Le.value[n] + 16,
|
|
5292
5320
|
y: 5,
|
|
5293
5321
|
"font-size": "13",
|
|
5294
5322
|
fill: "currentColor"
|
|
5295
|
-
}, v(t.label), 9,
|
|
5296
|
-
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),
|
|
5297
5325
|
a("defs", null, [a("linearGradient", {
|
|
5298
5326
|
id: d,
|
|
5299
5327
|
x1: "0",
|
|
5300
5328
|
x2: "1",
|
|
5301
5329
|
y1: "0",
|
|
5302
5330
|
y2: "0"
|
|
5303
|
-
}, [(m(!0), i(e, null, g(
|
|
5331
|
+
}, [(m(!0), i(e, null, g(Fe.value, (e) => (m(), i("stop", {
|
|
5304
5332
|
key: e.offset,
|
|
5305
5333
|
offset: e.offset,
|
|
5306
5334
|
"stop-color": e.color
|
|
5307
|
-
}, null, 8,
|
|
5335
|
+
}, null, 8, Xe))), 128))])]),
|
|
5308
5336
|
a("rect", {
|
|
5309
5337
|
x: o.legendTitle ? o.legendTitle.length * 8 + 12 : 0,
|
|
5310
5338
|
y: -6,
|
|
@@ -5312,8 +5340,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5312
5340
|
height: 12,
|
|
5313
5341
|
rx: "2",
|
|
5314
5342
|
fill: `url(#${d})`
|
|
5315
|
-
}, null, 8,
|
|
5316
|
-
(m(!0), i(e, null, g(
|
|
5343
|
+
}, null, 8, Ze),
|
|
5344
|
+
(m(!0), i(e, null, g(X.value, (e) => (m(), i("text", {
|
|
5317
5345
|
key: e.value,
|
|
5318
5346
|
x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
|
|
5319
5347
|
y: 20,
|
|
@@ -5321,8 +5349,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5321
5349
|
fill: "currentColor",
|
|
5322
5350
|
opacity: "0.7",
|
|
5323
5351
|
"text-anchor": "middle"
|
|
5324
|
-
}, v(e.value), 9,
|
|
5325
|
-
], 64))], 8,
|
|
5352
|
+
}, v(e.value), 9, Qe))), 128))
|
|
5353
|
+
], 64))], 8, Ke)) : r("", !0),
|
|
5326
5354
|
o.title ? (m(), i("text", {
|
|
5327
5355
|
key: 1,
|
|
5328
5356
|
x: I.value / 2,
|
|
@@ -5331,10 +5359,10 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5331
5359
|
"font-size": "14",
|
|
5332
5360
|
"font-weight": "600",
|
|
5333
5361
|
fill: "currentColor"
|
|
5334
|
-
}, v(o.title), 9,
|
|
5335
|
-
], 8,
|
|
5362
|
+
}, v(o.title), 9, $e)) : r("", !0)
|
|
5363
|
+
], 8, Ue))], 2));
|
|
5336
5364
|
}
|
|
5337
|
-
}), [["__scopeId", "data-v-
|
|
5365
|
+
}), [["__scopeId", "data-v-25a20d5b"]]), tt = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
5338
5366
|
__name: "ChartTooltip",
|
|
5339
5367
|
props: {
|
|
5340
5368
|
x: {},
|
|
@@ -5385,7 +5413,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5385
5413
|
_: 3
|
|
5386
5414
|
}, 8, ["open"])) : r("", !0);
|
|
5387
5415
|
}
|
|
5388
|
-
}), [["__scopeId", "data-v-44377f70"]]),
|
|
5416
|
+
}), [["__scopeId", "data-v-44377f70"]]), nt = { class: "TableWrapper" }, rt = { class: "Table" }, it = ["href", "download"], at = /* @__PURE__ */ R(/* @__PURE__ */ c({
|
|
5389
5417
|
__name: "DataTable",
|
|
5390
5418
|
props: {
|
|
5391
5419
|
data: {},
|
|
@@ -5470,7 +5498,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5470
5498
|
key: 0,
|
|
5471
5499
|
items: C.value
|
|
5472
5500
|
}, null, 8, ["items"])) : r("", !0),
|
|
5473
|
-
a("div",
|
|
5501
|
+
a("div", nt, [a("table", rt, [
|
|
5474
5502
|
a("colgroup", null, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("col", {
|
|
5475
5503
|
key: e.name,
|
|
5476
5504
|
style: f(d(e.name))
|
|
@@ -5490,9 +5518,9 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
|
|
|
5490
5518
|
class: "data-table-download-link",
|
|
5491
5519
|
href: T.value,
|
|
5492
5520
|
download: `${b()}.csv`
|
|
5493
|
-
}, v(w.value), 9,
|
|
5521
|
+
}, v(w.value), 9, it)) : r("", !0)
|
|
5494
5522
|
], 2));
|
|
5495
5523
|
}
|
|
5496
5524
|
}), [["__scopeId", "data-v-505e2187"]]);
|
|
5497
5525
|
//#endregion
|
|
5498
|
-
export {
|
|
5526
|
+
export { tt as ChartTooltip, et as ChoroplethMap, at as DataTable, Be as LineChart };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type TooltipClamp = "none" | "chart" | "window";
|
|
2
|
+
/**
|
|
3
|
+
* Computes a tooltip position in client coordinates, flipping to the opposite
|
|
4
|
+
* side of the pointer and clamping vertically when the preferred placement
|
|
5
|
+
* would overflow the clamp boundary.
|
|
6
|
+
*
|
|
7
|
+
* The tooltip is assumed to be anchored with `transform: translateY(-50%)`,
|
|
8
|
+
* so `top` is the vertical center.
|
|
9
|
+
*/
|
|
10
|
+
export declare function placeTooltip(clientX: number, centerY: number, tipW: number, tipH: number, clamp: TooltipClamp, chartRect?: DOMRect): {
|
|
11
|
+
left: number;
|
|
12
|
+
top: number;
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfasim-ui/charts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Chart visualization components for cfasim-ui",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"d3-zoom": "^3.0.0",
|
|
34
34
|
"reka-ui": "^2.9.2",
|
|
35
35
|
"topojson-client": "^3.1.0",
|
|
36
|
-
"@cfasim-ui/shared": "0.3.
|
|
36
|
+
"@cfasim-ui/shared": "0.3.4"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"vue": "^3.5.0"
|