@undp/data-viz 1.5.1 → 1.5.3
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 +3 -2
- package/dist/AreaChart.js.map +1 -1
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +1221 -1247
- package/dist/BarGraph.js.map +1 -1
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.cjs.map +1 -1
- package/dist/BeeSwarmChart.js +130 -142
- package/dist/BeeSwarmChart.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +41 -41
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.cjs.map +1 -1
- package/dist/BulletChart.js +483 -487
- package/dist/BulletChart.js.map +1 -1
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.cjs.map +1 -1
- package/dist/ButterflyChart.js +99 -99
- package/dist/ButterflyChart.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +125 -125
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +2 -2
- package/dist/Data/BureauPerformance.csv +8 -0
- package/dist/Data/EGDashboardData.csv +6 -0
- package/dist/DataCards.cjs +2 -2
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +6 -6
- package/dist/DataCards.js.map +1 -1
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.cjs.map +1 -1
- package/dist/DataTable.js +66 -68
- package/dist/DataTable.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +3 -2
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +205 -205
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +78 -81
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.js +3 -2
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.cjs.map +1 -1
- package/dist/DumbbellChart.js +64 -65
- package/dist/DumbbellChart.js.map +1 -1
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.js +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +1 -1
- package/dist/{GraphEl-4RUlclvW.cjs → GraphEl-BcYgMnN2.cjs} +2 -2
- package/dist/{GraphEl-4RUlclvW.cjs.map → GraphEl-BcYgMnN2.cjs.map} +1 -1
- package/dist/{GraphEl-ClIxlWa3.js → GraphEl-CMWeARJ3.js} +2 -2
- package/dist/{GraphEl-ClIxlWa3.js.map → GraphEl-CMWeARJ3.js.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.js +4 -4
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.js +1 -1
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.cjs.map +1 -1
- package/dist/HeatMap.js +83 -83
- 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 +7 -6
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.js +2 -2
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +82 -91
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +3 -2
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +2 -2
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.cjs.map +1 -1
- package/dist/RadarChart.js +124 -130
- package/dist/RadarChart.js.map +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.cjs.map +1 -1
- package/dist/SankeyChart.js +200 -200
- package/dist/SankeyChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +149 -155
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +44 -43
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.js +4 -4
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.cjs.map +1 -1
- package/dist/SlopeChart.js +107 -113
- package/dist/SlopeChart.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +3 -2
- package/dist/SparkLine.js.map +1 -1
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.cjs.map +1 -1
- package/dist/StripChart.js +159 -159
- package/dist/StripChart.js.map +1 -1
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +3 -3
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.cjs.map +1 -1
- package/dist/TreeMapGraph.js +194 -200
- package/dist/TreeMapGraph.js.map +1 -1
- package/dist/ensureCompleteData-DkQYPeDa.cjs +2 -0
- package/dist/ensureCompleteData-DkQYPeDa.cjs.map +1 -0
- package/dist/{ensureCompleteData-BALdOrsS.js → ensureCompleteData-DlmibgaI.js} +28 -8
- package/dist/ensureCompleteData-DlmibgaI.js.map +1 -0
- package/dist/fetchAndParseData-Ba-_CgxS.cjs +16 -0
- package/dist/fetchAndParseData-Ba-_CgxS.cjs.map +1 -0
- package/dist/fetchAndParseData-sapWbnYk.js +583 -0
- package/dist/fetchAndParseData-sapWbnYk.js.map +1 -0
- package/dist/fetchAndParseData.cjs +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/getJenks-BbngDoBQ.js +19 -0
- package/dist/getJenks-BbngDoBQ.js.map +1 -0
- package/dist/getJenks-GYmdwBqm.cjs +2 -0
- package/dist/getJenks-GYmdwBqm.cjs.map +1 -0
- package/dist/getSliderMarks-9cNoRkDx.js +1023 -0
- package/dist/getSliderMarks-9cNoRkDx.js.map +1 -0
- package/dist/getSliderMarks-CRIbTGYV.cjs +6 -0
- package/dist/getSliderMarks-CRIbTGYV.cjs.map +1 -0
- package/dist/getUniqValue-DiCh_MOD.js +13 -0
- package/dist/getUniqValue-DiCh_MOD.js.map +1 -0
- package/dist/getUniqValue-RViz8tTw.cjs +2 -0
- package/dist/getUniqValue-RViz8tTw.cjs.map +1 -0
- package/dist/{index-BMgDMxKJ.js → index-37q0ULNQ.js} +44 -50
- package/dist/index-37q0ULNQ.js.map +1 -0
- package/dist/index-CVlCtJbC.cjs +2 -0
- package/dist/index-CVlCtJbC.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/sort-DfK1b0F5.js +34 -0
- package/dist/sort-DfK1b0F5.js.map +1 -0
- package/dist/sort-O96oMZLb.cjs +2 -0
- package/dist/sort-O96oMZLb.cjs.map +1 -0
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +3 -3
- package/dist/transformDataForAggregation-KXGm6flX.cjs +2 -0
- package/dist/{transformDataForAggregation-BVxVu4yY.cjs.map → transformDataForAggregation-KXGm6flX.cjs.map} +1 -1
- package/dist/{transformDataForAggregation-1BYVFqvF.js → transformDataForAggregation-sBpdlX8n.js} +40 -44
- package/dist/{transformDataForAggregation-1BYVFqvF.js.map → transformDataForAggregation-sBpdlX8n.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js → transformDataForGraphFromFile-ComYvzuz.js} +3 -3
- package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js.map → transformDataForGraphFromFile-ComYvzuz.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs → transformDataForGraphFromFile-DVZodTHd.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs.map → transformDataForGraphFromFile-DVZodTHd.cjs.map} +1 -1
- package/dist/uniqBy-BHy4I8PK.js +8 -0
- package/dist/uniqBy-BHy4I8PK.js.map +1 -0
- package/dist/uniqBy-O05lp2S5.cjs +2 -0
- package/dist/uniqBy-O05lp2S5.cjs.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +1 -7
- package/dist/ensureCompleteData-BALdOrsS.js.map +0 -1
- package/dist/ensureCompleteData-BU5Zlccy.cjs +0 -2
- package/dist/ensureCompleteData-BU5Zlccy.cjs.map +0 -1
- package/dist/fetchAndParseData-DBOl1Icl.js +0 -1196
- package/dist/fetchAndParseData-DBOl1Icl.js.map +0 -1
- package/dist/fetchAndParseData-Dcy7AS_0.cjs +0 -16
- package/dist/fetchAndParseData-Dcy7AS_0.cjs.map +0 -1
- package/dist/getJenks-DW96UYNE.js +0 -23
- package/dist/getJenks-DW96UYNE.js.map +0 -1
- package/dist/getJenks-vofIZmeb.cjs +0 -2
- package/dist/getJenks-vofIZmeb.cjs.map +0 -1
- package/dist/getSliderMarks-C0jptXeP.js +0 -1054
- package/dist/getSliderMarks-C0jptXeP.js.map +0 -1
- package/dist/getSliderMarks-CtsEXiLV.cjs +0 -6
- package/dist/getSliderMarks-CtsEXiLV.cjs.map +0 -1
- package/dist/getUniqValue-CfuE_l9c.cjs +0 -2
- package/dist/getUniqValue-CfuE_l9c.cjs.map +0 -1
- package/dist/getUniqValue-CttuU_wn.js +0 -20
- package/dist/getUniqValue-CttuU_wn.js.map +0 -1
- package/dist/index-AqnpA7_O.js +0 -631
- package/dist/index-AqnpA7_O.js.map +0 -1
- package/dist/index-BJOeaYTk.cjs +0 -2
- package/dist/index-BJOeaYTk.cjs.map +0 -1
- package/dist/index-BMgDMxKJ.js.map +0 -1
- package/dist/index-DYH8g9WA.cjs +0 -2
- package/dist/index-DYH8g9WA.cjs.map +0 -1
- package/dist/index-Da2GUKrr.cjs +0 -2
- package/dist/index-Da2GUKrr.cjs.map +0 -1
- package/dist/index-fwdktvAS.js +0 -707
- package/dist/index-fwdktvAS.js.map +0 -1
- package/dist/transformDataForAggregation-BVxVu4yY.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DotDensityMap.js","sources":["../src/Components/Graphs/Maps/DotDensityMap/Graph.tsx","../src/Components/Graphs/Maps/DotDensityMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleSqrt } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n DotDensityMapDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n data: DotDensityMapDataType[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n colorDomain: string[];\r\n width: number;\r\n height: number;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n radius: number;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n showLabels: boolean;\r\n mapBorderColor: 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 isWorldMap: boolean;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedDataPoints: (string | 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 zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n maxRadiusValue: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n colorDomain,\r\n radius,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n showLabels,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n maxRadiusValue,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const radiusScale =\r\n data.filter(d => d.radius === undefined || d.radius === null).length !== data.length\r\n ? scaleSqrt().domain([0, maxRadiusValue]).range([0.25, radius]).nice()\r\n : undefined;\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const color =\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 return (\r\n <motion.g\r\n key={d.label || `${d.lat}-${d.long}`}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\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 transform={`translate(${\r\n (projection([d.long, d.lat]) as [number, number])[0]\r\n },${(projection([d.long, d.lat]) as [number, number])[1]})`}\r\n >\r\n <motion.circle\r\n cx={0}\r\n cy={0}\r\n variants={{\r\n initial: {\r\n r: 0,\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 },\r\n whileInView: {\r\n r: !radiusScale ? radius : radiusScale(d.radius || 0),\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 transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ r: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n fillOpacity: 0.8,\r\n }}\r\n />\r\n {showLabels && d.label ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: !radiusScale ? radius : radiusScale(d.radius || 0),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: !radiusScale ? radius : radiusScale(d.radius || 0),\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 y={0}\r\n className='fill-primary-gray-600 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'start' }}\r\n dx={4}\r\n dy={5}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null}\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 {data.filter(el => el.color).length === 0 || showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div className='p-2' style={{ backgroundColor: 'rgba(240,240,240, 0.7)' }}>\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <p\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </p>\r\n ) : null}\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\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 {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport uniqBy from 'lodash.uniqby';\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 { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { ascending, sort } from 'd3-array';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n DotDensityMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ZoomInteractionTypes,\r\n MapProjectionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DotDensityMapDataType[];\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 the circle */\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 /** Color for the areas where data is no available */\r\n mapNoDataColor?: 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\r\n // Graph Parameters\r\n /** Maximum radius of the circle */\r\n radius?: number;\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Maximum value mapped to the radius chart */\r\n maxRadiusValue?: number;\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 /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\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 DotDensityMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorLegendTitle,\r\n colorDomain,\r\n radius = 5,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n showLabels = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\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 mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n maxRadiusValue,\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\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(\r\n data.filter(d => d.date !== undefined && d.date !== null),\r\n d => d.date,\r\n ).map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(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 || 760);\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 || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n setMapShape(d);\r\n });\r\n } else {\r\n setMapShape(mapData);\r\n }\r\n }, [mapData]);\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 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 dot density map showing the distribution of a variable across a region or world, with each dot representing a data point.${\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\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\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 => !checkIfNullOrUndefined(el.color)),\r\n 'color',\r\n ).map(d => `${d.color}`) as string[])\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 scale={scale}\r\n centerPoint={centerPoint}\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) || Colors[theme].categoricalColors.colors\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n radius={radius}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showLabels={showLabels}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n highlightedDataPoints={highlightedDataPoints}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n classNames={classNames}\r\n zoomInteraction={zoomInteraction}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\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 maxRadiusValue={\r\n !checkIfNullOrUndefined(maxRadiusValue)\r\n ? (maxRadiusValue as number)\r\n : Math.max(\r\n ...data.map(d => d.radius).filter(d => d !== undefined && d !== null),\r\n )\r\n }\r\n />\r\n ) : (\r\n <div\r\n style={{\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 )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\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","colors","mapData","colorLegendTitle","colorDomain","radius","height","width","scale","centerPoint","tooltip","showLabels","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedDataPoints","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","maxRadiusValue","selectedColor","setSelectedColor","useState","showLegend","setShowLegend","zoomRef","useRef","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","mapG","radiusScale","d","scaleSqrt","useEffect","mapGSelect","select","mapSvgSelect","zoomFilter","e","isWheel","isTouch","isDrag","zoomBehavior","zoom","transform","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","projection","geoMercator","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","jsxs","Fragment","jsx","motion","i","el","masterPath","geo","path","c","k","point","AnimatePresence","color","Colors","event","isEqual","X","P","Modal","string2HTML","Tooltip","DotDensityMap","graphTitle","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","isWorldMap","graphID","graphDownload","dataDownload","showAntarctica","language","minHeight","theme","ariaLabel","timeline","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","index","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","resizeObserver","entries","fetchAndParseJSON","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","checkIfNullOrUndefined","Spinner","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwEO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IAC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GAAG9B,EAAK,IAAI,CAAAmD,MAAKA,EAAE,MAAM,EAAE,OAAO,CAAAA,MAAwBA,KAAM,IAAI;AAAA,wBAAA,IAFrErB;AAAA,sBAGD;AAAA,oBAAA,IAIRsD,gBAAAA,EAAAA;AAAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,OAAO;AAAA,0BACL,QAAQ,GAAG,KAAK;AAAA,4BACdkC;AAAA,4BACAhH,MACGyG,IACGO,KACG/G,KAASmH,KAAYX,IAAiBO,KACpC/G,KAASmH,KAAYX,IACtBO,KACD/G,KAASmH,KAAYX,IACxBa;AAAA,0BAAA,CACP;AAAA,wBAAA;AAAA,wBAEH,WAAU;AAAA,wBAEV,UAAAxC,gBAAAA,EAAAA,IAACuE,IAAA,EAAQ,cAAW,gBAAA,CAAgB;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACtC;AAAA,gBAAA;AAAA,gBAGHjD,KAAWE,IACVxB,gBAAAA,EAAAA;AAAAA,kBAACwE;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUrI,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAkF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAArG;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"DotDensityMap.js","sources":["../src/Components/Graphs/Maps/DotDensityMap/Graph.tsx","../src/Components/Graphs/Maps/DotDensityMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleSqrt } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n DotDensityMapDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n data: DotDensityMapDataType[];\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n colorDomain: string[];\r\n width: number;\r\n height: number;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n colors: string[];\r\n colorLegendTitle?: string;\r\n radius: number;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n showLabels: boolean;\r\n mapBorderColor: 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 isWorldMap: boolean;\r\n showColorScale: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedDataPoints: (string | 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 zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n maxRadiusValue: number;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n colors,\r\n mapData,\r\n colorLegendTitle,\r\n colorDomain,\r\n radius,\r\n height,\r\n width,\r\n scale,\r\n centerPoint,\r\n tooltip,\r\n showLabels,\r\n mapBorderWidth,\r\n mapBorderColor,\r\n mapNoDataColor,\r\n onSeriesMouseOver,\r\n showColorScale,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n maxRadiusValue,\r\n } = props;\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const radiusScale =\r\n data.filter(d => d.radius === undefined || d.radius === null).length !== data.length\r\n ? scaleSqrt().domain([0, maxRadiusValue]).range([0.25, radius]).nice()\r\n : undefined;\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const color =\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 return (\r\n <motion.g\r\n key={d.label || `${d.lat}-${d.long}`}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\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 transform={`translate(${\r\n (projection([d.long, d.lat]) as [number, number])[0]\r\n },${(projection([d.long, d.lat]) as [number, number])[1]})`}\r\n >\r\n <motion.circle\r\n cx={0}\r\n cy={0}\r\n variants={{\r\n initial: {\r\n r: 0,\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 },\r\n whileInView: {\r\n r: !radiusScale ? radius : radiusScale(d.radius || 0),\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 transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ r: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n fillOpacity: 0.8,\r\n }}\r\n />\r\n {showLabels && d.label ? (\r\n <motion.text\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: !radiusScale ? radius : radiusScale(d.radius || 0),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: !radiusScale ? radius : radiusScale(d.radius || 0),\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 y={0}\r\n className='fill-primary-gray-600 dark:fill-primary-gray-300 text-sm'\r\n style={{ textAnchor: 'start' }}\r\n dx={4}\r\n dy={5}\r\n >\r\n {d.label}\r\n </motion.text>\r\n ) : null}\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 {data.filter(el => el.color).length === 0 || showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div className='p-2' style={{ backgroundColor: 'rgba(240,240,240, 0.7)' }}>\r\n {colorLegendTitle && colorLegendTitle !== '' ? (\r\n <p\r\n className='p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n }}\r\n >\r\n {colorLegendTitle}\r\n </p>\r\n ) : null}\r\n <div className='flex flex-col gap-3'>\r\n {colorDomain.map((d, i) => (\r\n <div\r\n key={i}\r\n className='flex gap-2 items-center'\r\n onMouseOver={() => {\r\n setSelectedColor(colors[i % colors.length]);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n >\r\n <div\r\n className='w-2 h-2 rounded-full'\r\n style={{ backgroundColor: colors[i % colors.length] }}\r\n />\r\n <P size='sm' marginBottom='none' leading='none'>\r\n {d}\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\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 {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { 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 { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { ascending, sort } from 'd3-array';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport {\r\n DotDensityMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n ZoomInteractionTypes,\r\n MapProjectionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DotDensityMapDataType[];\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 the circle */\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 /** Color for the areas where data is no available */\r\n mapNoDataColor?: 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\r\n // Graph Parameters\r\n /** Maximum radius of the circle */\r\n radius?: number;\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Maximum value mapped to the radius chart */\r\n maxRadiusValue?: number;\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 /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\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 DotDensityMap(props: Props) {\r\n const {\r\n data,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = 'The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.',\r\n colorLegendTitle,\r\n colorDomain,\r\n radius = 5,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n showLabels = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n showColorScale = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\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 mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n maxRadiusValue,\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\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\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(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 || 760);\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 || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n setMapShape(d);\r\n });\r\n } else {\r\n setMapShape(mapData);\r\n }\r\n }, [mapData]);\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 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 dot density map showing the distribution of a variable across a region or world, with each dot representing a data point.${\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\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain || (uniqBy(data, 'color', true) as string[])\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 scale={scale}\r\n centerPoint={centerPoint}\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) || Colors[theme].categoricalColors.colors\r\n }\r\n colorLegendTitle={colorLegendTitle}\r\n radius={radius}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showLabels={showLabels}\r\n isWorldMap={isWorldMap}\r\n showColorScale={showColorScale}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n highlightedDataPoints={highlightedDataPoints}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n classNames={classNames}\r\n zoomInteraction={zoomInteraction}\r\n detailsOnClick={detailsOnClick}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\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 maxRadiusValue={\r\n !checkIfNullOrUndefined(maxRadiusValue)\r\n ? (maxRadiusValue as number)\r\n : Math.max(\r\n ...data.map(d => d.radius).filter(d => d !== undefined && d !== null),\r\n )\r\n }\r\n />\r\n ) : (\r\n <div\r\n style={{\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 )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\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","colors","mapData","colorLegendTitle","colorDomain","radius","height","width","scale","centerPoint","tooltip","showLabels","mapBorderWidth","mapBorderColor","mapNoDataColor","onSeriesMouseOver","showColorScale","zoomScaleExtend","zoomTranslateExtend","highlightedDataPoints","onSeriesMouseClick","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","maxRadiusValue","selectedColor","setSelectedColor","useState","showLegend","setShowLegend","zoomRef","useRef","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","isInView","useInView","mapG","radiusScale","d","scaleSqrt","useEffect","mapGSelect","select","mapSvgSelect","zoomFilter","e","isWheel","isTouch","isDrag","zoomBehavior","zoom","transform","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","projection","geoMercator","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","handleZoom","direction","jsxs","Fragment","jsx","motion","i","el","masterPath","geo","path","c","k","point","AnimatePresence","color","Colors","event","isEqual","X","P","Modal","string2HTML","Tooltip","DotDensityMap","graphTitle","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","isWorldMap","graphID","graphDownload","dataDownload","showAntarctica","language","minHeight","theme","ariaLabel","timeline","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","index","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","resizeObserver","entries","fetchAndParseJSON","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","checkIfNullOrUndefined","Spinner","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwEO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,IACE/B,IACE,CAACgC,GAAeC,EAAgB,IAAIC,EAA6B,MAAS,GAC1E,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAE1B,IAAQ,IAAI,GACrD6B,I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,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("react"),F=require("./parse-hMnG_lRV.cjs"),Ne=require("./index-DYH8g9WA.cjs"),ae=require("./numberFormattingFunction-02t-wJta.cjs"),Ie=require("./Tooltip-De16GWhY.cjs"),f=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ye=require("./Axis-DE7dSn1_.cjs"),we=require("./AxisTitle-CK9YeovX.cjs"),Le=require("./index-BYzIB5V6.cjs"),qe=require("./time-Byw_jYQ7.cjs"),Ee=require("./linear-BVckp9RD.cjs"),ge=require("./line-DHV4JwCR.cjs"),oe=require("./step-BZ3C8QFW.cjs"),De=require("./select-Bnfk0lJx.cjs"),Se=require("./init-DU0ybBc_.cjs"),Me=require("./pointer-Dkq5NV1q.cjs"),Te=require("./use-in-view-sQJZ_xDO.cjs"),b=require("./proxy-BHRoeZgd.cjs"),Ve=require("./GraphFooter.cjs"),$e=require("./GraphHeader.cjs"),Fe=require("./ColorLegend.cjs"),Re=require("./Colors.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs");function Pe(le){const{data:k,width:R,height:D,lineColors:n,labels:y,sameAxes:o,dateFormat:j,showValues:G,noOfXTicks:xe,rightMargin:ce,leftMargin:W,topMargin:X,bottomMargin:ue,tooltip:v,highlightAreaSettings:me,onSeriesMouseOver:C,animate:s,strokeWidth:Y,showDots:P,noOfYTicks:B,lineSuffixes:S,linePrefixes:M,minDate:z,maxDate:N,curveType:T,styles:l,classNames:r,precision:A,customLayers:H,showAxisLabels:J}=le,K=h.useRef(null),d=Te.useInView(K,{once:s.once,amount:s.amount}),[p,V]=h.useState(!1);h.useEffect(()=>{if(d&&!p){const e=setTimeout(()=>{V(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[d,p,s.duration]);const Q=T==="linear"?ge.curveLinear:T==="step"?oe.curveStep:T==="stepAfter"?oe.stepAfter:T==="stepBefore"?oe.stepBefore:oe.monotoneX,[I,Z]=h.useState(void 0),[_,ee]=h.useState(void 0),[te,ie]=h.useState(void 0),m={top:X,bottom:ue,left:W+50,right:ce+65},w=h.useRef(null),i=Ne.sortBy(k.map(e=>({...e,date:F.parse(`${e.date}`,j,new Date)})),"date"),de=me.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:F.parse(`${e.coordinates[0]}`,j,new Date),e.coordinates[1]===null?null:F.parse(`${e.coordinates[1]}`,j,new Date)]})),u=R-m.left-m.right,a=D-m.top-m.bottom,se=z?F.parse(`${z}`,j,new Date):i[0].date,ne=N?F.parse(`${N}`,j,new Date):i[i.length-1].date,$=Math.min(...i.map(e=>e.y1).filter(e=>e!=null))!==1/0?Math.min(...i.map(e=>e.y2).filter(e=>e!=null))>0?0:Math.min(...i.map(e=>e.y1).filter(e=>e!=null)):0,E=Math.min(...i.map(e=>e.y2).filter(e=>e!=null))!==1/0?Math.min(...i.map(e=>e.y2).filter(e=>e!=null))>0?0:Math.min(...i.map(e=>e.y2).filter(e=>e!=null)):0,O=Math.max(...i.map(e=>e.y1).filter(e=>e!=null))!==1/0?Math.max(...i.map(e=>e.y1).filter(e=>e!=null)):0,x=Math.max(...i.map(e=>e.y2).filter(e=>e!=null))!==1/0?Math.max(...i.map(e=>e.y2).filter(e=>e!=null)):0,U=$<E?$:E,re=O>x?O:x,c=qe.time().domain([se,ne]).range([0,u]),L=Ee.linear().domain([o?U:$,o?re>0?re:0:O>0?O:0]).range([a,0]).nice(),g=Ee.linear().domain([o?U:E,o?re>0?re:0:x>0?x:0]).range([a,0]).nice(),fe=ge.line().defined(e=>!f.checkIfNullOrUndefined(e.y1)).x(e=>c(e.date)).y(e=>L(e.y1)).curve(Q),he=ge.line().defined(e=>!f.checkIfNullOrUndefined(e.y2)).x(e=>c(e.date)).y(e=>g(e.y2)).curve(Q),Ae=L.ticks(B),be=g.ticks(B),je=c.ticks(xe);return h.useEffect(()=>{const e=pe=>{const ve=i[Se.bisectCenter(i.map(ke=>ke.date),c.invert(Me.pointer(pe)[0]),0)];Z(ve||i[i.length-1]),C?.(ve||i[i.length-1]),ie(pe.clientY),ee(pe.clientX)},q=()=>{Z(void 0),ee(void 0),ie(void 0),C?.(void 0)};De.select(w.current).on("mousemove",e).on("mouseout",q)},[c,i,C]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(b.motion.svg,{width:`${R}px`,height:`${D}px`,viewBox:`0 0 ${R} ${D}`,direction:"ltr",ref:K,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${m.left},${m.top})`,children:[t.jsxRuntimeExports.jsx(Le.HighlightArea,{areaSettings:de,width:u,height:a,scale:c,animate:s,isInView:d}),t.jsxRuntimeExports.jsxs("g",{children:[Ae.map((e,q)=>t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx("line",{y1:L(e),y2:L(e),x1:-15,x2:-20,style:{stroke:n[0],strokeWidth:1,...l?.yAxis?.gridLines||{}},className:r?.yAxis?.gridLines}),t.jsxRuntimeExports.jsx("text",{x:-25,y:L(e),dy:"0.33em",className:t.mo("text-xs",r?.yAxis?.labels),style:{textAnchor:"end",fill:n[0],...l?.yAxis?.labels||{}},children:ae.numberFormattingFunction(e,"NA",A,M[0],S[0])})]},q)),t.jsxRuntimeExports.jsx(ye.Axis,{y1:0,y2:a,x1:-15,x2:-15,classNames:{axis:r?.xAxis?.axis},styles:{axis:{stroke:n[0],...l?.xAxis?.axis||{}}}}),J?t.jsxRuntimeExports.jsx(we.AxisTitle,{x:10-m.left,y:a/2,style:{fill:n[0],...l?.yAxis?.title||{}},className:r?.yAxis?.title,text:y[0].length>100?`${y[0].substring(0,100)}...`:y[0],rotate90:!0}):null]}),t.jsxRuntimeExports.jsxs("g",{children:[be.map((e,q)=>t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx("line",{y1:g(e),y2:g(e),x1:u+15,x2:u+20,style:{stroke:n[1],strokeWidth:1,...l?.yAxis?.gridLines||{}},className:r?.yAxis?.gridLines}),t.jsxRuntimeExports.jsx("text",{x:u+25,y:g(e),dy:"0.33em",dx:-2,style:{textAnchor:"start",fill:n[1],...l?.yAxis?.labels||{}},className:t.mo("text-xs",r?.yAxis?.labels),children:ae.numberFormattingFunction(e,"NA",A,M[1],S[1])})]},q)),t.jsxRuntimeExports.jsx(ye.Axis,{y1:0,y2:a,x1:u+15,x2:u+15,classNames:{axis:r?.xAxis?.axis},styles:{axis:{stroke:n[1],...l?.xAxis?.axis||{}}}}),J?t.jsxRuntimeExports.jsx(we.AxisTitle,{x:u+m.right-15,y:a/2,style:{fill:n[1],...l?.yAxis?.title||{}},className:r?.yAxis?.title,text:y[1].length>100?`${y[1].substring(0,100)}...`:y[1],rotate90:!0}):null]}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(ye.Axis,{y1:a,y2:a,x1:-15,x2:u+15,classNames:{axis:r?.xAxis?.axis},styles:{axis:l?.xAxis?.axis}}),t.jsxRuntimeExports.jsx(Oe.XTicksAndGridLines,{values:je.map(e=>F.format(e,j)),x:je.map(e=>c(e)),y1:0,y2:a,styles:{gridLines:l?.xAxis?.gridLines,labels:l?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",r?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",r?.xAxis?.labels)},labelType:"primary",showGridLines:!0,precision:A})]}),H.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(b.motion.path,{style:{stroke:n[0],strokeWidth:Y,fill:"none"},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{pathLength:0,d:fe(i.filter(e=>!f.checkIfNullOrUndefined(e.y1)))||"",opacity:1},whileInView:{pathLength:1,d:fe(i.filter(e=>!f.checkIfNullOrUndefined(e.y1)))||"",opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:d?"whileInView":"initial"}),t.jsxRuntimeExports.jsx(b.motion.path,{d:he(i.filter(e=>!f.checkIfNullOrUndefined(e.y2)))||"",style:{stroke:n[1],strokeWidth:Y,fill:"none"},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{pathLength:0,d:he(i.filter(e=>!f.checkIfNullOrUndefined(e.y2)))||"",opacity:1},whileInView:{pathLength:1,d:he(i.filter(e=>!f.checkIfNullOrUndefined(e.y2)))||"",opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:d?"whileInView":"initial"}),I?t.jsxRuntimeExports.jsx("line",{y1:0,y2:a,x1:c(I.date),x2:c(I.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",r?.mouseOverLine),style:l?.mouseOverLine}):null]}),t.jsxRuntimeExports.jsx("g",{children:i.map((e,q)=>t.jsxRuntimeExports.jsxs(b.motion.g,{children:[f.checkIfNullOrUndefined(e.y1)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[P?t.jsxRuntimeExports.jsx(b.motion.circle,{r:u/i.length<5?0:u/i.length<20?2:4,style:{fill:n[0]},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:c(e.date),cy:L(e.y1)},whileInView:{opacity:1,transition:{duration:p?s.duration:.5,delay:p?0:s.duration},cx:c(e.date),cy:L(e.y1)}},initial:"initial",animate:d?"whileInView":"initial"}):null,G?t.jsxRuntimeExports.jsx(b.motion.text,{dy:f.checkIfNullOrUndefined(e.y2)||e.y2<e.y1?-8:"1em",style:{fill:n[0],textAnchor:"middle",...l?.graphObjectValues||{}},className:t.mo("graph-value graph-value-line-1 text-xs font-bold",r?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:c(e.date),y:g(e.y1)},whileInView:{opacity:1,x:c(e.date),y:g(e.y1),transition:{duration:p?s.duration:.5,delay:p?0:s.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:ae.numberFormattingFunction(e.y1,"NA",A,M[0],S[0])}):null]}),f.checkIfNullOrUndefined(e.y2)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[P?t.jsxRuntimeExports.jsx(b.motion.circle,{r:u/i.length<5?0:u/i.length<20?2:4,style:{fill:n[1]},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:c(e.date),cy:g(e.y2)},whileInView:{opacity:1,transition:{duration:p?s.duration:.5,delay:p?0:s.duration},cx:c(e.date),cy:g(e.y2)}},initial:"initial",animate:d?"whileInView":"initial"}):null,G?t.jsxRuntimeExports.jsx(b.motion.text,{dy:f.checkIfNullOrUndefined(e.y1)||e.y1<e.y2?-8:"1em",style:{fill:n[1],textAnchor:"middle",...l?.graphObjectValues||{}},className:t.mo("graph-value graph-value-line-2 text-xs font-bold",r?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:c(e.date),y:g(e.y2)},whileInView:{opacity:1,x:c(e.date),y:g(e.y2),transition:{duration:p?s.duration:.5,delay:p?0:s.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:ae.numberFormattingFunction(e.y2,"NA",A,M[1],S[1])}):null]})]},q))}),H.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:w,style:{fill:"none",pointerEvents:"all"},width:u,height:a})]})}),I&&v&&_&&te?t.jsxRuntimeExports.jsx(Ie.Tooltip,{data:I,body:v,xPos:_,yPos:te,backgroundStyle:l?.tooltip,className:r?.tooltip}):null]})}function He(le){const{data:k,graphTitle:R,sources:D,graphDescription:n,height:y,width:o,footNote:j,noOfXTicks:G=10,dateFormat:xe="yyyy",showValues:ce=!1,padding:W,lineColors:X=[Re.Colors.light.categoricalColors.colors[0],Re.Colors.light.categoricalColors.colors[1]],sameAxes:ue=!1,backgroundColor:v=!1,leftMargin:me=80,rightMargin:C=80,topMargin:s=20,bottomMargin:Y=25,labels:P,lineSuffixes:B=["",""],linePrefixes:S=["",""],tooltip:M,highlightAreaSettings:z=[],relativeHeight:N,onSeriesMouseOver:T,graphID:l,graphDownload:r=!1,dataDownload:A=!1,animate:H=!1,strokeWidth:J=2,showDots:K=!0,language:d="en",showColorScale:p=!0,minHeight:V=0,colorLegendTitle:Q,theme:I="light",ariaLabel:Z,noOfYTicks:_=5,maxDate:ee,minDate:te,curveType:ie="curve",styles:m,classNames:w,precision:i=2,customLayers:de=[],showAxisLabels:u=!0}=le,[a,se]=h.useState(0),[ne,$]=h.useState(0),E=h.useRef(null),O=h.useRef(null);return h.useEffect(()=>{const x=new ResizeObserver(U=>{se(o||U[0].target.clientWidth||620),$(y||U[0].target.clientHeight||480)});return E.current&&($(E.current.clientHeight||480),se(E.current.clientWidth||620),o||x.observe(E.current)),()=>x.disconnect()},[o,y]),t.jsxRuntimeExports.jsx("div",{className:`${I||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:d==="he"||d==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${d||"en"}`,o?"w-fit":"w-full",w?.graphContainer),style:{...m?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:l,ref:O,"aria-label":Z||`${R?`The graph shows ${R}. `:""}This is a line chart that show trends for two datasets over time.${n?` ${n}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:v?W||"1rem":W||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||n||r||A?t.jsxRuntimeExports.jsx($e.GraphHeader,{styles:{title:m?.title,description:m?.description},classNames:{title:w?.title,description:w?.description},graphTitle:R,graphDescription:n,width:o,graphDownload:r?O.current:void 0,dataDownload:A?k.map(x=>x.data).filter(x=>x!==void 0).length>0?k.map(x=>x.data).filter(x=>x!==void 0):k.filter(x=>x!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:k.length===0?t.jsxRuntimeExports.jsx(Ce.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[p?t.jsxRuntimeExports.jsx(Fe.ColorLegend,{colorDomain:P,colorLegendTitle:Q,colors:X,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:E,"aria-label":"Graph area",children:(o||a)&&(y||ne)?t.jsxRuntimeExports.jsx(Pe,{data:k,sameAxes:ue,lineColors:X,width:o||a,height:Math.max(V,y||(N?V?(o||a)*N>V?(o||a)*N:V:(o||a)*N:ne)),dateFormat:xe,showValues:ce,noOfXTicks:G,leftMargin:me,rightMargin:C,topMargin:s,bottomMargin:Y,labels:P,highlightAreaSettings:z,tooltip:M,onSeriesMouseOver:T,animate:H===!0?{duration:.5,once:!0,amount:.5}:H||{duration:0,once:!0,amount:0},strokeWidth:J,showDots:K,noOfYTicks:_,lineSuffixes:B,linePrefixes:S,minDate:te,maxDate:ee,curveType:ie,styles:m,classNames:w,precision:i,customLayers:de,showAxisLabels:u}):null})]})}),D||j?t.jsxRuntimeExports.jsx(Ve.GraphFooter,{styles:{footnote:m?.footnote,source:m?.source},classNames:{footnote:w?.footnote,source:w?.source},sources:D,footNote:j,width:o}):null]})})})})}exports.DualAxisLineChart=He;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("react"),F=require("./parse-hMnG_lRV.cjs"),Ne=require("./index-CQ3e6Ewi.cjs"),ae=require("./numberFormattingFunction-02t-wJta.cjs"),Ie=require("./Tooltip-De16GWhY.cjs"),f=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Oe=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ye=require("./Axis-DE7dSn1_.cjs"),we=require("./AxisTitle-CK9YeovX.cjs"),Le=require("./index-BYzIB5V6.cjs"),qe=require("./time-Byw_jYQ7.cjs"),Ee=require("./linear-BVckp9RD.cjs"),ge=require("./line-DHV4JwCR.cjs"),oe=require("./step-BZ3C8QFW.cjs"),De=require("./select-Bnfk0lJx.cjs"),Se=require("./init-DU0ybBc_.cjs"),Me=require("./pointer-Dkq5NV1q.cjs"),Te=require("./use-in-view-sQJZ_xDO.cjs"),b=require("./proxy-BHRoeZgd.cjs"),Ve=require("./GraphFooter.cjs"),$e=require("./GraphHeader.cjs"),Fe=require("./ColorLegend.cjs"),Re=require("./Colors.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs");function Pe(le){const{data:k,width:R,height:D,lineColors:n,labels:y,sameAxes:o,dateFormat:j,showValues:G,noOfXTicks:xe,rightMargin:ce,leftMargin:W,topMargin:X,bottomMargin:ue,tooltip:v,highlightAreaSettings:me,onSeriesMouseOver:C,animate:s,strokeWidth:Y,showDots:P,noOfYTicks:B,lineSuffixes:S,linePrefixes:M,minDate:z,maxDate:N,curveType:T,styles:l,classNames:r,precision:A,customLayers:H,showAxisLabels:J}=le,K=h.useRef(null),d=Te.useInView(K,{once:s.once,amount:s.amount}),[p,V]=h.useState(!1);h.useEffect(()=>{if(d&&!p){const e=setTimeout(()=>{V(!0)},(s.duration+.5)*1e3);return()=>clearTimeout(e)}},[d,p,s.duration]);const Q=T==="linear"?ge.curveLinear:T==="step"?oe.curveStep:T==="stepAfter"?oe.stepAfter:T==="stepBefore"?oe.stepBefore:oe.monotoneX,[I,Z]=h.useState(void 0),[_,ee]=h.useState(void 0),[te,ie]=h.useState(void 0),m={top:X,bottom:ue,left:W+50,right:ce+65},w=h.useRef(null),i=Ne.orderBy(k.map(e=>({...e,date:F.parse(`${e.date}`,j,new Date)})),["date"],["asc"]),de=me.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:F.parse(`${e.coordinates[0]}`,j,new Date),e.coordinates[1]===null?null:F.parse(`${e.coordinates[1]}`,j,new Date)]})),u=R-m.left-m.right,a=D-m.top-m.bottom,se=z?F.parse(`${z}`,j,new Date):i[0].date,ne=N?F.parse(`${N}`,j,new Date):i[i.length-1].date,$=Math.min(...i.map(e=>e.y1).filter(e=>e!=null))!==1/0?Math.min(...i.map(e=>e.y2).filter(e=>e!=null))>0?0:Math.min(...i.map(e=>e.y1).filter(e=>e!=null)):0,E=Math.min(...i.map(e=>e.y2).filter(e=>e!=null))!==1/0?Math.min(...i.map(e=>e.y2).filter(e=>e!=null))>0?0:Math.min(...i.map(e=>e.y2).filter(e=>e!=null)):0,O=Math.max(...i.map(e=>e.y1).filter(e=>e!=null))!==1/0?Math.max(...i.map(e=>e.y1).filter(e=>e!=null)):0,x=Math.max(...i.map(e=>e.y2).filter(e=>e!=null))!==1/0?Math.max(...i.map(e=>e.y2).filter(e=>e!=null)):0,U=$<E?$:E,re=O>x?O:x,c=qe.time().domain([se,ne]).range([0,u]),L=Ee.linear().domain([o?U:$,o?re>0?re:0:O>0?O:0]).range([a,0]).nice(),g=Ee.linear().domain([o?U:E,o?re>0?re:0:x>0?x:0]).range([a,0]).nice(),fe=ge.line().defined(e=>!f.checkIfNullOrUndefined(e.y1)).x(e=>c(e.date)).y(e=>L(e.y1)).curve(Q),he=ge.line().defined(e=>!f.checkIfNullOrUndefined(e.y2)).x(e=>c(e.date)).y(e=>g(e.y2)).curve(Q),Ae=L.ticks(B),be=g.ticks(B),je=c.ticks(xe);return h.useEffect(()=>{const e=pe=>{const ve=i[Se.bisectCenter(i.map(ke=>ke.date),c.invert(Me.pointer(pe)[0]),0)];Z(ve||i[i.length-1]),C?.(ve||i[i.length-1]),ie(pe.clientY),ee(pe.clientX)},q=()=>{Z(void 0),ee(void 0),ie(void 0),C?.(void 0)};De.select(w.current).on("mousemove",e).on("mouseout",q)},[c,i,C]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(b.motion.svg,{width:`${R}px`,height:`${D}px`,viewBox:`0 0 ${R} ${D}`,direction:"ltr",ref:K,children:t.jsxRuntimeExports.jsxs("g",{transform:`translate(${m.left},${m.top})`,children:[t.jsxRuntimeExports.jsx(Le.HighlightArea,{areaSettings:de,width:u,height:a,scale:c,animate:s,isInView:d}),t.jsxRuntimeExports.jsxs("g",{children:[Ae.map((e,q)=>t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx("line",{y1:L(e),y2:L(e),x1:-15,x2:-20,style:{stroke:n[0],strokeWidth:1,...l?.yAxis?.gridLines||{}},className:r?.yAxis?.gridLines}),t.jsxRuntimeExports.jsx("text",{x:-25,y:L(e),dy:"0.33em",className:t.mo("text-xs",r?.yAxis?.labels),style:{textAnchor:"end",fill:n[0],...l?.yAxis?.labels||{}},children:ae.numberFormattingFunction(e,"NA",A,M[0],S[0])})]},q)),t.jsxRuntimeExports.jsx(ye.Axis,{y1:0,y2:a,x1:-15,x2:-15,classNames:{axis:r?.xAxis?.axis},styles:{axis:{stroke:n[0],...l?.xAxis?.axis||{}}}}),J?t.jsxRuntimeExports.jsx(we.AxisTitle,{x:10-m.left,y:a/2,style:{fill:n[0],...l?.yAxis?.title||{}},className:r?.yAxis?.title,text:y[0].length>100?`${y[0].substring(0,100)}...`:y[0],rotate90:!0}):null]}),t.jsxRuntimeExports.jsxs("g",{children:[be.map((e,q)=>t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx("line",{y1:g(e),y2:g(e),x1:u+15,x2:u+20,style:{stroke:n[1],strokeWidth:1,...l?.yAxis?.gridLines||{}},className:r?.yAxis?.gridLines}),t.jsxRuntimeExports.jsx("text",{x:u+25,y:g(e),dy:"0.33em",dx:-2,style:{textAnchor:"start",fill:n[1],...l?.yAxis?.labels||{}},className:t.mo("text-xs",r?.yAxis?.labels),children:ae.numberFormattingFunction(e,"NA",A,M[1],S[1])})]},q)),t.jsxRuntimeExports.jsx(ye.Axis,{y1:0,y2:a,x1:u+15,x2:u+15,classNames:{axis:r?.xAxis?.axis},styles:{axis:{stroke:n[1],...l?.xAxis?.axis||{}}}}),J?t.jsxRuntimeExports.jsx(we.AxisTitle,{x:u+m.right-15,y:a/2,style:{fill:n[1],...l?.yAxis?.title||{}},className:r?.yAxis?.title,text:y[1].length>100?`${y[1].substring(0,100)}...`:y[1],rotate90:!0}):null]}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(ye.Axis,{y1:a,y2:a,x1:-15,x2:u+15,classNames:{axis:r?.xAxis?.axis},styles:{axis:l?.xAxis?.axis}}),t.jsxRuntimeExports.jsx(Oe.XTicksAndGridLines,{values:je.map(e=>F.format(e,j)),x:je.map(e=>c(e)),y1:0,y2:a,styles:{gridLines:l?.xAxis?.gridLines,labels:l?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",r?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs",r?.xAxis?.labels)},labelType:"primary",showGridLines:!0,precision:A})]}),H.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(b.motion.path,{style:{stroke:n[0],strokeWidth:Y,fill:"none"},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{pathLength:0,d:fe(i.filter(e=>!f.checkIfNullOrUndefined(e.y1)))||"",opacity:1},whileInView:{pathLength:1,d:fe(i.filter(e=>!f.checkIfNullOrUndefined(e.y1)))||"",opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:d?"whileInView":"initial"}),t.jsxRuntimeExports.jsx(b.motion.path,{d:he(i.filter(e=>!f.checkIfNullOrUndefined(e.y2)))||"",style:{stroke:n[1],strokeWidth:Y,fill:"none"},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{pathLength:0,d:he(i.filter(e=>!f.checkIfNullOrUndefined(e.y2)))||"",opacity:1},whileInView:{pathLength:1,d:he(i.filter(e=>!f.checkIfNullOrUndefined(e.y2)))||"",opacity:1,transition:{duration:s.duration}}},initial:"initial",animate:d?"whileInView":"initial"}),I?t.jsxRuntimeExports.jsx("line",{y1:0,y2:a,x1:c(I.date),x2:c(I.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",r?.mouseOverLine),style:l?.mouseOverLine}):null]}),t.jsxRuntimeExports.jsx("g",{children:i.map((e,q)=>t.jsxRuntimeExports.jsxs(b.motion.g,{children:[f.checkIfNullOrUndefined(e.y1)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[P?t.jsxRuntimeExports.jsx(b.motion.circle,{r:u/i.length<5?0:u/i.length<20?2:4,style:{fill:n[0]},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:c(e.date),cy:L(e.y1)},whileInView:{opacity:1,transition:{duration:p?s.duration:.5,delay:p?0:s.duration},cx:c(e.date),cy:L(e.y1)}},initial:"initial",animate:d?"whileInView":"initial"}):null,G?t.jsxRuntimeExports.jsx(b.motion.text,{dy:f.checkIfNullOrUndefined(e.y2)||e.y2<e.y1?-8:"1em",style:{fill:n[0],textAnchor:"middle",...l?.graphObjectValues||{}},className:t.mo("graph-value graph-value-line-1 text-xs font-bold",r?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:c(e.date),y:g(e.y1)},whileInView:{opacity:1,x:c(e.date),y:g(e.y1),transition:{duration:p?s.duration:.5,delay:p?0:s.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:ae.numberFormattingFunction(e.y1,"NA",A,M[0],S[0])}):null]}),f.checkIfNullOrUndefined(e.y2)?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[P?t.jsxRuntimeExports.jsx(b.motion.circle,{r:u/i.length<5?0:u/i.length<20?2:4,style:{fill:n[1]},exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,cx:c(e.date),cy:g(e.y2)},whileInView:{opacity:1,transition:{duration:p?s.duration:.5,delay:p?0:s.duration},cx:c(e.date),cy:g(e.y2)}},initial:"initial",animate:d?"whileInView":"initial"}):null,G?t.jsxRuntimeExports.jsx(b.motion.text,{dy:f.checkIfNullOrUndefined(e.y1)||e.y1<e.y2?-8:"1em",style:{fill:n[1],textAnchor:"middle",...l?.graphObjectValues||{}},className:t.mo("graph-value graph-value-line-2 text-xs font-bold",r?.graphObjectValues),exit:{opacity:0,transition:{duration:s.duration}},variants:{initial:{opacity:0,x:c(e.date),y:g(e.y2)},whileInView:{opacity:1,x:c(e.date),y:g(e.y2),transition:{duration:p?s.duration:.5,delay:p?0:s.duration}}},initial:"initial",animate:d?"whileInView":"initial",children:ae.numberFormattingFunction(e.y2,"NA",A,M[1],S[1])}):null]})]},q))}),H.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:w,style:{fill:"none",pointerEvents:"all"},width:u,height:a})]})}),I&&v&&_&&te?t.jsxRuntimeExports.jsx(Ie.Tooltip,{data:I,body:v,xPos:_,yPos:te,backgroundStyle:l?.tooltip,className:r?.tooltip}):null]})}function He(le){const{data:k,graphTitle:R,sources:D,graphDescription:n,height:y,width:o,footNote:j,noOfXTicks:G=10,dateFormat:xe="yyyy",showValues:ce=!1,padding:W,lineColors:X=[Re.Colors.light.categoricalColors.colors[0],Re.Colors.light.categoricalColors.colors[1]],sameAxes:ue=!1,backgroundColor:v=!1,leftMargin:me=80,rightMargin:C=80,topMargin:s=20,bottomMargin:Y=25,labels:P,lineSuffixes:B=["",""],linePrefixes:S=["",""],tooltip:M,highlightAreaSettings:z=[],relativeHeight:N,onSeriesMouseOver:T,graphID:l,graphDownload:r=!1,dataDownload:A=!1,animate:H=!1,strokeWidth:J=2,showDots:K=!0,language:d="en",showColorScale:p=!0,minHeight:V=0,colorLegendTitle:Q,theme:I="light",ariaLabel:Z,noOfYTicks:_=5,maxDate:ee,minDate:te,curveType:ie="curve",styles:m,classNames:w,precision:i=2,customLayers:de=[],showAxisLabels:u=!0}=le,[a,se]=h.useState(0),[ne,$]=h.useState(0),E=h.useRef(null),O=h.useRef(null);return h.useEffect(()=>{const x=new ResizeObserver(U=>{se(o||U[0].target.clientWidth||620),$(y||U[0].target.clientHeight||480)});return E.current&&($(E.current.clientHeight||480),se(E.current.clientWidth||620),o||x.observe(E.current)),()=>x.disconnect()},[o,y]),t.jsxRuntimeExports.jsx("div",{className:`${I||"light"} flex ${o?"w-fit grow-0":"w-full grow"}`,dir:d==="he"||d==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${v?v===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${d||"en"}`,o?"w-fit":"w-full",w?.graphContainer),style:{...m?.graphContainer||{},...v&&v!==!0?{backgroundColor:v}:{}},id:l,ref:O,"aria-label":Z||`${R?`The graph shows ${R}. `:""}This is a line chart that show trends for two datasets over time.${n?` ${n}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:v?W||"1rem":W||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||n||r||A?t.jsxRuntimeExports.jsx($e.GraphHeader,{styles:{title:m?.title,description:m?.description},classNames:{title:w?.title,description:w?.description},graphTitle:R,graphDescription:n,width:o,graphDownload:r?O.current:void 0,dataDownload:A?k.map(x=>x.data).filter(x=>x!==void 0).length>0?k.map(x=>x.data).filter(x=>x!==void 0):k.filter(x=>x!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:k.length===0?t.jsxRuntimeExports.jsx(Ce.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[p?t.jsxRuntimeExports.jsx(Fe.ColorLegend,{colorDomain:P,colorLegendTitle:Q,colors:X,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:E,"aria-label":"Graph area",children:(o||a)&&(y||ne)?t.jsxRuntimeExports.jsx(Pe,{data:k,sameAxes:ue,lineColors:X,width:o||a,height:Math.max(V,y||(N?V?(o||a)*N>V?(o||a)*N:V:(o||a)*N:ne)),dateFormat:xe,showValues:ce,noOfXTicks:G,leftMargin:me,rightMargin:C,topMargin:s,bottomMargin:Y,labels:P,highlightAreaSettings:z,tooltip:M,onSeriesMouseOver:T,animate:H===!0?{duration:.5,once:!0,amount:.5}:H||{duration:0,once:!0,amount:0},strokeWidth:J,showDots:K,noOfYTicks:_,lineSuffixes:B,linePrefixes:S,minDate:te,maxDate:ee,curveType:ie,styles:m,classNames:w,precision:i,customLayers:de,showAxisLabels:u}):null})]})}),D||j?t.jsxRuntimeExports.jsx(Ve.GraphFooter,{styles:{footnote:m?.footnote,source:m?.source},classNames:{footnote:w?.footnote,source:w?.source},sources:D,footNote:j,width:o}):null]})})})})}exports.DualAxisLineChart=He;
|
|
2
2
|
//# sourceMappingURL=DualAxisLineChart.cjs.map
|