@undp/data-viz 1.4.7 → 1.4.8

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.
Files changed (37) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +58 -58
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/DifferenceLineChart.cjs +1 -1
  6. package/dist/DifferenceLineChart.cjs.map +1 -1
  7. package/dist/DifferenceLineChart.js +44 -44
  8. package/dist/DifferenceLineChart.js.map +1 -1
  9. package/dist/DualAxisLineChart.cjs +1 -1
  10. package/dist/DualAxisLineChart.cjs.map +1 -1
  11. package/dist/DualAxisLineChart.js +1 -1
  12. package/dist/DualAxisLineChart.js.map +1 -1
  13. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  14. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  15. package/dist/LineChartWithConfidenceInterval.js +33 -33
  16. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  17. package/dist/MultiLineAltChart.cjs +1 -1
  18. package/dist/MultiLineAltChart.cjs.map +1 -1
  19. package/dist/MultiLineAltChart.js +78 -78
  20. package/dist/MultiLineAltChart.js.map +1 -1
  21. package/dist/MultiLineChart.cjs +1 -1
  22. package/dist/MultiLineChart.cjs.map +1 -1
  23. package/dist/MultiLineChart.js +28 -28
  24. package/dist/MultiLineChart.js.map +1 -1
  25. package/dist/ScatterPlot.cjs +1 -1
  26. package/dist/ScatterPlot.cjs.map +1 -1
  27. package/dist/ScatterPlot.js +43 -43
  28. package/dist/ScatterPlot.js.map +1 -1
  29. package/dist/SimpleLineChart.cjs +1 -1
  30. package/dist/SimpleLineChart.cjs.map +1 -1
  31. package/dist/SimpleLineChart.js +17 -17
  32. package/dist/SimpleLineChart.js.map +1 -1
  33. package/dist/SparkLine.cjs +1 -1
  34. package/dist/SparkLine.cjs.map +1 -1
  35. package/dist/SparkLine.js +1 -1
  36. package/dist/SparkLine.js.map +1 -1
  37. package/package.json +1 -1
@@ -21,7 +21,7 @@ import { s as ei } from "./select-DKy99ogv.js";
21
21
  import { a as ai } from "./init-BhZylTFx.js";
22
22
  import { p as ni } from "./pointer-CWRWOsrb.js";
23
23
  import { u as oi } from "./use-in-view-yS6jzJAp.js";
24
- import { m as p } from "./proxy-CkpFesk1.js";
24
+ import { m as f } from "./proxy-CkpFesk1.js";
25
25
  import { GraphFooter as ri } from "./GraphFooter.js";
26
26
  import { GraphHeader as si } from "./GraphHeader.js";
27
27
  import { ColorLegend as li } from "./ColorLegend.js";
@@ -33,7 +33,7 @@ function hi(pt) {
33
33
  data: N,
34
34
  width: D,
35
35
  height: Y,
36
- lineColors: f,
36
+ lineColors: g,
37
37
  suffix: L,
38
38
  prefix: w,
39
39
  dateFormat: r,
@@ -83,7 +83,7 @@ function hi(pt) {
83
83
  return () => clearTimeout(t);
84
84
  }
85
85
  }, [s, c, a.duration]);
86
- const M = F === "linear" ? Qt : F === "step" ? Zt : F === "stepAfter" ? _t : F === "stepBefore" ? ti : ii, [S, rt] = W(void 0), [st, lt] = W(void 0), [A, C] = W(void 0), g = {
86
+ const M = F === "linear" ? Qt : F === "step" ? Zt : F === "stepAfter" ? _t : F === "stepBefore" ? ti : ii, [S, rt] = W(void 0), [st, lt] = W(void 0), [A, C] = W(void 0), u = {
87
87
  top: gt,
88
88
  bottom: K,
89
89
  left: U ? j + 30 : j,
@@ -105,16 +105,16 @@ function hi(pt) {
105
105
  coordinates: t.coordinates.map(
106
106
  (v, $) => $ % 2 === 0 ? d(`${v}`, r, /* @__PURE__ */ new Date()) : v
107
107
  )
108
- })), m = D - g.left - g.right, u = Y - g.top - g.bottom, xt = et ? d(`${et}`, r, /* @__PURE__ */ new Date()) : i[0].date, h = at ? d(`${at}`, r, /* @__PURE__ */ new Date()) : i[i.length - 1].date, q = Math.min(...i.map((t) => t.y1)) !== 1 / 0 ? Math.min(...i.map((t) => t.y1)) > 0 ? 0 : Math.min(...i.map((t) => t.y1)) : 0, Vt = Math.min(...i.map((t) => t.y2)) !== 1 / 0 ? Math.min(...i.map((t) => t.y2)) > 0 ? 0 : Math.min(...i.map((t) => t.y2)) : 0, $t = Math.max(...i.map((t) => t.y1)) !== 1 / 0 ? Math.max(...i.map((t) => t.y1)) : 0, Nt = Math.max(...i.map((t) => t.y2)) !== 1 / 0 ? Math.max(...i.map((t) => t.y2)) : 0, O = P(I) ? q < Vt ? q : Vt : I, jt = $t > Nt ? $t : Nt, n = Jt().domain([xt, h]).range([0, m]), o = Kt().domain([
108
+ })), m = D - u.left - u.right, p = Y - u.top - u.bottom, xt = et ? d(`${et}`, r, /* @__PURE__ */ new Date()) : i[0].date, h = at ? d(`${at}`, r, /* @__PURE__ */ new Date()) : i[i.length - 1].date, q = Math.min(...i.map((t) => t.y1)) !== 1 / 0 ? Math.min(...i.map((t) => t.y1)) > 0 ? 0 : Math.min(...i.map((t) => t.y1)) : 0, Vt = Math.min(...i.map((t) => t.y2)) !== 1 / 0 ? Math.min(...i.map((t) => t.y2)) > 0 ? 0 : Math.min(...i.map((t) => t.y2)) : 0, $t = Math.max(...i.map((t) => t.y1)) !== 1 / 0 ? Math.max(...i.map((t) => t.y1)) : 0, Nt = Math.max(...i.map((t) => t.y2)) !== 1 / 0 ? Math.max(...i.map((t) => t.y2)) : 0, O = P(I) ? q < Vt ? q : Vt : I, jt = $t > Nt ? $t : Nt, n = Jt().domain([xt, h]).range([0, m]), o = Kt().domain([
109
109
  P(I) ? O : I,
110
110
  P(z) ? jt > 0 ? jt : 0 : z
111
- ]).range([u, 0]).nice(), bt = Mt().x((t) => n(t.date)).y((t) => o(t.y1)).curve(M), Lt = Mt().x((t) => n(t.date)).y((t) => o(t.y2)).curve(M), It = Ot().x((t) => n(t.date)).y1((t) => o(t.y1)).y0((t) => o(t.y2)).curve(M), St = Ot().x((t) => n(t.date)).y1((t) => o(t.y1)).y0(0).curve(M), Pt = Ot().x((t) => n(t.date)).y1((t) => o(t.y2)).y0(0).curve(M), kt = o.ticks(it), Tt = n.ticks(J);
111
+ ]).range([p, 0]).nice(), bt = Mt().x((t) => n(t.date)).y((t) => o(t.y1)).curve(M), Lt = Mt().x((t) => n(t.date)).y((t) => o(t.y2)).curve(M), It = Ot().x((t) => n(t.date)).y1((t) => o(t.y1)).y0((t) => o(t.y2)).curve(M), St = Ot().x((t) => n(t.date)).y1((t) => o(t.y1)).y0(0).curve(M), Pt = Ot().x((t) => n(t.date)).y1((t) => o(t.y2)).y0(0).curve(M), kt = o.ticks(it), Tt = n.ticks(J);
112
112
  return Dt(() => {
113
113
  const t = ($) => {
114
114
  const yt = i[ai(
115
115
  i.map((At) => At.date),
116
116
  n.invert(ni($)[0]),
117
- 1
117
+ 0
118
118
  )];
119
119
  rt(yt || i[i.length - 1]), E?.(yt || i[i.length - 1]), C($.clientY), lt($.clientX);
120
120
  }, v = () => {
@@ -123,14 +123,14 @@ function hi(pt) {
123
123
  ei(ct.current).on("mousemove", t).on("mouseout", v);
124
124
  }, [n, i, E]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
125
125
  /* @__PURE__ */ e.jsx(
126
- p.svg,
126
+ f.svg,
127
127
  {
128
128
  width: `${D}px`,
129
129
  height: `${Y}px`,
130
130
  viewBox: `0 0 ${D} ${Y}`,
131
131
  direction: "ltr",
132
132
  ref: ot,
133
- children: /* @__PURE__ */ e.jsxs("g", { transform: `translate(${g.left},${g.top})`, children: [
133
+ children: /* @__PURE__ */ e.jsxs("g", { transform: `translate(${u.left},${u.top})`, children: [
134
134
  /* @__PURE__ */ e.jsx("clipPath", { id: `above${b}`, children: /* @__PURE__ */ e.jsx(
135
135
  "path",
136
136
  {
@@ -150,7 +150,7 @@ function hi(pt) {
150
150
  {
151
151
  areaSettings: mt,
152
152
  width: m,
153
- height: u,
153
+ height: p,
154
154
  scale: n,
155
155
  animate: a,
156
156
  isInView: s
@@ -173,7 +173,7 @@ function hi(pt) {
173
173
  values: kt.filter((t) => t !== 0),
174
174
  y: kt.filter((t) => t !== 0).map((t) => o(t)),
175
175
  x1: 0 - j,
176
- x2: m + g.right,
176
+ x2: m + u.right,
177
177
  styles: {
178
178
  gridLines: x?.yAxis?.gridLines,
179
179
  labels: x?.yAxis?.labels
@@ -196,7 +196,7 @@ function hi(pt) {
196
196
  y1: o(O < 0 ? 0 : O),
197
197
  y2: o(O < 0 ? 0 : O),
198
198
  x1: 0 - j,
199
- x2: m + g.right,
199
+ x2: m + u.right,
200
200
  label: Ct(
201
201
  O < 0 ? 0 : O,
202
202
  "NA",
@@ -224,7 +224,7 @@ function hi(pt) {
224
224
  Xt,
225
225
  {
226
226
  x: 0 - j - 15,
227
- y: u / 2,
227
+ y: p / 2,
228
228
  style: x?.yAxis?.title,
229
229
  className: y?.yAxis?.title,
230
230
  text: U,
@@ -238,7 +238,7 @@ function hi(pt) {
238
238
  values: Tt.map((t) => Ht(t, r)),
239
239
  x: Tt.map((t) => n(t)),
240
240
  y1: 0,
241
- y2: u,
241
+ y2: p,
242
242
  styles: {
243
243
  gridLines: x?.xAxis?.gridLines,
244
244
  labels: x?.xAxis?.labels
@@ -260,7 +260,7 @@ function hi(pt) {
260
260
  nt.filter((t) => t.position === "before").map((t) => t.layer),
261
261
  /* @__PURE__ */ e.jsxs("g", { children: [
262
262
  /* @__PURE__ */ e.jsx(
263
- p.path,
263
+ f.path,
264
264
  {
265
265
  clipPath: `url(#below${b})`,
266
266
  d: It(i) || "",
@@ -275,7 +275,7 @@ function hi(pt) {
275
275
  }
276
276
  ),
277
277
  /* @__PURE__ */ e.jsx(
278
- p.path,
278
+ f.path,
279
279
  {
280
280
  clipPath: `url(#above${b})`,
281
281
  d: It(i) || "",
@@ -292,12 +292,12 @@ function hi(pt) {
292
292
  ] }),
293
293
  /* @__PURE__ */ e.jsxs("g", { children: [
294
294
  /* @__PURE__ */ e.jsx(
295
- p.path,
295
+ f.path,
296
296
  {
297
297
  d: bt(i) || "",
298
298
  style: {
299
299
  fill: "none",
300
- stroke: f[0],
300
+ stroke: g[0],
301
301
  strokeWidth: _
302
302
  },
303
303
  exit: { opacity: 0, transition: { duration: a.duration } },
@@ -315,11 +315,11 @@ function hi(pt) {
315
315
  }
316
316
  ),
317
317
  /* @__PURE__ */ e.jsx(
318
- p.path,
318
+ f.path,
319
319
  {
320
320
  style: {
321
321
  fill: "none",
322
- stroke: f[1],
322
+ stroke: g[1],
323
323
  strokeWidth: _
324
324
  },
325
325
  exit: { opacity: 0, transition: { duration: a.duration } },
@@ -338,9 +338,9 @@ function hi(pt) {
338
338
  ),
339
339
  wt ? null : /* @__PURE__ */ e.jsxs("g", { children: [
340
340
  /* @__PURE__ */ e.jsx(
341
- p.text,
341
+ f.text,
342
342
  {
343
- style: { fill: f[0] },
343
+ style: { fill: g[0] },
344
344
  className: "text-xs",
345
345
  dx: 5,
346
346
  dy: 4,
@@ -368,9 +368,9 @@ function hi(pt) {
368
368
  H[0]
369
369
  ),
370
370
  /* @__PURE__ */ e.jsx(
371
- p.text,
371
+ f.text,
372
372
  {
373
- style: { fill: f[1] },
373
+ style: { fill: g[1] },
374
374
  className: "text-xs",
375
375
  dx: 5,
376
376
  dy: 4,
@@ -402,7 +402,7 @@ function hi(pt) {
402
402
  "line",
403
403
  {
404
404
  y1: 0,
405
- y2: u,
405
+ y2: p,
406
406
  x1: n(S.date),
407
407
  x2: n(S.date),
408
408
  className: G(
@@ -412,13 +412,13 @@ function hi(pt) {
412
412
  style: x?.mouseOverLine
413
413
  }
414
414
  ) : null,
415
- i.map((t, v) => /* @__PURE__ */ e.jsxs(p.g, { children: [
415
+ i.map((t, v) => /* @__PURE__ */ e.jsxs(f.g, { children: [
416
416
  P(t.y1) ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
417
417
  tt ? /* @__PURE__ */ e.jsx(
418
- p.circle,
418
+ f.circle,
419
419
  {
420
420
  r: m / i.length < 5 ? 0 : m / i.length < 20 ? 2 : 4,
421
- style: { fill: f[0] },
421
+ style: { fill: g[0] },
422
422
  exit: { opacity: 0, transition: { duration: a.duration } },
423
423
  variants: {
424
424
  initial: { opacity: 0, cx: n(t.date), cy: o(t.y1) },
@@ -434,11 +434,11 @@ function hi(pt) {
434
434
  }
435
435
  ) : null,
436
436
  l ? /* @__PURE__ */ e.jsx(
437
- p.text,
437
+ f.text,
438
438
  {
439
439
  dy: t.y2 < t.y1 ? -8 : "1em",
440
440
  style: {
441
- fill: f[0],
441
+ fill: g[0],
442
442
  textAnchor: "middle",
443
443
  ...x?.graphObjectValues || {}
444
444
  },
@@ -467,10 +467,10 @@ function hi(pt) {
467
467
  ] }),
468
468
  P(t.y2) ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
469
469
  tt ? /* @__PURE__ */ e.jsx(
470
- p.circle,
470
+ f.circle,
471
471
  {
472
472
  r: m / i.length < 5 ? 0 : m / i.length < 20 ? 2 : 4,
473
- style: { fill: f[1] },
473
+ style: { fill: g[1] },
474
474
  exit: { opacity: 0, transition: { duration: a.duration } },
475
475
  variants: {
476
476
  initial: { opacity: 0, cx: n(t.date), cy: o(t.y2) },
@@ -489,11 +489,11 @@ function hi(pt) {
489
489
  }
490
490
  ) : null,
491
491
  l ? /* @__PURE__ */ e.jsx(
492
- p.text,
492
+ f.text,
493
493
  {
494
494
  dy: t.y2 > t.y1 ? -8 : "1em",
495
495
  style: {
496
- fill: f[1],
496
+ fill: g[1],
497
497
  textAnchor: "middle",
498
498
  ...x?.graphObjectValues || {}
499
499
  },
@@ -529,7 +529,7 @@ function hi(pt) {
529
529
  color: t.color,
530
530
  y: o(t.value),
531
531
  x1: 0 - j,
532
- x2: m + g.right,
532
+ x2: m + u.right,
533
533
  classNames: t.classNames,
534
534
  styles: t.styles,
535
535
  animate: a,
@@ -560,7 +560,7 @@ function hi(pt) {
560
560
  } : void 0, At = {
561
561
  y: t.yCoordinate ? o(t.yCoordinate) + (t.yOffset || 0) - 8 : 0 + (t.yOffset || 0) - 8,
562
562
  x: Q ? 0 : t.xCoordinate ? n(d(`${t.xCoordinate}`, r, /* @__PURE__ */ new Date())) + (t.xOffset || 0) : 0 + (t.xOffset || 0),
563
- width: Q ? t.xCoordinate ? n(d(`${t.xCoordinate}`, r, /* @__PURE__ */ new Date())) + (t.xOffset || 0) : 0 + (t.xOffset || 0) : m - (t.xCoordinate ? n(d(`${t.xCoordinate}`, r, /* @__PURE__ */ new Date())) + (t.xOffset || 0) : 0 + (t.xOffset || 0)),
563
+ width: Q ? t.xCoordinate ? n(d(`${t.xCoordinate}`, r, /* @__PURE__ */ new Date())) + (t.xOffset || 0) : 0 + (t.xOffset || 0) : m + u.right - (t.xCoordinate ? n(d(`${t.xCoordinate}`, r, /* @__PURE__ */ new Date())) + (t.xOffset || 0) : 0 + (t.xOffset || 0)),
564
564
  maxWidth: t.maxWidth,
565
565
  fontWeight: t.fontWeight,
566
566
  align: t.align
@@ -590,7 +590,7 @@ function hi(pt) {
590
590
  pointerEvents: "all"
591
591
  },
592
592
  width: m,
593
- height: u
593
+ height: p
594
594
  }
595
595
  )
596
596
  ] })
@@ -614,7 +614,7 @@ function Yi(pt) {
614
614
  data: N,
615
615
  graphTitle: D,
616
616
  suffix: Y = "",
617
- sources: f,
617
+ sources: g,
618
618
  prefix: L = "",
619
619
  graphDescription: w,
620
620
  height: r,
@@ -663,14 +663,14 @@ function Yi(pt) {
663
663
  curveType: lt = "curve",
664
664
  styles: A,
665
665
  classNames: C,
666
- precision: g = 2,
666
+ precision: u = 2,
667
667
  customLayers: ct = []
668
- } = pt, [i, mt] = W(0), [ht, m] = W(0), u = ut(null), xt = ut(null);
668
+ } = pt, [i, mt] = W(0), [ht, m] = W(0), p = ut(null), xt = ut(null);
669
669
  return Dt(() => {
670
670
  const h = new ResizeObserver((q) => {
671
671
  mt(l || q[0].target.clientWidth || 620), m(r || q[0].target.clientHeight || 480);
672
672
  });
673
- return u.current && (m(u.current.clientHeight || 480), mt(u.current.clientWidth || 620), l || h.observe(u.current)), () => h.disconnect();
673
+ return p.current && (m(p.current.clientHeight || 480), mt(p.current.clientWidth || 620), l || h.observe(p.current)), () => h.disconnect();
674
674
  }, [l, r]), /* @__PURE__ */ e.jsx(
675
675
  "div",
676
676
  {
@@ -728,7 +728,7 @@ function Yi(pt) {
728
728
  "div",
729
729
  {
730
730
  className: "flex flex-col grow justify-center leading-0",
731
- ref: u,
731
+ ref: p,
732
732
  "aria-label": "Graph area",
733
733
  children: (l || i) && (r || ht) ? /* @__PURE__ */ e.jsx(
734
734
  hi,
@@ -772,14 +772,14 @@ function Yi(pt) {
772
772
  curveType: lt,
773
773
  styles: A,
774
774
  classNames: C,
775
- precision: g,
775
+ precision: u,
776
776
  customLayers: ct
777
777
  }
778
778
  ) : null
779
779
  }
780
780
  )
781
781
  ] }) }),
782
- f || J ? /* @__PURE__ */ e.jsx(
782
+ g || J ? /* @__PURE__ */ e.jsx(
783
783
  ri,
784
784
  {
785
785
  styles: { footnote: A?.footnote, source: A?.source },
@@ -787,7 +787,7 @@ function Yi(pt) {
787
787
  footnote: C?.footnote,
788
788
  source: C?.source
789
789
  },
790
- sources: f,
790
+ sources: g,
791
791
  footNote: J,
792
792
  width: l
793
793
  }