@undp/data-viz 1.4.13 → 1.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AreaChart.cjs +1 -1
- package/dist/AreaChart.cjs.map +1 -1
- package/dist/AreaChart.js +25 -24
- package/dist/AreaChart.js.map +1 -1
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +638 -632
- package/dist/BarGraph.js.map +1 -1
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.cjs.map +1 -1
- package/dist/BeeSwarmChart.js +134 -132
- package/dist/BeeSwarmChart.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +35 -34
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.cjs.map +1 -1
- package/dist/BulletChart.js +226 -224
- package/dist/BulletChart.js.map +1 -1
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.cjs.map +1 -1
- package/dist/ButterflyChart.js +48 -47
- package/dist/ButterflyChart.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +56 -55
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +1 -1
- package/dist/DataCards.cjs +3 -3
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +2 -1
- package/dist/DataCards.js.map +1 -1
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.cjs.map +1 -1
- package/dist/DataTable.js +9 -8
- package/dist/DataTable.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +1 -0
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +77 -76
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +1 -0
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/{DropdownSelect-CeHog_ih.js → DropdownSelect-CtOKZHD0.js} +22 -20
- package/dist/{DropdownSelect-CeHog_ih.js.map → DropdownSelect-CtOKZHD0.js.map} +1 -1
- package/dist/{DropdownSelect-BmE5JaeE.cjs → DropdownSelect-DBDM64B5.cjs} +2 -2
- package/dist/{DropdownSelect-BmE5JaeE.cjs.map → DropdownSelect-DBDM64B5.cjs.map} +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.js +52 -51
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.cjs.map +1 -1
- package/dist/DumbbellChart.js +216 -214
- package/dist/DumbbellChart.js.map +1 -1
- package/dist/GeoHubCompareMaps.cjs +1 -1
- package/dist/GeoHubCompareMaps.cjs.map +1 -1
- package/dist/GeoHubCompareMaps.js +1 -0
- package/dist/GeoHubCompareMaps.js.map +1 -1
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.cjs.map +1 -1
- package/dist/GeoHubMap.js +29 -28
- package/dist/GeoHubMap.js.map +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +34 -33
- package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
- package/dist/{GraphEl-B3xVlimz.js → GraphEl-N6vuMRw_.js} +2 -2
- package/dist/{GraphEl-B3xVlimz.js.map → GraphEl-N6vuMRw_.js.map} +1 -1
- package/dist/{GraphEl-DO-juRN8.cjs → GraphEl-Zl0W-LK9.cjs} +2 -2
- package/dist/{GraphEl-DO-juRN8.cjs.map → GraphEl-Zl0W-LK9.cjs.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.js +2 -2
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.cjs.map +1 -1
- package/dist/HeatMap.js +55 -54
- package/dist/HeatMap.js.map +1 -1
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
- package/dist/LineChartWithConfidenceInterval.js +22 -21
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +34 -33
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +72 -71
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.cjs.map +1 -1
- package/dist/ParetoChart.js +22 -21
- package/dist/ParetoChart.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +1 -1
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.cjs.map +1 -1
- package/dist/RadarChart.js +27 -26
- package/dist/RadarChart.js.map +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.cjs.map +1 -1
- package/dist/SankeyChart.js +30 -29
- package/dist/SankeyChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +119 -118
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +16 -15
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.js +2 -2
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.cjs.map +1 -1
- package/dist/SlopeChart.js +46 -45
- package/dist/SlopeChart.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +12 -11
- package/dist/SparkLine.js.map +1 -1
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.cjs.map +1 -1
- package/dist/StripChart.js +81 -79
- package/dist/StripChart.js.map +1 -1
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +1 -0
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.cjs.map +1 -1
- package/dist/TreeMapGraph.js +114 -113
- package/dist/TreeMapGraph.js.map +1 -1
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.cjs.map +1 -1
- package/dist/UnitChart.js +10 -9
- package/dist/UnitChart.js.map +1 -1
- package/dist/{index-CZLvTu6p.cjs → index-BbNoLJ_w.cjs} +2 -2
- package/dist/{index-CZLvTu6p.cjs.map → index-BbNoLJ_w.cjs.map} +1 -1
- package/dist/{index-DGAaLNu9.js → index-Bc5VF70V.js} +46 -45
- package/dist/{index-DGAaLNu9.js.map → index-Bc5VF70V.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/SlopeChart.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlopeChart.cjs","sources":["../src/Components/Graphs/SlopeChart/Graph.tsx","../src/Components/Graphs/SlopeChart/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useRef, useState } from 'react';\r\nimport { scaleLinear } from 'd3-scale';\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 SlopeChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\n\r\ninterface Props {\r\n data: SlopeChartDataType[];\r\n width: number;\r\n height: number;\r\n selectedColor?: string;\r\n showLabels: boolean;\r\n colors: string[];\r\n colorDomain: string[];\r\n radius: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n axisTitles: [string, 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 highlightedDataPoints: (string | number)[];\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 resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n showLabels,\r\n colors,\r\n colorDomain,\r\n radius,\r\n leftMargin,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n axisTitles,\r\n highlightedDataPoints,\r\n selectedColor,\r\n minValue,\r\n maxValue,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n // 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 const margin = {\r\n top: 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 const minY = Math.min(Math.min(...data.map(d => d.y1)), Math.min(...data.map(d => d.y2)));\r\n const maxY = Math.max(Math.max(...data.map(d => d.y1)), Math.max(...data.map(d => d.y2)));\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? (minY > 0 ? 0 : minY) : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxY > 0 ? maxY : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\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 className='mx-auto'\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <g>\r\n <Axis\r\n y1={0}\r\n y2={graphHeight}\r\n x1={radius}\r\n x2={radius}\r\n classNames={{\r\n axis: cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.yAxis?.axis,\r\n ),\r\n }}\r\n />\r\n <AxisTitle\r\n x={radius}\r\n y={graphHeight + 15}\r\n style={styles?.yAxis?.title}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.yAxis?.title,\r\n )}\r\n text={axisTitles[0]}\r\n />\r\n </g>\r\n <g>\r\n <Axis\r\n y1={0}\r\n y2={graphHeight}\r\n x1={graphWidth - radius}\r\n x2={graphWidth - radius}\r\n classNames={{\r\n axis: cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.yAxis?.axis,\r\n ),\r\n }}\r\n />\r\n <AxisTitle\r\n x={graphWidth - radius}\r\n y={graphHeight + 15}\r\n style={styles?.yAxis?.title}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.yAxis?.title,\r\n )}\r\n text={axisTitles[1]}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <AnimatePresence>\r\n {data.map((d, i) => {\r\n return (\r\n <motion.g\r\n key={i}\r\n variants={{\r\n initial: {\r\n opacity: selectedColor\r\n ? d.color\r\n ? colors[colorDomain.indexOf(`${d.color}`)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : mouseOverData\r\n ? mouseOverData.label === d.label\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? d.color\r\n ? colors[colorDomain.indexOf(`${d.color}`)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : mouseOverData\r\n ? mouseOverData.label === d.label\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.circle\r\n cx={radius}\r\n variants={{\r\n initial: {\r\n cy: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n cy: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n r={radius}\r\n style={{\r\n fillOpacity: 0.6,\r\n }}\r\n />\r\n {showLabels ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'end',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={5}\r\n dy='0.33em'\r\n textAnchor='end'\r\n dx={0 - radius - 3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : highlightedDataPoints.length !== 0 ? (\r\n highlightedDataPoints.indexOf(d.label) !== -1 ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'end',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={5}\r\n dy='0.33em'\r\n dx={-3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null\r\n ) : null}\r\n <motion.circle\r\n cx={graphWidth - radius}\r\n variants={{\r\n initial: {\r\n cy: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n cy: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n r={radius}\r\n style={{\r\n fillOpacity: 0.6,\r\n }}\r\n />\r\n {showLabels ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={graphWidth - 5}\r\n dy='0.33em'\r\n dx={radius + 3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : highlightedDataPoints.length !== 0 ? (\r\n highlightedDataPoints.indexOf(d.label) !== -1 ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={graphWidth - 5}\r\n dy='0.33em'\r\n dx={3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null\r\n ) : null}\r\n <motion.line\r\n x1={radius}\r\n x2={graphWidth - radius}\r\n variants={{\r\n initial: {\r\n y1: y(d.y1),\r\n y2: y(d.y1),\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n },\r\n whileInView: {\r\n y1: y(d.y1),\r\n y2: y(d.y2),\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 className={classNames?.dataConnectors}\r\n style={{\r\n fill: 'none',\r\n strokeWidth: 1,\r\n ...styles?.dataConnectors,\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\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 uniqBy from 'lodash.uniqby';\r\nimport { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n Languages,\r\n SlopeChartDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { 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\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: SlopeChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for circles */\r\n colors?: string | 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 /** 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 /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Radius of the circles */\r\n radius?: number;\r\n /** Title for the two axis */\r\n axisTitles?: [string, string];\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** 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 /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** 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 SlopeChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showLabels = false,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n radius = 5,\r\n axisTitles = ['', ''],\r\n padding,\r\n backgroundColor = false,\r\n leftMargin = 50,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 20,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n showColorScale = true,\r\n highlightedDataPoints = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n } `}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a slope chart showing changes in data between two category or starting and ending time. Each line represents a different row in data, with lines sloping up or down to show increase or decrease over two categories or time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data.filter(\r\n d => !checkIfNullOrUndefined(d.y1) && !checkIfNullOrUndefined(d.y2),\r\n )}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n colors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n selectedColor={selectedColor}\r\n axisTitles={axisTitles}\r\n showLabels={showLabels}\r\n radius={radius}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n highlightedDataPoints={highlightedDataPoints}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\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 dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","showLabels","colors","colorDomain","radius","leftMargin","rightMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","axisTitles","highlightedDataPoints","selectedColor","minValue","maxValue","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","dimmedOpacity","customLayers","svgRef","useRef","isInView","useInView","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","minY","d","maxY","y","scaleLinear","checkIfNullOrUndefined","jsxs","Fragment","jsx","motion","Axis","cn","AxisTitle","AnimatePresence","i","event","isEqual","el","Colors","Tooltip","Modal","string2HTML","SlopeChart","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter"],"mappings":"wwBAsDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,WAAAC,EACA,OAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,sBAAAC,EACA,cAAAC,EACA,SAAAC,EACA,SAAAC,EACA,mBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,OAAAC,EACA,WAAAC,EACA,QAAAC,EACA,cAAAC,EACA,aAAAC,CAAA,EACE1B,EACE2B,EAASC,EAAAA,OAAO,IAAI,EACpBC,EAAWC,GAAAA,UAAUH,EAAQ,CACjC,KAAMH,EAAQ,KACd,OAAQA,EAAQ,MAAA,CACjB,EAEK,CAACO,EAAeC,CAAgB,EAAIC,EAAAA,SAAc,MAAS,EAE3D,CAACC,EAAgBC,CAAiB,EAAIF,EAAAA,SAAc,MAAS,EAC7D,CAACG,EAAQC,CAAS,EAAIJ,EAAAA,SAA6B,MAAS,EAC5D,CAACK,EAAQC,CAAS,EAAIN,EAAAA,SAA6B,MAAS,EAC5DO,EAAS,CACb,IAAK9B,EACL,OAAQC,EACR,KAAMH,EACN,MAAOC,CAAA,EAEHgC,EAAavC,EAAQsC,EAAO,KAAOA,EAAO,MAC1CE,EAAcvC,EAASqC,EAAO,IAAMA,EAAO,OAC3CG,EAAO,KAAK,IAAI,KAAK,IAAI,GAAG1C,EAAK,IAAI2C,GAAKA,EAAE,EAAE,CAAC,EAAG,KAAK,IAAI,GAAG3C,EAAK,IAAI2C,GAAKA,EAAE,EAAE,CAAC,CAAC,EAClFC,EAAO,KAAK,IAAI,KAAK,IAAI,GAAG5C,EAAK,IAAI2C,GAAKA,EAAE,EAAE,CAAC,EAAG,KAAK,IAAI,GAAG3C,EAAK,IAAI2C,GAAKA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tD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAA4C,EACA,SAAAE,EACA,MAAAnE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
|
1
|
+
{"version":3,"file":"SlopeChart.cjs","sources":["../src/Components/Graphs/SlopeChart/Graph.tsx","../src/Components/Graphs/SlopeChart/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useRef, useState } from 'react';\r\nimport { scaleLinear } from 'd3-scale';\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 SlopeChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\n\r\ninterface Props {\r\n data: SlopeChartDataType[];\r\n width: number;\r\n height: number;\r\n selectedColor?: string;\r\n showLabels: boolean;\r\n colors: string[];\r\n colorDomain: string[];\r\n radius: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n axisTitles: [string, 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 highlightedDataPoints: (string | number)[];\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 resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n showLabels,\r\n colors,\r\n colorDomain,\r\n radius,\r\n leftMargin,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n axisTitles,\r\n highlightedDataPoints,\r\n selectedColor,\r\n minValue,\r\n maxValue,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n // 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 const margin = {\r\n top: 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 const minY = Math.min(Math.min(...data.map(d => d.y1)), Math.min(...data.map(d => d.y2)));\r\n const maxY = Math.max(Math.max(...data.map(d => d.y1)), Math.max(...data.map(d => d.y2)));\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? (minY > 0 ? 0 : minY) : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxY > 0 ? maxY : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\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 className='mx-auto'\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <g>\r\n <Axis\r\n y1={0}\r\n y2={graphHeight}\r\n x1={radius}\r\n x2={radius}\r\n classNames={{\r\n axis: cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.yAxis?.axis,\r\n ),\r\n }}\r\n />\r\n <AxisTitle\r\n x={radius}\r\n y={graphHeight + 15}\r\n style={styles?.yAxis?.title}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.yAxis?.title,\r\n )}\r\n text={axisTitles[0]}\r\n />\r\n </g>\r\n <g>\r\n <Axis\r\n y1={0}\r\n y2={graphHeight}\r\n x1={graphWidth - radius}\r\n x2={graphWidth - radius}\r\n classNames={{\r\n axis: cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.yAxis?.axis,\r\n ),\r\n }}\r\n />\r\n <AxisTitle\r\n x={graphWidth - radius}\r\n y={graphHeight + 15}\r\n style={styles?.yAxis?.title}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.yAxis?.title,\r\n )}\r\n text={axisTitles[1]}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <AnimatePresence>\r\n {data.map((d, i) => {\r\n return (\r\n <motion.g\r\n key={i}\r\n variants={{\r\n initial: {\r\n opacity: selectedColor\r\n ? d.color\r\n ? colors[colorDomain.indexOf(`${d.color}`)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : mouseOverData\r\n ? mouseOverData.label === d.label\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? d.color\r\n ? colors[colorDomain.indexOf(`${d.color}`)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : mouseOverData\r\n ? mouseOverData.label === d.label\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.circle\r\n cx={radius}\r\n variants={{\r\n initial: {\r\n cy: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n cy: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n r={radius}\r\n style={{\r\n fillOpacity: 0.6,\r\n }}\r\n />\r\n {showLabels ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'end',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={5}\r\n dy='0.33em'\r\n textAnchor='end'\r\n dx={0 - radius - 3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : highlightedDataPoints.length !== 0 ? (\r\n highlightedDataPoints.indexOf(d.label) !== -1 ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y1),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'end',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={5}\r\n dy='0.33em'\r\n dx={-3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null\r\n ) : null}\r\n <motion.circle\r\n cx={graphWidth - radius}\r\n variants={{\r\n initial: {\r\n cy: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n cy: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n r={radius}\r\n style={{\r\n fillOpacity: 0.6,\r\n }}\r\n />\r\n {showLabels ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={graphWidth - 5}\r\n dy='0.33em'\r\n dx={radius + 3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : highlightedDataPoints.length !== 0 ? (\r\n highlightedDataPoints.indexOf(d.label) !== -1 ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n opacity: 0,\r\n },\r\n whileInView: {\r\n y: y(d.y2),\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.yAxis?.labels || {}),\r\n }}\r\n className={cn('text-xs', classNames?.yAxis?.labels)}\r\n x={graphWidth - 5}\r\n dy='0.33em'\r\n dx={3}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null\r\n ) : null}\r\n <motion.line\r\n x1={radius}\r\n x2={graphWidth - radius}\r\n variants={{\r\n initial: {\r\n y1: y(d.y1),\r\n y2: y(d.y1),\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\r\n },\r\n whileInView: {\r\n y1: y(d.y1),\r\n y2: y(d.y2),\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? colors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : colors[colorDomain.indexOf(`${d.color}`)],\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 className={classNames?.dataConnectors}\r\n style={{\r\n fill: 'none',\r\n strokeWidth: 1,\r\n ...styles?.dataConnectors,\r\n }}\r\n />\r\n </motion.g>\r\n );\r\n })}\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 uniqBy from 'lodash.uniqby';\r\nimport { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n Languages,\r\n SlopeChartDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { 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\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: SlopeChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for circles */\r\n colors?: string | 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 /** 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 /** Toggles the background to fill the container. This only works if the width of the graph is defined. */\r\n fillContainer?: boolean;\r\n\r\n // Values and Ticks\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Radius of the circles */\r\n radius?: number;\r\n /** Title for the two axis */\r\n axisTitles?: [string, string];\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** 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 /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** 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 SlopeChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n showLabels = false,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n radius = 5,\r\n axisTitles = ['', ''],\r\n padding,\r\n backgroundColor = false,\r\n leftMargin = 50,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 20,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n showColorScale = true,\r\n highlightedDataPoints = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n fillContainer = true,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'grow-0' : 'grow'} ${\r\n !fillContainer ? 'w-fit' : 'w-full'\r\n } `}\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 !fillContainer ? '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 slope chart showing changes in data between two category or starting and ending time. Each line represents a different row in data, with lines sloping up or down to show increase or decrease over two categories or time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data.filter(\r\n d => !checkIfNullOrUndefined(d.y1) && !checkIfNullOrUndefined(d.y2),\r\n )}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n colors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n selectedColor={selectedColor}\r\n axisTitles={axisTitles}\r\n showLabels={showLabels}\r\n radius={radius}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n highlightedDataPoints={highlightedDataPoints}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\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 dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","showLabels","colors","colorDomain","radius","leftMargin","rightMargin","topMargin","bottomMargin","tooltip","onSeriesMouseOver","axisTitles","highlightedDataPoints","selectedColor","minValue","maxValue","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","dimmedOpacity","customLayers","svgRef","useRef","isInView","useInView","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","minY","d","maxY","y","scaleLinear","checkIfNullOrUndefined","jsxs","Fragment","jsx","motion","Axis","cn","AxisTitle","AnimatePresence","i","event","isEqual","el","Colors","Tooltip","Modal","string2HTML","SlopeChart","graphTitle","sources","graphDescription","footNote","colorLegendTitle","padding","backgroundColor","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","fillContainer","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter"],"mappings":"wwBAsDO,SAASA,GAAMC,EAAc,CAClC,KAAM,CACJ,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,WAAAC,EACA,OAAAC,EACA,YAAAC,EACA,OAAAC,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EACA,aAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,WAAAC,EACA,sBAAAC,EACA,cAAAC,EACA,SAAAC,EACA,SAAAC,EACA,mBAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,OAAAC,EACA,WAAAC,EACA,QAAAC,EACA,cAAAC,EACA,aAAAC,CAAA,EACE1B,EACE2B,EAASC,EAAAA,OAAO,IAAI,EACpBC,EAAWC,GAAAA,UAAUH,EAAQ,CACjC,KAAMH,EAAQ,KACd,OAAQA,EAAQ,MAAA,CACjB,EAEK,CAACO,EAAeC,CAAgB,EAAIC,EAAAA,SAAc,MAAS,EAE3D,CAACC,EAAgBC,CAAiB,EAAIF,EAAAA,SAAc,MAAS,EAC7D,CAACG,EAAQC,CAAS,EAAIJ,EAAAA,SAA6B,MAAS,EAC5D,CAACK,EAAQC,CAAS,EAAIN,EAAAA,SAA6B,MAAS,EAC5DO,EAAS,CACb,IAAK9B,EACL,OAAQC,EACR,KAAMH,EACN,MAAOC,CAAA,EAEHgC,EAAavC,EAAQsC,EAAO,KAAOA,EAAO,MAC1CE,EAAcvC,EAASqC,EAAO,IAAMA,EAAO,OAC3CG,EAAO,KAAK,IAAI,KAAK,IAAI,GAAG1C,EAAK,IAAI2C,GAAKA,EAAE,EAAE,CAAC,EAAG,KAAK,IAAI,GAAG3C,EAAK,IAAI2C,GAAKA,EAAE,EAAE,CAAC,CAAC,EAClFC,EAAO,KAAK,IAAI,KAAK,IA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EACCyC,GAAWE,EACVlB,EAAAA,kBAAAA,IAAC+C,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAU5E,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAA4C,EACA,SAAAE,EACA,MAAAnE,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
|
package/dist/SlopeChart.js
CHANGED
|
@@ -3,10 +3,10 @@ import { u as ri } from "./index-CaAIPGZo.js";
|
|
|
3
3
|
import { useRef as ii, useState as I, useEffect as yi } from "react";
|
|
4
4
|
import { i as mi } from "./index-27yTRcko.js";
|
|
5
5
|
import { X as xi } from "./Modal-DVVwpKhP.js";
|
|
6
|
-
import { T as
|
|
6
|
+
import { T as fi } from "./Tooltip-DyM5snqx.js";
|
|
7
7
|
import { c as J } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
8
8
|
import { Colors as n } from "./Colors.js";
|
|
9
|
-
import { s as
|
|
9
|
+
import { s as hi } from "./string2HTML-CWHGfz_d.js";
|
|
10
10
|
import { A as ai } from "./Axis-Ddg-seDi.js";
|
|
11
11
|
import { A as ni } from "./AxisTitle-BmHLMRJZ.js";
|
|
12
12
|
import { a as gi } from "./linear-DUdu7l2G.js";
|
|
@@ -41,22 +41,22 @@ function Oi(K) {
|
|
|
41
41
|
resetSelectionOnDoubleClick: Z,
|
|
42
42
|
detailsOnClick: g,
|
|
43
43
|
styles: u,
|
|
44
|
-
classNames:
|
|
44
|
+
classNames: f,
|
|
45
45
|
animate: s,
|
|
46
46
|
dimmedOpacity: p,
|
|
47
47
|
customLayers: B
|
|
48
48
|
} = K, _ = ii(null), d = ui(_, {
|
|
49
49
|
once: s.once,
|
|
50
50
|
amount: s.amount
|
|
51
|
-
}), [w, S] = I(void 0), [
|
|
51
|
+
}), [w, S] = I(void 0), [M, N] = I(void 0), [U, C] = I(void 0), [T, W] = I(void 0), A = {
|
|
52
52
|
top: G,
|
|
53
53
|
bottom: Q,
|
|
54
54
|
left: x,
|
|
55
55
|
right: X
|
|
56
|
-
}, v = $ -
|
|
56
|
+
}, v = $ - A.left - A.right, h = k - A.top - A.bottom, b = Math.min(Math.min(...l.map((i) => i.y1)), Math.min(...l.map((i) => i.y2))), P = Math.max(Math.max(...l.map((i) => i.y1)), Math.max(...l.map((i) => i.y2))), y = gi().domain([
|
|
57
57
|
J(q) ? b > 0 ? 0 : b : q,
|
|
58
58
|
J(z) ? P > 0 ? P : 0 : z
|
|
59
|
-
]).range([
|
|
59
|
+
]).range([h, 0]).nice();
|
|
60
60
|
return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
61
61
|
/* @__PURE__ */ o.jsx(
|
|
62
62
|
O.svg,
|
|
@@ -67,19 +67,19 @@ function Oi(K) {
|
|
|
67
67
|
className: "mx-auto",
|
|
68
68
|
direction: "ltr",
|
|
69
69
|
ref: _,
|
|
70
|
-
children: /* @__PURE__ */ o.jsxs("g", { transform: `translate(${
|
|
70
|
+
children: /* @__PURE__ */ o.jsxs("g", { transform: `translate(${A.left},${A.top})`, children: [
|
|
71
71
|
/* @__PURE__ */ o.jsxs("g", { children: [
|
|
72
72
|
/* @__PURE__ */ o.jsx(
|
|
73
73
|
ai,
|
|
74
74
|
{
|
|
75
75
|
y1: 0,
|
|
76
|
-
y2:
|
|
76
|
+
y2: h,
|
|
77
77
|
x1: c,
|
|
78
78
|
x2: c,
|
|
79
79
|
classNames: {
|
|
80
80
|
axis: j(
|
|
81
81
|
"stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",
|
|
82
|
-
|
|
82
|
+
f?.yAxis?.axis
|
|
83
83
|
)
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -88,11 +88,11 @@ function Oi(K) {
|
|
|
88
88
|
ni,
|
|
89
89
|
{
|
|
90
90
|
x: c,
|
|
91
|
-
y:
|
|
91
|
+
y: h + 15,
|
|
92
92
|
style: u?.yAxis?.title,
|
|
93
93
|
className: j(
|
|
94
94
|
"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",
|
|
95
|
-
|
|
95
|
+
f?.yAxis?.title
|
|
96
96
|
),
|
|
97
97
|
text: L[0]
|
|
98
98
|
}
|
|
@@ -103,13 +103,13 @@ function Oi(K) {
|
|
|
103
103
|
ai,
|
|
104
104
|
{
|
|
105
105
|
y1: 0,
|
|
106
|
-
y2:
|
|
106
|
+
y2: h,
|
|
107
107
|
x1: v - c,
|
|
108
108
|
x2: v - c,
|
|
109
109
|
classNames: {
|
|
110
110
|
axis: j(
|
|
111
111
|
"stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",
|
|
112
|
-
|
|
112
|
+
f?.yAxis?.axis
|
|
113
113
|
)
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -118,11 +118,11 @@ function Oi(K) {
|
|
|
118
118
|
ni,
|
|
119
119
|
{
|
|
120
120
|
x: v - c,
|
|
121
|
-
y:
|
|
121
|
+
y: h + 15,
|
|
122
122
|
style: u?.yAxis?.title,
|
|
123
123
|
className: j(
|
|
124
124
|
"fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",
|
|
125
|
-
|
|
125
|
+
f?.yAxis?.title
|
|
126
126
|
),
|
|
127
127
|
text: L[1]
|
|
128
128
|
}
|
|
@@ -145,16 +145,16 @@ function Oi(K) {
|
|
|
145
145
|
animate: d ? "whileInView" : "initial",
|
|
146
146
|
exit: { opacity: 0, transition: { duration: s.duration } },
|
|
147
147
|
onMouseEnter: (t) => {
|
|
148
|
-
S(i), W(t.clientY),
|
|
148
|
+
S(i), W(t.clientY), C(t.clientX), F?.(i);
|
|
149
149
|
},
|
|
150
150
|
onMouseMove: (t) => {
|
|
151
|
-
S(i), W(t.clientY),
|
|
151
|
+
S(i), W(t.clientY), C(t.clientX);
|
|
152
152
|
},
|
|
153
153
|
onMouseLeave: () => {
|
|
154
|
-
S(void 0),
|
|
154
|
+
S(void 0), C(void 0), W(void 0), F?.(void 0);
|
|
155
155
|
},
|
|
156
156
|
onClick: () => {
|
|
157
|
-
(E || g) && (mi(
|
|
157
|
+
(E || g) && (mi(M, i) && Z ? (N(void 0), E?.(void 0)) : (N(i), E?.(i)));
|
|
158
158
|
},
|
|
159
159
|
children: [
|
|
160
160
|
/* @__PURE__ */ o.jsx(
|
|
@@ -208,7 +208,7 @@ function Oi(K) {
|
|
|
208
208
|
textAnchor: "end",
|
|
209
209
|
...u?.yAxis?.labels || {}
|
|
210
210
|
},
|
|
211
|
-
className: j("text-xs",
|
|
211
|
+
className: j("text-xs", f?.yAxis?.labels),
|
|
212
212
|
x: 5,
|
|
213
213
|
dy: "0.33em",
|
|
214
214
|
textAnchor: "end",
|
|
@@ -238,7 +238,7 @@ function Oi(K) {
|
|
|
238
238
|
textAnchor: "end",
|
|
239
239
|
...u?.yAxis?.labels || {}
|
|
240
240
|
},
|
|
241
|
-
className: j("text-xs",
|
|
241
|
+
className: j("text-xs", f?.yAxis?.labels),
|
|
242
242
|
x: 5,
|
|
243
243
|
dy: "0.33em",
|
|
244
244
|
dx: -3,
|
|
@@ -296,7 +296,7 @@ function Oi(K) {
|
|
|
296
296
|
textAnchor: "start",
|
|
297
297
|
...u?.yAxis?.labels || {}
|
|
298
298
|
},
|
|
299
|
-
className: j("text-xs",
|
|
299
|
+
className: j("text-xs", f?.yAxis?.labels),
|
|
300
300
|
x: v - 5,
|
|
301
301
|
dy: "0.33em",
|
|
302
302
|
dx: c + 3,
|
|
@@ -325,7 +325,7 @@ function Oi(K) {
|
|
|
325
325
|
textAnchor: "start",
|
|
326
326
|
...u?.yAxis?.labels || {}
|
|
327
327
|
},
|
|
328
|
-
className: j("text-xs",
|
|
328
|
+
className: j("text-xs", f?.yAxis?.labels),
|
|
329
329
|
x: v - 5,
|
|
330
330
|
dy: "0.33em",
|
|
331
331
|
dx: 3,
|
|
@@ -353,7 +353,7 @@ function Oi(K) {
|
|
|
353
353
|
initial: "initial",
|
|
354
354
|
animate: d ? "whileInView" : "initial",
|
|
355
355
|
exit: { opacity: 0, transition: { duration: s.duration } },
|
|
356
|
-
className:
|
|
356
|
+
className: f?.dataConnectors,
|
|
357
357
|
style: {
|
|
358
358
|
fill: "none",
|
|
359
359
|
strokeWidth: 1,
|
|
@@ -370,20 +370,20 @@ function Oi(K) {
|
|
|
370
370
|
}
|
|
371
371
|
),
|
|
372
372
|
w && R && U && T ? /* @__PURE__ */ o.jsx(
|
|
373
|
-
|
|
373
|
+
fi,
|
|
374
374
|
{
|
|
375
375
|
data: w,
|
|
376
376
|
body: R,
|
|
377
377
|
xPos: U,
|
|
378
378
|
yPos: T,
|
|
379
379
|
backgroundStyle: u?.tooltip,
|
|
380
|
-
className:
|
|
380
|
+
className: f?.tooltip
|
|
381
381
|
}
|
|
382
382
|
) : null,
|
|
383
|
-
g &&
|
|
383
|
+
g && M !== void 0 ? /* @__PURE__ */ o.jsx(
|
|
384
384
|
xi,
|
|
385
385
|
{
|
|
386
|
-
open:
|
|
386
|
+
open: M !== void 0,
|
|
387
387
|
onClose: () => {
|
|
388
388
|
N(void 0);
|
|
389
389
|
},
|
|
@@ -391,8 +391,8 @@ function Oi(K) {
|
|
|
391
391
|
"div",
|
|
392
392
|
{
|
|
393
393
|
className: "graph-modal-content m-0",
|
|
394
|
-
dangerouslySetInnerHTML: typeof g == "string" ? { __html:
|
|
395
|
-
children: typeof g == "function" ? g(
|
|
394
|
+
dangerouslySetInnerHTML: typeof g == "string" ? { __html: hi(g, M) } : void 0,
|
|
395
|
+
children: typeof g == "function" ? g(M) : null
|
|
396
396
|
}
|
|
397
397
|
)
|
|
398
398
|
}
|
|
@@ -423,7 +423,7 @@ function Gi(K) {
|
|
|
423
423
|
tooltip: Z,
|
|
424
424
|
relativeHeight: g,
|
|
425
425
|
onSeriesMouseOver: u,
|
|
426
|
-
showColorScale:
|
|
426
|
+
showColorScale: f = !0,
|
|
427
427
|
highlightedDataPoints: s = [],
|
|
428
428
|
graphID: p,
|
|
429
429
|
minValue: B,
|
|
@@ -431,15 +431,15 @@ function Gi(K) {
|
|
|
431
431
|
onSeriesMouseClick: d,
|
|
432
432
|
graphDownload: w = !1,
|
|
433
433
|
dataDownload: S = !1,
|
|
434
|
-
fillContainer:
|
|
434
|
+
fillContainer: M = !0,
|
|
435
435
|
language: N = "en",
|
|
436
436
|
showNAColor: U = !0,
|
|
437
|
-
minHeight:
|
|
437
|
+
minHeight: C = 0,
|
|
438
438
|
theme: T = "light",
|
|
439
439
|
ariaLabel: W,
|
|
440
|
-
resetSelectionOnDoubleClick:
|
|
440
|
+
resetSelectionOnDoubleClick: A = !0,
|
|
441
441
|
detailsOnClick: v,
|
|
442
|
-
styles:
|
|
442
|
+
styles: h,
|
|
443
443
|
classNames: b,
|
|
444
444
|
animate: P = !1,
|
|
445
445
|
dimmedOpacity: y = 0.3,
|
|
@@ -453,17 +453,18 @@ function Gi(K) {
|
|
|
453
453
|
}, [x, c]), /* @__PURE__ */ o.jsx(
|
|
454
454
|
"div",
|
|
455
455
|
{
|
|
456
|
-
className: `${T || "light"} flex ${x ? "grow-0" : "grow"} ${
|
|
456
|
+
className: `${T || "light"} flex ${x ? "grow-0" : "grow"} ${M ? "w-full" : "w-fit"} `,
|
|
457
457
|
dir: N === "he" || N === "ar" ? "rtl" : void 0,
|
|
458
458
|
children: /* @__PURE__ */ o.jsx(
|
|
459
459
|
"div",
|
|
460
460
|
{
|
|
461
461
|
className: j(
|
|
462
462
|
`${m ? m === !0 ? "bg-primary-gray-200 dark:bg-primary-gray-650 " : "" : "bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${N || "en"}`,
|
|
463
|
+
M ? "w-full" : "w-fit",
|
|
463
464
|
b?.graphContainer
|
|
464
465
|
),
|
|
465
466
|
style: {
|
|
466
|
-
...
|
|
467
|
+
...h?.graphContainer || {},
|
|
467
468
|
...m && m !== !0 ? { backgroundColor: m } : {}
|
|
468
469
|
},
|
|
469
470
|
id: p,
|
|
@@ -479,8 +480,8 @@ function Gi(K) {
|
|
|
479
480
|
wi,
|
|
480
481
|
{
|
|
481
482
|
styles: {
|
|
482
|
-
title:
|
|
483
|
-
description:
|
|
483
|
+
title: h?.title,
|
|
484
|
+
description: h?.description
|
|
484
485
|
},
|
|
485
486
|
classNames: {
|
|
486
487
|
title: b?.title,
|
|
@@ -494,7 +495,7 @@ function Gi(K) {
|
|
|
494
495
|
}
|
|
495
496
|
) : null,
|
|
496
497
|
/* @__PURE__ */ o.jsx("div", { className: "grow flex flex-col justify-center gap-3 w-full", children: l.length === 0 ? /* @__PURE__ */ o.jsx(bi, {}) : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
497
|
-
|
|
498
|
+
f && l.filter((r) => r.color).length !== 0 ? /* @__PURE__ */ o.jsx(
|
|
498
499
|
vi,
|
|
499
500
|
{
|
|
500
501
|
width: x,
|
|
@@ -522,8 +523,8 @@ function Gi(K) {
|
|
|
522
523
|
),
|
|
523
524
|
width: x || V,
|
|
524
525
|
height: Math.max(
|
|
525
|
-
|
|
526
|
-
c || (g ?
|
|
526
|
+
C,
|
|
527
|
+
c || (g ? C ? (x || V) * g > C ? (x || V) * g : C : (x || V) * g : ti)
|
|
527
528
|
),
|
|
528
529
|
colorDomain: l.filter((r) => r.color).length === 0 ? [] : G || ri(
|
|
529
530
|
l.filter((r) => r.color),
|
|
@@ -544,9 +545,9 @@ function Gi(K) {
|
|
|
544
545
|
minValue: B,
|
|
545
546
|
maxValue: _,
|
|
546
547
|
onSeriesMouseClick: d,
|
|
547
|
-
resetSelectionOnDoubleClick:
|
|
548
|
+
resetSelectionOnDoubleClick: A,
|
|
548
549
|
detailsOnClick: v,
|
|
549
|
-
styles:
|
|
550
|
+
styles: h,
|
|
550
551
|
classNames: b,
|
|
551
552
|
animate: P === !0 ? { duration: 0.5, once: !0, amount: 0.5 } : P || { duration: 0, once: !0, amount: 0 },
|
|
552
553
|
dimmedOpacity: y,
|
|
@@ -559,7 +560,7 @@ function Gi(K) {
|
|
|
559
560
|
H || X ? /* @__PURE__ */ o.jsx(
|
|
560
561
|
di,
|
|
561
562
|
{
|
|
562
|
-
styles: { footnote:
|
|
563
|
+
styles: { footnote: h?.footnote, source: h?.source },
|
|
563
564
|
classNames: {
|
|
564
565
|
footnote: b?.footnote,
|
|
565
566
|
source: b?.source
|