@undp/data-viz 1.4.7 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +58 -58
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/DifferenceLineChart.cjs +1 -1
  6. package/dist/DifferenceLineChart.cjs.map +1 -1
  7. package/dist/DifferenceLineChart.js +44 -44
  8. package/dist/DifferenceLineChart.js.map +1 -1
  9. package/dist/DualAxisLineChart.cjs +1 -1
  10. package/dist/DualAxisLineChart.cjs.map +1 -1
  11. package/dist/DualAxisLineChart.js +1 -1
  12. package/dist/DualAxisLineChart.js.map +1 -1
  13. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  14. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  15. package/dist/LineChartWithConfidenceInterval.js +33 -33
  16. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  17. package/dist/MultiLineAltChart.cjs +1 -1
  18. package/dist/MultiLineAltChart.cjs.map +1 -1
  19. package/dist/MultiLineAltChart.js +78 -78
  20. package/dist/MultiLineAltChart.js.map +1 -1
  21. package/dist/MultiLineChart.cjs +1 -1
  22. package/dist/MultiLineChart.cjs.map +1 -1
  23. package/dist/MultiLineChart.js +28 -28
  24. package/dist/MultiLineChart.js.map +1 -1
  25. package/dist/ScatterPlot.cjs +1 -1
  26. package/dist/ScatterPlot.cjs.map +1 -1
  27. package/dist/ScatterPlot.js +43 -43
  28. package/dist/ScatterPlot.js.map +1 -1
  29. package/dist/SimpleLineChart.cjs +1 -1
  30. package/dist/SimpleLineChart.cjs.map +1 -1
  31. package/dist/SimpleLineChart.js +17 -17
  32. package/dist/SimpleLineChart.js.map +1 -1
  33. package/dist/SparkLine.cjs +1 -1
  34. package/dist/SparkLine.cjs.map +1 -1
  35. package/dist/SparkLine.js +1 -1
  36. package/dist/SparkLine.js.map +1 -1
  37. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MultiLineChart.js","sources":["../src/Components/Graphs/LineCharts/MultiLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/MultiLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveLinear,\r\n curveMonotoneX,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport sortBy from 'lodash.sortby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\r\n lineColors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n labels: (string | number)[];\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues: boolean;\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 showColorLegendAtTop: boolean;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n dashedLines: (string | number)[];\r\n dashSettings: string[];\r\n labelsToBeHidden: (string | number)[];\r\n revealClipId: string;\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n dateFormat,\r\n noOfXTicks,\r\n labels,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n leftMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showValues,\r\n showColorLegendAtTop,\r\n refValues,\r\n highlightAreaSettings,\r\n minValue,\r\n maxValue,\r\n highlightedLines,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n dashedLines,\r\n dashSettings,\r\n labelsToBeHidden,\r\n revealClipId,\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 dataArray = dataFormatted[0].y.map((_d, i) => {\r\n return dataFormatted\r\n .map(el => ({\r\n ...el,\r\n y: el.y[i],\r\n }))\r\n .filter(el => !checkIfNullOrUndefined(el.y));\r\n });\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = checkIfNullOrUndefined(minValue)\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0\r\n : (minValue as number);\r\n const maxParam: number = Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0;\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n\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 setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n 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 <defs>\r\n <clipPath id={revealClipId}>\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n height={graphHeight}\r\n variants={{\r\n initial: { width: 0 },\r\n whileInView: {\r\n width: graphWidth,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </clipPath>\r\n </defs>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n {dataArray.map((d, i) => (\r\n <motion.g\r\n key={labels[i]}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n strokeWidth,\r\n }}\r\n clipPath={`url(#${revealClipId})`}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n ...(dashedLines.length === 0 ? { pathLength: 0 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n },\r\n whileInView: {\r\n ...(dashedLines.length === 0 ? { pathLength: 1 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n strokeDasharray={\r\n dashedLines.includes(labels[i])\r\n ? dashSettings[i % dashSettings.length]\r\n : undefined\r\n }\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[i] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(el.date), cy: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n fill: lineColors[i],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(el.date), y: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(el.date),\r\n y: y(el.y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n {showColorLegendAtTop || labelsToBeHidden.includes(labels[i]) ? null : (\r\n <motion.text\r\n style={{ fill: lineColors[i] }}\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(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {labels[i]}\r\n </motion.text>\r\n )}\r\n </motion.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 </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 {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\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 of the lines */\r\n lineColors?: 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 /** Array of labels of line which are dashed */\r\n dashedLines?: (string | number)[];\r\n /** Array of dash settings that define the dash style for the dashed line. If the length of the array is less than length of dashedLines then it loop around. */\r\n dashSettings?: string[];\r\n /** Defines which labels are hidden from the color scale and the graph */\r\n labelsToBeHidden?: (string | number)[];\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Labels for the lines */\r\n labels: (string | number)[];\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function MultiLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n lineColors = Colors.light.categoricalColors.colors,\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 labels,\r\n padding,\r\n showValues = false,\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 relativeHeight,\r\n onSeriesMouseOver,\r\n showColorLegendAtTop = false,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n highlightedLines = [],\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n colorLegendTitle,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n dashedLines = [],\r\n dashSettings = ['5 5'],\r\n labelsToBeHidden = [],\r\n showColorScale = true,\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 multi-line chart that shows trends over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop && showColorScale ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n labelsToBeHidden={labelsToBeHidden}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n dateFormat={dateFormat}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n labels={labels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorScale ? showColorLegendAtTop : true}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n highlightedLines={highlightedLines}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n labelsToBeHidden={labelsToBeHidden}\r\n dashedLines={dashedLines}\r\n dashSettings={dashSettings}\r\n revealClipId={generateRandomString(8)}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","dateFormat","noOfXTicks","labels","rightMargin","topMargin","bottomMargin","suffix","prefix","leftMargin","tooltip","onSeriesMouseOver","showValues","showColorLegendAtTop","refValues","highlightAreaSettings","minValue","maxValue","highlightedLines","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","dimmedOpacity","precision","customLayers","dashedLines","dashSettings","labelsToBeHidden","revealClipId","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","dataArray","_d","el","checkIfNullOrUndefined","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","MultiLineChart","graphTitle","Colors","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","colorLegendTitle","minHeight","theme","ariaLabel","showColorScale","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings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B,KAAWE,IACVvB,gBAAAA,EAAAA;AAAAA,kBAACgD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUlH,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAsF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAzH;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":"MultiLineChart.js","sources":["../src/Components/Graphs/LineCharts/MultiLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/MultiLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveLinear,\r\n curveMonotoneX,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport sortBy from 'lodash.sortby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\r\n lineColors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n labels: (string | number)[];\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues: boolean;\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 showColorLegendAtTop: boolean;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n dashedLines: (string | number)[];\r\n dashSettings: string[];\r\n labelsToBeHidden: (string | number)[];\r\n revealClipId: string;\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n dateFormat,\r\n noOfXTicks,\r\n labels,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n leftMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showValues,\r\n showColorLegendAtTop,\r\n refValues,\r\n highlightAreaSettings,\r\n minValue,\r\n maxValue,\r\n highlightedLines,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n dashedLines,\r\n dashSettings,\r\n labelsToBeHidden,\r\n revealClipId,\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 dataArray = dataFormatted[0].y.map((_d, i) => {\r\n return dataFormatted\r\n .map(el => ({\r\n ...el,\r\n y: el.y[i],\r\n }))\r\n .filter(el => !checkIfNullOrUndefined(el.y));\r\n });\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = checkIfNullOrUndefined(minValue)\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0\r\n : (minValue as number);\r\n const maxParam: number = Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0;\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n 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 <defs>\r\n <clipPath id={revealClipId}>\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n height={graphHeight}\r\n variants={{\r\n initial: { width: 0 },\r\n whileInView: {\r\n width: graphWidth,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </clipPath>\r\n </defs>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n {dataArray.map((d, i) => (\r\n <motion.g\r\n key={labels[i]}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n strokeWidth,\r\n }}\r\n clipPath={`url(#${revealClipId})`}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n ...(dashedLines.length === 0 ? { pathLength: 0 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n },\r\n whileInView: {\r\n ...(dashedLines.length === 0 ? { pathLength: 1 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n strokeDasharray={\r\n dashedLines.includes(labels[i])\r\n ? dashSettings[i % dashSettings.length]\r\n : undefined\r\n }\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[i] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(el.date), cy: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n fill: lineColors[i],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(el.date), y: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(el.date),\r\n y: y(el.y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n {showColorLegendAtTop || labelsToBeHidden.includes(labels[i]) ? null : (\r\n <motion.text\r\n style={{ fill: lineColors[i] }}\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(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {labels[i]}\r\n </motion.text>\r\n )}\r\n </motion.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 </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 {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\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 of the lines */\r\n lineColors?: 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 /** Array of labels of line which are dashed */\r\n dashedLines?: (string | number)[];\r\n /** Array of dash settings that define the dash style for the dashed line. If the length of the array is less than length of dashedLines then it loop around. */\r\n dashSettings?: string[];\r\n /** Defines which labels are hidden from the color scale and the graph */\r\n labelsToBeHidden?: (string | number)[];\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Labels for the lines */\r\n labels: (string | number)[];\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n\r\n // Configuration and Options\r\n /** Language setting */\r\n language?: Languages;\r\n /** Color theme */\r\n theme?: 'light' | 'dark';\r\n /** Unique ID for the graph */\r\n graphID?: string;\r\n}\r\n\r\nexport function MultiLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n lineColors = Colors.light.categoricalColors.colors,\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 labels,\r\n padding,\r\n showValues = false,\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 relativeHeight,\r\n onSeriesMouseOver,\r\n showColorLegendAtTop = false,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n highlightedLines = [],\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n colorLegendTitle,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n dashedLines = [],\r\n dashSettings = ['5 5'],\r\n labelsToBeHidden = [],\r\n showColorScale = true,\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 multi-line chart that shows trends over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop && showColorScale ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n labelsToBeHidden={labelsToBeHidden}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n dateFormat={dateFormat}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n labels={labels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorScale ? showColorLegendAtTop : true}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n highlightedLines={highlightedLines}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n labelsToBeHidden={labelsToBeHidden}\r\n dashedLines={dashedLines}\r\n dashSettings={dashSettings}\r\n revealClipId={generateRandomString(8)}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","dateFormat","noOfXTicks","labels","rightMargin","topMargin","bottomMargin","suffix","prefix","leftMargin","tooltip","onSeriesMouseOver","showValues","showColorLegendAtTop","refValues","highlightAreaSettings","minValue","maxValue","highlightedLines","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","dimmedOpacity","precision","customLayers","dashedLines","dashSettings","labelsToBeHidden","revealClipId","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","dataArray","_d","el","checkIfNullOrUndefined","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","MultiLineChart","graphTitle","Colors","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","colorLegendTitle","minHeight","theme","ariaLabel","showColorScale","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACE1C,IACE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ACA,6BAAAC;AAAA,sBACA,YAAAC;AAAA,sBACA,YAAAC;AAAA,sBACA,SAAAC;AAAA,sBACA,SAAAC;AAAA,sBACA,WAAAC;AAAA,sBACA,QAAAC;AAAA,sBACA,YAAAC;AAAA,sBACA,eAAAC;AAAA,sBACA,WAAAC;AAAA,sBACA,cAAAC;AAAA,sBACA,kBAAAG;AAAA,sBACA,aAAAF;AAAA,sBACA,cAAAC;AAAA,sBACA,cAAc2G,GAAqB,CAAC;AAAA,oBAAA;AAAA,kBAAA,IAEpC,KAAA,CACN;AAAA,gBAAA,EAAA,CACF,EAAA,CAEJ;AAAA,gBACC1B,KAAWE,IACVvB,gBAAAA,EAAAA;AAAAA,kBAACgD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUlH,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAsF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAzH;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ke=require("./index-CZbIGs8q.cjs"),Me=require("./parse-hMnG_lRV.cjs"),j=require("react"),Ae=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./index-BXns0-ng.cjs"),Ue=require("./index-BczVvEBZ.cjs"),Le=require("./simple-statistics-xm8c0LQQ.cjs"),Fe=require("./Modal-tXZlLE5s.cjs"),He=require("./Tooltip-n8z5bfav.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),N=require("./Colors.cjs"),Ve=require("./numberFormattingFunction-02t-wJta.cjs"),Ne=require("./customArea-CK768gCn.cjs"),Ge=require("./string2HTML-D2Avudmb.cjs"),$e=require("./Axis-DE7dSn1_.cjs"),Te=require("./AxisTitle-CK9YeovX.cjs"),We=require("./XTicksAndGridLines-CCzXIV8d.cjs"),De=require("./ReferenceLine-CFVBBN__.cjs"),Be=require("./RegressionLine-xKdiJ8sw.cjs"),ze=require("./YTicksAndGridLines-DBDuz6vb.cjs"),_e=require("./index-DNj994Pv.cjs"),Je=require("./pow-B5-jkdHU.cjs"),Pe=require("./linear-BVckp9RD.cjs"),Ke=require("./delaunay-rcy0HhZi.cjs"),Qe=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Xe=require("./index-BW8iNx7E.cjs"),Ze=require("./GraphFooter.cjs"),et=require("./GraphHeader.cjs"),tt=require("./ColorLegendWithMouseOver.cjs"),it=require("./EmptyState-d8_8SxeW.cjs"),Ye=require("./index-BW_-wD2k.cjs"),st=require("./ensureCompleteData-DqWQ2Zbi.cjs"),ot=require("./init-DU0ybBc_.cjs");function rt(ge){const{data:s,width:q,height:M,showLabels:se,colors:l,colorDomain:C,radius:R,xAxisTitle:d,yAxisTitle:J,leftMargin:G,rightMargin:ye,topMargin:pe,bottomMargin:oe,tooltip:re,onSeriesMouseOver:X,refXValues:I,refYValues:je,highlightAreaSettings:ve,selectedColor:W,highlightedDataPoints:L,maxRadiusValue:be,maxXValue:B,minXValue:w,maxYValue:Oe,minYValue:E,onSeriesMouseClick:V,rtl:K,annotations:Ce,customHighlightAreaSettings:Re,regressionLine:z,resetSelectionOnDoubleClick:Q,detailsOnClick:k,noOfXTicks:ne,noOfYTicks:le,labelColor:Z,xSuffix:ae,ySuffix:ce,xPrefix:xe,yPrefix:ue,styles:x,classNames:u,animate:n,dimmedOpacity:A,precision:S,customLayers:fe}=ge,me=j.useRef(null),p=Qe.useInView(me,{once:n.once,amount:n.amount}),[$,T]=j.useState(void 0),[D,Y]=j.useState(void 0),[de,P]=j.useState(void 0),[he,v]=j.useState(void 0),h={top:pe,bottom:d?oe+50:oe,left:J?G+30:G,right:ye},_=s.map((e,y)=>({...e,id:`${y}`})),g=q-h.left-h.right,b=M-h.top-h.bottom,O=s.filter(e=>e.radius===void 0||e.radius===null).length!==s.length?Je.sqrt().domain([0,be]).range([.25,R]).nice():void 0,m=_.filter(e=>!c.checkIfNullOrUndefined(e.radius)).length===0?_:Ue.orderBy(_.filter(e=>!c.checkIfNullOrUndefined(e.radius)),"radius","desc"),r=Pe.linear().domain([w,B]).range([0,g]).nice(),a=Pe.linear().domain([E,Oe]).range([b,0]).nice(),ee=r.ticks(ne),te=a.ticks(le),U=Ke.Delaunay.from(m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)),e=>r(e.x),e=>a(e.y)).voronoi([0,0,g<0?0:g,b<0?0:b]),we=Le.linearRegression(s.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map(e=>[r(e.x),a(e.y)])),f=Le.linearRegressionLine(we);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(ie.motion.svg,{width:`${q}px`,height:`${M}px`,viewBox:`0 0 ${q} ${M}`,direction:"ltr",ref:me,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[i.jsxRuntimeExports.jsx(_e.HighlightAreaForScatterPlot,{areaSettings:ve,width:g,height:b,scaleX:r,scaleY:a,animate:n,isInView:p}),i.jsxRuntimeExports.jsx(Ne.CustomArea,{areaSettings:Re,scaleX:r,scaleY:a,animate:n,isInView:p})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(ze.YTicksAndGridLines,{values:te.filter(e=>e!==0),y:te.filter(e=>e!==0).map(e=>a(e)),x1:0,x2:g+h.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:u?.yAxis?.gridLines,labels:u?.yAxis?.labels},suffix:ce,prefix:ue,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{y1:a(E<0?0:E),y2:a(E<0?0:E),x1:0,x2:g+h.right,label:Ve.numberFormattingFunction(E<0?0:E,"NA",S,ue,ce),labelPos:{x:0,y:a(E<0?0:E),dy:"0.33em",dx:-4},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"end",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:0-G-15,y:b/2,style:x?.yAxis?.title,className:u?.yAxis?.title,text:J,rotate90:!0})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(We.XTicksAndGridLines,{values:ee.filter(e=>e!==0),x:ee.filter(e=>e!==0).map(e=>r(e)),y1:0,y2:b,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:u?.xAxis?.gridLines,labels:u?.xAxis?.labels},suffix:ae,prefix:xe,labelType:"primary",showGridLines:!0,precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{x1:r(w<0?0:w),x2:r(w<0?0:w),y1:0,y2:b,label:Ve.numberFormattingFunction(w<0?0:w,"NA",S,xe,ae),labelPos:{x:r(w<0?0:w),y:b,dy:"1em",dx:0},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"middle",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:g/2,y:b+30,style:x?.xAxis?.title,className:u?.xAxis?.title,text:d})]}),fe.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsx("path",{d:U.renderCell(m.findIndex(o=>o.id===e.id)),opacity:0,onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))}},`${e.label||y}`)),m.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsxs(ie.motion.g,{variants:{initial:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1},whileInView:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",exit:{opacity:0,transition:{duration:n.duration}},onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))},children:[i.jsxRuntimeExports.jsx(ie.motion.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:n.duration}},variants:{initial:{r:0,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray},whileInView:{r:O?O(e.radius||0):R,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",style:{fillOpacity:.6}}),se&&!c.checkIfNullOrUndefined(e.label)?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray)},whileInView:{x:O?O(e.radius||0):R,opacity:1,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):L.length!==0&&!c.checkIfNullOrUndefined(e.label)&&L.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0},whileInView:{x:O?O(e.radius||0):R,opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):null]},`${e.label||y}`)),I.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineX,{text:e.text,color:e.color,x:r(e.value),y1:0,y2:b,textSide:r(e.value)>g*.75||K?"left":"right",classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),je.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineY,{text:e.text,color:e.color,y:a(e.value),x1:0,x2:g,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),i.jsxRuntimeExports.jsx("g",{children:Ce.map((e,y)=>{const o=Ne.getLineEndPoint({x:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(e.xCoordinate):0,y:e.yCoordinate?a(e.yCoordinate):0},c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),Ee=e.showConnector?{y1:o.y,x1:o.x,y2:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?a(e.yCoordinate):0,cx:e.xCoordinate?r(e.xCoordinate):0,circleRadius:c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,F={y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:K?0:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),width:K?e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0):g-(e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return i.jsxRuntimeExports.jsx(Ne.Annotation,{color:e.color,connectorsSettings:Ee,labelSettings:F,text:e.text,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)})}),z?i.jsxRuntimeExports.jsx(Be.RegressionLine,{x1:0,x2:g,y1:f(0),y2:f(g),graphHeight:b,graphWidth:g,className:u?.regLine,style:x?.regLine,color:typeof z=="string"?z:void 0,animate:n,isInView:p}):null]}),fe.filter(e=>e.position==="after").map(e=>e.layer)]})}),$&&re&&de&&he?i.jsxRuntimeExports.jsx(He.Tooltip,{data:$,body:re,xPos:de,yPos:he,backgroundStyle:x?.tooltip,className:u?.tooltip}):null,k&&D!==void 0?i.jsxRuntimeExports.jsx(Fe.X,{open:D!==void 0,onClose:()=>{Y(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof k=="string"?{__html:Ge.string2HTML(k,D)}:void 0,children:typeof k=="function"?k(D):null})}):null]})}function nt(ge){const{data:s,graphTitle:q,colors:M,sources:se,graphDescription:l,showLabels:C=!1,height:R,width:d,footNote:J,colorDomain:G,colorLegendTitle:ye,radius:pe=5,xAxisTitle:oe="X Axis",yAxisTitle:re="Y Axis",padding:X,backgroundColor:I=!1,leftMargin:je=0,rightMargin:ve=10,topMargin:W=20,bottomMargin:L=50,tooltip:be,relativeHeight:B,onSeriesMouseOver:w,refXValues:Oe=[],refYValues:E=[],highlightAreaSettings:V=[],showColorScale:K=!0,highlightedDataPoints:Ce=[],graphID:Re,maxRadiusValue:z,maxXValue:Q,minXValue:k,maxYValue:ne,minYValue:le,xSuffix:Z="",ySuffix:ae="",xPrefix:ce="",yPrefix:xe="",onSeriesMouseClick:ue,graphDownload:x=!1,dataDownload:u=!1,language:n="en",showNAColor:A=!0,minHeight:S=0,annotations:fe=[],customHighlightAreaSettings:me=[],theme:p="light",regressionLine:$=!1,ariaLabel:T,resetSelectionOnDoubleClick:D=!0,detailsOnClick:Y,noOfXTicks:de=5,noOfYTicks:P=5,labelColor:he,styles:v,classNames:h,animate:_=!1,dimmedOpacity:g=.3,precision:b=2,customLayers:O=[],timeline:m={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ge,[r,a]=j.useState(0),[ee,te]=j.useState(0),[U,we]=j.useState(m.autoplay),f=Ae.sort(ke.uniqBy(s.filter(t=>t.date!==void 0&&t.date!==null),t=>t.date).map(t=>Me.parse(`${t.date}`,m.dateFormat||"yyyy",new Date).getTime()),(t,H)=>ot.ascending(t,H)),[e,y]=j.useState(m.autoplay?0:f.length-1),[o,Ee]=j.useState(void 0),F=j.useRef(null),Se=j.useRef(null);j.useEffect(()=>{const t=new ResizeObserver(H=>{a(d||H[0].target.clientWidth||620),te(R||H[0].target.clientHeight||480)});return F.current&&(te(F.current.clientHeight||480),a(F.current.clientWidth||620),d||t.observe(F.current)),()=>t.disconnect()},[d,R]),j.useEffect(()=>{const t=setInterval(()=>{y(H=>H<f.length-1?H+1:0)},(m.speed||2)*1e3);return U||clearInterval(t),()=>clearInterval(t)},[f,U,m.speed]);const qe=Ae.getSliderMarks(f,e,m.showOnlyActiveDate,m.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${p||"light"} flex ${d?"w-fit grow-0":"w-full grow"}`,dir:n==="he"||n==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${n||"en"}`,h?.graphContainer),style:{...v?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:Re,ref:Se,"aria-label":T||`${q?`The graph shows ${q}. `:""}This is a scatter plot that shows correlation between two variables.${l?` ${l}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:I?X||"1rem":X||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[q||l||x||u?i.jsxRuntimeExports.jsx(et.GraphHeader,{styles:{title:v?.title,description:v?.description},classNames:{title:h?.title,description:h?.description},graphTitle:q,graphDescription:l,width:d,graphDownload:x?Se.current:void 0,dataDownload:u?s.map(t=>t.data).filter(t=>t!==void 0).length>0?s.map(t=>t.data).filter(t=>t!==void 0):s.filter(t=>t!==void 0):null}):null,m.enabled&&f.length>0&&qe?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?i.jsxRuntimeExports.jsx(Ye.Pause,{}):i.jsxRuntimeExports.jsx(Ye.Play,{})}),i.jsxRuntimeExports.jsx(Ae.xr,{min:f[0],max:f[f.length-1],marks:qe,step:null,defaultValue:f[f.length-1],value:f[e],onChangeComplete:t=>{y(f.indexOf(t))},onChange:t=>{y(f.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(it.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[K&&s.filter(t=>t.color).length!==0?i.jsxRuntimeExports.jsx(tt.ColorLegendWithMouseOver,{width:d,colorLegendTitle:ye,colors:M||N.Colors[p].categoricalColors.colors,colorDomain:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),setSelectedColor:Ee,showNAColor:A}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:F,"aria-label":"Graph area",children:(d||r)&&(R||ee)?i.jsxRuntimeExports.jsx(rt,{data:st.ensureCompleteDataForScatterPlot(s,m.dateFormat||"yyyy").filter(t=>m.enabled?t.date===Me.format(new Date(f[e]),m.dateFormat||"yyyy"):t),width:d||r,height:Math.max(S,R||(B?S?(d||r)*B>S?(d||r)*B:S:(d||r)*B:ee)),colorDomain:s.filter(t=>t.color).length===0?[]:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),colors:s.filter(t=>t.color).length===0?M?[M]:[N.Colors.primaryColors["blue-600"]]:M||N.Colors[p].categoricalColors.colors,xAxisTitle:oe,yAxisTitle:re,refXValues:Oe,refYValues:E,showLabels:C,radius:pe,leftMargin:je,rightMargin:ve,topMargin:W,bottomMargin:L,tooltip:be,onSeriesMouseOver:w,highlightAreaSettings:V,highlightedDataPoints:s.filter(t=>t.label).length===0?[]:Ce,selectedColor:o,maxRadiusValue:c.checkIfNullOrUndefined(z)?Math.max(...s.map(t=>t.radius).filter(t=>t!=null)):z,maxXValue:c.checkIfNullOrUndefined(Q)?Math.max(...s.map(t=>t.x).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.x).filter(t=>t!=null)):0:Q,minXValue:c.checkIfNullOrUndefined(k)?Math.min(...s.map(t=>t.x).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.x).filter(t=>t!=null)):k,maxYValue:c.checkIfNullOrUndefined(ne)?Math.max(...s.map(t=>t.y).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.y).filter(t=>t!=null)):0:ne,minYValue:c.checkIfNullOrUndefined(le)?Math.min(...s.map(t=>t.y).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.y).filter(t=>t!=null)):le,onSeriesMouseClick:ue,rtl:n==="he"||n==="ar",annotations:fe,customHighlightAreaSettings:me,regressionLine:$,resetSelectionOnDoubleClick:D,detailsOnClick:Y,noOfXTicks:de,noOfYTicks:P,labelColor:he,xSuffix:Z,ySuffix:ae,xPrefix:ce,yPrefix:xe,styles:v,classNames:h,animate:_===!0?{duration:.5,once:!0,amount:.5}:_||{duration:0,once:!0,amount:0},dimmedOpacity:g,precision:b,customLayers:O}):null})]})}),se||J?i.jsxRuntimeExports.jsx(Ze.GraphFooter,{styles:{footnote:v?.footnote,source:v?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:se,footNote:J,width:d}):null]})})})})}exports.ScatterPlot=nt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ke=require("./index-CZbIGs8q.cjs"),Me=require("./parse-hMnG_lRV.cjs"),j=require("react"),Ae=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./index-BXns0-ng.cjs"),Ue=require("./index-BczVvEBZ.cjs"),Le=require("./simple-statistics-xm8c0LQQ.cjs"),Fe=require("./Modal-tXZlLE5s.cjs"),He=require("./Tooltip-n8z5bfav.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),N=require("./Colors.cjs"),Ve=require("./numberFormattingFunction-02t-wJta.cjs"),Ne=require("./customArea-CK768gCn.cjs"),Ge=require("./string2HTML-D2Avudmb.cjs"),$e=require("./Axis-DE7dSn1_.cjs"),Te=require("./AxisTitle-CK9YeovX.cjs"),We=require("./XTicksAndGridLines-CCzXIV8d.cjs"),De=require("./ReferenceLine-CFVBBN__.cjs"),Be=require("./RegressionLine-xKdiJ8sw.cjs"),ze=require("./YTicksAndGridLines-DBDuz6vb.cjs"),_e=require("./index-DNj994Pv.cjs"),Je=require("./pow-B5-jkdHU.cjs"),Pe=require("./linear-BVckp9RD.cjs"),Ke=require("./delaunay-rcy0HhZi.cjs"),Qe=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Xe=require("./index-BW8iNx7E.cjs"),Ze=require("./GraphFooter.cjs"),et=require("./GraphHeader.cjs"),tt=require("./ColorLegendWithMouseOver.cjs"),it=require("./EmptyState-d8_8SxeW.cjs"),Ye=require("./index-BW_-wD2k.cjs"),st=require("./ensureCompleteData-DqWQ2Zbi.cjs"),ot=require("./init-DU0ybBc_.cjs");function rt(ge){const{data:s,width:q,height:M,showLabels:se,colors:l,colorDomain:C,radius:R,xAxisTitle:h,yAxisTitle:J,leftMargin:G,rightMargin:ye,topMargin:pe,bottomMargin:oe,tooltip:re,onSeriesMouseOver:X,refXValues:I,refYValues:je,highlightAreaSettings:ve,selectedColor:W,highlightedDataPoints:L,maxRadiusValue:be,maxXValue:B,minXValue:w,maxYValue:Oe,minYValue:E,onSeriesMouseClick:V,rtl:K,annotations:Ce,customHighlightAreaSettings:Re,regressionLine:z,resetSelectionOnDoubleClick:Q,detailsOnClick:k,noOfXTicks:ne,noOfYTicks:le,labelColor:Z,xSuffix:ae,ySuffix:ce,xPrefix:xe,yPrefix:ue,styles:x,classNames:u,animate:n,dimmedOpacity:A,precision:S,customLayers:fe}=ge,me=j.useRef(null),p=Qe.useInView(me,{once:n.once,amount:n.amount}),[$,T]=j.useState(void 0),[D,Y]=j.useState(void 0),[de,P]=j.useState(void 0),[he,v]=j.useState(void 0),m={top:pe,bottom:h?oe+50:oe,left:J?G+30:G,right:ye},_=s.map((e,y)=>({...e,id:`${y}`})),g=q-m.left-m.right,b=M-m.top-m.bottom,O=s.filter(e=>e.radius===void 0||e.radius===null).length!==s.length?Je.sqrt().domain([0,be]).range([.25,R]).nice():void 0,d=_.filter(e=>!c.checkIfNullOrUndefined(e.radius)).length===0?_:Ue.orderBy(_.filter(e=>!c.checkIfNullOrUndefined(e.radius)),"radius","desc"),r=Pe.linear().domain([w,B]).range([0,g]).nice(),a=Pe.linear().domain([E,Oe]).range([b,0]).nice(),ee=r.ticks(ne),te=a.ticks(le),U=Ke.Delaunay.from(d.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)),e=>r(e.x),e=>a(e.y)).voronoi([0,0,g<0?0:g,b<0?0:b]),we=Le.linearRegression(s.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map(e=>[r(e.x),a(e.y)])),f=Le.linearRegressionLine(we);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(ie.motion.svg,{width:`${q}px`,height:`${M}px`,viewBox:`0 0 ${q} ${M}`,direction:"ltr",ref:me,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${m.left},${m.top})`,children:[i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[i.jsxRuntimeExports.jsx(_e.HighlightAreaForScatterPlot,{areaSettings:ve,width:g,height:b,scaleX:r,scaleY:a,animate:n,isInView:p}),i.jsxRuntimeExports.jsx(Ne.CustomArea,{areaSettings:Re,scaleX:r,scaleY:a,animate:n,isInView:p})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(ze.YTicksAndGridLines,{values:te.filter(e=>e!==0),y:te.filter(e=>e!==0).map(e=>a(e)),x1:0,x2:g+m.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:u?.yAxis?.gridLines,labels:u?.yAxis?.labels},suffix:ce,prefix:ue,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{y1:a(E<0?0:E),y2:a(E<0?0:E),x1:0,x2:g+m.right,label:Ve.numberFormattingFunction(E<0?0:E,"NA",S,ue,ce),labelPos:{x:0,y:a(E<0?0:E),dy:"0.33em",dx:-4},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"end",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:0-G-15,y:b/2,style:x?.yAxis?.title,className:u?.yAxis?.title,text:J,rotate90:!0})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(We.XTicksAndGridLines,{values:ee.filter(e=>e!==0),x:ee.filter(e=>e!==0).map(e=>r(e)),y1:0,y2:b,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:u?.xAxis?.gridLines,labels:u?.xAxis?.labels},suffix:ae,prefix:xe,labelType:"primary",showGridLines:!0,precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{x1:r(w<0?0:w),x2:r(w<0?0:w),y1:0,y2:b,label:Ve.numberFormattingFunction(w<0?0:w,"NA",S,xe,ae),labelPos:{x:r(w<0?0:w),y:b,dy:"1em",dx:0},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"middle",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:g/2,y:b+30,style:x?.xAxis?.title,className:u?.xAxis?.title,text:h})]}),fe.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[d.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsx("path",{d:U.renderCell(d.findIndex(o=>o.id===e.id)),opacity:0,onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))}},`${e.label||y}`)),d.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsxs(ie.motion.g,{variants:{initial:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1},whileInView:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:$?$.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",exit:{opacity:0,transition:{duration:n.duration}},onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))},children:[i.jsxRuntimeExports.jsx(ie.motion.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:n.duration}},variants:{initial:{r:0,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray},whileInView:{r:O?O(e.radius||0):R,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",style:{fillOpacity:.6}}),se&&!c.checkIfNullOrUndefined(e.label)?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray)},whileInView:{x:O?O(e.radius||0):R,opacity:1,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):L.length!==0&&!c.checkIfNullOrUndefined(e.label)&&L.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0},whileInView:{x:O?O(e.radius||0):R,opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):null]},`${e.label||y}`)),I.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineX,{text:e.text,color:e.color,x:r(e.value),y1:0,y2:b,textSide:r(e.value)>g*.75||K?"left":"right",classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),je.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineY,{text:e.text,color:e.color,y:a(e.value),x1:0,x2:g,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),i.jsxRuntimeExports.jsx("g",{children:Ce.map((e,y)=>{const o=Ne.getLineEndPoint({x:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(e.xCoordinate):0,y:e.yCoordinate?a(e.yCoordinate):0},c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),Ee=e.showConnector?{y1:o.y,x1:o.x,y2:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?a(e.yCoordinate):0,cx:e.xCoordinate?r(e.xCoordinate):0,circleRadius:c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,F={y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:K?0:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),width:K?e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0):g+m.right-(e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return i.jsxRuntimeExports.jsx(Ne.Annotation,{color:e.color,connectorsSettings:Ee,labelSettings:F,text:e.text,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)})}),z?i.jsxRuntimeExports.jsx(Be.RegressionLine,{x1:0,x2:g,y1:f(0),y2:f(g),graphHeight:b,graphWidth:g,className:u?.regLine,style:x?.regLine,color:typeof z=="string"?z:void 0,animate:n,isInView:p}):null]}),fe.filter(e=>e.position==="after").map(e=>e.layer)]})}),$&&re&&de&&he?i.jsxRuntimeExports.jsx(He.Tooltip,{data:$,body:re,xPos:de,yPos:he,backgroundStyle:x?.tooltip,className:u?.tooltip}):null,k&&D!==void 0?i.jsxRuntimeExports.jsx(Fe.X,{open:D!==void 0,onClose:()=>{Y(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof k=="string"?{__html:Ge.string2HTML(k,D)}:void 0,children:typeof k=="function"?k(D):null})}):null]})}function nt(ge){const{data:s,graphTitle:q,colors:M,sources:se,graphDescription:l,showLabels:C=!1,height:R,width:h,footNote:J,colorDomain:G,colorLegendTitle:ye,radius:pe=5,xAxisTitle:oe="X Axis",yAxisTitle:re="Y Axis",padding:X,backgroundColor:I=!1,leftMargin:je=0,rightMargin:ve=10,topMargin:W=20,bottomMargin:L=50,tooltip:be,relativeHeight:B,onSeriesMouseOver:w,refXValues:Oe=[],refYValues:E=[],highlightAreaSettings:V=[],showColorScale:K=!0,highlightedDataPoints:Ce=[],graphID:Re,maxRadiusValue:z,maxXValue:Q,minXValue:k,maxYValue:ne,minYValue:le,xSuffix:Z="",ySuffix:ae="",xPrefix:ce="",yPrefix:xe="",onSeriesMouseClick:ue,graphDownload:x=!1,dataDownload:u=!1,language:n="en",showNAColor:A=!0,minHeight:S=0,annotations:fe=[],customHighlightAreaSettings:me=[],theme:p="light",regressionLine:$=!1,ariaLabel:T,resetSelectionOnDoubleClick:D=!0,detailsOnClick:Y,noOfXTicks:de=5,noOfYTicks:P=5,labelColor:he,styles:v,classNames:m,animate:_=!1,dimmedOpacity:g=.3,precision:b=2,customLayers:O=[],timeline:d={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ge,[r,a]=j.useState(0),[ee,te]=j.useState(0),[U,we]=j.useState(d.autoplay),f=Ae.sort(ke.uniqBy(s.filter(t=>t.date!==void 0&&t.date!==null),t=>t.date).map(t=>Me.parse(`${t.date}`,d.dateFormat||"yyyy",new Date).getTime()),(t,H)=>ot.ascending(t,H)),[e,y]=j.useState(d.autoplay?0:f.length-1),[o,Ee]=j.useState(void 0),F=j.useRef(null),Se=j.useRef(null);j.useEffect(()=>{const t=new ResizeObserver(H=>{a(h||H[0].target.clientWidth||620),te(R||H[0].target.clientHeight||480)});return F.current&&(te(F.current.clientHeight||480),a(F.current.clientWidth||620),h||t.observe(F.current)),()=>t.disconnect()},[h,R]),j.useEffect(()=>{const t=setInterval(()=>{y(H=>H<f.length-1?H+1:0)},(d.speed||2)*1e3);return U||clearInterval(t),()=>clearInterval(t)},[f,U,d.speed]);const qe=Ae.getSliderMarks(f,e,d.showOnlyActiveDate,d.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${p||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:n==="he"||n==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${n||"en"}`,m?.graphContainer),style:{...v?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:Re,ref:Se,"aria-label":T||`${q?`The graph shows ${q}. `:""}This is a scatter plot that shows correlation between two variables.${l?` ${l}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:I?X||"1rem":X||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[q||l||x||u?i.jsxRuntimeExports.jsx(et.GraphHeader,{styles:{title:v?.title,description:v?.description},classNames:{title:m?.title,description:m?.description},graphTitle:q,graphDescription:l,width:h,graphDownload:x?Se.current:void 0,dataDownload:u?s.map(t=>t.data).filter(t=>t!==void 0).length>0?s.map(t=>t.data).filter(t=>t!==void 0):s.filter(t=>t!==void 0):null}):null,d.enabled&&f.length>0&&qe?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?i.jsxRuntimeExports.jsx(Ye.Pause,{}):i.jsxRuntimeExports.jsx(Ye.Play,{})}),i.jsxRuntimeExports.jsx(Ae.xr,{min:f[0],max:f[f.length-1],marks:qe,step:null,defaultValue:f[f.length-1],value:f[e],onChangeComplete:t=>{y(f.indexOf(t))},onChange:t=>{y(f.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(it.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[K&&s.filter(t=>t.color).length!==0?i.jsxRuntimeExports.jsx(tt.ColorLegendWithMouseOver,{width:h,colorLegendTitle:ye,colors:M||N.Colors[p].categoricalColors.colors,colorDomain:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),setSelectedColor:Ee,showNAColor:A}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:F,"aria-label":"Graph area",children:(h||r)&&(R||ee)?i.jsxRuntimeExports.jsx(rt,{data:st.ensureCompleteDataForScatterPlot(s,d.dateFormat||"yyyy").filter(t=>d.enabled?t.date===Me.format(new Date(f[e]),d.dateFormat||"yyyy"):t),width:h||r,height:Math.max(S,R||(B?S?(h||r)*B>S?(h||r)*B:S:(h||r)*B:ee)),colorDomain:s.filter(t=>t.color).length===0?[]:G||ke.uniqBy(s.filter(t=>t.color),"color").map(t=>t.color),colors:s.filter(t=>t.color).length===0?M?[M]:[N.Colors.primaryColors["blue-600"]]:M||N.Colors[p].categoricalColors.colors,xAxisTitle:oe,yAxisTitle:re,refXValues:Oe,refYValues:E,showLabels:C,radius:pe,leftMargin:je,rightMargin:ve,topMargin:W,bottomMargin:L,tooltip:be,onSeriesMouseOver:w,highlightAreaSettings:V,highlightedDataPoints:s.filter(t=>t.label).length===0?[]:Ce,selectedColor:o,maxRadiusValue:c.checkIfNullOrUndefined(z)?Math.max(...s.map(t=>t.radius).filter(t=>t!=null)):z,maxXValue:c.checkIfNullOrUndefined(Q)?Math.max(...s.map(t=>t.x).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.x).filter(t=>t!=null)):0:Q,minXValue:c.checkIfNullOrUndefined(k)?Math.min(...s.map(t=>t.x).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.x).filter(t=>t!=null)):k,maxYValue:c.checkIfNullOrUndefined(ne)?Math.max(...s.map(t=>t.y).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.y).filter(t=>t!=null)):0:ne,minYValue:c.checkIfNullOrUndefined(le)?Math.min(...s.map(t=>t.y).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.y).filter(t=>t!=null)):le,onSeriesMouseClick:ue,rtl:n==="he"||n==="ar",annotations:fe,customHighlightAreaSettings:me,regressionLine:$,resetSelectionOnDoubleClick:D,detailsOnClick:Y,noOfXTicks:de,noOfYTicks:P,labelColor:he,xSuffix:Z,ySuffix:ae,xPrefix:ce,yPrefix:xe,styles:v,classNames:m,animate:_===!0?{duration:.5,once:!0,amount:.5}:_||{duration:0,once:!0,amount:0},dimmedOpacity:g,precision:b,customLayers:O}):null})]})}),se||J?i.jsxRuntimeExports.jsx(Ze.GraphFooter,{styles:{footnote:v?.footnote,source:v?.source},classNames:{footnote:m?.footnote,source:m?.source},sources:se,footNote:J,width:h}):null]})})})})}exports.ScatterPlot=nt;
2
2
  //# sourceMappingURL=ScatterPlot.cjs.map