@undp/data-viz 1.5.7 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/BarGraph.cjs +1 -1
  2. package/dist/BarGraph.cjs.map +1 -1
  3. package/dist/BarGraph.js +650 -648
  4. package/dist/BarGraph.js.map +1 -1
  5. package/dist/BulletChart.cjs +1 -1
  6. package/dist/BulletChart.cjs.map +1 -1
  7. package/dist/BulletChart.js +210 -208
  8. package/dist/BulletChart.js.map +1 -1
  9. package/dist/ButterflyChart.cjs +1 -1
  10. package/dist/ButterflyChart.cjs.map +1 -1
  11. package/dist/ButterflyChart.js +42 -40
  12. package/dist/ButterflyChart.js.map +1 -1
  13. package/dist/DifferenceLineChart.cjs +1 -1
  14. package/dist/DifferenceLineChart.cjs.map +1 -1
  15. package/dist/DifferenceLineChart.js +122 -120
  16. package/dist/DifferenceLineChart.js.map +1 -1
  17. package/dist/DualAxisLineChart.cjs +1 -1
  18. package/dist/DualAxisLineChart.cjs.map +1 -1
  19. package/dist/DualAxisLineChart.js +133 -113
  20. package/dist/DualAxisLineChart.js.map +1 -1
  21. package/dist/DumbbellChart.cjs +1 -1
  22. package/dist/DumbbellChart.cjs.map +1 -1
  23. package/dist/DumbbellChart.js +274 -274
  24. package/dist/DumbbellChart.js.map +1 -1
  25. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  26. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  27. package/dist/LineChartWithConfidenceInterval.js +194 -174
  28. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  29. package/dist/MultiLineAltChart.cjs +1 -1
  30. package/dist/MultiLineAltChart.cjs.map +1 -1
  31. package/dist/MultiLineAltChart.js +160 -161
  32. package/dist/MultiLineAltChart.js.map +1 -1
  33. package/dist/MultiLineChart.cjs +1 -1
  34. package/dist/MultiLineChart.cjs.map +1 -1
  35. package/dist/MultiLineChart.js +77 -66
  36. package/dist/MultiLineChart.js.map +1 -1
  37. package/dist/ParetoChart.cjs +1 -1
  38. package/dist/ParetoChart.cjs.map +1 -1
  39. package/dist/ParetoChart.js +166 -161
  40. package/dist/ParetoChart.js.map +1 -1
  41. package/dist/RadarChart.cjs +1 -1
  42. package/dist/RadarChart.cjs.map +1 -1
  43. package/dist/RadarChart.js +253 -241
  44. package/dist/RadarChart.js.map +1 -1
  45. package/dist/{RegressionLine-mH7UKOPi.js → RegressionLine-C2--oMQq.js} +10 -9
  46. package/dist/RegressionLine-C2--oMQq.js.map +1 -0
  47. package/dist/RegressionLine-Dj0GSiAp.cjs +2 -0
  48. package/dist/RegressionLine-Dj0GSiAp.cjs.map +1 -0
  49. package/dist/ScatterPlot.cjs +1 -1
  50. package/dist/ScatterPlot.cjs.map +1 -1
  51. package/dist/ScatterPlot.js +130 -129
  52. package/dist/ScatterPlot.js.map +1 -1
  53. package/dist/SimpleLineChart.cjs +1 -1
  54. package/dist/SimpleLineChart.cjs.map +1 -1
  55. package/dist/SimpleLineChart.js +43 -38
  56. package/dist/SimpleLineChart.js.map +1 -1
  57. package/dist/SlopeChart.cjs +1 -1
  58. package/dist/SlopeChart.cjs.map +1 -1
  59. package/dist/SlopeChart.js +113 -109
  60. package/dist/SlopeChart.js.map +1 -1
  61. package/dist/StripChart.cjs +1 -1
  62. package/dist/StripChart.cjs.map +1 -1
  63. package/dist/StripChart.js +282 -270
  64. package/dist/StripChart.js.map +1 -1
  65. package/dist/UnitChart.cjs +1 -1
  66. package/dist/UnitChart.cjs.map +1 -1
  67. package/dist/UnitChart.js +20 -21
  68. package/dist/UnitChart.js.map +1 -1
  69. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -1
  70. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -1
  71. package/package.json +1 -1
  72. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  73. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  74. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DumbbellChart.js","sources":["../src/Components/Graphs/DumbbellChart/Horizontal/Graph.tsx","../src/Components/Graphs/DumbbellChart/Horizontal/index.tsx","../src/Components/Graphs/DumbbellChart/Vertical/Graph.tsx","../src/Components/Graphs/DumbbellChart/Vertical/index.tsx","../src/Components/Graphs/DumbbellChart/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n DumbbellChartDataType,\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 { string2HTML } from '@/Utils/string2HTML';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { RefLineX } from '@/Components/Elements/ReferenceLine';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n dotColors: string[];\r\n suffix: string;\r\n prefix: string;\r\n barPadding: number;\r\n showValues: boolean;\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n radius: number;\r\n showLabels: boolean;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n maxValue: number;\r\n minValue: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n arrowConnector: boolean;\r\n connectorStrokeWidth: number;\r\n maxBarThickness?: number;\r\n minBarThickness?: number;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks: number;\r\n valueColor?: string;\r\n labelOrder?: string[];\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n refValues?: ReferenceDataType[];\r\n rtl: boolean;\r\n animate: AnimateDataType;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n highlightedDataPoints: (string | number)[];\r\n dimmedOpacity: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n dotColors,\r\n suffix,\r\n prefix,\r\n barPadding,\r\n showValues,\r\n showTicks,\r\n leftMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n radius,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n selectedColor,\r\n arrowConnector,\r\n connectorStrokeWidth,\r\n maxBarThickness,\r\n minBarThickness,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks,\r\n valueColor,\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n rtl,\r\n animate,\r\n precision,\r\n customLayers,\r\n highlightedDataPoints,\r\n dimmedOpacity,\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 margin = {\r\n top: axisTitle ? topMargin + 25 : topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n\r\n const dataWithId = data.map((d, i) => ({\r\n ...d,\r\n id: labelOrder ? `${d.label}` : `${i}`,\r\n }));\r\n const barOrder = labelOrder || dataWithId.map(d => `${d.id}`);\r\n const x = scaleLinear().domain([minValue, maxValue]).range([0, graphWidth]).nice();\r\n const y = scaleBand()\r\n .domain(barOrder)\r\n .range([\r\n 0,\r\n minBarThickness\r\n ? Math.max(graphHeight, minBarThickness * dataWithId.length)\r\n : maxBarThickness\r\n ? Math.min(graphHeight, maxBarThickness * dataWithId.length)\r\n : graphHeight,\r\n ])\r\n .paddingInner(barPadding);\r\n const xTicks = x.ticks(noOfTicks);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n {arrowConnector ? (\r\n <defs>\r\n <marker\r\n id='arrow'\r\n viewBox='0 0 10 10'\r\n refX='10'\r\n refY='5'\r\n markerWidth='6'\r\n markerHeight='6'\r\n orient='auto-start-reverse'\r\n >\r\n <path\r\n d='M 0 0 L 10 5 L 0 10 z'\r\n className='fill-primary-gray-600 dark:fill-primary-gray-300'\r\n />\r\n </marker>\r\n </defs>\r\n ) : null}\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {showTicks ? (\r\n <XTicksAndGridLines\r\n values={xTicks.filter((_d, i) => i !== 0)}\r\n x={xTicks.filter((_d, i) => i !== 0).map(d => x(d))}\r\n y1={0 - topMargin}\r\n y2={graphHeight + margin.bottom}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.xAxis?.gridLines,\r\n labels: classNames?.xAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n ) : null}\r\n <AxisTitle\r\n x={graphWidth / 2}\r\n y={0 - margin.top + 15}\r\n style={styles?.xAxis?.title}\r\n className={classNames?.xAxis?.title}\r\n text={axisTitle}\r\n />\r\n <YTicksAndGridLines\r\n y={dataWithId.map(d => (y(`${d.id}`) as number) + y.bandwidth() / 2)}\r\n x1={0}\r\n x2={graphWidth}\r\n styles={{ gridLines: styles?.yAxis?.gridLines }}\r\n classNames={{ gridLines: classNames?.yAxis?.gridLines }}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <AnimatePresence>\r\n {dataWithId.map(d => (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n variants={{\r\n initial: {\r\n x: 0,\r\n y: (y(`${d.id}`) as number) + y.bandwidth() / 2,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n },\r\n whileInView: {\r\n x: 0,\r\n y: (y(`${d.id}`) as number) + y.bandwidth() / 2,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {showLabels ? (\r\n <YAxesLabels\r\n value={\r\n `${d.label}`.length < truncateBy\r\n ? `${d.label}`\r\n : `${`${d.label}`.substring(0, truncateBy)}...`\r\n }\r\n y={0 - y.bandwidth() / 2}\r\n x={0 - margin.left}\r\n width={margin.left}\r\n height={y.bandwidth()}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n <motion.line\r\n y1={0}\r\n y2={0}\r\n style={{\r\n strokeWidth: connectorStrokeWidth,\r\n ...(styles?.dataConnectors || {}),\r\n opacity: selectedColor ? 0.3 : 1,\r\n }}\r\n className={cn(\r\n 'stroke-primary-gray-600 dark:stroke-primary-gray-300',\r\n classNames?.dataConnectors,\r\n )}\r\n markerEnd={\r\n arrowConnector &&\r\n d.x.indexOf(Math.min(...d.x.filter(el => el !== null)) as number) === 0\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n markerStart={\r\n arrowConnector &&\r\n d.x.indexOf(Math.min(...d.x.filter(el => el !== null)) as number) ===\r\n d.x.length - 1\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n x1: 0,\r\n x2: 0,\r\n },\r\n whileInView: {\r\n x1: x(Math.min(...d.x.filter(el => el !== null))) + radius,\r\n x2: x(Math.max(...d.x.filter(el => el !== null)) as number) - radius,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x.map((el, j) => (\r\n <motion.g\r\n key={j}\r\n onMouseEnter={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.({ ...d, xIndex: j });\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, { ...d, xIndex: j }) &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData({ ...d, xIndex: j });\r\n if (onSeriesMouseClick) onSeriesMouseClick({ ...d, xIndex: j });\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 1,\r\n },\r\n whileInView: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 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 {checkIfNullOrUndefined(el) ? null : (\r\n <>\r\n <motion.circle\r\n cy={0}\r\n r={radius}\r\n style={{\r\n fill: dotColors[j],\r\n fillOpacity: 0.85,\r\n stroke: dotColors[j],\r\n strokeWidth: 1,\r\n opacity: checkIfNullOrUndefined(el) ? 0 : 1,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { cx: x(0), opacity: 0 },\r\n whileInView: {\r\n cx: x(el || 0),\r\n opacity: checkIfNullOrUndefined(el) ? 0 : 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 {showValues ? (\r\n <motion.text\r\n y={0}\r\n style={{\r\n fill: valueColor || dotColors[j],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n dx={0}\r\n dy={0 - radius - 3}\r\n className={cn(\r\n 'graph-value text-sm font-bold',\r\n checkIfNullOrUndefined(el) ? '0opacity-0' : 'opacity-100',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { x: x(0), opacity: 0 },\r\n whileInView: {\r\n x: x(el || 0),\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n )}\r\n </motion.g>\r\n ))}\r\n </motion.g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineX\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n x={x(el.value as number)}\r\n y1={0 - margin.top}\r\n y2={graphHeight + margin.bottom}\r\n textSide={x(el.value as number) > graphWidth * 0.75 || rtl ? 'left' : '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 </AnimatePresence>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { ascending, sort } from 'd3-array';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DumbbellChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ReferenceDataType,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { ensureCompleteDataForDumbbellChart } from '@/Utils/ensureCompleteData';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n colors?: string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n suffix?: string;\r\n prefix?: string;\r\n sources?: SourcesDataType[];\r\n barPadding?: number;\r\n showValues?: boolean;\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n truncateBy?: number;\r\n colorDomain: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n radius?: number;\r\n relativeHeight?: number;\r\n showLabels?: boolean;\r\n showColorScale?: 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 graphID?: string;\r\n maxValue?: number;\r\n minValue?: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n sortParameter?: number | 'diff';\r\n arrowConnector?: boolean;\r\n connectorStrokeWidth?: number;\r\n language?: Languages;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n maxBarThickness?: number;\r\n maxNumberOfBars?: number;\r\n minBarThickness?: number;\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks?: number;\r\n valueColor?: string;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n labelOrder?: string[];\r\n refValues?: ReferenceDataType[];\r\n filterNA?: boolean;\r\n animate?: boolean | AnimateDataType;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n highlightedDataPoints?: (string | number)[];\r\n dimmedOpacity?: number;\r\n timeline?: TimelineDataType;\r\n sortData?: 'asc' | 'desc';\r\n}\r\n\r\nexport function HorizontalDumbbellChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n graphDescription,\r\n barPadding = 0.25,\r\n showTicks = true,\r\n leftMargin = 100,\r\n rightMargin = 40,\r\n topMargin = 20,\r\n bottomMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n radius = 3,\r\n showLabels = true,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n suffix = '',\r\n prefix = '',\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showValues = true,\r\n sortParameter,\r\n arrowConnector = false,\r\n connectorStrokeWidth = 2,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n labelOrder,\r\n maxBarThickness,\r\n maxNumberOfBars,\r\n minBarThickness,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks = 5,\r\n valueColor,\r\n styles,\r\n classNames,\r\n refValues,\r\n filterNA = true,\r\n animate = false,\r\n precision = 2,\r\n customLayers = [],\r\n showColorScale = true,\r\n highlightedDataPoints = [],\r\n dimmedOpacity = 0.3,\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n sortData,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a dumbbell chart that shows comparisons between two or more data points across categories. ${\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 {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorDomain={colorDomain}\r\n colors={colors}\r\n colorLegendTitle={colorLegendTitle}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex grow w-full justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={\r\n sortParameter !== undefined\r\n ? sortParameter === 'diff'\r\n ? orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[d.x.length - 1]) ||\r\n checkIfNullOrUndefined(d.x[0])\r\n ? -Infinity\r\n : (d.x[d.x.length - 1] as number) - (d.x[0] as number),\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[sortParameter])\r\n ? -Infinity\r\n : d.x[sortParameter],\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d))\r\n .filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n }\r\n dotColors={colors}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n radius={radius}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n maxValue={\r\n !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n minValue={\r\n !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n selectedColor={selectedColor}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n maxBarThickness={maxBarThickness}\r\n minBarThickness={minBarThickness}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n valueColor={valueColor}\r\n styles={styles}\r\n classNames={classNames}\r\n labelOrder={labelOrder}\r\n refValues={refValues}\r\n rtl={language === 'he' || language === 'ar'}\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 precision={precision}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\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","import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n DumbbellChartDataType,\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 { string2HTML } from '@/Utils/string2HTML';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n dotColors: string[];\r\n barPadding: number;\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n radius: number;\r\n showLabels: 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 maxValue: number;\r\n minValue: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues: boolean;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n arrowConnector: boolean;\r\n connectorStrokeWidth: number;\r\n maxBarThickness?: number;\r\n minBarThickness?: number;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks: number;\r\n valueColor?: string;\r\n labelOrder?: string[];\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n refValues?: ReferenceDataType[];\r\n animate: AnimateDataType;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n highlightedDataPoints: (string | number)[];\r\n dimmedOpacity: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n dotColors,\r\n barPadding,\r\n showTicks,\r\n leftMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n radius,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n showValues,\r\n suffix,\r\n prefix,\r\n selectedColor,\r\n arrowConnector,\r\n connectorStrokeWidth,\r\n maxBarThickness,\r\n minBarThickness,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks,\r\n valueColor,\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n animate,\r\n precision,\r\n customLayers,\r\n highlightedDataPoints,\r\n dimmedOpacity,\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 margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: axisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n\r\n const dataWithId = data.map((d, i) => ({\r\n ...d,\r\n id: labelOrder ? `${d.label}` : `${i}`,\r\n }));\r\n const barOrder = labelOrder || dataWithId.map(d => `${d.id}`);\r\n const y = scaleLinear().domain([minValue, maxValue]).range([graphHeight, 0]).nice();\r\n const x = scaleBand()\r\n .domain(barOrder)\r\n .range([\r\n 0,\r\n minBarThickness\r\n ? Math.max(graphWidth, minBarThickness * dataWithId.length)\r\n : maxBarThickness\r\n ? Math.min(graphWidth, maxBarThickness * dataWithId.length)\r\n : graphWidth,\r\n ])\r\n .paddingInner(barPadding);\r\n const yTicks = y.ticks(noOfTicks);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n {arrowConnector ? (\r\n <defs>\r\n <marker\r\n id='arrow'\r\n viewBox='0 0 10 10'\r\n refX='10'\r\n refY='5'\r\n markerWidth='6'\r\n markerHeight='6'\r\n orient='auto-start-reverse'\r\n >\r\n <path\r\n d='M 0 0 L 10 5 L 0 10 z'\r\n className='fill-primary-gray-600 dark:fill-primary-gray-300'\r\n />\r\n </marker>\r\n </defs>\r\n ) : null}\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <Axis\r\n y1={y(minValue < 0 ? 0 : minValue)}\r\n y2={y(minValue < 0 ? 0 : minValue)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minValue < 0 ? 0 : minValue,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n dx: 0,\r\n dy: maxValue < 0 ? '1em' : -5,\r\n y: y(minValue < 0 ? 0 : minValue),\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{ axis: styles?.xAxis?.axis, label: styles?.yAxis?.labels }}\r\n />\r\n {showTicks ? (\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 ) : null}\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={axisTitle}\r\n rotate90\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <AnimatePresence>\r\n {dataWithId.map(d => (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n variants={{\r\n initial: {\r\n x: (x(`${d.id}`) as number) + x.bandwidth() / 2,\r\n y: 0,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n },\r\n whileInView: {\r\n x: (x(`${d.id}`) as number) + x.bandwidth() / 2,\r\n y: 0,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {showLabels ? (\r\n <XAxesLabels\r\n value={\r\n `${d.label}`.length < truncateBy\r\n ? `${d.label}`\r\n : `${`${d.label}`.substring(0, truncateBy)}...`\r\n }\r\n y={graphHeight + 5}\r\n x={0 - x.bandwidth() / 2}\r\n width={x.bandwidth()}\r\n height={margin.bottom}\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='top'\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n <motion.line\r\n x1={0}\r\n x2={0}\r\n style={{\r\n strokeWidth: connectorStrokeWidth,\r\n ...(styles?.dataConnectors || {}),\r\n opacity: selectedColor ? 0.3 : 1,\r\n }}\r\n className={cn(\r\n 'stroke-primary-gray-600 dark:stroke-primary-gray-300',\r\n classNames?.dataConnectors,\r\n )}\r\n markerEnd={\r\n arrowConnector && d.x.indexOf(Math.min(...d.x.filter(el => el !== null))) === 0\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n markerStart={\r\n arrowConnector &&\r\n d.x.indexOf(Math.min(...d.x.filter(el => el !== null))) === d.x.length - 1\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n y1: 0,\r\n y2: 0,\r\n },\r\n whileInView: {\r\n y1: y(Math.min(...d.x.filter(el => el !== null))) + radius,\r\n y2: y(Math.max(...d.x.filter(el => el !== null))) - radius,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x.map((el, j) => (\r\n <motion.g\r\n key={j}\r\n onMouseEnter={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.({ ...d, xIndex: j });\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, { ...d, xIndex: j }) &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData({ ...d, xIndex: j });\r\n if (onSeriesMouseClick) onSeriesMouseClick({ ...d, xIndex: j });\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 1,\r\n },\r\n whileInView: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 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 {checkIfNullOrUndefined(el) ? null : (\r\n <>\r\n <motion.circle\r\n cx={0}\r\n r={radius}\r\n style={{\r\n fill: dotColors[j],\r\n fillOpacity: 0.85,\r\n stroke: dotColors[j],\r\n strokeWidth: 1,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { cy: y(0), opacity: 0 },\r\n whileInView: {\r\n cy: y(el || 0),\r\n opacity: checkIfNullOrUndefined(el) ? 0 : 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 {showValues ? (\r\n <motion.text\r\n x={0}\r\n style={{\r\n fill: valueColor || dotColors[j],\r\n textAnchor: 'start',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-sm font-bold',\r\n checkIfNullOrUndefined(el) ? 'opacity-0' : 'opacity-100',\r\n classNames?.graphObjectValues,\r\n )}\r\n dx={radius + 3}\r\n dy='0.33em'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { y: y(0), opacity: 0 },\r\n whileInView: {\r\n y: y(el || 0),\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n )}\r\n </motion.g>\r\n ))}\r\n </motion.g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n </AnimatePresence>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { ascending, sort } from 'd3-array';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DumbbellChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ReferenceDataType,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { ensureCompleteDataForDumbbellChart } from '@/Utils/ensureCompleteData';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n colors?: string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n sources?: SourcesDataType[];\r\n barPadding?: number;\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n truncateBy?: number;\r\n colorDomain: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n radius?: number;\r\n relativeHeight?: number;\r\n showValues?: boolean;\r\n showLabels?: 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 graphID?: string;\r\n maxValue?: number;\r\n minValue?: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n suffix?: string;\r\n prefix?: string;\r\n sortParameter?: number | 'diff';\r\n arrowConnector?: boolean;\r\n connectorStrokeWidth?: number;\r\n language?: Languages;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n maxBarThickness?: number;\r\n maxNumberOfBars?: number;\r\n minBarThickness?: number;\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks?: number;\r\n valueColor?: string;\r\n labelOrder?: string[];\r\n showColorScale?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n refValues?: ReferenceDataType[];\r\n filterNA?: boolean;\r\n animate?: boolean | AnimateDataType;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n highlightedDataPoints?: (string | number)[];\r\n dimmedOpacity?: number;\r\n timeline?: TimelineDataType;\r\n sortData?: 'asc' | 'desc';\r\n}\r\n\r\nexport function VerticalDumbbellChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n graphDescription,\r\n barPadding = 0.25,\r\n showTicks = true,\r\n leftMargin = 20,\r\n rightMargin = 20,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n radius = 3,\r\n tooltip,\r\n showLabels = true,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n suffix = '',\r\n prefix = '',\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showValues = true,\r\n sortParameter,\r\n arrowConnector = false,\r\n connectorStrokeWidth = 2,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n maxBarThickness,\r\n maxNumberOfBars,\r\n minBarThickness,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks = 5,\r\n valueColor,\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n filterNA = true,\r\n animate = false,\r\n precision = 2,\r\n customLayers = [],\r\n showColorScale = true,\r\n highlightedDataPoints = [],\r\n dimmedOpacity = 0.3,\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n sortData,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a dumbbell chart that shows comparisons between two or more data points across categories. ${\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 {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorDomain={colorDomain}\r\n colors={colors}\r\n colorLegendTitle={colorLegendTitle}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex grow w-full justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={\r\n sortParameter !== undefined\r\n ? sortParameter === 'diff'\r\n ? orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[d.x.length - 1]) ||\r\n checkIfNullOrUndefined(d.x[0])\r\n ? -Infinity\r\n : (d.x[d.x.length - 1] as number) - (d.x[0] as number),\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[sortParameter])\r\n ? -Infinity\r\n : d.x[sortParameter],\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d))\r\n .filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n }\r\n dotColors={colors}\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 radius={radius}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n tooltip={tooltip}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n maxValue={\r\n !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n minValue={\r\n !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n selectedColor={selectedColor}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n maxBarThickness={maxBarThickness}\r\n minBarThickness={minBarThickness}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n valueColor={valueColor}\r\n styles={styles}\r\n classNames={classNames}\r\n labelOrder={labelOrder}\r\n refValues={refValues}\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 precision={precision}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\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","import { HorizontalDumbbellChart } from './Horizontal';\r\nimport { VerticalDumbbellChart } from './Vertical';\r\n\r\nimport {\r\n SourcesDataType,\r\n Languages,\r\n DumbbellChartDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ReferenceDataType,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DumbbellChartDataType[];\r\n\r\n /** Orientation of the graph */\r\n orientation?: 'vertical' | 'horizontal';\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for the circle */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain: string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color of value labels */\r\n valueColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Padding between bars */\r\n barPadding?: number;\r\n /** Maximum thickness of bars */\r\n maxBarThickness?: number;\r\n /** Minimum thickness of bars */\r\n minBarThickness?: number;\r\n /** Maximum number of bars shown in the graph */\r\n maxNumberOfBars?: number;\r\n /** Radius of the dots */\r\n radius?: 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 /** Truncate labels by specified length */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Number of ticks on the axis */\r\n noOfTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Custom order for labels */\r\n labelOrder?: string[];\r\n /** Toggle visibility of axis ticks */\r\n showTicks?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle if the is a arrow head at the end of the connector */\r\n arrowConnector?: boolean;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Stroke width of the connector */\r\n connectorStrokeWidth?: number;\r\n /** Title for the axis */\r\n axisTitle?: string;\r\n /** Sorting order for data. If this is a number then data is sorted by value at that index x array in the data props. If this is diff then data is sorted by the difference of the last and first element in the x array in the data props. This is overwritten by labelOrder prop */\r\n sortParameter?: number | 'diff';\r\n /** Sorting order for data. This is overwritten by labelOrder prop. */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if data points which have all the values as undefined or null are filtered out. */\r\n filterNA?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\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 /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\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 /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: 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 /** Details displayed on the modal when user clicks of a data point. 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 detailsOnClick?: 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 /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_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 DumbbellChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n barPadding,\r\n showTicks,\r\n leftMargin,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n truncateBy,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor,\r\n radius,\r\n tooltip,\r\n showLabels,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n suffix,\r\n prefix,\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n graphDownload,\r\n dataDownload,\r\n showValues,\r\n sortParameter,\r\n arrowConnector,\r\n connectorStrokeWidth,\r\n language,\r\n minHeight,\r\n theme,\r\n maxBarThickness,\r\n maxNumberOfBars,\r\n minBarThickness,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks,\r\n valueColor,\r\n orientation = 'vertical',\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n filterNA,\r\n animate,\r\n precision,\r\n showColorScale,\r\n customLayers,\r\n highlightedDataPoints,\r\n dimmedOpacity,\r\n timeline,\r\n sortData,\r\n } = props;\r\n\r\n if (orientation === 'vertical')\r\n return (\r\n <VerticalDumbbellChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n backgroundColor={backgroundColor}\r\n radius={radius}\r\n tooltip={tooltip}\r\n showLabels={showLabels}\r\n relativeHeight={relativeHeight}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n graphID={graphID}\r\n suffix={suffix}\r\n prefix={prefix}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n showValues={showValues}\r\n sortParameter={sortParameter}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n language={language}\r\n minHeight={minHeight}\r\n theme={theme}\r\n maxBarThickness={maxBarThickness}\r\n maxNumberOfBars={maxNumberOfBars}\r\n minBarThickness={minBarThickness}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n labelOrder={labelOrder}\r\n valueColor={valueColor}\r\n classNames={classNames}\r\n refValues={refValues}\r\n filterNA={filterNA}\r\n animate={animate}\r\n precision={precision}\r\n showColorScale={showColorScale}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\r\n timeline={timeline}\r\n sortData={sortData}\r\n />\r\n );\r\n return (\r\n <HorizontalDumbbellChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n backgroundColor={backgroundColor}\r\n radius={radius}\r\n tooltip={tooltip}\r\n showLabels={showLabels}\r\n relativeHeight={relativeHeight}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n graphID={graphID}\r\n suffix={suffix}\r\n prefix={prefix}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n showValues={showValues}\r\n sortParameter={sortParameter}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n language={language}\r\n minHeight={minHeight}\r\n theme={theme}\r\n maxBarThickness={maxBarThickness}\r\n maxNumberOfBars={maxNumberOfBars}\r\n minBarThickness={minBarThickness}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n valueColor={valueColor}\r\n classNames={classNames}\r\n labelOrder={labelOrder}\r\n refValues={refValues}\r\n filterNA={filterNA}\r\n animate={animate}\r\n precision={precision}\r\n showColorScale={showColorScale}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\r\n timeline={timeline}\r\n sortData={sortData}\r\n />\r\n );\r\n}\r\n"],"names":["Graph","props","data","dotColors","suffix","prefix","barPadding","showValues","showTicks","leftMargin","truncateBy","width","height","rightMargin","topMargin","bottomMargin","radius","showLabels","tooltip","onSeriesMouseOver","maxValue","minValue","onSeriesMouseClick","selectedColor","arrowConnector","connectorStrokeWidth","maxBarThickness","minBarThickness","resetSelectionOnDoubleClick","detailsOnClick","axisTitle","noOfTicks","valueColor","styles","classNames","labelOrder","refValues","rtl","animate","precision","customLayers","highlightedDataPoints","dimmedOpacity","svgRef","useRef","isInView","useInView","margin","graphWidth","graphHeight","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","dataWithId","d","i","barOrder","x","scaleLinear","y","scaleBand","xTicks","jsxs","Fragment","motion","jsx","XTicksAndGridLines","_d","AxisTitle","YTicksAndGridLines","AnimatePresence","YAxesLabels","cn","el","j","event","isEqual","checkIfNullOrUndefined","numberFormattingFunction","RefLineX","Tooltip","Modal","string2HTML","HorizontalDumbbellChart","graphTitle","colors","Colors","sources","graphDescription","footNote","colorDomain","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","sortParameter","language","minHeight","theme","maxNumberOfBars","ariaLabel","filterNA","showColorScale","timeline","sortData","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","index","setIndex","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","interval","markObj","getSliderMarks","GraphHeader","Pause","Play","SliderUI","nextValue","EmptyState","ColorLegendWithMouseOver","orderBy","ensureCompleteDataForDumbbellChart","format","item","GraphFooter","yTicks","Axis","XAxesLabels","RefLineY","VerticalDumbbellChart","DumbbellChart","orientation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,KAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,eAAAC;AAAA,EAAA,IACEzC,IACE0C,IAASC,GAAO,IAAI,GACpBC,IAAWC,GAAUH,GAAQ;AAAA,IACjC,MAAML,EAAQ;AAAA,IACd,QAAQA,EAAQ;AAAA,EAAA,CACjB,GACKS,IAAS;AAAA,IACb,KAAKjB,IAAYhB,IAAY,KAAKA;AAAA,IAClC,QAAQ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A,MACA,WAAAC;AAAA,MACA,YAAAC;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,WAAAC;AAAA,MACA,UAAA0E;AAAA,MACA,SAAAxE;AAAA,MACA,WAAAC;AAAA,MACA,gBAAAwE;AAAA,MACA,cAAAvE;AAAA,MACA,uBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,UAAAsE;AAAA,MACA,UAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"DumbbellChart.js","sources":["../src/Components/Graphs/DumbbellChart/Horizontal/Graph.tsx","../src/Components/Graphs/DumbbellChart/Horizontal/index.tsx","../src/Components/Graphs/DumbbellChart/Vertical/Graph.tsx","../src/Components/Graphs/DumbbellChart/Vertical/index.tsx","../src/Components/Graphs/DumbbellChart/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n DumbbellChartDataType,\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 { string2HTML } from '@/Utils/string2HTML';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { YAxesLabels } from '@/Components/Elements/Axes/YAxesLabels';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { RefLineX } from '@/Components/Elements/ReferenceLine';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n dotColors: string[];\r\n suffix: string;\r\n prefix: string;\r\n barPadding: number;\r\n showValues: boolean;\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n radius: number;\r\n showLabels: boolean;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n maxValue: number;\r\n minValue: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n arrowConnector: boolean;\r\n connectorStrokeWidth: number;\r\n maxBarThickness?: number;\r\n minBarThickness?: number;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks: number;\r\n valueColor?: string;\r\n labelOrder?: string[];\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n refValues?: ReferenceDataType[];\r\n rtl: boolean;\r\n animate: AnimateDataType;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n highlightedDataPoints: (string | number)[];\r\n dimmedOpacity: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n dotColors,\r\n suffix,\r\n prefix,\r\n barPadding,\r\n showValues,\r\n showTicks,\r\n leftMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n radius,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n selectedColor,\r\n arrowConnector,\r\n connectorStrokeWidth,\r\n maxBarThickness,\r\n minBarThickness,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks,\r\n valueColor,\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n rtl,\r\n animate,\r\n precision,\r\n customLayers,\r\n highlightedDataPoints,\r\n dimmedOpacity,\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 margin = {\r\n top: axisTitle ? topMargin + 25 : topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n\r\n const dataWithId = data.map((d, i) => ({\r\n ...d,\r\n id: labelOrder ? `${d.label}` : `${i}`,\r\n }));\r\n const barOrder = labelOrder || dataWithId.map(d => `${d.id}`);\r\n const x = scaleLinear().domain([minValue, maxValue]).range([0, graphWidth]).nice();\r\n const y = scaleBand()\r\n .domain(barOrder)\r\n .range([\r\n 0,\r\n minBarThickness\r\n ? Math.max(graphHeight, minBarThickness * dataWithId.length)\r\n : maxBarThickness\r\n ? Math.min(graphHeight, maxBarThickness * dataWithId.length)\r\n : graphHeight,\r\n ])\r\n .paddingInner(barPadding);\r\n const xTicks = x.ticks(noOfTicks);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n {arrowConnector ? (\r\n <defs>\r\n <marker\r\n id='arrow'\r\n viewBox='0 0 10 10'\r\n refX='10'\r\n refY='5'\r\n markerWidth='6'\r\n markerHeight='6'\r\n orient='auto-start-reverse'\r\n >\r\n <path\r\n d='M 0 0 L 10 5 L 0 10 z'\r\n className='fill-primary-gray-600 dark:fill-primary-gray-300'\r\n />\r\n </marker>\r\n </defs>\r\n ) : null}\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {showTicks ? (\r\n <XTicksAndGridLines\r\n values={xTicks.filter((_d, i) => i !== 0)}\r\n x={xTicks.filter((_d, i) => i !== 0).map(d => x(d))}\r\n y1={0 - topMargin}\r\n y2={graphHeight + margin.bottom}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.xAxis?.gridLines,\r\n labels: classNames?.xAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n ) : null}\r\n <AxisTitle\r\n x={graphWidth / 2}\r\n y={0 - margin.top + 15}\r\n style={styles?.xAxis?.title}\r\n className={classNames?.xAxis?.title}\r\n text={axisTitle}\r\n />\r\n <YTicksAndGridLines\r\n y={dataWithId.map(d => (y(`${d.id}`) as number) + y.bandwidth() / 2)}\r\n x1={0}\r\n x2={graphWidth}\r\n styles={{ gridLines: styles?.yAxis?.gridLines }}\r\n classNames={{ gridLines: classNames?.yAxis?.gridLines }}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <AnimatePresence>\r\n {dataWithId.map(d => (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n variants={{\r\n initial: {\r\n x: 0,\r\n y: (y(`${d.id}`) as number) + y.bandwidth() / 2,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n },\r\n whileInView: {\r\n x: 0,\r\n y: (y(`${d.id}`) as number) + y.bandwidth() / 2,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {showLabels ? (\r\n <YAxesLabels\r\n value={\r\n `${d.label}`.length < truncateBy\r\n ? `${d.label}`\r\n : `${`${d.label}`.substring(0, truncateBy)}...`\r\n }\r\n y={0 - y.bandwidth() / 2}\r\n x={0 - margin.left}\r\n width={margin.left}\r\n height={y.bandwidth()}\r\n alignment='right'\r\n style={styles?.yAxis?.labels}\r\n className={classNames?.yAxis?.labels}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n <motion.line\r\n y1={0}\r\n y2={0}\r\n style={{\r\n strokeWidth: connectorStrokeWidth,\r\n ...(styles?.dataConnectors || {}),\r\n opacity: selectedColor ? 0.3 : 1,\r\n }}\r\n className={cn(\r\n 'stroke-primary-gray-600 dark:stroke-primary-gray-300',\r\n classNames?.dataConnectors,\r\n )}\r\n markerEnd={\r\n arrowConnector &&\r\n d.x.indexOf(Math.min(...d.x.filter(el => el !== null)) as number) === 0\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n markerStart={\r\n arrowConnector &&\r\n d.x.indexOf(Math.min(...d.x.filter(el => el !== null)) as number) ===\r\n d.x.length - 1\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n x1: 0,\r\n x2: 0,\r\n },\r\n whileInView: {\r\n x1: x(Math.min(...d.x.filter(el => el !== null))) + radius,\r\n x2: x(Math.max(...d.x.filter(el => el !== null)) as number) - radius,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x.map((el, j) => (\r\n <motion.g\r\n key={j}\r\n onMouseEnter={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.({ ...d, xIndex: j });\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, { ...d, xIndex: j }) &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData({ ...d, xIndex: j });\r\n if (onSeriesMouseClick) onSeriesMouseClick({ ...d, xIndex: j });\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 1,\r\n },\r\n whileInView: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 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 {checkIfNullOrUndefined(el) ? null : (\r\n <>\r\n <motion.circle\r\n cy={0}\r\n r={radius}\r\n style={{\r\n fill: dotColors[j],\r\n fillOpacity: 0.85,\r\n stroke: dotColors[j],\r\n strokeWidth: 1,\r\n opacity: checkIfNullOrUndefined(el) ? 0 : 1,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { cx: x(0), opacity: 0 },\r\n whileInView: {\r\n cx: x(el || 0),\r\n opacity: checkIfNullOrUndefined(el) ? 0 : 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 {showValues ? (\r\n <motion.text\r\n y={0}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n dx={0}\r\n dy={0 - radius - 3}\r\n className={cn(\r\n 'graph-value text-sm font-bold',\r\n checkIfNullOrUndefined(el) ? '0opacity-0' : 'opacity-100',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { x: x(0), opacity: 0, fill: valueColor || dotColors[j] },\r\n whileInView: {\r\n x: x(el || 0),\r\n fill: valueColor || dotColors[j],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n )}\r\n </motion.g>\r\n ))}\r\n </motion.g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineX\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n x={x(el.value as number)}\r\n y1={0 - margin.top}\r\n y2={graphHeight + margin.bottom}\r\n textSide={x(el.value as number) > graphWidth * 0.75 || rtl ? 'left' : '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 </AnimatePresence>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { ascending, sort } from 'd3-array';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DumbbellChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ReferenceDataType,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { ensureCompleteDataForDumbbellChart } from '@/Utils/ensureCompleteData';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n colors?: string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n suffix?: string;\r\n prefix?: string;\r\n sources?: SourcesDataType[];\r\n barPadding?: number;\r\n showValues?: boolean;\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n truncateBy?: number;\r\n colorDomain: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n radius?: number;\r\n relativeHeight?: number;\r\n showLabels?: boolean;\r\n showColorScale?: 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 graphID?: string;\r\n maxValue?: number;\r\n minValue?: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n sortParameter?: number | 'diff';\r\n arrowConnector?: boolean;\r\n connectorStrokeWidth?: number;\r\n language?: Languages;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n maxBarThickness?: number;\r\n maxNumberOfBars?: number;\r\n minBarThickness?: number;\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks?: number;\r\n valueColor?: string;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n labelOrder?: string[];\r\n refValues?: ReferenceDataType[];\r\n filterNA?: boolean;\r\n animate?: boolean | AnimateDataType;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n highlightedDataPoints?: (string | number)[];\r\n dimmedOpacity?: number;\r\n timeline?: TimelineDataType;\r\n sortData?: 'asc' | 'desc';\r\n}\r\n\r\nexport function HorizontalDumbbellChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n graphDescription,\r\n barPadding = 0.25,\r\n showTicks = true,\r\n leftMargin = 100,\r\n rightMargin = 40,\r\n topMargin = 20,\r\n bottomMargin = 10,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n radius = 3,\r\n showLabels = true,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n suffix = '',\r\n prefix = '',\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showValues = true,\r\n sortParameter,\r\n arrowConnector = false,\r\n connectorStrokeWidth = 2,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n labelOrder,\r\n maxBarThickness,\r\n maxNumberOfBars,\r\n minBarThickness,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks = 5,\r\n valueColor,\r\n styles,\r\n classNames,\r\n refValues,\r\n filterNA = true,\r\n animate = false,\r\n precision = 2,\r\n customLayers = [],\r\n showColorScale = true,\r\n highlightedDataPoints = [],\r\n dimmedOpacity = 0.3,\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n sortData,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a dumbbell chart that shows comparisons between two or more data points across categories. ${\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 {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorDomain={colorDomain}\r\n colors={colors}\r\n colorLegendTitle={colorLegendTitle}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex grow w-full justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={\r\n sortParameter !== undefined\r\n ? sortParameter === 'diff'\r\n ? orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[d.x.length - 1]) ||\r\n checkIfNullOrUndefined(d.x[0])\r\n ? -Infinity\r\n : (d.x[d.x.length - 1] as number) - (d.x[0] as number),\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[sortParameter])\r\n ? -Infinity\r\n : d.x[sortParameter],\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d))\r\n .filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n }\r\n dotColors={colors}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n suffix={suffix}\r\n prefix={prefix}\r\n radius={radius}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n maxValue={\r\n !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n minValue={\r\n !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n selectedColor={selectedColor}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n maxBarThickness={maxBarThickness}\r\n minBarThickness={minBarThickness}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n valueColor={valueColor}\r\n styles={styles}\r\n classNames={classNames}\r\n labelOrder={labelOrder}\r\n refValues={refValues}\r\n rtl={language === 'he' || language === 'ar'}\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 precision={precision}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\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","import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleBand } from 'd3-scale';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n DumbbellChartDataType,\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 { string2HTML } from '@/Utils/string2HTML';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XAxesLabels } from '@/Components/Elements/Axes/XAxesLabels';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n dotColors: string[];\r\n barPadding: number;\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n truncateBy: number;\r\n width: number;\r\n height: number;\r\n radius: number;\r\n showLabels: 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 maxValue: number;\r\n minValue: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues: boolean;\r\n selectedColor?: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n arrowConnector: boolean;\r\n connectorStrokeWidth: number;\r\n maxBarThickness?: number;\r\n minBarThickness?: number;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks: number;\r\n valueColor?: string;\r\n labelOrder?: string[];\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n refValues?: ReferenceDataType[];\r\n animate: AnimateDataType;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n highlightedDataPoints: (string | number)[];\r\n dimmedOpacity: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n dotColors,\r\n barPadding,\r\n showTicks,\r\n leftMargin,\r\n truncateBy,\r\n width,\r\n height,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n radius,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n showValues,\r\n suffix,\r\n prefix,\r\n selectedColor,\r\n arrowConnector,\r\n connectorStrokeWidth,\r\n maxBarThickness,\r\n minBarThickness,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks,\r\n valueColor,\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n animate,\r\n precision,\r\n customLayers,\r\n highlightedDataPoints,\r\n dimmedOpacity,\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 margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: axisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n\r\n const dataWithId = data.map((d, i) => ({\r\n ...d,\r\n id: labelOrder ? `${d.label}` : `${i}`,\r\n }));\r\n const barOrder = labelOrder || dataWithId.map(d => `${d.id}`);\r\n const y = scaleLinear().domain([minValue, maxValue]).range([graphHeight, 0]).nice();\r\n const x = scaleBand()\r\n .domain(barOrder)\r\n .range([\r\n 0,\r\n minBarThickness\r\n ? Math.max(graphWidth, minBarThickness * dataWithId.length)\r\n : maxBarThickness\r\n ? Math.min(graphWidth, maxBarThickness * dataWithId.length)\r\n : graphWidth,\r\n ])\r\n .paddingInner(barPadding);\r\n const yTicks = y.ticks(noOfTicks);\r\n\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n {arrowConnector ? (\r\n <defs>\r\n <marker\r\n id='arrow'\r\n viewBox='0 0 10 10'\r\n refX='10'\r\n refY='5'\r\n markerWidth='6'\r\n markerHeight='6'\r\n orient='auto-start-reverse'\r\n >\r\n <path\r\n d='M 0 0 L 10 5 L 0 10 z'\r\n className='fill-primary-gray-600 dark:fill-primary-gray-300'\r\n />\r\n </marker>\r\n </defs>\r\n ) : null}\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <Axis\r\n y1={y(minValue < 0 ? 0 : minValue)}\r\n y2={y(minValue < 0 ? 0 : minValue)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minValue < 0 ? 0 : minValue,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n dx: 0,\r\n dy: maxValue < 0 ? '1em' : -5,\r\n y: y(minValue < 0 ? 0 : minValue),\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{ axis: styles?.xAxis?.axis, label: styles?.yAxis?.labels }}\r\n />\r\n {showTicks ? (\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 ) : null}\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={axisTitle}\r\n rotate90\r\n />\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <AnimatePresence>\r\n {dataWithId.map(d => (\r\n <motion.g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n variants={{\r\n initial: {\r\n x: (x(`${d.id}`) as number) + x.bandwidth() / 2,\r\n y: 0,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n },\r\n whileInView: {\r\n x: (x(`${d.id}`) as number) + x.bandwidth() / 2,\r\n y: 0,\r\n opacity:\r\n highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {showLabels ? (\r\n <XAxesLabels\r\n value={\r\n `${d.label}`.length < truncateBy\r\n ? `${d.label}`\r\n : `${`${d.label}`.substring(0, truncateBy)}...`\r\n }\r\n y={graphHeight + 5}\r\n x={0 - x.bandwidth() / 2}\r\n width={x.bandwidth()}\r\n height={margin.bottom}\r\n style={styles?.xAxis?.labels}\r\n className={classNames?.xAxis?.labels}\r\n alignment='top'\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ) : null}\r\n <motion.line\r\n x1={0}\r\n x2={0}\r\n style={{\r\n strokeWidth: connectorStrokeWidth,\r\n ...(styles?.dataConnectors || {}),\r\n opacity: selectedColor ? 0.3 : 1,\r\n }}\r\n className={cn(\r\n 'stroke-primary-gray-600 dark:stroke-primary-gray-300',\r\n classNames?.dataConnectors,\r\n )}\r\n markerEnd={\r\n arrowConnector && d.x.indexOf(Math.min(...d.x.filter(el => el !== null))) === 0\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n markerStart={\r\n arrowConnector &&\r\n d.x.indexOf(Math.min(...d.x.filter(el => el !== null))) === d.x.length - 1\r\n ? 'url(#arrow)'\r\n : ''\r\n }\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n y1: 0,\r\n y2: 0,\r\n },\r\n whileInView: {\r\n y1: y(Math.min(...d.x.filter(el => el !== null))) + radius,\r\n y2: y(Math.max(...d.x.filter(el => el !== null))) - radius,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.x.map((el, j) => (\r\n <motion.g\r\n key={j}\r\n onMouseEnter={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.({ ...d, xIndex: j });\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (\r\n isEqual(mouseClickData, { ...d, xIndex: j }) &&\r\n resetSelectionOnDoubleClick\r\n ) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData({ ...d, xIndex: j });\r\n if (onSeriesMouseClick) onSeriesMouseClick({ ...d, xIndex: j });\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData({ ...d, xIndex: j });\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 1,\r\n },\r\n whileInView: {\r\n opacity: selectedColor ? (dotColors[j] === selectedColor ? 1 : 0.3) : 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 {checkIfNullOrUndefined(el) ? null : (\r\n <>\r\n <motion.circle\r\n cx={0}\r\n r={radius}\r\n style={{\r\n fill: dotColors[j],\r\n fillOpacity: 0.85,\r\n stroke: dotColors[j],\r\n strokeWidth: 1,\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { cy: y(0), opacity: 0 },\r\n whileInView: {\r\n cy: y(el || 0),\r\n opacity: checkIfNullOrUndefined(el) ? 0 : 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 {showValues ? (\r\n <motion.text\r\n x={0}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-sm font-bold',\r\n checkIfNullOrUndefined(el) ? 'opacity-0' : 'opacity-100',\r\n classNames?.graphObjectValues,\r\n )}\r\n dx={radius + 3}\r\n dy='0.33em'\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { y: y(0), opacity: 0, fill: valueColor || dotColors[j] },\r\n whileInView: {\r\n y: y(el || 0),\r\n fill: valueColor || dotColors[j],\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n )}\r\n </motion.g>\r\n ))}\r\n </motion.g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n </AnimatePresence>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { ascending, sort } from 'd3-array';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DumbbellChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ReferenceDataType,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { ensureCompleteDataForDumbbellChart } from '@/Utils/ensureCompleteData';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n data: DumbbellChartDataType[];\r\n colors?: string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n sources?: SourcesDataType[];\r\n barPadding?: number;\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n truncateBy?: number;\r\n colorDomain: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n radius?: number;\r\n relativeHeight?: number;\r\n showValues?: boolean;\r\n showLabels?: 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 graphID?: string;\r\n maxValue?: number;\r\n minValue?: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n suffix?: string;\r\n prefix?: string;\r\n sortParameter?: number | 'diff';\r\n arrowConnector?: boolean;\r\n connectorStrokeWidth?: number;\r\n language?: Languages;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n maxBarThickness?: number;\r\n maxNumberOfBars?: number;\r\n minBarThickness?: number;\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n axisTitle?: string;\r\n noOfTicks?: number;\r\n valueColor?: string;\r\n labelOrder?: string[];\r\n showColorScale?: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n refValues?: ReferenceDataType[];\r\n filterNA?: boolean;\r\n animate?: boolean | AnimateDataType;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n highlightedDataPoints?: (string | number)[];\r\n dimmedOpacity?: number;\r\n timeline?: TimelineDataType;\r\n sortData?: 'asc' | 'desc';\r\n}\r\n\r\nexport function VerticalDumbbellChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n graphDescription,\r\n barPadding = 0.25,\r\n showTicks = true,\r\n leftMargin = 20,\r\n rightMargin = 20,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n truncateBy = 999,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n radius = 3,\r\n tooltip,\r\n showLabels = true,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n suffix = '',\r\n prefix = '',\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showValues = true,\r\n sortParameter,\r\n arrowConnector = false,\r\n connectorStrokeWidth = 2,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n maxBarThickness,\r\n maxNumberOfBars,\r\n minBarThickness,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks = 5,\r\n valueColor,\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n filterNA = true,\r\n animate = false,\r\n precision = 2,\r\n customLayers = [],\r\n showColorScale = true,\r\n highlightedDataPoints = [],\r\n dimmedOpacity = 0.3,\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n sortData,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(data, 'date', true).map(d =>\r\n parse(`${d}`, timeline.dateFormat || 'yyyy', new Date()).getTime(),\r\n ),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a dumbbell chart that shows comparisons between two or more data points across categories. ${\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 {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorDomain={colorDomain}\r\n colors={colors}\r\n colorLegendTitle={colorLegendTitle}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div\r\n className='flex grow w-full justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={\r\n sortParameter !== undefined\r\n ? sortParameter === 'diff'\r\n ? orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[d.x.length - 1]) ||\r\n checkIfNullOrUndefined(d.x[0])\r\n ? -Infinity\r\n : (d.x[d.x.length - 1] as number) - (d.x[0] as number),\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : orderBy(\r\n ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(\r\n new Date(uniqDatesSorted[index]),\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n : d,\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d)),\r\n d =>\r\n checkIfNullOrUndefined(d.x[sortParameter])\r\n ? -Infinity\r\n : d.x[sortParameter],\r\n [sortData || 'asc'],\r\n ).filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n : ensureCompleteDataForDumbbellChart(\r\n data,\r\n timeline.dateFormat || 'yyyy',\r\n )\r\n .filter(d => (filterNA ? !d.x.every(item => item == null) : d))\r\n .filter((_d, i) => (maxNumberOfBars ? i < maxNumberOfBars : true))\r\n }\r\n dotColors={colors}\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 radius={radius}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n showLabels={showLabels}\r\n showValues={showValues}\r\n tooltip={tooltip}\r\n suffix={suffix}\r\n prefix={prefix}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n maxValue={\r\n !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d => Math.max(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n minValue={\r\n !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d => Math.min(...d.x.filter(el => el !== null))),\r\n )\r\n }\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n selectedColor={selectedColor}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n maxBarThickness={maxBarThickness}\r\n minBarThickness={minBarThickness}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n valueColor={valueColor}\r\n styles={styles}\r\n classNames={classNames}\r\n labelOrder={labelOrder}\r\n refValues={refValues}\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 precision={precision}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\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","import { HorizontalDumbbellChart } from './Horizontal';\r\nimport { VerticalDumbbellChart } from './Vertical';\r\n\r\nimport {\r\n SourcesDataType,\r\n Languages,\r\n DumbbellChartDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ReferenceDataType,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DumbbellChartDataType[];\r\n\r\n /** Orientation of the graph */\r\n orientation?: 'vertical' | 'horizontal';\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors for the circle */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain: string[];\r\n /** Title for the color legend */\r\n colorLegendTitle?: string;\r\n /** Color of value labels */\r\n valueColor?: string;\r\n /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n /** Padding between bars */\r\n barPadding?: number;\r\n /** Maximum thickness of bars */\r\n maxBarThickness?: number;\r\n /** Minimum thickness of bars */\r\n minBarThickness?: number;\r\n /** Maximum number of bars shown in the graph */\r\n maxNumberOfBars?: number;\r\n /** Radius of the dots */\r\n radius?: 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 /** Truncate labels by specified length */\r\n truncateBy?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Number of ticks on the axis */\r\n noOfTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Custom order for labels */\r\n labelOrder?: string[];\r\n /** Toggle visibility of axis ticks */\r\n showTicks?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle if the is a arrow head at the end of the connector */\r\n arrowConnector?: boolean;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Stroke width of the connector */\r\n connectorStrokeWidth?: number;\r\n /** Title for the axis */\r\n axisTitle?: string;\r\n /** Sorting order for data. If this is a number then data is sorted by value at that index x array in the data props. If this is diff then data is sorted by the difference of the last and first element in the x array in the data props. This is overwritten by labelOrder prop */\r\n sortParameter?: number | 'diff';\r\n /** Sorting order for data. This is overwritten by labelOrder prop. */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if data points which have all the values as undefined or null are filtered out. */\r\n filterNA?: boolean;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\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 /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\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 /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: 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 /** Details displayed on the modal when user clicks of a data point. 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 detailsOnClick?: 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 /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_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 DumbbellChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n barPadding,\r\n showTicks,\r\n leftMargin,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n truncateBy,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor,\r\n radius,\r\n tooltip,\r\n showLabels,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n graphID,\r\n suffix,\r\n prefix,\r\n maxValue,\r\n minValue,\r\n onSeriesMouseClick,\r\n graphDownload,\r\n dataDownload,\r\n showValues,\r\n sortParameter,\r\n arrowConnector,\r\n connectorStrokeWidth,\r\n language,\r\n minHeight,\r\n theme,\r\n maxBarThickness,\r\n maxNumberOfBars,\r\n minBarThickness,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n axisTitle,\r\n noOfTicks,\r\n valueColor,\r\n orientation = 'vertical',\r\n styles,\r\n classNames,\r\n labelOrder,\r\n refValues,\r\n filterNA,\r\n animate,\r\n precision,\r\n showColorScale,\r\n customLayers,\r\n highlightedDataPoints,\r\n dimmedOpacity,\r\n timeline,\r\n sortData,\r\n } = props;\r\n\r\n if (orientation === 'vertical')\r\n return (\r\n <VerticalDumbbellChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n backgroundColor={backgroundColor}\r\n radius={radius}\r\n tooltip={tooltip}\r\n showLabels={showLabels}\r\n relativeHeight={relativeHeight}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n graphID={graphID}\r\n suffix={suffix}\r\n prefix={prefix}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n showValues={showValues}\r\n sortParameter={sortParameter}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n language={language}\r\n minHeight={minHeight}\r\n theme={theme}\r\n maxBarThickness={maxBarThickness}\r\n maxNumberOfBars={maxNumberOfBars}\r\n minBarThickness={minBarThickness}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n labelOrder={labelOrder}\r\n valueColor={valueColor}\r\n classNames={classNames}\r\n refValues={refValues}\r\n filterNA={filterNA}\r\n animate={animate}\r\n precision={precision}\r\n showColorScale={showColorScale}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\r\n timeline={timeline}\r\n sortData={sortData}\r\n />\r\n );\r\n return (\r\n <HorizontalDumbbellChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n barPadding={barPadding}\r\n showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n truncateBy={truncateBy}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n backgroundColor={backgroundColor}\r\n radius={radius}\r\n tooltip={tooltip}\r\n showLabels={showLabels}\r\n relativeHeight={relativeHeight}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n graphID={graphID}\r\n suffix={suffix}\r\n prefix={prefix}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n showValues={showValues}\r\n sortParameter={sortParameter}\r\n arrowConnector={arrowConnector}\r\n connectorStrokeWidth={connectorStrokeWidth}\r\n language={language}\r\n minHeight={minHeight}\r\n theme={theme}\r\n maxBarThickness={maxBarThickness}\r\n maxNumberOfBars={maxNumberOfBars}\r\n minBarThickness={minBarThickness}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n axisTitle={axisTitle}\r\n noOfTicks={noOfTicks}\r\n valueColor={valueColor}\r\n classNames={classNames}\r\n labelOrder={labelOrder}\r\n refValues={refValues}\r\n filterNA={filterNA}\r\n animate={animate}\r\n precision={precision}\r\n showColorScale={showColorScale}\r\n customLayers={customLayers}\r\n highlightedDataPoints={highlightedDataPoints}\r\n dimmedOpacity={dimmedOpacity}\r\n timeline={timeline}\r\n sortData={sortData}\r\n />\r\n );\r\n}\r\n"],"names":["Graph","props","data","dotColors","suffix","prefix","barPadding","showValues","showTicks","leftMargin","truncateBy","width","height","rightMargin","topMargin","bottomMargin","radius","showLabels","tooltip","onSeriesMouseOver","maxValue","minValue","onSeriesMouseClick","selectedColor","arrowConnector","connectorStrokeWidth","maxBarThickness","minBarThickness","resetSelectionOnDoubleClick","detailsOnClick","axisTitle","noOfTicks","valueColor","styles","classNames","labelOrder","refValues","rtl","animate","precision","customLayers","highlightedDataPoints","dimmedOpacity","svgRef","useRef","isInView","useInView","margin","graphWidth","graphHeight","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","dataWithId","d","i","barOrder","x","scaleLinear","y","scaleBand","xTicks","jsxs","Fragment","motion","jsx","XTicksAndGridLines","_d","AxisTitle","YTicksAndGridLines","AnimatePresence","YAxesLabels","cn","el","j","event","isEqual","checkIfNullOrUndefined","numberFormattingFunction","RefLineX","Tooltip","Modal","string2HTML","HorizontalDumbbellChart","graphTitle","colors","Colors","sources","graphDescription","footNote","colorDomain","colorLegendTitle","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","sortParameter","language","minHeight","theme","maxNumberOfBars","ariaLabel","filterNA","showColorScale","timeline","sortData","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","index","setIndex","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","interval","markObj","getSliderMarks","GraphHeader","Pause","Play","SliderUI","nextValue","EmptyState","ColorLegendWithMouseOver","orderBy","ensureCompleteDataForDumbbellChart","format","item","GraphFooter","yTicks","Axis","XAxesLabels","RefLineY","VerticalDumbbellChart","DumbbellChart","orientation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,KA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