@undp/data-viz 1.4.6 → 1.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AreaChart.cjs +1 -1
- package/dist/AreaChart.cjs.map +1 -1
- package/dist/AreaChart.js +58 -58
- package/dist/AreaChart.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +50 -50
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +26 -26
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +44 -44
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +2 -2
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.js +1 -1
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
- package/dist/LineChartWithConfidenceInterval.js +33 -33
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +78 -78
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +28 -28
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +43 -43
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +17 -17
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +1 -1
- package/dist/SparkLine.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DifferenceLineChart.js","sources":["../src/Components/Graphs/LineCharts/DifferenceLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/DifferenceLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\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 sortBy from 'lodash.sortby';\r\nimport { motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n DifferenceLineChartDataType,\r\n HighlightAreaSettingsDataType,\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 { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: DifferenceLineChartDataType[];\r\n lineColors: [string, string];\r\n diffAreaColors: [string, 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 highlightAreaSettings: HighlightAreaSettingsDataType[];\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 animate: AnimateDataType;\r\n rtl: boolean;\r\n colorDomain: [string, string];\r\n showColorLegendAtTop?: boolean;\r\n idSuffix: string;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\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 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 y1: number;\r\n y2: 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 lineColors,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n highlightAreaSettings,\r\n onSeriesMouseOver,\r\n animate,\r\n rtl,\r\n showColorLegendAtTop,\r\n colorDomain,\r\n diffAreaColors,\r\n idSuffix,\r\n strokeWidth,\r\n showDots,\r\n refValues,\r\n minValue,\r\n maxValue,\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 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 = sortBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n 'date',\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 minParam1 =\r\n Math.min(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y1)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const minParam2 =\r\n Math.min(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y2)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n const maxParam1 =\r\n Math.max(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const maxParam2 =\r\n Math.max(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n\r\n const minParam = checkIfNullOrUndefined(minValue)\r\n ? minParam1 < minParam2\r\n ? minParam1\r\n : minParam2\r\n : (minValue as number);\r\n const maxParam = maxParam1 > maxParam2 ? maxParam1 : maxParam2;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n\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 lineShape1 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y1))\r\n .curve(curve);\r\n\r\n const lineShape2 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y2))\r\n .curve(curve);\r\n\r\n const mainGraphArea = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(d => y(d.y2))\r\n .curve(curve);\r\n const mainGraphArea1 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(0)\r\n .curve(curve);\r\n const mainGraphArea2 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y2))\r\n .y0(0)\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 1,\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 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 <clipPath id={`above${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea2(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <clipPath id={`below${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea1(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\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 <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 ? '1rem' : -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 {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n clipPath={`url(#below${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 1 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n clipPath={`url(#above${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </g>\r\n <g>\r\n <motion.path\r\n d={lineShape1(dataFormatted) || ''}\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[0],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape1(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape1(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 <motion.path\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[1],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape2(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape2(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 {showColorLegendAtTop ? null : (\r\n <g>\r\n <motion.text\r\n key={colorDomain[0]}\r\n style={{ fill: lineColors[0] }}\r\n className='text-xs'\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(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 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 {colorDomain[0]}\r\n </motion.text>\r\n <motion.text\r\n key={colorDomain[1]}\r\n style={{ fill: lineColors[1] }}\r\n className='text-xs'\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(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 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 {colorDomain[1]}\r\n </motion.text>\r\n </g>\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 {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y1) ? (\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: lineColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: 0.5, delay: animate.duration },\r\n cx: x(d.date),\r\n cy: y(d.y1),\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={d.y2 < d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[0],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-1 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.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y1),\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.y1, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n {!checkIfNullOrUndefined(d.y2) ? (\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: lineColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y2) },\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.y2),\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={d.y2 > d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[1],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-2 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.y2) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y2),\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.y2, '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 (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 <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 { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n DifferenceLineChartDataType,\r\n Languages,\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 { Colors } from '@/Components/ColorPalette';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DifferenceLineChartDataType[];\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 /** Array of colors for the 2 lines */\r\n lineColors?: [string, string];\r\n /** Array of colors to highlight the negative and positive difference between the lines */\r\n diffAreaColors?: [string, string];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: 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 /** 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 /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\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 /** Labels for the lines */\r\n labels: [string, string];\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 /** 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 DifferenceLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\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 lineColors = [\r\n Colors.light.categoricalColors.colors[0],\r\n Colors.light.categoricalColors.colors[1],\r\n ],\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n labels,\r\n showColorLegendAtTop = false,\r\n colorLegendTitle,\r\n diffAreaColors = [Colors.alerts.red, Colors.alerts.darkGreen],\r\n strokeWidth = 2,\r\n showDots = true,\r\n refValues = [],\r\n minValue,\r\n maxValue,\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 precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\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\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 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 highlights the difference between two datasets 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 {showColorLegendAtTop ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\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 lineColors={lineColors}\r\n colorDomain={labels}\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 highlightAreaSettings={highlightAreaSettings}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorLegendAtTop}\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 diffAreaColors={diffAreaColors}\r\n idSuffix={generateRandomString(8)}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\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 precision={precision}\r\n customLayers={customLayers}\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","suffix","prefix","dateFormat","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","highlightAreaSettings","onSeriesMouseOver","animate","rtl","showColorLegendAtTop","colorDomain","diffAreaColors","idSuffix","strokeWidth","showDots","refValues","minValue","maxValue","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","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","sortBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam1","minParam2","maxParam1","maxParam2","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape1","line","lineShape2","mainGraphArea","area","mainGraphArea1","mainGraphArea2","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","DifferenceLineChart","graphTitle","sources","graphDescription","footNote","padding","Colors","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","labels","colorLegendTitle","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IAC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BACA,mBAAAE;AAAA,0BACA,sBAAAG;AAAA,0BACA,SACEF,MAAY,KACR,EAAE,UAAU,KAAK,MAAM,IAAM,QAAQ,IAAA,IACrCA,KAAW,EAAE,UAAU,GAAG,MAAM,IAAM,QAAQ,EAAA;AAAA,0BAEpD,KAAKqH,MAAa,QAAQA,MAAa;AAAA,0BACvC,gBAAAjH;AAAA,0BACA,UAAUkI,GAAqB,CAAC;AAAA,0BAChC,aAAAhI;AAAA,0BACA,UAAAC;AAAA,0BACA,WAAAC;AAAA,0BACA,UAAAC;AAAA,0BACA,UAAAC;AAAA,0BACA,aAAAC;AAAA,0BACA,6BAAAC;AAAA,0BACA,YAAAC;AAAA,0BACA,YAAAC;AAAA,0BACA,SAAAC;AAAA,0BACA,SAAAC;AAAA,0BACA,WAAAC;AAAA,0BACA,QAAAC;AAAA,0BACA,YAAAC;AAAA,0BACA,WAAAC;AAAA,0BACA,cAAAC;AAAA,wBAAA;AAAA,sBAAA,IAEA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACN,EAAA,CACF,EAAA,CAEJ;AAAA,gBACCsF,KAAWE,IACVvB,gBAAAA,EAAAA;AAAAA,kBAACiD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUrH,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAwF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAA5H;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":"DifferenceLineChart.js","sources":["../src/Components/Graphs/LineCharts/DifferenceLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/DifferenceLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveMonotoneX,\r\n area,\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 sortBy from 'lodash.sortby';\r\nimport { motion, useInView } from 'motion/react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n DifferenceLineChartDataType,\r\n HighlightAreaSettingsDataType,\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 { HighlightArea } from '@/Components/Elements/HighlightArea';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\n\r\ninterface Props {\r\n data: DifferenceLineChartDataType[];\r\n lineColors: [string, string];\r\n diffAreaColors: [string, 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 highlightAreaSettings: HighlightAreaSettingsDataType[];\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 animate: AnimateDataType;\r\n rtl: boolean;\r\n colorDomain: [string, string];\r\n showColorLegendAtTop?: boolean;\r\n idSuffix: string;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\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 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 y1: number;\r\n y2: 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 lineColors,\r\n suffix,\r\n prefix,\r\n dateFormat,\r\n showValues,\r\n noOfXTicks,\r\n rightMargin,\r\n leftMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n highlightAreaSettings,\r\n onSeriesMouseOver,\r\n animate,\r\n rtl,\r\n showColorLegendAtTop,\r\n colorDomain,\r\n diffAreaColors,\r\n idSuffix,\r\n strokeWidth,\r\n showDots,\r\n refValues,\r\n minValue,\r\n maxValue,\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 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 = sortBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n 'date',\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 minParam1 =\r\n Math.min(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y1)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const minParam2 =\r\n Math.min(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.min(...dataFormatted.map(d => d.y2)) > 0\r\n ? 0\r\n : Math.min(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n const maxParam1 =\r\n Math.max(...dataFormatted.map(d => d.y1)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y1))\r\n : 0;\r\n const maxParam2 =\r\n Math.max(...dataFormatted.map(d => d.y2)) !== Infinity\r\n ? Math.max(...dataFormatted.map(d => d.y2))\r\n : 0;\r\n\r\n const minParam = checkIfNullOrUndefined(minValue)\r\n ? minParam1 < minParam2\r\n ? minParam1\r\n : minParam2\r\n : (minValue as number);\r\n const maxParam = maxParam1 > maxParam2 ? maxParam1 : maxParam2;\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n\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 lineShape1 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y1))\r\n .curve(curve);\r\n\r\n const lineShape2 = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y2))\r\n .curve(curve);\r\n\r\n const mainGraphArea = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(d => y(d.y2))\r\n .curve(curve);\r\n const mainGraphArea1 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y1))\r\n .y0(0)\r\n .curve(curve);\r\n const mainGraphArea2 = area<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y1(d => y(d.y2))\r\n .y0(0)\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 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 <clipPath id={`above${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea2(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\r\n <clipPath id={`below${idSuffix}`}>\r\n <path\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d={mainGraphArea1(dataFormatted as any) as string}\r\n style={{ fill: 'none' }}\r\n />\r\n </clipPath>\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 <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 ? '1rem' : -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 {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n <motion.path\r\n clipPath={`url(#below${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 1 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n <motion.path\r\n clipPath={`url(#above${idSuffix})`}\r\n d={mainGraphArea(dataFormatted) || ''}\r\n style={{ fill: diffAreaColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: { opacity: 1, transition: { duration: animate.duration } },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </g>\r\n <g>\r\n <motion.path\r\n d={lineShape1(dataFormatted) || ''}\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[0],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape1(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape1(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 <motion.path\r\n style={{\r\n fill: 'none',\r\n stroke: lineColors[1],\r\n strokeWidth,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { pathLength: 0, d: lineShape2(dataFormatted) || '', opacity: 1 },\r\n whileInView: {\r\n pathLength: 1,\r\n d: lineShape2(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 {showColorLegendAtTop ? null : (\r\n <g>\r\n <motion.text\r\n key={colorDomain[0]}\r\n style={{ fill: lineColors[0] }}\r\n className='text-xs'\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(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y1 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 {colorDomain[0]}\r\n </motion.text>\r\n <motion.text\r\n key={colorDomain[1]}\r\n style={{ fill: lineColors[1] }}\r\n className='text-xs'\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(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(dataFormatted[dataFormatted.length - 1].date),\r\n y: y(dataFormatted[dataFormatted.length - 1].y2 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 {colorDomain[1]}\r\n </motion.text>\r\n </g>\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 {dataFormatted.map((d, i) => (\r\n <motion.g key={i}>\r\n {!checkIfNullOrUndefined(d.y1) ? (\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: lineColors[0] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: 0.5, delay: animate.duration },\r\n cx: x(d.date),\r\n cy: y(d.y1),\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={d.y2 < d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[0],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-1 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.y1) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y1),\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.y1, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n {!checkIfNullOrUndefined(d.y2) ? (\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: lineColors[1] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(d.date), cy: y(d.y2) },\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.y2),\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={d.y2 > d.y1 ? -8 : '1em'}\r\n style={{\r\n fill: lineColors[1],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value graph-value-line-2 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.y2) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d.date),\r\n y: y(d.y2),\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.y2, '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 {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 { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n DifferenceLineChartDataType,\r\n Languages,\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 { Colors } from '@/Components/ColorPalette';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DifferenceLineChartDataType[];\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 /** Array of colors for the 2 lines */\r\n lineColors?: [string, string];\r\n /** Array of colors to highlight the negative and positive difference between the lines */\r\n diffAreaColors?: [string, string];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: 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 /** 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 /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\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 /** Labels for the lines */\r\n labels: [string, string];\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 /** 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 DifferenceLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\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 lineColors = [\r\n Colors.light.categoricalColors.colors[0],\r\n Colors.light.categoricalColors.colors[1],\r\n ],\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n highlightAreaSettings = [],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n minHeight = 0,\r\n labels,\r\n showColorLegendAtTop = false,\r\n colorLegendTitle,\r\n diffAreaColors = [Colors.alerts.red, Colors.alerts.darkGreen],\r\n strokeWidth = 2,\r\n showDots = true,\r\n refValues = [],\r\n minValue,\r\n maxValue,\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 precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\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\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 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 highlights the difference between two datasets 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 {showColorLegendAtTop ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\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 lineColors={lineColors}\r\n colorDomain={labels}\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 highlightAreaSettings={highlightAreaSettings}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorLegendAtTop}\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 diffAreaColors={diffAreaColors}\r\n idSuffix={generateRandomString(8)}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\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 precision={precision}\r\n customLayers={customLayers}\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","suffix","prefix","dateFormat","showValues","noOfXTicks","rightMargin","leftMargin","topMargin","bottomMargin","tooltip","highlightAreaSettings","onSeriesMouseOver","animate","rtl","showColorLegendAtTop","colorDomain","diffAreaColors","idSuffix","strokeWidth","showDots","refValues","minValue","maxValue","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","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","sortBy","d","parse","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","el","j","graphWidth","graphHeight","minYear","maxYear","minParam1","minParam2","maxParam1","maxParam2","minParam","checkIfNullOrUndefined","maxParam","x","scaleTime","y","scaleLinear","lineShape1","line","lineShape2","mainGraphArea","area","mainGraphArea1","mainGraphArea2","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","i","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","DifferenceLineChart","graphTitle","sources","graphDescription","footNote","padding","Colors","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","minHeight","labels","colorLegendTitle","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;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,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEtC,IACEuC,KAASC,GAAO,IAAI,GACpBC,IAAWC,GAAUH,IAAQ;AAAA,IACjC,MAAMtB,EAAQ;AAAA,IACd,QAAQA,EAAQ;AAAA,EAAA,CACjB,GACK,CAAC0B,GAAiBC,EAAkB,IAAIC,EAAS,EAAK;AAE5D,EAA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BACA,YAAAC;AAAA,0BACA,SAAAC;AAAA,0BACA,SAAAC;AAAA,0BACA,WAAAC;AAAA,0BACA,QAAAC;AAAA,0BACA,YAAAC;AAAA,0BACA,WAAAC;AAAA,0BACA,cAAAC;AAAA,wBAAA;AAAA,sBAAA,IAEA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACN,EAAA,CACF,EAAA,CAEJ;AAAA,gBACCsF,KAAWE,IACVvB,gBAAAA,EAAAA;AAAAA,kBAACiD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUrH,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAwF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAA5H;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
package/dist/DotDensityMap.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),n=require("react"),be=require("./index-CZbIGs8q.cjs"),Ee=require("./parse-hMnG_lRV.cjs"),ye=require("./getSliderMarks-CtsEXiLV.cjs"),ke=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./index-BXns0-ng.cjs"),$=require("./zoom-Lo7IAUfC.cjs"),De=require("./Modal-tXZlLE5s.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./Tooltip-n8z5bfav.cjs"),R=require("./Colors.cjs"),$e=require("./string2HTML-D2Avudmb.cjs"),ve=require("./index-BW_-wD2k.cjs"),Me=require("./pow-B5-jkdHU.cjs"),je=require("./select-Bnfk0lJx.cjs"),Oe=require("./use-in-view-sQJZ_xDO.cjs"),de=require("./proxy-BHRoeZgd.cjs"),qe=require("./index-BW8iNx7E.cjs"),Pe=require("./GraphFooter.cjs"),Ie=require("./GraphHeader.cjs"),Le=require("./fetchAndParseData-CQyVGCul.cjs"),we=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Te=require("./init-DU0ybBc_.cjs");function ze(me){const{data:l,colors:c,mapData:k,colorLegendTitle:M,colorDomain:j,radius:v,height:m,width:a,scale:K,centerPoint:O,tooltip:Z,showLabels:pe,mapBorderWidth:J,mapBorderColor:Q,mapNoDataColor:H,onSeriesMouseOver:ee,showColorScale:xe,zoomScaleExtend:C,zoomTranslateExtend:he,highlightedDataPoints:te,onSeriesMouseClick:B,resetSelectionOnDoubleClick:g,detailsOnClick:D,styles:re,classNames:ge,mapProjection:T,zoomInteraction:q,animate:f,dimmedOpacity:oe,customLayers:ae,maxRadiusValue:ie}=me,[A,se]=n.useState(void 0),[F,h]=n.useState(!(a<680)),z=n.useRef(null),[P,G]=n.useState(void 0),[ne,y]=n.useState(void 0),[b,U]=n.useState(void 0),[le,V]=n.useState(void 0),I=n.useRef(null),X=Oe.useInView(I,{once:f.once,amount:f.amount}),_=n.useRef(null),d=l.filter(e=>e.radius===void 0||e.radius===null).length!==l.length?Me.sqrt().domain([0,ie]).range([.25,v]).nice():void 0;n.useEffect(()=>{const e=je.select(_.current),x=je.select(I.current),o=i=>{if(q==="noZoom")return!1;if(q==="button")return!i.type.includes("wheel");const t=i.type==="wheel",u=i.type.startsWith("touch"),w=i.type==="mousedown"||i.type==="mousemove";return u?!0:t?q==="scroll"?!0:i.ctrlKey:w&&!i.button&&!i.ctrlKey},E=$.zoom().scaleExtent(C).translateExtent(he||[[-20,-20],[a+20,m+20]]).filter(o).on("zoom",({transform:i})=>{e.attr("transform",i)});x.call(E),z.current=E},[m,a,q]);const p=$.turf_bbox_default(k),S=$.turf_centroid_default(k),Y=p[2]-p[0],ce=p[3]-p[1],L=a*190/960*360/Y,fe=m*190/678*180/ce,s=K*Math.min(L,fe),N=T==="mercator"?$.geoMercator().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):T==="equalEarth"?$.geoEqualEarth().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):T==="naturalEarth"?$.geoNaturalEarth1().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):T==="orthographic"?$.geoOrthographic().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):$.geoAlbersUsa().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s),W=e=>{if(!I.current||!z.current)return;je.select(I.current).call(z.current.scaleBy,e==="in"?1.2:1/1.2)};return r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r.jsxRuntimeExports.jsx(de.motion.svg,{width:`${a}px`,height:`${m}px`,viewBox:`0 0 ${a} ${m}`,ref:I,direction:"ltr",children:r.jsxRuntimeExports.jsxs("g",{ref:_,children:[ae.filter(e=>e.position==="before").map(e=>e.layer),k.features.map((e,x)=>r.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((o,E)=>{let i="";return o.forEach(t=>{let u=" M";t.forEach((w,Re)=>{const ue=N([w[0],w[1]]);Re!==t.length-1?u=`${u}${ue[0]} ${ue[1]}L`:u=`${u}${ue[0]} ${ue[1]}`}),i+=u}),r.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:Q,strokeWidth:J,fill:H}},E)}):e.geometry.coordinates.map((o,E)=>{let i="M";return o.forEach((t,u)=>{const w=N([t[0],t[1]]);u!==o.length-1?i=`${i}${w[0]} ${w[1]}L`:i=`${i}${w[0]} ${w[1]}`}),r.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:Q,strokeWidth:J,fill:H}},E)})},x)),r.jsxRuntimeExports.jsx(qe.AnimatePresence,{children:l.map(e=>{const x=l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray;return r.jsxRuntimeExports.jsxs(de.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:A?A===x?1:oe:te.length!==0?te.indexOf(e.label||"")!==-1?1:oe:1,transition:{duration:f.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:f.duration}},onMouseEnter:o=>{y(e),V(o.clientY),U(o.clientX),ee?.(e)},onMouseMove:o=>{y(e),V(o.clientY),U(o.clientX)},onMouseLeave:()=>{y(void 0),U(void 0),V(void 0),ee?.(void 0)},onClick:()=>{(B||D)&&(Ce.isEqual(P,e)&&g?(G(void 0),B?.(void 0)):(G(e),B?.(e)))},transform:`translate(${N([e.long,e.lat])[0]},${N([e.long,e.lat])[1]})`,children:[r.jsxRuntimeExports.jsx(de.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray,stroke:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray},whileInView:{r:d?d(e.radius||0):v,fill:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray,stroke:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray,transition:{duration:f.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{r:0,transition:{duration:f.duration}},style:{fillOpacity:.8}}),pe&&e.label?r.jsxRuntimeExports.jsx(de.motion.text,{variants:{initial:{opacity:0,x:d?d(e.radius||0):v},whileInView:{opacity:1,x:d?d(e.radius||0):v,transition:{duration:f.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:f.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:e.label}):null]},e.label||`${e.lat}-${e.long}`)})}),ae.filter(e=>e.position==="after").map(e=>e.layer)]})}),l.filter(e=>e.color).length===0||xe===!1?null:r.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:F?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{h(!1)},children:r.jsxRuntimeExports.jsx(ve.X,{})}),r.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[M&&M!==""?r.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:M}):null,r.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:j.map((e,x)=>r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{se(c[x%c.length])},onMouseLeave:()=>{se(void 0)},children:[r.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:c[x%c.length]}}),r.jsxRuntimeExports.jsx(Se.u,{size:"sm",marginBottom:"none",leading:"none",children:e})]},x))})]})]}):r.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{h(!0)},children:r.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="button"&&r.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[r.jsxRuntimeExports.jsx("button",{onClick:()=>W("in"),className:"leading-0 px-2 py-3.5 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),r.jsxRuntimeExports.jsx("button",{onClick:()=>W("out"),className:"leading-0 px-2 py-3.5 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),D&&P!==void 0?r.jsxRuntimeExports.jsx(De.X,{open:P!==void 0,onClose:()=>{G(void 0)},children:r.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:$e.string2HTML(D,P)}:void 0,children:typeof D=="function"?D(P):null})}):null,ne&&Z&&b&&le?r.jsxRuntimeExports.jsx(Ne.Tooltip,{data:ne,body:Z,xPos:b,yPos:le,backgroundStyle:re?.tooltip,className:ge?.tooltip}):null]})}function Ve(me){const{data:l,mapData:c="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",graphTitle:k,colors:M,sources:j,graphDescription:v,height:m,width:a,footNote:K="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorLegendTitle:O,colorDomain:Z,radius:pe=5,scale:J=.95,centerPoint:Q,padding:H,mapBorderWidth:ee=.5,mapNoDataColor:xe=R.Colors.light.graphNoData,backgroundColor:C=!1,showLabels:he=!1,mapBorderColor:te=R.Colors.light.grays["gray-500"],tooltip:B,relativeHeight:g,onSeriesMouseOver:D,isWorldMap:re=!0,showColorScale:ge=!0,zoomScaleExtend:T=[.8,6],zoomTranslateExtend:q,graphID:f,highlightedDataPoints:oe=[],onSeriesMouseClick:ae,graphDownload:ie=!1,dataDownload:A=!1,showAntarctica:se=!1,language:F="en",minHeight:h=0,theme:z="light",ariaLabel:P,resetSelectionOnDoubleClick:G=!0,detailsOnClick:ne,styles:y,classNames:b,mapProjection:U,zoomInteraction:le="button",animate:V=!1,dimmedOpacity:I=.3,customLayers:X=[],maxRadiusValue:_,timeline:d={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=me,[p,S]=n.useState(0),[Y,ce]=n.useState(0),[L,fe]=n.useState(d.autoplay),s=ye.sort(be.uniqBy(l.filter(t=>t.date!==void 0&&t.date!==null),t=>t.date).map(t=>Ee.parse(`${t.date}`,d.dateFormat||"yyyy",new Date).getTime()),(t,u)=>Te.ascending(t,u)),[N,W]=n.useState(d.autoplay?0:s.length-1),[e,x]=n.useState(void 0),o=n.useRef(null),E=n.useRef(null);n.useEffect(()=>{const t=new ResizeObserver(u=>{S(a||u[0].target.clientWidth||760),ce(m||u[0].target.clientHeight||480)});return o.current&&(ce(o.current.clientHeight||480),S(o.current.clientWidth||760),a||t.observe(o.current)),()=>t.disconnect()},[a,m]),n.useEffect(()=>{typeof c=="string"?Le.fetchAndParseJSON(c).then(u=>{x(u)}):x(c)},[c]),n.useEffect(()=>{const t=setInterval(()=>{W(u=>u<s.length-1?u+1:0)},(d.speed||2)*1e3);return L||clearInterval(t),()=>clearInterval(t)},[s,L,d.speed]);const i=ye.getSliderMarks(s,N,d.showOnlyActiveDate,d.dateFormat||"yyyy");return r.jsxRuntimeExports.jsx("div",{className:`${z||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:F==="he"||F==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:r.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${F||"en"}`,b?.graphContainer),style:{...y?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:f,ref:E,"aria-label":P||`${k?`The graph shows ${k}. `:""}This is a dot density map showing the distribution of a variable across a region or world, with each dot representing a data point.${v?` ${v}`:""}`,children:r.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?H||"1rem":H||0},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[k||v||ie||A?r.jsxRuntimeExports.jsx(Ie.GraphHeader,{styles:{title:y?.title,description:y?.description},classNames:{title:b?.title,description:b?.description},graphTitle:k,graphDescription:v,width:a,graphDownload:ie?E.current:void 0,dataDownload:A?l.map(t=>t.data).filter(t=>t!==void 0).length>0?l.map(t=>t.data).filter(t=>t!==void 0):l.filter(t=>t!==void 0):null}):null,d.enabled&&s.length>0&&i?r.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[r.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{fe(!L)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":L?"Click to pause animation":"Click to play animation",children:L?r.jsxRuntimeExports.jsx(ve.Pause,{}):r.jsxRuntimeExports.jsx(ve.Play,{})}),r.jsxRuntimeExports.jsx(ye.xr,{min:s[0],max:s[s.length-1],marks:i,step:null,defaultValue:s[s.length-1],value:s[N],onChangeComplete:t=>{W(s.indexOf(t))},onChange:t=>{W(s.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,r.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:o,"aria-label":"Map area",children:(a||p)&&(m||Y)&&e?r.jsxRuntimeExports.jsx(ze,{data:l.filter(t=>d.enabled?t.date===Ee.format(new Date(s[N]),d.dateFormat||"yyyy"):t),mapData:se?e:{...e,features:e.features.filter(t=>t.properties.NAME!=="Antarctica")},colorDomain:l.filter(t=>t.color).length===0?[]:Z||be.uniqBy(l.filter(t=>!we.checkIfNullOrUndefined(t.color)),"color").map(t=>`${t.color}`),width:a||p,height:Math.max(h,m||(g?h?(a||p)*g>h?(a||p)*g:h:(a||p)*g:Y)),scale:J,centerPoint:Q,colors:l.filter(t=>t.color).length===0?M?[M]:[R.Colors.primaryColors["blue-600"]]:M||R.Colors[z].categoricalColors.colors,colorLegendTitle:O,radius:pe,mapBorderWidth:ee,mapNoDataColor:xe,mapBorderColor:te,tooltip:B,onSeriesMouseOver:D,showLabels:he,isWorldMap:re,showColorScale:ge,zoomScaleExtend:T,zoomTranslateExtend:q,onSeriesMouseClick:ae,highlightedDataPoints:oe,resetSelectionOnDoubleClick:G,styles:y,classNames:b,zoomInteraction:le,detailsOnClick:ne,mapProjection:U||(re?"naturalEarth":"mercator"),animate:V===!0?{duration:.5,once:!0,amount:.5}:V||{duration:0,once:!0,amount:0},dimmedOpacity:I,customLayers:X,maxRadiusValue:we.checkIfNullOrUndefined(_)?Math.max(...l.map(t=>t.radius).filter(t=>t!=null)):_}):r.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,m||(g?h?(a||p)*g>h?(a||p)*g:h:(a||p)*g:Y))}px`},className:"flex items-center justify-center",children:r.jsxRuntimeExports.jsx(ke.y,{"aria-label":"Loading graph"})})}),j||K?r.jsxRuntimeExports.jsx(Pe.GraphFooter,{styles:{footnote:y?.footnote,source:y?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:j,footNote:K,width:a}):null]})})})})}exports.DotDensityMap=Ve;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),n=require("react"),be=require("./index-CZbIGs8q.cjs"),Ee=require("./parse-hMnG_lRV.cjs"),fe=require("./getSliderMarks-CtsEXiLV.cjs"),ke=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./index-BXns0-ng.cjs"),$=require("./zoom-Lo7IAUfC.cjs"),De=require("./Modal-tXZlLE5s.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./Tooltip-n8z5bfav.cjs"),R=require("./Colors.cjs"),$e=require("./string2HTML-D2Avudmb.cjs"),ve=require("./index-BW_-wD2k.cjs"),Me=require("./pow-B5-jkdHU.cjs"),je=require("./select-Bnfk0lJx.cjs"),Oe=require("./use-in-view-sQJZ_xDO.cjs"),de=require("./proxy-BHRoeZgd.cjs"),qe=require("./index-BW8iNx7E.cjs"),Pe=require("./GraphFooter.cjs"),Ie=require("./GraphHeader.cjs"),Le=require("./fetchAndParseData-CQyVGCul.cjs"),we=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Te=require("./init-DU0ybBc_.cjs");function ze(me){const{data:l,colors:c,mapData:k,colorLegendTitle:M,colorDomain:j,radius:v,height:m,width:a,scale:K,centerPoint:O,tooltip:Z,showLabels:pe,mapBorderWidth:J,mapBorderColor:Q,mapNoDataColor:H,onSeriesMouseOver:ee,showColorScale:xe,zoomScaleExtend:C,zoomTranslateExtend:he,highlightedDataPoints:te,onSeriesMouseClick:B,resetSelectionOnDoubleClick:g,detailsOnClick:D,styles:re,classNames:ge,mapProjection:T,zoomInteraction:q,animate:y,dimmedOpacity:oe,customLayers:ae,maxRadiusValue:ie}=me,[A,se]=n.useState(void 0),[F,h]=n.useState(!(a<680)),z=n.useRef(null),[P,G]=n.useState(void 0),[ne,f]=n.useState(void 0),[b,U]=n.useState(void 0),[le,V]=n.useState(void 0),I=n.useRef(null),X=Oe.useInView(I,{once:y.once,amount:y.amount}),_=n.useRef(null),d=l.filter(e=>e.radius===void 0||e.radius===null).length!==l.length?Me.sqrt().domain([0,ie]).range([.25,v]).nice():void 0;n.useEffect(()=>{const e=je.select(_.current),x=je.select(I.current),o=i=>{if(q==="noZoom")return!1;if(q==="button")return!i.type.includes("wheel");const t=i.type==="wheel",u=i.type.startsWith("touch"),w=i.type==="mousedown"||i.type==="mousemove";return u?!0:t?q==="scroll"?!0:i.ctrlKey:w&&!i.button&&!i.ctrlKey},E=$.zoom().scaleExtent(C).translateExtent(he||[[-20,-20],[a+20,m+20]]).filter(o).on("zoom",({transform:i})=>{e.attr("transform",i)});x.call(E),z.current=E},[m,a,q]);const p=$.turf_bbox_default(k),S=$.turf_centroid_default(k),Y=p[2]-p[0],ce=p[3]-p[1],L=a*190/960*360/Y,ye=m*190/678*180/ce,s=K*Math.min(L,ye),N=T==="mercator"?$.geoMercator().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):T==="equalEarth"?$.geoEqualEarth().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):T==="naturalEarth"?$.geoNaturalEarth1().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):T==="orthographic"?$.geoOrthographic().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s):$.geoAlbersUsa().rotate([0,0]).center(O||S.geometry.coordinates).translate([a/2,m/2]).scale(s),W=e=>{if(!I.current||!z.current)return;je.select(I.current).call(z.current.scaleBy,e==="in"?1.2:1/1.2)};return r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r.jsxRuntimeExports.jsx(de.motion.svg,{width:`${a}px`,height:`${m}px`,viewBox:`0 0 ${a} ${m}`,ref:I,direction:"ltr",children:r.jsxRuntimeExports.jsxs("g",{ref:_,children:[ae.filter(e=>e.position==="before").map(e=>e.layer),k.features.map((e,x)=>r.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((o,E)=>{let i="";return o.forEach(t=>{let u=" M";t.forEach((w,Re)=>{const ue=N([w[0],w[1]]);Re!==t.length-1?u=`${u}${ue[0]} ${ue[1]}L`:u=`${u}${ue[0]} ${ue[1]}`}),i+=u}),r.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:Q,strokeWidth:J,fill:H}},E)}):e.geometry.coordinates.map((o,E)=>{let i="M";return o.forEach((t,u)=>{const w=N([t[0],t[1]]);u!==o.length-1?i=`${i}${w[0]} ${w[1]}L`:i=`${i}${w[0]} ${w[1]}`}),r.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:Q,strokeWidth:J,fill:H}},E)})},x)),r.jsxRuntimeExports.jsx(qe.AnimatePresence,{children:l.map(e=>{const x=l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray;return r.jsxRuntimeExports.jsxs(de.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:A?A===x?1:oe:te.length!==0?te.indexOf(e.label||"")!==-1?1:oe:1,transition:{duration:y.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:y.duration}},onMouseEnter:o=>{f(e),V(o.clientY),U(o.clientX),ee?.(e)},onMouseMove:o=>{f(e),V(o.clientY),U(o.clientX)},onMouseLeave:()=>{f(void 0),U(void 0),V(void 0),ee?.(void 0)},onClick:()=>{(B||D)&&(Ce.isEqual(P,e)&&g?(G(void 0),B?.(void 0)):(G(e),B?.(e)))},transform:`translate(${N([e.long,e.lat])[0]},${N([e.long,e.lat])[1]})`,children:[r.jsxRuntimeExports.jsx(de.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray,stroke:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray},whileInView:{r:d?d(e.radius||0):v,fill:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray,stroke:l.filter(o=>o.color).length===0?c[0]:e.color?c[j.indexOf(`${e.color}`)]:R.Colors.gray,transition:{duration:y.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{r:0,transition:{duration:y.duration}},style:{fillOpacity:.8}}),pe&&e.label?r.jsxRuntimeExports.jsx(de.motion.text,{variants:{initial:{opacity:0,x:d?d(e.radius||0):v},whileInView:{opacity:1,x:d?d(e.radius||0):v,transition:{duration:y.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:y.duration}},y:0,className:"fill-primary-gray-600 dark:fill-primary-gray-300 text-sm",style:{textAnchor:"start"},dx:4,dy:5,children:e.label}):null]},e.label||`${e.lat}-${e.long}`)})}),ae.filter(e=>e.position==="after").map(e=>e.layer)]})}),l.filter(e=>e.color).length===0||xe===!1?null:r.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:F?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{h(!1)},children:r.jsxRuntimeExports.jsx(ve.X,{})}),r.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[M&&M!==""?r.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:M}):null,r.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:j.map((e,x)=>r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{se(c[x%c.length])},onMouseLeave:()=>{se(void 0)},children:[r.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:c[x%c.length]}}),r.jsxRuntimeExports.jsx(Se.u,{size:"sm",marginBottom:"none",leading:"none",children:e})]},x))})]})]}):r.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{h(!0)},children:r.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="button"&&r.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[r.jsxRuntimeExports.jsx("button",{onClick:()=>W("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),r.jsxRuntimeExports.jsx("button",{onClick:()=>W("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),D&&P!==void 0?r.jsxRuntimeExports.jsx(De.X,{open:P!==void 0,onClose:()=>{G(void 0)},children:r.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof D=="string"?{__html:$e.string2HTML(D,P)}:void 0,children:typeof D=="function"?D(P):null})}):null,ne&&Z&&b&&le?r.jsxRuntimeExports.jsx(Ne.Tooltip,{data:ne,body:Z,xPos:b,yPos:le,backgroundStyle:re?.tooltip,className:ge?.tooltip}):null]})}function Ve(me){const{data:l,mapData:c="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",graphTitle:k,colors:M,sources:j,graphDescription:v,height:m,width:a,footNote:K="The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.",colorLegendTitle:O,colorDomain:Z,radius:pe=5,scale:J=.95,centerPoint:Q,padding:H,mapBorderWidth:ee=.5,mapNoDataColor:xe=R.Colors.light.graphNoData,backgroundColor:C=!1,showLabels:he=!1,mapBorderColor:te=R.Colors.light.grays["gray-500"],tooltip:B,relativeHeight:g,onSeriesMouseOver:D,isWorldMap:re=!0,showColorScale:ge=!0,zoomScaleExtend:T=[.8,6],zoomTranslateExtend:q,graphID:y,highlightedDataPoints:oe=[],onSeriesMouseClick:ae,graphDownload:ie=!1,dataDownload:A=!1,showAntarctica:se=!1,language:F="en",minHeight:h=0,theme:z="light",ariaLabel:P,resetSelectionOnDoubleClick:G=!0,detailsOnClick:ne,styles:f,classNames:b,mapProjection:U,zoomInteraction:le="button",animate:V=!1,dimmedOpacity:I=.3,customLayers:X=[],maxRadiusValue:_,timeline:d={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=me,[p,S]=n.useState(0),[Y,ce]=n.useState(0),[L,ye]=n.useState(d.autoplay),s=fe.sort(be.uniqBy(l.filter(t=>t.date!==void 0&&t.date!==null),t=>t.date).map(t=>Ee.parse(`${t.date}`,d.dateFormat||"yyyy",new Date).getTime()),(t,u)=>Te.ascending(t,u)),[N,W]=n.useState(d.autoplay?0:s.length-1),[e,x]=n.useState(void 0),o=n.useRef(null),E=n.useRef(null);n.useEffect(()=>{const t=new ResizeObserver(u=>{S(a||u[0].target.clientWidth||760),ce(m||u[0].target.clientHeight||480)});return o.current&&(ce(o.current.clientHeight||480),S(o.current.clientWidth||760),a||t.observe(o.current)),()=>t.disconnect()},[a,m]),n.useEffect(()=>{typeof c=="string"?Le.fetchAndParseJSON(c).then(u=>{x(u)}):x(c)},[c]),n.useEffect(()=>{const t=setInterval(()=>{W(u=>u<s.length-1?u+1:0)},(d.speed||2)*1e3);return L||clearInterval(t),()=>clearInterval(t)},[s,L,d.speed]);const i=fe.getSliderMarks(s,N,d.showOnlyActiveDate,d.dateFormat||"yyyy");return r.jsxRuntimeExports.jsx("div",{className:`${z||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:F==="he"||F==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:r.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${F||"en"}`,b?.graphContainer),style:{...f?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:y,ref:E,"aria-label":P||`${k?`The graph shows ${k}. `:""}This is a dot density map showing the distribution of a variable across a region or world, with each dot representing a data point.${v?` ${v}`:""}`,children:r.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?H||"1rem":H||0},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[k||v||ie||A?r.jsxRuntimeExports.jsx(Ie.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:b?.title,description:b?.description},graphTitle:k,graphDescription:v,width:a,graphDownload:ie?E.current:void 0,dataDownload:A?l.map(t=>t.data).filter(t=>t!==void 0).length>0?l.map(t=>t.data).filter(t=>t!==void 0):l.filter(t=>t!==void 0):null}):null,d.enabled&&s.length>0&&i?r.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[r.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ye(!L)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":L?"Click to pause animation":"Click to play animation",children:L?r.jsxRuntimeExports.jsx(ve.Pause,{}):r.jsxRuntimeExports.jsx(ve.Play,{})}),r.jsxRuntimeExports.jsx(fe.xr,{min:s[0],max:s[s.length-1],marks:i,step:null,defaultValue:s[s.length-1],value:s[N],onChangeComplete:t=>{W(s.indexOf(t))},onChange:t=>{W(s.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,r.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:o,"aria-label":"Map area",children:(a||p)&&(m||Y)&&e?r.jsxRuntimeExports.jsx(ze,{data:l.filter(t=>d.enabled?t.date===Ee.format(new Date(s[N]),d.dateFormat||"yyyy"):t),mapData:se?e:{...e,features:e.features.filter(t=>t.properties.NAME!=="Antarctica")},colorDomain:l.filter(t=>t.color).length===0?[]:Z||be.uniqBy(l.filter(t=>!we.checkIfNullOrUndefined(t.color)),"color").map(t=>`${t.color}`),width:a||p,height:Math.max(h,m||(g?h?(a||p)*g>h?(a||p)*g:h:(a||p)*g:Y)),scale:J,centerPoint:Q,colors:l.filter(t=>t.color).length===0?M?[M]:[R.Colors.primaryColors["blue-600"]]:M||R.Colors[z].categoricalColors.colors,colorLegendTitle:O,radius:pe,mapBorderWidth:ee,mapNoDataColor:xe,mapBorderColor:te,tooltip:B,onSeriesMouseOver:D,showLabels:he,isWorldMap:re,showColorScale:ge,zoomScaleExtend:T,zoomTranslateExtend:q,onSeriesMouseClick:ae,highlightedDataPoints:oe,resetSelectionOnDoubleClick:G,styles:f,classNames:b,zoomInteraction:le,detailsOnClick:ne,mapProjection:U||(re?"naturalEarth":"mercator"),animate:V===!0?{duration:.5,once:!0,amount:.5}:V||{duration:0,once:!0,amount:0},dimmedOpacity:I,customLayers:X,maxRadiusValue:we.checkIfNullOrUndefined(_)?Math.max(...l.map(t=>t.radius).filter(t=>t!=null)):_}):r.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,m||(g?h?(a||p)*g>h?(a||p)*g:h:(a||p)*g:Y))}px`},className:"flex items-center justify-center",children:r.jsxRuntimeExports.jsx(ke.y,{"aria-label":"Loading graph"})})}),j||K?r.jsxRuntimeExports.jsx(Pe.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:j,footNote:K,width:a}):null]})})})})}exports.DotDensityMap=Ve;
|
|
2
2
|
//# sourceMappingURL=DotDensityMap.cjs.map
|