@undp/data-viz 1.5.7 → 1.5.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 (74) hide show
  1. package/dist/BarGraph.cjs +1 -1
  2. package/dist/BarGraph.cjs.map +1 -1
  3. package/dist/BarGraph.js +650 -648
  4. package/dist/BarGraph.js.map +1 -1
  5. package/dist/BulletChart.cjs +1 -1
  6. package/dist/BulletChart.cjs.map +1 -1
  7. package/dist/BulletChart.js +210 -208
  8. package/dist/BulletChart.js.map +1 -1
  9. package/dist/ButterflyChart.cjs +1 -1
  10. package/dist/ButterflyChart.cjs.map +1 -1
  11. package/dist/ButterflyChart.js +42 -40
  12. package/dist/ButterflyChart.js.map +1 -1
  13. package/dist/DifferenceLineChart.cjs +1 -1
  14. package/dist/DifferenceLineChart.cjs.map +1 -1
  15. package/dist/DifferenceLineChart.js +122 -120
  16. package/dist/DifferenceLineChart.js.map +1 -1
  17. package/dist/DualAxisLineChart.cjs +1 -1
  18. package/dist/DualAxisLineChart.cjs.map +1 -1
  19. package/dist/DualAxisLineChart.js +133 -113
  20. package/dist/DualAxisLineChart.js.map +1 -1
  21. package/dist/DumbbellChart.cjs +1 -1
  22. package/dist/DumbbellChart.cjs.map +1 -1
  23. package/dist/DumbbellChart.js +274 -274
  24. package/dist/DumbbellChart.js.map +1 -1
  25. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  26. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  27. package/dist/LineChartWithConfidenceInterval.js +194 -174
  28. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  29. package/dist/MultiLineAltChart.cjs +1 -1
  30. package/dist/MultiLineAltChart.cjs.map +1 -1
  31. package/dist/MultiLineAltChart.js +160 -161
  32. package/dist/MultiLineAltChart.js.map +1 -1
  33. package/dist/MultiLineChart.cjs +1 -1
  34. package/dist/MultiLineChart.cjs.map +1 -1
  35. package/dist/MultiLineChart.js +77 -66
  36. package/dist/MultiLineChart.js.map +1 -1
  37. package/dist/ParetoChart.cjs +1 -1
  38. package/dist/ParetoChart.cjs.map +1 -1
  39. package/dist/ParetoChart.js +166 -161
  40. package/dist/ParetoChart.js.map +1 -1
  41. package/dist/RadarChart.cjs +1 -1
  42. package/dist/RadarChart.cjs.map +1 -1
  43. package/dist/RadarChart.js +253 -241
  44. package/dist/RadarChart.js.map +1 -1
  45. package/dist/{RegressionLine-mH7UKOPi.js → RegressionLine-C2--oMQq.js} +10 -9
  46. package/dist/RegressionLine-C2--oMQq.js.map +1 -0
  47. package/dist/RegressionLine-Dj0GSiAp.cjs +2 -0
  48. package/dist/RegressionLine-Dj0GSiAp.cjs.map +1 -0
  49. package/dist/ScatterPlot.cjs +1 -1
  50. package/dist/ScatterPlot.cjs.map +1 -1
  51. package/dist/ScatterPlot.js +130 -129
  52. package/dist/ScatterPlot.js.map +1 -1
  53. package/dist/SimpleLineChart.cjs +1 -1
  54. package/dist/SimpleLineChart.cjs.map +1 -1
  55. package/dist/SimpleLineChart.js +43 -38
  56. package/dist/SimpleLineChart.js.map +1 -1
  57. package/dist/SlopeChart.cjs +1 -1
  58. package/dist/SlopeChart.cjs.map +1 -1
  59. package/dist/SlopeChart.js +113 -109
  60. package/dist/SlopeChart.js.map +1 -1
  61. package/dist/StripChart.cjs +1 -1
  62. package/dist/StripChart.cjs.map +1 -1
  63. package/dist/StripChart.js +282 -270
  64. package/dist/StripChart.js.map +1 -1
  65. package/dist/UnitChart.cjs +1 -1
  66. package/dist/UnitChart.cjs.map +1 -1
  67. package/dist/UnitChart.js +20 -21
  68. package/dist/UnitChart.js.map +1 -1
  69. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -1
  70. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -1
  71. package/package.json +1 -1
  72. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  73. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  74. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
@@ -29,10 +29,10 @@ import { E as ne } from "./EmptyState-DdTp-Mdn.js";
29
29
  import { g as se } from "./generateRandomString-za3IQGfQ.js";
30
30
  function re(dt) {
31
31
  const {
32
- data: T,
33
- width: D,
32
+ data: $,
33
+ width: L,
34
34
  height: V,
35
- lineColors: $,
35
+ lineColors: C,
36
36
  dateFormat: l,
37
37
  noOfXTicks: xt,
38
38
  labels: j,
@@ -41,16 +41,16 @@ function re(dt) {
41
41
  bottomMargin: J,
42
42
  suffix: H,
43
43
  prefix: R,
44
- leftMargin: C,
44
+ leftMargin: b,
45
45
  tooltip: X,
46
46
  onSeriesMouseOver: E,
47
- showValues: L,
47
+ showValues: T,
48
48
  showColorLegendAtTop: gt,
49
49
  refValues: K,
50
50
  highlightAreaSettings: ft,
51
51
  minValue: F,
52
52
  maxValue: Q,
53
- highlightedLines: A,
53
+ highlightedLines: O,
54
54
  animate: o,
55
55
  rtl: G,
56
56
  strokeWidth: ut,
@@ -74,9 +74,9 @@ function re(dt) {
74
74
  } = dt, at = ht(null), h = te(at, {
75
75
  once: o.once,
76
76
  amount: o.amount
77
- }), [b, Ct] = Y(!1);
77
+ }), [A, Ct] = Y(!1);
78
78
  Dt(() => {
79
- if (h && !b) {
79
+ if (h && !A) {
80
80
  const t = setTimeout(
81
81
  () => {
82
82
  Ct(!0);
@@ -85,14 +85,14 @@ function re(dt) {
85
85
  );
86
86
  return () => clearTimeout(t);
87
87
  }
88
- }, [h, b, o.duration]);
89
- const bt = N === "linear" ? zt : N === "step" ? Ut : N === "stepAfter" ? _t : N === "stepBefore" ? qt : Jt, [y, O] = Y(void 0), [ot, nt] = Y(void 0), [st, rt] = Y(void 0), w = {
88
+ }, [h, A, o.duration]);
89
+ const bt = N === "linear" ? zt : N === "step" ? Ut : N === "stepAfter" ? _t : N === "stepBefore" ? qt : Jt, [y, D] = Y(void 0), [ot, nt] = Y(void 0), [st, rt] = Y(void 0), w = {
90
90
  top: m,
91
91
  bottom: J,
92
- left: Z ? C + 30 : C,
92
+ left: Z ? b + 30 : b,
93
93
  right: I
94
94
  }, _ = ht(null), n = Mt(
95
- T.map((t) => ({
95
+ $.map((t) => ({
96
96
  ...t,
97
97
  date: u(`${t.date}`, l, /* @__PURE__ */ new Date())
98
98
  })),
@@ -112,7 +112,7 @@ function re(dt) {
112
112
  coordinates: t.coordinates.map(
113
113
  (i, a) => a % 2 === 0 ? u(`${i}`, l, /* @__PURE__ */ new Date()) : i
114
114
  )
115
- })), g = D - w.left - w.right, f = V - w.top - w.bottom, mt = B ? u(`${B}`, l, /* @__PURE__ */ new Date()) : n[0].date, d = z ? u(`${z}`, l, /* @__PURE__ */ new Date()) : n[n.length - 1].date, v = x(F) ? Math.min(
115
+ })), g = L - w.left - w.right, f = V - w.top - w.bottom, mt = B ? u(`${B}`, l, /* @__PURE__ */ new Date()) : n[0].date, d = z ? u(`${z}`, l, /* @__PURE__ */ new Date()) : n[n.length - 1].date, v = x(F) ? Math.min(
116
116
  ...n.map(
117
117
  (t) => Math.min(...t.y.filter((i) => !x(i)))
118
118
  )
@@ -143,18 +143,18 @@ function re(dt) {
143
143
  s.invert(Zt(a)[0]),
144
144
  0
145
145
  )];
146
- O(P || n[n.length - 1]), rt(a.clientY), nt(a.clientX), E?.(P || n[n.length - 1]);
146
+ D(P || n[n.length - 1]), rt(a.clientY), nt(a.clientX), E?.(P || n[n.length - 1]);
147
147
  }, i = () => {
148
- O(void 0), nt(void 0), rt(void 0);
148
+ D(void 0), nt(void 0), rt(void 0);
149
149
  };
150
150
  Kt(_.current).on("mousemove", t).on("mouseout", i), E?.(void 0);
151
151
  }, [s, n, E]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
152
152
  /* @__PURE__ */ e.jsx(
153
153
  S.svg,
154
154
  {
155
- width: `${D}px`,
155
+ width: `${L}px`,
156
156
  height: `${V}px`,
157
- viewBox: `0 0 ${D} ${V}`,
157
+ viewBox: `0 0 ${L} ${V}`,
158
158
  direction: "ltr",
159
159
  ref: at,
160
160
  children: /* @__PURE__ */ e.jsxs("g", { transform: `translate(${w.left},${w.top})`, children: [
@@ -202,7 +202,7 @@ function re(dt) {
202
202
  {
203
203
  values: Tt.filter((t) => t !== 0),
204
204
  y: Tt.filter((t) => t !== 0).map((t) => r(t)),
205
- x1: 0 - C,
205
+ x1: 0 - b,
206
206
  x2: g + w.right,
207
207
  styles: {
208
208
  gridLines: c?.yAxis?.gridLines,
@@ -225,7 +225,7 @@ function re(dt) {
225
225
  {
226
226
  y1: r(v < 0 ? 0 : v),
227
227
  y2: r(v < 0 ? 0 : v),
228
- x1: 0 - C,
228
+ x1: 0 - b,
229
229
  x2: g + w.right,
230
230
  label: Nt(
231
231
  v < 0 ? 0 : v,
@@ -235,7 +235,7 @@ function re(dt) {
235
235
  H
236
236
  ),
237
237
  labelPos: {
238
- x: 0 - C,
238
+ x: 0 - b,
239
239
  y: r(v < 0 ? 0 : v),
240
240
  dx: 0,
241
241
  dy: At < 0 ? "1em" : -5
@@ -253,7 +253,7 @@ function re(dt) {
253
253
  /* @__PURE__ */ e.jsx(
254
254
  Rt,
255
255
  {
256
- x: 0 - C - 15,
256
+ x: 0 - b - 15,
257
257
  y: f / 2,
258
258
  style: c?.yAxis?.title,
259
259
  className: p?.yAxis?.title,
@@ -295,10 +295,10 @@ function re(dt) {
295
295
  exit: { opacity: 0, transition: { duration: o.duration } },
296
296
  variants: {
297
297
  initial: {
298
- opacity: A.length !== 0 ? A.indexOf(j[i]) !== -1 ? 1 : k : 1
298
+ opacity: O.length !== 0 ? O.indexOf(j[i]) !== -1 ? 1 : k : 1
299
299
  },
300
300
  whileInView: {
301
- opacity: A.length !== 0 ? A.indexOf(j[i]) !== -1 ? 1 : k : 1,
301
+ opacity: O.length !== 0 ? O.indexOf(j[i]) !== -1 ? 1 : k : 1,
302
302
  transition: { duration: o.duration }
303
303
  }
304
304
  },
@@ -321,7 +321,7 @@ function re(dt) {
321
321
  t.filter((a) => !x(a.y))
322
322
  ) || "",
323
323
  opacity: 1,
324
- stroke: $[i]
324
+ stroke: C[i]
325
325
  },
326
326
  whileInView: {
327
327
  ...U.length === 0 ? { pathLength: 1 } : {},
@@ -329,7 +329,7 @@ function re(dt) {
329
329
  t.filter((a) => !x(a.y))
330
330
  ) || "",
331
331
  opacity: 1,
332
- stroke: $[i],
332
+ stroke: C[i],
333
333
  transition: { duration: o.duration }
334
334
  }
335
335
  },
@@ -343,15 +343,20 @@ function re(dt) {
343
343
  S.circle,
344
344
  {
345
345
  r: g / n.length < 5 ? 0 : g / n.length < 20 ? 2 : 4,
346
- style: { fill: $[i] },
347
346
  exit: { opacity: 0, transition: { duration: o.duration } },
348
347
  variants: {
349
- initial: { opacity: 0, cx: s(a.date), cy: r(a.y) },
348
+ initial: {
349
+ opacity: 0,
350
+ fill: C[i],
351
+ cx: s(a.date),
352
+ cy: r(a.y)
353
+ },
350
354
  whileInView: {
351
355
  opacity: 1,
356
+ fill: C[i],
352
357
  transition: {
353
- duration: b ? o.duration : 0.5,
354
- delay: b ? 0 : o.duration
358
+ duration: A ? o.duration : 0.5,
359
+ delay: A ? 0 : o.duration
355
360
  },
356
361
  cx: s(a.date),
357
362
  cy: r(a.y)
@@ -361,12 +366,11 @@ function re(dt) {
361
366
  animate: h ? "whileInView" : "initial"
362
367
  }
363
368
  ) : null,
364
- L ? /* @__PURE__ */ e.jsx(
369
+ T ? /* @__PURE__ */ e.jsx(
365
370
  S.text,
366
371
  {
367
372
  dy: -8,
368
373
  style: {
369
- fill: $[i],
370
374
  textAnchor: "middle",
371
375
  ...c?.graphObjectValues || {}
372
376
  },
@@ -376,14 +380,20 @@ function re(dt) {
376
380
  ),
377
381
  exit: { opacity: 0, transition: { duration: o.duration } },
378
382
  variants: {
379
- initial: { opacity: 0, x: s(a.date), y: r(a.y) },
383
+ initial: {
384
+ opacity: 0,
385
+ fill: C[i],
386
+ x: s(a.date),
387
+ y: r(a.y)
388
+ },
380
389
  whileInView: {
381
390
  opacity: 1,
391
+ fill: C[i],
382
392
  x: s(a.date),
383
393
  y: r(a.y),
384
394
  transition: {
385
- duration: b ? o.duration : 0.5,
386
- delay: b ? 0 : o.duration
395
+ duration: A ? o.duration : 0.5,
396
+ delay: A ? 0 : o.duration
387
397
  }
388
398
  }
389
399
  },
@@ -396,7 +406,6 @@ function re(dt) {
396
406
  gt || jt.includes(j[i]) ? null : /* @__PURE__ */ e.jsx(
397
407
  S.text,
398
408
  {
399
- style: { fill: $[i] },
400
409
  className: "text-xs",
401
410
  dx: 5,
402
411
  dy: 4,
@@ -404,16 +413,18 @@ function re(dt) {
404
413
  variants: {
405
414
  initial: {
406
415
  opacity: 0,
416
+ fill: C[i],
407
417
  x: s(t[t.length - 1].date),
408
418
  y: r(t[t.length - 1].y)
409
419
  },
410
420
  whileInView: {
411
421
  opacity: 1,
422
+ fill: C[i],
412
423
  x: s(t[t.length - 1].date),
413
424
  y: r(t[t.length - 1].y),
414
425
  transition: {
415
- duration: b ? o.duration : 0.5,
416
- delay: b ? 0 : o.duration
426
+ duration: A ? o.duration : 0.5,
427
+ delay: A ? 0 : o.duration
417
428
  }
418
429
  }
419
430
  },
@@ -447,7 +458,7 @@ function re(dt) {
447
458
  text: t.text,
448
459
  color: t.color,
449
460
  y: r(t.value),
450
- x1: 0 - C,
461
+ x1: 0 - b,
451
462
  x2: g + w.right,
452
463
  classNames: t.classNames,
453
464
  styles: t.styles,
@@ -530,10 +541,10 @@ function re(dt) {
530
541
  }
531
542
  function Re(dt) {
532
543
  const {
533
- data: T,
534
- graphTitle: D,
544
+ data: $,
545
+ graphTitle: L,
535
546
  lineColors: V = oe.light.categoricalColors.colors,
536
- suffix: $ = "",
547
+ suffix: C = "",
537
548
  sources: l,
538
549
  prefix: xt = "",
539
550
  graphDescription: j,
@@ -542,16 +553,16 @@ function Re(dt) {
542
553
  footNote: J,
543
554
  noOfXTicks: H = 10,
544
555
  dateFormat: R = "yyyy",
545
- labels: C,
556
+ labels: b,
546
557
  padding: X,
547
558
  showValues: E = !1,
548
- backgroundColor: L = !1,
559
+ backgroundColor: T = !1,
549
560
  leftMargin: gt = 30,
550
561
  rightMargin: K = 50,
551
562
  topMargin: ft = 20,
552
563
  bottomMargin: F = 25,
553
564
  tooltip: Q,
554
- relativeHeight: A,
565
+ relativeHeight: O,
555
566
  onSeriesMouseOver: o,
556
567
  showColorLegendAtTop: G = !1,
557
568
  refValues: ut = [],
@@ -574,11 +585,11 @@ function Re(dt) {
574
585
  ariaLabel: it,
575
586
  yAxisTitle: at,
576
587
  noOfYTicks: h = 5,
577
- minDate: b,
588
+ minDate: A,
578
589
  maxDate: Ct,
579
590
  curveType: bt = "curve",
580
591
  styles: y,
581
- classNames: O,
592
+ classNames: D,
582
593
  dimmedOpacity: ot = 0.3,
583
594
  precision: nt = 2,
584
595
  customLayers: st = [],
@@ -601,24 +612,24 @@ function Re(dt) {
601
612
  "div",
602
613
  {
603
614
  className: q(
604
- `${L ? L === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c || "en"}`,
615
+ `${T ? T === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c || "en"}`,
605
616
  m ? "w-fit" : "w-full",
606
- O?.graphContainer
617
+ D?.graphContainer
607
618
  ),
608
619
  style: {
609
620
  ...y?.graphContainer || {},
610
- ...L && L !== !0 ? { backgroundColor: L } : {}
621
+ ...T && T !== !0 ? { backgroundColor: T } : {}
611
622
  },
612
623
  id: yt,
613
624
  ref: mt,
614
- "aria-label": it || `${D ? `The graph shows ${D}. ` : ""}This is a multi-line chart that shows trends over time.${j ? ` ${j}` : ""}`,
625
+ "aria-label": it || `${L ? `The graph shows ${L}. ` : ""}This is a multi-line chart that shows trends over time.${j ? ` ${j}` : ""}`,
615
626
  children: /* @__PURE__ */ e.jsx(
616
627
  "div",
617
628
  {
618
629
  className: "flex grow",
619
- style: { padding: L ? X || "1rem" : X || 0 },
630
+ style: { padding: T ? X || "1rem" : X || 0 },
620
631
  children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col w-full gap-4 grow justify-between", children: [
621
- D || j || B || z ? /* @__PURE__ */ e.jsx(
632
+ L || j || B || z ? /* @__PURE__ */ e.jsx(
622
633
  ie,
623
634
  {
624
635
  styles: {
@@ -626,21 +637,21 @@ function Re(dt) {
626
637
  description: y?.description
627
638
  },
628
639
  classNames: {
629
- title: O?.title,
630
- description: O?.description
640
+ title: D?.title,
641
+ description: D?.description
631
642
  },
632
- graphTitle: D,
643
+ graphTitle: L,
633
644
  graphDescription: j,
634
645
  width: m,
635
646
  graphDownload: B ? mt.current : void 0,
636
- dataDownload: z ? T.map((d) => d.data).filter((d) => d !== void 0).length > 0 ? T.map((d) => d.data).filter((d) => d !== void 0) : T.filter((d) => d !== void 0) : null
647
+ dataDownload: z ? $.map((d) => d.data).filter((d) => d !== void 0).length > 0 ? $.map((d) => d.data).filter((d) => d !== void 0) : $.filter((d) => d !== void 0) : null
637
648
  }
638
649
  ) : null,
639
- /* @__PURE__ */ e.jsx("div", { className: "grow flex flex-col justify-center gap-3 w-full", children: T.length === 0 ? /* @__PURE__ */ e.jsx(ne, {}) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
650
+ /* @__PURE__ */ e.jsx("div", { className: "grow flex flex-col justify-center gap-3 w-full", children: $.length === 0 ? /* @__PURE__ */ e.jsx(ne, {}) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
640
651
  G && n ? /* @__PURE__ */ e.jsx(
641
652
  ae,
642
653
  {
643
- colorDomain: C,
654
+ colorDomain: b,
644
655
  colorLegendTitle: p,
645
656
  labelsToBeHidden: _,
646
657
  colors: V,
@@ -650,12 +661,12 @@ function Re(dt) {
650
661
  /* @__PURE__ */ e.jsx("div", { className: "w-full grow leading-0", ref: f, "aria-label": "Graph area", children: (m || M) && (I || ct) ? /* @__PURE__ */ e.jsx(
651
662
  re,
652
663
  {
653
- data: T,
664
+ data: $,
654
665
  lineColors: V,
655
666
  width: m || M,
656
667
  height: Math.max(
657
668
  k,
658
- I || (A ? k ? (m || M) * A > k ? (m || M) * A : k : (m || M) * A : ct)
669
+ I || (O ? k ? (m || M) * O > k ? (m || M) * O : k : (m || M) * O : ct)
659
670
  ),
660
671
  dateFormat: R,
661
672
  noOfXTicks: H,
@@ -663,12 +674,12 @@ function Re(dt) {
663
674
  rightMargin: K,
664
675
  topMargin: ft,
665
676
  bottomMargin: F,
666
- labels: C,
677
+ labels: b,
667
678
  tooltip: Q,
668
679
  onSeriesMouseOver: o,
669
680
  showColorLegendAtTop: n ? G : !0,
670
681
  showValues: E,
671
- suffix: $,
682
+ suffix: C,
672
683
  prefix: xt,
673
684
  highlightAreaSettings: pt,
674
685
  refValues: ut,
@@ -683,11 +694,11 @@ function Re(dt) {
683
694
  customHighlightAreaSettings: et,
684
695
  yAxisTitle: at,
685
696
  noOfYTicks: h,
686
- minDate: b,
697
+ minDate: A,
687
698
  maxDate: Ct,
688
699
  curveType: bt,
689
700
  styles: y,
690
- classNames: O,
701
+ classNames: D,
691
702
  dimmedOpacity: ot,
692
703
  precision: nt,
693
704
  customLayers: st,
@@ -703,8 +714,8 @@ function Re(dt) {
703
714
  {
704
715
  styles: { footnote: y?.footnote, source: y?.source },
705
716
  classNames: {
706
- footnote: O?.footnote,
707
- source: O?.source
717
+ footnote: D?.footnote,
718
+ source: D?.source
708
719
  },
709
720
  sources: l,
710
721
  footNote: J,