@undp/data-viz 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/BarGraph.cjs +1 -1
  2. package/dist/BarGraph.cjs.map +1 -1
  3. package/dist/BarGraph.js +650 -648
  4. package/dist/BarGraph.js.map +1 -1
  5. package/dist/BulletChart.cjs +1 -1
  6. package/dist/BulletChart.cjs.map +1 -1
  7. package/dist/BulletChart.js +210 -208
  8. package/dist/BulletChart.js.map +1 -1
  9. package/dist/ButterflyChart.cjs +1 -1
  10. package/dist/ButterflyChart.cjs.map +1 -1
  11. package/dist/ButterflyChart.js +42 -40
  12. package/dist/ButterflyChart.js.map +1 -1
  13. package/dist/DifferenceLineChart.cjs +1 -1
  14. package/dist/DifferenceLineChart.cjs.map +1 -1
  15. package/dist/DifferenceLineChart.js +122 -120
  16. package/dist/DifferenceLineChart.js.map +1 -1
  17. package/dist/DualAxisLineChart.cjs +1 -1
  18. package/dist/DualAxisLineChart.cjs.map +1 -1
  19. package/dist/DualAxisLineChart.js +133 -113
  20. package/dist/DualAxisLineChart.js.map +1 -1
  21. package/dist/DumbbellChart.cjs +1 -1
  22. package/dist/DumbbellChart.cjs.map +1 -1
  23. package/dist/DumbbellChart.js +274 -274
  24. package/dist/DumbbellChart.js.map +1 -1
  25. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  26. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  27. package/dist/LineChartWithConfidenceInterval.js +194 -174
  28. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  29. package/dist/MultiLineAltChart.cjs +1 -1
  30. package/dist/MultiLineAltChart.cjs.map +1 -1
  31. package/dist/MultiLineAltChart.js +160 -161
  32. package/dist/MultiLineAltChart.js.map +1 -1
  33. package/dist/MultiLineChart.cjs +1 -1
  34. package/dist/MultiLineChart.cjs.map +1 -1
  35. package/dist/MultiLineChart.js +77 -66
  36. package/dist/MultiLineChart.js.map +1 -1
  37. package/dist/ParetoChart.cjs +1 -1
  38. package/dist/ParetoChart.cjs.map +1 -1
  39. package/dist/ParetoChart.js +166 -161
  40. package/dist/ParetoChart.js.map +1 -1
  41. package/dist/RadarChart.cjs +1 -1
  42. package/dist/RadarChart.cjs.map +1 -1
  43. package/dist/RadarChart.js +253 -241
  44. package/dist/RadarChart.js.map +1 -1
  45. package/dist/{RegressionLine-mH7UKOPi.js → RegressionLine-C2--oMQq.js} +10 -9
  46. package/dist/RegressionLine-C2--oMQq.js.map +1 -0
  47. package/dist/RegressionLine-Dj0GSiAp.cjs +2 -0
  48. package/dist/RegressionLine-Dj0GSiAp.cjs.map +1 -0
  49. package/dist/ScatterPlot.cjs +1 -1
  50. package/dist/ScatterPlot.cjs.map +1 -1
  51. package/dist/ScatterPlot.js +130 -129
  52. package/dist/ScatterPlot.js.map +1 -1
  53. package/dist/SimpleLineChart.cjs +1 -1
  54. package/dist/SimpleLineChart.cjs.map +1 -1
  55. package/dist/SimpleLineChart.js +43 -38
  56. package/dist/SimpleLineChart.js.map +1 -1
  57. package/dist/SlopeChart.cjs +1 -1
  58. package/dist/SlopeChart.cjs.map +1 -1
  59. package/dist/SlopeChart.js +113 -109
  60. package/dist/SlopeChart.js.map +1 -1
  61. package/dist/StripChart.cjs +1 -1
  62. package/dist/StripChart.cjs.map +1 -1
  63. package/dist/StripChart.js +282 -270
  64. package/dist/StripChart.js.map +1 -1
  65. package/dist/ThreeDGlobe.cjs +1 -1
  66. package/dist/ThreeDGlobe.cjs.map +1 -1
  67. package/dist/ThreeDGlobe.js +284 -349
  68. package/dist/ThreeDGlobe.js.map +1 -1
  69. package/dist/UnitChart.cjs +1 -1
  70. package/dist/UnitChart.cjs.map +1 -1
  71. package/dist/UnitChart.js +20 -21
  72. package/dist/UnitChart.js.map +1 -1
  73. package/dist/getCentroidCoordinates-Dfk6IqEG.js +70 -0
  74. package/dist/getCentroidCoordinates-Dfk6IqEG.js.map +1 -0
  75. package/dist/getCentroidCoordinates-DxTBqzp2.cjs +2 -0
  76. package/dist/getCentroidCoordinates-DxTBqzp2.cjs.map +1 -0
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.d.ts +7 -0
  79. package/dist/index.js +34 -32
  80. package/dist/index.js.map +1 -1
  81. package/dist/utils.cjs +1 -1
  82. package/dist/utils.d.ts +8 -0
  83. package/dist/utils.js +16 -14
  84. package/dist/utils.js.map +1 -1
  85. package/package.json +1 -1
  86. package/dist/RegressionLine-mH7UKOPi.js.map +0 -1
  87. package/dist/RegressionLine-xKdiJ8sw.cjs +0 -2
  88. package/dist/RegressionLine-xKdiJ8sw.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RadarChart.js","sources":["../node_modules/d3-shape/src/curve/radial.js","../node_modules/d3-shape/src/lineRadial.js","../node_modules/d3-shape/src/noop.js","../node_modules/d3-shape/src/curve/cardinal.js","../node_modules/d3-shape/src/curve/cardinalClosed.js","../node_modules/d3-shape/src/curve/linearClosed.js","../src/Components/Graphs/RadarChart/Graph.tsx","../src/Components/Graphs/RadarChart/index.tsx"],"sourcesContent":["import curveLinear from \"./linear.js\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nexport default function curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport line from \"./line.js\";\n\nexport function lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nexport default function() {\n return lineRadial(line().curve(curveRadialLinear));\n}\n","export default function() {}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { lineRadial, curveLinearClosed, curveCardinalClosed } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { scaleLinear } from 'd3-scale';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n RadarChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\n\r\ninterface Props {\r\n radius: number;\r\n lineColors: string[];\r\n axisLabels: (string | number)[];\r\n data: RadarChartDataType[];\r\n\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n selectedColor?: string;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n strokeWidth: number;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n showValues: boolean;\r\n showDots: boolean;\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n curveType: 'linear' | 'curve';\r\n noOfTicks: number;\r\n maxValue?: number;\r\n minValue?: number;\r\n fillShape: boolean;\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\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 radius,\r\n lineColors,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n selectedColor,\r\n axisLabels,\r\n strokeWidth,\r\n showValues,\r\n showDots,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n leftMargin,\r\n curveType,\r\n noOfTicks,\r\n minValue,\r\n maxValue,\r\n resetSelectionOnDoubleClick,\r\n fillShape,\r\n highlightedLines,\r\n animate,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const curve = curveType === 'linear' ? curveLinearClosed : curveCardinalClosed;\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 radiusWithoutMargin = Math.min(\r\n (2 * radius - leftMargin - rightMargin) / 2,\r\n (2 * radius - topMargin - bottomMargin) / 2,\r\n );\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const angleScale = scaleLinear()\r\n .domain([0, data[0].values.length])\r\n .range([0, 2 * Math.PI]);\r\n\r\n const maxVal = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n\r\n const minVal = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) >= 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n const scale = scaleLinear().domain([minVal, maxVal]).range([0, radiusWithoutMargin]).nice();\r\n const ticksArray = scale.ticks(noOfTicks);\r\n const lineShape = lineRadial<number>()\r\n .radius(d => scale(d))\r\n .angle((_, i) => angleScale(i))\r\n .curve(curve);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g transform={`translate(${radiusWithoutMargin},${radiusWithoutMargin})`}>\r\n {axisLabels.map((d, i) => (\r\n <g key={i}>\r\n <line\r\n x1={0}\r\n y1={0}\r\n x2={Math.cos(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n y2={Math.sin(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n key={i}\r\n className={cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.axis,\r\n )}\r\n style={styles?.xAxis?.axis}\r\n />\r\n <text\r\n x={Math.cos(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n y={Math.sin(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n style={{\r\n textAnchor:\r\n Math.cos(angleScale(i) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n ...(styles?.xAxis?.labels || ''),\r\n }}\r\n dy={\r\n Math.sin(angleScale(i) - Math.PI / 2) < 0\r\n ? 0\r\n : Math.sin(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 5\r\n : 10\r\n }\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.xAxis?.labels,\r\n )}\r\n >\r\n {d}\r\n </text>\r\n </g>\r\n ))}\r\n {ticksArray.map((d, i) => (\r\n <g key={i}>\r\n <path\r\n d={lineShape(Array(axisLabels.length).fill(d)) || ''}\r\n className={cn(\r\n 'stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.gridLines,\r\n )}\r\n style={{\r\n ...styles?.xAxis?.gridLines,\r\n fill: 'none',\r\n }}\r\n />\r\n <foreignObject\r\n x={-25}\r\n y={\r\n Math.sin(-Math.PI / 2) * scale(d) > -0.0001\r\n ? Math.sin(-Math.PI / 2) * scale(d) - 7\r\n : Math.sin(-Math.PI / 2) * scale(d) - 5\r\n }\r\n width={50}\r\n height={12}\r\n >\r\n <div className='flex justify-center'>\r\n <p\r\n className={cn(\r\n 'fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700',\r\n classNames?.xAxis?.labels,\r\n )}\r\n style={styles?.xAxis?.labels}\r\n >\r\n {numberFormattingFunction(d, 'NA', precision)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ))}\r\n <AnimatePresence>\r\n {data.map((d, i) => (\r\n <motion.g\r\n key={d.label || i}\r\n variants={{\r\n initial: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : 0.3\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.path\r\n d={lineShape(d.values) || ''}\r\n variants={{\r\n initial: { d: lineShape(d.values.map(_el => 0)) || '' },\r\n whileInView: {\r\n d: lineShape(d.values) || '',\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n fill: fillShape\r\n ? data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)]\r\n : 'none',\r\n fillOpacity: 0.1,\r\n strokeWidth,\r\n }}\r\n />\r\n <g>\r\n {d.values.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n cx={Math.cos(angleScale(j) - Math.PI / 2) * scale(el)}\r\n cy={Math.sin(angleScale(j) - Math.PI / 2) * scale(el)}\r\n r={4}\r\n style={{\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n }}\r\n variants={{\r\n initial: { cx: 0, cy: 0, opacity: 0 },\r\n whileInView: {\r\n cx: Math.cos(angleScale(j) - Math.PI / 2) * scale(el),\r\n cy: Math.sin(angleScale(j) - Math.PI / 2) * scale(el),\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n x={Math.cos(angleScale(j) - Math.PI / 2) * (scale(el) + 6)}\r\n y={Math.sin(angleScale(j) - Math.PI / 2) * (scale(el) + 6)}\r\n style={{\r\n fill: lineColors[i],\r\n textAnchor:\r\n Math.cos(angleScale(j) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n dy={\r\n Math.sin(angleScale(j) - Math.PI / 2) < 0\r\n ? 10\r\n : Math.sin(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 0\r\n : 0\r\n }\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n </g>\r\n </motion.g>\r\n ))}\r\n </AnimatePresence>\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n RadarChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: RadarChartDataType[];\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 each line */\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 /** Radius of the radar chart */\r\n radius?: number;\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 chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle is the shape is filled or not */\r\n fillShape?: boolean;\r\n /** No. of ticks on the x-axis */\r\n noOfTicks?: number;\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 highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the axes */\r\n axisLabels: (string | number)[];\r\n /** Curve type for the line */\r\n curveType?: 'linear' | 'curve';\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** 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 RadarChart(props: Props) {\r\n const {\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n topMargin = 75,\r\n bottomMargin = 75,\r\n leftMargin = 75,\r\n rightMargin = 75,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n language = 'en',\r\n theme = 'light',\r\n highlightedLines = [],\r\n width,\r\n height,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n relativeHeight,\r\n ariaLabel,\r\n colorLegendTitle,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n showNAColor = true,\r\n axisLabels,\r\n showDots = true,\r\n showValues = false,\r\n curveType = 'curve',\r\n noOfTicks = 5,\r\n minValue,\r\n maxValue,\r\n fillShape = false,\r\n resetSelectionOnDoubleClick = true,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\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 || 420);\r\n setSvgHeight(height || entries[0].target.clientHeight || 420);\r\n setGraphRadius(\r\n (Math.min(\r\n ...[\r\n width || entries[0].target.clientWidth || 620,\r\n height || entries[0].target.clientHeight || 480,\r\n ],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 420);\r\n setSvgWidth(graphDiv.current.clientWidth || 420);\r\n setGraphRadius(\r\n (Math.min(...[graphDiv.current.clientWidth, graphDiv.current.clientHeight]) || 420) / 2,\r\n );\r\n if (!width || !radius) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height, radius]);\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 minHeight: 'inherit',\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 donut or pie chart chart. ${graphDescription ? ` ${graphDescription}` : ''}`\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 gap-2 w-full 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\r\n className='flex grow flex-col justify-center items-stretch gap-8 flex-wrap'\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n }}\r\n >\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={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 ${\r\n width ? 'grow-0' : 'grow'\r\n } items-center justify-center leading-0`}\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n height: height\r\n ? `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`\r\n : 'auto',\r\n }}\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n <div className='w-full flex justify-center leading-0'>\r\n {radius || graphRadius ? (\r\n <Graph\r\n data={data}\r\n lineColors={\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 radius={radius || graphRadius}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n selectedColor={selectedColor}\r\n axisLabels={axisLabels}\r\n strokeWidth={strokeWidth}\r\n showValues={showValues}\r\n showDots={showDots}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n curveType={curveType}\r\n noOfTicks={noOfTicks}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n fillShape={fillShape}\r\n highlightedLines={highlightedLines}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\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 ) : (\r\n <div />\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["curveRadialLinear","curveRadial","curveLinear","Radial","curve","a","r","radial","context","lineRadial","l","c","_","lineRadial$1","line","noop","point","that","x","y","Cardinal","tension","custom","cardinal","CardinalClosed","curveCardinalClosed","LinearClosed","curveLinearClosed","Graph","props","data","radius","lineColors","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","detailsOnClick","styles","classNames","selectedColor","axisLabels","strokeWidth","showValues","showDots","rightMargin","topMargin","bottomMargin","leftMargin","curveType","noOfTicks","minValue","maxValue","resetSelectionOnDoubleClick","fillShape","highlightedLines","animate","dimmedOpacity","precision","customLayers","svgRef","useRef","isInView","useInView","margin","radiusWithoutMargin","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","angleScale","scaleLinear","maxVal","checkIfNullOrUndefined","d","minVal","scale","ticksArray","lineShape","i","jsxs","Fragment","jsx","motion","cn","numberFormattingFunction","AnimatePresence","event","isEqual","_el","el","Colors","j","Tooltip","Modal","string2HTML","RadarChart","graphTitle","colors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorLegendTitle","showNAColor","graphRadius","setGraphRadius","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter"],"mappings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,OAAA,CAAA,CAAI;AAAA,cAAA,EAAA,CAET;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"RadarChart.js","sources":["../node_modules/d3-shape/src/curve/radial.js","../node_modules/d3-shape/src/lineRadial.js","../node_modules/d3-shape/src/noop.js","../node_modules/d3-shape/src/curve/cardinal.js","../node_modules/d3-shape/src/curve/cardinalClosed.js","../node_modules/d3-shape/src/curve/linearClosed.js","../src/Components/Graphs/RadarChart/Graph.tsx","../src/Components/Graphs/RadarChart/index.tsx"],"sourcesContent":["import curveLinear from \"./linear.js\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nexport default function curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport line from \"./line.js\";\n\nexport function lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nexport default function() {\n return lineRadial(line().curve(curveRadialLinear));\n}\n","export default function() {}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { lineRadial, curveLinearClosed, curveCardinalClosed } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { scaleLinear } from 'd3-scale';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n RadarChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\n\r\ninterface Props {\r\n radius: number;\r\n lineColors: string[];\r\n axisLabels: (string | number)[];\r\n data: RadarChartDataType[];\r\n\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n selectedColor?: string;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n strokeWidth: number;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n showValues: boolean;\r\n showDots: boolean;\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n curveType: 'linear' | 'curve';\r\n noOfTicks: number;\r\n maxValue?: number;\r\n minValue?: number;\r\n fillShape: boolean;\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\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 radius,\r\n lineColors,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n selectedColor,\r\n axisLabels,\r\n strokeWidth,\r\n showValues,\r\n showDots,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n leftMargin,\r\n curveType,\r\n noOfTicks,\r\n minValue,\r\n maxValue,\r\n resetSelectionOnDoubleClick,\r\n fillShape,\r\n highlightedLines,\r\n animate,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const curve = curveType === 'linear' ? curveLinearClosed : curveCardinalClosed;\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 radiusWithoutMargin = Math.min(\r\n (2 * radius - leftMargin - rightMargin) / 2,\r\n (2 * radius - topMargin - bottomMargin) / 2,\r\n );\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const angleScale = scaleLinear()\r\n .domain([0, data[0].values.length])\r\n .range([0, 2 * Math.PI]);\r\n\r\n const maxVal = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n\r\n const minVal = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) >= 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n const scale = scaleLinear().domain([minVal, maxVal]).range([0, radiusWithoutMargin]).nice();\r\n const ticksArray = scale.ticks(noOfTicks);\r\n const lineShape = lineRadial<number>()\r\n .radius(d => scale(d))\r\n .angle((_, i) => angleScale(i))\r\n .curve(curve);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g transform={`translate(${radiusWithoutMargin},${radiusWithoutMargin})`}>\r\n {axisLabels.map((d, i) => (\r\n <g key={i}>\r\n <line\r\n x1={0}\r\n y1={0}\r\n x2={Math.cos(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n y2={Math.sin(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n key={i}\r\n className={cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.axis,\r\n )}\r\n style={styles?.xAxis?.axis}\r\n />\r\n <text\r\n x={Math.cos(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n y={Math.sin(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n style={{\r\n textAnchor:\r\n Math.cos(angleScale(i) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n ...(styles?.xAxis?.labels || ''),\r\n }}\r\n dy={\r\n Math.sin(angleScale(i) - Math.PI / 2) < 0\r\n ? 0\r\n : Math.sin(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 5\r\n : 10\r\n }\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.xAxis?.labels,\r\n )}\r\n >\r\n {d}\r\n </text>\r\n </g>\r\n ))}\r\n {ticksArray.map((d, i) => (\r\n <g key={i}>\r\n <path\r\n d={lineShape(Array(axisLabels.length).fill(d)) || ''}\r\n className={cn(\r\n 'stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.gridLines,\r\n )}\r\n style={{\r\n ...styles?.xAxis?.gridLines,\r\n fill: 'none',\r\n }}\r\n />\r\n <foreignObject\r\n x={-25}\r\n y={\r\n Math.sin(-Math.PI / 2) * scale(d) > -0.0001\r\n ? Math.sin(-Math.PI / 2) * scale(d) - 7\r\n : Math.sin(-Math.PI / 2) * scale(d) - 5\r\n }\r\n width={50}\r\n height={12}\r\n >\r\n <div className='flex justify-center'>\r\n <p\r\n className={cn(\r\n 'fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700',\r\n classNames?.xAxis?.labels,\r\n )}\r\n style={styles?.xAxis?.labels}\r\n >\r\n {numberFormattingFunction(d, 'NA', precision)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ))}\r\n <AnimatePresence>\r\n {data.map((d, i) => (\r\n <motion.g\r\n key={d.label || i}\r\n variants={{\r\n initial: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : 0.3\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.path\r\n d={lineShape(d.values) || ''}\r\n variants={{\r\n initial: {\r\n d: lineShape(d.values.map(_el => 0)) || '',\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n fill: fillShape\r\n ? data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)]\r\n : 'none',\r\n strokeWidth,\r\n },\r\n whileInView: {\r\n d: lineShape(d.values) || '',\r\n transition: { duration: animate.duration },\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n fill: fillShape\r\n ? data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)]\r\n : 'none',\r\n strokeWidth,\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n fillOpacity: 0.1,\r\n }}\r\n />\r\n <g>\r\n {d.values.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={4}\r\n variants={{\r\n initial: {\r\n cx: 0,\r\n cy: 0,\r\n opacity: 0,\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n },\r\n whileInView: {\r\n cx: Math.cos(angleScale(j) - Math.PI / 2) * scale(el),\r\n cy: Math.sin(angleScale(j) - Math.PI / 2) * scale(el),\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n style={{\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n dy={\r\n Math.sin(angleScale(j) - Math.PI / 2) < 0\r\n ? 10\r\n : Math.sin(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 0\r\n : 0\r\n }\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: Math.cos(angleScale(j) - Math.PI / 2) * (scale(el) + 6),\r\n y: Math.sin(angleScale(j) - Math.PI / 2) * (scale(el) + 6),\r\n fill: lineColors[i],\r\n textAnchor:\r\n Math.cos(angleScale(j) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: Math.cos(angleScale(j) - Math.PI / 2) * (scale(el) + 6),\r\n y: Math.sin(angleScale(j) - Math.PI / 2) * (scale(el) + 6),\r\n fill: lineColors[i],\r\n textAnchor:\r\n Math.cos(angleScale(j) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n </g>\r\n </motion.g>\r\n ))}\r\n </AnimatePresence>\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n RadarChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: RadarChartDataType[];\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 each line */\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 /** Radius of the radar chart */\r\n radius?: number;\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 chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle is the shape is filled or not */\r\n fillShape?: boolean;\r\n /** No. of ticks on the x-axis */\r\n noOfTicks?: number;\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 highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the axes */\r\n axisLabels: (string | number)[];\r\n /** Curve type for the line */\r\n curveType?: 'linear' | 'curve';\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n /** 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 RadarChart(props: Props) {\r\n const {\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n topMargin = 75,\r\n bottomMargin = 75,\r\n leftMargin = 75,\r\n rightMargin = 75,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n language = 'en',\r\n theme = 'light',\r\n highlightedLines = [],\r\n width,\r\n height,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n relativeHeight,\r\n ariaLabel,\r\n colorLegendTitle,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n showNAColor = true,\r\n axisLabels,\r\n showDots = true,\r\n showValues = false,\r\n curveType = 'curve',\r\n noOfTicks = 5,\r\n minValue,\r\n maxValue,\r\n fillShape = false,\r\n resetSelectionOnDoubleClick = true,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\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 || 420);\r\n setSvgHeight(height || entries[0].target.clientHeight || 420);\r\n setGraphRadius(\r\n (Math.min(\r\n ...[\r\n width || entries[0].target.clientWidth || 620,\r\n height || entries[0].target.clientHeight || 480,\r\n ],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 420);\r\n setSvgWidth(graphDiv.current.clientWidth || 420);\r\n setGraphRadius(\r\n (Math.min(...[graphDiv.current.clientWidth, graphDiv.current.clientHeight]) || 420) / 2,\r\n );\r\n if (!width || !radius) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height, radius]);\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 minHeight: 'inherit',\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 donut or pie chart chart. ${graphDescription ? ` ${graphDescription}` : ''}`\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 gap-2 w-full 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\r\n className='flex grow flex-col justify-center items-stretch gap-8 flex-wrap'\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n }}\r\n >\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={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 ${\r\n width ? 'grow-0' : 'grow'\r\n } items-center justify-center leading-0`}\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n height: height\r\n ? `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`\r\n : 'auto',\r\n }}\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n <div className='w-full flex justify-center leading-0'>\r\n {radius || graphRadius ? (\r\n <Graph\r\n data={data}\r\n lineColors={\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 radius={radius || graphRadius}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n selectedColor={selectedColor}\r\n axisLabels={axisLabels}\r\n strokeWidth={strokeWidth}\r\n showValues={showValues}\r\n showDots={showDots}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n curveType={curveType}\r\n noOfTicks={noOfTicks}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n fillShape={fillShape}\r\n highlightedLines={highlightedLines}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\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 ) : (\r\n <div />\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["curveRadialLinear","curveRadial","curveLinear","Radial","curve","a","r","radial","context","lineRadial","l","c","_","lineRadial$1","line","noop","point","that","x","y","Cardinal","tension","custom","cardinal","CardinalClosed","curveCardinalClosed","LinearClosed","curveLinearClosed","Graph","props","data","radius","lineColors","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","detailsOnClick","styles","classNames","selectedColor","axisLabels","strokeWidth","showValues","showDots","rightMargin","topMargin","bottomMargin","leftMargin","curveType","noOfTicks","minValue","maxValue","resetSelectionOnDoubleClick","fillShape","highlightedLines","animate","dimmedOpacity","precision","customLayers","svgRef","useRef","isInView","useInView","margin","radiusWithoutMargin","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","angleScale","scaleLinear","maxVal","checkIfNullOrUndefined","d","minVal","scale","ticksArray","lineShape","i","jsxs","Fragment","jsx","motion","cn","numberFormattingFunction","AnimatePresence","event","isEqual","_el","el","Colors","j","Tooltip","Modal","string2HTML","RadarChart","graphTitle","colors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorLegendTitle","showNAColor","graphRadius","setGraphRadius","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,IAAIA,KAAoBC,GAAYC,EAAW;AAEtD,SAASC,GAAOC,GAAO;AACrB,OAAK,SAASA;AAChB;AAEAD,GAAO,YAAY;AAAA,EACjB,WAAW,WAAW;AACpB,SAAK,OAAO,UAAS;AAAA,EACvB;AAAA,EACA,SAAS,WAAW;AAClB,SAAK,OAAO,QAAO;AAAA,EACrB;AAAA,EACA,WAAW,WAAW;AACpB,SAAK,OAAO,UAAS;AAAA,EACvB;AAAA,EACA,SAAS,WAAW;AAClB,SAAK,OAAO,QAAO;AAAA,EACrB;AAAA,EACA,OAAO,SAASE,GAAGC,GAAG;AACpB,SAAK,OAAO,MAAMA,IAAI,KAAK,IAAID,CAAC,GAAGC,IAAI,CAAC,KAAK,IAAID,CAAC,CAAC;AAAA,EACrD;AACF;AAEe,SAASJ,GAAYG,GAAO;AAEzC,WAASG,EAAOC,GAAS;AACvB,WAAO,IAAIL,GAAOC,EAAMI,CAAO,CAAC;AAAA,EAClC;AAEA,SAAAD,EAAO,SAASH,GAETG;AACT;AChCO,SAASE,GAAWC,GAAG;AAC5B,MAAIC,IAAID,EAAE;AAEV,SAAAA,EAAE,QAAQA,EAAE,GAAG,OAAOA,EAAE,GACxBA,EAAE,SAASA,EAAE,GAAG,OAAOA,EAAE,GAEzBA,EAAE,QAAQ,SAASE,GAAG;AACpB,WAAO,UAAU,SAASD,EAAEV,GAAYW,CAAC,CAAC,IAAID,EAAC,EAAG;AAAA,EACpD,GAEOD;AACT;AAEe,SAAAG,KAAW;AACxB,SAAOJ,GAAWK,GAAI,EAAG,MAAMd,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eg.js";
4
4
  import { m as u } from "./proxy-CkpFesk1.js";
5
5
  function R(s) {
6
- const { color: t, x1: r, x2: o, y1: n, y2: l, className: m, style: d, animate: e, isInView: c, graphWidth: h, graphHeight: p } = s, a = g(8);
6
+ const { color: t, x1: r, x2: o, y1: e, y2: l, className: m, style: d, animate: n, isInView: c, graphWidth: h, graphHeight: p } = s, a = g(8);
7
7
  return /* @__PURE__ */ i.jsxs("g", { children: [
8
8
  /* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx("clipPath", { id: a, children: /* @__PURE__ */ i.jsx("rect", { x: "0", y: "0", width: h, height: p }) }) }),
9
9
  /* @__PURE__ */ i.jsx(y, { children: /* @__PURE__ */ i.jsx(
@@ -16,24 +16,25 @@ function R(s) {
16
16
  m
17
17
  ),
18
18
  style: {
19
- ...t && { stroke: t },
20
19
  fill: "none",
21
20
  ...d || {}
22
21
  },
23
- exit: { opacity: 0, transition: { duration: e.duration } },
22
+ exit: { opacity: 0, transition: { duration: n.duration } },
24
23
  variants: {
25
24
  initial: {
26
- y1: n,
27
- y2: n,
25
+ y1: e,
26
+ y2: e,
28
27
  x1: r,
29
- x2: r
28
+ x2: r,
29
+ ...t && { stroke: t }
30
30
  },
31
31
  whileInView: {
32
- y1: n,
32
+ y1: e,
33
33
  y2: l,
34
34
  x1: r,
35
35
  x2: o,
36
- transition: { duration: e.duration }
36
+ ...t && { stroke: t },
37
+ transition: { duration: n.duration }
37
38
  }
38
39
  },
39
40
  initial: "initial",
@@ -45,4 +46,4 @@ function R(s) {
45
46
  export {
46
47
  R
47
48
  };
48
- //# sourceMappingURL=RegressionLine-mH7UKOPi.js.map
49
+ //# sourceMappingURL=RegressionLine-C2--oMQq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegressionLine-C2--oMQq.js","sources":["../src/Components/Elements/RegressionLine.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { AnimatePresence, motion } from 'motion/react';\r\n\r\nimport { AnimateDataType } from '@/Types';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n color?: string;\r\n y1: number;\r\n y2: number;\r\n x1: number;\r\n x2: number;\r\n graphWidth: number;\r\n graphHeight: number;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n animate: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RegressionLine(props: Props) {\r\n const { color, x1, x2, y1, y2, className, style, animate, isInView, graphWidth, graphHeight } =\r\n props;\r\n const id = generateRandomString(8);\r\n return (\r\n <g>\r\n <defs>\r\n <clipPath id={id}>\r\n <rect x='0' y='0' width={graphWidth} height={graphHeight} />\r\n </clipPath>\r\n </defs>\r\n <AnimatePresence>\r\n <motion.line\r\n clipPath={`url(#${id})`}\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n className,\r\n )}\r\n style={{\r\n fill: 'none',\r\n ...(style || {}),\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n y1,\r\n y2: y1,\r\n x1,\r\n x2: x1,\r\n ...(color && { stroke: color }),\r\n },\r\n whileInView: {\r\n y1,\r\n y2,\r\n x1,\r\n x2,\r\n ...(color && { stroke: color }),\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </AnimatePresence>\r\n </g>\r\n );\r\n}\r\n"],"names":["RegressionLine","props","color","x1","x2","y1","y2","className","style","animate","isInView","graphWidth","graphHeight","id","generateRandomString","jsx","AnimatePresence","motion","cn"],"mappings":";;;;AAoBO,SAASA,EAAeC,GAAc;AAC3C,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,IAAAC,GAAI,IAAAC,GAAI,IAAAC,GAAI,WAAAC,GAAW,OAAAC,GAAO,SAAAC,GAAS,UAAAC,GAAU,YAAAC,GAAY,aAAAC,EAAA,IAC9EX,GACIY,IAAKC,EAAqB,CAAC;AACjC,gCACG,KAAA,EACC,UAAA;AAAA,IAAAC,gBAAAA,MAAC,QAAA,EACC,UAAAA,gBAAAA,EAAAA,IAAC,YAAA,EAAS,IAAAF,GACR,gCAAC,QAAA,EAAK,GAAE,KAAI,GAAE,KAAI,OAAOF,GAAY,QAAQC,EAAA,CAAa,GAC5D,GACF;AAAA,0BACCI,GAAA,EACC,UAAAD,gBAAAA,EAAAA;AAAAA,MAACE,EAAO;AAAA,MAAP;AAAA,QACC,UAAU,QAAQJ,CAAE;AAAA,QACpB,WAAWK;AAAAA,UACT;AAAA,UACChB,IAAiE,SAAzD;AAAA,UACTK;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,UACL,MAAM;AAAA,UACN,GAAIC,KAAS,CAAA;AAAA,QAAC;AAAA,QAEhB,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,UAAUC,EAAQ,WAAS;AAAA,QAC7D,UAAU;AAAA,UACR,SAAS;AAAA,YACP,IAAAJ;AAAA,YACA,IAAIA;AAAA,YACJ,IAAAF;AAAA,YACA,IAAIA;AAAA,YACJ,GAAID,KAAS,EAAE,QAAQA,EAAA;AAAA,UAAM;AAAA,UAE/B,aAAa;AAAA,YACX,IAAAG;AAAA,YACA,IAAAC;AAAA,YACA,IAAAH;AAAA,YACA,IAAAC;AAAA,YACA,GAAIF,KAAS,EAAE,QAAQA,EAAA;AAAA,YACvB,YAAY,EAAE,UAAUO,EAAQ,SAAA;AAAA,UAAS;AAAA,QAC3C;AAAA,QAEF,SAAQ;AAAA,QACR,SAASC,IAAW,gBAAgB;AAAA,MAAA;AAAA,IAAA,EACtC,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("./generateRandomString-B5zBiJzS.cjs"),p=require("./index-BW8iNx7E.cjs"),g=require("./proxy-BHRoeZgd.cjs");function j(o){const{color:e,x1:t,x2:a,y1:n,y2:x,className:l,style:c,animate:r,isInView:d,graphWidth:u,graphHeight:m}=o,s=h.generateRandomString(8);return i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx("defs",{children:i.jsxRuntimeExports.jsx("clipPath",{id:s,children:i.jsxRuntimeExports.jsx("rect",{x:"0",y:"0",width:u,height:m})})}),i.jsxRuntimeExports.jsx(p.AnimatePresence,{children:i.jsxRuntimeExports.jsx(g.motion.line,{clipPath:`url(#${s})`,className:i.mo("undp-ref-line",e?void 0:"stroke-primary-gray-700 dark:stroke-primary-gray-300",l),style:{fill:"none",...c||{}},exit:{opacity:0,transition:{duration:r.duration}},variants:{initial:{y1:n,y2:n,x1:t,x2:t,...e&&{stroke:e}},whileInView:{y1:n,y2:x,x1:t,x2:a,...e&&{stroke:e},transition:{duration:r.duration}}},initial:"initial",animate:d?"whileInView":"initial"})})]})}exports.RegressionLine=j;
2
+ //# sourceMappingURL=RegressionLine-Dj0GSiAp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegressionLine-Dj0GSiAp.cjs","sources":["../src/Components/Elements/RegressionLine.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { AnimatePresence, motion } from 'motion/react';\r\n\r\nimport { AnimateDataType } from '@/Types';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n color?: string;\r\n y1: number;\r\n y2: number;\r\n x1: number;\r\n x2: number;\r\n graphWidth: number;\r\n graphHeight: number;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n animate: AnimateDataType;\r\n isInView: boolean;\r\n}\r\n\r\nexport function RegressionLine(props: Props) {\r\n const { color, x1, x2, y1, y2, className, style, animate, isInView, graphWidth, graphHeight } =\r\n props;\r\n const id = generateRandomString(8);\r\n return (\r\n <g>\r\n <defs>\r\n <clipPath id={id}>\r\n <rect x='0' y='0' width={graphWidth} height={graphHeight} />\r\n </clipPath>\r\n </defs>\r\n <AnimatePresence>\r\n <motion.line\r\n clipPath={`url(#${id})`}\r\n className={cn(\r\n 'undp-ref-line',\r\n !color ? 'stroke-primary-gray-700 dark:stroke-primary-gray-300' : undefined,\r\n className,\r\n )}\r\n style={{\r\n fill: 'none',\r\n ...(style || {}),\r\n }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n y1,\r\n y2: y1,\r\n x1,\r\n x2: x1,\r\n ...(color && { stroke: color }),\r\n },\r\n whileInView: {\r\n y1,\r\n y2,\r\n x1,\r\n x2,\r\n ...(color && { stroke: color }),\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </AnimatePresence>\r\n </g>\r\n );\r\n}\r\n"],"names":["RegressionLine","props","color","x1","x2","y1","y2","className","style","animate","isInView","graphWidth","graphHeight","id","generateRandomString","jsx","AnimatePresence","motion","cn"],"mappings":"mLAoBO,SAASA,EAAeC,EAAc,CAC3C,KAAM,CAAE,MAAAC,EAAO,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,UAAAC,EAAW,MAAAC,EAAO,QAAAC,EAAS,SAAAC,EAAU,WAAAC,EAAY,YAAAC,CAAA,EAC9EX,EACIY,EAAKC,EAAAA,qBAAqB,CAAC,EACjC,gCACG,IAAA,CACC,SAAA,CAAAC,wBAAC,OAAA,CACC,SAAAA,EAAAA,kBAAAA,IAAC,WAAA,CAAS,GAAAF,EACR,iCAAC,OAAA,CAAK,EAAE,IAAI,EAAE,IAAI,MAAOF,EAAY,OAAQC,CAAA,CAAa,EAC5D,EACF,0BACCI,EAAAA,gBAAA,CACC,SAAAD,EAAAA,kBAAAA,IAACE,EAAAA,OAAO,KAAP,CACC,SAAU,QAAQJ,CAAE,IACpB,UAAWK,EAAAA,GACT,gBACChB,EAAiE,OAAzD,uDACTK,CAAA,EAEF,MAAO,CACL,KAAM,OACN,GAAIC,GAAS,CAAA,CAAC,EAEhB,KAAM,CAAE,QAAS,EAAG,WAAY,CAAE,SAAUC,EAAQ,SAAS,EAC7D,SAAU,CACR,QAAS,CACP,GAAAJ,EACA,GAAIA,EACJ,GAAAF,EACA,GAAIA,EACJ,GAAID,GAAS,CAAE,OAAQA,CAAA,CAAM,EAE/B,YAAa,CACX,GAAAG,EACA,GAAAC,EACA,GAAAH,EACA,GAAAC,EACA,GAAIF,GAAS,CAAE,OAAQA,CAAA,EACvB,WAAY,CAAE,SAAUO,EAAQ,QAAA,CAAS,CAC3C,EAEF,QAAQ,UACR,QAASC,EAAW,cAAgB,SAAA,CAAA,CACtC,CACF,CAAA,EACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),qe=require("./parse-hMnG_lRV.cjs"),j=require("react"),Me=require("./getSliderMarks-CRIbTGYV.cjs"),Ie=require("./index-DQA8q5sC.cjs"),Ue=require("./index-CQ3e6Ewi.cjs"),Le=require("./simple-statistics-xm8c0LQQ.cjs"),Fe=require("./Modal-tXZlLE5s.cjs"),He=require("./Tooltip-De16GWhY.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),N=require("./Colors.cjs"),Ve=require("./numberFormattingFunction-02t-wJta.cjs"),ke=require("./customArea-CK768gCn.cjs"),Ge=require("./string2HTML-z7CwHXcx.cjs"),Te=require("./Axis-DE7dSn1_.cjs"),$e=require("./AxisTitle-CK9YeovX.cjs"),We=require("./XTicksAndGridLines-CCzXIV8d.cjs"),De=require("./ReferenceLine-CFVBBN__.cjs"),Be=require("./RegressionLine-xKdiJ8sw.cjs"),_e=require("./YTicksAndGridLines-DBDuz6vb.cjs"),ze=require("./index-BYzIB5V6.cjs"),Je=require("./pow-B5-jkdHU.cjs"),Pe=require("./linear-BVckp9RD.cjs"),Ke=require("./delaunay-rcy0HhZi.cjs"),Qe=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Xe=require("./index-BW8iNx7E.cjs"),Ze=require("./GraphFooter.cjs"),et=require("./GraphHeader.cjs"),tt=require("./ColorLegendWithMouseOver.cjs"),it=require("./EmptyState-d8_8SxeW.cjs"),Ye=require("./index-BW_-wD2k.cjs"),st=require("./ensureCompleteData-DkQYPeDa.cjs"),Ae=require("./uniqBy-O05lp2S5.cjs"),ot=require("./sort-O96oMZLb.cjs"),rt=require("./init-DU0ybBc_.cjs");function nt(ge){const{data:s,width:q,height:M,showLabels:se,colors:l,colorDomain:C,radius:R,xAxisTitle:m,yAxisTitle:J,leftMargin:G,rightMargin:ye,topMargin:pe,bottomMargin:oe,tooltip:re,onSeriesMouseOver:X,refXValues:I,refYValues:je,highlightAreaSettings:ve,selectedColor:W,highlightedDataPoints:L,maxRadiusValue:be,maxXValue:B,minXValue:w,maxYValue:Oe,minYValue:E,onSeriesMouseClick:V,rtl:K,annotations:Ce,customHighlightAreaSettings:Re,regressionLine:_,resetSelectionOnDoubleClick:Q,detailsOnClick:k,noOfXTicks:ne,noOfYTicks:le,labelColor:Z,xSuffix:ae,ySuffix:ce,xPrefix:xe,yPrefix:ue,styles:x,classNames:u,animate:n,dimmedOpacity:A,precision:S,customLayers:fe}=ge,me=j.useRef(null),p=Qe.useInView(me,{once:n.once,amount:n.amount}),[T,$]=j.useState(void 0),[D,Y]=j.useState(void 0),[de,P]=j.useState(void 0),[he,v]=j.useState(void 0),d={top:pe,bottom:m?oe+50:oe,left:J?G+30:G,right:ye},z=s.map((e,y)=>({...e,id:`${y}`})),g=q-d.left-d.right,b=M-d.top-d.bottom,O=s.filter(e=>e.radius===void 0||e.radius===null).length!==s.length?Je.sqrt().domain([0,be]).range([.25,R]).nice():void 0,h=z.filter(e=>!c.checkIfNullOrUndefined(e.radius)).length===0?z:Ue.orderBy(z.filter(e=>!c.checkIfNullOrUndefined(e.radius)),"radius","desc"),r=Pe.linear().domain([w,B]).range([0,g]).nice(),a=Pe.linear().domain([E,Oe]).range([b,0]).nice(),ee=r.ticks(ne),te=a.ticks(le),U=Ke.Delaunay.from(h.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)),e=>r(e.x),e=>a(e.y)).voronoi([0,0,g<0?0:g,b<0?0:b]),we=Le.linearRegression(s.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map(e=>[r(e.x),a(e.y)])),f=Le.linearRegressionLine(we);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(ie.motion.svg,{width:`${q}px`,height:`${M}px`,viewBox:`0 0 ${q} ${M}`,direction:"ltr",ref:me,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[i.jsxRuntimeExports.jsx(ze.HighlightAreaForScatterPlot,{areaSettings:ve,width:g,height:b,scaleX:r,scaleY:a,animate:n,isInView:p},"highlight-area"),i.jsxRuntimeExports.jsx(ke.CustomArea,{areaSettings:Re,scaleX:r,scaleY:a,animate:n,isInView:p},"custom-area")]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(_e.YTicksAndGridLines,{values:te.filter(e=>e!==0),y:te.filter(e=>e!==0).map(e=>a(e)),x1:0,x2:g+d.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:u?.yAxis?.gridLines,labels:u?.yAxis?.labels},suffix:ce,prefix:ue,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:S}),i.jsxRuntimeExports.jsx(Te.Axis,{y1:a(E<0?0:E),y2:a(E<0?0:E),x1:0,x2:g+d.right,label:Ve.numberFormattingFunction(E<0?0:E,"NA",S,ue,ce),labelPos:{x:0,y:a(E<0?0:E),dy:"0.33em",dx:-4},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"end",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx($e.AxisTitle,{x:0-G-15,y:b/2,style:x?.yAxis?.title,className:u?.yAxis?.title,text:J,rotate90:!0})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(We.XTicksAndGridLines,{values:ee.filter(e=>e!==0),x:ee.filter(e=>e!==0).map(e=>r(e)),y1:0,y2:b,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:u?.xAxis?.gridLines,labels:u?.xAxis?.labels},suffix:ae,prefix:xe,labelType:"primary",showGridLines:!0,precision:S}),i.jsxRuntimeExports.jsx(Te.Axis,{x1:r(w<0?0:w),x2:r(w<0?0:w),y1:0,y2:b,label:Ve.numberFormattingFunction(w<0?0:w,"NA",S,xe,ae),labelPos:{x:r(w<0?0:w),y:b,dy:"1em",dx:0},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"middle",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx($e.AxisTitle,{x:g/2,y:b+30,style:x?.xAxis?.title,className:u?.xAxis?.title,text:m})]}),fe.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[h.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsx("path",{d:U.renderCell(h.findIndex(o=>o.id===e.id)),opacity:0,onMouseEnter:o=>{$(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{$(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{$(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))}},`tesselation_${e.label||y}`)),h.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsxs(ie.motion.g,{variants:{initial:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:T?T.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1},whileInView:{x:r(e.x),y:a(e.y),opacity:W?e.color&&l[C.indexOf(`${e.color}`)]===W?1:A:T?T.id===e.id?1:A:L.length!==0?L.indexOf(e.label||"")!==-1?1:A:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",exit:{opacity:0,transition:{duration:n.duration}},onMouseEnter:o=>{$(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{$(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{$(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||k)&&(Ie.isEqual(D,e)&&Q?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))},children:[i.jsxRuntimeExports.jsx(ie.motion.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:n.duration}},variants:{initial:{r:0,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray},whileInView:{r:O?O(e.radius||0):R,fill:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,stroke:s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",style:{fillOpacity:.6}}),se&&!c.checkIfNullOrUndefined(e.label)?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray)},whileInView:{x:O?O(e.radius||0):R,opacity:1,fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):L.length!==0&&!c.checkIfNullOrUndefined(e.label)&&L.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{fill:Z||(s.filter(o=>o.color).length===0?l[0]:e.color?l[C.indexOf(`${e.color}`)]:N.Colors.gray),...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:n.duration}},variants:{initial:{x:O?O(e.radius||0):R,opacity:0},whileInView:{x:O?O(e.radius||0):R,opacity:1,transition:{duration:n.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):null]},`${e.label||y}`)),I.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineX,{text:e.text,color:e.color,x:r(e.value),y1:0,y2:b,textSide:r(e.value)>g*.75||K?"left":"right",classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),je.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineY,{text:e.text,color:e.color,y:a(e.value),x1:0,x2:g,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)),i.jsxRuntimeExports.jsx("g",{children:Ce.map((e,y)=>{const o=ke.getLineEndPoint({x:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(e.xCoordinate):0,y:e.yCoordinate?a(e.yCoordinate):0},c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),Ee=e.showConnector?{y1:o.y,x1:o.x,y2:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?a(e.yCoordinate):0,cx:e.xCoordinate?r(e.xCoordinate):0,circleRadius:c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,F={y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:K?0:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),width:K?e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0):g+d.right-(e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return i.jsxRuntimeExports.jsx(ke.Annotation,{color:e.color,connectorsSettings:Ee,labelSettings:F,text:e.text,classNames:e.classNames,styles:e.styles,animate:n,isInView:p},y)})}),_?i.jsxRuntimeExports.jsx(Be.RegressionLine,{x1:0,x2:g,y1:f(0),y2:f(g),graphHeight:b,graphWidth:g,className:u?.regLine,style:x?.regLine,color:typeof _=="string"?_:void 0,animate:n,isInView:p}):null]}),fe.filter(e=>e.position==="after").map(e=>e.layer)]})}),T&&re&&de&&he?i.jsxRuntimeExports.jsx(He.Tooltip,{data:T,body:re,xPos:de,yPos:he,backgroundStyle:x?.tooltip,className:u?.tooltip}):null,k&&D!==void 0?i.jsxRuntimeExports.jsx(Fe.X,{open:D!==void 0,onClose:()=>{Y(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof k=="string"?{__html:Ge.string2HTML(k,D)}:void 0,children:typeof k=="function"?k(D):null})}):null]})}function lt(ge){const{data:s,graphTitle:q,colors:M,sources:se,graphDescription:l,showLabels:C=!1,height:R,width:m,footNote:J,colorDomain:G,colorLegendTitle:ye,radius:pe=5,xAxisTitle:oe="X Axis",yAxisTitle:re="Y Axis",padding:X,backgroundColor:I=!1,leftMargin:je=0,rightMargin:ve=10,topMargin:W=20,bottomMargin:L=50,tooltip:be,relativeHeight:B,onSeriesMouseOver:w,refXValues:Oe=[],refYValues:E=[],highlightAreaSettings:V=[],showColorScale:K=!0,highlightedDataPoints:Ce=[],graphID:Re,maxRadiusValue:_,maxXValue:Q,minXValue:k,maxYValue:ne,minYValue:le,xSuffix:Z="",ySuffix:ae="",xPrefix:ce="",yPrefix:xe="",onSeriesMouseClick:ue,graphDownload:x=!1,dataDownload:u=!1,language:n="en",showNAColor:A=!0,minHeight:S=0,annotations:fe=[],customHighlightAreaSettings:me=[],theme:p="light",regressionLine:T=!1,ariaLabel:$,resetSelectionOnDoubleClick:D=!0,detailsOnClick:Y,noOfXTicks:de=5,noOfYTicks:P=5,labelColor:he,styles:v,classNames:d,animate:z=!1,dimmedOpacity:g=.3,precision:b=2,customLayers:O=[],timeline:h={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ge,[r,a]=j.useState(0),[ee,te]=j.useState(0),[U,we]=j.useState(h.autoplay),f=ot.sort(Ae.uniqBy(s,"date",!0).map(t=>qe.parse(`${t}`,h.dateFormat||"yyyy",new Date).getTime()),(t,H)=>rt.ascending(t,H)),[e,y]=j.useState(h.autoplay?0:f.length-1),[o,Ee]=j.useState(void 0),F=j.useRef(null),Ne=j.useRef(null);j.useEffect(()=>{const t=new ResizeObserver(H=>{a(m||H[0].target.clientWidth||620),te(R||H[0].target.clientHeight||480)});return F.current&&(te(F.current.clientHeight||480),a(F.current.clientWidth||620),m||t.observe(F.current)),()=>t.disconnect()},[m,R]),j.useEffect(()=>{const t=setInterval(()=>{y(H=>H<f.length-1?H+1:0)},(h.speed||2)*1e3);return U||clearInterval(t),()=>clearInterval(t)},[f,U,h.speed]);const Se=Me.getSliderMarks(f,e,h.showOnlyActiveDate,h.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${p||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:n==="he"||n==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${n||"en"}`,m?"w-fit":"w-full",d?.graphContainer),style:{...v?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:Re,ref:Ne,"aria-label":$||`${q?`The graph shows ${q}. `:""}This is a scatter plot that shows correlation between two variables.${l?` ${l}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:I?X||"1rem":X||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[q||l||x||u?i.jsxRuntimeExports.jsx(et.GraphHeader,{styles:{title:v?.title,description:v?.description},classNames:{title:d?.title,description:d?.description},graphTitle:q,graphDescription:l,width:m,graphDownload:x?Ne.current:void 0,dataDownload:u?s.map(t=>t.data).filter(t=>t!==void 0).length>0?s.map(t=>t.data).filter(t=>t!==void 0):s.filter(t=>t!==void 0):null}):null,h.enabled&&f.length>0&&Se?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?i.jsxRuntimeExports.jsx(Ye.Pause,{}):i.jsxRuntimeExports.jsx(Ye.Play,{})}),i.jsxRuntimeExports.jsx(Me.xr,{min:f[0],max:f[f.length-1],marks:Se,step:null,defaultValue:f[f.length-1],value:f[e],onChangeComplete:t=>{y(f.indexOf(t))},onChange:t=>{y(f.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(it.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[K&&s.filter(t=>t.color).length!==0?i.jsxRuntimeExports.jsx(tt.ColorLegendWithMouseOver,{width:m,colorLegendTitle:ye,colors:M||N.Colors[p].categoricalColors.colors,colorDomain:G||Ae.uniqBy(s,"color",!0),setSelectedColor:Ee,showNAColor:A}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:F,"aria-label":"Graph area",children:(m||r)&&(R||ee)?i.jsxRuntimeExports.jsx(nt,{data:st.ensureCompleteDataForScatterPlot(s,h.dateFormat||"yyyy").filter(t=>h.enabled?t.date===qe.format(new Date(f[e]),h.dateFormat||"yyyy"):t),width:m||r,height:Math.max(S,R||(B?S?(m||r)*B>S?(m||r)*B:S:(m||r)*B:ee)),colorDomain:s.filter(t=>t.color).length===0?[]:G||Ae.uniqBy(s,"color",!0),colors:s.filter(t=>t.color).length===0?M?[M]:[N.Colors.primaryColors["blue-600"]]:M||N.Colors[p].categoricalColors.colors,xAxisTitle:oe,yAxisTitle:re,refXValues:Oe,refYValues:E,showLabels:C,radius:pe,leftMargin:je,rightMargin:ve,topMargin:W,bottomMargin:L,tooltip:be,onSeriesMouseOver:w,highlightAreaSettings:V,highlightedDataPoints:s.filter(t=>t.label).length===0?[]:Ce,selectedColor:o,maxRadiusValue:c.checkIfNullOrUndefined(_)?Math.max(...s.map(t=>t.radius).filter(t=>t!=null)):_,maxXValue:c.checkIfNullOrUndefined(Q)?Math.max(...s.map(t=>t.x).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.x).filter(t=>t!=null)):0:Q,minXValue:c.checkIfNullOrUndefined(k)?Math.min(...s.map(t=>t.x).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.x).filter(t=>t!=null)):k,maxYValue:c.checkIfNullOrUndefined(ne)?Math.max(...s.map(t=>t.y).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.y).filter(t=>t!=null)):0:ne,minYValue:c.checkIfNullOrUndefined(le)?Math.min(...s.map(t=>t.y).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.y).filter(t=>t!=null)):le,onSeriesMouseClick:ue,rtl:n==="he"||n==="ar",annotations:fe,customHighlightAreaSettings:me,regressionLine:T,resetSelectionOnDoubleClick:D,detailsOnClick:Y,noOfXTicks:de,noOfYTicks:P,labelColor:he,xSuffix:Z,ySuffix:ae,xPrefix:ce,yPrefix:xe,styles:v,classNames:d,animate:z===!0?{duration:.5,once:!0,amount:.5}:z||{duration:0,once:!0,amount:0},dimmedOpacity:g,precision:b,customLayers:O}):null})]})}),se||J?i.jsxRuntimeExports.jsx(Ze.GraphFooter,{styles:{footnote:v?.footnote,source:v?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:se,footNote:J,width:m}):null]})})})})}exports.ScatterPlot=lt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),qe=require("./parse-hMnG_lRV.cjs"),j=require("react"),Me=require("./getSliderMarks-CRIbTGYV.cjs"),Ie=require("./index-DQA8q5sC.cjs"),Ue=require("./index-CQ3e6Ewi.cjs"),Le=require("./simple-statistics-xm8c0LQQ.cjs"),Fe=require("./Modal-tXZlLE5s.cjs"),He=require("./Tooltip-De16GWhY.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),k=require("./Colors.cjs"),Ve=require("./numberFormattingFunction-02t-wJta.cjs"),ke=require("./customArea-CK768gCn.cjs"),Ge=require("./string2HTML-z7CwHXcx.cjs"),$e=require("./Axis-DE7dSn1_.cjs"),Te=require("./AxisTitle-CK9YeovX.cjs"),We=require("./XTicksAndGridLines-CCzXIV8d.cjs"),De=require("./ReferenceLine-CFVBBN__.cjs"),Be=require("./RegressionLine-Dj0GSiAp.cjs"),_e=require("./YTicksAndGridLines-DBDuz6vb.cjs"),ze=require("./index-BYzIB5V6.cjs"),Je=require("./pow-B5-jkdHU.cjs"),Pe=require("./linear-BVckp9RD.cjs"),Ke=require("./delaunay-rcy0HhZi.cjs"),Qe=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Xe=require("./index-BW8iNx7E.cjs"),Ze=require("./GraphFooter.cjs"),et=require("./GraphHeader.cjs"),tt=require("./ColorLegendWithMouseOver.cjs"),it=require("./EmptyState-d8_8SxeW.cjs"),Ye=require("./index-BW_-wD2k.cjs"),st=require("./ensureCompleteData-DkQYPeDa.cjs"),Ae=require("./uniqBy-O05lp2S5.cjs"),ot=require("./sort-O96oMZLb.cjs"),rt=require("./init-DU0ybBc_.cjs");function nt(ge){const{data:s,width:q,height:M,showLabels:se,colors:n,colorDomain:O,radius:R,xAxisTitle:m,yAxisTitle:K,leftMargin:G,rightMargin:ye,topMargin:pe,bottomMargin:oe,tooltip:re,onSeriesMouseOver:X,refXValues:I,refYValues:je,highlightAreaSettings:ve,selectedColor:W,highlightedDataPoints:L,maxRadiusValue:be,maxXValue:B,minXValue:w,maxYValue:Oe,minYValue:E,onSeriesMouseClick:V,rtl:Q,annotations:Ce,customHighlightAreaSettings:Re,regressionLine:_,resetSelectionOnDoubleClick:Z,detailsOnClick:A,noOfXTicks:ne,noOfYTicks:le,labelColor:z,xSuffix:ae,ySuffix:ce,xPrefix:xe,yPrefix:ue,styles:x,classNames:u,animate:l,dimmedOpacity:N,precision:S,customLayers:fe}=ge,me=j.useRef(null),p=Qe.useInView(me,{once:l.once,amount:l.amount}),[$,T]=j.useState(void 0),[D,Y]=j.useState(void 0),[de,P]=j.useState(void 0),[he,v]=j.useState(void 0),d={top:pe,bottom:m?oe+50:oe,left:K?G+30:G,right:ye},J=s.map((e,y)=>({...e,id:`${y}`})),g=q-d.left-d.right,b=M-d.top-d.bottom,C=s.filter(e=>e.radius===void 0||e.radius===null).length!==s.length?Je.sqrt().domain([0,be]).range([.25,R]).nice():void 0,h=J.filter(e=>!c.checkIfNullOrUndefined(e.radius)).length===0?J:Ue.orderBy(J.filter(e=>!c.checkIfNullOrUndefined(e.radius)),"radius","desc"),r=Pe.linear().domain([w,B]).range([0,g]).nice(),a=Pe.linear().domain([E,Oe]).range([b,0]).nice(),ee=r.ticks(ne),te=a.ticks(le),U=Ke.Delaunay.from(h.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)),e=>r(e.x),e=>a(e.y)).voronoi([0,0,g<0?0:g,b<0?0:b]),we=Le.linearRegression(s.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map(e=>[r(e.x),a(e.y)])),f=Le.linearRegressionLine(we);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(ie.motion.svg,{width:`${q}px`,height:`${M}px`,viewBox:`0 0 ${q} ${M}`,direction:"ltr",ref:me,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[i.jsxRuntimeExports.jsx(ze.HighlightAreaForScatterPlot,{areaSettings:ve,width:g,height:b,scaleX:r,scaleY:a,animate:l,isInView:p},"highlight-area"),i.jsxRuntimeExports.jsx(ke.CustomArea,{areaSettings:Re,scaleX:r,scaleY:a,animate:l,isInView:p},"custom-area")]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(_e.YTicksAndGridLines,{values:te.filter(e=>e!==0),y:te.filter(e=>e!==0).map(e=>a(e)),x1:0,x2:g+d.right,styles:{gridLines:x?.yAxis?.gridLines,labels:x?.yAxis?.labels},classNames:{gridLines:u?.yAxis?.gridLines,labels:u?.yAxis?.labels},suffix:ce,prefix:ue,labelType:"secondary",showGridLines:!0,labelPos:"side",precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{y1:a(E<0?0:E),y2:a(E<0?0:E),x1:0,x2:g+d.right,label:Ve.numberFormattingFunction(E<0?0:E,"NA",S,ue,ce),labelPos:{x:0,y:a(E<0?0:E),dy:"0.33em",dx:-4},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"end",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:0-G-15,y:b/2,style:x?.yAxis?.title,className:u?.yAxis?.title,text:K,rotate90:!0})]}),i.jsxRuntimeExports.jsxs("g",{children:[i.jsxRuntimeExports.jsx(We.XTicksAndGridLines,{values:ee.filter(e=>e!==0),x:ee.filter(e=>e!==0).map(e=>r(e)),y1:0,y2:b,styles:{gridLines:x?.xAxis?.gridLines,labels:x?.xAxis?.labels},classNames:{gridLines:u?.xAxis?.gridLines,labels:u?.xAxis?.labels},suffix:ae,prefix:xe,labelType:"primary",showGridLines:!0,precision:S}),i.jsxRuntimeExports.jsx($e.Axis,{x1:r(w<0?0:w),x2:r(w<0?0:w),y1:0,y2:b,label:Ve.numberFormattingFunction(w<0?0:w,"NA",S,xe,ae),labelPos:{x:r(w<0?0:w),y:b,dy:"1em",dx:0},classNames:{axis:u?.xAxis?.axis,label:u?.yAxis?.labels},styles:{axis:x?.xAxis?.axis,label:{textAnchor:"middle",...x?.yAxis?.labels||{}}}}),i.jsxRuntimeExports.jsx(Te.AxisTitle,{x:g/2,y:b+30,style:x?.xAxis?.title,className:u?.xAxis?.title,text:m})]}),fe.filter(e=>e.position==="before").map(e=>e.layer),i.jsxRuntimeExports.jsxs(Xe.AnimatePresence,{children:[h.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsx("path",{d:U.renderCell(h.findIndex(o=>o.id===e.id)),opacity:0,onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||A)&&(Ie.isEqual(D,e)&&Z?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))}},`tesselation_${e.label||y}`)),h.filter(e=>!c.checkIfNullOrUndefined(e.x)&&!c.checkIfNullOrUndefined(e.y)).map((e,y)=>i.jsxRuntimeExports.jsxs(ie.motion.g,{variants:{initial:{x:r(e.x),y:a(e.y),opacity:W?e.color&&n[O.indexOf(`${e.color}`)]===W?1:N:$?$.id===e.id?1:N:L.length!==0?L.indexOf(e.label||"")!==-1?1:N:1},whileInView:{x:r(e.x),y:a(e.y),opacity:W?e.color&&n[O.indexOf(`${e.color}`)]===W?1:N:$?$.id===e.id?1:N:L.length!==0?L.indexOf(e.label||"")!==-1?1:N:1,transition:{duration:l.duration}}},initial:"initial",animate:p?"whileInView":"initial",exit:{opacity:0,transition:{duration:l.duration}},onMouseEnter:o=>{T(e),v(o.clientY),P(o.clientX),X?.(e)},onMouseMove:o=>{T(e),v(o.clientY),P(o.clientX)},onMouseLeave:()=>{T(void 0),P(void 0),v(void 0),X?.(void 0)},onClick:()=>{(V||A)&&(Ie.isEqual(D,e)&&Z?(Y(void 0),V?.(void 0)):(Y(e),V?.(e)))},children:[i.jsxRuntimeExports.jsx(ie.motion.circle,{cx:0,cy:0,exit:{r:0,transition:{duration:l.duration}},variants:{initial:{r:0,fill:s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray,stroke:s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray},whileInView:{r:C?C(e.radius||0):R,fill:s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray,stroke:s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray,transition:{duration:l.duration}}},initial:"initial",animate:p?"whileInView":"initial",style:{fillOpacity:.6}}),se&&!c.checkIfNullOrUndefined(e.label)?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:C?C(e.radius||0):R,opacity:0,fill:z||(s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray)},whileInView:{x:C?C(e.radius||0):R,opacity:1,fill:z||(s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray),transition:{duration:l.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):L.length!==0&&!c.checkIfNullOrUndefined(e.label)&&L.indexOf(e.label)!==-1?i.jsxRuntimeExports.jsx(ie.motion.text,{style:{...x?.graphObjectValues||{}},className:i.mo("graph-value text-sm",u?.graphObjectValues),y:0,exit:{opacity:0,transition:{duration:l.duration}},variants:{initial:{x:C?C(e.radius||0):R,opacity:0,fill:z||(s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray)},whileInView:{x:C?C(e.radius||0):R,opacity:1,fill:z||(s.filter(o=>o.color).length===0?n[0]:e.color?n[O.indexOf(`${e.color}`)]:k.Colors.gray),transition:{duration:l.duration}}},initial:"initial",animate:p?"whileInView":"initial",dy:"0.33em",dx:3,children:e.label}):null]},`${e.label||y}`)),I.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineX,{text:e.text,color:e.color,x:r(e.value),y1:0,y2:b,textSide:r(e.value)>g*.75||Q?"left":"right",classNames:e.classNames,styles:e.styles,animate:l,isInView:p},y)),je.map((e,y)=>i.jsxRuntimeExports.jsx(De.RefLineY,{text:e.text,color:e.color,y:a(e.value),x1:0,x2:g,classNames:e.classNames,styles:e.styles,animate:l,isInView:p},y)),i.jsxRuntimeExports.jsx("g",{children:Ce.map((e,y)=>{const o=ke.getLineEndPoint({x:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(e.xCoordinate):0,y:e.yCoordinate?a(e.yCoordinate):0},c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),Ee=e.showConnector?{y1:o.y,x1:o.x,y2:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),cy:e.yCoordinate?a(e.yCoordinate):0,cx:e.xCoordinate?r(e.xCoordinate):0,circleRadius:c.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,F={y:e.yCoordinate?a(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:Q?0:e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0),width:Q?e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0):g+d.right-(e.xCoordinate?r(e.xCoordinate)+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return i.jsxRuntimeExports.jsx(ke.Annotation,{color:e.color,connectorsSettings:Ee,labelSettings:F,text:e.text,classNames:e.classNames,styles:e.styles,animate:l,isInView:p},y)})}),_?i.jsxRuntimeExports.jsx(Be.RegressionLine,{x1:0,x2:g,y1:f(0),y2:f(g),graphHeight:b,graphWidth:g,className:u?.regLine,style:x?.regLine,color:typeof _=="string"?_:void 0,animate:l,isInView:p}):null]}),fe.filter(e=>e.position==="after").map(e=>e.layer)]})}),$&&re&&de&&he?i.jsxRuntimeExports.jsx(He.Tooltip,{data:$,body:re,xPos:de,yPos:he,backgroundStyle:x?.tooltip,className:u?.tooltip}):null,A&&D!==void 0?i.jsxRuntimeExports.jsx(Fe.X,{open:D!==void 0,onClose:()=>{Y(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof A=="string"?{__html:Ge.string2HTML(A,D)}:void 0,children:typeof A=="function"?A(D):null})}):null]})}function lt(ge){const{data:s,graphTitle:q,colors:M,sources:se,graphDescription:n,showLabels:O=!1,height:R,width:m,footNote:K,colorDomain:G,colorLegendTitle:ye,radius:pe=5,xAxisTitle:oe="X Axis",yAxisTitle:re="Y Axis",padding:X,backgroundColor:I=!1,leftMargin:je=0,rightMargin:ve=10,topMargin:W=20,bottomMargin:L=50,tooltip:be,relativeHeight:B,onSeriesMouseOver:w,refXValues:Oe=[],refYValues:E=[],highlightAreaSettings:V=[],showColorScale:Q=!0,highlightedDataPoints:Ce=[],graphID:Re,maxRadiusValue:_,maxXValue:Z,minXValue:A,maxYValue:ne,minYValue:le,xSuffix:z="",ySuffix:ae="",xPrefix:ce="",yPrefix:xe="",onSeriesMouseClick:ue,graphDownload:x=!1,dataDownload:u=!1,language:l="en",showNAColor:N=!0,minHeight:S=0,annotations:fe=[],customHighlightAreaSettings:me=[],theme:p="light",regressionLine:$=!1,ariaLabel:T,resetSelectionOnDoubleClick:D=!0,detailsOnClick:Y,noOfXTicks:de=5,noOfYTicks:P=5,labelColor:he,styles:v,classNames:d,animate:J=!1,dimmedOpacity:g=.3,precision:b=2,customLayers:C=[],timeline:h={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=ge,[r,a]=j.useState(0),[ee,te]=j.useState(0),[U,we]=j.useState(h.autoplay),f=ot.sort(Ae.uniqBy(s,"date",!0).map(t=>qe.parse(`${t}`,h.dateFormat||"yyyy",new Date).getTime()),(t,H)=>rt.ascending(t,H)),[e,y]=j.useState(h.autoplay?0:f.length-1),[o,Ee]=j.useState(void 0),F=j.useRef(null),Ne=j.useRef(null);j.useEffect(()=>{const t=new ResizeObserver(H=>{a(m||H[0].target.clientWidth||620),te(R||H[0].target.clientHeight||480)});return F.current&&(te(F.current.clientHeight||480),a(F.current.clientWidth||620),m||t.observe(F.current)),()=>t.disconnect()},[m,R]),j.useEffect(()=>{const t=setInterval(()=>{y(H=>H<f.length-1?H+1:0)},(h.speed||2)*1e3);return U||clearInterval(t),()=>clearInterval(t)},[f,U,h.speed]);const Se=Me.getSliderMarks(f,e,h.showOnlyActiveDate,h.dateFormat||"yyyy");return i.jsxRuntimeExports.jsx("div",{className:`${p||"light"} flex ${m?"w-fit grow-0":"w-full grow"}`,dir:l==="he"||l==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${I?I===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${l||"en"}`,m?"w-fit":"w-full",d?.graphContainer),style:{...v?.graphContainer||{},...I&&I!==!0?{backgroundColor:I}:{}},id:Re,ref:Ne,"aria-label":T||`${q?`The graph shows ${q}. `:""}This is a scatter plot that shows correlation between two variables.${n?` ${n}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:I?X||"1rem":X||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[q||n||x||u?i.jsxRuntimeExports.jsx(et.GraphHeader,{styles:{title:v?.title,description:v?.description},classNames:{title:d?.title,description:d?.description},graphTitle:q,graphDescription:n,width:m,graphDownload:x?Ne.current:void 0,dataDownload:u?s.map(t=>t.data).filter(t=>t!==void 0).length>0?s.map(t=>t.data).filter(t=>t!==void 0):s.filter(t=>t!==void 0):null}):null,h.enabled&&f.length>0&&Se?i.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[i.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!U)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":U?"Click to pause animation":"Click to play animation",children:U?i.jsxRuntimeExports.jsx(Ye.Pause,{}):i.jsxRuntimeExports.jsx(Ye.Play,{})}),i.jsxRuntimeExports.jsx(Me.xr,{min:f[0],max:f[f.length-1],marks:Se,step:null,defaultValue:f[f.length-1],value:f[e],onChangeComplete:t=>{y(f.indexOf(t))},onChange:t=>{y(f.indexOf(t))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:s.length===0?i.jsxRuntimeExports.jsx(it.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[Q&&s.filter(t=>t.color).length!==0?i.jsxRuntimeExports.jsx(tt.ColorLegendWithMouseOver,{width:m,colorLegendTitle:ye,colors:M||k.Colors[p].categoricalColors.colors,colorDomain:G||Ae.uniqBy(s,"color",!0),setSelectedColor:Ee,showNAColor:N}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:F,"aria-label":"Graph area",children:(m||r)&&(R||ee)?i.jsxRuntimeExports.jsx(nt,{data:st.ensureCompleteDataForScatterPlot(s,h.dateFormat||"yyyy").filter(t=>h.enabled?t.date===qe.format(new Date(f[e]),h.dateFormat||"yyyy"):t),width:m||r,height:Math.max(S,R||(B?S?(m||r)*B>S?(m||r)*B:S:(m||r)*B:ee)),colorDomain:s.filter(t=>t.color).length===0?[]:G||Ae.uniqBy(s,"color",!0),colors:s.filter(t=>t.color).length===0?M?[M]:[k.Colors.primaryColors["blue-600"]]:M||k.Colors[p].categoricalColors.colors,xAxisTitle:oe,yAxisTitle:re,refXValues:Oe,refYValues:E,showLabels:O,radius:pe,leftMargin:je,rightMargin:ve,topMargin:W,bottomMargin:L,tooltip:be,onSeriesMouseOver:w,highlightAreaSettings:V,highlightedDataPoints:s.filter(t=>t.label).length===0?[]:Ce,selectedColor:o,maxRadiusValue:c.checkIfNullOrUndefined(_)?Math.max(...s.map(t=>t.radius).filter(t=>t!=null)):_,maxXValue:c.checkIfNullOrUndefined(Z)?Math.max(...s.map(t=>t.x).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.x).filter(t=>t!=null)):0:Z,minXValue:c.checkIfNullOrUndefined(A)?Math.min(...s.map(t=>t.x).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.x).filter(t=>t!=null)):A,maxYValue:c.checkIfNullOrUndefined(ne)?Math.max(...s.map(t=>t.y).filter(t=>t!=null))>0?Math.max(...s.map(t=>t.y).filter(t=>t!=null)):0:ne,minYValue:c.checkIfNullOrUndefined(le)?Math.min(...s.map(t=>t.y).filter(t=>t!=null))>0?0:Math.min(...s.map(t=>t.y).filter(t=>t!=null)):le,onSeriesMouseClick:ue,rtl:l==="he"||l==="ar",annotations:fe,customHighlightAreaSettings:me,regressionLine:$,resetSelectionOnDoubleClick:D,detailsOnClick:Y,noOfXTicks:de,noOfYTicks:P,labelColor:he,xSuffix:z,ySuffix:ae,xPrefix:ce,yPrefix:xe,styles:v,classNames:d,animate:J===!0?{duration:.5,once:!0,amount:.5}:J||{duration:0,once:!0,amount:0},dimmedOpacity:g,precision:b,customLayers:C}):null})]})}),se||K?i.jsxRuntimeExports.jsx(Ze.GraphFooter,{styles:{footnote:v?.footnote,source:v?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:se,footNote:K,width:m}):null]})})})})}exports.ScatterPlot=lt;
2
2
  //# sourceMappingURL=ScatterPlot.cjs.map