@undp/data-viz 1.4.7 → 1.4.9
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/AreaChart.cjs +1 -1
- package/dist/AreaChart.cjs.map +1 -1
- package/dist/AreaChart.js +58 -58
- package/dist/AreaChart.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +44 -44
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.js +1 -1
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
- package/dist/LineChartWithConfidenceInterval.js +33 -33
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +78 -78
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +28 -28
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +43 -43
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +17 -17
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +1 -1
- package/dist/SparkLine.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/ScatterPlot.js
CHANGED
|
@@ -42,7 +42,7 @@ function yi(ye) {
|
|
|
42
42
|
colors: s,
|
|
43
43
|
colorDomain: w,
|
|
44
44
|
radius: O,
|
|
45
|
-
xAxisTitle:
|
|
45
|
+
xAxisTitle: h,
|
|
46
46
|
yAxisTitle: J,
|
|
47
47
|
leftMargin: q,
|
|
48
48
|
rightMargin: de,
|
|
@@ -83,17 +83,17 @@ function yi(ye) {
|
|
|
83
83
|
} = ye, ue = Se(null), p = si(ue, {
|
|
84
84
|
once: l.once,
|
|
85
85
|
amount: l.amount
|
|
86
|
-
}), [X, Y] = V(void 0), [I, W] = V(void 0), [ge, R] = V(void 0), [he, v] = V(void 0),
|
|
86
|
+
}), [X, Y] = V(void 0), [I, W] = V(void 0), [ge, R] = V(void 0), [he, v] = V(void 0), u = {
|
|
87
87
|
top: pe,
|
|
88
|
-
bottom:
|
|
88
|
+
bottom: h ? ae + 50 : ae,
|
|
89
89
|
left: J ? q + 30 : q,
|
|
90
90
|
right: de
|
|
91
|
-
}, _ = o.map((e, d) => ({ ...e, id: `${d}` })), y = L -
|
|
91
|
+
}, _ = o.map((e, d) => ({ ...e, id: `${d}` })), y = L - u.left - u.right, b = D - u.top - u.bottom, C = o.filter((e) => e.radius === void 0 || e.radius === null).length !== o.length ? ri().domain([0, Ce]).range([0.25, O]).nice() : void 0, g = _.filter((e) => !c(e.radius)).length === 0 ? _ : Ge(
|
|
92
92
|
_.filter((e) => !c(e.radius)),
|
|
93
93
|
"radius",
|
|
94
94
|
"desc"
|
|
95
95
|
), r = Ye().domain([j, z]).range([0, y]).nice(), n = Ye().domain([A, we]).range([b, 0]).nice(), ee = r.ticks(le), ie = n.ticks(se), F = li.from(
|
|
96
|
-
|
|
96
|
+
g.filter((e) => !c(e.x) && !c(e.y)),
|
|
97
97
|
(e) => r(e.x),
|
|
98
98
|
(e) => n(e.y)
|
|
99
99
|
).voronoi([0, 0, y < 0 ? 0 : y, b < 0 ? 0 : b]), Ae = qe(
|
|
@@ -108,7 +108,7 @@ function yi(ye) {
|
|
|
108
108
|
viewBox: `0 0 ${L} ${D}`,
|
|
109
109
|
direction: "ltr",
|
|
110
110
|
ref: ue,
|
|
111
|
-
children: /* @__PURE__ */ t.jsxs("g", { transform: `translate(${
|
|
111
|
+
children: /* @__PURE__ */ t.jsxs("g", { transform: `translate(${u.left},${u.top})`, children: [
|
|
112
112
|
/* @__PURE__ */ t.jsxs(Ie, { children: [
|
|
113
113
|
/* @__PURE__ */ t.jsx(
|
|
114
114
|
ai,
|
|
@@ -140,7 +140,7 @@ function yi(ye) {
|
|
|
140
140
|
values: ie.filter((e) => e !== 0),
|
|
141
141
|
y: ie.filter((e) => e !== 0).map((e) => n(e)),
|
|
142
142
|
x1: 0,
|
|
143
|
-
x2: y +
|
|
143
|
+
x2: y + u.right,
|
|
144
144
|
styles: {
|
|
145
145
|
gridLines: x?.yAxis?.gridLines,
|
|
146
146
|
labels: x?.yAxis?.labels
|
|
@@ -163,7 +163,7 @@ function yi(ye) {
|
|
|
163
163
|
y1: n(A < 0 ? 0 : A),
|
|
164
164
|
y2: n(A < 0 ? 0 : A),
|
|
165
165
|
x1: 0,
|
|
166
|
-
x2: y +
|
|
166
|
+
x2: y + u.right,
|
|
167
167
|
label: Te(
|
|
168
168
|
A < 0 ? 0 : A,
|
|
169
169
|
"NA",
|
|
@@ -262,16 +262,16 @@ function yi(ye) {
|
|
|
262
262
|
y: b + 30,
|
|
263
263
|
style: x?.xAxis?.title,
|
|
264
264
|
className: m?.xAxis?.title,
|
|
265
|
-
text:
|
|
265
|
+
text: h
|
|
266
266
|
}
|
|
267
267
|
)
|
|
268
268
|
] }),
|
|
269
269
|
fe.filter((e) => e.position === "before").map((e) => e.layer),
|
|
270
270
|
/* @__PURE__ */ t.jsxs(Ie, { children: [
|
|
271
|
-
|
|
271
|
+
g.filter((e) => !c(e.x) && !c(e.y)).map((e, d) => /* @__PURE__ */ t.jsx(
|
|
272
272
|
"path",
|
|
273
273
|
{
|
|
274
|
-
d: F.renderCell(
|
|
274
|
+
d: F.renderCell(g.findIndex((a) => a.id === e.id)),
|
|
275
275
|
opacity: 0,
|
|
276
276
|
onMouseEnter: (a) => {
|
|
277
277
|
Y(e), v(a.clientY), R(a.clientX), H?.(e);
|
|
@@ -288,7 +288,7 @@ function yi(ye) {
|
|
|
288
288
|
},
|
|
289
289
|
`${e.label || d}`
|
|
290
290
|
)),
|
|
291
|
-
|
|
291
|
+
g.filter((e) => !c(e.x) && !c(e.y)).map((e, d) => /* @__PURE__ */ t.jsxs(
|
|
292
292
|
te.g,
|
|
293
293
|
{
|
|
294
294
|
variants: {
|
|
@@ -460,7 +460,7 @@ function yi(ye) {
|
|
|
460
460
|
} : void 0, E = {
|
|
461
461
|
y: e.yCoordinate ? n(e.yCoordinate) + (e.yOffset || 0) - 8 : 0 + (e.yOffset || 0) - 8,
|
|
462
462
|
x: K ? 0 : e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0),
|
|
463
|
-
width: K ? e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0) : y - (e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0)),
|
|
463
|
+
width: K ? e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0) : y + u.right - (e.xCoordinate ? r(e.xCoordinate) + (e.xOffset || 0) : 0 + (e.xOffset || 0)),
|
|
464
464
|
maxWidth: e.maxWidth,
|
|
465
465
|
fontWeight: e.fontWeight,
|
|
466
466
|
align: e.align
|
|
@@ -540,7 +540,7 @@ function Qi(ye) {
|
|
|
540
540
|
graphDescription: s,
|
|
541
541
|
showLabels: w = !1,
|
|
542
542
|
height: O,
|
|
543
|
-
width:
|
|
543
|
+
width: h,
|
|
544
544
|
footNote: J,
|
|
545
545
|
colorDomain: q,
|
|
546
546
|
colorLegendTitle: de,
|
|
@@ -588,50 +588,50 @@ function Qi(ye) {
|
|
|
588
588
|
noOfYTicks: R = 5,
|
|
589
589
|
labelColor: he,
|
|
590
590
|
styles: v,
|
|
591
|
-
classNames:
|
|
591
|
+
classNames: u,
|
|
592
592
|
animate: _ = !1,
|
|
593
593
|
dimmedOpacity: y = 0.3,
|
|
594
594
|
precision: b = 2,
|
|
595
595
|
customLayers: C = [],
|
|
596
|
-
timeline:
|
|
597
|
-
} = ye, [r, n] = V(0), [ee, ie] = V(0), [F, Ae] = V(
|
|
596
|
+
timeline: g = { enabled: !1, autoplay: !1, showOnlyActiveDate: !0 }
|
|
597
|
+
} = ye, [r, n] = V(0), [ee, ie] = V(0), [F, Ae] = V(g.autoplay), f = We(
|
|
598
598
|
ke(
|
|
599
599
|
o.filter((i) => i.date !== void 0 && i.date !== null),
|
|
600
600
|
(i) => i.date
|
|
601
|
-
).map((i) => Re(`${i.date}`,
|
|
601
|
+
).map((i) => Re(`${i.date}`, g.dateFormat || "yyyy", /* @__PURE__ */ new Date()).getTime()),
|
|
602
602
|
(i, G) => hi(i, G)
|
|
603
|
-
), [e, d] = V(
|
|
603
|
+
), [e, d] = V(g.autoplay ? 0 : f.length - 1), [a, Me] = V(void 0), E = Se(null), Ve = Se(null);
|
|
604
604
|
De(() => {
|
|
605
605
|
const i = new ResizeObserver((G) => {
|
|
606
|
-
n(
|
|
606
|
+
n(h || G[0].target.clientWidth || 620), ie(O || G[0].target.clientHeight || 480);
|
|
607
607
|
});
|
|
608
|
-
return E.current && (ie(E.current.clientHeight || 480), n(E.current.clientWidth || 620),
|
|
609
|
-
}, [
|
|
608
|
+
return E.current && (ie(E.current.clientHeight || 480), n(E.current.clientWidth || 620), h || i.observe(E.current)), () => i.disconnect();
|
|
609
|
+
}, [h, O]), De(() => {
|
|
610
610
|
const i = setInterval(
|
|
611
611
|
() => {
|
|
612
612
|
d((G) => G < f.length - 1 ? G + 1 : 0);
|
|
613
613
|
},
|
|
614
|
-
(
|
|
614
|
+
(g.speed || 2) * 1e3
|
|
615
615
|
);
|
|
616
616
|
return F || clearInterval(i), () => clearInterval(i);
|
|
617
|
-
}, [f, F,
|
|
617
|
+
}, [f, F, g.speed]);
|
|
618
618
|
const Le = Fe(
|
|
619
619
|
f,
|
|
620
620
|
e,
|
|
621
|
-
|
|
622
|
-
|
|
621
|
+
g.showOnlyActiveDate,
|
|
622
|
+
g.dateFormat || "yyyy"
|
|
623
623
|
);
|
|
624
624
|
return /* @__PURE__ */ t.jsx(
|
|
625
625
|
"div",
|
|
626
626
|
{
|
|
627
|
-
className: `${p || "light"} flex ${
|
|
627
|
+
className: `${p || "light"} flex ${h ? "w-fit grow-0" : "w-full grow"}`,
|
|
628
628
|
dir: l === "he" || l === "ar" ? "rtl" : void 0,
|
|
629
629
|
children: /* @__PURE__ */ t.jsx(
|
|
630
630
|
"div",
|
|
631
631
|
{
|
|
632
632
|
className: Ne(
|
|
633
633
|
`${$ ? $ === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l || "en"}`,
|
|
634
|
-
|
|
634
|
+
u?.graphContainer
|
|
635
635
|
),
|
|
636
636
|
style: {
|
|
637
637
|
...v?.graphContainer || {},
|
|
@@ -654,17 +654,17 @@ function Qi(ye) {
|
|
|
654
654
|
description: v?.description
|
|
655
655
|
},
|
|
656
656
|
classNames: {
|
|
657
|
-
title:
|
|
658
|
-
description:
|
|
657
|
+
title: u?.title,
|
|
658
|
+
description: u?.description
|
|
659
659
|
},
|
|
660
660
|
graphTitle: L,
|
|
661
661
|
graphDescription: s,
|
|
662
|
-
width:
|
|
662
|
+
width: h,
|
|
663
663
|
graphDownload: x ? Ve.current : void 0,
|
|
664
664
|
dataDownload: m ? o.map((i) => i.data).filter((i) => i !== void 0).length > 0 ? o.map((i) => i.data).filter((i) => i !== void 0) : o.filter((i) => i !== void 0) : null
|
|
665
665
|
}
|
|
666
666
|
) : null,
|
|
667
|
-
|
|
667
|
+
g.enabled && f.length > 0 && Le ? /* @__PURE__ */ t.jsxs("div", { className: "flex gap-6 items-center", dir: "ltr", children: [
|
|
668
668
|
/* @__PURE__ */ t.jsx(
|
|
669
669
|
"button",
|
|
670
670
|
{
|
|
@@ -700,7 +700,7 @@ function Qi(ye) {
|
|
|
700
700
|
K && o.filter((i) => i.color).length !== 0 ? /* @__PURE__ */ t.jsx(
|
|
701
701
|
xi,
|
|
702
702
|
{
|
|
703
|
-
width:
|
|
703
|
+
width: h,
|
|
704
704
|
colorLegendTitle: de,
|
|
705
705
|
colors: D || N[p].categoricalColors.colors,
|
|
706
706
|
colorDomain: q || ke(
|
|
@@ -717,22 +717,22 @@ function Qi(ye) {
|
|
|
717
717
|
className: "flex flex-col grow justify-center w-full leading-0",
|
|
718
718
|
ref: E,
|
|
719
719
|
"aria-label": "Graph area",
|
|
720
|
-
children: (
|
|
720
|
+
children: (h || r) && (O || ee) ? /* @__PURE__ */ t.jsx(
|
|
721
721
|
yi,
|
|
722
722
|
{
|
|
723
723
|
data: gi(
|
|
724
724
|
o,
|
|
725
|
-
|
|
725
|
+
g.dateFormat || "yyyy"
|
|
726
726
|
).filter(
|
|
727
|
-
(i) =>
|
|
727
|
+
(i) => g.enabled ? i.date === He(
|
|
728
728
|
new Date(f[e]),
|
|
729
|
-
|
|
729
|
+
g.dateFormat || "yyyy"
|
|
730
730
|
) : i
|
|
731
731
|
),
|
|
732
|
-
width:
|
|
732
|
+
width: h || r,
|
|
733
733
|
height: Math.max(
|
|
734
734
|
S,
|
|
735
|
-
O || (z ? S ? (
|
|
735
|
+
O || (z ? S ? (h || r) * z > S ? (h || r) * z : S : (h || r) * z : ee)
|
|
736
736
|
),
|
|
737
737
|
colorDomain: o.filter((i) => i.color).length === 0 ? [] : q || ke(
|
|
738
738
|
o.filter((i) => i.color),
|
|
@@ -792,7 +792,7 @@ function Qi(ye) {
|
|
|
792
792
|
xPrefix: ce,
|
|
793
793
|
yPrefix: xe,
|
|
794
794
|
styles: v,
|
|
795
|
-
classNames:
|
|
795
|
+
classNames: u,
|
|
796
796
|
animate: _ === !0 ? { duration: 0.5, once: !0, amount: 0.5 } : _ || { duration: 0, once: !0, amount: 0 },
|
|
797
797
|
dimmedOpacity: y,
|
|
798
798
|
precision: b,
|
|
@@ -807,12 +807,12 @@ function Qi(ye) {
|
|
|
807
807
|
{
|
|
808
808
|
styles: { footnote: v?.footnote, source: v?.source },
|
|
809
809
|
classNames: {
|
|
810
|
-
footnote:
|
|
811
|
-
source:
|
|
810
|
+
footnote: u?.footnote,
|
|
811
|
+
source: u?.source
|
|
812
812
|
},
|
|
813
813
|
sources: oe,
|
|
814
814
|
footNote: J,
|
|
815
|
-
width:
|
|
815
|
+
width: h
|
|
816
816
|
}
|
|
817
817
|
) : null
|
|
818
818
|
] })
|