@undp/data-viz 1.5.6 → 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 (88) 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/ThreeDGlobe.cjs +1 -1
  66. package/dist/ThreeDGlobe.cjs.map +1 -1
  67. package/dist/ThreeDGlobe.js +284 -349
  68. package/dist/ThreeDGlobe.js.map +1 -1
  69. package/dist/UnitChart.cjs +1 -1
  70. package/dist/UnitChart.cjs.map +1 -1
  71. package/dist/UnitChart.js +20 -21
  72. package/dist/UnitChart.js.map +1 -1
  73. package/dist/getCentroidCoordinates-Dfk6IqEG.js +70 -0
  74. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -0
  75. package/dist/getCentroidCoordinates-DxTBqzp2.cjs +2 -0
  76. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -0
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.d.ts +7 -0
  79. package/dist/index.js +34 -32
  80. package/dist/index.js.map +1 -1
  81. package/dist/utils.cjs +1 -1
  82. package/dist/utils.d.ts +8 -0
  83. package/dist/utils.js +16 -14
  84. package/dist/utils.js.map +1 -1
  85. package/package.json +1 -1
  86. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  87. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  88. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MultiLineAltChart.js","sources":["../src/Components/Graphs/LineCharts/MultiLineAltChart/Graph.tsx","../src/Components/Graphs/LineCharts/MultiLineAltChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveLinear,\r\n curveMonotoneX,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { ascending, sort } from 'd3-array';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Delaunay } from 'd3-delaunay';\r\nimport { motion, useInView } from 'motion/react';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n MultiLineAltChartDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineAltChartDataType[];\r\n lineColors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showLabels: boolean;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n colorDomain: (string | number)[];\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n selectedColor?: string;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n naLabel: string;\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n label: number | string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n dateFormat,\r\n noOfXTicks,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n leftMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n highlightAreaSettings,\r\n minValue,\r\n maxValue,\r\n highlightedLines,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n colorDomain,\r\n selectedColor,\r\n classNames,\r\n showLabels,\r\n dimmedOpacity,\r\n precision,\r\n naLabel,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n const dataFormatted = orderBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n ['date'],\r\n ['asc'],\r\n ).filter(d => !checkIfNullOrUndefined(d.y));\r\n const labels = uniqBy(dataFormatted, 'label', true) as (string | number)[];\r\n const dates = sort(\r\n uniqBy(data, 'date', true).map(d => parse(`${d}`, dateFormat, new Date())),\r\n (a, b) => ascending(a, b),\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const lineArray = labels.map(d =>\r\n orderBy(\r\n dataFormatted.filter(el => el.label == d),\r\n ['date'],\r\n ['asc'],\r\n ),\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dates[0];\r\n const maxYear = maxDate ? parse(`${maxDate}`, dateFormat, new Date()) : dates[dates.length - 1];\r\n const minParam: number = checkIfNullOrUndefined(minValue)\r\n ? Math.min(...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]))\r\n ? (Math.min(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number) > 0\r\n ? 0\r\n : (Math.min(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number)\r\n : 0\r\n : (minValue as number);\r\n const maxParam: number = (Math.max(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number)\r\n ? (Math.max(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number)\r\n : 0;\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const voronoiDiagram = Delaunay.from(\r\n dataFormatted.filter(d => !checkIfNullOrUndefined(d.date) && !checkIfNullOrUndefined(d.y)),\r\n d => x(d.date),\r\n d => y(d.y as number),\r\n ).voronoi([0, 0, graphWidth < 0 ? 0 : graphWidth, graphHeight < 0 ? 0 : graphHeight]);\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <motion.g>\r\n {lineArray.map(d => (\r\n <motion.g\r\n key={d[0].label}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: mouseOverData\r\n ? d[0].label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d[0].color\r\n ? lineColors[colorDomain.indexOf(d[0].color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(d[0].label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: mouseOverData\r\n ? d[0].label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d[0].color\r\n ? lineColors[colorDomain.indexOf(d[0].color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(d[0].label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <motion.path\r\n d={\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || ''\r\n }\r\n style={{\r\n fill: 'none',\r\n strokeWidth: mouseOverData\r\n ? d[0].label === mouseOverData.label\r\n ? strokeWidth + Math.max(2, 0.5 * strokeWidth)\r\n : strokeWidth\r\n : highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(d[0].label) !== -1\r\n ? strokeWidth + Math.max(2, 0.5 * strokeWidth)\r\n : strokeWidth\r\n : strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.map((el, j) => (\r\n <motion.g key={j}>\r\n {!checkIfNullOrUndefined(el.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={graphWidth / d.length < 5 ? 0 : graphWidth / d.length < 20 ? 2 : 4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n {(highlightedLines.indexOf(d[0].label) !== -1 ||\r\n mouseOverData?.label === d[0].label) &&\r\n showLabels ? (\r\n <motion.text\r\n style={{\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n }}\r\n className='text-sm font-bold'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {d[0].label}\r\n </motion.text>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n {mouseOverData ? (\r\n <text\r\n y={y(mouseOverData.y) - 8}\r\n x={x(mouseOverData.date)}\r\n className={cn('graph-value text-sm font-bold', classNames?.graphObjectValues)}\r\n style={{\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !mouseOverData.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(mouseOverData.color)],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(mouseOverData.y, naLabel, precision, prefix, suffix)}\r\n </text>\r\n ) : null}\r\n </motion.g>\r\n {dataFormatted\r\n .filter(d => !checkIfNullOrUndefined(d.y))\r\n .map((d, i) => {\r\n return (\r\n <g key={i}>\r\n <path\r\n d={voronoiDiagram.renderCell(\r\n dataFormatted.findIndex(el => el.label === d.label && el.date === d.date),\r\n )}\r\n opacity={0}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n MultiLineAltChartDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineAltChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for lines */\r\n colors?: string | string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: (string | number)[];\r\n /** Toggle the visibility of labels of the lines when highlighted or mouse hovered */\r\n showLabels?: boolean;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Defines how “NA” values should be displayed/labelled in the graph */\r\n naLabel?: string;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function MultiLineAltChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n showNAColor = true,\r\n colors,\r\n colorDomain,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n padding,\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n showColorScale = true,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n showLabels = true,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n highlightedLines = [],\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n colorLegendTitle,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n naLabel = 'NA',\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a multi-line chart that shows trends over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n dateFormat={dateFormat}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n suffix={suffix}\r\n prefix={prefix}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n highlightedLines={highlightedLines}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n selectedColor={selectedColor}\r\n showLabels={showLabels}\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain || (uniqBy(data, 'color', true) as string[])\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n naLabel={naLabel}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","dateFormat","noOfXTicks","rightMargin","topMargin","bottomMargin","suffix","prefix","leftMargin","tooltip","onSeriesMouseOver","refValues","highlightAreaSettings","minValue","maxValue","highlightedLines","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","colorDomain","selectedColor","classNames","showLabels","dimmedOpacity","precision","naLabel","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","dataFormatted","orderBy","d","parse","checkIfNullOrUndefined","labels","uniqBy","dates","sort","a","b","ascending","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","lineArray","el","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","voronoiDiagram","Delaunay","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","Colors","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","MultiLineAltChart","graphTitle","showNAColor","colors","sources","graphDescription","footNote","padding","backgroundColor","showColorScale","relativeHeight","graphID","graphDownload","dataDownload","language","colorLegendTitle","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmGO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEvC,IACEwC,KAASC,GAAO,IAAI,GACpBC,IAAWC,GAAUH,IAAQ;AAAA,IACjC,MAAMpB,EAAQ;AAAA,IACd,QAAQA,EAAQ;AAAA,EAAA,CAC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,IACrCA,KAAW,EAAE,UAAU,GAAG,MAAM,IAAM,QAAQ,EAAA;AAAA,sBAEpD,KAAKsH,MAAa,QAAQA,MAAa;AAAA,sBACvC,aAAApH;AAAA,sBACA,UAAAC;AAAA,sBACA,aAAAC;AAAA,sBACA,6BAAAC;AAAA,sBACA,YAAAC;AAAA,sBACA,YAAAC;AAAA,sBACA,SAAAC;AAAA,sBACA,SAAAC;AAAA,sBACA,WAAAC;AAAA,sBACA,QAAAC;AAAA,sBACA,YAAAG;AAAA,sBACA,eAAAD;AAAA,sBACA,YAAAE;AAAA,sBACA,aACElC,EAAK,OAAO,CAAA2E,MAAMA,EAAG,KAAK,EAAE,WAAW,IACnC,CAAA,IACA5C,KAAgB6B,GAAO5D,GAAM,SAAS,EAAI;AAAA,sBAEhD,eAAAmC;AAAA,sBACA,WAAAC;AAAA,sBACA,cAAAE;AAAA,sBACA,SAAAD;AAAA,oBAAA;AAAA,kBAAA,IAEA,KAAA,CACN;AAAA,gBAAA,EAAA,CACF,EAAA,CAEJ;AAAA,gBACC0F,KAAWE,IACVzB,gBAAAA,EAAAA;AAAAA,kBAACkD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAU5H,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUG,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAA8F;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAhI;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"MultiLineAltChart.js","sources":["../src/Components/Graphs/LineCharts/MultiLineAltChart/Graph.tsx","../src/Components/Graphs/LineCharts/MultiLineAltChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveLinear,\r\n curveMonotoneX,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { ascending, sort } from 'd3-array';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Delaunay } from 'd3-delaunay';\r\nimport { motion, useInView } from 'motion/react';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n MultiLineAltChartDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineAltChartDataType[];\r\n lineColors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showLabels: boolean;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n colorDomain: (string | number)[];\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n selectedColor?: string;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n naLabel: string;\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n label: number | string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n dateFormat,\r\n noOfXTicks,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n leftMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n highlightAreaSettings,\r\n minValue,\r\n maxValue,\r\n highlightedLines,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n colorDomain,\r\n selectedColor,\r\n classNames,\r\n showLabels,\r\n dimmedOpacity,\r\n precision,\r\n naLabel,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n const dataFormatted = orderBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n ['date'],\r\n ['asc'],\r\n ).filter(d => !checkIfNullOrUndefined(d.y));\r\n const labels = uniqBy(dataFormatted, 'label', true) as (string | number)[];\r\n const dates = sort(\r\n uniqBy(data, 'date', true).map(d => parse(`${d}`, dateFormat, new Date())),\r\n (a, b) => ascending(a, b),\r\n );\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const lineArray = labels.map(d =>\r\n orderBy(\r\n dataFormatted.filter(el => el.label == d),\r\n ['date'],\r\n ['asc'],\r\n ),\r\n );\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dates[0];\r\n const maxYear = maxDate ? parse(`${maxDate}`, dateFormat, new Date()) : dates[dates.length - 1];\r\n const minParam: number = checkIfNullOrUndefined(minValue)\r\n ? Math.min(...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]))\r\n ? (Math.min(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number) > 0\r\n ? 0\r\n : (Math.min(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number)\r\n : 0\r\n : (minValue as number);\r\n const maxParam: number = (Math.max(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number)\r\n ? (Math.max(\r\n ...(dataFormatted.map(d => d.y).filter(d => !checkIfNullOrUndefined(d)) as number[]),\r\n ) as number)\r\n : 0;\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const voronoiDiagram = Delaunay.from(\r\n dataFormatted.filter(d => !checkIfNullOrUndefined(d.date) && !checkIfNullOrUndefined(d.y)),\r\n d => x(d.date),\r\n d => y(d.y as number),\r\n ).voronoi([0, 0, graphWidth < 0 ? 0 : graphWidth, graphHeight < 0 ? 0 : graphHeight]);\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <motion.g>\r\n {lineArray.map(d => (\r\n <motion.g\r\n key={d[0].label}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: mouseOverData\r\n ? d[0].label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d[0].color\r\n ? lineColors[colorDomain.indexOf(d[0].color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(d[0].label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: mouseOverData\r\n ? d[0].label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d[0].color\r\n ? lineColors[colorDomain.indexOf(d[0].color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(d[0].label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <motion.path\r\n d={\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || ''\r\n }\r\n style={{\r\n fill: 'none',\r\n strokeWidth: mouseOverData\r\n ? d[0].label === mouseOverData.label\r\n ? strokeWidth + Math.max(2, 0.5 * strokeWidth)\r\n : strokeWidth\r\n : highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(d[0].label) !== -1\r\n ? strokeWidth + Math.max(2, 0.5 * strokeWidth)\r\n : strokeWidth\r\n : strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.map((el, j) => (\r\n <motion.g key={j}>\r\n {!checkIfNullOrUndefined(el.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={graphWidth / d.length < 5 ? 0 : graphWidth / d.length < 20 ? 2 : 4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n {(highlightedLines.indexOf(d[0].label) !== -1 ||\r\n mouseOverData?.label === d[0].label) &&\r\n showLabels ? (\r\n <motion.text\r\n className='text-sm font-bold'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d[0].color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d[0].color)],\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {d[0].label}\r\n </motion.text>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n {mouseOverData ? (\r\n <text\r\n y={y(mouseOverData.y) - 8}\r\n x={x(mouseOverData.date)}\r\n className={cn('graph-value text-sm font-bold', classNames?.graphObjectValues)}\r\n style={{\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !mouseOverData.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(mouseOverData.color)],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {numberFormattingFunction(mouseOverData.y, naLabel, precision, prefix, suffix)}\r\n </text>\r\n ) : null}\r\n </motion.g>\r\n {dataFormatted\r\n .filter(d => !checkIfNullOrUndefined(d.y))\r\n .map((d, i) => {\r\n return (\r\n <g key={i}>\r\n <path\r\n d={voronoiDiagram.renderCell(\r\n dataFormatted.findIndex(el => el.label === d.label && el.date === d.date),\r\n )}\r\n opacity={0}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n />\r\n </g>\r\n );\r\n })}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n MultiLineAltChartDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineAltChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for lines */\r\n colors?: string | string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: (string | number)[];\r\n /** Toggle the visibility of labels of the lines when highlighted or mouse hovered */\r\n showLabels?: boolean;\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Defines how “NA” values should be displayed/labelled in the graph */\r\n naLabel?: string;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function MultiLineAltChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n showNAColor = true,\r\n colors,\r\n colorDomain,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n padding,\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n showColorScale = true,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n showLabels = true,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n highlightedLines = [],\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n colorLegendTitle,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n naLabel = 'NA',\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a multi-line chart that shows trends over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n dateFormat={dateFormat}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n suffix={suffix}\r\n prefix={prefix}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n highlightedLines={highlightedLines}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n selectedColor={selectedColor}\r\n showLabels={showLabels}\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain || (uniqBy(data, 'color', true) as string[])\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n naLabel={naLabel}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","dateFormat","noOfXTicks","rightMargin","topMargin","bottomMargin","suffix","prefix","leftMargin","tooltip","onSeriesMouseOver","refValues","highlightAreaSettings","minValue","maxValue","highlightedLines","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","colorDomain","selectedColor","classNames","showLabels","dimmedOpacity","precision","naLabel","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","dataFormatted","orderBy","d","parse","checkIfNullOrUndefined","labels","uniqBy","dates","sort","a","b","ascending","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","lineArray","el","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","voronoiDiagram","Delaunay","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","Colors","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","MultiLineAltChart","graphTitle","showNAColor","colors","sources","graphDescription","footNote","padding","backgroundColor","showColorScale","relativeHeight","graphID","graphDownload","dataDownload","language","colorLegendTitle","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmGO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA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ACA,YAAAE;AAAA,sBACA,aACElC,EAAK,OAAO,CAAA2E,MAAMA,EAAG,KAAK,EAAE,WAAW,IACnC,CAAA,IACA5C,KAAgB6B,GAAO5D,GAAM,SAAS,EAAI;AAAA,sBAEhD,eAAAmC;AAAA,sBACA,WAAAC;AAAA,sBACA,cAAAE;AAAA,sBACA,SAAAD;AAAA,oBAAA;AAAA,kBAAA,IAEA,KAAA,CACN;AAAA,gBAAA,EAAA,CACF,EAAA,CAEJ;AAAA,gBACC0F,KAAWE,IACVzB,gBAAAA,EAAAA;AAAAA,kBAACkD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAU5H,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUG,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAA8F;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAhI;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),m=require("./parse-hMnG_lRV.cjs"),Ie=require("./index-CQ3e6Ewi.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),Se=require("./Tooltip-De16GWhY.cjs"),h=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),be=require("./customArea-CK768gCn.cjs"),De=require("./AxisTitle-CK9YeovX.cjs"),Te=require("./Axis-DE7dSn1_.cjs"),qe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),$e=require("./ReferenceLine-CFVBBN__.cjs"),Me=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ve=require("./index-BYzIB5V6.cjs"),Fe=require("./time-Byw_jYQ7.cjs"),He=require("./linear-BVckp9RD.cjs"),Le=require("./line-DHV4JwCR.cjs"),xe=require("./step-BZ3C8QFW.cjs"),Ue=require("./select-Bnfk0lJx.cjs"),Ge=require("./init-DU0ybBc_.cjs"),Pe=require("./pointer-Dkq5NV1q.cjs"),We=require("./use-in-view-sQJZ_xDO.cjs"),T=require("./proxy-BHRoeZgd.cjs"),Ye=require("./GraphFooter.cjs"),Xe=require("./GraphHeader.cjs"),Be=require("./ColorLegend.cjs"),ze=require("./Colors.cjs"),_e=require("./EmptyState-d8_8SxeW.cjs"),Je=require("./generateRandomString-B5zBiJzS.cjs");function Ke(ue){const{data:N,width:A,height:q,lineColors:L,dateFormat:l,noOfXTicks:de,labels:R,rightMargin:$,topMargin:x,bottomMargin:_,suffix:M,prefix:V,leftMargin:E,tooltip:G,onSeriesMouseOver:P,showValues:k,showColorLegendAtTop:me,refValues:J,highlightAreaSettings:he,minValue:F,maxValue:K,highlightedLines:b,animate:s,rtl:W,strokeWidth:pe,showDots:ge,annotations:fe,customHighlightAreaSettings:ye,yAxisTitle:Q,noOfYTicks:je,minDate:Y,maxDate:X,curveType:I,styles:c,classNames:y,dimmedOpacity:S,precision:H,customLayers:Z,dashedLines:B,dashSettings:ee,labelsToBeHidden:we,revealClipId:te}=ue,ie=f.useRef(null),u=We.useInView(ie,{once:s.once,amount:s.amount}),[O,ve]=f.useState(!1);f.useEffect(()=>{if(u&&!O){const e=setTimeout(()=>{ve(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[u,O,s.duration]);const Re=I==="linear"?Le.curveLinear:I==="step"?xe.curveStep:I==="stepAfter"?xe.stepAfter:I==="stepBefore"?xe.stepBefore:xe.monotoneX,[j,C]=f.useState(void 0),[ne,se]=f.useState(void 0),[re,ae]=f.useState(void 0),w={top:x,bottom:_,left:Q?E+30:E,right:$},z=f.useRef(null),r=Ie.orderBy(N.map(e=>({...e,date:m.parse(`${e.date}`,l,new Date)})),["date"],["asc"]),D=r[0].y.map((e,i)=>r.map(n=>({...n,y:n.y[i]})).filter(n=>!h.checkIfNullOrUndefined(n.y))),oe=he.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,l,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,l,new Date)]})),le=ye.map(e=>({...e,coordinates:e.coordinates.map((i,n)=>n%2===0?m.parse(`${i}`,l,new Date):i)})),p=A-w.left-w.right,g=q-w.top-w.bottom,ce=Y?m.parse(`${Y}`,l,new Date):r[0].date,d=X?m.parse(`${X}`,l,new Date):r[r.length-1].date,v=h.checkIfNullOrUndefined(F)?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))>0?0:Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0:F,Ee=Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0,a=Fe.time().domain([ce,d]).range([0,p]),o=He.linear().domain([h.checkIfNullOrUndefined(F)?v:F,h.checkIfNullOrUndefined(K)?Ee>0?Ee:0:K]).range([g,0]).nice(),Ce=Le.line().x(e=>a(e.date)).y(e=>o(e.y)).curve(Re),Ae=o.ticks(je),ke=a.ticks(de);return f.useEffect(()=>{const e=n=>{const U=r[Ge.bisectCenter(r.map(Oe=>Oe.date),a.invert(Pe.pointer(n)[0]),0)];C(U||r[r.length-1]),ae(n.clientY),se(n.clientX),P?.(U||r[r.length-1])},i=()=>{C(void 0),se(void 0),ae(void 0)};Ue.select(z.current).on("mousemove",e).on("mouseout",i),P?.(void 0)},[a,r,P]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(T.motion.svg,{width:`${A}px`,height:`${q}px`,viewBox:`0 0 ${A} ${q}`,direction:"ltr",ref:ie,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[t.jsxRuntimeExports.jsx("defs",{children:t.jsxRuntimeExports.jsx("clipPath",{id:te,children:t.jsxRuntimeExports.jsx(T.motion.rect,{x:0,y:0,height:g,variants:{initial:{width:0},whileInView:{width:p,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial"})})}),t.jsxRuntimeExports.jsx(Ve.HighlightArea,{areaSettings:oe,width:p,height:g,scale:a,animate:s,isInView:u}),t.jsxRuntimeExports.jsx(be.CustomArea,{areaSettings:le,scaleX:a,scaleY:o,animate:s,isInView:u}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Me.YTicksAndGridLines,{values:Ae.filter(e=>e!==0),y:Ae.filter(e=>e!==0).map(e=>o(e)),x1:0-E,x2:p+w.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:M,prefix:V,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:H}),t.jsxRuntimeExports.jsx(Te.Axis,{y1:o(v<0?0:v),y2:o(v<0?0:v),x1:0-E,x2:p+w.right,label:Ne.numberFormattingFunction(v<0?0:v,"NA",H,V,M),labelPos:{x:0-E,y:o(v<0?0:v),dx:0,dy:Ee<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(De.AxisTitle,{x:0-E-15,y:g/2,style:c?.yAxis?.title,className:y?.yAxis?.title,text:Q,rotate90:!0})]}),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx(qe.XTicksAndGridLines,{values:ke.map(e=>m.format(e,l)),x:ke.map(e=>a(e)),y1:0,y2:g,styles:{gridLines:c?.xAxis?.gridLines,labels:c?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",y?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",y?.xAxis?.labels)},suffix:M,prefix:V,labelType:"primary",showGridLines:!0,precision:H})}),Z.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[D.map((e,i)=>t.jsxRuntimeExports.jsxs(T.motion.g,{exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:b.length!==0?b.indexOf(R[i])!==-1?1:S:1},whileInView:{opacity:b.length!==0?b.indexOf(R[i])!==-1?1:S:1,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx(T.motion.path,{style:{fill:"none",strokeWidth:pe},clipPath:`url(#${te})`,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{...B.length===0?{pathLength:0}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:L[i]},whileInView:{...B.length===0?{pathLength:1}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:L[i],transition:{duration:s.duration}}},strokeDasharray:B.includes(R[i])?ee[i%ee.length]:void 0,initial:"initial",animate:u?"whileInView":"initial"}),e.map((n,U)=>t.jsxRuntimeExports.jsx("g",{children:h.checkIfNullOrUndefined(n.y)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ge?t.jsxRuntimeExports.jsx(T.motion.circle,{r:p/r.length<5?0:p/r.length<20?2:4,style:{fill:L[i]},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:a(n.date),cy:o(n.y)},whileInView:{opacity:1,transition:{duration:O?s.duration:.5,delay:O?0:s.duration},cx:a(n.date),cy:o(n.y)}},initial:"initial",animate:u?"whileInView":"initial"}):null,k?t.jsxRuntimeExports.jsx(T.motion.text,{dy:-8,style:{fill:L[i],textAnchor:"middle",...c?.graphObjectValues||{}},className:t.mo("graph-value text-xs font-bold",y?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:a(n.date),y:o(n.y)},whileInView:{opacity:1,x:a(n.date),y:o(n.y),transition:{duration:O?s.duration:.5,delay:O?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:Ne.numberFormattingFunction(n.y,"NA",H,V,M)}):null]})},U)),me||we.includes(R[i])?null:t.jsxRuntimeExports.jsx(T.motion.text,{style:{fill:L[i]},className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:a(e[e.length-1].date),y:o(e[e.length-1].y)},whileInView:{opacity:1,x:a(e[e.length-1].date),y:o(e[e.length-1].y),transition:{duration:O?s.duration:.5,delay:O?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:R[i]})]},R[i])),j?t.jsxRuntimeExports.jsx("line",{y1:0,y2:g,x1:a(j.date),x2:a(j.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",y?.mouseOverLine),style:c?.mouseOverLine}):null]}),J?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:J.map((e,i)=>t.jsxRuntimeExports.jsx($e.RefLineY,{text:e.text,color:e.color,y:o(e.value),x1:0-E,x2:p+w.right,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i))}):null,t.jsxRuntimeExports.jsx("g",{children:fe.map((e,i)=>{const n=be.getLineEndPoint({x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,y:e.yCoordinate?o(e.yCoordinate):0},h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),U=e.showConnector?{y1:n.y,x1:n.x,y2:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?o(e.yCoordinate):0,cx:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,circleRadius:h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,Oe={y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0):p+w.right-(e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(be.Annotation,{color:e.color,connectorsSettings:U,labelSettings:Oe,text:e.text,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i)})}),Z.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:z,style:{fill:"none",pointerEvents:"all"},width:p,height:g})]})}),j&&G&&ne&&re?t.jsxRuntimeExports.jsx(Se.Tooltip,{data:j,body:G,xPos:ne,yPos:re,backgroundStyle:c?.tooltip,className:y?.tooltip}):null]})}function Qe(ue){const{data:N,graphTitle:A,lineColors:q=ze.Colors.light.categoricalColors.colors,suffix:L="",sources:l,prefix:de="",graphDescription:R,height:$,width:x,footNote:_,noOfXTicks:M=10,dateFormat:V="yyyy",labels:E,padding:G,showValues:P=!1,backgroundColor:k=!1,leftMargin:me=30,rightMargin:J=50,topMargin:he=20,bottomMargin:F=25,tooltip:K,relativeHeight:b,onSeriesMouseOver:s,showColorLegendAtTop:W=!1,refValues:pe=[],highlightAreaSettings:ge=[],graphID:fe,minValue:ye,maxValue:Q,highlightedLines:je=[],graphDownload:Y=!1,dataDownload:X=!1,animate:I=!1,language:c="en",colorLegendTitle:y,minHeight:S=0,strokeWidth:H=2,showDots:Z=!0,annotations:B=[],customHighlightAreaSettings:ee=[],theme:we="light",ariaLabel:te,yAxisTitle:ie,noOfYTicks:u=5,minDate:O,maxDate:ve,curveType:Re="curve",styles:j,classNames:C,dimmedOpacity:ne=.3,precision:se=2,customLayers:re=[],dashedLines:ae=[],dashSettings:w=["5 5"],labelsToBeHidden:z=[],showColorScale:r=!0}=ue,[D,oe]=f.useState(0),[le,p]=f.useState(0),g=f.useRef(null),ce=f.useRef(null);return f.useEffect(()=>{const d=new ResizeObserver(v=>{oe(x||v[0].target.clientWidth||620),p($||v[0].target.clientHeight||480)});return g.current&&(p(g.current.clientHeight||480),oe(g.current.clientWidth||620),x||d.observe(g.current)),()=>d.disconnect()},[x,$]),t.jsxRuntimeExports.jsx("div",{className:`${we||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${k?k===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,x?"w-fit":"w-full",C?.graphContainer),style:{...j?.graphContainer||{},...k&&k!==!0?{backgroundColor:k}:{}},id:fe,ref:ce,"aria-label":te||`${A?`The graph shows ${A}. `:""}This is a multi-line chart that shows trends over time.${R?` ${R}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:k?G||"1rem":G||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[A||R||Y||X?t.jsxRuntimeExports.jsx(Xe.GraphHeader,{styles:{title:j?.title,description:j?.description},classNames:{title:C?.title,description:C?.description},graphTitle:A,graphDescription:R,width:x,graphDownload:Y?ce.current:void 0,dataDownload:X?N.map(d=>d.data).filter(d=>d!==void 0).length>0?N.map(d=>d.data).filter(d=>d!==void 0):N.filter(d=>d!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:N.length===0?t.jsxRuntimeExports.jsx(_e.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[W&&r?t.jsxRuntimeExports.jsx(Be.ColorLegend,{colorDomain:E,colorLegendTitle:y,labelsToBeHidden:z,colors:q,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:g,"aria-label":"Graph area",children:(x||D)&&($||le)?t.jsxRuntimeExports.jsx(Ke,{data:N,lineColors:q,width:x||D,height:Math.max(S,$||(b?S?(x||D)*b>S?(x||D)*b:S:(x||D)*b:le)),dateFormat:V,noOfXTicks:M,leftMargin:me,rightMargin:J,topMargin:he,bottomMargin:F,labels:E,tooltip:K,onSeriesMouseOver:s,showColorLegendAtTop:r?W:!0,showValues:P,suffix:L,prefix:de,highlightAreaSettings:ge,refValues:pe,minValue:ye,maxValue:Q,highlightedLines:je,animate:I===!0?{duration:.5,once:!0,amount:.5}:I||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:H,showDots:Z,annotations:B,customHighlightAreaSettings:ee,yAxisTitle:ie,noOfYTicks:u,minDate:O,maxDate:ve,curveType:Re,styles:j,classNames:C,dimmedOpacity:ne,precision:se,customLayers:re,labelsToBeHidden:z,dashedLines:ae,dashSettings:w,revealClipId:Je.generateRandomString(8)}):null})]})}),l||_?t.jsxRuntimeExports.jsx(Ye.GraphFooter,{styles:{footnote:j?.footnote,source:j?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:l,footNote:_,width:x}):null]})})})})}exports.MultiLineChart=Qe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),m=require("./parse-hMnG_lRV.cjs"),Ie=require("./index-CQ3e6Ewi.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),Se=require("./Tooltip-De16GWhY.cjs"),h=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),be=require("./customArea-CK768gCn.cjs"),De=require("./AxisTitle-CK9YeovX.cjs"),Te=require("./Axis-DE7dSn1_.cjs"),qe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),$e=require("./ReferenceLine-CFVBBN__.cjs"),Me=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ve=require("./index-BYzIB5V6.cjs"),Fe=require("./time-Byw_jYQ7.cjs"),He=require("./linear-BVckp9RD.cjs"),Le=require("./line-DHV4JwCR.cjs"),xe=require("./step-BZ3C8QFW.cjs"),Ue=require("./select-Bnfk0lJx.cjs"),Ge=require("./init-DU0ybBc_.cjs"),Pe=require("./pointer-Dkq5NV1q.cjs"),We=require("./use-in-view-sQJZ_xDO.cjs"),T=require("./proxy-BHRoeZgd.cjs"),Ye=require("./GraphFooter.cjs"),Xe=require("./GraphHeader.cjs"),Be=require("./ColorLegend.cjs"),ze=require("./Colors.cjs"),_e=require("./EmptyState-d8_8SxeW.cjs"),Je=require("./generateRandomString-B5zBiJzS.cjs");function Ke(ue){const{data:L,width:k,height:q,lineColors:E,dateFormat:l,noOfXTicks:de,labels:R,rightMargin:$,topMargin:x,bottomMargin:_,suffix:M,prefix:V,leftMargin:O,tooltip:G,onSeriesMouseOver:P,showValues:N,showColorLegendAtTop:me,refValues:J,highlightAreaSettings:he,minValue:F,maxValue:K,highlightedLines:C,animate:s,rtl:W,strokeWidth:pe,showDots:ge,annotations:fe,customHighlightAreaSettings:ye,yAxisTitle:Q,noOfYTicks:je,minDate:Y,maxDate:X,curveType:I,styles:c,classNames:y,dimmedOpacity:S,precision:H,customLayers:Z,dashedLines:B,dashSettings:ee,labelsToBeHidden:we,revealClipId:te}=ue,ie=f.useRef(null),u=We.useInView(ie,{once:s.once,amount:s.amount}),[b,ve]=f.useState(!1);f.useEffect(()=>{if(u&&!b){const e=setTimeout(()=>{ve(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[u,b,s.duration]);const Re=I==="linear"?Le.curveLinear:I==="step"?xe.curveStep:I==="stepAfter"?xe.stepAfter:I==="stepBefore"?xe.stepBefore:xe.monotoneX,[j,A]=f.useState(void 0),[ne,se]=f.useState(void 0),[re,ae]=f.useState(void 0),w={top:x,bottom:_,left:Q?O+30:O,right:$},z=f.useRef(null),r=Ie.orderBy(L.map(e=>({...e,date:m.parse(`${e.date}`,l,new Date)})),["date"],["asc"]),D=r[0].y.map((e,i)=>r.map(n=>({...n,y:n.y[i]})).filter(n=>!h.checkIfNullOrUndefined(n.y))),oe=he.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,l,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,l,new Date)]})),le=ye.map(e=>({...e,coordinates:e.coordinates.map((i,n)=>n%2===0?m.parse(`${i}`,l,new Date):i)})),p=k-w.left-w.right,g=q-w.top-w.bottom,ce=Y?m.parse(`${Y}`,l,new Date):r[0].date,d=X?m.parse(`${X}`,l,new Date):r[r.length-1].date,v=h.checkIfNullOrUndefined(F)?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))>0?0:Math.min(...r.map(e=>Math.min(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0:F,Ee=Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i)))))?Math.max(...r.map(e=>Math.max(...e.y.filter(i=>!h.checkIfNullOrUndefined(i))))):0,a=Fe.time().domain([ce,d]).range([0,p]),o=He.linear().domain([h.checkIfNullOrUndefined(F)?v:F,h.checkIfNullOrUndefined(K)?Ee>0?Ee:0:K]).range([g,0]).nice(),Ce=Le.line().x(e=>a(e.date)).y(e=>o(e.y)).curve(Re),Ae=o.ticks(je),ke=a.ticks(de);return f.useEffect(()=>{const e=n=>{const U=r[Ge.bisectCenter(r.map(Oe=>Oe.date),a.invert(Pe.pointer(n)[0]),0)];A(U||r[r.length-1]),ae(n.clientY),se(n.clientX),P?.(U||r[r.length-1])},i=()=>{A(void 0),se(void 0),ae(void 0)};Ue.select(z.current).on("mousemove",e).on("mouseout",i),P?.(void 0)},[a,r,P]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(T.motion.svg,{width:`${k}px`,height:`${q}px`,viewBox:`0 0 ${k} ${q}`,direction:"ltr",ref:ie,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[t.jsxRuntimeExports.jsx("defs",{children:t.jsxRuntimeExports.jsx("clipPath",{id:te,children:t.jsxRuntimeExports.jsx(T.motion.rect,{x:0,y:0,height:g,variants:{initial:{width:0},whileInView:{width:p,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial"})})}),t.jsxRuntimeExports.jsx(Ve.HighlightArea,{areaSettings:oe,width:p,height:g,scale:a,animate:s,isInView:u}),t.jsxRuntimeExports.jsx(be.CustomArea,{areaSettings:le,scaleX:a,scaleY:o,animate:s,isInView:u}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Me.YTicksAndGridLines,{values:Ae.filter(e=>e!==0),y:Ae.filter(e=>e!==0).map(e=>o(e)),x1:0-O,x2:p+w.right,styles:{gridLines:c?.yAxis?.gridLines,labels:c?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:M,prefix:V,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:H}),t.jsxRuntimeExports.jsx(Te.Axis,{y1:o(v<0?0:v),y2:o(v<0?0:v),x1:0-O,x2:p+w.right,label:Ne.numberFormattingFunction(v<0?0:v,"NA",H,V,M),labelPos:{x:0-O,y:o(v<0?0:v),dx:0,dy:Ee<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:c?.xAxis?.axis,label:c?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(De.AxisTitle,{x:0-O-15,y:g/2,style:c?.yAxis?.title,className:y?.yAxis?.title,text:Q,rotate90:!0})]}),t.jsxRuntimeExports.jsx("g",{children:t.jsxRuntimeExports.jsx(qe.XTicksAndGridLines,{values:ke.map(e=>m.format(e,l)),x:ke.map(e=>a(e)),y1:0,y2:g,styles:{gridLines:c?.xAxis?.gridLines,labels:c?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",y?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",y?.xAxis?.labels)},suffix:M,prefix:V,labelType:"primary",showGridLines:!0,precision:H})}),Z.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[D.map((e,i)=>t.jsxRuntimeExports.jsxs(T.motion.g,{exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:C.length!==0?C.indexOf(R[i])!==-1?1:S:1},whileInView:{opacity:C.length!==0?C.indexOf(R[i])!==-1?1:S:1,transition:{duration:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:[t.jsxRuntimeExports.jsx(T.motion.path,{style:{fill:"none",strokeWidth:pe},clipPath:`url(#${te})`,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{...B.length===0?{pathLength:0}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:E[i]},whileInView:{...B.length===0?{pathLength:1}:{},d:Ce(e.filter(n=>!h.checkIfNullOrUndefined(n.y)))||"",opacity:1,stroke:E[i],transition:{duration:s.duration}}},strokeDasharray:B.includes(R[i])?ee[i%ee.length]:void 0,initial:"initial",animate:u?"whileInView":"initial"}),e.map((n,U)=>t.jsxRuntimeExports.jsx("g",{children:h.checkIfNullOrUndefined(n.y)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[ge?t.jsxRuntimeExports.jsx(T.motion.circle,{r:p/r.length<5?0:p/r.length<20?2:4,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,fill:E[i],cx:a(n.date),cy:o(n.y)},whileInView:{opacity:1,fill:E[i],transition:{duration:b?s.duration:.5,delay:b?0:s.duration},cx:a(n.date),cy:o(n.y)}},initial:"initial",animate:u?"whileInView":"initial"}):null,N?t.jsxRuntimeExports.jsx(T.motion.text,{dy:-8,style:{textAnchor:"middle",...c?.graphObjectValues||{}},className:t.mo("graph-value text-xs font-bold",y?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,fill:E[i],x:a(n.date),y:o(n.y)},whileInView:{opacity:1,fill:E[i],x:a(n.date),y:o(n.y),transition:{duration:b?s.duration:.5,delay:b?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:Ne.numberFormattingFunction(n.y,"NA",H,V,M)}):null]})},U)),me||we.includes(R[i])?null:t.jsxRuntimeExports.jsx(T.motion.text,{className:"text-xs",dx:5,dy:4,exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,fill:E[i],x:a(e[e.length-1].date),y:o(e[e.length-1].y)},whileInView:{opacity:1,fill:E[i],x:a(e[e.length-1].date),y:o(e[e.length-1].y),transition:{duration:b?s.duration:.5,delay:b?0:s.duration}}},initial:"initial",animate:u?"whileInView":"initial",children:R[i]})]},R[i])),j?t.jsxRuntimeExports.jsx("line",{y1:0,y2:g,x1:a(j.date),x2:a(j.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",y?.mouseOverLine),style:c?.mouseOverLine}):null]}),J?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:J.map((e,i)=>t.jsxRuntimeExports.jsx($e.RefLineY,{text:e.text,color:e.color,y:o(e.value),x1:0-O,x2:p+w.right,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i))}):null,t.jsxRuntimeExports.jsx("g",{children:fe.map((e,i)=>{const n=be.getLineEndPoint({x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,y:e.yCoordinate?o(e.yCoordinate):0},h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),U=e.showConnector?{y1:n.y,x1:n.x,y2:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?o(e.yCoordinate):0,cx:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date)):0,circleRadius:h.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,Oe={y:e.yCoordinate?o(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0):p+w.right-(e.xCoordinate?a(m.parse(`${e.xCoordinate}`,l,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(be.Annotation,{color:e.color,connectorsSettings:U,labelSettings:Oe,text:e.text,classNames:e.classNames,styles:e.styles,animate:s,isInView:u},i)})}),Z.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:z,style:{fill:"none",pointerEvents:"all"},width:p,height:g})]})}),j&&G&&ne&&re?t.jsxRuntimeExports.jsx(Se.Tooltip,{data:j,body:G,xPos:ne,yPos:re,backgroundStyle:c?.tooltip,className:y?.tooltip}):null]})}function Qe(ue){const{data:L,graphTitle:k,lineColors:q=ze.Colors.light.categoricalColors.colors,suffix:E="",sources:l,prefix:de="",graphDescription:R,height:$,width:x,footNote:_,noOfXTicks:M=10,dateFormat:V="yyyy",labels:O,padding:G,showValues:P=!1,backgroundColor:N=!1,leftMargin:me=30,rightMargin:J=50,topMargin:he=20,bottomMargin:F=25,tooltip:K,relativeHeight:C,onSeriesMouseOver:s,showColorLegendAtTop:W=!1,refValues:pe=[],highlightAreaSettings:ge=[],graphID:fe,minValue:ye,maxValue:Q,highlightedLines:je=[],graphDownload:Y=!1,dataDownload:X=!1,animate:I=!1,language:c="en",colorLegendTitle:y,minHeight:S=0,strokeWidth:H=2,showDots:Z=!0,annotations:B=[],customHighlightAreaSettings:ee=[],theme:we="light",ariaLabel:te,yAxisTitle:ie,noOfYTicks:u=5,minDate:b,maxDate:ve,curveType:Re="curve",styles:j,classNames:A,dimmedOpacity:ne=.3,precision:se=2,customLayers:re=[],dashedLines:ae=[],dashSettings:w=["5 5"],labelsToBeHidden:z=[],showColorScale:r=!0}=ue,[D,oe]=f.useState(0),[le,p]=f.useState(0),g=f.useRef(null),ce=f.useRef(null);return f.useEffect(()=>{const d=new ResizeObserver(v=>{oe(x||v[0].target.clientWidth||620),p($||v[0].target.clientHeight||480)});return g.current&&(p(g.current.clientHeight||480),oe(g.current.clientWidth||620),x||d.observe(g.current)),()=>d.disconnect()},[x,$]),t.jsxRuntimeExports.jsx("div",{className:`${we||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:c==="he"||c==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${N?N===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${c||"en"}`,x?"w-fit":"w-full",A?.graphContainer),style:{...j?.graphContainer||{},...N&&N!==!0?{backgroundColor:N}:{}},id:fe,ref:ce,"aria-label":te||`${k?`The graph shows ${k}. `:""}This is a multi-line chart that shows trends over time.${R?` ${R}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:N?G||"1rem":G||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[k||R||Y||X?t.jsxRuntimeExports.jsx(Xe.GraphHeader,{styles:{title:j?.title,description:j?.description},classNames:{title:A?.title,description:A?.description},graphTitle:k,graphDescription:R,width:x,graphDownload:Y?ce.current:void 0,dataDownload:X?L.map(d=>d.data).filter(d=>d!==void 0).length>0?L.map(d=>d.data).filter(d=>d!==void 0):L.filter(d=>d!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:L.length===0?t.jsxRuntimeExports.jsx(_e.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[W&&r?t.jsxRuntimeExports.jsx(Be.ColorLegend,{colorDomain:O,colorLegendTitle:y,labelsToBeHidden:z,colors:q,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:g,"aria-label":"Graph area",children:(x||D)&&($||le)?t.jsxRuntimeExports.jsx(Ke,{data:L,lineColors:q,width:x||D,height:Math.max(S,$||(C?S?(x||D)*C>S?(x||D)*C:S:(x||D)*C:le)),dateFormat:V,noOfXTicks:M,leftMargin:me,rightMargin:J,topMargin:he,bottomMargin:F,labels:O,tooltip:K,onSeriesMouseOver:s,showColorLegendAtTop:r?W:!0,showValues:P,suffix:E,prefix:de,highlightAreaSettings:ge,refValues:pe,minValue:ye,maxValue:Q,highlightedLines:je,animate:I===!0?{duration:.5,once:!0,amount:.5}:I||{duration:0,once:!0,amount:0},rtl:c==="he"||c==="ar",strokeWidth:H,showDots:Z,annotations:B,customHighlightAreaSettings:ee,yAxisTitle:ie,noOfYTicks:u,minDate:b,maxDate:ve,curveType:Re,styles:j,classNames:A,dimmedOpacity:ne,precision:se,customLayers:re,labelsToBeHidden:z,dashedLines:ae,dashSettings:w,revealClipId:Je.generateRandomString(8)}):null})]})}),l||_?t.jsxRuntimeExports.jsx(Ye.GraphFooter,{styles:{footnote:j?.footnote,source:j?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:l,footNote:_,width:x}):null]})})})})}exports.MultiLineChart=Qe;
2
2
  //# sourceMappingURL=MultiLineChart.cjs.map