@fluentui/react-charts 0.0.0-nightly-20250717-0406.1 → 0.0.0-nightly-20250721-0406.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +28 -15
  2. package/lib/components/AreaChart/AreaChart.js +10 -2
  3. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  4. package/lib/components/DonutChart/Arc/Arc.js +5 -5
  5. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  6. package/lib/components/DonutChart/DonutChart.js +7 -1
  7. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  8. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  9. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +10 -5
  10. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  11. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +9 -3
  12. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  13. package/lib/components/LineChart/LineChart.js +11 -4
  14. package/lib/components/LineChart/LineChart.js.map +1 -1
  15. package/lib/components/ScatterChart/ScatterChart.js +8 -2
  16. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  17. package/lib/components/VerticalBarChart/VerticalBarChart.js +6 -0
  18. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  19. package/lib-commonjs/components/AreaChart/AreaChart.js +10 -2
  20. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  21. package/lib-commonjs/components/DonutChart/Arc/Arc.js +5 -5
  22. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  23. package/lib-commonjs/components/DonutChart/DonutChart.js +7 -1
  24. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  25. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  26. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +10 -5
  27. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  28. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +9 -3
  29. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  30. package/lib-commonjs/components/LineChart/LineChart.js +11 -4
  31. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  32. package/lib-commonjs/components/ScatterChart/ScatterChart.js +8 -2
  33. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  34. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +6 -0
  35. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  36. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -1,28 +1,41 @@
1
1
  # Change Log - @fluentui/react-charts
2
2
 
3
- This log was last generated on Thu, 17 Jul 2025 04:21:06 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 21 Jul 2025 04:21:20 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20250717-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v0.0.0-nightly-20250717-0406.1)
7
+ ## [0.0.0-nightly-20250721-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v0.0.0-nightly-20250721-0406.1)
8
8
 
9
- Thu, 17 Jul 2025 04:21:06 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.1.8..@fluentui/react-charts_v0.0.0-nightly-20250717-0406.1)
9
+ Mon, 21 Jul 2025 04:21:20 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.1.9..@fluentui/react-charts_v0.0.0-nightly-20250721-0406.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-button to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
16
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
17
- - Bump @fluentui/react-overflow to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
18
- - Bump @fluentui/react-popover to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
19
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
20
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
21
- - Bump @fluentui/react-theme to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
22
- - Bump @fluentui/react-tooltip to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
23
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
24
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
25
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250717-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/0f0495e8b8894cf07db8628dd12264bb8ef07e4e) by beachball)
15
+ - Bump @fluentui/react-button to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
16
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
17
+ - Bump @fluentui/react-overflow to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
18
+ - Bump @fluentui/react-popover to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
19
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
20
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
21
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
22
+ - Bump @fluentui/react-tooltip to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
23
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
24
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
25
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250721-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/d866eeb4be9d6df8669dedffe9e870fa3306bcd0) by beachball)
26
+
27
+ ## [9.1.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.1.9)
28
+
29
+ Thu, 17 Jul 2025 13:49:52 GMT
30
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.1.8..@fluentui/react-charts_v9.1.9)
31
+
32
+ ### Patches
33
+
34
+ - Bump @fluentui/react-button to v9.6.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
35
+ - Bump @fluentui/react-overflow to v9.5.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
36
+ - Bump @fluentui/react-popover to v9.12.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
37
+ - Bump @fluentui/react-tabster to v9.26.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
38
+ - Bump @fluentui/react-tooltip to v9.8.0 ([PR #34862](https://github.com/microsoft/fluentui/pull/34862) by beachball)
26
39
 
27
40
  ## [9.1.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.1.8)
28
41
 
@@ -503,6 +503,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
503
503
  opacity: layerOpacity,
504
504
  fillOpacity: _getOpacity(points[index].legend),
505
505
  onMouseMove: (event)=>_onRectMouseMove(event),
506
+ onFocus: (event)=>_handleFocus(event, index, 0, `${_circleId}_${index}`),
506
507
  onMouseOut: _onRectMouseOut,
507
508
  onMouseOver: (event)=>_onRectMouseMove(event)
508
509
  }) : /*#__PURE__*/ React.createElement("path", {
@@ -552,7 +553,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
552
553
  onMouseOut: _onRectMouseOut,
553
554
  onMouseOver: (event)=>_onRectMouseMove(event),
554
555
  onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
555
- onFocus: ()=>_handleFocus(index, pointIndex, circleId),
556
+ onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
556
557
  onBlur: _handleBlur,
557
558
  ...getSecureProps(pointOptions),
558
559
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend),
@@ -578,6 +579,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
578
579
  fill: _updateCircleFillColor(xDataPoint, lineColor, circleId),
579
580
  onMouseOut: _onRectMouseOut,
580
581
  onMouseOver: (event)=>_onRectMouseMove(event),
582
+ onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
581
583
  onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
582
584
  ...getSecureProps(pointOptions),
583
585
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend)
@@ -671,7 +673,13 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
671
673
  };
672
674
  }) : [];
673
675
  }
674
- function _handleFocus(lineIndex, pointIndex, circleId) {
676
+ function _handleFocus(event, lineIndex, pointIndex, circleId) {
677
+ let cx = 0;
678
+ let cy = 0;
679
+ const targetRect = event.target.getBoundingClientRect();
680
+ cx = targetRect.left + targetRect.width / 2;
681
+ cy = targetRect.top + targetRect.height / 2;
682
+ _updatePosition(cx, cy);
675
683
  const { x, y, xAxisCalloutData } = props.data.lineChartData[lineIndex].data[pointIndex];
676
684
  const formattedDate = x instanceof Date ? formatDate(x, props.useUTC) : x;
677
685
  const modifiedXVal = x instanceof Date ? x.getTime() : x;
@@ -1 +1 @@
1
- {"version":3,"sources":["AreaChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useAreaChartStyles } from './useAreaChartStyles.styles';\nimport { max as d3Max, bisector } from 'd3-array';\nimport { pointer } from 'd3-selection';\nimport { select as d3Select } from 'd3-selection';\nimport { tokens } from '@fluentui/react-theme';\nimport { area as d3Area, stack as d3Stack, curveMonotoneX as d3CurveBasis, line as d3Line } from 'd3-shape';\nimport {\n AccessibilityProps,\n CartesianChart,\n CustomizedCalloutData,\n AreaChartProps,\n LineChartDataPoint,\n LineChartPoints,\n ChildProps,\n Margins,\n YValueHover,\n ChartPopoverProps,\n Chart,\n} from '../../index';\nimport {\n calloutData,\n getXAxisType,\n ChartTypes,\n XAxisTypes,\n getTypeOfAxis,\n tooltipOfAxislabels,\n getNextColor,\n getColorFromToken,\n formatDate,\n getSecureProps,\n areArraysEqual,\n getCurveFactory,\n find,\n findNumericMinMaxOfY,\n createNumericYAxis,\n IDomainNRange,\n domainRangeOfNumericForAreaChart,\n domainRangeOfDateForAreaLineVerticalBarChart,\n createStringYAxis,\n} from '../../utilities/index';\nimport { useId } from '@fluentui/react-utilities';\nimport { Legend, Legends } from '../Legends/index';\nimport { ScaleLinear } from 'd3-scale';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst bisect = bisector((d: any) => d.x).left;\n\nenum InterceptVisibility {\n show = 'visibility',\n hide = 'hidden',\n}\n\nexport interface AreaChartAreaPoint {\n xVal: string | number;\n values: AreaChartDataSetPoint;\n}\nexport interface AreaChartDataSetPoint {\n [key: string]: number | string | number[];\n}\nexport interface DPointType {\n values: { 0: number; 1: number; data: {} };\n xVal: number | Date;\n}\nexport interface MapXToDataSet {\n [key: string]: LineChartDataPoint[];\n [key: number]: LineChartDataPoint[];\n}\n\n//by default d3-shape 3.2.0 limits the< path> data point precision to 3 digits(d3/d3-path#10)\n\nexport const AreaChart: React.FunctionComponent<AreaChartProps> = React.forwardRef<HTMLDivElement, AreaChartProps>(\n (props, forwardedRef) => {\n const _uniqueIdForGraph: string = useId('areaChart_');\n const _verticalLineId: string = useId('verticalLine_');\n const _circleId: string = useId('circle');\n const _rectId: string = useId('rectangle');\n const _tooltipId: string = useId('AreaChartTooltipID');\n //enableComputationOptimization is used for optimized code to group data points by x value\n //from O(n^2) to O(n) using a map.\n const _enableComputationOptimization: boolean = true;\n const _firstRenderOptimization: boolean = true;\n const _emptyChartId: string = useId('_AreaChart_empty');\n let _containsSecondaryYAxis = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _calloutPoints: any;\n let _createSet: (data: LineChartPoints[]) => {\n colors: string[];\n opacity: number[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n calloutPoints: any;\n };\n let _colors: string[];\n let _opacity: number[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _data: any;\n let _chart: JSX.Element[];\n let _margins: Margins;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xAxisRectScale: any;\n // determines if the given area chart has multiple stacked bar charts\n let _isMultiStackChart: boolean;\n const cartesianChartRef = React.useRef<Chart>(null);\n\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [activeLegend, setActiveLegend] = React.useState<string | undefined>(undefined);\n const [hoverXValue, setHoverXValue] = React.useState<string | number | undefined | null>('');\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const [YValueHover, setYValueHover] = React.useState<YValueHover[]>([]);\n const [lineXValue, setLineXValue] = React.useState<number>(0);\n const [displayOfLine, setDisplayOfLine] = React.useState<InterceptVisibility>(InterceptVisibility.hide);\n const [isCircleClicked, setIsCircleClicked] = React.useState<boolean>(false);\n const [nearestCircleToHighlight, setNearestCircleToHighlight] = React.useState<number | string | Date | null>(null);\n const [activePoint, setActivePoint] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<CustomizedCalloutData>();\n const [stackCalloutProps, setStackCalloutProps] = React.useState<CustomizedCalloutData>();\n const [xAxisCalloutAccessibilityData, setXAxisCalloutAccessibilityData] = React.useState<AccessibilityProps>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const prevPropsRef = React.useRef<AreaChartProps | null>(null);\n\n React.useEffect(() => {\n if (prevPropsRef.current) {\n const prevProps = prevPropsRef.current;\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n }\n prevPropsRef.current = props;\n }, [props]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n }),\n [],\n );\n\n const classes = useAreaChartStyles(props);\n\n function _getDomainNRangeValues(\n points: LineChartPoints[],\n margins: Margins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForAreaChart(points, margins, width, isRTL);\n } else if (xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(\n points,\n margins,\n width,\n isRTL,\n tickValues! as Date[],\n chartType,\n barWidth,\n );\n } else {\n domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };\n }\n return domainNRangeValue;\n }\n\n function _getMargins(margins: Margins) {\n _margins = margins;\n }\n\n function _onRectMouseMove(mouseEvent: React.MouseEvent<SVGRectElement | SVGPathElement | SVGCircleElement>) {\n mouseEvent.persist();\n const { data } = props;\n const { lineChartData } = data;\n _updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n // This will get the value of the X when mouse is on the chart\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n const xOffset = _xAxisRectScale.invert(pointer(mouseEvent)[0], document.getElementById(_rectId)!);\n const i = bisect(lineChartData![0].data, xOffset);\n const d0 = lineChartData![0].data[i - 1] as LineChartDataPoint;\n const d1 = lineChartData![0].data[i] as LineChartDataPoint;\n let pointToHighlight: string | Date | number | null = null;\n let index: null | number = null;\n const axisType =\n lineChartData![0].data.length > 0 ? (getTypeOfAxis(lineChartData![0].data[0].x, true) as XAxisTypes) : null;\n if (d0 === undefined && d1 !== undefined) {\n pointToHighlight = d1.x;\n index = i;\n } else if (d0 !== undefined && d1 === undefined) {\n pointToHighlight = d0.x;\n index = i - 1;\n } else {\n let x0;\n let point0;\n let point1;\n switch (axisType) {\n case XAxisTypes.DateAxis:\n x0 = new Date(xOffset).getTime();\n point0 = (d0.x as Date).getTime();\n point1 = (d1.x as Date).getTime();\n pointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;\n index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;\n break;\n case XAxisTypes.NumericAxis:\n x0 = xOffset as number;\n point0 = d0.x as number;\n point1 = d1.x as number;\n pointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;\n index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;\n break;\n default:\n break;\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { xAxisCalloutData, xAxisCalloutAccessibilityData } = lineChartData![0].data[index as number];\n const formattedDate =\n pointToHighlight instanceof Date ? formatDate(pointToHighlight, props.useUTC) : pointToHighlight;\n const modifiedXVal = pointToHighlight instanceof Date ? pointToHighlight.getTime() : pointToHighlight;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const found: any = find(_calloutPoints, (element: { x: string | number }) => {\n return element.x === modifiedXVal;\n });\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const _nearestCircleToHighlight =\n axisType === XAxisTypes.DateAxis ? (pointToHighlight as Date).getTime() : pointToHighlight;\n // if no points need to be called out then don't show vertical line and callout card\n if (found) {\n const filteredValues = _getFilteredLegendValues(found.values);\n setNearestCircleToHighlight(_nearestCircleToHighlight);\n setLineXValue(_xAxisRectScale(pointToHighlight));\n setDisplayOfLine(InterceptVisibility.show);\n setIsCircleClicked(false);\n setStackCalloutProps({ ...found, values: filteredValues });\n setYValueHover(filteredValues);\n setDataPointCalloutProps({ ...found, values: filteredValues });\n setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);\n setXAxisCalloutAccessibilityData(xAxisCalloutAccessibilityData);\n setActivePoint('');\n } else {\n setPopoverOpen(false);\n setNearestCircleToHighlight(nearestCircleToHighlight);\n setDisplayOfLine(InterceptVisibility.hide);\n setIsCircleClicked(false);\n }\n }\n /**\n * just cleaning up the state which we have set in the mouse move event\n */\n function _onRectMouseOut() {\n /**/\n }\n\n function _updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n function _handleChartMouseLeave() {\n setPopoverOpen(false);\n setNearestCircleToHighlight(null);\n setLineXValue(0);\n setDisplayOfLine(InterceptVisibility.hide);\n setIsCircleClicked(false);\n setStackCalloutProps(undefined);\n setDataPointCalloutProps(undefined);\n setHoverXValue(undefined);\n setYValueHover([]);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _getDataPoints(keys: string[], dataSet: any) {\n const renderPoints: Array<AreaChartDataSetPoint[]> = [];\n let maxOfYVal = 0;\n\n if (_shouldFillToZeroY()) {\n keys.forEach((key, index) => {\n const currentLayer: AreaChartDataSetPoint[] = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dataSet.forEach((d: any) => {\n currentLayer.push({\n values: [0, d[key]], // Start from zero for \"tozeroy\" mode\n xVal: d.xVal,\n });\n if (d[key] > maxOfYVal) {\n maxOfYVal = d[key];\n }\n });\n renderPoints.push(currentLayer);\n });\n } else {\n const dataValues = d3Stack().keys(keys)(dataSet);\n maxOfYVal = d3Max(dataValues[dataValues.length - 1], dp => dp[1])!;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dataValues.forEach((layer: any) => {\n const currentLayer: AreaChartDataSetPoint[] = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n layer.forEach((d: any) => {\n currentLayer.push({\n values: d,\n xVal: d.data.xVal,\n });\n });\n renderPoints.push(currentLayer);\n });\n }\n\n _isMultiStackChart = !!(props.legendProps?.selectedLegends\n ? renderPoints?.length >= 1\n : renderPoints?.length > 1);\n return {\n renderData: renderPoints,\n // The maxOfYVal prop is only required for the primary y-axis. When the data includes\n // a secondary y-axis, the mode defaults to tozeroy, so maxOfYVal should be calculated using\n // only the data points associated with the primary y-axis.\n maxOfYVal: _containsSecondaryYAxis ? findNumericMinMaxOfY(props.data.lineChartData!).endValue : maxOfYVal,\n };\n }\n\n function _createDataSet(points: LineChartPoints[]) {\n if (props.enablePerfOptimization && _enableComputationOptimization) {\n const allChartPoints: LineChartDataPoint[] = [];\n const dataSet: AreaChartDataSetPoint[] = [];\n const colors: string[] = [];\n const opacity: number[] = [];\n const calloutPoints = calloutData(points!);\n\n points &&\n points.length &&\n points.forEach((singleChartPoint: LineChartPoints) => {\n colors.push(singleChartPoint.color!);\n opacity.push(singleChartPoint.opacity || 1);\n allChartPoints.push(...(singleChartPoint.data as LineChartDataPoint[]));\n });\n\n const mapOfXvalToListOfDataPoints: MapXToDataSet = {};\n allChartPoints.forEach((dataPoint: LineChartDataPoint) => {\n const xValue = dataPoint.x instanceof Date ? dataPoint.x.toLocaleString() : dataPoint.x;\n // map of x value to the list of data points which share the same x value .\n if (mapOfXvalToListOfDataPoints[xValue]) {\n mapOfXvalToListOfDataPoints[xValue].push(dataPoint);\n } else {\n mapOfXvalToListOfDataPoints[xValue] = [dataPoint];\n }\n });\n\n Object.keys(mapOfXvalToListOfDataPoints).forEach((key: number | string) => {\n const value: LineChartDataPoint[] = mapOfXvalToListOfDataPoints[key];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const singleDataset: any = {};\n value.forEach((singleDataPoint: LineChartDataPoint, index: number) => {\n singleDataset.xVal = singleDataPoint.x;\n singleDataset[`chart${index}`] = singleDataPoint.y;\n });\n dataSet.push(singleDataset);\n });\n\n // get keys from dataset, used to render data\n const keysLength: number = dataSet && Object.keys(dataSet[0])!.length;\n const keys: string[] = [];\n for (let i = 0; i < keysLength - 1; i++) {\n const keyVal = `chart${i}`;\n keys.push(keyVal);\n }\n\n // Data used to draw graph\n const data = _getDataPoints(keys, dataSet);\n\n return {\n colors,\n opacity,\n keys,\n data,\n calloutPoints,\n };\n } else {\n const allChartPoints: LineChartDataPoint[] = [];\n const dataSet: AreaChartDataSetPoint[] = [];\n const colors: string[] = [];\n const opacity: number[] = [];\n const calloutPoints = calloutData(points!);\n\n points &&\n points.length &&\n points.forEach((singleChartPoint: LineChartPoints) => {\n colors.push(singleChartPoint.color!);\n opacity.push(singleChartPoint.opacity || 1);\n allChartPoints.push(...(singleChartPoint.data as LineChartDataPoint[]));\n });\n\n let tempArr = allChartPoints;\n while (tempArr.length) {\n const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;\n const filteredChartPoints: LineChartDataPoint[] = tempArr.filter(\n (point: LineChartDataPoint) =>\n (point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck,\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const singleDataset: any = {};\n filteredChartPoints.forEach((singleDataPoint: LineChartDataPoint, index: number) => {\n singleDataset.xVal = singleDataPoint.x;\n singleDataset[`chart${index}`] = singleDataPoint.y;\n });\n dataSet.push(singleDataset);\n // removing compared objects from array\n const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;\n tempArr = tempArr.filter(\n (point: LineChartDataPoint) => (point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val,\n );\n }\n\n // get keys from dataset, used to create stacked data\n const keysLength: number = dataSet && Object.keys(dataSet[0])!.length;\n const keys: string[] = [];\n for (let i = 0; i < keysLength - 1; i++) {\n const keyVal = `chart${i}`;\n keys.push(keyVal);\n }\n\n // Data used to draw graph\n const data = _getDataPoints(keys, dataSet);\n\n return {\n colors,\n opacity,\n keys,\n data,\n calloutPoints,\n };\n }\n }\n\n function _getCustomizedCallout() {\n return props.onRenderCalloutPerStack\n ? props.onRenderCalloutPerStack(stackCalloutProps)\n : props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps)\n : null;\n }\n\n function _getGraphData(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xAxis: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yAxis: any,\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement | null,\n yAxisElement?: SVGElement | null,\n yScaleSecondary?: ScaleLinear<number, number>,\n ) {\n _chart = _drawGraph(containerHeight, xAxis, yAxis, yScaleSecondary, xElement!);\n }\n\n function _onLegendHover(legend: string): void {\n setActiveLegend(legend);\n }\n\n function _onLegendLeave(): void {\n setActiveLegend(undefined);\n }\n\n function _getLegendData(points: LineChartPoints[]): JSX.Element {\n const data = points;\n const actions: Legend[] = [];\n\n data.forEach((singleChartData: LineChartPoints) => {\n const color: string = singleChartData.color!;\n const checkSimilarLegends = actions.filter(\n (leg: Legend) => leg.title === singleChartData.legend && leg.color === color,\n );\n if (checkSimilarLegends!.length > 0) {\n return;\n }\n\n const legend: Legend = {\n title: singleChartData.legend,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(singleChartData.legend);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n\n actions.push(legend);\n });\n return (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n {...props.legendProps}\n onChange={_onLegendSelectionChange}\n />\n );\n }\n\n function _onLegendSelectionChange(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n function _onDataPointClick(func: (() => void) | undefined) {\n if (func) {\n func();\n }\n setIsCircleClicked(true);\n }\n\n function _getOpacity(legend: string): number {\n if (!_isMultiStackChart) {\n return 0.7;\n } else {\n const opacity = _legendHighlighted(legend) || _noLegendHighlighted() ? 0.7 : 0.1;\n return opacity;\n }\n }\n\n function _getLineOpacity(legend: string): number {\n if (!_isMultiStackChart) {\n return 1;\n } else {\n let opacity = 0.3;\n if (isPopoverOpen) {\n opacity = 1;\n }\n if (!_noLegendHighlighted()) {\n opacity = _legendHighlighted(legend) ? 0 : 0.1;\n }\n return opacity;\n }\n }\n\n function _updateCircleFillColor(xDataPoint: number | Date, lineColor: string, circleId: string): string {\n let fillColor = lineColor;\n if (nearestCircleToHighlight === xDataPoint || activePoint === circleId) {\n if (!isCircleClicked) {\n fillColor = tokens.colorNeutralBackground1;\n }\n }\n\n return fillColor;\n }\n\n function _drawGraph(\n containerHeight: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xScale: any,\n yScalePrimary: ScaleLinear<number, number>,\n yScaleSecondary: ScaleLinear<number, number> | undefined,\n xElement: SVGElement,\n ): JSX.Element[] {\n const points = _addDefaultColors(props.data.lineChartData);\n const { pointOptions, pointLineOptions } = props.data;\n\n const graph: JSX.Element[] = [];\n let lineColor: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _data.forEach((singleStackedData: Array<any>, index: number) => {\n const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;\n const curveFactory = getCurveFactory(points[index].lineOptions?.curve, d3CurveBasis);\n const area = d3Area()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .x((d: any) => xScale(d.xVal))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .y0((d: any) => yScale(d.values[0]))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .y1((d: any) => yScale(d.values[1]))\n .curve(curveFactory);\n const line = d3Line()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .x((d: any) => xScale(d.xVal))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .y((d: any) => yScale(d.values[1]))\n .curve(curveFactory);\n const layerOpacity = _shouldFillToZeroY() ? 0.8 : _opacity[index];\n graph.push(\n <React.Fragment key={`${index}-graph-${_uniqueIdForGraph}`}>\n {props.enableGradient && (\n <defs>\n <linearGradient id={`gradient_${index}`} x1=\"0%\" x2=\"0%\" y1=\"0%\" y2=\"100%\">\n <stop offset=\"0\" stopColor={_colors[index]} />\n <stop offset=\"100%\" stopColor=\"transparent\" />\n </linearGradient>\n </defs>\n )}\n <path\n id={`${index}-line-${_uniqueIdForGraph}`}\n d={line(singleStackedData)!}\n fill={'transparent'}\n strokeWidth={points[index].lineOptions?.strokeWidth ?? 3}\n stroke={_colors[index]}\n opacity={_getLineOpacity(points[index]!.legend)}\n onMouseMove={event => _onRectMouseMove(event)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n strokeDasharray={points[index].lineOptions?.strokeDasharray}\n strokeDashoffset={points[index].lineOptions?.strokeDashoffset}\n strokeLinecap={points[index].lineOptions?.strokeLinecap}\n />\n {singleStackedData.length === 1 ? (\n <circle\n id={`${index}-graph-${_uniqueIdForGraph}`}\n cx={xScale(singleStackedData[0].xVal)}\n cy={yScale(singleStackedData[0].values[1])}\n r={6}\n stroke={_colors[index]}\n strokeWidth={3}\n fill={_colors[index]}\n opacity={layerOpacity}\n fillOpacity={_getOpacity(points[index]!.legend)}\n onMouseMove={event => _onRectMouseMove(event)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n />\n ) : (\n <path\n id={`${index}-graph-${_uniqueIdForGraph}`}\n d={area(singleStackedData)!}\n fill={props.enableGradient ? `url(#gradient_${index})` : _colors[index]}\n opacity={layerOpacity}\n fillOpacity={_getOpacity(points[index]!.legend)}\n onMouseMove={event => _onRectMouseMove(event)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n {...(props.optimizeLargeData && {\n tabIndex: _legendHighlighted(points[index]!.legend) || _noLegendHighlighted() ? 0 : undefined,\n role: 'img',\n 'aria-label': `${points[index].legend}, series ${index + 1} of ${points.length} with ${\n points[index].data.length\n } data points.`,\n })}\n />\n )}\n </React.Fragment>,\n );\n });\n\n const circleRadius = pointOptions && pointOptions.r ? Number(pointOptions.r) : 8;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _data.forEach((singleStackedData: Array<any>, index: number) => {\n if (points.length === index) {\n return;\n }\n const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;\n\n if (!props.optimizeLargeData || singleStackedData.length === 1) {\n // Render circles for all data points\n graph.push(\n <g\n key={`${index}-dots-${_uniqueIdForGraph}`}\n clipPath=\"url(#clip)\"\n role=\"region\"\n aria-label={`${points[index].legend}, series ${index + 1} of ${points.length} with ${\n points[index].data.length\n } data points.`}\n >\n {singleStackedData.map((singlePoint: DPointType, pointIndex: number) => {\n const circleId = `${_circleId}_${index * _data[0].length + pointIndex}`;\n const xDataPoint = singlePoint.xVal instanceof Date ? singlePoint.xVal.getTime() : singlePoint.xVal;\n lineColor = points[index]!.color!;\n const legend = points[index]!.legend;\n return (\n <circle\n key={circleId}\n id={circleId}\n tabIndex={_legendHighlighted(points[index]!.legend) || _noLegendHighlighted() ? 0 : undefined}\n cx={xScale(singlePoint.xVal)}\n cy={yScale(singlePoint.values[1])}\n stroke={lineColor}\n strokeWidth={3}\n fill={_updateCircleFillColor(xDataPoint, lineColor, circleId)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n onClick={() => _onDataPointClick(points[index]!.data[pointIndex].onDataPointClick!)}\n onFocus={() => _handleFocus(index, pointIndex, circleId)}\n onBlur={_handleBlur}\n {...getSecureProps(pointOptions)}\n r={_getCircleRadius(xDataPoint, circleRadius, circleId, legend)}\n role=\"img\"\n aria-label={_getAriaLabel(index, pointIndex)}\n />\n );\n })}\n </g>,\n );\n } else {\n // Render circles for data points close to the mouse pointer only\n singleStackedData.forEach((singlePoint: DPointType, pointIndex: number) => {\n const xDataPoint = singlePoint.xVal instanceof Date ? singlePoint.xVal.getTime() : singlePoint.xVal;\n if (nearestCircleToHighlight === xDataPoint) {\n const circleId = `${_circleId}_${index * _data[0].length + pointIndex}`;\n lineColor = points[index]!.color!;\n const legend = points[index]!.legend;\n graph.push(\n <circle\n key={circleId}\n id={circleId}\n cx={xScale(singlePoint.xVal)}\n cy={yScale(singlePoint.values[1])}\n stroke={lineColor}\n strokeWidth={3}\n fill={_updateCircleFillColor(xDataPoint, lineColor, circleId)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n onClick={() => _onDataPointClick(points[index]!.data[pointIndex].onDataPointClick!)}\n {...getSecureProps(pointOptions)}\n r={_getCircleRadius(xDataPoint, circleRadius, circleId, legend)}\n />,\n );\n }\n });\n }\n });\n graph.push(\n <line\n id={_verticalLineId}\n key={_verticalLineId}\n x1={lineXValue}\n y1={0}\n x2={lineXValue}\n y2={containerHeight}\n strokeWidth={1}\n strokeDasharray={5.5}\n stroke={lineColor!}\n opacity={0.5}\n visibility={displayOfLine}\n {...getSecureProps(pointLineOptions)}\n />,\n );\n // Removing un wanted tooltip div from DOM, when prop not provided.\n if (!props.showXAxisLablesTooltip) {\n try {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n // Used to display tooltip at x axis labels.\n if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {\n const xAxisElement = d3Select(xElement).call(xScale);\n try {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n const tooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: xAxisElement,\n };\n xAxisElement && tooltipOfAxislabels(tooltipProps);\n }\n return graph;\n }\n\n function _getCircleRadius(xDataPoint: number, circleRadius: number, circleId: string, legend: string): number {\n // Show the circle if no legends are selected or if the point's legend is in the selected legends\n if (!_noLegendHighlighted() && !_legendHighlighted(legend)) {\n return 0;\n }\n\n if (isCircleClicked && nearestCircleToHighlight === xDataPoint) {\n return 1;\n } else if (nearestCircleToHighlight === xDataPoint || activePoint === circleId) {\n return circleRadius;\n } else {\n return 0;\n }\n }\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n function _legendHighlighted(legend: string) {\n return _getHighlightedLegend().includes(legend!);\n }\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n function _noLegendHighlighted() {\n return _getHighlightedLegend().length === 0;\n }\n\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _addDefaultColors(lineChartData?: LineChartPoints[]): LineChartPoints[] {\n return lineChartData\n ? lineChartData.map((item, index) => {\n let color: string;\n // isInverted property is applicable to v8 themes only\n if (typeof item.color === 'undefined') {\n color = getNextColor(index, 0);\n } else {\n color = getColorFromToken(item.color);\n }\n\n return { ...item, color };\n })\n : [];\n }\n\n function _handleFocus(lineIndex: number, pointIndex: number, circleId: string) {\n const { x, y, xAxisCalloutData } = props.data.lineChartData![lineIndex].data[pointIndex];\n const formattedDate = x instanceof Date ? formatDate(x, props.useUTC) : x;\n const modifiedXVal = x instanceof Date ? x.getTime() : x;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const found: any = _calloutPoints.find((e: { x: string | number }) => e.x === modifiedXVal);\n // Show details in the callout for the focused point only\n found.values = found.values.filter((e: { y: number }) => e.y === y);\n const filteredValues = _getFilteredLegendValues(found.values);\n\n setPopoverOpen(true);\n setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);\n setYValueHover(filteredValues!);\n setStackCalloutProps({ ...found, values: filteredValues });\n setDataPointCalloutProps({ ...found, values: filteredValues });\n setActivePoint(circleId);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _getFilteredLegendValues(values: any) {\n return !_noLegendHighlighted()\n ? values.filter((value: { legend: string }) => _legendHighlighted(value.legend))\n : values;\n }\n\n function _handleBlur() {\n setPopoverOpen(false);\n setHoverXValue(undefined);\n setYValueHover([]);\n setStackCalloutProps(undefined);\n setDataPointCalloutProps(undefined);\n setActivePoint('');\n }\n\n function _getAriaLabel(lineIndex: number, pointIndex: number): string {\n const line = props.data.lineChartData![lineIndex];\n const point = line.data[pointIndex];\n const formattedDate = point.x instanceof Date ? formatDate(point.x, props.useUTC) : point.x;\n const xValue = point.xAxisCalloutData || formattedDate;\n const legend = line.legend;\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${xValue}. ${legend}, ${yValue}.`;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n (\n props.data &&\n props.data.lineChartData &&\n props.data.lineChartData.length > 0 &&\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props.data.lineChartData.filter((item: { data: string | any[] }) => item.data.length === 0).length === 0\n )\n // if all the data sets have no data\n // filtering all items which have no data and checking if the length of the filtered array is 0\n // which means chart is not empty\n );\n }\n\n function _getChartTitle(): string {\n const { chartTitle, lineChartData } = props.data;\n return (chartTitle ? `${chartTitle}. ` : '') + `Area chart with ${lineChartData?.length || 0} data series. `;\n }\n\n function _shouldFillToZeroY() {\n return props.mode === 'tozeroy' || _containsSecondaryYAxis;\n }\n\n if (!_isChartEmpty()) {\n const { lineChartData } = props.data;\n const points = _addDefaultColors(lineChartData);\n _containsSecondaryYAxis = !!props.secondaryYScaleOptions && points.some(point => point.useSecondaryYScale);\n _createSet = _createDataSet;\n const { colors, opacity, data, calloutPoints } = _createSet(points);\n _calloutPoints = calloutPoints;\n const isXAxisDateType = getXAxisType(points);\n _colors = colors;\n _opacity = opacity;\n _data = data.renderData;\n const legends: JSX.Element = _getLegendData(points);\n\n const tickParams = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n const calloutProps: ChartPopoverProps = {\n YValueHover: YValueHover!,\n hoverXValue: hoverXValue!,\n xAxisCalloutAccessibilityData,\n ...props.calloutProps,\n clickPosition,\n isPopoverOpen,\n isCartesian: true,\n customCallout: {\n customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout()! : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n },\n isCalloutForStack: true,\n };\n return (\n <CartesianChart\n {...props}\n chartTitle={_getChartTitle()}\n points={points}\n chartType={ChartTypes.AreaChart}\n calloutProps={calloutProps}\n legendBars={legends}\n createYAxis={createNumericYAxis}\n xAxisType={isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis}\n tickParams={tickParams}\n maxOfYVal={data.maxOfYVal}\n getGraphData={_getGraphData}\n getDomainNRangeValues={_getDomainNRangeValues}\n createStringYAxis={createStringYAxis}\n getmargins={_getMargins}\n onChartMouseLeave={_handleChartMouseLeave}\n getMinMaxOfYAxis={findNumericMinMaxOfY}\n enableFirstRenderOptimization={props.enablePerfOptimization && _firstRenderOptimization}\n componentRef={cartesianChartRef}\n /* eslint-disable react/jsx-no-bind */\n // eslint-disable-next-line react/no-children-prop, @typescript-eslint/no-shadow\n children={(props: ChildProps) => {\n _xAxisRectScale = props.xScale;\n const ticks = _xAxisRectScale.ticks();\n const width1 = _xAxisRectScale(ticks[ticks.length - 1]);\n const rectHeight = props.containerHeight! - _margins.top!;\n return (\n <>\n <g>\n <rect\n id={_rectId}\n width={width1}\n height={rectHeight}\n fill={'transparent'}\n onMouseMove={event => _onRectMouseMove(event)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n />\n </g>\n <g>{_chart}</g>\n </>\n );\n }}\n />\n );\n }\n return (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\nAreaChart.displayName = 'AreaChart';\n"],"names":["React","useAreaChartStyles","max","d3Max","bisector","pointer","select","d3Select","tokens","area","d3Area","stack","d3Stack","curveMonotoneX","d3CurveBasis","line","d3Line","CartesianChart","calloutData","getXAxisType","ChartTypes","XAxisTypes","getTypeOfAxis","tooltipOfAxislabels","getNextColor","getColorFromToken","formatDate","getSecureProps","areArraysEqual","getCurveFactory","find","findNumericMinMaxOfY","createNumericYAxis","domainRangeOfNumericForAreaChart","domainRangeOfDateForAreaLineVerticalBarChart","createStringYAxis","useId","Legends","bisect","d","x","left","InterceptVisibility","AreaChart","forwardRef","props","forwardedRef","_uniqueIdForGraph","_verticalLineId","_circleId","_rectId","_tooltipId","_enableComputationOptimization","_firstRenderOptimization","_emptyChartId","_containsSecondaryYAxis","_calloutPoints","_createSet","_colors","_opacity","_data","_chart","_margins","_xAxisRectScale","_isMultiStackChart","cartesianChartRef","useRef","selectedLegends","setSelectedLegends","useState","legendProps","activeLegend","setActiveLegend","undefined","hoverXValue","setHoverXValue","YValueHover","setYValueHover","lineXValue","setLineXValue","displayOfLine","setDisplayOfLine","isCircleClicked","setIsCircleClicked","nearestCircleToHighlight","setNearestCircleToHighlight","activePoint","setActivePoint","dataPointCalloutProps","setDataPointCalloutProps","stackCalloutProps","setStackCalloutProps","xAxisCalloutAccessibilityData","setXAxisCalloutAccessibilityData","clickPosition","setClickPosition","y","isPopoverOpen","setPopoverOpen","prevPropsRef","useEffect","current","prevProps","useImperativeHandle","componentRef","chartContainer","classes","_getDomainNRangeValues","points","margins","width","chartType","isRTL","xAxisType","barWidth","tickValues","domainNRangeValue","NumericAxis","DateAxis","dStartValue","dEndValue","rStartValue","rEndValue","_getMargins","_onRectMouseMove","mouseEvent","persist","data","lineChartData","_updatePosition","clientX","clientY","xOffset","invert","document","getElementById","i","d0","d1","pointToHighlight","index","axisType","length","x0","point0","point1","Date","getTime","Math","abs","xAxisCalloutData","formattedDate","useUTC","modifiedXVal","found","element","_nearestCircleToHighlight","filteredValues","_getFilteredLegendValues","values","_onRectMouseOut","newX","newY","threshold","distance","sqrt","pow","_handleChartMouseLeave","_getDataPoints","keys","dataSet","renderPoints","maxOfYVal","_shouldFillToZeroY","forEach","key","currentLayer","push","xVal","dataValues","dp","layer","renderData","endValue","_createDataSet","enablePerfOptimization","allChartPoints","colors","opacity","calloutPoints","singleChartPoint","color","mapOfXvalToListOfDataPoints","dataPoint","xValue","toLocaleString","Object","value","singleDataset","singleDataPoint","keysLength","keyVal","tempArr","valToCheck","filteredChartPoints","filter","point","val","_getCustomizedCallout","onRenderCalloutPerStack","onRenderCalloutPerDataPoint","_getGraphData","xAxis","yAxis","containerHeight","containerWidth","xElement","yAxisElement","yScaleSecondary","_drawGraph","_onLegendHover","legend","_onLegendLeave","_getLegendData","actions","singleChartData","checkSimilarLegends","leg","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","onChange","_onLegendSelectionChange","event","currentLegend","canSelectMultipleLegends","slice","_onDataPointClick","func","_getOpacity","_legendHighlighted","_noLegendHighlighted","_getLineOpacity","_updateCircleFillColor","xDataPoint","lineColor","circleId","fillColor","colorNeutralBackground1","xScale","yScalePrimary","_addDefaultColors","pointOptions","pointLineOptions","graph","singleStackedData","yScale","useSecondaryYScale","curveFactory","lineOptions","curve","y0","y1","layerOpacity","Fragment","enableGradient","defs","linearGradient","id","x1","x2","y2","stop","offset","stopColor","path","fill","strokeWidth","stroke","onMouseMove","onMouseOut","onMouseOver","strokeDasharray","strokeDashoffset","strokeLinecap","circle","cx","cy","r","fillOpacity","optimizeLargeData","tabIndex","role","circleRadius","Number","g","clipPath","aria-label","map","singlePoint","pointIndex","onClick","onDataPointClick","onFocus","_handleFocus","onBlur","_handleBlur","_getCircleRadius","_getAriaLabel","visibility","showXAxisLablesTooltip","remove","e","wrapXAxisLables","xAxisElement","call","tooltipProps","tooltipCls","tooltip","axis","_getHighlightedLegend","includes","item","lineIndex","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_isChartEmpty","_getChartTitle","chartTitle","mode","secondaryYScaleOptions","some","isXAxisDateType","tickParams","tickFormat","calloutProps","isCartesian","customCallout","customizedCallout","customCalloutProps","calloutPropsPerDataPoint","isCalloutForStack","legendBars","createYAxis","getGraphData","getDomainNRangeValues","getmargins","onChartMouseLeave","getMinMaxOfYAxis","enableFirstRenderOptimization","children","ticks","width1","rectHeight","top","rect","height","div","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BACCzF,IAAI7N;oBACJ4D,OAAOuP;oBACPI,QAAQH;oBACR/E,MAAM;oBACNG,aAAa9C,CAAAA,QAAShH,iBAAiBgH;oBACvC+C,YAAY3H;oBACZ4H,aAAahD,CAAAA,QAAShH,iBAAiBgH;mCAG3C,oBAAC8D,WAAG7O;YAGV;;IAGN;IACA,qBACE,oBAAC6S;QAAI3F,IAAIzN;QAAeiP,MAAM;QAASoE,OAAO;YAAE/K,SAAS;QAAI;QAAGgH,cAAY;;AAEhF,GACA;AACFjQ,UAAUiU,WAAW,GAAG"}
1
+ {"version":3,"sources":["AreaChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useAreaChartStyles } from './useAreaChartStyles.styles';\nimport { max as d3Max, bisector } from 'd3-array';\nimport { pointer } from 'd3-selection';\nimport { select as d3Select } from 'd3-selection';\nimport { tokens } from '@fluentui/react-theme';\nimport { area as d3Area, stack as d3Stack, curveMonotoneX as d3CurveBasis, line as d3Line } from 'd3-shape';\nimport {\n AccessibilityProps,\n CartesianChart,\n CustomizedCalloutData,\n AreaChartProps,\n LineChartDataPoint,\n LineChartPoints,\n ChildProps,\n Margins,\n YValueHover,\n ChartPopoverProps,\n Chart,\n} from '../../index';\nimport {\n calloutData,\n getXAxisType,\n ChartTypes,\n XAxisTypes,\n getTypeOfAxis,\n tooltipOfAxislabels,\n getNextColor,\n getColorFromToken,\n formatDate,\n getSecureProps,\n areArraysEqual,\n getCurveFactory,\n find,\n findNumericMinMaxOfY,\n createNumericYAxis,\n IDomainNRange,\n domainRangeOfNumericForAreaChart,\n domainRangeOfDateForAreaLineVerticalBarChart,\n createStringYAxis,\n} from '../../utilities/index';\nimport { useId } from '@fluentui/react-utilities';\nimport { Legend, Legends } from '../Legends/index';\nimport { ScaleLinear } from 'd3-scale';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst bisect = bisector((d: any) => d.x).left;\n\nenum InterceptVisibility {\n show = 'visibility',\n hide = 'hidden',\n}\n\nexport interface AreaChartAreaPoint {\n xVal: string | number;\n values: AreaChartDataSetPoint;\n}\nexport interface AreaChartDataSetPoint {\n [key: string]: number | string | number[];\n}\nexport interface DPointType {\n values: { 0: number; 1: number; data: {} };\n xVal: number | Date;\n}\nexport interface MapXToDataSet {\n [key: string]: LineChartDataPoint[];\n [key: number]: LineChartDataPoint[];\n}\n\n//by default d3-shape 3.2.0 limits the< path> data point precision to 3 digits(d3/d3-path#10)\n\nexport const AreaChart: React.FunctionComponent<AreaChartProps> = React.forwardRef<HTMLDivElement, AreaChartProps>(\n (props, forwardedRef) => {\n const _uniqueIdForGraph: string = useId('areaChart_');\n const _verticalLineId: string = useId('verticalLine_');\n const _circleId: string = useId('circle');\n const _rectId: string = useId('rectangle');\n const _tooltipId: string = useId('AreaChartTooltipID');\n //enableComputationOptimization is used for optimized code to group data points by x value\n //from O(n^2) to O(n) using a map.\n const _enableComputationOptimization: boolean = true;\n const _firstRenderOptimization: boolean = true;\n const _emptyChartId: string = useId('_AreaChart_empty');\n let _containsSecondaryYAxis = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _calloutPoints: any;\n let _createSet: (data: LineChartPoints[]) => {\n colors: string[];\n opacity: number[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n calloutPoints: any;\n };\n let _colors: string[];\n let _opacity: number[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _data: any;\n let _chart: JSX.Element[];\n let _margins: Margins;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xAxisRectScale: any;\n // determines if the given area chart has multiple stacked bar charts\n let _isMultiStackChart: boolean;\n const cartesianChartRef = React.useRef<Chart>(null);\n\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [activeLegend, setActiveLegend] = React.useState<string | undefined>(undefined);\n const [hoverXValue, setHoverXValue] = React.useState<string | number | undefined | null>('');\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const [YValueHover, setYValueHover] = React.useState<YValueHover[]>([]);\n const [lineXValue, setLineXValue] = React.useState<number>(0);\n const [displayOfLine, setDisplayOfLine] = React.useState<InterceptVisibility>(InterceptVisibility.hide);\n const [isCircleClicked, setIsCircleClicked] = React.useState<boolean>(false);\n const [nearestCircleToHighlight, setNearestCircleToHighlight] = React.useState<number | string | Date | null>(null);\n const [activePoint, setActivePoint] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<CustomizedCalloutData>();\n const [stackCalloutProps, setStackCalloutProps] = React.useState<CustomizedCalloutData>();\n const [xAxisCalloutAccessibilityData, setXAxisCalloutAccessibilityData] = React.useState<AccessibilityProps>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const prevPropsRef = React.useRef<AreaChartProps | null>(null);\n\n React.useEffect(() => {\n if (prevPropsRef.current) {\n const prevProps = prevPropsRef.current;\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n }\n prevPropsRef.current = props;\n }, [props]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n }),\n [],\n );\n\n const classes = useAreaChartStyles(props);\n\n function _getDomainNRangeValues(\n points: LineChartPoints[],\n margins: Margins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForAreaChart(points, margins, width, isRTL);\n } else if (xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(\n points,\n margins,\n width,\n isRTL,\n tickValues! as Date[],\n chartType,\n barWidth,\n );\n } else {\n domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };\n }\n return domainNRangeValue;\n }\n\n function _getMargins(margins: Margins) {\n _margins = margins;\n }\n\n function _onRectMouseMove(mouseEvent: React.MouseEvent<SVGRectElement | SVGPathElement | SVGCircleElement>) {\n mouseEvent.persist();\n const { data } = props;\n const { lineChartData } = data;\n _updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n // This will get the value of the X when mouse is on the chart\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n const xOffset = _xAxisRectScale.invert(pointer(mouseEvent)[0], document.getElementById(_rectId)!);\n const i = bisect(lineChartData![0].data, xOffset);\n const d0 = lineChartData![0].data[i - 1] as LineChartDataPoint;\n const d1 = lineChartData![0].data[i] as LineChartDataPoint;\n let pointToHighlight: string | Date | number | null = null;\n let index: null | number = null;\n const axisType =\n lineChartData![0].data.length > 0 ? (getTypeOfAxis(lineChartData![0].data[0].x, true) as XAxisTypes) : null;\n if (d0 === undefined && d1 !== undefined) {\n pointToHighlight = d1.x;\n index = i;\n } else if (d0 !== undefined && d1 === undefined) {\n pointToHighlight = d0.x;\n index = i - 1;\n } else {\n let x0;\n let point0;\n let point1;\n switch (axisType) {\n case XAxisTypes.DateAxis:\n x0 = new Date(xOffset).getTime();\n point0 = (d0.x as Date).getTime();\n point1 = (d1.x as Date).getTime();\n pointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;\n index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;\n break;\n case XAxisTypes.NumericAxis:\n x0 = xOffset as number;\n point0 = d0.x as number;\n point1 = d1.x as number;\n pointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;\n index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;\n break;\n default:\n break;\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { xAxisCalloutData, xAxisCalloutAccessibilityData } = lineChartData![0].data[index as number];\n const formattedDate =\n pointToHighlight instanceof Date ? formatDate(pointToHighlight, props.useUTC) : pointToHighlight;\n const modifiedXVal = pointToHighlight instanceof Date ? pointToHighlight.getTime() : pointToHighlight;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const found: any = find(_calloutPoints, (element: { x: string | number }) => {\n return element.x === modifiedXVal;\n });\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const _nearestCircleToHighlight =\n axisType === XAxisTypes.DateAxis ? (pointToHighlight as Date).getTime() : pointToHighlight;\n // if no points need to be called out then don't show vertical line and callout card\n if (found) {\n const filteredValues = _getFilteredLegendValues(found.values);\n setNearestCircleToHighlight(_nearestCircleToHighlight);\n setLineXValue(_xAxisRectScale(pointToHighlight));\n setDisplayOfLine(InterceptVisibility.show);\n setIsCircleClicked(false);\n setStackCalloutProps({ ...found, values: filteredValues });\n setYValueHover(filteredValues);\n setDataPointCalloutProps({ ...found, values: filteredValues });\n setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);\n setXAxisCalloutAccessibilityData(xAxisCalloutAccessibilityData);\n setActivePoint('');\n } else {\n setPopoverOpen(false);\n setNearestCircleToHighlight(nearestCircleToHighlight);\n setDisplayOfLine(InterceptVisibility.hide);\n setIsCircleClicked(false);\n }\n }\n /**\n * just cleaning up the state which we have set in the mouse move event\n */\n function _onRectMouseOut() {\n /**/\n }\n\n function _updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n function _handleChartMouseLeave() {\n setPopoverOpen(false);\n setNearestCircleToHighlight(null);\n setLineXValue(0);\n setDisplayOfLine(InterceptVisibility.hide);\n setIsCircleClicked(false);\n setStackCalloutProps(undefined);\n setDataPointCalloutProps(undefined);\n setHoverXValue(undefined);\n setYValueHover([]);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _getDataPoints(keys: string[], dataSet: any) {\n const renderPoints: Array<AreaChartDataSetPoint[]> = [];\n let maxOfYVal = 0;\n\n if (_shouldFillToZeroY()) {\n keys.forEach((key, index) => {\n const currentLayer: AreaChartDataSetPoint[] = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dataSet.forEach((d: any) => {\n currentLayer.push({\n values: [0, d[key]], // Start from zero for \"tozeroy\" mode\n xVal: d.xVal,\n });\n if (d[key] > maxOfYVal) {\n maxOfYVal = d[key];\n }\n });\n renderPoints.push(currentLayer);\n });\n } else {\n const dataValues = d3Stack().keys(keys)(dataSet);\n maxOfYVal = d3Max(dataValues[dataValues.length - 1], dp => dp[1])!;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dataValues.forEach((layer: any) => {\n const currentLayer: AreaChartDataSetPoint[] = [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n layer.forEach((d: any) => {\n currentLayer.push({\n values: d,\n xVal: d.data.xVal,\n });\n });\n renderPoints.push(currentLayer);\n });\n }\n\n _isMultiStackChart = !!(props.legendProps?.selectedLegends\n ? renderPoints?.length >= 1\n : renderPoints?.length > 1);\n return {\n renderData: renderPoints,\n // The maxOfYVal prop is only required for the primary y-axis. When the data includes\n // a secondary y-axis, the mode defaults to tozeroy, so maxOfYVal should be calculated using\n // only the data points associated with the primary y-axis.\n maxOfYVal: _containsSecondaryYAxis ? findNumericMinMaxOfY(props.data.lineChartData!).endValue : maxOfYVal,\n };\n }\n\n function _createDataSet(points: LineChartPoints[]) {\n if (props.enablePerfOptimization && _enableComputationOptimization) {\n const allChartPoints: LineChartDataPoint[] = [];\n const dataSet: AreaChartDataSetPoint[] = [];\n const colors: string[] = [];\n const opacity: number[] = [];\n const calloutPoints = calloutData(points!);\n\n points &&\n points.length &&\n points.forEach((singleChartPoint: LineChartPoints) => {\n colors.push(singleChartPoint.color!);\n opacity.push(singleChartPoint.opacity || 1);\n allChartPoints.push(...(singleChartPoint.data as LineChartDataPoint[]));\n });\n\n const mapOfXvalToListOfDataPoints: MapXToDataSet = {};\n allChartPoints.forEach((dataPoint: LineChartDataPoint) => {\n const xValue = dataPoint.x instanceof Date ? dataPoint.x.toLocaleString() : dataPoint.x;\n // map of x value to the list of data points which share the same x value .\n if (mapOfXvalToListOfDataPoints[xValue]) {\n mapOfXvalToListOfDataPoints[xValue].push(dataPoint);\n } else {\n mapOfXvalToListOfDataPoints[xValue] = [dataPoint];\n }\n });\n\n Object.keys(mapOfXvalToListOfDataPoints).forEach((key: number | string) => {\n const value: LineChartDataPoint[] = mapOfXvalToListOfDataPoints[key];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const singleDataset: any = {};\n value.forEach((singleDataPoint: LineChartDataPoint, index: number) => {\n singleDataset.xVal = singleDataPoint.x;\n singleDataset[`chart${index}`] = singleDataPoint.y;\n });\n dataSet.push(singleDataset);\n });\n\n // get keys from dataset, used to render data\n const keysLength: number = dataSet && Object.keys(dataSet[0])!.length;\n const keys: string[] = [];\n for (let i = 0; i < keysLength - 1; i++) {\n const keyVal = `chart${i}`;\n keys.push(keyVal);\n }\n\n // Data used to draw graph\n const data = _getDataPoints(keys, dataSet);\n\n return {\n colors,\n opacity,\n keys,\n data,\n calloutPoints,\n };\n } else {\n const allChartPoints: LineChartDataPoint[] = [];\n const dataSet: AreaChartDataSetPoint[] = [];\n const colors: string[] = [];\n const opacity: number[] = [];\n const calloutPoints = calloutData(points!);\n\n points &&\n points.length &&\n points.forEach((singleChartPoint: LineChartPoints) => {\n colors.push(singleChartPoint.color!);\n opacity.push(singleChartPoint.opacity || 1);\n allChartPoints.push(...(singleChartPoint.data as LineChartDataPoint[]));\n });\n\n let tempArr = allChartPoints;\n while (tempArr.length) {\n const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;\n const filteredChartPoints: LineChartDataPoint[] = tempArr.filter(\n (point: LineChartDataPoint) =>\n (point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck,\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const singleDataset: any = {};\n filteredChartPoints.forEach((singleDataPoint: LineChartDataPoint, index: number) => {\n singleDataset.xVal = singleDataPoint.x;\n singleDataset[`chart${index}`] = singleDataPoint.y;\n });\n dataSet.push(singleDataset);\n // removing compared objects from array\n const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;\n tempArr = tempArr.filter(\n (point: LineChartDataPoint) => (point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val,\n );\n }\n\n // get keys from dataset, used to create stacked data\n const keysLength: number = dataSet && Object.keys(dataSet[0])!.length;\n const keys: string[] = [];\n for (let i = 0; i < keysLength - 1; i++) {\n const keyVal = `chart${i}`;\n keys.push(keyVal);\n }\n\n // Data used to draw graph\n const data = _getDataPoints(keys, dataSet);\n\n return {\n colors,\n opacity,\n keys,\n data,\n calloutPoints,\n };\n }\n }\n\n function _getCustomizedCallout() {\n return props.onRenderCalloutPerStack\n ? props.onRenderCalloutPerStack(stackCalloutProps)\n : props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps)\n : null;\n }\n\n function _getGraphData(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xAxis: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yAxis: any,\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement | null,\n yAxisElement?: SVGElement | null,\n yScaleSecondary?: ScaleLinear<number, number>,\n ) {\n _chart = _drawGraph(containerHeight, xAxis, yAxis, yScaleSecondary, xElement!);\n }\n\n function _onLegendHover(legend: string): void {\n setActiveLegend(legend);\n }\n\n function _onLegendLeave(): void {\n setActiveLegend(undefined);\n }\n\n function _getLegendData(points: LineChartPoints[]): JSX.Element {\n const data = points;\n const actions: Legend[] = [];\n\n data.forEach((singleChartData: LineChartPoints) => {\n const color: string = singleChartData.color!;\n const checkSimilarLegends = actions.filter(\n (leg: Legend) => leg.title === singleChartData.legend && leg.color === color,\n );\n if (checkSimilarLegends!.length > 0) {\n return;\n }\n\n const legend: Legend = {\n title: singleChartData.legend,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(singleChartData.legend);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n\n actions.push(legend);\n });\n return (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n {...props.legendProps}\n onChange={_onLegendSelectionChange}\n />\n );\n }\n\n function _onLegendSelectionChange(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n function _onDataPointClick(func: (() => void) | undefined) {\n if (func) {\n func();\n }\n setIsCircleClicked(true);\n }\n\n function _getOpacity(legend: string): number {\n if (!_isMultiStackChart) {\n return 0.7;\n } else {\n const opacity = _legendHighlighted(legend) || _noLegendHighlighted() ? 0.7 : 0.1;\n return opacity;\n }\n }\n\n function _getLineOpacity(legend: string): number {\n if (!_isMultiStackChart) {\n return 1;\n } else {\n let opacity = 0.3;\n if (isPopoverOpen) {\n opacity = 1;\n }\n if (!_noLegendHighlighted()) {\n opacity = _legendHighlighted(legend) ? 0 : 0.1;\n }\n return opacity;\n }\n }\n\n function _updateCircleFillColor(xDataPoint: number | Date, lineColor: string, circleId: string): string {\n let fillColor = lineColor;\n if (nearestCircleToHighlight === xDataPoint || activePoint === circleId) {\n if (!isCircleClicked) {\n fillColor = tokens.colorNeutralBackground1;\n }\n }\n\n return fillColor;\n }\n\n function _drawGraph(\n containerHeight: number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xScale: any,\n yScalePrimary: ScaleLinear<number, number>,\n yScaleSecondary: ScaleLinear<number, number> | undefined,\n xElement: SVGElement,\n ): JSX.Element[] {\n const points = _addDefaultColors(props.data.lineChartData);\n const { pointOptions, pointLineOptions } = props.data;\n\n const graph: JSX.Element[] = [];\n let lineColor: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _data.forEach((singleStackedData: Array<any>, index: number) => {\n const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;\n const curveFactory = getCurveFactory(points[index].lineOptions?.curve, d3CurveBasis);\n const area = d3Area()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .x((d: any) => xScale(d.xVal))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .y0((d: any) => yScale(d.values[0]))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .y1((d: any) => yScale(d.values[1]))\n .curve(curveFactory);\n const line = d3Line()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .x((d: any) => xScale(d.xVal))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .y((d: any) => yScale(d.values[1]))\n .curve(curveFactory);\n const layerOpacity = _shouldFillToZeroY() ? 0.8 : _opacity[index];\n graph.push(\n <React.Fragment key={`${index}-graph-${_uniqueIdForGraph}`}>\n {props.enableGradient && (\n <defs>\n <linearGradient id={`gradient_${index}`} x1=\"0%\" x2=\"0%\" y1=\"0%\" y2=\"100%\">\n <stop offset=\"0\" stopColor={_colors[index]} />\n <stop offset=\"100%\" stopColor=\"transparent\" />\n </linearGradient>\n </defs>\n )}\n <path\n id={`${index}-line-${_uniqueIdForGraph}`}\n d={line(singleStackedData)!}\n fill={'transparent'}\n strokeWidth={points[index].lineOptions?.strokeWidth ?? 3}\n stroke={_colors[index]}\n opacity={_getLineOpacity(points[index]!.legend)}\n onMouseMove={event => _onRectMouseMove(event)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n strokeDasharray={points[index].lineOptions?.strokeDasharray}\n strokeDashoffset={points[index].lineOptions?.strokeDashoffset}\n strokeLinecap={points[index].lineOptions?.strokeLinecap}\n />\n {singleStackedData.length === 1 ? (\n <circle\n id={`${index}-graph-${_uniqueIdForGraph}`}\n cx={xScale(singleStackedData[0].xVal)}\n cy={yScale(singleStackedData[0].values[1])}\n r={6}\n stroke={_colors[index]}\n strokeWidth={3}\n fill={_colors[index]}\n opacity={layerOpacity}\n fillOpacity={_getOpacity(points[index]!.legend)}\n onMouseMove={event => _onRectMouseMove(event)}\n onFocus={event => _handleFocus(event, index, 0, `${_circleId}_${index}`)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n />\n ) : (\n <path\n id={`${index}-graph-${_uniqueIdForGraph}`}\n d={area(singleStackedData)!}\n fill={props.enableGradient ? `url(#gradient_${index})` : _colors[index]}\n opacity={layerOpacity}\n fillOpacity={_getOpacity(points[index]!.legend)}\n onMouseMove={event => _onRectMouseMove(event)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n {...(props.optimizeLargeData && {\n tabIndex: _legendHighlighted(points[index]!.legend) || _noLegendHighlighted() ? 0 : undefined,\n role: 'img',\n 'aria-label': `${points[index].legend}, series ${index + 1} of ${points.length} with ${\n points[index].data.length\n } data points.`,\n })}\n />\n )}\n </React.Fragment>,\n );\n });\n\n const circleRadius = pointOptions && pointOptions.r ? Number(pointOptions.r) : 8;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _data.forEach((singleStackedData: Array<any>, index: number) => {\n if (points.length === index) {\n return;\n }\n const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;\n\n if (!props.optimizeLargeData || singleStackedData.length === 1) {\n // Render circles for all data points\n graph.push(\n <g\n key={`${index}-dots-${_uniqueIdForGraph}`}\n clipPath=\"url(#clip)\"\n role=\"region\"\n aria-label={`${points[index].legend}, series ${index + 1} of ${points.length} with ${\n points[index].data.length\n } data points.`}\n >\n {singleStackedData.map((singlePoint: DPointType, pointIndex: number) => {\n const circleId = `${_circleId}_${index * _data[0].length + pointIndex}`;\n const xDataPoint = singlePoint.xVal instanceof Date ? singlePoint.xVal.getTime() : singlePoint.xVal;\n lineColor = points[index]!.color!;\n const legend = points[index]!.legend;\n return (\n <circle\n key={circleId}\n id={circleId}\n tabIndex={_legendHighlighted(points[index]!.legend) || _noLegendHighlighted() ? 0 : undefined}\n cx={xScale(singlePoint.xVal)}\n cy={yScale(singlePoint.values[1])}\n stroke={lineColor}\n strokeWidth={3}\n fill={_updateCircleFillColor(xDataPoint, lineColor, circleId)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n onClick={() => _onDataPointClick(points[index]!.data[pointIndex].onDataPointClick!)}\n onFocus={event => _handleFocus(event, index, pointIndex, circleId)}\n onBlur={_handleBlur}\n {...getSecureProps(pointOptions)}\n r={_getCircleRadius(xDataPoint, circleRadius, circleId, legend)}\n role=\"img\"\n aria-label={_getAriaLabel(index, pointIndex)}\n />\n );\n })}\n </g>,\n );\n } else {\n // Render circles for data points close to the mouse pointer only\n singleStackedData.forEach((singlePoint: DPointType, pointIndex: number) => {\n const xDataPoint = singlePoint.xVal instanceof Date ? singlePoint.xVal.getTime() : singlePoint.xVal;\n if (nearestCircleToHighlight === xDataPoint) {\n const circleId = `${_circleId}_${index * _data[0].length + pointIndex}`;\n lineColor = points[index]!.color!;\n const legend = points[index]!.legend;\n graph.push(\n <circle\n key={circleId}\n id={circleId}\n cx={xScale(singlePoint.xVal)}\n cy={yScale(singlePoint.values[1])}\n stroke={lineColor}\n strokeWidth={3}\n fill={_updateCircleFillColor(xDataPoint, lineColor, circleId)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n onFocus={event => _handleFocus(event, index, pointIndex, circleId)}\n onClick={() => _onDataPointClick(points[index]!.data[pointIndex].onDataPointClick!)}\n {...getSecureProps(pointOptions)}\n r={_getCircleRadius(xDataPoint, circleRadius, circleId, legend)}\n />,\n );\n }\n });\n }\n });\n graph.push(\n <line\n id={_verticalLineId}\n key={_verticalLineId}\n x1={lineXValue}\n y1={0}\n x2={lineXValue}\n y2={containerHeight}\n strokeWidth={1}\n strokeDasharray={5.5}\n stroke={lineColor!}\n opacity={0.5}\n visibility={displayOfLine}\n {...getSecureProps(pointLineOptions)}\n />,\n );\n // Removing un wanted tooltip div from DOM, when prop not provided.\n if (!props.showXAxisLablesTooltip) {\n try {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n // Used to display tooltip at x axis labels.\n if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {\n const xAxisElement = d3Select(xElement).call(xScale);\n try {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n const tooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: xAxisElement,\n };\n xAxisElement && tooltipOfAxislabels(tooltipProps);\n }\n return graph;\n }\n\n function _getCircleRadius(xDataPoint: number, circleRadius: number, circleId: string, legend: string): number {\n // Show the circle if no legends are selected or if the point's legend is in the selected legends\n if (!_noLegendHighlighted() && !_legendHighlighted(legend)) {\n return 0;\n }\n\n if (isCircleClicked && nearestCircleToHighlight === xDataPoint) {\n return 1;\n } else if (nearestCircleToHighlight === xDataPoint || activePoint === circleId) {\n return circleRadius;\n } else {\n return 0;\n }\n }\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n function _legendHighlighted(legend: string) {\n return _getHighlightedLegend().includes(legend!);\n }\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n function _noLegendHighlighted() {\n return _getHighlightedLegend().length === 0;\n }\n\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _addDefaultColors(lineChartData?: LineChartPoints[]): LineChartPoints[] {\n return lineChartData\n ? lineChartData.map((item, index) => {\n let color: string;\n // isInverted property is applicable to v8 themes only\n if (typeof item.color === 'undefined') {\n color = getNextColor(index, 0);\n } else {\n color = getColorFromToken(item.color);\n }\n\n return { ...item, color };\n })\n : [];\n }\n\n function _handleFocus(\n event: React.FocusEvent<SVGCircleElement, Element>,\n lineIndex: number,\n pointIndex: number,\n circleId: string,\n ) {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (event.target as SVGCircleElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n _updatePosition(cx, cy);\n\n const { x, y, xAxisCalloutData } = props.data.lineChartData![lineIndex].data[pointIndex];\n const formattedDate = x instanceof Date ? formatDate(x, props.useUTC) : x;\n const modifiedXVal = x instanceof Date ? x.getTime() : x;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const found: any = _calloutPoints.find((e: { x: string | number }) => e.x === modifiedXVal);\n // Show details in the callout for the focused point only\n found.values = found.values.filter((e: { y: number }) => e.y === y);\n const filteredValues = _getFilteredLegendValues(found.values);\n\n setPopoverOpen(true);\n setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);\n setYValueHover(filteredValues!);\n setStackCalloutProps({ ...found, values: filteredValues });\n setDataPointCalloutProps({ ...found, values: filteredValues });\n setActivePoint(circleId);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _getFilteredLegendValues(values: any) {\n return !_noLegendHighlighted()\n ? values.filter((value: { legend: string }) => _legendHighlighted(value.legend))\n : values;\n }\n\n function _handleBlur() {\n setPopoverOpen(false);\n setHoverXValue(undefined);\n setYValueHover([]);\n setStackCalloutProps(undefined);\n setDataPointCalloutProps(undefined);\n setActivePoint('');\n }\n\n function _getAriaLabel(lineIndex: number, pointIndex: number): string {\n const line = props.data.lineChartData![lineIndex];\n const point = line.data[pointIndex];\n const formattedDate = point.x instanceof Date ? formatDate(point.x, props.useUTC) : point.x;\n const xValue = point.xAxisCalloutData || formattedDate;\n const legend = line.legend;\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${xValue}. ${legend}, ${yValue}.`;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n (\n props.data &&\n props.data.lineChartData &&\n props.data.lineChartData.length > 0 &&\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n props.data.lineChartData.filter((item: { data: string | any[] }) => item.data.length === 0).length === 0\n )\n // if all the data sets have no data\n // filtering all items which have no data and checking if the length of the filtered array is 0\n // which means chart is not empty\n );\n }\n\n function _getChartTitle(): string {\n const { chartTitle, lineChartData } = props.data;\n return (chartTitle ? `${chartTitle}. ` : '') + `Area chart with ${lineChartData?.length || 0} data series. `;\n }\n\n function _shouldFillToZeroY() {\n return props.mode === 'tozeroy' || _containsSecondaryYAxis;\n }\n\n if (!_isChartEmpty()) {\n const { lineChartData } = props.data;\n const points = _addDefaultColors(lineChartData);\n _containsSecondaryYAxis = !!props.secondaryYScaleOptions && points.some(point => point.useSecondaryYScale);\n _createSet = _createDataSet;\n const { colors, opacity, data, calloutPoints } = _createSet(points);\n _calloutPoints = calloutPoints;\n const isXAxisDateType = getXAxisType(points);\n _colors = colors;\n _opacity = opacity;\n _data = data.renderData;\n const legends: JSX.Element = _getLegendData(points);\n\n const tickParams = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n const calloutProps: ChartPopoverProps = {\n YValueHover: YValueHover!,\n hoverXValue: hoverXValue!,\n xAxisCalloutAccessibilityData,\n ...props.calloutProps,\n clickPosition,\n isPopoverOpen,\n isCartesian: true,\n customCallout: {\n customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout()! : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n },\n isCalloutForStack: true,\n };\n return (\n <CartesianChart\n {...props}\n chartTitle={_getChartTitle()}\n points={points}\n chartType={ChartTypes.AreaChart}\n calloutProps={calloutProps}\n legendBars={legends}\n createYAxis={createNumericYAxis}\n xAxisType={isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis}\n tickParams={tickParams}\n maxOfYVal={data.maxOfYVal}\n getGraphData={_getGraphData}\n getDomainNRangeValues={_getDomainNRangeValues}\n createStringYAxis={createStringYAxis}\n getmargins={_getMargins}\n onChartMouseLeave={_handleChartMouseLeave}\n getMinMaxOfYAxis={findNumericMinMaxOfY}\n enableFirstRenderOptimization={props.enablePerfOptimization && _firstRenderOptimization}\n componentRef={cartesianChartRef}\n /* eslint-disable react/jsx-no-bind */\n // eslint-disable-next-line react/no-children-prop, @typescript-eslint/no-shadow\n children={(props: ChildProps) => {\n _xAxisRectScale = props.xScale;\n const ticks = _xAxisRectScale.ticks();\n const width1 = _xAxisRectScale(ticks[ticks.length - 1]);\n const rectHeight = props.containerHeight! - _margins.top!;\n return (\n <>\n <g>\n <rect\n id={_rectId}\n width={width1}\n height={rectHeight}\n fill={'transparent'}\n onMouseMove={event => _onRectMouseMove(event)}\n onMouseOut={_onRectMouseOut}\n onMouseOver={event => _onRectMouseMove(event)}\n />\n </g>\n <g>{_chart}</g>\n </>\n );\n }}\n />\n );\n }\n return (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\nAreaChart.displayName = 'AreaChart';\n"],"names":["React","useAreaChartStyles","max","d3Max","bisector","pointer","select","d3Select","tokens","area","d3Area","stack","d3Stack","curveMonotoneX","d3CurveBasis","line","d3Line","CartesianChart","calloutData","getXAxisType","ChartTypes","XAxisTypes","getTypeOfAxis","tooltipOfAxislabels","getNextColor","getColorFromToken","formatDate","getSecureProps","areArraysEqual","getCurveFactory","find","findNumericMinMaxOfY","createNumericYAxis","domainRangeOfNumericForAreaChart","domainRangeOfDateForAreaLineVerticalBarChart","createStringYAxis","useId","Legends","bisect","d","x","left","InterceptVisibility","AreaChart","forwardRef","props","forwardedRef","_uniqueIdForGraph","_verticalLineId","_circleId","_rectId","_tooltipId","_enableComputationOptimization","_firstRenderOptimization","_emptyChartId","_containsSecondaryYAxis","_calloutPoints","_createSet","_colors","_opacity","_data","_chart","_margins","_xAxisRectScale","_isMultiStackChart","cartesianChartRef","useRef","selectedLegends","setSelectedLegends","useState","legendProps","activeLegend","setActiveLegend","undefined","hoverXValue","setHoverXValue","YValueHover","setYValueHover","lineXValue","setLineXValue","displayOfLine","setDisplayOfLine","isCircleClicked","setIsCircleClicked","nearestCircleToHighlight","setNearestCircleToHighlight","activePoint","setActivePoint","dataPointCalloutProps","setDataPointCalloutProps","stackCalloutProps","setStackCalloutProps","xAxisCalloutAccessibilityData","setXAxisCalloutAccessibilityData","clickPosition","setClickPosition","y","isPopoverOpen","setPopoverOpen","prevPropsRef","useEffect","current","prevProps","useImperativeHandle","componentRef","chartContainer","classes","_getDomainNRangeValues","points","margins","width","chartType","isRTL","xAxisType","barWidth","tickValues","domainNRangeValue","NumericAxis","DateAxis","dStartValue","dEndValue","rStartValue","rEndValue","_getMargins","_onRectMouseMove","mouseEvent","persist","data","lineChartData","_updatePosition","clientX","clientY","xOffset","invert","document","getElementById","i","d0","d1","pointToHighlight","index","axisType","length","x0","point0","point1","Date","getTime","Math","abs","xAxisCalloutData","formattedDate","useUTC","modifiedXVal","found","element","_nearestCircleToHighlight","filteredValues","_getFilteredLegendValues","values","_onRectMouseOut","newX","newY","threshold","distance","sqrt","pow","_handleChartMouseLeave","_getDataPoints","keys","dataSet","renderPoints","maxOfYVal","_shouldFillToZeroY","forEach","key","currentLayer","push","xVal","dataValues","dp","layer","renderData","endValue","_createDataSet","enablePerfOptimization","allChartPoints","colors","opacity","calloutPoints","singleChartPoint","color","mapOfXvalToListOfDataPoints","dataPoint","xValue","toLocaleString","Object","value","singleDataset","singleDataPoint","keysLength","keyVal","tempArr","valToCheck","filteredChartPoints","filter","point","val","_getCustomizedCallout","onRenderCalloutPerStack","onRenderCalloutPerDataPoint","_getGraphData","xAxis","yAxis","containerHeight","containerWidth","xElement","yAxisElement","yScaleSecondary","_drawGraph","_onLegendHover","legend","_onLegendLeave","_getLegendData","actions","singleChartData","checkSimilarLegends","leg","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","onChange","_onLegendSelectionChange","event","currentLegend","canSelectMultipleLegends","slice","_onDataPointClick","func","_getOpacity","_legendHighlighted","_noLegendHighlighted","_getLineOpacity","_updateCircleFillColor","xDataPoint","lineColor","circleId","fillColor","colorNeutralBackground1","xScale","yScalePrimary","_addDefaultColors","pointOptions","pointLineOptions","graph","singleStackedData","yScale","useSecondaryYScale","curveFactory","lineOptions","curve","y0","y1","layerOpacity","Fragment","enableGradient","defs","linearGradient","id","x1","x2","y2","stop","offset","stopColor","path","fill","strokeWidth","stroke","onMouseMove","onMouseOut","onMouseOver","strokeDasharray","strokeDashoffset","strokeLinecap","circle","cx","cy","r","fillOpacity","onFocus","_handleFocus","optimizeLargeData","tabIndex","role","circleRadius","Number","g","clipPath","aria-label","map","singlePoint","pointIndex","onClick","onDataPointClick","onBlur","_handleBlur","_getCircleRadius","_getAriaLabel","visibility","showXAxisLablesTooltip","remove","e","wrapXAxisLables","xAxisElement","call","tooltipProps","tooltipCls","tooltip","axis","_getHighlightedLegend","includes","item","lineIndex","targetRect","target","getBoundingClientRect","top","height","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_isChartEmpty","_getChartTitle","chartTitle","mode","secondaryYScaleOptions","some","isXAxisDateType","tickParams","tickFormat","calloutProps","isCartesian","customCallout","customizedCallout","customCalloutProps","calloutPropsPerDataPoint","isCalloutForStack","legendBars","createYAxis","getGraphData","getDomainNRangeValues","getmargins","onChartMouseLeave","getMinMaxOfYAxis","enableFirstRenderOpt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BAAC9B,yBACC,oBAACgE;oBACC7F,IAAI7N;oBACJ4D,OAAO4P;oBACP/B,QAAQgC;oBACRpF,MAAM;oBACNG,aAAa9C,CAAAA,QAAShH,iBAAiBgH;oBACvC+C,YAAY3H;oBACZ4H,aAAahD,CAAAA,QAAShH,iBAAiBgH;mCAG3C,oBAACgE,WAAG/O;YAGV;;IAGN;IACA,qBACE,oBAACgT;QAAI9F,IAAIzN;QAAemP,MAAM;QAASqE,OAAO;YAAElL,SAAS;QAAI;QAAGkH,cAAY;;AAEhF,GACA;AACFnQ,UAAUoU,WAAW,GAAG"}
@@ -18,8 +18,8 @@ import { formatScientificLimitWidth, useRtl } from '../../../utilities/index';
18
18
  }, [
19
19
  props
20
20
  ]);
21
- function _onFocus(data, id) {
22
- props.onFocusCallback(data, id, currentRef.current);
21
+ function _onFocus(data, id, event) {
22
+ props.onFocusCallback(data, id, event, currentRef.current);
23
23
  }
24
24
  function _hoverOn(data, mouseEvent) {
25
25
  mouseEvent.persist();
@@ -101,10 +101,10 @@ import { formatScientificLimitWidth, useRtl } from '../../../utilities/index';
101
101
  fill: props.color,
102
102
  cursor: href ? 'pointer' : 'default'
103
103
  },
104
- onFocus: _onFocus.bind(this, props.data.data, id),
104
+ onFocus: (event)=>_onFocus(props.data.data, id, event),
105
105
  "data-is-focusable": props.activeArc === props.data.data.legend || props.activeArc === '',
106
- onMouseOver: _hoverOn.bind(this, props.data.data),
107
- onMouseMove: _hoverOn.bind(this, props.data.data),
106
+ onMouseOver: (event)=>_hoverOn(props.data.data, event),
107
+ onMouseMove: (event)=>_hoverOn(props.data.data, event),
108
108
  onMouseLeave: _hoverOff,
109
109
  tabIndex: _shouldHighlightArc(props.data.data.legend) ? 0 : undefined,
110
110
  onBlur: _onBlur,
@@ -1 +1 @@
1
- {"version":3,"sources":["Arc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { useArcStyles } from './useArcStyles.styles';\nimport { ChartDataPoint } from '../index';\nimport { ArcProps } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatScientificLimitWidth, useRtl } from '../../../utilities/index';\n\n// Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Arc component within Donut Chart.\n * {@docCategory ArcDonutChart}\n */\nexport const Arc: React.FunctionComponent<ArcProps> = React.forwardRef<HTMLDivElement, ArcProps>(\n (props, forwardedRef) => {\n const arc = d3Arc();\n const currentRef = React.createRef<SVGPathElement>();\n const _isRTL: boolean = useRtl();\n const classes = useArcStyles(props);\n\n React.useEffect(() => {\n _updateChart(props);\n }, [props]);\n\n function _onFocus(data: ChartDataPoint, id: string): void {\n props.onFocusCallback!(data, id, currentRef.current);\n }\n\n function _hoverOn(data: ChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n props.hoverOnCallback!(data, mouseEvent);\n }\n\n function _hoverOff(): void {\n props.hoverLeaveCallback!();\n }\n\n function _onBlur(): void {\n props.onBlurCallback!();\n }\n\n function _getAriaLabel(): string {\n const point = props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n }\n\n function _shouldHighlightArc(legend?: string): boolean {\n const { activeArc } = props;\n // If no activeArc is provided, highlight all arcs. Otherwise, only highlight the arcs that are active.\n return !activeArc || activeArc.length === 0 || legend === undefined || activeArc.includes(legend);\n }\n\n function _renderArcLabel(className: string) {\n const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid({ ...data!, innerRadius, outerRadius });\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== _isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatScientificLimitWidth(arcValue)}\n </text>\n );\n }\n\n function _updateChart(newProps: ArcProps): void {\n if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n }\n }\n\n const { href, focusedArcId } = props;\n //TO DO 'replace' is throwing error\n const id =\n props.uniqText! +\n (typeof props.data!.data.legend === 'string' ? props.data!.data.legend.replace(/\\s+/g, '') : '') +\n props.data!.data.data;\n const opacity: number = props.activeArc === props.data!.data.legend || props.activeArc === '' ? 1 : 0.1;\n const cornerRadius = props.roundCorners ? 3 : 0;\n return (\n <g ref={currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n // TODO innerradius and outerradius were absent\n <path\n id={id + 'focusRing'}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.focusRing}\n />\n )}\n <path\n // TODO innerradius and outerradius were absent\n id={id}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.root}\n style={{ fill: props.color, cursor: href ? 'pointer' : 'default' }}\n onFocus={_onFocus.bind(this, props.data!.data, id)}\n data-is-focusable={props.activeArc === props.data!.data.legend || props.activeArc === ''}\n onMouseOver={_hoverOn.bind(this, props.data!.data)}\n onMouseMove={_hoverOn.bind(this, props.data!.data)}\n onMouseLeave={_hoverOff}\n tabIndex={_shouldHighlightArc(props.data!.data.legend!) ? 0 : undefined}\n onBlur={_onBlur}\n opacity={opacity}\n onClick={props.data?.data.onClick}\n aria-label={_getAriaLabel()}\n role=\"img\"\n />\n {_renderArcLabel(classes.arcLabel)}\n </g>\n );\n },\n);\nArc.displayName = 'Arc';\n"],"names":["React","arc","d3Arc","useArcStyles","format","d3Format","formatScientificLimitWidth","useRtl","Arc","forwardRef","props","forwardedRef","currentRef","createRef","_isRTL","classes","useEffect","_updateChart","_onFocus","data","id","onFocusCallback","current","_hoverOn","mouseEvent","persist","hoverOnCallback","_hoverOff","hoverLeaveCallback","_onBlur","onBlurCallback","_getAriaLabel","point","legend","xAxisCalloutData","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_shouldHighlightArc","activeArc","length","undefined","includes","_renderArcLabel","className","innerRadius","outerRadius","showLabelsInPercent","totalValue","hideLabels","Math","abs","endAngle","startAngle","PI","base","perp","centroid","hyp","sqrt","labelRadius","max","angle","arcValue","value","text","x","y","textAnchor","dominantBaseline","aria-hidden","newProps","href","focusedArcId","uniqText","replace","opacity","cornerRadius","roundCorners","g","ref","path","d","focusRing","root","style","fill","color","cursor","onFocus","bind","data-is-focusable","onMouseOver","onMouseMove","onMouseLeave","tabIndex","onBlur","onClick","aria-label","role","arcLabel","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AACxC,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,UAAUC,QAAQ,QAAQ,YAAY;AAC/C,SAASC,0BAA0B,EAAEC,MAAM,QAAQ,2BAA2B;AAE9E,wGAAwG;AACxG;;;CAGC,GACD,OAAO,MAAMC,o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,CAAC,IAAI,EAAEjF,MAAMS,IAAI,CAAEA,IAAI;QACjD2E,aAAavE,SAASoE,IAAI,CAAC,IAAI,EAAEjF,MAAMS,IAAI,CAAEA,IAAI;QACjD4E,cAAcpE;QACdqE,UAAUzD,oBAAoB7B,MAAMS,IAAI,CAAEA,IAAI,CAACc,MAAM,IAAK,IAAIS;QAC9DuD,QAAQpE;QACRgD,SAASA;QACTqB,OAAO,GAAExF,cAAAA,MAAMS,IAAI,cAAVT,kCAAAA,YAAYS,IAAI,CAAC+E,OAAO;QACjCC,cAAYpE;QACZqE,MAAK;QAENxD,gBAAgB7B,QAAQsF,QAAQ;AAGvC,GACA;AACF7F,IAAI8F,WAAW,GAAG"}
1
+ {"version":3,"sources":["Arc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { useArcStyles } from './useArcStyles.styles';\nimport { ChartDataPoint } from '../index';\nimport { ArcProps } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatScientificLimitWidth, useRtl } from '../../../utilities/index';\n\n// Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Arc component within Donut Chart.\n * {@docCategory ArcDonutChart}\n */\nexport const Arc: React.FunctionComponent<ArcProps> = React.forwardRef<HTMLDivElement, ArcProps>(\n (props, forwardedRef) => {\n const arc = d3Arc();\n const currentRef = React.createRef<SVGPathElement>();\n const _isRTL: boolean = useRtl();\n const classes = useArcStyles(props);\n\n React.useEffect(() => {\n _updateChart(props);\n }, [props]);\n\n function _onFocus(data: ChartDataPoint, id: string, event: React.FocusEvent<SVGPathElement, Element>): void {\n props.onFocusCallback!(data, id, event, currentRef.current);\n }\n\n function _hoverOn(data: ChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n props.hoverOnCallback!(data, mouseEvent);\n }\n\n function _hoverOff(): void {\n props.hoverLeaveCallback!();\n }\n\n function _onBlur(): void {\n props.onBlurCallback!();\n }\n\n function _getAriaLabel(): string {\n const point = props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n }\n\n function _shouldHighlightArc(legend?: string): boolean {\n const { activeArc } = props;\n // If no activeArc is provided, highlight all arcs. Otherwise, only highlight the arcs that are active.\n return !activeArc || activeArc.length === 0 || legend === undefined || activeArc.includes(legend);\n }\n\n function _renderArcLabel(className: string) {\n const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid({ ...data!, innerRadius, outerRadius });\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== _isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatScientificLimitWidth(arcValue)}\n </text>\n );\n }\n\n function _updateChart(newProps: ArcProps): void {\n if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n }\n }\n\n const { href, focusedArcId } = props;\n //TO DO 'replace' is throwing error\n const id =\n props.uniqText! +\n (typeof props.data!.data.legend === 'string' ? props.data!.data.legend.replace(/\\s+/g, '') : '') +\n props.data!.data.data;\n const opacity: number = props.activeArc === props.data!.data.legend || props.activeArc === '' ? 1 : 0.1;\n const cornerRadius = props.roundCorners ? 3 : 0;\n return (\n <g ref={currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n // TODO innerradius and outerradius were absent\n <path\n id={id + 'focusRing'}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.focusRing}\n />\n )}\n <path\n // TODO innerradius and outerradius were absent\n id={id}\n d={\n arc.cornerRadius(cornerRadius)({\n ...props.data!,\n innerRadius: props.innerRadius,\n outerRadius: props.outerRadius,\n })!\n }\n className={classes.root}\n style={{ fill: props.color, cursor: href ? 'pointer' : 'default' }}\n onFocus={event => _onFocus(props.data!.data, id, event)}\n data-is-focusable={props.activeArc === props.data!.data.legend || props.activeArc === ''}\n onMouseOver={event => _hoverOn(props.data!.data, event)}\n onMouseMove={event => _hoverOn(props.data!.data, event)}\n onMouseLeave={_hoverOff}\n tabIndex={_shouldHighlightArc(props.data!.data.legend!) ? 0 : undefined}\n onBlur={_onBlur}\n opacity={opacity}\n onClick={props.data?.data.onClick}\n aria-label={_getAriaLabel()}\n role=\"img\"\n />\n {_renderArcLabel(classes.arcLabel)}\n </g>\n );\n },\n);\nArc.displayName = 'Arc';\n"],"names":["React","arc","d3Arc","useArcStyles","format","d3Format","formatScientificLimitWidth","useRtl","Arc","forwardRef","props","forwardedRef","currentRef","createRef","_isRTL","classes","useEffect","_updateChart","_onFocus","data","id","event","onFocusCallback","current","_hoverOn","mouseEvent","persist","hoverOnCallback","_hoverOff","hoverLeaveCallback","_onBlur","onBlurCallback","_getAriaLabel","point","legend","xAxisCalloutData","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_shouldHighlightArc","activeArc","length","undefined","includes","_renderArcLabel","className","innerRadius","outerRadius","showLabelsInPercent","totalValue","hideLabels","Math","abs","endAngle","startAngle","PI","base","perp","centroid","hyp","sqrt","labelRadius","max","angle","arcValue","value","text","x","y","textAnchor","dominantBaseline","aria-hidden","newProps","href","focusedArcId","uniqText","replace","opacity","cornerRadius","roundCorners","g","ref","path","d","focusRing","root","style","fill","color","cursor","onFocus","data-is-focusable","onMouseOver","onMouseMove","onMouseLeave","tabIndex","onBlur","onClick","aria-label","role","arcLabel","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,QAAQ,WAAW;AACxC,SAASC,YAAY,QAAQ,wBAAwB;AAGrD,SAASC,UAAUC,QAAQ,QAAQ,YAAY;AAC/C,SAASC,0BAA0B,EAAEC,MAAM,QAAQ,2BAA2B;AAE9E,wGAAwG;AACxG;;;CAGC,GACD,OAAO,MAAMC,oBAAyCR,MAAMS,UAAU,CACpE,CAACC,OAAOC;QA4HSD;IA3Hf,MAAMT,MAAMC;IACZ,MAAMU,2BAAaZ,MAAMa,SAAS;IAClC,MAAMC,SAAkBP;IACxB,MAAMQ,UAAUZ,aAAaO;IAE7BV,MAAMgB,SAAS,CAAC;QACdC,aAAaP;IACf,GAAG;QAACA;KAAM;IAEV,SAASQ,SAASC,IAAoB,EAAEC,EAAU,EAAEC,KAAgD;QAClGX,MAAMY,eAAe,CAAEH,MAAMC,IAAIC,OAAOT,WAAWW,OAAO;IAC5D;IAEA,SAASC,SAASL,IAAoB,EAAEM,UAA4C;QAClFA,WAAWC,OAAO;QAClBhB,MAAMiB,eAAe,CAAER,MAAMM;IAC/B;IAEA,SAASG;QACPlB,MAAMmB,kBAAkB;IAC1B;IAEA,SAASC;QACPpB,MAAMqB,cAAc;IACtB;IAEA,SAASC;YAIAC;QAHP,MAAMA,QAAQvB,MAAMS,IAAI,CAAEA,IAAI;QAC9B,MAAMe,SAASD,MAAME,gBAAgB,I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S,IAAI;YACb4B,aAAarC,MAAMqC,WAAW;YAC9BC,aAAatC,MAAMsC,WAAW;QAChC;QAEFF,WAAW/B,QAAQsE,SAAS;sBAGhC,oBAACF;QACC,+CAA+C;QAC/C/D,IAAIA;QACJgE,GACEnF,IAAI8E,YAAY,CAACA,cAAc;YAC7B,GAAGrE,MAAMS,IAAI;YACb4B,aAAarC,MAAMqC,WAAW;YAC9BC,aAAatC,MAAMsC,WAAW;QAChC;QAEFF,WAAW/B,QAAQuE,IAAI;QACvBC,OAAO;YAAEC,MAAM9E,MAAM+E,KAAK;YAAEC,QAAQhB,OAAO,YAAY;QAAU;QACjEiB,SAAStE,CAAAA,QAASH,SAASR,MAAMS,IAAI,CAAEA,IAAI,EAAEC,IAAIC;QACjDuE,qBAAmBlF,MAAM+B,SAAS,KAAK/B,MAAMS,IAAI,CAAEA,IAAI,CAACe,MAAM,IAAIxB,MAAM+B,SAAS,KAAK;QACtFoD,aAAaxE,CAAAA,QAASG,SAASd,MAAMS,IAAI,CAAEA,IAAI,EAAEE;QACjDyE,aAAazE,CAAAA,QAASG,SAASd,MAAMS,IAAI,CAAEA,IAAI,EAAEE;QACjD0E,cAAcnE;QACdoE,UAAUxD,oBAAoB9B,MAAMS,IAAI,CAAEA,IAAI,CAACe,MAAM,IAAK,IAAIS;QAC9DsD,QAAQnE;QACRgD,SAASA;QACToB,OAAO,GAAExF,cAAAA,MAAMS,IAAI,cAAVT,kCAAAA,YAAYS,IAAI,CAAC+E,OAAO;QACjCC,cAAYnE;QACZoE,MAAK;QAENvD,gBAAgB9B,QAAQsF,QAAQ;AAGvC,GACA;AACF7F,IAAI8F,WAAW,GAAG"}
@@ -99,7 +99,13 @@ const MIN_LEGEND_CONTAINER_HEIGHT = 40;
99
99
  });
100
100
  return legends;
101
101
  }
102
- function _focusCallback(data, id, element) {
102
+ function _focusCallback(data, id, e) {
103
+ let cx = 0;
104
+ let cy = 0;
105
+ const targetRect = e.target.getBoundingClientRect();
106
+ cx = targetRect.left + targetRect.width / 2;
107
+ cy = targetRect.top + targetRect.height / 2;
108
+ updatePosition(cx, cy);
103
109
  setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);
104
110
  setValue(data.data.toString());
105
111
  setLegend(data.legend);