@undp/data-viz 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AreaChart.cjs +1 -1
- package/dist/AreaChart.cjs.map +1 -1
- package/dist/AreaChart.js +3 -2
- package/dist/AreaChart.js.map +1 -1
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.cjs.map +1 -1
- package/dist/BarGraph.js +1221 -1247
- package/dist/BarGraph.js.map +1 -1
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.cjs.map +1 -1
- package/dist/BeeSwarmChart.js +130 -142
- package/dist/BeeSwarmChart.js.map +1 -1
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.js +41 -41
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.cjs.map +1 -1
- package/dist/BulletChart.js +483 -487
- package/dist/BulletChart.js.map +1 -1
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.cjs.map +1 -1
- package/dist/ButterflyChart.js +99 -99
- package/dist/ButterflyChart.js.map +1 -1
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.js +125 -125
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +2 -2
- package/dist/Data/BureauPerformance.csv +8 -0
- package/dist/Data/EGDashboardData.csv +6 -0
- package/dist/DataCards.cjs +2 -2
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +6 -6
- package/dist/DataCards.js.map +1 -1
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.cjs.map +1 -1
- package/dist/DataTable.js +66 -68
- package/dist/DataTable.js.map +1 -1
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.cjs.map +1 -1
- package/dist/DifferenceLineChart.js +3 -2
- package/dist/DifferenceLineChart.js.map +1 -1
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.cjs.map +1 -1
- package/dist/DonutChart.js +205 -205
- package/dist/DonutChart.js.map +1 -1
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.js +78 -81
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.cjs.map +1 -1
- package/dist/DualAxisLineChart.js +3 -2
- package/dist/DualAxisLineChart.js.map +1 -1
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.cjs.map +1 -1
- package/dist/DumbbellChart.js +64 -65
- package/dist/DumbbellChart.js.map +1 -1
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.js +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +1 -1
- package/dist/{GraphEl-4RUlclvW.cjs → GraphEl-BcYgMnN2.cjs} +2 -2
- package/dist/{GraphEl-4RUlclvW.cjs.map → GraphEl-BcYgMnN2.cjs.map} +1 -1
- package/dist/{GraphEl-ClIxlWa3.js → GraphEl-CMWeARJ3.js} +2 -2
- package/dist/{GraphEl-ClIxlWa3.js.map → GraphEl-CMWeARJ3.js.map} +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.js +4 -4
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.js +1 -1
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.cjs.map +1 -1
- package/dist/HeatMap.js +83 -83
- package/dist/HeatMap.js.map +1 -1
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
- package/dist/LineChartWithConfidenceInterval.js +7 -6
- package/dist/LineChartWithConfidenceInterval.js.map +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.js +2 -2
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.cjs.map +1 -1
- package/dist/MultiLineAltChart.js +82 -91
- package/dist/MultiLineAltChart.js.map +1 -1
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.cjs.map +1 -1
- package/dist/MultiLineChart.js +3 -2
- package/dist/MultiLineChart.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +2 -2
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.cjs.map +1 -1
- package/dist/RadarChart.js +124 -130
- package/dist/RadarChart.js.map +1 -1
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.cjs.map +1 -1
- package/dist/SankeyChart.js +200 -200
- package/dist/SankeyChart.js.map +1 -1
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.cjs.map +1 -1
- package/dist/ScatterPlot.js +149 -155
- package/dist/ScatterPlot.js.map +1 -1
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.cjs.map +1 -1
- package/dist/SimpleLineChart.js +44 -43
- package/dist/SimpleLineChart.js.map +1 -1
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.js +4 -4
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.js +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.js +3 -3
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.cjs.map +1 -1
- package/dist/SlopeChart.js +107 -113
- package/dist/SlopeChart.js.map +1 -1
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.cjs.map +1 -1
- package/dist/SparkLine.js +3 -2
- package/dist/SparkLine.js.map +1 -1
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.cjs.map +1 -1
- package/dist/StripChart.js +159 -159
- package/dist/StripChart.js.map +1 -1
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.js +3 -3
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.cjs.map +1 -1
- package/dist/TreeMapGraph.js +194 -200
- package/dist/TreeMapGraph.js.map +1 -1
- package/dist/ensureCompleteData-DkQYPeDa.cjs +2 -0
- package/dist/ensureCompleteData-DkQYPeDa.cjs.map +1 -0
- package/dist/{ensureCompleteData-BALdOrsS.js → ensureCompleteData-DlmibgaI.js} +28 -8
- package/dist/ensureCompleteData-DlmibgaI.js.map +1 -0
- package/dist/fetchAndParseData-Ba-_CgxS.cjs +16 -0
- package/dist/fetchAndParseData-Ba-_CgxS.cjs.map +1 -0
- package/dist/fetchAndParseData-sapWbnYk.js +583 -0
- package/dist/fetchAndParseData-sapWbnYk.js.map +1 -0
- package/dist/fetchAndParseData.cjs +1 -1
- package/dist/fetchAndParseData.js +1 -1
- package/dist/getJenks-BbngDoBQ.js +19 -0
- package/dist/getJenks-BbngDoBQ.js.map +1 -0
- package/dist/getJenks-GYmdwBqm.cjs +2 -0
- package/dist/getJenks-GYmdwBqm.cjs.map +1 -0
- package/dist/getSliderMarks-9cNoRkDx.js +1023 -0
- package/dist/getSliderMarks-9cNoRkDx.js.map +1 -0
- package/dist/getSliderMarks-CRIbTGYV.cjs +6 -0
- package/dist/getSliderMarks-CRIbTGYV.cjs.map +1 -0
- package/dist/getUniqValue-DiCh_MOD.js +13 -0
- package/dist/getUniqValue-DiCh_MOD.js.map +1 -0
- package/dist/getUniqValue-RViz8tTw.cjs +2 -0
- package/dist/getUniqValue-RViz8tTw.cjs.map +1 -0
- package/dist/{index-BMgDMxKJ.js → index-37q0ULNQ.js} +44 -50
- package/dist/index-37q0ULNQ.js.map +1 -0
- package/dist/index-CVlCtJbC.cjs +2 -0
- package/dist/index-CVlCtJbC.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/sort-DfK1b0F5.js +34 -0
- package/dist/sort-DfK1b0F5.js.map +1 -0
- package/dist/sort-O96oMZLb.cjs +2 -0
- package/dist/sort-O96oMZLb.cjs.map +1 -0
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +3 -3
- package/dist/transformDataForAggregation-KXGm6flX.cjs +2 -0
- package/dist/{transformDataForAggregation-BVxVu4yY.cjs.map → transformDataForAggregation-KXGm6flX.cjs.map} +1 -1
- package/dist/{transformDataForAggregation-1BYVFqvF.js → transformDataForAggregation-sBpdlX8n.js} +40 -44
- package/dist/{transformDataForAggregation-1BYVFqvF.js.map → transformDataForAggregation-sBpdlX8n.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js → transformDataForGraphFromFile-ComYvzuz.js} +3 -3
- package/dist/{transformDataForGraphFromFile-BC9Ha8hF.js.map → transformDataForGraphFromFile-ComYvzuz.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs → transformDataForGraphFromFile-DVZodTHd.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-b41aNQYY.cjs.map → transformDataForGraphFromFile-DVZodTHd.cjs.map} +1 -1
- package/dist/uniqBy-BHy4I8PK.js +8 -0
- package/dist/uniqBy-BHy4I8PK.js.map +1 -0
- package/dist/uniqBy-O05lp2S5.cjs +2 -0
- package/dist/uniqBy-O05lp2S5.cjs.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -2
- package/package.json +1 -7
- package/dist/ensureCompleteData-BALdOrsS.js.map +0 -1
- package/dist/ensureCompleteData-BU5Zlccy.cjs +0 -2
- package/dist/ensureCompleteData-BU5Zlccy.cjs.map +0 -1
- package/dist/fetchAndParseData-DBOl1Icl.js +0 -1196
- package/dist/fetchAndParseData-DBOl1Icl.js.map +0 -1
- package/dist/fetchAndParseData-Dcy7AS_0.cjs +0 -16
- package/dist/fetchAndParseData-Dcy7AS_0.cjs.map +0 -1
- package/dist/getJenks-DW96UYNE.js +0 -23
- package/dist/getJenks-DW96UYNE.js.map +0 -1
- package/dist/getJenks-vofIZmeb.cjs +0 -2
- package/dist/getJenks-vofIZmeb.cjs.map +0 -1
- package/dist/getSliderMarks-C0jptXeP.js +0 -1054
- package/dist/getSliderMarks-C0jptXeP.js.map +0 -1
- package/dist/getSliderMarks-CtsEXiLV.cjs +0 -6
- package/dist/getSliderMarks-CtsEXiLV.cjs.map +0 -1
- package/dist/getUniqValue-CfuE_l9c.cjs +0 -2
- package/dist/getUniqValue-CfuE_l9c.cjs.map +0 -1
- package/dist/getUniqValue-CttuU_wn.js +0 -20
- package/dist/getUniqValue-CttuU_wn.js.map +0 -1
- package/dist/index-AqnpA7_O.js +0 -631
- package/dist/index-AqnpA7_O.js.map +0 -1
- package/dist/index-BJOeaYTk.cjs +0 -2
- package/dist/index-BJOeaYTk.cjs.map +0 -1
- package/dist/index-BMgDMxKJ.js.map +0 -1
- package/dist/index-DYH8g9WA.cjs +0 -2
- package/dist/index-DYH8g9WA.cjs.map +0 -1
- package/dist/index-Da2GUKrr.cjs +0 -2
- package/dist/index-Da2GUKrr.cjs.map +0 -1
- package/dist/index-fwdktvAS.js +0 -707
- package/dist/index-fwdktvAS.js.map +0 -1
- package/dist/transformDataForAggregation-BVxVu4yY.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiLineChart.js","sources":["../src/Components/Graphs/LineCharts/MultiLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/MultiLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveLinear,\r\n curveMonotoneX,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport sortBy from 'lodash.sortby';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\r\n lineColors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n labels: (string | number)[];\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorLegendAtTop: boolean;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n dashedLines: (string | number)[];\r\n dashSettings: string[];\r\n labelsToBeHidden: (string | number)[];\r\n revealClipId: string;\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n dateFormat,\r\n noOfXTicks,\r\n labels,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n leftMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showValues,\r\n showColorLegendAtTop,\r\n refValues,\r\n highlightAreaSettings,\r\n minValue,\r\n maxValue,\r\n highlightedLines,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n dashedLines,\r\n dashSettings,\r\n labelsToBeHidden,\r\n revealClipId,\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 [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted = sortBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n 'date',\r\n );\r\n const dataArray = dataFormatted[0].y.map((_d, i) => {\r\n return dataFormatted\r\n .map(el => ({\r\n ...el,\r\n y: el.y[i],\r\n }))\r\n .filter(el => !checkIfNullOrUndefined(el.y));\r\n });\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = checkIfNullOrUndefined(minValue)\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0\r\n : (minValue as number);\r\n const maxParam: number = Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0;\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <defs>\r\n <clipPath id={revealClipId}>\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n height={graphHeight}\r\n variants={{\r\n initial: { width: 0 },\r\n whileInView: {\r\n width: graphWidth,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </clipPath>\r\n </defs>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n {dataArray.map((d, i) => (\r\n <motion.g\r\n key={labels[i]}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n strokeWidth,\r\n }}\r\n clipPath={`url(#${revealClipId})`}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n ...(dashedLines.length === 0 ? { pathLength: 0 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n },\r\n whileInView: {\r\n ...(dashedLines.length === 0 ? { pathLength: 1 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n strokeDasharray={\r\n dashedLines.includes(labels[i])\r\n ? dashSettings[i % dashSettings.length]\r\n : undefined\r\n }\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[i] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(el.date), cy: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n fill: lineColors[i],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(el.date), y: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(el.date),\r\n y: y(el.y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n {showColorLegendAtTop || labelsToBeHidden.includes(labels[i]) ? null : (\r\n <motion.text\r\n style={{ fill: lineColors[i] }}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {labels[i]}\r\n </motion.text>\r\n )}\r\n </motion.g>\r\n ))}\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\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 </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\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 { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors of the lines */\r\n lineColors?: string[];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: boolean;\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 /** Array of labels of line which are dashed */\r\n dashedLines?: (string | number)[];\r\n /** Array of dash settings that define the dash style for the dashed line. If the length of the array is less than length of dashedLines then it loop around. */\r\n dashSettings?: string[];\r\n /** Defines which labels are hidden from the color scale and the graph */\r\n labelsToBeHidden?: (string | number)[];\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: 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 /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Labels for the lines */\r\n labels: (string | number)[];\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 /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\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 /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_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 MultiLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n lineColors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n labels,\r\n padding,\r\n showValues = false,\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n showColorLegendAtTop = false,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n highlightedLines = [],\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n colorLegendTitle,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n dashedLines = [],\r\n dashSettings = ['5 5'],\r\n labelsToBeHidden = [],\r\n showColorScale = true,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a multi-line chart that shows trends over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop && showColorScale ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n labelsToBeHidden={labelsToBeHidden}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n dateFormat={dateFormat}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n labels={labels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorScale ? showColorLegendAtTop : true}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n highlightedLines={highlightedLines}\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 rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n labelsToBeHidden={labelsToBeHidden}\r\n dashedLines={dashedLines}\r\n dashSettings={dashSettings}\r\n revealClipId={generateRandomString(8)}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","dateFormat","noOfXTicks","labels","rightMargin","topMargin","bottomMargin","suffix","prefix","leftMargin","tooltip","onSeriesMouseOver","showValues","showColorLegendAtTop","refValues","highlightAreaSettings","minValue","maxValue","highlightedLines","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","dimmedOpacity","precision","customLayers","dashedLines","dashSettings","labelsToBeHidden","revealClipId","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","sortBy","d","parse","dataArray","_d","el","checkIfNullOrUndefined","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","MultiLineChart","graphTitle","Colors","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","colorLegendTitle","minHeight","theme","ariaLabel","showColorScale","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,KAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAC;AAAA,EAAA,IACE1C,IACE2C,KAASC,GAAO,IAAI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;AAAA,sBACA,YAAAC;AAAA,sBACA,YAAAC;AAAA,sBACA,SAAAC;AAAA,sBACA,SAAAC;AAAA,sBACA,WAAAC;AAAA,sBACA,QAAAC;AAAA,sBACA,YAAAC;AAAA,sBACA,eAAAC;AAAA,sBACA,WAAAC;AAAA,sBACA,cAAAC;AAAA,sBACA,kBAAAG;AAAA,sBACA,aAAAF;AAAA,sBACA,cAAAC;AAAA,sBACA,cAAc2G,GAAqB,CAAC;AAAA,oBAAA;AAAA,kBAAA,IAEpC,KAAA,CACN;AAAA,gBAAA,EAAA,CACF,EAAA,CAEJ;AAAA,gBACC1B,KAAWE,IACVvB,gBAAAA,EAAAA;AAAAA,kBAACgD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUlH,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAsF;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAzH;AAAA,kBAAA;AAAA,gBAAA,IAEA;AAAA,cAAA,EAAA,CACN;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"MultiLineChart.js","sources":["../src/Components/Graphs/LineCharts/MultiLineChart/Graph.tsx","../src/Components/Graphs/LineCharts/MultiLineChart/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\r\nimport {\r\n line,\r\n curveLinear,\r\n curveMonotoneX,\r\n curveStep,\r\n curveStepAfter,\r\n curveStepBefore,\r\n} from 'd3-shape';\r\nimport { scaleLinear, scaleTime } from 'd3-scale';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { bisectCenter } from 'd3-array';\r\nimport { pointer, select } from 'd3-selection';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { motion, useInView } from 'motion/react';\r\nimport orderBy from 'lodash.orderby';\r\n\r\nimport {\r\n AnimateDataType,\r\n AnnotationSettingsDataType,\r\n ClassNameObject,\r\n CurveTypes,\r\n CustomHighlightAreaSettingsDataType,\r\n CustomLayerDataType,\r\n HighlightAreaSettingsDataType,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getLineEndPoint } from '@/Utils/getLineEndPoint';\r\nimport { AxisTitle } from '@/Components/Elements/Axes/AxisTitle';\r\nimport { Axis } from '@/Components/Elements/Axes/Axis';\r\nimport { XTicksAndGridLines } from '@/Components/Elements/Axes/XTicksAndGridLines';\r\nimport { RefLineY } from '@/Components/Elements/ReferenceLine';\r\nimport { Annotation } from '@/Components/Elements/Annotations';\r\nimport { YTicksAndGridLines } from '@/Components/Elements/Axes/YTicksAndGridLines';\r\nimport { CustomArea } from '@/Components/Elements/HighlightArea/customArea';\r\nimport { HighlightArea } from '@/Components/Elements/HighlightArea';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\r\n lineColors: string[];\r\n width: number;\r\n height: number;\r\n dateFormat: string;\r\n noOfXTicks: number;\r\n labels: (string | number)[];\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n suffix: string;\r\n prefix: string;\r\n showValues: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n showColorLegendAtTop: boolean;\r\n highlightAreaSettings: HighlightAreaSettingsDataType[];\r\n refValues: ReferenceDataType[];\r\n maxValue?: number;\r\n minValue?: number;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n rtl: boolean;\r\n strokeWidth: number;\r\n showDots: boolean;\r\n annotations: AnnotationSettingsDataType[];\r\n customHighlightAreaSettings: CustomHighlightAreaSettingsDataType[];\r\n yAxisTitle?: string;\r\n noOfYTicks: number;\r\n minDate?: string | number;\r\n maxDate?: string | number;\r\n curveType: CurveTypes;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n dashedLines: (string | number)[];\r\n dashSettings: string[];\r\n labelsToBeHidden: (string | number)[];\r\n revealClipId: string;\r\n}\r\n\r\ninterface FormattedDataType {\r\n y: number;\r\n date: Date;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n width,\r\n height,\r\n lineColors,\r\n dateFormat,\r\n noOfXTicks,\r\n labels,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n suffix,\r\n prefix,\r\n leftMargin,\r\n tooltip,\r\n onSeriesMouseOver,\r\n showValues,\r\n showColorLegendAtTop,\r\n refValues,\r\n highlightAreaSettings,\r\n minValue,\r\n maxValue,\r\n highlightedLines,\r\n animate,\r\n rtl,\r\n strokeWidth,\r\n showDots,\r\n annotations,\r\n customHighlightAreaSettings,\r\n yAxisTitle,\r\n noOfYTicks,\r\n minDate,\r\n maxDate,\r\n curveType,\r\n styles,\r\n classNames,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n dashedLines,\r\n dashSettings,\r\n labelsToBeHidden,\r\n revealClipId,\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 [hasAnimatedOnce, setHasAnimatedOnce] = useState(false);\r\n\r\n useEffect(() => {\r\n if (isInView && !hasAnimatedOnce) {\r\n const timeout = setTimeout(\r\n () => {\r\n setHasAnimatedOnce(true);\r\n },\r\n (animate.duration + 0.5) * 1000,\r\n );\r\n return () => clearTimeout(timeout);\r\n }\r\n }, [isInView, hasAnimatedOnce, animate.duration]);\r\n const curve =\r\n curveType === 'linear'\r\n ? curveLinear\r\n : curveType === 'step'\r\n ? curveStep\r\n : curveType === 'stepAfter'\r\n ? curveStepAfter\r\n : curveType === 'stepBefore'\r\n ? curveStepBefore\r\n : curveMonotoneX;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: yAxisTitle ? leftMargin + 30 : leftMargin,\r\n right: rightMargin,\r\n };\r\n const MouseoverRectRef = useRef(null);\r\n const dataFormatted = orderBy(\r\n data.map(d => ({\r\n ...d,\r\n date: parse(`${d.date}`, dateFormat, new Date()),\r\n })),\r\n ['date'],\r\n ['asc'],\r\n );\r\n const dataArray = dataFormatted[0].y.map((_d, i) => {\r\n return dataFormatted\r\n .map(el => ({\r\n ...el,\r\n y: el.y[i],\r\n }))\r\n .filter(el => !checkIfNullOrUndefined(el.y));\r\n });\r\n const highlightAreaSettingsFormatted = highlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: [\r\n d.coordinates[0] === null ? null : parse(`${d.coordinates[0]}`, dateFormat, new Date()),\r\n d.coordinates[1] === null ? null : parse(`${d.coordinates[1]}`, dateFormat, new Date()),\r\n ],\r\n }));\r\n const customHighlightAreaSettingsFormatted = customHighlightAreaSettings.map(d => ({\r\n ...d,\r\n coordinates: d.coordinates.map((el, j) =>\r\n j % 2 === 0 ? parse(`${el}`, dateFormat, new Date()) : (el as number),\r\n ),\r\n }));\r\n const graphWidth = width - margin.left - margin.right;\r\n const graphHeight = height - margin.top - margin.bottom;\r\n const minYear = minDate ? parse(`${minDate}`, dateFormat, new Date()) : dataFormatted[0].date;\r\n const maxYear = maxDate\r\n ? parse(`${maxDate}`, dateFormat, new Date())\r\n : dataFormatted[dataFormatted.length - 1].date;\r\n const minParam: number = checkIfNullOrUndefined(minValue)\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n ) > 0\r\n ? 0\r\n : Math.min(\r\n ...dataFormatted.map(d =>\r\n Math.min(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0\r\n : (minValue as number);\r\n const maxParam: number = Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n ? Math.max(\r\n ...dataFormatted.map(d =>\r\n Math.max(...(d.y.filter(el => !checkIfNullOrUndefined(el)) as number[])),\r\n ),\r\n )\r\n : 0;\r\n\r\n const x = scaleTime().domain([minYear, maxYear]).range([0, graphWidth]);\r\n const y = scaleLinear()\r\n .domain([\r\n checkIfNullOrUndefined(minValue) ? minParam : (minValue as number),\r\n checkIfNullOrUndefined(maxValue) ? (maxParam > 0 ? maxParam : 0) : (maxValue as number),\r\n ])\r\n .range([graphHeight, 0])\r\n .nice();\r\n\r\n const lineShape = line<FormattedDataType>()\r\n .x(d => x(d.date))\r\n .y(d => y(d.y))\r\n .curve(curve);\r\n\r\n const yTicks = y.ticks(noOfYTicks);\r\n const xTicks = x.ticks(noOfXTicks);\r\n useEffect(() => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const mousemove = (event: any) => {\r\n const selectedData =\r\n dataFormatted[\r\n bisectCenter(\r\n dataFormatted.map(d => d.date),\r\n x.invert(pointer(event)[0]),\r\n 0,\r\n )\r\n ];\r\n setMouseOverData(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(selectedData || dataFormatted[dataFormatted.length - 1]);\r\n };\r\n const mouseout = () => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n };\r\n select(MouseoverRectRef.current).on('mousemove', mousemove).on('mouseout', mouseout);\r\n onSeriesMouseOver?.(undefined);\r\n }, [x, dataFormatted, onSeriesMouseOver]);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n viewBox={`0 0 ${width} ${height}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n <defs>\r\n <clipPath id={revealClipId}>\r\n <motion.rect\r\n x={0}\r\n y={0}\r\n height={graphHeight}\r\n variants={{\r\n initial: { width: 0 },\r\n whileInView: {\r\n width: graphWidth,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n </clipPath>\r\n </defs>\r\n <HighlightArea\r\n areaSettings={highlightAreaSettingsFormatted}\r\n width={graphWidth}\r\n height={graphHeight}\r\n scale={x}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <CustomArea\r\n areaSettings={customHighlightAreaSettingsFormatted}\r\n scaleX={x}\r\n scaleY={y}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n <g>\r\n <YTicksAndGridLines\r\n values={yTicks.filter(d => d !== 0)}\r\n y={yTicks.filter(d => d !== 0).map(d => y(d))}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n styles={{\r\n gridLines: styles?.yAxis?.gridLines,\r\n labels: styles?.yAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: classNames?.yAxis?.gridLines,\r\n labels: classNames?.yAxis?.labels,\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='secondary'\r\n showGridLines\r\n labelPos='vertical'\r\n precision={precision}\r\n />\r\n <Axis\r\n y1={y(minParam < 0 ? 0 : minParam)}\r\n y2={y(minParam < 0 ? 0 : minParam)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n label={numberFormattingFunction(\r\n minParam < 0 ? 0 : minParam,\r\n 'NA',\r\n precision,\r\n prefix,\r\n suffix,\r\n )}\r\n labelPos={{\r\n x: 0 - leftMargin,\r\n y: y(minParam < 0 ? 0 : minParam),\r\n dx: 0,\r\n dy: maxParam < 0 ? '1em' : -5,\r\n }}\r\n classNames={{\r\n axis: classNames?.xAxis?.axis,\r\n label: classNames?.yAxis?.labels,\r\n }}\r\n styles={{\r\n axis: styles?.xAxis?.axis,\r\n label: styles?.yAxis?.labels,\r\n }}\r\n />\r\n <AxisTitle\r\n x={0 - leftMargin - 15}\r\n y={graphHeight / 2}\r\n style={styles?.yAxis?.title}\r\n className={classNames?.yAxis?.title}\r\n text={yAxisTitle}\r\n rotate90\r\n />\r\n </g>\r\n <g>\r\n <XTicksAndGridLines\r\n values={xTicks.map(d => format(d, dateFormat))}\r\n x={xTicks.map(d => x(d))}\r\n y1={0}\r\n y2={graphHeight}\r\n styles={{\r\n gridLines: styles?.xAxis?.gridLines,\r\n labels: styles?.xAxis?.labels,\r\n }}\r\n classNames={{\r\n gridLines: cn('opacity-0', classNames?.xAxis?.gridLines),\r\n labels: cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[9px] md:text-[10px] lg:text-xs',\r\n classNames?.xAxis?.labels,\r\n ),\r\n }}\r\n suffix={suffix}\r\n prefix={prefix}\r\n labelType='primary'\r\n showGridLines\r\n precision={precision}\r\n />\r\n </g>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g>\r\n {dataArray.map((d, i) => (\r\n <motion.g\r\n key={labels[i]}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity:\r\n highlightedLines.length !== 0\r\n ? highlightedLines.indexOf(labels[i]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n <motion.path\r\n style={{\r\n fill: 'none',\r\n strokeWidth,\r\n }}\r\n clipPath={`url(#${revealClipId})`}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n ...(dashedLines.length === 0 ? { pathLength: 0 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n },\r\n whileInView: {\r\n ...(dashedLines.length === 0 ? { pathLength: 1 } : {}),\r\n d:\r\n lineShape(\r\n d.filter((el): el is FormattedDataType => !checkIfNullOrUndefined(el.y)),\r\n ) || '',\r\n opacity: 1,\r\n stroke: lineColors[i],\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n strokeDasharray={\r\n dashedLines.includes(labels[i])\r\n ? dashSettings[i % dashSettings.length]\r\n : undefined\r\n }\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n {d.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el.y) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n r={\r\n graphWidth / dataFormatted.length < 5\r\n ? 0\r\n : graphWidth / dataFormatted.length < 20\r\n ? 2\r\n : 4\r\n }\r\n style={{ fill: lineColors[i] }}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, cx: x(el.date), cy: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n cx: x(el.date),\r\n cy: y(el.y as number),\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n dy={-8}\r\n style={{\r\n fill: lineColors[i],\r\n textAnchor: 'middle',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: { opacity: 0, x: x(el.date), y: y(el.y as number) },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(el.date),\r\n y: y(el.y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {numberFormattingFunction(el.y, 'NA', precision, prefix, suffix)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n {showColorLegendAtTop || labelsToBeHidden.includes(labels[i]) ? null : (\r\n <motion.text\r\n style={{ fill: lineColors[i] }}\r\n className='text-xs'\r\n dx={5}\r\n dy={4}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n variants={{\r\n initial: {\r\n opacity: 0,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n },\r\n whileInView: {\r\n opacity: 1,\r\n x: x(d[d.length - 1].date),\r\n y: y(d[d.length - 1].y as number),\r\n transition: {\r\n duration: hasAnimatedOnce ? animate.duration : 0.5,\r\n delay: hasAnimatedOnce ? 0 : animate.duration,\r\n },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n >\r\n {labels[i]}\r\n </motion.text>\r\n )}\r\n </motion.g>\r\n ))}\r\n {mouseOverData ? (\r\n <line\r\n y1={0}\r\n y2={graphHeight}\r\n x1={x(mouseOverData.date)}\r\n x2={x(mouseOverData.date)}\r\n className={cn(\r\n 'undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100',\r\n classNames?.mouseOverLine,\r\n )}\r\n style={styles?.mouseOverLine}\r\n />\r\n ) : null}\r\n </g>\r\n {refValues ? (\r\n <>\r\n {refValues.map((el, i) => (\r\n <RefLineY\r\n key={i}\r\n text={el.text}\r\n color={el.color}\r\n y={y(el.value as number)}\r\n x1={0 - leftMargin}\r\n x2={graphWidth + margin.right}\r\n classNames={el.classNames}\r\n styles={el.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n ))}\r\n </>\r\n ) : null}\r\n <g>\r\n {annotations.map((d, i) => {\r\n const endPoints = getLineEndPoint(\r\n {\r\n x: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n },\r\n {\r\n x: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n y: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n },\r\n checkIfNullOrUndefined(d.connectorRadius) ? 3.5 : (d.connectorRadius as number),\r\n );\r\n const connectorSettings = d.showConnector\r\n ? {\r\n y1: endPoints.y,\r\n x1: endPoints.x,\r\n y2: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0)\r\n : 0 + (d.yOffset || 0),\r\n x2: d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n cy: d.yCoordinate ? y(d.yCoordinate as number) : 0,\r\n cx: d.xCoordinate ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) : 0,\r\n circleRadius: checkIfNullOrUndefined(d.connectorRadius)\r\n ? 3.5\r\n : (d.connectorRadius as number),\r\n strokeWidth: d.showConnector === true ? 2 : Math.min(d.showConnector || 0, 1),\r\n }\r\n : undefined;\r\n const labelSettings = {\r\n y: d.yCoordinate\r\n ? y(d.yCoordinate as number) + (d.yOffset || 0) - 8\r\n : 0 + (d.yOffset || 0) - 8,\r\n x: rtl\r\n ? 0\r\n : d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0),\r\n width: rtl\r\n ? d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)\r\n : graphWidth +\r\n margin.right -\r\n (d.xCoordinate\r\n ? x(parse(`${d.xCoordinate}`, dateFormat, new Date())) + (d.xOffset || 0)\r\n : 0 + (d.xOffset || 0)),\r\n maxWidth: d.maxWidth,\r\n fontWeight: d.fontWeight,\r\n align: d.align,\r\n };\r\n return (\r\n <Annotation\r\n key={i}\r\n color={d.color}\r\n connectorsSettings={connectorSettings}\r\n labelSettings={labelSettings}\r\n text={d.text}\r\n classNames={d.classNames}\r\n styles={d.styles}\r\n animate={animate}\r\n isInView={isInView}\r\n />\r\n );\r\n })}\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n <rect\r\n ref={MouseoverRectRef}\r\n style={{\r\n fill: 'none',\r\n pointerEvents: 'all',\r\n }}\r\n width={graphWidth}\r\n height={graphHeight}\r\n />\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 </>\r\n );\r\n}\r\n","import { useState, useRef, useEffect } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n AnnotationSettingsDataType,\r\n CustomHighlightAreaSettingsDataType,\r\n Languages,\r\n MultiLineChartDataType,\r\n ReferenceDataType,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n HighlightAreaSettingsDataType,\r\n CurveTypes,\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 { ColorLegend } from '@/Components/Elements/ColorLegend';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: MultiLineChartDataType[];\r\n\r\n // Titles, Labels, and Sources\r\n /** Title of the graph */\r\n graphTitle?: string | React.ReactNode;\r\n /** Description of the graph */\r\n graphDescription?: string | React.ReactNode;\r\n /** Footnote for the graph */\r\n footNote?: string | React.ReactNode;\r\n /** Source data for the graph */\r\n sources?: SourcesDataType[];\r\n /** Accessibility label */\r\n ariaLabel?: string;\r\n\r\n // Colors and Styling\r\n /** Array of colors of the lines */\r\n lineColors?: string[];\r\n /** Toggle the visibility of color legend between the top of the graphs and next to the line */\r\n showColorLegendAtTop?: boolean;\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 /** Array of labels of line which are dashed */\r\n dashedLines?: (string | number)[];\r\n /** Array of dash settings that define the dash style for the dashed line. If the length of the array is less than length of dashedLines then it loop around. */\r\n dashSettings?: string[];\r\n /** Defines which labels are hidden from the color scale and the graph */\r\n labelsToBeHidden?: (string | number)[];\r\n /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n padding?: string;\r\n /** Left margin of the graph */\r\n leftMargin?: number;\r\n /** Right margin of the graph */\r\n rightMargin?: number;\r\n /** Top margin of the graph */\r\n topMargin?: number;\r\n /** Bottom margin of the graph */\r\n bottomMargin?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n /** Maximum value for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n /** Reference values for comparison */\r\n refValues?: ReferenceDataType[];\r\n /** Maximum value of the date for the chart */\r\n maxDate?: string | number;\r\n /** Minimum value of the date for the chart */\r\n minDate?: string | number;\r\n /** No. of ticks on the x-axis */\r\n noOfXTicks?: number;\r\n /** No. of ticks on the y-axis */\r\n noOfYTicks?: 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 /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle the initial animation of the line. If the type is number then it uses the number as the time in seconds for animation. */\r\n animate?: boolean | AnimateDataType;\r\n /** Format of the date in the data object. Available formats can be found [here](https://date-fns.org/docs/format) */\r\n dateFormat?: string;\r\n /** Title for the Y-axis */\r\n yAxisTitle?: string;\r\n /** Labels for the lines */\r\n labels: (string | number)[];\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 /** Annotations on the chart */\r\n annotations?: AnnotationSettingsDataType[];\r\n /** Highlighted area(square) on the chart */\r\n highlightAreaSettings?: HighlightAreaSettingsDataType[];\r\n /** Highlighted area(custom shape) on the chart */\r\n customHighlightAreaSettings?: CustomHighlightAreaSettingsDataType[];\r\n /** Curve type for the line */\r\n curveType?: CurveTypes;\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 /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_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 MultiLineChart(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n lineColors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n graphDescription,\r\n height,\r\n width,\r\n footNote,\r\n noOfXTicks = 10,\r\n dateFormat = 'yyyy',\r\n labels,\r\n padding,\r\n showValues = false,\r\n backgroundColor = false,\r\n leftMargin = 30,\r\n rightMargin = 50,\r\n topMargin = 20,\r\n bottomMargin = 25,\r\n tooltip,\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n showColorLegendAtTop = false,\r\n refValues = [],\r\n highlightAreaSettings = [],\r\n graphID,\r\n minValue,\r\n maxValue,\r\n highlightedLines = [],\r\n graphDownload = false,\r\n dataDownload = false,\r\n animate = false,\r\n language = 'en',\r\n colorLegendTitle,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n showDots = true,\r\n annotations = [],\r\n customHighlightAreaSettings = [],\r\n theme = 'light',\r\n ariaLabel,\r\n yAxisTitle,\r\n noOfYTicks = 5,\r\n minDate,\r\n maxDate,\r\n curveType = 'curve',\r\n styles,\r\n classNames,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n dashedLines = [],\r\n dashSettings = ['5 5'],\r\n labelsToBeHidden = [],\r\n showColorScale = true,\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 620);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 620);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a multi-line chart that shows trends over time.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n <div className='grow flex flex-col justify-center gap-3 w-full'>\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorLegendAtTop && showColorScale ? (\r\n <ColorLegend\r\n colorDomain={labels}\r\n colorLegendTitle={colorLegendTitle}\r\n labelsToBeHidden={labelsToBeHidden}\r\n colors={lineColors}\r\n showNAColor={false}\r\n />\r\n ) : null}\r\n <div className='w-full grow leading-0' ref={graphDiv} aria-label='Graph area'>\r\n {(width || svgWidth) && (height || svgHeight) ? (\r\n <Graph\r\n data={data}\r\n lineColors={lineColors}\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n dateFormat={dateFormat}\r\n noOfXTicks={noOfXTicks}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n labels={labels}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n showColorLegendAtTop={showColorScale ? showColorLegendAtTop : true}\r\n showValues={showValues}\r\n suffix={suffix}\r\n prefix={prefix}\r\n highlightAreaSettings={highlightAreaSettings}\r\n refValues={refValues}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n highlightedLines={highlightedLines}\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 rtl={language === 'he' || language === 'ar'}\r\n strokeWidth={strokeWidth}\r\n showDots={showDots}\r\n annotations={annotations}\r\n customHighlightAreaSettings={customHighlightAreaSettings}\r\n yAxisTitle={yAxisTitle}\r\n noOfYTicks={noOfYTicks}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n curveType={curveType}\r\n styles={styles}\r\n classNames={classNames}\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n labelsToBeHidden={labelsToBeHidden}\r\n dashedLines={dashedLines}\r\n dashSettings={dashSettings}\r\n revealClipId={generateRandomString(8)}\r\n />\r\n ) : null}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","width","height","lineColors","dateFormat","noOfXTicks","labels","rightMargin","topMargin","bottomMargin","suffix","prefix","leftMargin","tooltip","onSeriesMouseOver","showValues","showColorLegendAtTop","refValues","highlightAreaSettings","minValue","maxValue","highlightedLines","animate","rtl","strokeWidth","showDots","annotations","customHighlightAreaSettings","yAxisTitle","noOfYTicks","minDate","maxDate","curveType","styles","classNames","dimmedOpacity","precision","customLayers","dashedLines","dashSettings","labelsToBeHidden","revealClipId","svgRef","useRef","isInView","useInView","hasAnimatedOnce","setHasAnimatedOnce","useState","useEffect","timeout","curve","curveLinear","curveStep","curveStepAfter","curveStepBefore","curveMonotoneX","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","margin","MouseoverRectRef","dataFormatted","orderBy","d","parse","dataArray","_d","el","checkIfNullOrUndefined","highlightAreaSettingsFormatted","customHighlightAreaSettingsFormatted","j","graphWidth","graphHeight","minYear","maxYear","minParam","maxParam","x","scaleTime","y","scaleLinear","lineShape","line","yTicks","xTicks","mousemove","event","selectedData","bisectCenter","pointer","mouseout","select","jsxs","Fragment","jsx","motion","HighlightArea","CustomArea","YTicksAndGridLines","Axis","numberFormattingFunction","AxisTitle","XTicksAndGridLines","format","cn","RefLineY","endPoints","getLineEndPoint","connectorSettings","labelSettings","Annotation","Tooltip","MultiLineChart","graphTitle","Colors","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","graphID","graphDownload","dataDownload","language","colorLegendTitle","minHeight","theme","ariaLabel","showColorScale","svgWidth","setSvgWidth","svgHeight","setSvgHeight","graphDiv","graphParentDiv","resizeObserver","entries","GraphHeader","EmptyState","ColorLegend","generateRandomString","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGO,SAASA,GAAMC,IAAc;AAClC,QAAM;AAAA,IACJ,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,UAAA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,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),I=require("./index-D72cOtq7.cjs"),j=require("./index-BS2TADPj.cjs"),b=require("./DropdownSelect-DBDM64B5.cjs"),z=require("./checkIfMultiple-BXbHUCWM.cjs"),L=require("./SingleGraphDashboard.cjs"),U=require("./SingleGraphDashboardThreeDGraphs.cjs"),Z=require("./SingleGraphDashboardGeoHubMaps.cjs"),p=require("./fetchAndParseData-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),o=require("react"),I=require("./index-D72cOtq7.cjs"),j=require("./index-BS2TADPj.cjs"),b=require("./DropdownSelect-DBDM64B5.cjs"),z=require("./checkIfMultiple-BXbHUCWM.cjs"),L=require("./SingleGraphDashboard.cjs"),U=require("./SingleGraphDashboardThreeDGraphs.cjs"),Z=require("./SingleGraphDashboardGeoHubMaps.cjs"),p=require("./fetchAndParseData-Ba-_CgxS.cjs"),J=require("./getUniqValue-RViz8tTw.cjs"),B=require("./GraphHeader.cjs"),k=require("./filterData-BoYadk0l.cjs"),V=require("./transformDataForSelect-YmStusCI.cjs"),w=y=>y.map(a=>a.columnWidth||1).reduce((a,h)=>a+h,0),K=["barChart","choroplethMap","biVariateChoroplethMap","circlePacking","treeMap"];function Q(y){const{dashboardID:C,dashboardLayout:s,dataSettings:a,filters:h,debugMode:c,theme:g="light",readableHeader:T,dataFilters:R,noOfFiltersPerRow:v=4,filterPosition:F,uiMode:d="normal",graphStyles:S,graphClassNames:D}=y,[m,H]=o.useState(void 0),[f,q]=o.useState(void 0),[u,E]=o.useState([]),A=["threeDGlobe"],N=["geoHubCompareMap","geoHubMap","geoHubMapWithLayerSelection"],G=o.useMemo(()=>({ignoreCase:!0,ignoreAccents:!0,trim:!0}),[]),O=o.useMemo(()=>!f||u.length===0?f:f.filter(l=>u.every(e=>e.value&&j.flattenDeep([e.value]).length>0?I.intersection(j.flattenDeep([l[e.filter]]),j.flattenDeep([e.value]).map(i=>i.value)).length>0:!0)),[u,f]);o.useEffect(()=>{H(O)},[O]);const M=o.useCallback(async()=>{if(a)try{const l=await(a.dataURL?typeof a.dataURL=="string"?a.fileType==="json"?p.fetchAndParseJSON(a.dataURL,a.columnsToArray,a.dataTransformation,c):a.fileType==="api"?p.fetchAndTransformDataFromAPI(a.dataURL,a.apiHeaders,a.columnsToArray,a.dataTransformation,c):p.fetchAndParseCSV(a.dataURL,a.dataTransformation,a.columnsToArray,c,a.delimiter,!0):p.fetchAndParseMultipleDataSources(a.dataURL,a.idColumnTitle):p.transformColumnsToArray(a.data,a.columnsToArray));q(l);const e=(h||[]).map(i=>({filter:i.column,label:i.label||`Filter by ${i.column}`,singleSelect:i.singleSelect,clearable:i.clearable,defaultValue:V.transformDefaultValue(i.defaultValue),value:V.transformDefaultValue(i.defaultValue),availableValues:J.getUniqValue(l,i.column).filter(n=>!i.excludeValues?.includes(`${n}`)).map(n=>({value:n,label:n})),allowSelectAll:i.allowSelectAll,width:i.width}));E(e)}catch(t){console.error("Data fetching error:",t)}},[a,h,c]);o.useEffect(()=>{M()},[M]);const x=o.useCallback((t,l)=>{E(e=>e.map(i=>i.filter===t?{...i,value:l}:i))},[]);return r.jsxRuntimeExports.jsx("div",{className:`${g||"light"} flex grow`,dir:s.language==="he"||s.language==="ar"?"rtl":void 0,children:r.jsxRuntimeExports.jsx("div",{className:`${s.backgroundColor?s.backgroundColor===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto gap-4 flex flex-col w-full grow h-inherit ${s.language||"en"}`,style:{...s.backgroundColor&&s.backgroundColor!==!0?{backgroundColor:s.backgroundColor}:{}},id:C,children:r.jsxRuntimeExports.jsx("div",{style:{padding:s.backgroundColor?s.padding||"1rem":s.padding||0,flexGrow:1,display:"flex"},children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[s.title||s.description?r.jsxRuntimeExports.jsx(B.GraphHeader,{graphTitle:s.title,graphDescription:s.description,isDashboard:!0}):null,r.jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap"},children:[u.length!==0?r.jsxRuntimeExports.jsx("div",{style:{width:F==="side"?"280px":"100%",flexGrow:1,flexShrink:0},children:r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",flexWrap:"wrap",alignItems:"flex-start",width:"100%",position:"sticky",top:"1rem"},children:u?.map((t,l)=>r.jsxRuntimeExports.jsxs("div",{style:{width:t.width||`calc(${100/v}% - ${(v-1)/v}rem)`,flexGrow:1,flexShrink:0,minWidth:"240px"},children:[r.jsxRuntimeExports.jsx(z.f,{className:"mb-2",children:t.label}),t.singleSelect?r.jsxRuntimeExports.jsx(b.Za,{options:t.availableValues,isClearable:t.clearable===void 0?!0:t.clearable,size:"sm",variant:d,isMulti:!1,isSearchable:!0,filterOption:b.Hu(G),onChange:e=>{x(t.filter,e)},defaultValue:t.defaultValue,value:t.value}):r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(b.Za,{options:t.availableValues,isMulti:!0,size:"sm",isClearable:t.clearable===void 0?!0:t.clearable,variant:d,isSearchable:!0,controlShouldRenderValue:!0,closeMenuOnSelect:!1,hideSelectedOptions:!1,filterOption:b.Hu(G),onChange:e=>{x(t.filter,e)},value:t.value,defaultValue:t.defaultValue}),t.allowSelectAll?r.jsxRuntimeExports.jsx("button",{type:"button",className:"bg-transparent border-0 p-0 mt-2 cursor-pointer text-primary-blue-600 dark:text-primary-blue-400",onClick:()=>{x(t.filter,t.availableValues)},children:"Select all options"}):null]})]},l))})}):null,r.jsxRuntimeExports.jsx("div",{style:{width:F==="side"?"calc(100% - 280px - 1rem)":"100%",minWidth:"280px",flexGrow:1,display:"flex",gap:"1rem",flexWrap:"wrap",flexShrink:"0"},children:s.rows.map((t,l)=>r.jsxRuntimeExports.jsx("div",{style:{display:"flex",gap:"1rem",alignItems:"stretch",minHeight:`${t.height||0}px`,height:"auto",width:"100%",flexWrap:"wrap"},children:t.columns.map((e,i)=>r.jsxRuntimeExports.jsx("div",{className:"flex bg-transparent h-inherit grow min-w-60",style:{width:`calc(${100*(e.columnWidth||1)/w(t.columns)}% - ${(w(t.columns)-(e.columnWidth||1))/w(t.columns)}rem)`,minHeight:"inherit"},children:A.includes(e.graphType)?r.jsxRuntimeExports.jsx(U.SingleGraphDashboardThreeDGraphs,{graphType:e.graphType,dataFilters:e.dataFilters,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},dataSettings:{data:m?k.filterData(m,R||[]):void 0},dataTransform:e.dataTransform,dataSelectionOptions:e.dataSelectionOptions,advancedDataSelectionOptions:e.advancedDataSelectionOptions,graphDataConfiguration:e.graphDataConfiguration,debugMode:c,readableHeader:T||[]}):N.includes(e.graphType)?r.jsxRuntimeExports.jsx(Z.SingleGraphDashboardGeoHubMaps,{graphType:e.graphType,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},debugMode:c}):r.jsxRuntimeExports.jsx(L.SingleGraphDashboard,{graphType:e.graphType,dataFilters:e.dataFilters,uiMode:d,graphSettings:{...e.settings||{},width:void 0,height:void 0,resetSelectionOnDoubleClick:e.attachedFilter?!1:e.settings?.resetSelectionOnDoubleClick,styles:e.settings?.styles||S,classNames:e.settings?.classNames||D,radius:e.graphType==="donutChart"?void 0:e.settings?.radius,size:e.graphType==="unitChart"?e.settings?.size:void 0,language:e.settings?.language||s.language,theme:e.settings?.theme||g},dataSettings:{data:m?k.filterData(m,R||[]):void 0},updateFilters:e.attachedFilter&&K.indexOf(e.graphType)!==-1&&u.findIndex(n=>n.filter===e.attachedFilter)!==-1?n=>{const W=u.findIndex($=>$.filter===e.attachedFilter),P=n?u[W].singleSelect?{value:n,label:n}:[{value:n,label:n}]:void 0;x(e.attachedFilter,P)}:void 0,dataTransform:e.dataTransform,dataSelectionOptions:e.dataSelectionOptions,advancedDataSelectionOptions:e.advancedDataSelectionOptions,graphDataConfiguration:e.graphDataConfiguration,debugMode:c,readableHeader:T||[]})},i))},l))})]})]})})})})}exports.PerformanceIntensiveMultiGraphDashboard=Q;
|
|
2
2
|
//# sourceMappingURL=PerformanceIntensiveMultiGraphDashboard.cjs.map
|
|
@@ -7,8 +7,8 @@ import { f as q } from "./checkIfMultiple-ChTJk2Tk.js";
|
|
|
7
7
|
import { SingleGraphDashboard as J } from "./SingleGraphDashboard.js";
|
|
8
8
|
import { SingleGraphDashboardThreeDGraphs as B } from "./SingleGraphDashboardThreeDGraphs.js";
|
|
9
9
|
import { SingleGraphDashboardGeoHubMaps as K } from "./SingleGraphDashboardGeoHubMaps.js";
|
|
10
|
-
import { f as Q, a as X, b as Y, c as _, t as aa } from "./fetchAndParseData-
|
|
11
|
-
import { g as ea } from "./getUniqValue-
|
|
10
|
+
import { f as Q, a as X, b as Y, c as _, t as aa } from "./fetchAndParseData-sapWbnYk.js";
|
|
11
|
+
import { g as ea } from "./getUniqValue-DiCh_MOD.js";
|
|
12
12
|
import { GraphHeader as ta } from "./GraphHeader.js";
|
|
13
13
|
import { f as W } from "./filterData-9nEcQ-Jp.js";
|
|
14
14
|
import { t as $ } from "./transformDataForSelect-D8AuvYdf.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),s=require("react"),o=require("./Spinner-DA6Z5E4n.cjs"),d=require("./PerformanceIntensiveMultiGraphDashboard.cjs"),f=require("./fetchAndParseData-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CHPV5EwG-DDoeWRVt.cjs"),s=require("react"),o=require("./Spinner-DA6Z5E4n.cjs"),d=require("./PerformanceIntensiveMultiGraphDashboard.cjs"),f=require("./fetchAndParseData-Ba-_CgxS.cjs");function u(i){const{config:t}=i,[e,a]=s.useState(void 0);return s.useEffect(()=>{(async()=>{if(typeof t=="string"){const n=await f.fetchAndParseJSON(t);a(n)}else a(t)})()},[t]),e?r.jsxRuntimeExports.jsx(d.PerformanceIntensiveMultiGraphDashboard,{dashboardID:e.dashboardID,dashboardLayout:e.dashboardLayout,dataSettings:e.dataSettings,filters:e.filters,debugMode:e.debugMode,theme:e.theme,readableHeader:e.readableHeader,dataFilters:e.dataFilters,noOfFiltersPerRow:e.noOfFiltersPerRow,filterPosition:e.filterPosition,uiMode:e.uiMode,graphStyles:e.graphStyles,graphClassNames:e.graphClassNames}):r.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center p-4",children:r.jsxRuntimeExports.jsx(o.y,{})})}exports.PerformanceIntensiveMultiGraphDashboardFromConfig=u;
|
|
2
2
|
//# sourceMappingURL=PerformanceIntensiveMultiGraphDashboardFromConfig.cjs.map
|
|
@@ -2,7 +2,7 @@ import { j as a } from "./index-CHPV5EwG-BPSP-7Jg.js";
|
|
|
2
2
|
import { useState as i, useEffect as n } from "react";
|
|
3
3
|
import { y as f } from "./Spinner-C85UF28E.js";
|
|
4
4
|
import { PerformanceIntensiveMultiGraphDashboard as d } from "./PerformanceIntensiveMultiGraphDashboard.js";
|
|
5
|
-
import { f as l } from "./fetchAndParseData-
|
|
5
|
+
import { f as l } from "./fetchAndParseData-sapWbnYk.js";
|
|
6
6
|
function b(s) {
|
|
7
7
|
const { config: t } = s, [e, r] = i(void 0);
|
|
8
8
|
return n(() => {
|
package/dist/RadarChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),xt=require("./index-BJOeaYTk.cjs"),wt=require("./index-DQA8q5sC.cjs"),bt=require("./Modal-tXZlLE5s.cjs"),Et=require("./Tooltip-De16GWhY.cjs"),q=require("./Colors.cjs"),dt=require("./numberFormattingFunction-02t-wJta.cjs"),kt=require("./string2HTML-z7CwHXcx.cjs"),N=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),pt=require("./linear-BVckp9RD.cjs"),mt=require("./line-DHV4JwCR.cjs"),Rt=require("./use-in-view-sQJZ_xDO.cjs"),W=require("./proxy-BHRoeZgd.cjs"),Ct=require("./index-BW8iNx7E.cjs"),It=require("./GraphFooter.cjs"),St=require("./GraphHeader.cjs"),Nt=require("./EmptyState-d8_8SxeW.cjs"),Ot=require("./ColorLegendWithMouseOver.cjs");var Pt=gt(mt.curveLinear);function ft(t){this._curve=t}ft.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};function gt(t){function e(r){return new ft(t(r))}return e._curve=t,e}function Tt(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(r){return arguments.length?e(gt(r)):e()._curve},t}function $t(){return Tt(mt.line().curve(Pt))}function it(){}function ht(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function _t(t,e){this._context=t,this._k=(1-e)/6}_t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ht(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function r(c){return new _t(c,e)}return r.tension=function(c){return t(+c)},r})(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const qt=function t(e){function r(c){return new yt(c,e)}return r.tension=function(c){return t(+c)},r}(0);function vt(t){this._context=t}vt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Vt(t){return new vt(t)}function Dt(t){const{data:e,radius:r,lineColors:c,tooltip:k,onSeriesMouseOver:V,onSeriesMouseClick:M,colorDomain:u,detailsOnClick:j,styles:y,classNames:d,selectedColor:O,axisLabels:G,strokeWidth:et,showValues:nt,showDots:st,rightMargin:ot,topMargin:U,bottomMargin:rt,leftMargin:D,curveType:X,noOfTicks:Y,minValue:P,maxValue:T,resetSelectionOnDoubleClick:at,fillShape:h,highlightedLines:g,animate:x,dimmedOpacity:_,precision:R,customLayers:z}=t,B=f.useRef(null),$=Rt.useInView(B,{once:x.once,amount:x.amount}),w=X==="linear"?Vt:qt,b={top:U,left:D},v=Math.min((2*r-D-ot)/2,(2*r-U-rt)/2),[E,L]=f.useState(void 0),[C,A]=f.useState(void 0),[J,H]=f.useState(void 0),[K,F]=f.useState(void 0),l=pt.linear().domain([0,e[0].values.length]).range([0,2*Math.PI]),Q=N.checkIfNullOrUndefined(T)?Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))<0?0:Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):T,lt=N.checkIfNullOrUndefined(P)?Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))>=0?0:Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):P,p=pt.linear().domain([lt,Q]).range([0,v]).nice(),ct=p.ticks(Y),I=$t().radius(i=>p(i)).angle((i,s)=>l(s)).curve(w);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(W.motion.svg,{width:`${r*2}px`,height:`${r*2}px`,viewBox:`0 0 ${r*2} ${r*2}`,direction:"ltr",ref:B,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${b.left},${b.top})`,children:[z.filter(i=>i.position==="before").map(i=>i.layer),n.jsxRuntimeExports.jsxs("g",{transform:`translate(${v},${v})`,children:[G.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("line",{x1:0,y1:0,x2:Math.cos(l(s)-Math.PI/2)*v,y2:Math.sin(l(s)-Math.PI/2)*v,className:n.mo("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.axis),style:y?.xAxis?.axis},s),n.jsxRuntimeExports.jsx("text",{x:Math.cos(l(s)-Math.PI/2)*(v+6),y:Math.sin(l(s)-Math.PI/2)*(v+6),style:{textAnchor:Math.cos(l(s)-Math.PI/2)<0?"end":Math.cos(l(s)-Math.PI/2)<1e-5?"middle":"start",...y?.xAxis?.labels||""},dy:Math.sin(l(s)-Math.PI/2)<0?0:Math.sin(l(s)-Math.PI/2)<1e-5?5:10,className:n.mo("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",d?.xAxis?.labels),children:i})]},s)),ct.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("path",{d:I(Array(G.length).fill(i))||"",className:n.mo("stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.gridLines),style:{...y?.xAxis?.gridLines,fill:"none"}}),n.jsxRuntimeExports.jsx("foreignObject",{x:-25,y:Math.sin(-Math.PI/2)*p(i)>-1e-4?Math.sin(-Math.PI/2)*p(i)-7:Math.sin(-Math.PI/2)*p(i)-5,width:50,height:12,children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-center",children:n.jsxRuntimeExports.jsx("p",{className:n.mo("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",d?.xAxis?.labels),style:y?.xAxis?.labels,children:dt.numberFormattingFunction(i,"NA",R)})})})]},s)),n.jsxRuntimeExports.jsx(Ct.AnimatePresence,{children:e.map((i,s)=>n.jsxRuntimeExports.jsxs(W.motion.g,{variants:{initial:{opacity:E?i.label===E.label?1:_:O?i.color&&c[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:.3:1},whileInView:{opacity:E?i.label===E.label?1:_:O?i.color&&c[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:_:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},onMouseEnter:a=>{L(i),F(a.clientY),H(a.clientX),V?.(i)},onMouseMove:a=>{L(i),F(a.clientY),H(a.clientX)},onMouseLeave:()=>{L(void 0),H(void 0),F(void 0),V?.(void 0)},onClick:()=>{(M||j)&&(wt.isEqual(C,i)&&at?(A(void 0),M?.(void 0)):(A(i),M?.(i)))},children:[n.jsxRuntimeExports.jsx(W.motion.path,{d:I(i.values)||"",variants:{initial:{d:I(i.values.map(a=>0))||""},whileInView:{d:I(i.values)||"",transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},style:{stroke:e.filter(a=>a.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray,fill:h?e.filter(a=>a.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray:"none",fillOpacity:.1,strokeWidth:et}}),n.jsxRuntimeExports.jsx("g",{children:i.values.map((a,m)=>n.jsxRuntimeExports.jsx("g",{children:N.checkIfNullOrUndefined(a)?null:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[st?n.jsxRuntimeExports.jsx(W.motion.circle,{cx:Math.cos(l(m)-Math.PI/2)*p(a),cy:Math.sin(l(m)-Math.PI/2)*p(a),r:4,style:{fill:e.filter(Z=>Z.color).length===0?c[0]:i.color?c[u.indexOf(i.color)]:q.Colors.gray},variants:{initial:{cx:0,cy:0,opacity:0},whileInView:{cx:Math.cos(l(m)-Math.PI/2)*p(a),cy:Math.sin(l(m)-Math.PI/2)*p(a),opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}}}):null,nt?n.jsxRuntimeExports.jsx(W.motion.text,{x:Math.cos(l(m)-Math.PI/2)*(p(a)+6),y:Math.sin(l(m)-Math.PI/2)*(p(a)+6),style:{fill:c[s],textAnchor:Math.cos(l(m)-Math.PI/2)<0?"end":Math.cos(l(m)-Math.PI/2)<1e-5?"middle":"start",...y?.graphObjectValues||{}},dy:Math.sin(l(m)-Math.PI/2)<0?10:(Math.sin(l(m)-Math.PI/2)<1e-5,0),className:n.mo("graph-value text-xs font-bold",d?.graphObjectValues),variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:$?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},children:dt.numberFormattingFunction(a,"NA",R)}):null]})},m))})]},i.label||s))})]}),z.filter(i=>i.position==="after").map(i=>i.layer)]})}),E&&k&&J&&K?n.jsxRuntimeExports.jsx(Et.Tooltip,{data:E,body:k,xPos:J,yPos:K,backgroundStyle:y?.tooltip,className:d?.tooltip}):null,j&&C!==void 0?n.jsxRuntimeExports.jsx(bt.X,{open:C!==void 0,onClose:()=>{A(void 0)},children:n.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof j=="string"?{__html:kt.string2HTML(j,C)}:void 0,children:typeof j=="function"?j(C):null})}):null]})}function Lt(t){const{graphTitle:e,colors:r,sources:c,graphDescription:k,footNote:V,radius:M,data:u,showColorScale:j=!0,padding:y,backgroundColor:d=!1,tooltip:O,onSeriesMouseOver:G,graphID:et,onSeriesMouseClick:nt,topMargin:st=75,bottomMargin:ot=75,leftMargin:U=75,rightMargin:rt=75,graphDownload:D=!1,dataDownload:X=!1,colorDomain:Y,language:P="en",theme:T="light",highlightedLines:at=[],width:h,height:g,minHeight:x=0,strokeWidth:_=2,relativeHeight:R,ariaLabel:z,colorLegendTitle:B,detailsOnClick:$,styles:w,classNames:b,showNAColor:v=!0,axisLabels:E,showDots:L=!0,showValues:C=!1,curveType:A="curve",noOfTicks:J=5,minValue:H,maxValue:K,fillShape:F=!1,resetSelectionOnDoubleClick:l=!0,animate:Q=!1,dimmedOpacity:lt=.3,precision:p=2,customLayers:ct=[]}=t,[I,i]=f.useState(0),[s,a]=f.useState(0),[m,Z]=f.useState(0),[Mt,jt]=f.useState(void 0),S=f.useRef(null),ut=f.useRef(null);return f.useEffect(()=>{const o=new ResizeObserver(tt=>{a(h||tt[0].target.clientWidth||420),Z(g||tt[0].target.clientHeight||420),i((Math.min(h||tt[0].target.clientWidth||620,g||tt[0].target.clientHeight||480)||420)/2)});return S.current&&(Z(S.current.clientHeight||420),a(S.current.clientWidth||420),i((Math.min(S.current.clientWidth,S.current.clientHeight)||420)/2),(!h||!M)&&o.observe(S.current)),()=>o.disconnect()},[h,g,M]),n.jsxRuntimeExports.jsx("div",{className:`${T||"light"} flex ${h?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:n.jsxRuntimeExports.jsx("div",{className:n.mo(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,h?"w-fit":"w-full",b?.graphContainer),style:{...w?.graphContainer||{},minHeight:"inherit",...d&&d!==!0?{backgroundColor:d}:{}},id:et,ref:ut,"aria-label":z||`${e?`The graph shows ${e}. `:""}This is a donut or pie chart chart. ${k?` ${k}`:""}`,children:n.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:d?y||"1rem":y||0},children:n.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 w-full grow justify-between",children:[e||k||D||X?n.jsxRuntimeExports.jsx(St.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:b?.title,description:b?.description},graphTitle:e,graphDescription:k,width:h,graphDownload:D?ut.current:void 0,dataDownload:X?u.map(o=>o.data).filter(o=>o!==void 0).length>0?u.map(o=>o.data).filter(o=>o!==void 0):u.filter(o=>o!==void 0):null}):null,n.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center items-stretch gap-8 flex-wrap",style:{width:h?`${h}px`:"100%"},children:u.length===0?n.jsxRuntimeExports.jsx(Nt.EmptyState,{}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[j&&u.filter(o=>o.color).length!==0?n.jsxRuntimeExports.jsx(Ot.ColorLegendWithMouseOver,{width:h,colorLegendTitle:B,colors:r||q.Colors[T].categoricalColors.colors,colorDomain:Y||xt.uniqBy(u.filter(o=>o.color),"color").map(o=>o.color),setSelectedColor:jt,showNAColor:v}):null,n.jsxRuntimeExports.jsx("div",{className:`flex ${h?"grow-0":"grow"} items-center justify-center leading-0`,style:{width:h?`${h}px`:"100%",height:g?`${Math.max(x,g||(R?x?(h||s)*R>x?(h||s)*R:x:(h||s)*R:m))}px`:"auto"},ref:S,"aria-label":"Graph area",children:n.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center leading-0",children:M||I?n.jsxRuntimeExports.jsx(Dt,{data:u,lineColors:u.filter(o=>o.color).length===0?r?[r]:[q.Colors.primaryColors["blue-600"]]:r||q.Colors[T].categoricalColors.colors,radius:M||I,tooltip:O,colorDomain:Y||xt.uniqBy(u.filter(o=>o.color),"color").map(o=>o.color),onSeriesMouseOver:G,onSeriesMouseClick:nt,styles:w,detailsOnClick:$,selectedColor:Mt,axisLabels:E,strokeWidth:_,showValues:C,showDots:L,topMargin:st,bottomMargin:ot,leftMargin:U,rightMargin:rt,curveType:A,noOfTicks:J,minValue:H,maxValue:K,fillShape:F,highlightedLines:at,resetSelectionOnDoubleClick:l,animate:Q===!0?{duration:.5,once:!0,amount:.5}:Q||{duration:0,once:!0,amount:0},dimmedOpacity:lt,precision:p,customLayers:ct}):null})})]})}),c||V?n.jsxRuntimeExports.jsx(It.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:c,footNote:V,width:h}):n.jsxRuntimeExports.jsx("div",{})]})})})})}exports.RadarChart=Lt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-CHPV5EwG-DDoeWRVt.cjs"),f=require("react"),wt=require("./index-DQA8q5sC.cjs"),bt=require("./Modal-tXZlLE5s.cjs"),Et=require("./Tooltip-De16GWhY.cjs"),V=require("./Colors.cjs"),xt=require("./numberFormattingFunction-02t-wJta.cjs"),kt=require("./string2HTML-z7CwHXcx.cjs"),N=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),dt=require("./linear-BVckp9RD.cjs"),mt=require("./line-DHV4JwCR.cjs"),Rt=require("./use-in-view-sQJZ_xDO.cjs"),W=require("./proxy-BHRoeZgd.cjs"),Ct=require("./index-BW8iNx7E.cjs"),It=require("./GraphFooter.cjs"),St=require("./GraphHeader.cjs"),Nt=require("./EmptyState-d8_8SxeW.cjs"),Ot=require("./ColorLegendWithMouseOver.cjs"),pt=require("./uniqBy-O05lp2S5.cjs");var Pt=gt(mt.curveLinear);function ft(t){this._curve=t}ft.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};function gt(t){function e(o){return new ft(t(o))}return e._curve=t,e}function qt(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(o){return arguments.length?e(gt(o)):e()._curve},t}function Tt(){return qt(mt.line().curve(Pt))}function it(){}function ht(t,e,o){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-o),t._x2,t._y2)}function _t(t,e){this._context=t,this._k=(1-e)/6}_t.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:ht(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function o(l){return new _t(l,e)}return o.tension=function(l){return t(+l)},o})(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:ht(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const Vt=function t(e){function o(l){return new yt(l,e)}return o.tension=function(l){return t(+l)},o}(0);function vt(t){this._context=t}vt.prototype={areaStart:it,areaEnd:it,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function $t(t){return new vt(t)}function Dt(t){const{data:e,radius:o,lineColors:l,tooltip:k,onSeriesMouseOver:$,onSeriesMouseClick:M,colorDomain:u,detailsOnClick:j,styles:y,classNames:d,selectedColor:O,axisLabels:G,strokeWidth:et,showValues:nt,showDots:st,rightMargin:ot,topMargin:U,bottomMargin:rt,leftMargin:D,curveType:X,noOfTicks:B,minValue:P,maxValue:q,resetSelectionOnDoubleClick:at,fillShape:c,highlightedLines:g,animate:x,dimmedOpacity:_,precision:R,customLayers:Y}=t,z=f.useRef(null),T=Rt.useInView(z,{once:x.once,amount:x.amount}),w=X==="linear"?$t:Vt,b={top:U,left:D},v=Math.min((2*o-D-ot)/2,(2*o-U-rt)/2),[E,L]=f.useState(void 0),[C,A]=f.useState(void 0),[J,H]=f.useState(void 0),[K,F]=f.useState(void 0),a=dt.linear().domain([0,e[0].values.length]).range([0,2*Math.PI]),Q=N.checkIfNullOrUndefined(q)?Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))<0?0:Math.max(...e.map(i=>Math.max(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):q,lt=N.checkIfNullOrUndefined(P)?Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s)))))>=0?0:Math.min(...e.map(i=>Math.min(...i.values.filter(s=>!N.checkIfNullOrUndefined(s))))):P,p=dt.linear().domain([lt,Q]).range([0,v]).nice(),ct=p.ticks(B),I=Tt().radius(i=>p(i)).angle((i,s)=>a(s)).curve(w);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(W.motion.svg,{width:`${o*2}px`,height:`${o*2}px`,viewBox:`0 0 ${o*2} ${o*2}`,direction:"ltr",ref:z,children:n.jsxRuntimeExports.jsxs("g",{transform:`translate(${b.left},${b.top})`,children:[Y.filter(i=>i.position==="before").map(i=>i.layer),n.jsxRuntimeExports.jsxs("g",{transform:`translate(${v},${v})`,children:[G.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("line",{x1:0,y1:0,x2:Math.cos(a(s)-Math.PI/2)*v,y2:Math.sin(a(s)-Math.PI/2)*v,className:n.mo("stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.axis),style:y?.xAxis?.axis},s),n.jsxRuntimeExports.jsx("text",{x:Math.cos(a(s)-Math.PI/2)*(v+6),y:Math.sin(a(s)-Math.PI/2)*(v+6),style:{textAnchor:Math.cos(a(s)-Math.PI/2)<0?"end":Math.cos(a(s)-Math.PI/2)<1e-5?"middle":"start",...y?.xAxis?.labels||""},dy:Math.sin(a(s)-Math.PI/2)<0?0:Math.sin(a(s)-Math.PI/2)<1e-5?5:10,className:n.mo("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",d?.xAxis?.labels),children:i})]},s)),ct.map((i,s)=>n.jsxRuntimeExports.jsxs("g",{children:[n.jsxRuntimeExports.jsx("path",{d:I(Array(G.length).fill(i))||"",className:n.mo("stroke-primary-gray-500 dark:stroke-primary-gray-550",d?.xAxis?.gridLines),style:{...y?.xAxis?.gridLines,fill:"none"}}),n.jsxRuntimeExports.jsx("foreignObject",{x:-25,y:Math.sin(-Math.PI/2)*p(i)>-1e-4?Math.sin(-Math.PI/2)*p(i)-7:Math.sin(-Math.PI/2)*p(i)-5,width:50,height:12,children:n.jsxRuntimeExports.jsx("div",{className:"flex justify-center",children:n.jsxRuntimeExports.jsx("p",{className:n.mo("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",d?.xAxis?.labels),style:y?.xAxis?.labels,children:xt.numberFormattingFunction(i,"NA",R)})})})]},s)),n.jsxRuntimeExports.jsx(Ct.AnimatePresence,{children:e.map((i,s)=>n.jsxRuntimeExports.jsxs(W.motion.g,{variants:{initial:{opacity:E?i.label===E.label?1:_:O?i.color&&l[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:.3:1},whileInView:{opacity:E?i.label===E.label?1:_:O?i.color&&l[u.indexOf(i.color)]===O?1:_:g.length!==0?i.label&&g.indexOf(i.label)!==-1?1:_:1,transition:{duration:x.duration}}},initial:"initial",animate:T?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},onMouseEnter:r=>{L(i),F(r.clientY),H(r.clientX),$?.(i)},onMouseMove:r=>{L(i),F(r.clientY),H(r.clientX)},onMouseLeave:()=>{L(void 0),H(void 0),F(void 0),$?.(void 0)},onClick:()=>{(M||j)&&(wt.isEqual(C,i)&&at?(A(void 0),M?.(void 0)):(A(i),M?.(i)))},children:[n.jsxRuntimeExports.jsx(W.motion.path,{d:I(i.values)||"",variants:{initial:{d:I(i.values.map(r=>0))||""},whileInView:{d:I(i.values)||"",transition:{duration:x.duration}}},initial:"initial",animate:T?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},style:{stroke:e.filter(r=>r.color).length===0?l[0]:i.color?l[u.indexOf(i.color)]:V.Colors.gray,fill:c?e.filter(r=>r.color).length===0?l[0]:i.color?l[u.indexOf(i.color)]:V.Colors.gray:"none",fillOpacity:.1,strokeWidth:et}}),n.jsxRuntimeExports.jsx("g",{children:i.values.map((r,m)=>n.jsxRuntimeExports.jsx("g",{children:N.checkIfNullOrUndefined(r)?null:n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[st?n.jsxRuntimeExports.jsx(W.motion.circle,{cx:Math.cos(a(m)-Math.PI/2)*p(r),cy:Math.sin(a(m)-Math.PI/2)*p(r),r:4,style:{fill:e.filter(Z=>Z.color).length===0?l[0]:i.color?l[u.indexOf(i.color)]:V.Colors.gray},variants:{initial:{cx:0,cy:0,opacity:0},whileInView:{cx:Math.cos(a(m)-Math.PI/2)*p(r),cy:Math.sin(a(m)-Math.PI/2)*p(r),opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:T?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}}}):null,nt?n.jsxRuntimeExports.jsx(W.motion.text,{x:Math.cos(a(m)-Math.PI/2)*(p(r)+6),y:Math.sin(a(m)-Math.PI/2)*(p(r)+6),style:{fill:l[s],textAnchor:Math.cos(a(m)-Math.PI/2)<0?"end":Math.cos(a(m)-Math.PI/2)<1e-5?"middle":"start",...y?.graphObjectValues||{}},dy:Math.sin(a(m)-Math.PI/2)<0?10:(Math.sin(a(m)-Math.PI/2)<1e-5,0),className:n.mo("graph-value text-xs font-bold",d?.graphObjectValues),variants:{initial:{opacity:0},whileInView:{opacity:1,transition:{duration:x.duration}}},initial:"initial",animate:T?"whileInView":"initial",exit:{opacity:0,transition:{duration:x.duration}},children:xt.numberFormattingFunction(r,"NA",R)}):null]})},m))})]},i.label||s))})]}),Y.filter(i=>i.position==="after").map(i=>i.layer)]})}),E&&k&&J&&K?n.jsxRuntimeExports.jsx(Et.Tooltip,{data:E,body:k,xPos:J,yPos:K,backgroundStyle:y?.tooltip,className:d?.tooltip}):null,j&&C!==void 0?n.jsxRuntimeExports.jsx(bt.X,{open:C!==void 0,onClose:()=>{A(void 0)},children:n.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof j=="string"?{__html:kt.string2HTML(j,C)}:void 0,children:typeof j=="function"?j(C):null})}):null]})}function Lt(t){const{graphTitle:e,colors:o,sources:l,graphDescription:k,footNote:$,radius:M,data:u,showColorScale:j=!0,padding:y,backgroundColor:d=!1,tooltip:O,onSeriesMouseOver:G,graphID:et,onSeriesMouseClick:nt,topMargin:st=75,bottomMargin:ot=75,leftMargin:U=75,rightMargin:rt=75,graphDownload:D=!1,dataDownload:X=!1,colorDomain:B,language:P="en",theme:q="light",highlightedLines:at=[],width:c,height:g,minHeight:x=0,strokeWidth:_=2,relativeHeight:R,ariaLabel:Y,colorLegendTitle:z,detailsOnClick:T,styles:w,classNames:b,showNAColor:v=!0,axisLabels:E,showDots:L=!0,showValues:C=!1,curveType:A="curve",noOfTicks:J=5,minValue:H,maxValue:K,fillShape:F=!1,resetSelectionOnDoubleClick:a=!0,animate:Q=!1,dimmedOpacity:lt=.3,precision:p=2,customLayers:ct=[]}=t,[I,i]=f.useState(0),[s,r]=f.useState(0),[m,Z]=f.useState(0),[Mt,jt]=f.useState(void 0),S=f.useRef(null),ut=f.useRef(null);return f.useEffect(()=>{const h=new ResizeObserver(tt=>{r(c||tt[0].target.clientWidth||420),Z(g||tt[0].target.clientHeight||420),i((Math.min(c||tt[0].target.clientWidth||620,g||tt[0].target.clientHeight||480)||420)/2)});return S.current&&(Z(S.current.clientHeight||420),r(S.current.clientWidth||420),i((Math.min(S.current.clientWidth,S.current.clientHeight)||420)/2),(!c||!M)&&h.observe(S.current)),()=>h.disconnect()},[c,g,M]),n.jsxRuntimeExports.jsx("div",{className:`${q||"light"} flex ${c?"w-fit grow-0":"w-full grow"}`,dir:P==="he"||P==="ar"?"rtl":void 0,children:n.jsxRuntimeExports.jsx("div",{className:n.mo(`${d?d===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${P||"en"}`,c?"w-fit":"w-full",b?.graphContainer),style:{...w?.graphContainer||{},minHeight:"inherit",...d&&d!==!0?{backgroundColor:d}:{}},id:et,ref:ut,"aria-label":Y||`${e?`The graph shows ${e}. `:""}This is a donut or pie chart chart. ${k?` ${k}`:""}`,children:n.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:d?y||"1rem":y||0},children:n.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2 w-full grow justify-between",children:[e||k||D||X?n.jsxRuntimeExports.jsx(St.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:b?.title,description:b?.description},graphTitle:e,graphDescription:k,width:c,graphDownload:D?ut.current:void 0,dataDownload:X?u.map(h=>h.data).filter(h=>h!==void 0).length>0?u.map(h=>h.data).filter(h=>h!==void 0):u.filter(h=>h!==void 0):null}):null,n.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center items-stretch gap-8 flex-wrap",style:{width:c?`${c}px`:"100%"},children:u.length===0?n.jsxRuntimeExports.jsx(Nt.EmptyState,{}):n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[j&&u.filter(h=>h.color).length!==0?n.jsxRuntimeExports.jsx(Ot.ColorLegendWithMouseOver,{width:c,colorLegendTitle:z,colors:o||V.Colors[q].categoricalColors.colors,colorDomain:B||pt.uniqBy(u,"color",!0),setSelectedColor:jt,showNAColor:v}):null,n.jsxRuntimeExports.jsx("div",{className:`flex ${c?"grow-0":"grow"} items-center justify-center leading-0`,style:{width:c?`${c}px`:"100%",height:g?`${Math.max(x,g||(R?x?(c||s)*R>x?(c||s)*R:x:(c||s)*R:m))}px`:"auto"},ref:S,"aria-label":"Graph area",children:n.jsxRuntimeExports.jsx("div",{className:"w-full flex justify-center leading-0",children:M||I?n.jsxRuntimeExports.jsx(Dt,{data:u,lineColors:u.filter(h=>h.color).length===0?o?[o]:[V.Colors.primaryColors["blue-600"]]:o||V.Colors[q].categoricalColors.colors,radius:M||I,tooltip:O,colorDomain:B||pt.uniqBy(u,"color",!0),onSeriesMouseOver:G,onSeriesMouseClick:nt,styles:w,detailsOnClick:T,selectedColor:Mt,axisLabels:E,strokeWidth:_,showValues:C,showDots:L,topMargin:st,bottomMargin:ot,leftMargin:U,rightMargin:rt,curveType:A,noOfTicks:J,minValue:H,maxValue:K,fillShape:F,highlightedLines:at,resetSelectionOnDoubleClick:a,animate:Q===!0?{duration:.5,once:!0,amount:.5}:Q||{duration:0,once:!0,amount:0},dimmedOpacity:lt,precision:p,customLayers:ct}):null})})]})}),l||$?n.jsxRuntimeExports.jsx(It.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:b?.footnote,source:b?.source},sources:l,footNote:$,width:c}):n.jsxRuntimeExports.jsx("div",{})]})})})})}exports.RadarChart=Lt;
|
|
2
2
|
//# sourceMappingURL=RadarChart.cjs.map
|