@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.
Files changed (230) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +3 -2
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/BarGraph.cjs +1 -1
  6. package/dist/BarGraph.cjs.map +1 -1
  7. package/dist/BarGraph.js +1221 -1247
  8. package/dist/BarGraph.js.map +1 -1
  9. package/dist/BeeSwarmChart.cjs +1 -1
  10. package/dist/BeeSwarmChart.cjs.map +1 -1
  11. package/dist/BeeSwarmChart.js +130 -142
  12. package/dist/BeeSwarmChart.js.map +1 -1
  13. package/dist/BiVariateChoroplethMap.cjs +1 -1
  14. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  15. package/dist/BiVariateChoroplethMap.js +41 -41
  16. package/dist/BiVariateChoroplethMap.js.map +1 -1
  17. package/dist/BulletChart.cjs +1 -1
  18. package/dist/BulletChart.cjs.map +1 -1
  19. package/dist/BulletChart.js +483 -487
  20. package/dist/BulletChart.js.map +1 -1
  21. package/dist/ButterflyChart.cjs +1 -1
  22. package/dist/ButterflyChart.cjs.map +1 -1
  23. package/dist/ButterflyChart.js +99 -99
  24. package/dist/ButterflyChart.js.map +1 -1
  25. package/dist/ChoroplethMap.cjs +1 -1
  26. package/dist/ChoroplethMap.cjs.map +1 -1
  27. package/dist/ChoroplethMap.js +125 -125
  28. package/dist/ChoroplethMap.js.map +1 -1
  29. package/dist/CirclePackingGraph.cjs +1 -1
  30. package/dist/CirclePackingGraph.js +2 -2
  31. package/dist/Data/BureauPerformance.csv +8 -0
  32. package/dist/Data/EGDashboardData.csv +6 -0
  33. package/dist/DataCards.cjs +2 -2
  34. package/dist/DataCards.cjs.map +1 -1
  35. package/dist/DataCards.js +6 -6
  36. package/dist/DataCards.js.map +1 -1
  37. package/dist/DataTable.cjs +1 -1
  38. package/dist/DataTable.cjs.map +1 -1
  39. package/dist/DataTable.js +66 -68
  40. package/dist/DataTable.js.map +1 -1
  41. package/dist/DifferenceLineChart.cjs +1 -1
  42. package/dist/DifferenceLineChart.cjs.map +1 -1
  43. package/dist/DifferenceLineChart.js +3 -2
  44. package/dist/DifferenceLineChart.js.map +1 -1
  45. package/dist/DonutChart.cjs +1 -1
  46. package/dist/DonutChart.cjs.map +1 -1
  47. package/dist/DonutChart.js +205 -205
  48. package/dist/DonutChart.js.map +1 -1
  49. package/dist/DotDensityMap.cjs +1 -1
  50. package/dist/DotDensityMap.cjs.map +1 -1
  51. package/dist/DotDensityMap.js +78 -81
  52. package/dist/DotDensityMap.js.map +1 -1
  53. package/dist/DualAxisLineChart.cjs +1 -1
  54. package/dist/DualAxisLineChart.cjs.map +1 -1
  55. package/dist/DualAxisLineChart.js +3 -2
  56. package/dist/DualAxisLineChart.js.map +1 -1
  57. package/dist/DumbbellChart.cjs +1 -1
  58. package/dist/DumbbellChart.cjs.map +1 -1
  59. package/dist/DumbbellChart.js +64 -65
  60. package/dist/DumbbellChart.js.map +1 -1
  61. package/dist/GeoHubMap.cjs +1 -1
  62. package/dist/GeoHubMap.js +1 -1
  63. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  64. package/dist/GeoHubMapWithLayerSelection.js +1 -1
  65. package/dist/{GraphEl-4RUlclvW.cjs → GraphEl-BcYgMnN2.cjs} +2 -2
  66. package/dist/{GraphEl-4RUlclvW.cjs.map → GraphEl-BcYgMnN2.cjs.map} +1 -1
  67. package/dist/{GraphEl-ClIxlWa3.js → GraphEl-CMWeARJ3.js} +2 -2
  68. package/dist/{GraphEl-ClIxlWa3.js.map → GraphEl-CMWeARJ3.js.map} +1 -1
  69. package/dist/GriddedGraphs.cjs +1 -1
  70. package/dist/GriddedGraphs.js +4 -4
  71. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  72. package/dist/GriddedGraphsFromConfig.js +1 -1
  73. package/dist/HeatMap.cjs +1 -1
  74. package/dist/HeatMap.cjs.map +1 -1
  75. package/dist/HeatMap.js +83 -83
  76. package/dist/HeatMap.js.map +1 -1
  77. package/dist/Histogram.cjs +1 -1
  78. package/dist/Histogram.js +1 -1
  79. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  80. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  81. package/dist/LineChartWithConfidenceInterval.js +7 -6
  82. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  83. package/dist/MultiGraphDashboard.cjs +1 -1
  84. package/dist/MultiGraphDashboard.js +2 -2
  85. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  86. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  87. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  88. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  89. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  90. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  91. package/dist/MultiLineAltChart.cjs +1 -1
  92. package/dist/MultiLineAltChart.cjs.map +1 -1
  93. package/dist/MultiLineAltChart.js +82 -91
  94. package/dist/MultiLineAltChart.js.map +1 -1
  95. package/dist/MultiLineChart.cjs +1 -1
  96. package/dist/MultiLineChart.cjs.map +1 -1
  97. package/dist/MultiLineChart.js +3 -2
  98. package/dist/MultiLineChart.js.map +1 -1
  99. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  100. package/dist/PerformanceIntensiveMultiGraphDashboard.js +2 -2
  101. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  102. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  103. package/dist/RadarChart.cjs +1 -1
  104. package/dist/RadarChart.cjs.map +1 -1
  105. package/dist/RadarChart.js +124 -130
  106. package/dist/RadarChart.js.map +1 -1
  107. package/dist/SankeyChart.cjs +1 -1
  108. package/dist/SankeyChart.cjs.map +1 -1
  109. package/dist/SankeyChart.js +200 -200
  110. package/dist/SankeyChart.js.map +1 -1
  111. package/dist/ScatterPlot.cjs +1 -1
  112. package/dist/ScatterPlot.cjs.map +1 -1
  113. package/dist/ScatterPlot.js +149 -155
  114. package/dist/ScatterPlot.js.map +1 -1
  115. package/dist/SimpleLineChart.cjs +1 -1
  116. package/dist/SimpleLineChart.cjs.map +1 -1
  117. package/dist/SimpleLineChart.js +44 -43
  118. package/dist/SimpleLineChart.js.map +1 -1
  119. package/dist/SingleGraphDashboard.cjs +1 -1
  120. package/dist/SingleGraphDashboard.js +4 -4
  121. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  122. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  123. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  124. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  125. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  126. package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
  127. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  128. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  129. package/dist/SlopeChart.cjs +1 -1
  130. package/dist/SlopeChart.cjs.map +1 -1
  131. package/dist/SlopeChart.js +107 -113
  132. package/dist/SlopeChart.js.map +1 -1
  133. package/dist/SparkLine.cjs +1 -1
  134. package/dist/SparkLine.cjs.map +1 -1
  135. package/dist/SparkLine.js +3 -2
  136. package/dist/SparkLine.js.map +1 -1
  137. package/dist/StripChart.cjs +1 -1
  138. package/dist/StripChart.cjs.map +1 -1
  139. package/dist/StripChart.js +159 -159
  140. package/dist/StripChart.js.map +1 -1
  141. package/dist/ThreeDGlobe.cjs +1 -1
  142. package/dist/ThreeDGlobe.cjs.map +1 -1
  143. package/dist/ThreeDGlobe.js +3 -3
  144. package/dist/ThreeDGlobe.js.map +1 -1
  145. package/dist/TreeMapGraph.cjs +1 -1
  146. package/dist/TreeMapGraph.cjs.map +1 -1
  147. package/dist/TreeMapGraph.js +194 -200
  148. package/dist/TreeMapGraph.js.map +1 -1
  149. package/dist/ensureCompleteData-DkQYPeDa.cjs +2 -0
  150. package/dist/ensureCompleteData-DkQYPeDa.cjs.map +1 -0
  151. package/dist/{ensureCompleteData-BALdOrsS.js → ensureCompleteData-DlmibgaI.js} +28 -8
  152. package/dist/ensureCompleteData-DlmibgaI.js.map +1 -0
  153. package/dist/fetchAndParseData-Ba-_CgxS.cjs +16 -0
  154. package/dist/fetchAndParseData-Ba-_CgxS.cjs.map +1 -0
  155. package/dist/fetchAndParseData-sapWbnYk.js +583 -0
  156. package/dist/fetchAndParseData-sapWbnYk.js.map +1 -0
  157. package/dist/fetchAndParseData.cjs +1 -1
  158. package/dist/fetchAndParseData.js +1 -1
  159. package/dist/getJenks-BbngDoBQ.js +19 -0
  160. package/dist/getJenks-BbngDoBQ.js.map +1 -0
  161. package/dist/getJenks-GYmdwBqm.cjs +2 -0
  162. package/dist/getJenks-GYmdwBqm.cjs.map +1 -0
  163. package/dist/getSliderMarks-9cNoRkDx.js +1023 -0
  164. package/dist/getSliderMarks-9cNoRkDx.js.map +1 -0
  165. package/dist/getSliderMarks-CRIbTGYV.cjs +6 -0
  166. package/dist/getSliderMarks-CRIbTGYV.cjs.map +1 -0
  167. package/dist/getUniqValue-DiCh_MOD.js +13 -0
  168. package/dist/getUniqValue-DiCh_MOD.js.map +1 -0
  169. package/dist/getUniqValue-RViz8tTw.cjs +2 -0
  170. package/dist/getUniqValue-RViz8tTw.cjs.map +1 -0
  171. package/dist/{index-BMgDMxKJ.js → index-37q0ULNQ.js} +44 -50
  172. package/dist/index-37q0ULNQ.js.map +1 -0
  173. package/dist/index-CVlCtJbC.cjs +2 -0
  174. package/dist/index-CVlCtJbC.cjs.map +1 -0
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.d.ts +1 -1
  177. package/dist/index.js +6 -6
  178. package/dist/sort-DfK1b0F5.js +34 -0
  179. package/dist/sort-DfK1b0F5.js.map +1 -0
  180. package/dist/sort-O96oMZLb.cjs +2 -0
  181. package/dist/sort-O96oMZLb.cjs.map +1 -0
  182. package/dist/transformData.cjs +1 -1
  183. package/dist/transformData.js +3 -3
  184. package/dist/transformDataForAggregation-KXGm6flX.cjs +2 -0
  185. package/dist/{transformDataForAggregation-BVxVu4yY.cjs.map → transformDataForAggregation-KXGm6flX.cjs.map} +1 -1
  186. package/dist/{transformDataForAggregation-1BYVFqvF.js → transformDataForAggregation-sBpdlX8n.js} +40 -44
  187. package/dist/{transformDataForAggregation-1BYVFqvF.js.map → transformDataForAggregation-sBpdlX8n.js.map} +1 -1
  188. package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js → transformDataForGraphFromFile-ComYvzuz.js} +3 -3
  189. package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js.map → transformDataForGraphFromFile-ComYvzuz.js.map} +1 -1
  190. package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs → transformDataForGraphFromFile-DVZodTHd.cjs} +2 -2
  191. package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs.map → transformDataForGraphFromFile-DVZodTHd.cjs.map} +1 -1
  192. package/dist/uniqBy-BHy4I8PK.js +8 -0
  193. package/dist/uniqBy-BHy4I8PK.js.map +1 -0
  194. package/dist/uniqBy-O05lp2S5.cjs +2 -0
  195. package/dist/uniqBy-O05lp2S5.cjs.map +1 -0
  196. package/dist/utils.cjs +1 -1
  197. package/dist/utils.d.ts +1 -1
  198. package/dist/utils.js +2 -2
  199. package/package.json +1 -7
  200. package/dist/ensureCompleteData-BALdOrsS.js.map +0 -1
  201. package/dist/ensureCompleteData-BU5Zlccy.cjs +0 -2
  202. package/dist/ensureCompleteData-BU5Zlccy.cjs.map +0 -1
  203. package/dist/fetchAndParseData-DBOl1Icl.js +0 -1196
  204. package/dist/fetchAndParseData-DBOl1Icl.js.map +0 -1
  205. package/dist/fetchAndParseData-Dcy7AS_0.cjs +0 -16
  206. package/dist/fetchAndParseData-Dcy7AS_0.cjs.map +0 -1
  207. package/dist/getJenks-DW96UYNE.js +0 -23
  208. package/dist/getJenks-DW96UYNE.js.map +0 -1
  209. package/dist/getJenks-vofIZmeb.cjs +0 -2
  210. package/dist/getJenks-vofIZmeb.cjs.map +0 -1
  211. package/dist/getSliderMarks-C0jptXeP.js +0 -1054
  212. package/dist/getSliderMarks-C0jptXeP.js.map +0 -1
  213. package/dist/getSliderMarks-CtsEXiLV.cjs +0 -6
  214. package/dist/getSliderMarks-CtsEXiLV.cjs.map +0 -1
  215. package/dist/getUniqValue-CfuE_l9c.cjs +0 -2
  216. package/dist/getUniqValue-CfuE_l9c.cjs.map +0 -1
  217. package/dist/getUniqValue-CttuU_wn.js +0 -20
  218. package/dist/getUniqValue-CttuU_wn.js.map +0 -1
  219. package/dist/index-AqnpA7_O.js +0 -631
  220. package/dist/index-AqnpA7_O.js.map +0 -1
  221. package/dist/index-BJOeaYTk.cjs +0 -2
  222. package/dist/index-BJOeaYTk.cjs.map +0 -1
  223. package/dist/index-BMgDMxKJ.js.map +0 -1
  224. package/dist/index-DYH8g9WA.cjs +0 -2
  225. package/dist/index-DYH8g9WA.cjs.map +0 -1
  226. package/dist/index-Da2GUKrr.cjs +0 -2
  227. package/dist/index-Da2GUKrr.cjs.map +0 -1
  228. package/dist/index-fwdktvAS.js +0 -707
  229. package/dist/index-fwdktvAS.js.map +0 -1
  230. package/dist/transformDataForAggregation-BVxVu4yY.cjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"BeeSwarmChart.js","sources":["../src/Components/Graphs/BeeSwarmChart/Horizontal/Graph.tsx","../src/Components/Graphs/BeeSwarmChart/Horizontal/index.tsx","../src/Components/Graphs/BeeSwarmChart/Vertical/Graph.tsx","../src/Components/Graphs/BeeSwarmChart/Vertical/index.tsx","../src/Components/Graphs/BeeSwarmChart/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleSqrt } from 'd3-scale';\r\nimport { forceCollide, forceManyBody, forceSimulation, forceX, forceY } from 'd3-force';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineX } from '@/Components/Elements/ReferenceLine';\r\n\r\ninterface BeeSwarmChartDataTypeForBubbleChart extends BeeSwarmChartDataType {\r\n x: number;\r\n y: number;\r\n vx: number;\r\n vy: number;\r\n}\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n circleColors: string[];\r\n colorDomain: string[];\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n width: number;\r\n suffix: string;\r\n prefix: string;\r\n height: number;\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 refValues?: ReferenceDataType[];\r\n selectedColor?: string;\r\n startFromZero: boolean;\r\n radius: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: 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 rtl: boolean;\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 noOfTicks: number;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n circleColors,\r\n showTicks,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n selectedColor,\r\n startFromZero,\r\n radius,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n rtl,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n suffix,\r\n prefix,\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [finalData, setFinalData] = useState<BeeSwarmChartDataTypeForBubbleChart[] | null>(null);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const dataOrdered =\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)).length === 0\r\n ? data\r\n : orderBy(\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)),\r\n 'radius',\r\n 'desc',\r\n );\r\n const xMaxValue = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) < 0 &&\r\n !startFromZero\r\n ? 0\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n const xMinValue = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) >=\r\n 0 && !startFromZero\r\n ? 0\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n\r\n const radiusScale =\r\n data.filter(d => d.radius === undefined || d.radius === null).length !== data.length\r\n ? scaleSqrt()\r\n .domain([\r\n 0,\r\n checkIfNullOrUndefined(maxRadiusValue)\r\n ? Math.max(...data.map(d => d.radius).filter(d => d !== undefined && d !== null))\r\n : (maxRadiusValue as number),\r\n ])\r\n .range([0.25, radius])\r\n .nice()\r\n : undefined;\r\n const x = scaleLinear().domain([xMinValue, xMaxValue]).range([0, graphWidth]).nice();\r\n const xTicks = x.ticks(noOfTicks);\r\n\r\n useEffect(() => {\r\n setFinalData(null);\r\n const dataTemp = (dataOrdered as BeeSwarmChartDataType[]).filter(d => d.position);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceSimulation(dataTemp as any)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .force('x', forceX((d: any) => x(d.position as number)).strength(5))\r\n .force('y', forceY(_d => graphHeight / 2).strength(1))\r\n .force(\r\n 'collide',\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceCollide((d: any) => (radiusScale ? radiusScale(d.radius || 0) + 1 : radius + 1)),\r\n )\r\n .force('charge', forceManyBody().strength(-15))\r\n .alphaDecay(0.05)\r\n .tick(10000)\r\n .on('tick', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n })\r\n .on('end', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n });\r\n }, [data, radius, graphHeight, graphWidth, xMinValue, xMaxValue, dataOrdered, x, radiusScale]);\r\n\r\n return (\r\n <>\r\n {finalData ? (\r\n <svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {showTicks ? (\r\n <>\r\n <Axis\r\n x1={x(xMinValue < 0 ? 0 : xMinValue)}\r\n x2={x(xMinValue < 0 ? 0 : xMinValue)}\r\n y1={0 - margin.top}\r\n y2={graphHeight + margin.bottom}\r\n label={numberFormattingFunction(\r\n xMinValue < 0 ? 0 : xMinValue,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: x(xMinValue < 0 ? 0 : xMinValue),\r\n y: 0 - topMargin,\r\n dy: '0.75em',\r\n dx: 3,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <XTicksAndGridLines\r\n values={xTicks.filter(d => d !== 0)}\r\n x={xTicks.filter(d => d !== 0).map(d => x(d))}\r\n y1={0 - topMargin}\r\n y2={graphHeight + margin.bottom}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.xAxis?.gridLines,\r\n labels: classNames?.xAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {finalData.map(d => (\r\n <g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n transform={`translate(${d.x},${d.y})`}\r\n opacity={\r\n selectedColor\r\n ? d.color\r\n ? circleColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85\r\n }\r\n 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 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 onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <circle\r\n cx={0}\r\n cy={0}\r\n fill={\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)]\r\n }\r\n radius={radiusScale ? radiusScale(d.radius || 0) : radius}\r\n />\r\n {(radiusScale ? radiusScale(d.radius || 0) : radius) > 10 && showLabels ? (\r\n <g>\r\n <foreignObject\r\n y={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n x={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n width={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n height={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5'>\r\n {showLabels ? (\r\n <p\r\n className={cn(\r\n 'text-center leading-none m-0',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n fontSize: `${Math.min(\r\n Math.max(\r\n Math.round(\r\n (radiusScale ? radiusScale(d.radius || 0) : radius) / 4,\r\n ),\r\n 10,\r\n ),\r\n Math.max(\r\n Math.round(\r\n ((radiusScale ? radiusScale(d.radius || 0) : radius) * 12) /\r\n `${d.label}`.length,\r\n ),\r\n 10,\r\n ),\r\n 20,\r\n )}px`,\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)],\r\n ),\r\n hyphens: 'auto',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {d.label}\r\n </p>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ) : null}\r\n </g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineX\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n x={x(el.value as number)}\r\n y1={0 - margin.top}\r\n y2={graphHeight + margin.bottom}\r\n textSide={x(el.value as number) > graphWidth * 0.75 || rtl ? 'left' : 'right'}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n isInView={true}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </svg>\r\n ) : (\r\n <div style={{ width: `${width}px`, height: `${height}px` }}>\r\n <div className='flex m-auto items-center justify-center p-0 leading-none text-base h-40'>\r\n <Spinner />\r\n </div>\r\n </div>\r\n )}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import uniqBy from 'lodash.uniqby';\r\nimport { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n colors?: string | string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n sources?: SourcesDataType[];\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n colorDomain?: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n relativeHeight?: number;\r\n showLabels?: boolean;\r\n showColorScale?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n refValues?: ReferenceDataType[];\r\n graphID?: string;\r\n radius?: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: 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 graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n language?: Languages;\r\n showNAColor?: boolean;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n suffix?: string;\r\n prefix?: string;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n noOfTicks?: number;\r\n dimmedOpacity?: number;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n}\r\n\r\nexport function HorizontalBeeSwarmChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n backgroundColor = false,\r\n topMargin = 25,\r\n bottomMargin = 10,\r\n leftMargin = 10,\r\n rightMargin = 10,\r\n showLabels = true,\r\n showTicks = true,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n showColorScale,\r\n graphID,\r\n radius = 5,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n suffix = '',\r\n prefix = '',\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n 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 bee swarm chart showing the distribution along the x-axes. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale !== false && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={\r\n showNAColor === undefined || showNAColor === null ? true : showNAColor\r\n }\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n circleColors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n width={width || svgWidth}\r\n selectedColor={selectedColor}\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 showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n startFromZero={false}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n rtl={language === 'he' || language === 'ar'}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n suffix={suffix}\r\n prefix={prefix}\r\n styles={styles}\r\n classNames={classNames}\r\n noOfTicks={noOfTicks || 5}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n","import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleSqrt } from 'd3-scale';\r\nimport { forceCollide, forceManyBody, forceSimulation, forceX, forceY } from 'd3-force';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\n\r\ninterface BeeSwarmChartDataTypeForBubbleChart extends BeeSwarmChartDataType {\r\n x: number;\r\n y: number;\r\n vx: number;\r\n vy: number;\r\n}\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n circleColors: string[];\r\n colorDomain: string[];\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: 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 refValues?: ReferenceDataType[];\r\n selectedColor?: string;\r\n startFromZero: boolean;\r\n radius: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: 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 noOfTicks: number;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n circleColors,\r\n showTicks,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n selectedColor,\r\n startFromZero,\r\n radius,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [finalData, setFinalData] = useState<BeeSwarmChartDataTypeForBubbleChart[] | null>(null);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const dataOrdered =\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)).length === 0\r\n ? data\r\n : orderBy(\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)),\r\n 'radius',\r\n 'desc',\r\n );\r\n const yMaxValue = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) < 0 &&\r\n !startFromZero\r\n ? 0\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n const yMinValue = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) >=\r\n 0 && !startFromZero\r\n ? 0\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n\r\n const radiusScale =\r\n data.filter(d => d.radius === undefined || d.radius === null).length !== data.length\r\n ? scaleSqrt()\r\n .domain([\r\n 0,\r\n checkIfNullOrUndefined(maxRadiusValue)\r\n ? Math.max(...data.map(d => d.radius).filter(d => d !== undefined && d !== null))\r\n : (maxRadiusValue as number),\r\n ])\r\n .range([0.25, radius])\r\n .nice()\r\n : undefined;\r\n const y = scaleLinear().domain([yMinValue, yMaxValue]).range([graphHeight, 0]).nice();\r\n const yTicks = y.ticks(noOfTicks);\r\n\r\n useEffect(() => {\r\n setFinalData(null);\r\n const dataTemp = (dataOrdered as BeeSwarmChartDataType[]).filter(d => d.position);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceSimulation(dataTemp as any)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .force('y', forceY((d: any) => y(d.position as number)).strength(5))\r\n .force('x', forceX(_d => graphWidth / 2).strength(1))\r\n .force(\r\n 'collide',\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceCollide((d: any) => (radiusScale ? radiusScale(d.radius || 0) + 1 : radius + 1)),\r\n )\r\n .force('charge', forceManyBody().strength(-15))\r\n .alphaDecay(0.05)\r\n .tick(10000)\r\n .on('tick', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n })\r\n .on('end', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n });\r\n }, [data, radius, graphHeight, graphWidth, yMinValue, yMaxValue, dataOrdered, y, radiusScale]);\r\n\r\n return (\r\n <>\r\n {finalData ? (\r\n <svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {showTicks ? (\r\n <>\r\n <Axis\r\n y1={y(yMinValue < 0 ? 0 : yMinValue)}\r\n y2={y(yMinValue < 0 ? 0 : yMinValue)}\r\n x1={0 - margin.left}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n yMinValue < 0 ? 0 : yMinValue,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - margin.left,\r\n y: y(yMinValue < 0 ? 0 : yMinValue),\r\n dx: 0,\r\n dy: yMaxValue < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - margin.left}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {finalData.map(d => (\r\n <g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n transform={`translate(${d.x},${d.y})`}\r\n opacity={\r\n selectedColor\r\n ? d.color\r\n ? circleColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85\r\n }\r\n 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 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 onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radiusScale ? radiusScale(d.radius || 0) : radius}\r\n fill={\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)]\r\n }\r\n />\r\n {(radiusScale ? radiusScale(d.radius || 0) : radius) > 10 && showLabels ? (\r\n <g>\r\n <foreignObject\r\n y={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n x={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n width={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n height={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n >\r\n <div className='flex flex-col justify-center items-center h-inherit py-0 px-1.5'>\r\n {showLabels ? (\r\n <p\r\n className={cn(\r\n 'text-center leading-none m-0',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n fontSize: `${Math.min(\r\n Math.max(\r\n Math.round(\r\n (radiusScale ? radiusScale(d.radius || 0) : radius) / 4,\r\n ),\r\n 10,\r\n ),\r\n Math.max(\r\n Math.round(\r\n ((radiusScale ? radiusScale(d.radius || 0) : radius) * 12) /\r\n `${d.label}`.length,\r\n ),\r\n 10,\r\n ),\r\n 20,\r\n )}px`,\r\n hyphens: 'auto',\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {d.label}\r\n </p>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ) : null}\r\n </g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - margin.left}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n isInView={true}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </svg>\r\n ) : (\r\n <div style={{ width: `${width}px`, height: `${height}px` }}>\r\n <div className='flex m-auto items-center justify-center p-0 leading-none text-base h-40'>\r\n <Spinner />\r\n </div>\r\n </div>\r\n )}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import uniqBy from 'lodash.uniqby';\r\nimport { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n colors?: string | string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n suffix?: string;\r\n prefix?: string;\r\n sources?: SourcesDataType[];\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n colorDomain?: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n relativeHeight?: number;\r\n showLabels?: boolean;\r\n showColorScale?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n refValues?: ReferenceDataType[];\r\n graphID?: string;\r\n radius?: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedDataPoints?: (string | number)[];\r\n dimmedOpacity?: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n language?: Languages;\r\n showNAColor?: boolean;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n noOfTicks?: number;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n}\r\n\r\nexport function VerticalBeeSwarmChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 25,\r\n bottomMargin = 10,\r\n leftMargin = 100,\r\n rightMargin = 40,\r\n showLabels = true,\r\n showTicks = true,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n showColorScale,\r\n graphID,\r\n radius = 5,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n suffix = '',\r\n prefix = '',\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n 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 bee swarm chart showing the distribution along the y-axes. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale !== false && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n circleColors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n data.filter(el => el.color).length === 0\r\n ? []\r\n : colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n width={width || svgWidth}\r\n selectedColor={selectedColor}\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 showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n startFromZero={false}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n suffix={suffix}\r\n prefix={prefix}\r\n noOfTicks={noOfTicks || 5}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n","import { HorizontalBeeSwarmChart } from './Horizontal';\r\nimport { VerticalBeeSwarmChart } from './Vertical';\r\n\r\nimport {\r\n ReferenceDataType,\r\n SourcesDataType,\r\n Languages,\r\n BeeSwarmChartDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n} from '@/Types';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: BeeSwarmChartDataType[];\r\n\r\n /** Orientation of the graph */\r\n orientation?: 'vertical' | 'horizontal';\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for 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 /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Maximum value for the radius of the circle */\r\n maxRadiusValue?: number;\r\n /** Minimum value for position of the circle */\r\n minValue?: number;\r\n /** Maximum value for position of the circle */\r\n maxValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Number of ticks on the axis */\r\n noOfTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Toggle visibility of values */\r\n showTicks?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Maximum radius of the circles */\r\n radius?: number;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** 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 BeeSwarmChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n backgroundColor,\r\n topMargin,\r\n bottomMargin,\r\n leftMargin,\r\n rightMargin,\r\n showLabels,\r\n showTicks,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n showColorScale,\r\n graphID,\r\n radius,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n graphDownload,\r\n dataDownload,\r\n language,\r\n showNAColor,\r\n minHeight,\r\n theme,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n noOfTicks,\r\n orientation = 'vertical',\r\n styles,\r\n classNames,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n\r\n if (orientation === 'vertical')\r\n return (\r\n <VerticalBeeSwarmChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n backgroundColor={backgroundColor}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n showLabels={showLabels}\r\n showTicks={showTicks}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n relativeHeight={relativeHeight}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n showColorScale={showColorScale}\r\n graphID={graphID}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n language={language}\r\n showNAColor={showNAColor}\r\n minHeight={minHeight}\r\n theme={theme}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n classNames={classNames}\r\n noOfTicks={noOfTicks}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n );\r\n return (\r\n <HorizontalBeeSwarmChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n backgroundColor={backgroundColor}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n showLabels={showLabels}\r\n showTicks={showTicks}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n relativeHeight={relativeHeight}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n showColorScale={showColorScale}\r\n graphID={graphID}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n language={language}\r\n showNAColor={showNAColor}\r\n minHeight={minHeight}\r\n theme={theme}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n classNames={classNames}\r\n noOfTicks={noOfTicks}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n );\r\n}\r\n"],"names":["Graph","props","data","circleColors","showTicks","leftMargin","width","height","colorDomain","rightMargin","topMargin","bottomMargin","showLabels","tooltip","onSeriesMouseOver","refValues","selectedColor","startFromZero","radius","maxRadiusValue","maxValue","minValue","highlightedDataPoints","onSeriesMouseClick","rtl","resetSelectionOnDoubleClick","detailsOnClick","suffix","prefix","styles","classNames","noOfTicks","dimmedOpacity","precision","customLayers","svgRef","useRef","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","finalData","setFinalData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","dataOrdered","d","checkIfNullOrUndefined","orderBy","xMaxValue","xMinValue","radiusScale","scaleSqrt","x","scaleLinear","xTicks","useEffect","dataTemp","forceSimulation","forceX","forceY","_d","forceCollide","forceManyBody","jsxs","Fragment","jsx","Axis","numberFormattingFunction","XTicksAndGridLines","event","isEqual","el","Colors","cn","getTextColorBasedOnBgColor","i","RefLineX","Spinner","Tooltip","Modal","string2HTML","HorizontalBeeSwarmChart","graphTitle","backgroundColor","colors","sources","graphDescription","footNote","colorLegendTitle","padding","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter","yMaxValue","yMinValue","y","yTicks","YTicksAndGridLines","RefLineY","VerticalBeeSwarmChart","BeeSwarmChart","orientation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyEO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,KAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA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ACA,SAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAAtF;AAAA,MACA,OAAAD;AAAA,MACA,UAAAwF;AAAA,MACA,aAAAtF;AAAA,MACA,kBAAAuF;AAAA,MACA,SAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,SAAApF;AAAA,MACA,mBAAAC;AAAA,MACA,WAAAC;AAAA,MACA,gBAAAmF;AAAA,MACA,SAAAC;AAAA,MACA,QAAAjF;AAAA,MACA,gBAAAC;AAAA,MACA,UAAAC;AAAA,MACA,UAAAC;AAAA,MACA,uBAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,eAAA6E;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,WAAAC;AAAA,MACA,OAAAC;AAAA,MACA,WAAAC;AAAA,MACA,6BAAAjF;AAAA,MACA,QAAAI;AAAA,MACA,gBAAAH;AAAA,MACA,YAAAI;AAAA,MACA,WAAAC;AAAA,MACA,eAAAC;AAAA,MACA,WAAAC;AAAA,MACA,cAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"BeeSwarmChart.js","sources":["../src/Components/Graphs/BeeSwarmChart/Horizontal/Graph.tsx","../src/Components/Graphs/BeeSwarmChart/Horizontal/index.tsx","../src/Components/Graphs/BeeSwarmChart/Vertical/Graph.tsx","../src/Components/Graphs/BeeSwarmChart/Vertical/index.tsx","../src/Components/Graphs/BeeSwarmChart/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleSqrt } from 'd3-scale';\r\nimport { forceCollide, forceManyBody, forceSimulation, forceX, forceY } from 'd3-force';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineX } from '@/Components/Elements/ReferenceLine';\r\n\r\ninterface BeeSwarmChartDataTypeForBubbleChart extends BeeSwarmChartDataType {\r\n x: number;\r\n y: number;\r\n vx: number;\r\n vy: number;\r\n}\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n circleColors: string[];\r\n colorDomain: string[];\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n width: number;\r\n suffix: string;\r\n prefix: string;\r\n height: number;\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 refValues?: ReferenceDataType[];\r\n selectedColor?: string;\r\n startFromZero: boolean;\r\n radius: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: 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 rtl: boolean;\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 noOfTicks: number;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n circleColors,\r\n showTicks,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n selectedColor,\r\n startFromZero,\r\n radius,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n rtl,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n suffix,\r\n prefix,\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [finalData, setFinalData] = useState<BeeSwarmChartDataTypeForBubbleChart[] | null>(null);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const dataOrdered =\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)).length === 0\r\n ? data\r\n : orderBy(\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)),\r\n 'radius',\r\n 'desc',\r\n );\r\n const xMaxValue = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) < 0 &&\r\n !startFromZero\r\n ? 0\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n const xMinValue = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) >=\r\n 0 && !startFromZero\r\n ? 0\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n\r\n const radiusScale =\r\n data.filter(d => d.radius === undefined || d.radius === null).length !== data.length\r\n ? scaleSqrt()\r\n .domain([\r\n 0,\r\n checkIfNullOrUndefined(maxRadiusValue)\r\n ? Math.max(...data.map(d => d.radius).filter(d => d !== undefined && d !== null))\r\n : (maxRadiusValue as number),\r\n ])\r\n .range([0.25, radius])\r\n .nice()\r\n : undefined;\r\n const x = scaleLinear().domain([xMinValue, xMaxValue]).range([0, graphWidth]).nice();\r\n const xTicks = x.ticks(noOfTicks);\r\n\r\n useEffect(() => {\r\n setFinalData(null);\r\n const dataTemp = (dataOrdered as BeeSwarmChartDataType[]).filter(d => d.position);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceSimulation(dataTemp as any)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .force('x', forceX((d: any) => x(d.position as number)).strength(5))\r\n .force('y', forceY(_d => graphHeight / 2).strength(1))\r\n .force(\r\n 'collide',\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceCollide((d: any) => (radiusScale ? radiusScale(d.radius || 0) + 1 : radius + 1)),\r\n )\r\n .force('charge', forceManyBody().strength(-15))\r\n .alphaDecay(0.05)\r\n .tick(10000)\r\n .on('tick', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n })\r\n .on('end', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n });\r\n }, [data, radius, graphHeight, graphWidth, xMinValue, xMaxValue, dataOrdered, x, radiusScale]);\r\n\r\n return (\r\n <>\r\n {finalData ? (\r\n <svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {showTicks ? (\r\n <>\r\n <Axis\r\n x1={x(xMinValue < 0 ? 0 : xMinValue)}\r\n x2={x(xMinValue < 0 ? 0 : xMinValue)}\r\n y1={0 - margin.top}\r\n y2={graphHeight + margin.bottom}\r\n label={numberFormattingFunction(\r\n xMinValue < 0 ? 0 : xMinValue,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: x(xMinValue < 0 ? 0 : xMinValue),\r\n y: 0 - topMargin,\r\n dy: '0.75em',\r\n dx: 3,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <XTicksAndGridLines\r\n values={xTicks.filter(d => d !== 0)}\r\n x={xTicks.filter(d => d !== 0).map(d => x(d))}\r\n y1={0 - topMargin}\r\n y2={graphHeight + margin.bottom}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.xAxis?.gridLines,\r\n labels: classNames?.xAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {finalData.map(d => (\r\n <g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n transform={`translate(${d.x},${d.y})`}\r\n opacity={\r\n selectedColor\r\n ? d.color\r\n ? circleColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85\r\n }\r\n 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 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 onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <circle\r\n cx={0}\r\n cy={0}\r\n fill={\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)]\r\n }\r\n radius={radiusScale ? radiusScale(d.radius || 0) : radius}\r\n />\r\n {(radiusScale ? radiusScale(d.radius || 0) : radius) > 10 && showLabels ? (\r\n <g>\r\n <foreignObject\r\n y={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n x={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n width={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n height={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5'>\r\n {showLabels ? (\r\n <p\r\n className={cn(\r\n 'text-center leading-none m-0',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n fontSize: `${Math.min(\r\n Math.max(\r\n Math.round(\r\n (radiusScale ? radiusScale(d.radius || 0) : radius) / 4,\r\n ),\r\n 10,\r\n ),\r\n Math.max(\r\n Math.round(\r\n ((radiusScale ? radiusScale(d.radius || 0) : radius) * 12) /\r\n `${d.label}`.length,\r\n ),\r\n 10,\r\n ),\r\n 20,\r\n )}px`,\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)],\r\n ),\r\n hyphens: 'auto',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {d.label}\r\n </p>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ) : null}\r\n </g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineX\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n x={x(el.value as number)}\r\n y1={0 - margin.top}\r\n y2={graphHeight + margin.bottom}\r\n textSide={x(el.value as number) > graphWidth * 0.75 || rtl ? 'left' : 'right'}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n isInView={true}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </svg>\r\n ) : (\r\n <div style={{ width: `${width}px`, height: `${height}px` }}>\r\n <div className='flex m-auto items-center justify-center p-0 leading-none text-base h-40'>\r\n <Spinner />\r\n </div>\r\n </div>\r\n )}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n colors?: string | string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n sources?: SourcesDataType[];\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n colorDomain?: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n relativeHeight?: number;\r\n showLabels?: boolean;\r\n showColorScale?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n refValues?: ReferenceDataType[];\r\n graphID?: string;\r\n radius?: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: 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 graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n language?: Languages;\r\n showNAColor?: boolean;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n suffix?: string;\r\n prefix?: string;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n noOfTicks?: number;\r\n dimmedOpacity?: number;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n}\r\n\r\nexport function HorizontalBeeSwarmChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n backgroundColor = false,\r\n topMargin = 25,\r\n bottomMargin = 10,\r\n leftMargin = 10,\r\n rightMargin = 10,\r\n showLabels = true,\r\n showTicks = true,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n showColorScale,\r\n graphID,\r\n radius = 5,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n suffix = '',\r\n prefix = '',\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n 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 bee swarm chart showing the distribution along the x-axes. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale !== false && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={\r\n showNAColor === undefined || showNAColor === null ? true : showNAColor\r\n }\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n circleColors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n 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 selectedColor={selectedColor}\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 showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n startFromZero={false}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n rtl={language === 'he' || language === 'ar'}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n suffix={suffix}\r\n prefix={prefix}\r\n styles={styles}\r\n classNames={classNames}\r\n noOfTicks={noOfTicks || 5}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n","import isEqual from 'fast-deep-equal';\r\nimport { scaleLinear, scaleSqrt } from 'd3-scale';\r\nimport { forceCollide, forceManyBody, forceSimulation, forceX, forceY } from 'd3-force';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\n\r\ninterface BeeSwarmChartDataTypeForBubbleChart extends BeeSwarmChartDataType {\r\n x: number;\r\n y: number;\r\n vx: number;\r\n vy: number;\r\n}\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n circleColors: string[];\r\n colorDomain: string[];\r\n showTicks: boolean;\r\n leftMargin: number;\r\n rightMargin: number;\r\n topMargin: number;\r\n bottomMargin: number;\r\n showLabels: boolean;\r\n width: number;\r\n height: number;\r\n suffix: string;\r\n prefix: 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 refValues?: ReferenceDataType[];\r\n selectedColor?: string;\r\n startFromZero: boolean;\r\n radius: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: 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 noOfTicks: number;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n circleColors,\r\n showTicks,\r\n leftMargin,\r\n width,\r\n height,\r\n colorDomain,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n showLabels,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n selectedColor,\r\n startFromZero,\r\n radius,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [finalData, setFinalData] = useState<BeeSwarmChartDataTypeForBubbleChart[] | null>(null);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n\r\n const dataOrdered =\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)).length === 0\r\n ? data\r\n : orderBy(\r\n data.filter(d => !checkIfNullOrUndefined(d.radius)),\r\n 'radius',\r\n 'desc',\r\n );\r\n const yMaxValue = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) < 0 &&\r\n !startFromZero\r\n ? 0\r\n : Math.max(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n const yMinValue = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position)) >=\r\n 0 && !startFromZero\r\n ? 0\r\n : Math.min(...data.filter(d => !checkIfNullOrUndefined(d.position)).map(d => d.position));\r\n\r\n const radiusScale =\r\n data.filter(d => d.radius === undefined || d.radius === null).length !== data.length\r\n ? scaleSqrt()\r\n .domain([\r\n 0,\r\n checkIfNullOrUndefined(maxRadiusValue)\r\n ? Math.max(...data.map(d => d.radius).filter(d => d !== undefined && d !== null))\r\n : (maxRadiusValue as number),\r\n ])\r\n .range([0.25, radius])\r\n .nice()\r\n : undefined;\r\n const y = scaleLinear().domain([yMinValue, yMaxValue]).range([graphHeight, 0]).nice();\r\n const yTicks = y.ticks(noOfTicks);\r\n\r\n useEffect(() => {\r\n setFinalData(null);\r\n const dataTemp = (dataOrdered as BeeSwarmChartDataType[]).filter(d => d.position);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceSimulation(dataTemp as any)\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .force('y', forceY((d: any) => y(d.position as number)).strength(5))\r\n .force('x', forceX(_d => graphWidth / 2).strength(1))\r\n .force(\r\n 'collide',\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n forceCollide((d: any) => (radiusScale ? radiusScale(d.radius || 0) + 1 : radius + 1)),\r\n )\r\n .force('charge', forceManyBody().strength(-15))\r\n .alphaDecay(0.05)\r\n .tick(10000)\r\n .on('tick', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n })\r\n .on('end', () => {\r\n setFinalData(dataTemp as BeeSwarmChartDataTypeForBubbleChart[]);\r\n });\r\n }, [data, radius, graphHeight, graphWidth, yMinValue, yMaxValue, dataOrdered, y, radiusScale]);\r\n\r\n return (\r\n <>\r\n {finalData ? (\r\n <svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {showTicks ? (\r\n <>\r\n <Axis\r\n y1={y(yMinValue < 0 ? 0 : yMinValue)}\r\n y2={y(yMinValue < 0 ? 0 : yMinValue)}\r\n x1={0 - margin.left}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n yMinValue < 0 ? 0 : yMinValue,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - margin.left,\r\n y: y(yMinValue < 0 ? 0 : yMinValue),\r\n dx: 0,\r\n dy: yMaxValue < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - margin.left}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {finalData.map(d => (\r\n <g\r\n className='undp-viz-g-with-hover'\r\n key={d.label}\r\n transform={`translate(${d.x},${d.y})`}\r\n opacity={\r\n selectedColor\r\n ? d.color\r\n ? circleColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedDataPoints.length !== 0\r\n ? highlightedDataPoints.indexOf(d.label) !== -1\r\n ? 0.85\r\n : dimmedOpacity\r\n : 0.85\r\n }\r\n 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 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 onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radiusScale ? radiusScale(d.radius || 0) : radius}\r\n fill={\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)]\r\n }\r\n />\r\n {(radiusScale ? radiusScale(d.radius || 0) : radius) > 10 && showLabels ? (\r\n <g>\r\n <foreignObject\r\n y={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n x={0 - (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n width={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n height={2 * (radiusScale ? radiusScale(d.radius || 0) : radius)}\r\n >\r\n <div className='flex flex-col justify-center items-center h-inherit py-0 px-1.5'>\r\n {showLabels ? (\r\n <p\r\n className={cn(\r\n 'text-center leading-none m-0',\r\n classNames?.graphObjectValues,\r\n )}\r\n style={{\r\n fontSize: `${Math.min(\r\n Math.max(\r\n Math.round(\r\n (radiusScale ? radiusScale(d.radius || 0) : radius) / 4,\r\n ),\r\n 10,\r\n ),\r\n Math.max(\r\n Math.round(\r\n ((radiusScale ? radiusScale(d.radius || 0) : radius) * 12) /\r\n `${d.label}`.length,\r\n ),\r\n 10,\r\n ),\r\n 20,\r\n )}px`,\r\n hyphens: 'auto',\r\n color: getTextColorBasedOnBgColor(\r\n data.filter(el => el.color).length === 0\r\n ? circleColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : circleColors[colorDomain.indexOf(d.color)],\r\n ),\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n >\r\n {d.label}\r\n </p>\r\n ) : null}\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ) : null}\r\n </g>\r\n ))}\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - margin.left}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n isInView={true}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </svg>\r\n ) : (\r\n <div style={{ width: `${width}px`, height: `${height}px` }}>\r\n <div className='flex m-auto items-center justify-center p-0 leading-none text-base h-40'>\r\n <Spinner />\r\n </div>\r\n </div>\r\n )}\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BeeSwarmChartDataType,\r\n Languages,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n data: BeeSwarmChartDataType[];\r\n colors?: string | string[];\r\n graphTitle?: string | React.ReactNode;\r\n graphDescription?: string | React.ReactNode;\r\n footNote?: string | React.ReactNode;\r\n width?: number;\r\n height?: number;\r\n suffix?: string;\r\n prefix?: string;\r\n sources?: SourcesDataType[];\r\n showTicks?: boolean;\r\n leftMargin?: number;\r\n rightMargin?: number;\r\n colorDomain?: string[];\r\n colorLegendTitle?: string;\r\n backgroundColor?: string | boolean;\r\n padding?: string;\r\n topMargin?: number;\r\n bottomMargin?: number;\r\n relativeHeight?: number;\r\n showLabels?: boolean;\r\n showColorScale?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n refValues?: ReferenceDataType[];\r\n graphID?: string;\r\n radius?: number;\r\n maxRadiusValue?: number;\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedDataPoints?: (string | number)[];\r\n dimmedOpacity?: number;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n graphDownload?: boolean;\r\n dataDownload?: boolean;\r\n language?: Languages;\r\n showNAColor?: boolean;\r\n minHeight?: number;\r\n theme?: 'light' | 'dark';\r\n ariaLabel?: string;\r\n resetSelectionOnDoubleClick?: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n noOfTicks?: number;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision?: number;\r\n customLayers?: CustomLayerDataType[];\r\n}\r\n\r\nexport function VerticalBeeSwarmChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n backgroundColor = false,\r\n topMargin = 25,\r\n bottomMargin = 10,\r\n leftMargin = 100,\r\n rightMargin = 40,\r\n showLabels = true,\r\n showTicks = true,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n showColorScale,\r\n graphID,\r\n radius = 5,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints = [],\r\n onSeriesMouseClick,\r\n graphDownload = false,\r\n dataDownload = false,\r\n language = 'en',\r\n showNAColor = true,\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n suffix = '',\r\n prefix = '',\r\n styles,\r\n classNames,\r\n noOfTicks,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n 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 bee swarm chart showing the distribution along the y-axes. ${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale !== false && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center w-full leading-0'\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n circleColors={\r\n data.filter(el => el.color).length === 0\r\n ? colors\r\n ? [colors as string]\r\n : [Colors.primaryColors['blue-600']]\r\n : (colors as string[] | undefined) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n 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 selectedColor={selectedColor}\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 showTicks={showTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n showLabels={showLabels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n startFromZero={false}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n detailsOnClick={detailsOnClick}\r\n styles={styles}\r\n classNames={classNames}\r\n suffix={suffix}\r\n prefix={prefix}\r\n noOfTicks={noOfTicks || 5}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n","import { HorizontalBeeSwarmChart } from './Horizontal';\r\nimport { VerticalBeeSwarmChart } from './Vertical';\r\n\r\nimport {\r\n ReferenceDataType,\r\n SourcesDataType,\r\n Languages,\r\n BeeSwarmChartDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n} from '@/Types';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: BeeSwarmChartDataType[];\r\n\r\n /** Orientation of the graph */\r\n orientation?: 'vertical' | 'horizontal';\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Color or array of colors for 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 /** Background color of the graph */\r\n backgroundColor?: string | boolean;\r\n /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n styles?: StyleObject;\r\n /** Custom class names */\r\n classNames?: ClassNameObject;\r\n\r\n // Size and Spacing\r\n /** Width of the graph */\r\n width?: number;\r\n /** Height of the graph */\r\n height?: number;\r\n /** Minimum height of the graph */\r\n minHeight?: number;\r\n /** Relative height scaling factor. This overwrites the height props */\r\n relativeHeight?: number;\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Maximum value for the radius of the circle */\r\n maxRadiusValue?: number;\r\n /** Minimum value for position of the circle */\r\n minValue?: number;\r\n /** Maximum value for position of the circle */\r\n maxValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Number of ticks on the axis */\r\n noOfTicks?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of labels */\r\n showLabels?: boolean;\r\n /** Toggle visibility of values */\r\n showTicks?: boolean;\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n showNAColor?: boolean;\r\n /** Data points to highlight. Use the label value from data to highlight the data point */\r\n highlightedDataPoints?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Maximum radius of the circles */\r\n radius?: number;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** 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 BeeSwarmChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n backgroundColor,\r\n topMargin,\r\n bottomMargin,\r\n leftMargin,\r\n rightMargin,\r\n showLabels,\r\n showTicks,\r\n colors,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n colorDomain,\r\n colorLegendTitle,\r\n padding,\r\n relativeHeight,\r\n tooltip,\r\n onSeriesMouseOver,\r\n refValues,\r\n showColorScale,\r\n graphID,\r\n radius,\r\n maxRadiusValue,\r\n maxValue,\r\n minValue,\r\n highlightedDataPoints,\r\n onSeriesMouseClick,\r\n graphDownload,\r\n dataDownload,\r\n language,\r\n showNAColor,\r\n minHeight,\r\n theme,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n noOfTicks,\r\n orientation = 'vertical',\r\n styles,\r\n classNames,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n\r\n if (orientation === 'vertical')\r\n return (\r\n <VerticalBeeSwarmChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n backgroundColor={backgroundColor}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n showLabels={showLabels}\r\n showTicks={showTicks}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n relativeHeight={relativeHeight}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n showColorScale={showColorScale}\r\n graphID={graphID}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n language={language}\r\n showNAColor={showNAColor}\r\n minHeight={minHeight}\r\n theme={theme}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n classNames={classNames}\r\n noOfTicks={noOfTicks}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n );\r\n return (\r\n <HorizontalBeeSwarmChart\r\n data={data}\r\n graphTitle={graphTitle}\r\n backgroundColor={backgroundColor}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n showLabels={showLabels}\r\n showTicks={showTicks}\r\n colors={colors}\r\n sources={sources}\r\n graphDescription={graphDescription}\r\n height={height}\r\n width={width}\r\n footNote={footNote}\r\n colorDomain={colorDomain}\r\n colorLegendTitle={colorLegendTitle}\r\n padding={padding}\r\n relativeHeight={relativeHeight}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n refValues={refValues}\r\n showColorScale={showColorScale}\r\n graphID={graphID}\r\n radius={radius}\r\n maxRadiusValue={maxRadiusValue}\r\n maxValue={maxValue}\r\n minValue={minValue}\r\n highlightedDataPoints={highlightedDataPoints}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n graphDownload={graphDownload}\r\n dataDownload={dataDownload}\r\n language={language}\r\n showNAColor={showNAColor}\r\n minHeight={minHeight}\r\n theme={theme}\r\n ariaLabel={ariaLabel}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n classNames={classNames}\r\n noOfTicks={noOfTicks}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n );\r\n}\r\n"],"names":["Graph","props","data","circleColors","showTicks","leftMargin","width","height","colorDomain","rightMargin","topMargin","bottomMargin","showLabels","tooltip","onSeriesMouseOver","refValues","selectedColor","startFromZero","radius","maxRadiusValue","maxValue","minValue","highlightedDataPoints","onSeriesMouseClick","rtl","resetSelectionOnDoubleClick","detailsOnClick","suffix","prefix","styles","classNames","noOfTicks","dimmedOpacity","precision","customLayers","svgRef","useRef","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","finalData","setFinalData","eventX","setEventX","eventY","setEventY","margin","graphWidth","graphHeight","dataOrdered","d","checkIfNullOrUndefined","orderBy","xMaxValue","xMinValue","radiusScale","scaleSqrt","x","scaleLinear","xTicks","useEffect","dataTemp","forceSimulation","forceX","forceY","_d","forceCollide","forceManyBody","jsxs","Fragment","jsx","Axis","numberFormattingFunction","XTicksAndGridLines","event","isEqual","el","Colors","cn","getTextColorBasedOnBgColor","i","RefLineX","Spinner","Tooltip","Modal","string2HTML","HorizontalBeeSwarmChart","graphTitle","backgroundColor","colors","sources","graphDescription","footNote","colorLegendTitle","padding","relativeHeight","showColorScale","graphID","graphDownload","dataDownload","language","showNAColor","minHeight","theme","ariaLabel","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter","yMaxValue","yMinValue","y","yTicks","YTicksAndGridLines","RefLineY","VerticalBeeSwarmChart","BeeSwarmChart","orientation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyEO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,QAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,KAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACEjC,IACEkC,IAASC,GAAO,IAAI,GAEpB,CAACC,GAAeC,CAAgB,IAAIC,EAAc,MAAS,GAE3D,CAACC,GAAgBC,CAAiB,IAAIF,EAAc,MAAS,GAC7D,CAACG,GAAWC,CAAY,IAAIJ,EAAuD,IAAI,GACvF,CAACK,IAAQC,CAAS,IAAIN,EAA6B,MAAS,GAC5D,CAACO,GAAQC,CAAS,IAAIR,EAA6B,MAAS,GAC5DS,IAAS;AAAA,IACb,KAAKtC;AAAA,IACL,QAAQC;AAAA,IACR,MAAMN;AAAA,IACN,OAAOI;AAAA,EAAA,GAEHwC,IAAa3C,IAAQ0C,EAAO,OAA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AAAA,MACA,OAAAC;AAAA,MACA,WAAAC;AAAA,MACA,6BAAAjF;AAAA,MACA,QAAAI;AAAA,MACA,gBAAAH;AAAA,MACA,YAAAI;AAAA,MACA,WAAAC;AAAA,MACA,eAAAC;AAAA,MACA,WAAAC;AAAA,MACA,cAAAC;AAAA,IAAA;AAAA,EAAA,IAIJsC,gBAAAA,EAAAA;AAAAA,IAACgB;AAAA,IAAA;AAAA,MACC,MAAAtF;AAAA,MACA,YAAAuF;AAAA,MACA,iBAAAC;AAAA,MACA,WAAAhF;AAAA,MACA,cAAAC;AAAA,MACA,YAAAN;AAAA,MACA,aAAAI;AAAA,MACA,YAAAG;AAAA,MACA,WAAAR;AAAA,MACA,QAAAuF;AAAA,MACA,SAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,QAAAtF;AAAA,MACA,OAAAD;AAAA,MACA,UAAAwF;AAAA,MACA,aAAAtF;AAAA,MACA,kBAAAuF;AAAA,MACA,SAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,SAAApF;AAAA,MACA,mBAAAC;AAAA,MACA,WAAAC;AAAA,MACA,gBAAAmF;AAAA,MACA,SAAAC;AAAA,MACA,QAAAjF;AAAA,MACA,gBAAAC;AAAA,MACA,UAAAC;AAAA,MACA,UAAAC;AAAA,MACA,uBAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,eAAA6E;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,WAAAC;AAAA,MACA,OAAAC;AAAA,MACA,WAAAC;AAAA,MACA,6BAAAjF;AAAA,MACA,QAAAI;AAAA,MACA,gBAAAH;AAAA,MACA,YAAAI;AAAA,MACA,WAAAC;AAAA,MACA,eAAAC;AAAA,MACA,WAAAC;AAAA,MACA,cAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),ke=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./parse-hMnG_lRV.cjs"),Pe=require("./index-BJOeaYTk.cjs"),Le=require("./index-DQA8q5sC.cjs"),L=require("./zoom-Bsbhil-K.cjs"),Te=require("./index-D05lK1Te.cjs"),ze=require("./Modal-tXZlLE5s.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),We=require("./Tooltip-De16GWhY.cjs"),Ae=require("./string2HTML-z7CwHXcx.cjs"),De=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),$e=require("./index-BW_-wD2k.cjs"),we=require("./select-Bnfk0lJx.cjs"),Me=require("./threshold-DNsSUf8Q.cjs"),Be=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Fe=require("./index-BW8iNx7E.cjs"),Ve=require("./GraphHeader.cjs"),He=require("./GraphFooter.cjs"),Re=require("./Colors.cjs"),_e=require("./fetchAndParseData-Dcy7AS_0.cjs"),qe=require("./getJenks-vofIZmeb.cjs"),Ge=require("./init-DU0ybBc_.cjs");function Ue(je){const{data:v,xDomain:R,mapData:f,xColorLegendTitle:D,yDomain:T,yColorLegendTitle:z,width:u,height:s,colors:Y,scale:J,centerPoint:$,mapBorderWidth:W,mapNoDataColor:M,mapBorderColor:ne,tooltip:se,onSeriesMouseOver:le,zoomScaleExtend:ce,zoomTranslateExtend:ve,highlightedIds:A,onSeriesMouseClick:b,mapProperty:B,resetSelectionOnDoubleClick:E,detailsOnClick:S,showColorScale:de,styles:be,classNames:Ee,mapProjection:F,zoomInteraction:q,animate:k,dimmedOpacity:V,customLayers:me}=je,[ue,K]=d.useState(!(u<680)),[H,_]=d.useState(void 0),[h,Z]=d.useState(void 0),[G,Q]=d.useState(void 0),[pe,w]=d.useState(void 0),[C,ee]=d.useState(void 0),O=d.useRef(null),U=Be.useInView(O,{once:k.once,amount:k.amount}),xe=d.useRef(null),te=d.useRef(null);d.useEffect(()=>{const e=we.select(xe.current),n=we.select(O.current),r=o=>{if(q==="noZoom")return!1;if(q==="button")return!o.type.includes("wheel");const i=o.type==="wheel",m=o.type.startsWith("touch"),l=o.type==="mousedown"||o.type==="mousemove";return m?!0:i?q==="scroll"?!0:o.ctrlKey:l&&!o.button&&!o.ctrlKey},a=L.zoom().scaleExtent(ce).translateExtent(ve||[[-20,-20],[u+20,s+20]]).filter(r).on("zoom",({transform:o})=>{e.attr("transform",o)});n.call(a),te.current=a},[s,u,q]);const p=L.turf_bbox_default(f),g=Te.turf_center_of_mass_default(f),he=p[2]-p[0],re=p[3]-p[1],ge=u*190/960*360/he,I=s*190/678*180/re,P=J*Math.min(ge,I),c=F==="mercator"?L.geoMercator().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):F==="equalEarth"?L.geoEqualEarth().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):F==="naturalEarth"?L.geoNaturalEarth1().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):F==="orthographic"?L.geoOrthographic().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):L.geoAlbersUsa().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P),oe=Array.from({length:R.length},(e,n)=>n),ae=Array.from({length:T.length},(e,n)=>n),X=Me.threshold().domain(R).range(oe),ye=Me.threshold().domain(T).range(ae),N=e=>{if(!O.current||!te.current)return;we.select(O.current).call(te.current.scaleBy,e==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(ie.motion.svg,{viewBox:`0 0 ${u} ${s}`,width:`${u}px`,height:`${s}px`,ref:O,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:xe,children:[me.filter(e=>e.position==="before").map(e=>e.layer),f.features.map((e,n)=>v.findIndex(a=>a.id===e.properties[B])!==-1?null:t.jsxRuntimeExports.jsx(ie.motion.g,{opacity:H?V:A.length!==0?A.indexOf(e.properties[B])!==-1?1:V:1,children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((a,o)=>{let i="";return a.forEach(m=>{let l=" M";m.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==m.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),i+=l}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:W,fill:M}},o)}):e.geometry.coordinates.map((a,o)=>{let i="M";return a.forEach((m,l)=>{const x=c([m[0],m[1]]);l!==a.length-1?i=`${i}${x[0]} ${x[1]}L`:i=`${i}${x[0]} ${x[1]}`}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:W,fill:M}},o)})},n)),t.jsxRuntimeExports.jsx(Fe.AnimatePresence,{children:v.map(e=>{const n=f.features.findIndex(i=>e.id===i.properties[B]),r=De.checkIfNullOrUndefined(e.x)?void 0:X(e.x),a=De.checkIfNullOrUndefined(e.y)?void 0:ye(e.y),o=r!==void 0&&a!==void 0?Y[a][r]:M;return t.jsxRuntimeExports.jsx(ie.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:H?H===o?1:V:A.length!==0?A.indexOf(e.id)!==-1?1:V:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},onMouseEnter:i=>{Q(e),ee(i.clientY),w(i.clientX),le?.(e)},onClick:()=>{(b||S)&&(Le.isEqual(h,e)&&E?(Z(void 0),b?.(void 0)):(Z(e),b?.(e)))},onMouseMove:i=>{Q(e),ee(i.clientY),w(i.clientX)},onMouseLeave:()=>{Q(void 0),w(void 0),ee(void 0),le?.(void 0)},children:n===-1?null:f.features[n].geometry.type==="MultiPolygon"?f.features[n].geometry.coordinates.map((i,m)=>{let l="";return i.forEach(x=>{let y=" M";x.forEach((j,Oe)=>{const fe=c([j[0],j[1]]);Oe!==x.length-1?y=`${y}${fe[0]} ${fe[1]}L`:y=`${y}${fe[0]} ${fe[1]}`}),l+=y}),t.jsxRuntimeExports.jsx(ie.motion.path,{variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},d:l,className:`${o===M?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)}):f.features[n].geometry.coordinates.map((i,m)=>{let l="M";return i.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==i.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),t.jsxRuntimeExports.jsx(ie.motion.path,{d:l,variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},className:`${o===M?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)})},e.id)})}),G?f.features.filter(e=>e.properties[B]===G.id).map((e,n)=>t.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((r,a)=>{let o="";return r.forEach(i=>{let m=" M";i.forEach((l,x)=>{const y=c([l[0],l[1]]);x!==i.length-1?m=`${m}${y[0]} ${y[1]}L`:m=`${m}${y[0]} ${y[1]}`}),o+=m}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)}):e.geometry.coordinates.map((r,a)=>{let o="M";return r.forEach((i,m)=>{const l=c([i[0],i[1]]);m!==r.length-1?o=`${o}${l[0]} ${l[1]}L`:o=`${o}${l[0]} ${l[1]}`}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)})},n)):null,me.filter(e=>e.position==="after").map(e=>e.layer)]})}),de===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:ue?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{K(!1)},children:t.jsxRuntimeExports.jsx($e.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:"175px"},children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:t.jsxRuntimeExports.jsxs("g",{children:[Y.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-n*25})`,children:e.map((r,a)=>t.jsxRuntimeExports.jsx("rect",{y:1,x:a*25+1,fill:r,width:23,height:23,strokeWidth:H===r?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{_(r)},onMouseLeave:()=>{_(void 0)}},a))},n)),t.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:R.map((e,n)=>t.jsxRuntimeExports.jsx("text",{y:10,x:(n+1)*25,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")},n))}),T.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(R.length+1,5),4)*25+10},${100-n*25})`,children:t.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")})},n))]})}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:z})]}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:D})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{K(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>N("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>N("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),G&&se&&pe&&C?t.jsxRuntimeExports.jsx(We.Tooltip,{data:G,body:se,xPos:pe,yPos:C,backgroundStyle:be?.tooltip,className:Ee?.tooltip}):null,S&&h!==void 0?t.jsxRuntimeExports.jsx(ze.X,{open:h!==void 0,onClose:()=>{Z(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:Ae.string2HTML(S,h)}:void 0,children:typeof S=="function"?S(h):null})}):null]})}function Xe(je){const{data:v,graphTitle:R,mapData:f="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:D=Re.Colors.light.bivariateColors.colors05x05,sources:T,graphDescription:z,height:u,width:s,footNote:Y="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.",xDomain:J,yDomain:$,xColorLegendTitle:W="X Color key",yColorLegendTitle:M="Y Color key",tooltip:ne,scale:se=.95,centerPoint:le,padding:ce,mapBorderWidth:ve=.5,mapNoDataColor:A=Re.Colors.light.graphNoData,backgroundColor:b=!1,mapBorderColor:B=Re.Colors.light.grays["gray-500"],relativeHeight:E,onSeriesMouseOver:S,isWorldMap:de=!0,zoomScaleExtend:be=[.8,6],zoomTranslateExtend:Ee,graphID:F,showColorScale:q=!0,highlightedIds:k=[],onSeriesMouseClick:V,mapProperty:me="ISO3",graphDownload:ue=!1,dataDownload:K=!1,showAntarctica:H=!1,language:_="en",minHeight:h=0,theme:Z="light",ariaLabel:G,resetSelectionOnDoubleClick:Q=!0,detailsOnClick:pe,styles:w,classNames:C,mapProjection:ee,zoomInteraction:O="button",animate:U=!1,dimmedOpacity:xe=.3,customLayers:te=[],timeline:p={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=je,[g,he]=d.useState(0),[re,ge]=d.useState(0),[I,P]=d.useState(p.autoplay),c=ke.sort(Pe.uniqBy(v.filter(r=>r.date!==void 0&&r.date!==null),r=>r.date).map(r=>Ce.parse(`${r.date}`,p.dateFormat||"yyyy",new Date).getTime()),(r,a)=>Ge.ascending(r,a)),[oe,ae]=d.useState(p.autoplay?0:c.length-1),[X,ye]=d.useState(void 0),N=d.useRef(null),e=d.useRef(null);d.useEffect(()=>{const r=new ResizeObserver(a=>{he(s||a[0].contentRect.width||760),ge(u||a[0].target.clientHeight||480)});return N.current&&(ge(N.current.clientHeight||480),he(N.current.clientWidth||760),s||r.observe(N.current)),()=>r.disconnect()},[s,u]),d.useEffect(()=>{typeof f=="string"?_e.fetchAndParseJSON(f).then(a=>{ye(a)}):ye(f)},[f]),d.useEffect(()=>{const r=setInterval(()=>{ae(a=>a<c.length-1?a+1:0)},(p.speed||2)*1e3);return I||clearInterval(r),()=>clearInterval(r)},[c,I,p.speed]);const n=ke.getSliderMarks(c,oe,p.showOnlyActiveDate,p.dateFormat||"yyyy");return J&&$&&(J.length!==D[0].length-1||$.length!==D.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):t.jsxRuntimeExports.jsx("div",{className:`${Z||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:_==="he"||_==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${b?b===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${_||"en"}`,s?"w-fit":"w-full",C?.graphContainer),style:{...w?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:F,ref:e,"aria-label":G||`${R?`The graph shows ${R}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${z?` ${z}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?ce||"1rem":ce||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||z||ue||K?t.jsxRuntimeExports.jsx(Ve.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:C?.title,description:C?.description},graphTitle:R,graphDescription:z,width:s,graphDownload:ue?e.current:void 0,dataDownload:K?v.map(r=>r.data).filter(r=>r!==void 0).length>0?v.map(r=>r.data).filter(r=>r!==void 0):v.filter(r=>r!==void 0):null}):null,p.enabled&&c.length>0&&n?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{P(!I)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":I?"Click to pause animation":"Click to play animation",children:I?t.jsxRuntimeExports.jsx($e.Pause,{}):t.jsxRuntimeExports.jsx($e.Play,{})}),t.jsxRuntimeExports.jsx(ke.xr,{min:c[0],max:c[c.length-1],marks:n,step:null,defaultValue:c[c.length-1],value:c[oe],onChangeComplete:r=>{ae(c.indexOf(r))},onChange:r=>{ae(c.indexOf(r))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:N,"aria-label":"Map area",children:(s||g)&&(u||re)&&X?t.jsxRuntimeExports.jsx(Ue,{data:v.filter(r=>p.enabled?r.date===Ce.format(new Date(c[oe]),p.dateFormat||"yyyy"):r),mapData:H?X:{...X,features:X.features.filter(r=>r.properties.NAME!=="Antarctica")},xDomain:J||qe.getJenks(v.map(r=>r.x),D[0].length),yDomain:$||qe.getJenks(v.map(r=>r.y),D.length),width:s||g,height:Math.max(h,u||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re)),scale:se,centerPoint:le,colors:D,xColorLegendTitle:W,yColorLegendTitle:M,mapBorderWidth:ve,mapNoDataColor:A,mapBorderColor:B,tooltip:ne,onSeriesMouseOver:S,isWorldMap:de,zoomScaleExtend:be,zoomTranslateExtend:Ee,onSeriesMouseClick:V,mapProperty:me,highlightedIds:k,resetSelectionOnDoubleClick:Q,styles:w,showColorScale:q,classNames:C,mapProjection:ee||(de?"naturalEarth":"mercator"),detailsOnClick:pe,zoomInteraction:O,animate:U===!0?{duration:.5,once:!0,amount:.5}:U||{duration:0,once:!0,amount:0},dimmedOpacity:xe,customLayers:te}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,u||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Ie.y,{"aria-label":"Loading graph"})})}),T||Y?t.jsxRuntimeExports.jsx(He.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:T,footNote:Y,width:s}):null]})})})})}exports.BiVariateChoroplethMap=Xe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),u=require("react"),$e=require("./getSliderMarks-CRIbTGYV.cjs"),Ie=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./parse-hMnG_lRV.cjs"),Pe=require("./index-DQA8q5sC.cjs"),L=require("./zoom-Bsbhil-K.cjs"),Le=require("./index-D05lK1Te.cjs"),Te=require("./Modal-tXZlLE5s.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),ze=require("./Tooltip-De16GWhY.cjs"),We=require("./string2HTML-z7CwHXcx.cjs"),De=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Re=require("./index-BW_-wD2k.cjs"),ke=require("./select-Bnfk0lJx.cjs"),Me=require("./threshold-DNsSUf8Q.cjs"),Be=require("./use-in-view-sQJZ_xDO.cjs"),ae=require("./proxy-BHRoeZgd.cjs"),Ae=require("./index-BW8iNx7E.cjs"),Fe=require("./GraphHeader.cjs"),Ve=require("./GraphFooter.cjs"),we=require("./Colors.cjs"),He=require("./fetchAndParseData-Ba-_CgxS.cjs"),qe=require("./getJenks-GYmdwBqm.cjs"),_e=require("./uniqBy-O05lp2S5.cjs"),Ge=require("./sort-O96oMZLb.cjs"),Ue=require("./init-DU0ybBc_.cjs");function Xe(je){const{data:v,xDomain:R,mapData:f,xColorLegendTitle:D,yDomain:T,yColorLegendTitle:z,width:d,height:s,colors:Y,scale:J,centerPoint:$,mapBorderWidth:W,mapNoDataColor:M,mapBorderColor:ne,tooltip:se,onSeriesMouseOver:le,zoomScaleExtend:ce,zoomTranslateExtend:ve,highlightedIds:B,onSeriesMouseClick:b,mapProperty:A,resetSelectionOnDoubleClick:E,detailsOnClick:S,showColorScale:ue,styles:be,classNames:Ee,mapProjection:F,zoomInteraction:q,animate:k,dimmedOpacity:V,customLayers:me}=je,[de,K]=u.useState(!(d<680)),[H,_]=u.useState(void 0),[h,Z]=u.useState(void 0),[G,Q]=u.useState(void 0),[pe,w]=u.useState(void 0),[C,ee]=u.useState(void 0),O=u.useRef(null),U=Be.useInView(O,{once:k.once,amount:k.amount}),xe=u.useRef(null),te=u.useRef(null);u.useEffect(()=>{const e=ke.select(xe.current),n=ke.select(O.current),r=o=>{if(q==="noZoom")return!1;if(q==="button")return!o.type.includes("wheel");const a=o.type==="wheel",m=o.type.startsWith("touch"),l=o.type==="mousedown"||o.type==="mousemove";return m?!0:a?q==="scroll"?!0:o.ctrlKey:l&&!o.button&&!o.ctrlKey},i=L.zoom().scaleExtent(ce).translateExtent(ve||[[-20,-20],[d+20,s+20]]).filter(r).on("zoom",({transform:o})=>{e.attr("transform",o)});n.call(i),te.current=i},[s,d,q]);const p=L.turf_bbox_default(f),g=Le.turf_center_of_mass_default(f),he=p[2]-p[0],re=p[3]-p[1],ge=d*190/960*360/he,I=s*190/678*180/re,P=J*Math.min(ge,I),c=F==="mercator"?L.geoMercator().rotate([0,0]).center($||g.geometry.coordinates).translate([d/2,s/2]).scale(P):F==="equalEarth"?L.geoEqualEarth().rotate([0,0]).center($||g.geometry.coordinates).translate([d/2,s/2]).scale(P):F==="naturalEarth"?L.geoNaturalEarth1().rotate([0,0]).center($||g.geometry.coordinates).translate([d/2,s/2]).scale(P):F==="orthographic"?L.geoOrthographic().rotate([0,0]).center($||g.geometry.coordinates).translate([d/2,s/2]).scale(P):L.geoAlbersUsa().rotate([0,0]).center($||g.geometry.coordinates).translate([d/2,s/2]).scale(P),oe=Array.from({length:R.length},(e,n)=>n),ie=Array.from({length:T.length},(e,n)=>n),X=Me.threshold().domain(R).range(oe),ye=Me.threshold().domain(T).range(ie),N=e=>{if(!O.current||!te.current)return;ke.select(O.current).call(te.current.scaleBy,e==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(ae.motion.svg,{viewBox:`0 0 ${d} ${s}`,width:`${d}px`,height:`${s}px`,ref:O,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:xe,children:[me.filter(e=>e.position==="before").map(e=>e.layer),f.features.map((e,n)=>v.findIndex(i=>i.id===e.properties[A])!==-1?null:t.jsxRuntimeExports.jsx(ae.motion.g,{opacity:H?V:B.length!==0?B.indexOf(e.properties[A])!==-1?1:V:1,children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((i,o)=>{let a="";return i.forEach(m=>{let l=" M";m.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==m.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),a+=l}),t.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ne,strokeWidth:W,fill:M}},o)}):e.geometry.coordinates.map((i,o)=>{let a="M";return i.forEach((m,l)=>{const x=c([m[0],m[1]]);l!==i.length-1?a=`${a}${x[0]} ${x[1]}L`:a=`${a}${x[0]} ${x[1]}`}),t.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ne,strokeWidth:W,fill:M}},o)})},n)),t.jsxRuntimeExports.jsx(Ae.AnimatePresence,{children:v.map(e=>{const n=f.features.findIndex(a=>e.id===a.properties[A]),r=De.checkIfNullOrUndefined(e.x)?void 0:X(e.x),i=De.checkIfNullOrUndefined(e.y)?void 0:ye(e.y),o=r!==void 0&&i!==void 0?Y[i][r]:M;return t.jsxRuntimeExports.jsx(ae.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:H?H===o?1:V:B.length!==0?B.indexOf(e.id)!==-1?1:V:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},onMouseEnter:a=>{Q(e),ee(a.clientY),w(a.clientX),le?.(e)},onClick:()=>{(b||S)&&(Pe.isEqual(h,e)&&E?(Z(void 0),b?.(void 0)):(Z(e),b?.(e)))},onMouseMove:a=>{Q(e),ee(a.clientY),w(a.clientX)},onMouseLeave:()=>{Q(void 0),w(void 0),ee(void 0),le?.(void 0)},children:n===-1?null:f.features[n].geometry.type==="MultiPolygon"?f.features[n].geometry.coordinates.map((a,m)=>{let l="";return a.forEach(x=>{let y=" M";x.forEach((j,Oe)=>{const fe=c([j[0],j[1]]);Oe!==x.length-1?y=`${y}${fe[0]} ${fe[1]}L`:y=`${y}${fe[0]} ${fe[1]}`}),l+=y}),t.jsxRuntimeExports.jsx(ae.motion.path,{variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},d:l,className:`${o===M?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)}):f.features[n].geometry.coordinates.map((a,m)=>{let l="M";return a.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==a.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),t.jsxRuntimeExports.jsx(ae.motion.path,{d:l,variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},className:`${o===M?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)})},e.id)})}),G?f.features.filter(e=>e.properties[A]===G.id).map((e,n)=>t.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((r,i)=>{let o="";return r.forEach(a=>{let m=" M";a.forEach((l,x)=>{const y=c([l[0],l[1]]);x!==a.length-1?m=`${m}${y[0]} ${y[1]}L`:m=`${m}${y[0]} ${y[1]}`}),o+=m}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},i)}):e.geometry.coordinates.map((r,i)=>{let o="M";return r.forEach((a,m)=>{const l=c([a[0],a[1]]);m!==r.length-1?o=`${o}${l[0]} ${l[1]}L`:o=`${o}${l[0]} ${l[1]}`}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},i)})},n)):null,me.filter(e=>e.position==="after").map(e=>e.layer)]})}),ue===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:de?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{K(!1)},children:t.jsxRuntimeExports.jsx(Re.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:"175px"},children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:t.jsxRuntimeExports.jsxs("g",{children:[Y.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-n*25})`,children:e.map((r,i)=>t.jsxRuntimeExports.jsx("rect",{y:1,x:i*25+1,fill:r,width:23,height:23,strokeWidth:H===r?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{_(r)},onMouseLeave:()=>{_(void 0)}},i))},n)),t.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:R.map((e,n)=>t.jsxRuntimeExports.jsx("text",{y:10,x:(n+1)*25,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")},n))}),T.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(R.length+1,5),4)*25+10},${100-n*25})`,children:t.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")})},n))]})}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:z})]}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:D})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{K(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>N("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>N("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),G&&se&&pe&&C?t.jsxRuntimeExports.jsx(ze.Tooltip,{data:G,body:se,xPos:pe,yPos:C,backgroundStyle:be?.tooltip,className:Ee?.tooltip}):null,S&&h!==void 0?t.jsxRuntimeExports.jsx(Te.X,{open:h!==void 0,onClose:()=>{Z(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:We.string2HTML(S,h)}:void 0,children:typeof S=="function"?S(h):null})}):null]})}function Ye(je){const{data:v,graphTitle:R,mapData:f="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:D=we.Colors.light.bivariateColors.colors05x05,sources:T,graphDescription:z,height:d,width:s,footNote:Y="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.",xDomain:J,yDomain:$,xColorLegendTitle:W="X Color key",yColorLegendTitle:M="Y Color key",tooltip:ne,scale:se=.95,centerPoint:le,padding:ce,mapBorderWidth:ve=.5,mapNoDataColor:B=we.Colors.light.graphNoData,backgroundColor:b=!1,mapBorderColor:A=we.Colors.light.grays["gray-500"],relativeHeight:E,onSeriesMouseOver:S,isWorldMap:ue=!0,zoomScaleExtend:be=[.8,6],zoomTranslateExtend:Ee,graphID:F,showColorScale:q=!0,highlightedIds:k=[],onSeriesMouseClick:V,mapProperty:me="ISO3",graphDownload:de=!1,dataDownload:K=!1,showAntarctica:H=!1,language:_="en",minHeight:h=0,theme:Z="light",ariaLabel:G,resetSelectionOnDoubleClick:Q=!0,detailsOnClick:pe,styles:w,classNames:C,mapProjection:ee,zoomInteraction:O="button",animate:U=!1,dimmedOpacity:xe=.3,customLayers:te=[],timeline:p={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=je,[g,he]=u.useState(0),[re,ge]=u.useState(0),[I,P]=u.useState(p.autoplay),c=Ge.sort(_e.uniqBy(v,"date",!0).map(r=>Ce.parse(`${r}`,p.dateFormat||"yyyy",new Date).getTime()),(r,i)=>Ue.ascending(r,i)),[oe,ie]=u.useState(p.autoplay?0:c.length-1),[X,ye]=u.useState(void 0),N=u.useRef(null),e=u.useRef(null);u.useEffect(()=>{const r=new ResizeObserver(i=>{he(s||i[0].contentRect.width||760),ge(d||i[0].target.clientHeight||480)});return N.current&&(ge(N.current.clientHeight||480),he(N.current.clientWidth||760),s||r.observe(N.current)),()=>r.disconnect()},[s,d]),u.useEffect(()=>{typeof f=="string"?He.fetchAndParseJSON(f).then(i=>{ye(i)}):ye(f)},[f]),u.useEffect(()=>{const r=setInterval(()=>{ie(i=>i<c.length-1?i+1:0)},(p.speed||2)*1e3);return I||clearInterval(r),()=>clearInterval(r)},[c,I,p.speed]);const n=$e.getSliderMarks(c,oe,p.showOnlyActiveDate,p.dateFormat||"yyyy");return J&&$&&(J.length!==D[0].length-1||$.length!==D.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):t.jsxRuntimeExports.jsx("div",{className:`${Z||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:_==="he"||_==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${b?b===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${_||"en"}`,s?"w-fit":"w-full",C?.graphContainer),style:{...w?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:F,ref:e,"aria-label":G||`${R?`The graph shows ${R}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${z?` ${z}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?ce||"1rem":ce||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||z||de||K?t.jsxRuntimeExports.jsx(Fe.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:C?.title,description:C?.description},graphTitle:R,graphDescription:z,width:s,graphDownload:de?e.current:void 0,dataDownload:K?v.map(r=>r.data).filter(r=>r!==void 0).length>0?v.map(r=>r.data).filter(r=>r!==void 0):v.filter(r=>r!==void 0):null}):null,p.enabled&&c.length>0&&n?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{P(!I)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":I?"Click to pause animation":"Click to play animation",children:I?t.jsxRuntimeExports.jsx(Re.Pause,{}):t.jsxRuntimeExports.jsx(Re.Play,{})}),t.jsxRuntimeExports.jsx($e.xr,{min:c[0],max:c[c.length-1],marks:n,step:null,defaultValue:c[c.length-1],value:c[oe],onChangeComplete:r=>{ie(c.indexOf(r))},onChange:r=>{ie(c.indexOf(r))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:N,"aria-label":"Map area",children:(s||g)&&(d||re)&&X?t.jsxRuntimeExports.jsx(Xe,{data:v.filter(r=>p.enabled?r.date===Ce.format(new Date(c[oe]),p.dateFormat||"yyyy"):r),mapData:H?X:{...X,features:X.features.filter(r=>r.properties.NAME!=="Antarctica")},xDomain:J||qe.getJenks(v.map(r=>r.x),D[0].length),yDomain:$||qe.getJenks(v.map(r=>r.y),D.length),width:s||g,height:Math.max(h,d||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re)),scale:se,centerPoint:le,colors:D,xColorLegendTitle:W,yColorLegendTitle:M,mapBorderWidth:ve,mapNoDataColor:B,mapBorderColor:A,tooltip:ne,onSeriesMouseOver:S,isWorldMap:ue,zoomScaleExtend:be,zoomTranslateExtend:Ee,onSeriesMouseClick:V,mapProperty:me,highlightedIds:k,resetSelectionOnDoubleClick:Q,styles:w,showColorScale:q,classNames:C,mapProjection:ee||(ue?"naturalEarth":"mercator"),detailsOnClick:pe,zoomInteraction:O,animate:U===!0?{duration:.5,once:!0,amount:.5}:U||{duration:0,once:!0,amount:0},dimmedOpacity:xe,customLayers:te}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,d||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Ie.y,{"aria-label":"Loading graph"})})}),T||Y?t.jsxRuntimeExports.jsx(Ve.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:T,footNote:Y,width:s}):null]})})})})}exports.BiVariateChoroplethMap=Ye;
2
2
  //# sourceMappingURL=BiVariateChoroplethMap.cjs.map