@undp/data-viz 1.5.7 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/BarGraph.cjs +1 -1
  2. package/dist/BarGraph.cjs.map +1 -1
  3. package/dist/BarGraph.js +650 -648
  4. package/dist/BarGraph.js.map +1 -1
  5. package/dist/BulletChart.cjs +1 -1
  6. package/dist/BulletChart.cjs.map +1 -1
  7. package/dist/BulletChart.js +210 -208
  8. package/dist/BulletChart.js.map +1 -1
  9. package/dist/ButterflyChart.cjs +1 -1
  10. package/dist/ButterflyChart.cjs.map +1 -1
  11. package/dist/ButterflyChart.js +42 -40
  12. package/dist/ButterflyChart.js.map +1 -1
  13. package/dist/DifferenceLineChart.cjs +1 -1
  14. package/dist/DifferenceLineChart.cjs.map +1 -1
  15. package/dist/DifferenceLineChart.js +122 -120
  16. package/dist/DifferenceLineChart.js.map +1 -1
  17. package/dist/DualAxisLineChart.cjs +1 -1
  18. package/dist/DualAxisLineChart.cjs.map +1 -1
  19. package/dist/DualAxisLineChart.js +133 -113
  20. package/dist/DualAxisLineChart.js.map +1 -1
  21. package/dist/DumbbellChart.cjs +1 -1
  22. package/dist/DumbbellChart.cjs.map +1 -1
  23. package/dist/DumbbellChart.js +274 -274
  24. package/dist/DumbbellChart.js.map +1 -1
  25. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  26. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  27. package/dist/LineChartWithConfidenceInterval.js +194 -174
  28. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  29. package/dist/MultiLineAltChart.cjs +1 -1
  30. package/dist/MultiLineAltChart.cjs.map +1 -1
  31. package/dist/MultiLineAltChart.js +160 -161
  32. package/dist/MultiLineAltChart.js.map +1 -1
  33. package/dist/MultiLineChart.cjs +1 -1
  34. package/dist/MultiLineChart.cjs.map +1 -1
  35. package/dist/MultiLineChart.js +77 -66
  36. package/dist/MultiLineChart.js.map +1 -1
  37. package/dist/ParetoChart.cjs +1 -1
  38. package/dist/ParetoChart.cjs.map +1 -1
  39. package/dist/ParetoChart.js +166 -161
  40. package/dist/ParetoChart.js.map +1 -1
  41. package/dist/RadarChart.cjs +1 -1
  42. package/dist/RadarChart.cjs.map +1 -1
  43. package/dist/RadarChart.js +253 -241
  44. package/dist/RadarChart.js.map +1 -1
  45. package/dist/{RegressionLine-mH7UKOPi.js → RegressionLine-C2--oMQq.js} +10 -9
  46. package/dist/RegressionLine-C2--oMQq.js.map +1 -0
  47. package/dist/RegressionLine-Dj0GSiAp.cjs +2 -0
  48. package/dist/RegressionLine-Dj0GSiAp.cjs.map +1 -0
  49. package/dist/ScatterPlot.cjs +1 -1
  50. package/dist/ScatterPlot.cjs.map +1 -1
  51. package/dist/ScatterPlot.js +130 -129
  52. package/dist/ScatterPlot.js.map +1 -1
  53. package/dist/SimpleLineChart.cjs +1 -1
  54. package/dist/SimpleLineChart.cjs.map +1 -1
  55. package/dist/SimpleLineChart.js +43 -38
  56. package/dist/SimpleLineChart.js.map +1 -1
  57. package/dist/SlopeChart.cjs +1 -1
  58. package/dist/SlopeChart.cjs.map +1 -1
  59. package/dist/SlopeChart.js +113 -109
  60. package/dist/SlopeChart.js.map +1 -1
  61. package/dist/StripChart.cjs +1 -1
  62. package/dist/StripChart.cjs.map +1 -1
  63. package/dist/StripChart.js +282 -270
  64. package/dist/StripChart.js.map +1 -1
  65. package/dist/UnitChart.cjs +1 -1
  66. package/dist/UnitChart.cjs.map +1 -1
  67. package/dist/UnitChart.js +20 -21
  68. package/dist/UnitChart.js.map +1 -1
  69. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -1
  70. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -1
  71. package/package.json +1 -1
  72. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  73. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  74. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleLineChart.cjs","sources":["../src/Components/Graphs/LineCharts/LineChart/Graph.tsx","../src/Components/Graphs/LineCharts/LineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n curveLinear,\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 { linearRegression, linearRegressionLine } from 'simple-statistics';\r\nimport { cn } from '@undp/design-system-react/cn';\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 LineChartDataType,\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 { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { RegressionLine } from '@/Components/Elements/RegressionLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: LineChartDataType[];\r\n lineColor: string;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\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 refValues: ReferenceDataType[];\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n regressionLine: boolean | string;\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColor,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n highlightAreaSettings,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n regressionLine,\r\n yAxisTitle,\r\n noOfYTicks,\r\n maxDate,\r\n minDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\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 // 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 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 );\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()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) !==\r\n Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null))\r\n : 0;\r\n const maxParam: number =\r\n Math.max(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null))\r\n : 0;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n minParam,\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 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 onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n const regressionLineParam = linearRegression(\r\n dataFormatted\r\n .filter(d => !checkIfNullOrUndefined(d.date) && !checkIfNullOrUndefined(d.y))\r\n .map(d => [x(d.date), y(d.y as number)]),\r\n );\r\n const predict = linearRegressionLine(regressionLineParam);\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 <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 {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n style={{\r\n stroke: lineColor,\r\n fill: 'none',\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: lineShape(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape(dataFormatted) || '',\r\n opacity: 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 {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n </g>\r\n <g>\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColor }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y),\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 {numberFormattingFunction(d.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\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 <g>\r\n {regressionLine ? (\r\n <RegressionLine\r\n x1={0}\r\n x2={graphWidth}\r\n y1={predict(0)}\r\n y2={predict(graphWidth)}\r\n graphHeight={graphHeight}\r\n graphWidth={graphWidth}\r\n className={classNames?.regLine}\r\n style={styles?.regLine}\r\n color={typeof regressionLine === 'string' ? regressionLine : undefined}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\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 LineChartDataType,\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\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: LineChartDataType[];\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 /** Colors of the lines */\r\n lineColor?: 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 values */\r\n showValues?: boolean;\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 /** 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 /** Toggles the visibility of the regression line for the data. If the type is string then string is use to define the color of the line. */\r\n regressionLine?: boolean | string;\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 SimpleLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n lineColor,\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 showValues = false,\r\n padding,\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 30,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n maxDate,\r\n minDate,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n refValues = [],\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 regressionLine = false,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\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 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 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 {data.length === 0 ? (\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n <EmptyState />\r\n </div>\r\n ) : (\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColor={lineColor || Colors.primaryColors['blue-600']}\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 suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\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 highlightAreaSettings={highlightAreaSettings}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\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 regressionLine={regressionLine}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n maxDate={maxDate}\r\n minDate={minDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n )}\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","lineColor","suffix","prefix","dateFormat","highlightAreaSettings","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","refValues","minValue","maxValue","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","regressionLine","yAxisTitle","noOfYTicks","maxDate","minDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","regressionLineParam","linearRegression","predict","linearRegressionLine","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","RegressionLine","Tooltip","SimpleLineChart","graphTitle","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","Colors","GraphFooter"],"mappings":"oqCA0FO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,OAAAC,EACA,OA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G,GAAA,CACC,KAAAE,EACA,UAAWG,GAAawI,UAAO,cAAc,UAAU,EACvD,MAAO1I,GAASgI,EAChB,OAAQ,KAAK,IACXH,EACA5H,IACGuH,EACGK,GACG7H,GAASgI,GAAYR,EAAiBK,GACpC7H,GAASgI,GAAYR,EACtBK,GACD7H,GAASgI,GAAYR,EACxBU,GAAA,EAER,OAAA/H,EACA,OAAAC,EACA,WAAAC,EACA,WAAAE,GACA,WAAAC,GACA,WAAAE,EACA,YAAAD,EACA,UAAAE,EACA,aAAAC,EACA,QAAAC,EACA,sBAAAP,GACA,kBAAAQ,GACA,UAAAC,EACA,SAAAC,GACA,SAAAC,EACA,QACEC,IAAY,GACR,CAAE,SAAU,GAAK,KAAM,GAAM,OAAQ,EAAA,EACrCA,GAAW,CAAE,SAAU,EAAG,KAAM,GAAM,OAAQ,CAAA,EAEpD,IAAK0G,IAAa,MAAQA,IAAa,KACvC,YAAAxG,EACA,SAAAC,EACA,YAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,WAAAC,EACA,WAAAC,EACA,QAAAC,EACA,QAAAC,GACA,UAAAC,EACA,OAAAC,EACA,WAAAC,EACA,UAAAC,EACA,aAAAC,CAAA,CAAA,EAEA,IAAA,CAAA,EAGPkF,GAAWE,EACVxB,EAAAA,kBAAAA,IAAC8C,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAU7G,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAoF,EACA,SAAAE,EACA,MAAArH,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"SimpleLineChart.cjs","sources":["../src/Components/Graphs/LineCharts/LineChart/Graph.tsx","../src/Components/Graphs/LineCharts/LineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n curveLinear,\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 { linearRegression, linearRegressionLine } from 'simple-statistics';\r\nimport { cn } from '@undp/design-system-react/cn';\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 LineChartDataType,\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 { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { RegressionLine } from '@/Components/Elements/RegressionLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: LineChartDataType[];\r\n lineColor: string;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: string;\r\n dateFormat: string;\r\n showValues: boolean;\r\n noOfXTicks: number;\r\n rightMargin: number;\r\n leftMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\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 refValues: ReferenceDataType[];\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n regressionLine: boolean | string;\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColor,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n highlightAreaSettings,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n minValue,\r\n maxValue,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n regressionLine,\r\n yAxisTitle,\r\n noOfYTicks,\r\n maxDate,\r\n minDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n precision,\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 // 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 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 );\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()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) !==\r\n Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null))\r\n : 0;\r\n const maxParam: number =\r\n Math.max(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y).filter(d => d !== undefined && d !== null))\r\n : 0;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n minParam,\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 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 onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n const regressionLineParam = linearRegression(\r\n dataFormatted\r\n .filter(d => !checkIfNullOrUndefined(d.date) && !checkIfNullOrUndefined(d.y))\r\n .map(d => [x(d.date), y(d.y as number)]),\r\n );\r\n const predict = linearRegressionLine(regressionLineParam);\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 <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 {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n style={{\r\n stroke: lineColor,\r\n fill: 'none',\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: lineShape(dataFormatted) || '',\r\n opacity: 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape(dataFormatted) || '',\r\n opacity: 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 {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n </g>\r\n <g>\r\n {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n cx: x(d.date),\r\n cy: y(d.y as number),\r\n fill: lineColor,\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n fill: lineColor,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(d.date),\r\n cy: y(d.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(d.date), y: y(d.y) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y),\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 {numberFormattingFunction(d.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </motion.g>\r\n ))}\r\n </g>\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 <g>\r\n {regressionLine ? (\r\n <RegressionLine\r\n x1={0}\r\n x2={graphWidth}\r\n y1={predict(0)}\r\n y2={predict(graphWidth)}\r\n graphHeight={graphHeight}\r\n graphWidth={graphWidth}\r\n className={classNames?.regLine}\r\n style={styles?.regLine}\r\n color={typeof regressionLine === 'string' ? regressionLine : undefined}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\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 LineChartDataType,\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\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: LineChartDataType[];\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 /** Colors of the lines */\r\n lineColor?: 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 values */\r\n showValues?: boolean;\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 /** 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 /** Toggles the visibility of the regression line for the data. If the type is string then string is use to define the color of the line. */\r\n regressionLine?: boolean | string;\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 SimpleLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n lineColor,\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 showValues = false,\r\n padding,\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 30,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n maxDate,\r\n minDate,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n refValues = [],\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 regressionLine = false,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\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 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 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 {data.length === 0 ? (\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n <EmptyState />\r\n </div>\r\n ) : (\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColor={lineColor || Colors.primaryColors['blue-600']}\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 suffix={suffix}\r\n prefix={prefix}\r\n dateFormat={dateFormat}\r\n showValues={showValues}\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 highlightAreaSettings={highlightAreaSettings}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\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 regressionLine={regressionLine}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n maxDate={maxDate}\r\n minDate={minDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n )}\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","lineColor","suffix","prefix","dateFormat","highlightAreaSettings","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","refValues","minValue","maxValue","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","regressionLine","yAxisTitle","noOfYTicks","maxDate","minDate","curveType","styles","classNames","precision","customLayers","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","regressionLineParam","linearRegression","predict","linearRegressionLine","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","RegressionLine","Tooltip","SimpleLineChart","graphTitle","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","Colors","GraphFooter"],"mappings":"oqCA0FO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,UAAAC,EACA,OAAAC,EACA,OAAAC,EACA,WAAAC,EACA,sBAAAC,EACA,WAAAC,EACA,WAAAC,EACA,YAAAC,GACA,WAAAC,EACA,UAAAC,GACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA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EACtBK,GACD7H,GAASgI,GAAYR,EACxBU,GAAA,EAER,OAAA/H,EACA,OAAAC,EACA,WAAAC,EACA,WAAAE,GACA,WAAAC,GACA,WAAAE,EACA,YAAAD,EACA,UAAAE,EACA,aAAAC,EACA,QAAAC,EACA,sBAAAP,GACA,kBAAAQ,GACA,UAAAC,EACA,SAAAC,GACA,SAAAC,EACA,QACEC,IAAY,GACR,CAAE,SAAU,GAAK,KAAM,GAAM,OAAQ,EAAA,EACrCA,GAAW,CAAE,SAAU,EAAG,KAAM,GAAM,OAAQ,CAAA,EAEpD,IAAK0G,IAAa,MAAQA,IAAa,KACvC,YAAAxG,EACA,SAAAC,EACA,YAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,WAAAC,EACA,WAAAC,EACA,QAAAC,EACA,QAAAC,GACA,UAAAC,EACA,OAAAC,EACA,WAAAC,EACA,UAAAC,EACA,aAAAC,CAAA,CAAA,EAEA,IAAA,CAAA,EAGPkF,GAAWE,EACVxB,EAAAA,kBAAAA,IAAC8C,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAU7G,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAAoF,EACA,SAAAE,EACA,MAAArH,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
@@ -1,4 +1,4 @@
1
- import { j as t, m as Y } from "./index-CHPV5EwG-BPSP-7Jg.js";
1
+ import { j as t, m as P } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
2
  import { useRef as se, useState as M, useEffect as de } from "react";
3
3
  import { p as h, f as Oe } from "./parse-DlCRUFh_.js";
4
4
  import { l as De, a as Le } from "./simple-statistics-flVzqVtt.js";
@@ -11,7 +11,7 @@ import { A as Me } from "./Axis-Ddg-seDi.js";
11
11
  import { A as Ve } from "./AxisTitle-BmHLMRJZ.js";
12
12
  import { X as Re } from "./XTicksAndGridLines-Bn9u5gOM.js";
13
13
  import { R as He } from "./ReferenceLine-CfAW3vKJ.js";
14
- import { R as Ie } from "./RegressionLine-mH7UKOPi.js";
14
+ import { R as Ie } from "./RegressionLine-C2--oMQq.js";
15
15
  import { Y as We } from "./YTicksAndGridLines-B6ah7CRf.js";
16
16
  import { H as Fe } from "./index-DKCxu1Gh.js";
17
17
  import { t as Ye } from "./time-BzJP5SPC.js";
@@ -22,7 +22,7 @@ import { s as qe } from "./select-DKy99ogv.js";
22
22
  import { a as Je } from "./init-BhZylTFx.js";
23
23
  import { p as Ke } from "./pointer-CWRWOsrb.js";
24
24
  import { u as Qe } from "./use-in-view-yS6jzJAp.js";
25
- import { m as F } from "./proxy-CkpFesk1.js";
25
+ import { m as Y } from "./proxy-CkpFesk1.js";
26
26
  import { GraphFooter as Ze } from "./GraphFooter.js";
27
27
  import { GraphHeader as _e } from "./GraphHeader.js";
28
28
  import { Colors as et } from "./Colors.js";
@@ -32,7 +32,7 @@ function it(re) {
32
32
  data: D,
33
33
  width: A,
34
34
  height: V,
35
- lineColor: P,
35
+ lineColor: R,
36
36
  suffix: L,
37
37
  prefix: T,
38
38
  dateFormat: s,
@@ -44,7 +44,7 @@ function it(re) {
44
44
  topMargin: le,
45
45
  bottomMargin: E,
46
46
  tooltip: v,
47
- onSeriesMouseOver: R,
47
+ onSeriesMouseOver: H,
48
48
  refValues: G,
49
49
  minValue: B,
50
50
  maxValue: z,
@@ -54,11 +54,11 @@ function it(re) {
54
54
  showDots: me,
55
55
  annotations: xe,
56
56
  customHighlightAreaSettings: fe,
57
- regressionLine: H,
57
+ regressionLine: I,
58
58
  yAxisTitle: q,
59
59
  noOfYTicks: he,
60
- maxDate: I,
61
- minDate: W,
60
+ maxDate: W,
61
+ minDate: F,
62
62
  curveType: $,
63
63
  styles: n,
64
64
  classNames: x,
@@ -102,7 +102,7 @@ function it(re) {
102
102
  coordinates: e.coordinates.map(
103
103
  (y, O) => O % 2 === 0 ? h(`${y}`, s, /* @__PURE__ */ new Date()) : y
104
104
  )
105
- })), l = A - u.left - u.right, f = V - u.top - u.bottom, ae = W ? h(`${W}`, s, /* @__PURE__ */ new Date()) : i[0].date, m = I ? h(`${I}`, s, /* @__PURE__ */ new Date()) : i[i.length - 1].date, p = k(B) ? Math.min(...i.map((e) => e.y).filter((e) => e != null)) !== 1 / 0 ? Math.min(...i.map((e) => e.y).filter((e) => e != null)) > 0 ? 0 : Math.min(...i.map((e) => e.y).filter((e) => e != null)) : 0 : B, pe = Math.max(...i.map((e) => e.y).filter((e) => e != null)) !== 1 / 0 ? Math.max(...i.map((e) => e.y).filter((e) => e != null)) : 0, o = Ye().domain([ae, m]).range([0, l]), r = Pe().domain([
105
+ })), l = A - u.left - u.right, f = V - u.top - u.bottom, ae = F ? h(`${F}`, s, /* @__PURE__ */ new Date()) : i[0].date, m = W ? h(`${W}`, s, /* @__PURE__ */ new Date()) : i[i.length - 1].date, p = k(B) ? Math.min(...i.map((e) => e.y).filter((e) => e != null)) !== 1 / 0 ? Math.min(...i.map((e) => e.y).filter((e) => e != null)) > 0 ? 0 : Math.min(...i.map((e) => e.y).filter((e) => e != null)) : 0 : B, pe = Math.max(...i.map((e) => e.y).filter((e) => e != null)) !== 1 / 0 ? Math.max(...i.map((e) => e.y).filter((e) => e != null)) : 0, o = Ye().domain([ae, m]).range([0, l]), r = Pe().domain([
106
106
  p,
107
107
  k(z) ? pe > 0 ? pe : 0 : z
108
108
  ]).range([f, 0]).nice(), ve = Xe().x((e) => o(e.date)).y((e) => r(e.y)).curve(ue), we = r.ticks(he), je = o.ticks(X);
@@ -113,18 +113,18 @@ function it(re) {
113
113
  o.invert(Ke(O)[0]),
114
114
  0
115
115
  )];
116
- Q(oe || i[i.length - 1]), R?.(oe || i[i.length - 1]), b(O.clientY), _(O.clientX);
116
+ Q(oe || i[i.length - 1]), H?.(oe || i[i.length - 1]), b(O.clientY), _(O.clientX);
117
117
  }, y = () => {
118
- Q(void 0), _(void 0), b(void 0), R?.(void 0);
118
+ Q(void 0), _(void 0), b(void 0), H?.(void 0);
119
119
  };
120
120
  qe(ee.current).on("mousemove", e).on("mouseout", y);
121
- }, [o, i, R]);
121
+ }, [o, i, H]);
122
122
  const Ce = De(
123
123
  i.filter((e) => !k(e.date) && !k(e.y)).map((e) => [o(e.date), r(e.y)])
124
124
  ), be = Le(Ce);
125
125
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
126
126
  /* @__PURE__ */ t.jsx(
127
- F.svg,
127
+ Y.svg,
128
128
  {
129
129
  width: `${A}px`,
130
130
  height: `${V}px`,
@@ -231,8 +231,8 @@ function it(re) {
231
231
  labels: n?.xAxis?.labels
232
232
  },
233
233
  classNames: {
234
- gridLines: Y("opacity-0", x?.xAxis?.gridLines),
235
- labels: Y(
234
+ gridLines: P("opacity-0", x?.xAxis?.gridLines),
235
+ labels: P(
236
236
  "fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",
237
237
  x?.xAxis?.labels
238
238
  )
@@ -247,10 +247,10 @@ function it(re) {
247
247
  J.filter((e) => e.position === "before").map((e) => e.layer),
248
248
  /* @__PURE__ */ t.jsxs("g", { children: [
249
249
  /* @__PURE__ */ t.jsx(
250
- F.path,
250
+ Y.path,
251
251
  {
252
252
  style: {
253
- stroke: P,
253
+ stroke: R,
254
254
  fill: "none",
255
255
  strokeWidth: ce
256
256
  },
@@ -279,7 +279,7 @@ function it(re) {
279
279
  y2: f,
280
280
  x1: o(N.date),
281
281
  x2: o(N.date),
282
- className: Y(
282
+ className: P(
283
283
  "undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",
284
284
  x?.mouseOverLine
285
285
  ),
@@ -287,17 +287,22 @@ function it(re) {
287
287
  }
288
288
  ) : null
289
289
  ] }),
290
- /* @__PURE__ */ t.jsx("g", { children: i.map((e, y) => /* @__PURE__ */ t.jsx(F.g, { children: k(e.y) ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
290
+ /* @__PURE__ */ t.jsx("g", { children: i.map((e, y) => /* @__PURE__ */ t.jsx(Y.g, { children: k(e.y) ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
291
291
  me ? /* @__PURE__ */ t.jsx(
292
- F.circle,
292
+ Y.circle,
293
293
  {
294
294
  r: l / i.length < 5 ? 0 : l / i.length < 20 ? 2 : 4,
295
- style: { fill: P },
296
295
  exit: { opacity: 0, transition: { duration: a.duration } },
297
296
  variants: {
298
- initial: { opacity: 0, cx: o(e.date), cy: r(e.y) },
297
+ initial: {
298
+ opacity: 0,
299
+ cx: o(e.date),
300
+ cy: r(e.y),
301
+ fill: R
302
+ },
299
303
  whileInView: {
300
304
  opacity: 1,
305
+ fill: R,
301
306
  transition: {
302
307
  duration: C ? a.duration : 0.5,
303
308
  delay: C ? 0 : a.duration
@@ -311,14 +316,14 @@ function it(re) {
311
316
  }
312
317
  ) : null,
313
318
  c ? /* @__PURE__ */ t.jsx(
314
- F.text,
319
+ Y.text,
315
320
  {
316
321
  dy: -8,
317
322
  style: {
318
323
  textAnchor: "middle",
319
324
  ...n?.graphObjectValues || {}
320
325
  },
321
- className: Y(
326
+ className: P(
322
327
  "graph-value text-xs font-bold",
323
328
  x?.graphObjectValues
324
329
  ),
@@ -399,7 +404,7 @@ function it(re) {
399
404
  y
400
405
  );
401
406
  }) }),
402
- /* @__PURE__ */ t.jsx("g", { children: H ? /* @__PURE__ */ t.jsx(
407
+ /* @__PURE__ */ t.jsx("g", { children: I ? /* @__PURE__ */ t.jsx(
403
408
  Ie,
404
409
  {
405
410
  x1: 0,
@@ -410,7 +415,7 @@ function it(re) {
410
415
  graphWidth: l,
411
416
  className: x?.regLine,
412
417
  style: n?.regLine,
413
- color: typeof H == "string" ? H : void 0,
418
+ color: typeof I == "string" ? I : void 0,
414
419
  animate: a,
415
420
  isInView: g
416
421
  }
@@ -449,7 +454,7 @@ function St(re) {
449
454
  data: D,
450
455
  graphTitle: A,
451
456
  lineColor: V,
452
- suffix: P = "",
457
+ suffix: R = "",
453
458
  sources: L,
454
459
  prefix: T = "",
455
460
  graphDescription: s,
@@ -461,7 +466,7 @@ function St(re) {
461
466
  showValues: le = !1,
462
467
  padding: E,
463
468
  backgroundColor: v = !1,
464
- leftMargin: R = 30,
469
+ leftMargin: H = 30,
465
470
  rightMargin: G = 30,
466
471
  topMargin: B = 20,
467
472
  bottomMargin: z = 25,
@@ -471,11 +476,11 @@ function St(re) {
471
476
  highlightAreaSettings: me = [],
472
477
  graphID: xe,
473
478
  minValue: fe,
474
- maxValue: H,
479
+ maxValue: I,
475
480
  maxDate: q,
476
481
  minDate: he,
477
- graphDownload: I = !1,
478
- dataDownload: W = !1,
482
+ graphDownload: W = !1,
483
+ dataDownload: F = !1,
479
484
  animate: $ = !1,
480
485
  language: n = "en",
481
486
  refValues: x = [],
@@ -508,7 +513,7 @@ function St(re) {
508
513
  children: /* @__PURE__ */ t.jsx(
509
514
  "div",
510
515
  {
511
- className: Y(
516
+ className: P(
512
517
  `${v ? v === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${n || "en"}`,
513
518
  c ? "w-fit" : "w-full",
514
519
  b?.graphContainer
@@ -526,7 +531,7 @@ function St(re) {
526
531
  className: "flex grow",
527
532
  style: { padding: v ? E || "1rem" : E || 0 },
528
533
  children: /* @__PURE__ */ t.jsxs("div", { className: "flex flex-col w-full gap-4 grow justify-between", children: [
529
- A || s || I || W ? /* @__PURE__ */ t.jsx(
534
+ A || s || W || F ? /* @__PURE__ */ t.jsx(
530
535
  _e,
531
536
  {
532
537
  styles: {
@@ -540,8 +545,8 @@ function St(re) {
540
545
  graphTitle: A,
541
546
  graphDescription: s,
542
547
  width: c,
543
- graphDownload: I ? ae.current : void 0,
544
- dataDownload: W ? D.map((m) => m.data).filter((m) => m !== void 0).length > 0 ? D.map((m) => m.data).filter((m) => m !== void 0) : D.filter((m) => m !== void 0) : null
548
+ graphDownload: W ? ae.current : void 0,
549
+ dataDownload: F ? D.map((m) => m.data).filter((m) => m !== void 0).length > 0 ? D.map((m) => m.data).filter((m) => m !== void 0) : D.filter((m) => m !== void 0) : null
545
550
  }
546
551
  ) : null,
547
552
  D.length === 0 ? /* @__PURE__ */ t.jsx("div", { className: "grow flex flex-col justify-center gap-3 w-full", children: /* @__PURE__ */ t.jsx(tt, {}) }) : /* @__PURE__ */ t.jsx(
@@ -560,12 +565,12 @@ function St(re) {
560
565
  w,
561
566
  S || (a ? w ? (c || i) * a > w ? (c || i) * a : w : (c || i) * a : ie)
562
567
  ),
563
- suffix: P,
568
+ suffix: R,
564
569
  prefix: T,
565
570
  dateFormat: d,
566
571
  showValues: le,
567
572
  noOfXTicks: ne,
568
- leftMargin: R,
573
+ leftMargin: H,
569
574
  rightMargin: G,
570
575
  topMargin: B,
571
576
  bottomMargin: z,
@@ -574,7 +579,7 @@ function St(re) {
574
579
  onSeriesMouseOver: ce,
575
580
  refValues: x,
576
581
  minValue: fe,
577
- maxValue: H,
582
+ maxValue: I,
578
583
  animate: $ === !0 ? { duration: 0.5, once: !0, amount: 0.5 } : $ || { duration: 0, once: !0, amount: 0 },
579
584
  rtl: n === "he" || n === "ar",
580
585
  strokeWidth: J,