@fluentui/react-charts 0.0.0-nightly-20251217-0407.1 → 0.0.0-nightly-20251218-0407.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.
- package/CHANGELOG.md +38 -13
- package/lib/components/ChartTable/ChartTable.js +6 -1
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +1 -0
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +6 -3
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +6 -3
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +6 -3
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -4
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +7 -6
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +6 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +5 -2
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +5 -2
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +5 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -4
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +7 -6
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CommonComponents/CartesianChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ModifiedCartesianChartProps } from '../../index';\nimport { useCartesianChartStyles } from './useCartesianChartStyles.styles';\nimport { select as d3Select } from 'd3-selection';\nimport {\n createNumericXAxis,\n createStringXAxis,\n IAxisData,\n createDateXAxis,\n IMargins,\n XAxisTypes,\n YAxisType,\n createWrapOfXLabels,\n rotateXAxisLabels,\n calculateLongestLabelWidth,\n createYAxisLabels,\n ChartTypes,\n wrapContent,\n useRtl,\n truncateString,\n tooltipOfAxislabels,\n getSecureProps,\n DEFAULT_WRAP_WIDTH,\n autoLayoutXAxisLabels,\n} from '../../utilities/index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { SVGTooltipText, SVGTooltipTextProps } from '../../utilities/SVGTooltipText';\nimport { ChartAnnotationLayer } from './Annotations/ChartAnnotationLayer';\nimport { ChartAnnotationContext } from './Annotations/ChartAnnotationLayer.types';\nimport { ChartPopover } from './ChartPopover';\nimport { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';\n\nconst HORIZONTAL_MARGIN_FOR_YAXIS_TITLE = 24;\nconst VERTICAL_MARGIN_FOR_XAXIS_TITLE = 20;\nconst AXIS_TITLE_PADDING = 8;\nconst DEFAULT_MARGIN_WITH_TICKS = 40;\nconst DEFAULT_MARGIN_NO_TICKS = 20;\n\n/**\n * Cartesian Chart component\n * {@docCategory CartesianChart}\n */\nexport const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps> = React.forwardRef<\n HTMLDivElement,\n ModifiedCartesianChartProps\n>(({ hideTickOverlap = true, ...props }, forwardedRef) => {\n const chartContainer = React.useRef<HTMLDivElement | null>(null);\n let legendContainer: HTMLDivElement;\n const minLegendContainerHeight: number = 40;\n const xAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElementSecondary = React.useRef<SVGSVGElement | null>(null);\n let margins: IMargins;\n const idForGraph: string = 'chart_';\n let _reqID: number | undefined;\n const _useRtl: boolean = useRtl();\n let _tickLabels: string[];\n const _isFirstRender = React.useRef<boolean>(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xScale: any;\n const isIntegralDataset = React.useMemo(() => {\n return !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n }, [props.points]);\n let _tooltipId: string = useId('tooltip_');\n /* Used for when WrapXAxisLabels props appeared.\n * To display the total word (space separated words), Need to have more space than usual.\n * This height will get total height need to disaply total word.\n * These value need to be removed from actual svg height/graph height.\n * Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.\n */\n let _removalValueForTextTuncate: number = 0;\n const _yAxisTickText = React.useRef<string[]>([]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>(0);\n const [containerHeight, setContainerHeight] = React.useState<number>(0);\n const [startFromX, setStartFromX] = React.useState<number>(0);\n const prevWidthRef = React.useRef<number | undefined>(undefined);\n const prevHeightRef = React.useRef<number | undefined>(undefined);\n\n const classes = useCartesianChartStyles(props);\n const focusAttributes = useFocusableGroup();\n const arrowAttributes = useArrowNavigationGroup({ axis: 'horizontal' });\n // ComponentdidMount and Componentwillunmount logic\n React.useEffect(() => {\n _fitParentContainer();\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n return () => {\n if (_reqID !== undefined) {\n cancelAnimationFrame(_reqID);\n }\n };\n }, [props]);\n\n // ComponentDidUpdate logic\n React.useEffect(() => {\n // Check if height or width changed\n if (\n prevWidthRef.current !== undefined &&\n prevHeightRef.current !== undefined &&\n (prevWidthRef.current !== props.width || prevHeightRef.current !== props.height)\n ) {\n _fitParentContainer();\n }\n // Update refs with current values\n prevWidthRef.current = props.width;\n prevHeightRef.current = props.height;\n\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n }, [props.width, props.height, props.chartType, props.showYAxisLables, props.yAxisType]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: chartContainer.current ?? null,\n }),\n [],\n );\n\n /**\n * Dedicated function to return the Callout JSX Element , which can further be used to only call this when\n * only the calloutprops and charthover props changes.\n * @param calloutProps\n * @param chartHoverProps\n * @returns\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _generateCallout(calloutProps: any): JSXElement {\n return <ChartPopover {...calloutProps} />;\n }\n\n function calculateMaxYAxisLabelLength(className: string): number {\n const formatTickLabel = (str: string) => {\n if (props.showYAxisLablesTooltip) {\n return truncateString(str, props.noOfCharsToTruncate || 4);\n }\n\n return str;\n };\n return calculateLongestLabelWidth(\n _yAxisTickText.current.map(label => formatTickLabel(label)),\n `.${className} text`,\n );\n }\n\n const {\n calloutProps,\n points,\n chartType,\n svgProps,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n } = props;\n if (props.parentRef) {\n _fitParentContainer();\n }\n\n margins = _calcMargins();\n // Callback for margins to the chart\n props.getmargins && props.getmargins(margins);\n\n let callout: JSXElement | null = null;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScalePrimary: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScaleSecondary: any;\n\n let children = null;\n if ((props.enableFirstRenderOptimization && chartContainer.current) || !props.enableFirstRenderOptimization) {\n _isFirstRender.current = false;\n const XAxisParams = {\n domainNRangeValues: props.getDomainNRangeValues(\n points,\n props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins,\n containerWidth,\n chartType,\n _useRtl,\n props.xAxisType,\n props.barwidth!,\n props.tickValues!,\n ),\n // FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.\n // Since the x-axis in HBWA is numeric, it typically doesn't require transformation.\n // However, if transformation props are enabled, the updated _removalValueForTextTuncate\n // will only be available in the next render, as it's set after the axis is created.\n // Solution: Delay the creation of gridlines until after the transformation has been applied,\n // or precompute the required height for transformed labels (_removalValueForTextTuncate).\n containerHeight: containerHeight - _removalValueForTextTuncate,\n margins: margins,\n xAxisElement: xAxisElement.current!,\n showRoundOffXTickValues: props.showRoundOffXTickValues ?? true,\n xAxisCount: props.xAxisTickCount,\n xAxistickSize: props.xAxistickSize,\n tickPadding: props.tickPadding || props.showXAxisLablesTooltip ? 5 : 10,\n xAxisPadding: props.xAxisPadding,\n xAxisInnerPadding: props.xAxisInnerPadding,\n xAxisOuterPadding: props.xAxisOuterPadding,\n containerWidth: containerWidth,\n hideTickOverlap: props.rotateXAxisLables || props.xAxis?.tickLayout === 'auto' ? false : hideTickOverlap,\n calcMaxLabelWidth: _calcMaxLabelWidthWithTransform,\n xMinValue: props.xMinValue,\n xMaxValue: props.xMaxValue,\n ...props.xAxis,\n };\n\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let xScale: any;\n let tickValues: number[] | Date[] | string[];\n let tickLabels: string[];\n switch (props.xAxisType!) {\n case XAxisTypes.NumericAxis:\n ({ xScale, tickValues, tickLabels } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n break;\n case XAxisTypes.DateAxis:\n ({ xScale, tickValues, tickLabels } = createDateXAxis(\n XAxisParams,\n props.tickParams!,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n props.useUTC,\n props.chartType,\n ));\n break;\n case XAxisTypes.StringAxis:\n ({ xScale, tickValues, tickLabels } = createStringXAxis(\n XAxisParams,\n props.tickParams!,\n props.datasetForXAxisDomain!,\n culture,\n _useRtl,\n ));\n break;\n default:\n ({ xScale, tickValues, tickLabels } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n }\n _xScale = xScale;\n _tickLabels = tickLabels;\n\n if (props.xAxis?.tickLayout === 'auto') {\n _removalValueForTextTuncate = autoLayoutXAxisLabels(\n tickValues,\n _tickLabels,\n _xScale,\n xAxisElement.current,\n containerWidth,\n chartContainer.current,\n );\n } else {\n _transformXAxisLabels();\n }\n\n const YAxisParams = {\n margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate,\n yAxisElement: yAxisElement.current!,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.yMinValue || 0,\n yMaxValue: props.yMaxValue || 0,\n tickPadding: 10,\n maxOfYVal: props.maxOfYVal,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),\n // please note these padding default values must be consistent in here\n // and the parent chart(HBWA/Vertical etc..) for more details refer example\n // http://using-d3js.com/04_07_ordinal_scales.html\n yAxisPadding: props.yAxisPadding || 0,\n tickValues: props.yAxisTickValues,\n ...props.yAxis,\n };\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n const axisData: IAxisData = { yAxisDomainValues: [], yAxisTickText: [] };\n if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {\n yScalePrimary = props.createStringYAxis(\n YAxisParams,\n props.stringDatasetForYAxisDomain!,\n _useRtl,\n axisData,\n props.barwidth,\n props.chartType,\n );\n } else {\n // TODO: Since the scale domain values are now computed independently for both the primary and\n // secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately\n // rendering the secondary y-axis. Therefore, rather than checking the secondaryYScaleOptions\n // prop to determine whether to create a secondary y-axis, it's more appropriate to check if any\n // data points are assigned to use the secondary y-scale.\n if (props?.secondaryYScaleOptions) {\n const YAxisParamsSecondary = {\n margins: margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate!,\n yAxisElement: yAxisElementSecondary.current,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.secondaryYScaleOptions?.yMinValue || 0,\n yMaxValue: props.secondaryYScaleOptions?.yMaxValue ?? 100,\n tickPadding: 10,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType, true),\n yAxisPadding: props.yAxisPadding,\n };\n\n yScaleSecondary = props.createYAxis(\n YAxisParamsSecondary,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n true,\n props.roundedTicks!,\n props.secondaryYScaleType,\n _useRtl,\n );\n }\n yScalePrimary = props.createYAxis(\n YAxisParams,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n false,\n props.roundedTicks!,\n props.yScaleType,\n _useRtl,\n );\n }\n _yAxisTickText.current = axisData.yAxisTickText;\n props.getAxisData && props.getAxisData(axisData);\n\n // Removing previously created tooltips.\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 // Used to display tooltip at x axis labels.\n if (props.showXAxisLablesTooltip || props.xAxis?.tickLayout === 'auto') {\n const _xAxisElement = xAxisElement.current ? d3Select(xAxisElement.current).call(xScale) : null;\n const tooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: _xAxisElement,\n container: chartContainer.current,\n };\n _xAxisElement && tooltipOfAxislabels(tooltipProps);\n }\n // Used to display tooltip at y axis labels.\n if (props.showYAxisLablesTooltip) {\n // To create y axis tick values by if specified truncating the rest of the text\n // and showing elipsis or showing the whole string,\n yScalePrimary &&\n createYAxisLabels(\n yAxisElement.current!,\n yScalePrimary,\n props.noOfCharsToTruncate || 4,\n props.showYAxisLablesTooltip || false,\n _useRtl,\n );\n\n const _yAxisElement = yAxisElement.current ? d3Select(yAxisElement.current).call(yScalePrimary) : null;\n const ytooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: _yAxisElement,\n container: chartContainer.current,\n };\n _yAxisElement && tooltipOfAxislabels(ytooltipProps);\n }\n\n // Call back to the chart.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _getData = (xScale: any, yScalePrimary: any, yScaleSecondary: any) => {\n props.getGraphData &&\n props.getGraphData(\n xScale,\n yScalePrimary,\n containerHeight - _removalValueForTextTuncate!,\n containerWidth,\n xAxisElement.current,\n yAxisElement.current,\n yScaleSecondary,\n );\n };\n\n // Callback function for chart, returns axis\n _getData(xScale, yScalePrimary, yScaleSecondary);\n\n children = props.children({\n xScale,\n yScalePrimary,\n yScaleSecondary,\n containerHeight,\n containerWidth,\n });\n\n if (!props.hideTooltip && calloutProps!.isPopoverOpen) {\n callout = _generateCallout(calloutProps);\n }\n }\n const svgDimensions = {\n width: containerWidth,\n height: containerHeight,\n };\n\n const plotWidth = Math.max(0, svgDimensions.width - margins.left! - margins.right!);\n const plotHeight = Math.max(0, svgDimensions.height - margins.top! - margins.bottom! - _removalValueForTextTuncate);\n\n const plotRect = {\n x: margins.left!,\n y: margins.top!,\n width: plotWidth,\n height: plotHeight,\n };\n\n const annotations = props.annotations ?? [];\n const hasAnnotations = annotations.length > 0;\n const annotationContext: ChartAnnotationContext | undefined = hasAnnotations\n ? {\n plotRect,\n svgRect: svgDimensions,\n isRtl: _useRtl,\n xScale: _xScale,\n yScalePrimary,\n yScaleSecondary,\n }\n : undefined;\n\n const xAxisTitleMaxWidth = svgDimensions.width - margins.left! - margins.right! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleMaxHeight =\n svgDimensions.height - margins.bottom! - margins.top! - _removalValueForTextTuncate! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleCenterY = margins.top! + AXIS_TITLE_PADDING + yAxisTitleMaxHeight / 2;\n const yAxisTitleCenterX = _useRtl\n ? svgDimensions.width - AXIS_TITLE_PADDING\n : HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING;\n const secondaryYAxisTitleCenterX = _useRtl\n ? HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING\n : svgDimensions.width - AXIS_TITLE_PADDING;\n\n const commonSvgToolTipProps: SVGTooltipTextProps = {\n wrapContent,\n showBackground: true,\n className: classes.svgTooltip,\n content: '',\n };\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer && getComputedStyle(legendContainer);\n legendContainerHeight =\n ((legendContainer && legendContainer.getBoundingClientRect().height) || minLegendContainerHeight) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || chartContainer.current) {\n const container = props.parentRef ? props.parentRef : chartContainer.current!;\n const currentContainerWidth =\n props.reflowProps?.mode === 'min-width' && !_isFirstRender.current\n ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth())\n : container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 350;\n const shouldResize =\n containerWidth !== currentContainerWidth || containerHeight !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setContainerWidth(currentContainerWidth);\n setContainerHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n function _onChartLeave(): void {\n props.onChartMouseLeave && props.onChartMouseLeave();\n }\n\n function _calculateChartMinWidth(): number {\n // Adding 10px for padding on both sides\n const labelWidth = _calcMaxLabelWidthWithTransform(_tickLabels) + 10;\n\n let minChartWidth = margins.left! + margins.right! + labelWidth * (_tickLabels.length - 1);\n\n if (\n [ChartTypes.GroupedVerticalBarChart, ChartTypes.VerticalBarChart, ChartTypes.VerticalStackedBarChart].includes(\n props.chartType,\n )\n ) {\n const minDomainMargin = 8;\n minChartWidth += minDomainMargin * 2;\n }\n\n return minChartWidth;\n }\n\n function _getChartDescription(): string {\n return (\n (props.chartTitle || 'Chart. ') +\n _getAxisTitle('X', props.xAxisTitle, props.xAxisType) +\n _getAxisTitle('Y', props.yAxisTitle, props.yAxisType || YAxisType.NumericAxis) +\n (props.secondaryYScaleOptions\n ? _getAxisTitle('secondary Y', props.secondaryYAxistitle, YAxisType.NumericAxis)\n : '')\n );\n }\n\n function _getAxisTitle(axisLabel: string, axisTitle: string | undefined, axisType: XAxisTypes | YAxisType): string {\n return (\n `The ${axisLabel} axis displays ` +\n (axisTitle ||\n (axisType === XAxisTypes.StringAxis || axisType === YAxisType.StringAxis\n ? 'categories'\n : axisType === XAxisTypes.DateAxis || axisType === YAxisType.DateAxis\n ? 'time'\n : 'values')) +\n '. '\n );\n }\n\n function _calcMaxLabelWidthWithTransform(x: (string | number)[]) {\n // Case: rotated labels\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));\n }\n\n // Case: truncated labels\n if (props.showXAxisLablesTooltip) {\n const tickLabels = x.map(val => {\n const numChars = props.noOfCharsToTruncate || 4;\n return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;\n });\n\n const longestLabelWidth = calculateLongestLabelWidth(tickLabels, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n // Case: wrapped labels\n if (props.wrapXAxisLables) {\n // FIXME: Calculate the max width of lines instead of words. This requires applying\n // the wrapping transformation earlier to obtain the actual rendered lines.\n const words: string[] = [];\n x.forEach((val: string) => {\n words.push(...val.toString().split(/\\s+/));\n });\n\n // This approach works well in most cases, since overflow typically occurs only when\n // a single word exceeds the specified width — otherwise, the text will wrap as expected.\n const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);\n return Math.max(Math.ceil(longestLabelWidth), DEFAULT_WRAP_WIDTH);\n }\n\n // Default case\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n function _transformXAxisLabels() {\n _removalValueForTextTuncate = 0;\n\n /*\n * To enable wrapping of x axis tick values or to display complete x axis tick values,\n * we need to calculate how much space it needed to render the text.\n * No need to re-calculate every time the chart renders and same time need to get an update. So using setState.\n * Required space will be calculated first time chart rendering and if any width/height of chart updated.\n * */\n if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {\n let maxXAxisLabelWidth: number | undefined;\n if (props.xAxisType === XAxisTypes.StringAxis) {\n if ((props.datasetForXAxisDomain?.length || 0) > 1) {\n maxXAxisLabelWidth = _xScale.step();\n } else {\n maxXAxisLabelWidth = containerWidth;\n }\n }\n\n const wrapLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,\n noOfCharsToTruncate: props.noOfCharsToTruncate || 4,\n width: maxXAxisLabelWidth,\n container: chartContainer.current,\n };\n _removalValueForTextTuncate = createWrapOfXLabels(wrapLabelProps) ?? 0;\n }\n\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const rotateLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n };\n const rotatedHeight = rotateXAxisLabels(rotateLabelProps) ?? 0;\n // margins.bottom is used as padding here\n _removalValueForTextTuncate = rotatedHeight + margins.bottom!;\n }\n }\n\n function _calcMargins(): IMargins {\n let _margins = _getDefaultMargins();\n\n _margins = _applyTitleMargins(_margins);\n _margins = _applyAnnotationMargins(_margins);\n\n if (_useRtl) {\n _margins = _swapRtlMargins(_margins);\n }\n\n return {\n ..._margins,\n ...props.margins,\n };\n }\n\n function _getDefaultMargins(): IMargins {\n return {\n top: DEFAULT_MARGIN_NO_TICKS,\n // Smaller than the default because it is based on the line height rather than\n // the length of the tick labels.\n bottom: DEFAULT_MARGIN_WITH_TICKS - 5,\n // For the actual margin, add the tick size, tick padding, and some extra space to\n // the width of the longest yaxis tick label (startFromX).\n left: Math.max(DEFAULT_MARGIN_WITH_TICKS, startFromX + 20),\n right: props.secondaryYScaleOptions ? DEFAULT_MARGIN_WITH_TICKS : DEFAULT_MARGIN_NO_TICKS,\n };\n }\n\n function _applyTitleMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {\n updated.bottom! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {\n updated.left! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n if (props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '') {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _applyAnnotationMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {\n updated.top! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (\n props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')\n ) {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _swapRtlMargins(_margins: IMargins): IMargins {\n return {\n ..._margins,\n left: _margins.right,\n right: _margins.left,\n };\n }\n\n /**\n * We have use the {@link defaultTabbableElement } to fix\n * the Focus not landing on chart while tabbing, instead goes to legend.\n * This issue is observed in Area, line chart after performance optimization done in the PR {@link https://github.com/microsoft/fluentui/pull/27721 }\n * This issue is observed in Bar charts after the changes done by FocusZone team in the PR: {@link https://github.com/microsoft/fluentui/pull/24175 }\n * The issue in Bar Charts(VB and VSB) is due to a {@link FocusZone } update where previously an event listener was\n * attached on keydown to the window, so that whenever the tab key is pressed all outer FocusZone's\n * tab-indexes are updated (an outer FocusZone is a FocusZone that is not within another one).\n * But now after the above PR : they are attaching the\n * listeners to the FocusZone elements instead of the window. So in the first render cycle in Bar charts\n * bars are not created as in the first render cycle the size of the chart container is not known( or is 0)\n * which creates bars of height 0 so instead we do not create any bars and instead return empty fragments.\n *\n * We have tried 2 Approaches to fix the issue:\n * 1. Using the {@link elementRef} property of FocusZone where we dispatch event for tab keydown\n * after the second render cycle which triggers an update of the tab index in FocusZone.\n * But this is a hacky solution and not a proper fix and also elementRef is deprecated.\n * 2. Using the default tabbable element to fix the issue.\n */\n\n return (\n <div\n id={idForGraph}\n className={classes.root}\n role={'presentation'}\n ref={(rootElem: HTMLDivElement) => {\n chartContainer.current = rootElem;\n }}\n onMouseLeave={_onChartLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes} {...arrowAttributes}>\n {_isFirstRender.current}\n <svg\n width={svgDimensions.width}\n height={svgDimensions.height}\n role=\"region\"\n aria-label={_getChartDescription()}\n style={{ display: 'block' }}\n className={classes.chart}\n {...getSecureProps(svgProps)}\n >\n <g\n ref={(e: SVGSVGElement | null) => {\n xAxisElement.current = e!;\n }}\n id={`xAxisGElement${idForGraph}`}\n // To add wrap of x axis lables feature, need to remove word height from svg height.\n transform={`translate(0, ${svgDimensions.height - margins.bottom! - _removalValueForTextTuncate!})`}\n className={classes.xAxis}\n />\n {props.xAxisTitle !== undefined && props.xAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisTitle}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: svgDimensions.height - AXIS_TITLE_PADDING,\n className: classes.axisTitle!,\n textAnchor: 'middle',\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n {props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisAnnotation}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING,\n className: classes.axisAnnotation!,\n textAnchor: 'middle',\n 'aria-hidden': true,\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElement.current = e!;\n }}\n id={`yAxisGElement${idForGraph}`}\n transform={`translate(${_useRtl ? svgDimensions.width - margins.right! : margins.left!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYScaleOptions && (\n <g>\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElementSecondary.current = e!;\n }}\n id={`yAxisGElementSecondary${idForGraph}`}\n transform={`translate(${_useRtl ? margins.left! : svgDimensions.width - margins.right!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.secondaryYAxistitle}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </g>\n )}\n {children}\n {props.yAxisTitle !== undefined && props.yAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisTitle}\n textProps={{\n x: yAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${yAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n {props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisAnnotation}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisAnnotation!,\n 'aria-hidden': true,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </svg>\n {hasAnnotations && annotationContext && (\n <ChartAnnotationLayer\n annotations={annotations}\n context={annotationContext}\n className={classes.annotationLayer}\n />\n )}\n </div>\n\n {!props.hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer = e;\n }}\n className={classes.legendContainer}\n >\n {props.legendBars}\n </div>\n )}\n {/** The callout is used for narration, so keep it mounted on the DOM */}\n {callout && <React.Suspense fallback={<div>Loading...</div>}>{callout}</React.Suspense>}\n </div>\n );\n});\nCartesianChart.displayName = 'CartesianChart';\n"],"names":["React","useCartesianChartStyles","select","d3Select","createNumericXAxis","createStringXAxis","createDateXAxis","XAxisTypes","YAxisType","createWrapOfXLabels","rotateXAxisLabels","calculateLongestLabelWidth","createYAxisLabels","ChartTypes","wrapContent","useRtl","truncateString","tooltipOfAxislabels","getSecureProps","DEFAULT_WRAP_WIDTH","autoLayoutXAxisLabels","useId","SVGTooltipText","ChartAnnotationLayer","ChartPopover","useFocusableGroup","useArrowNavigationGroup","HORIZONTAL_MARGIN_FOR_YAXIS_TITLE","VERTICAL_MARGIN_FOR_XAXIS_TITLE","AXIS_TITLE_PADDING","DEFAULT_MARGIN_WITH_TICKS","DEFAULT_MARGIN_NO_TICKS","CartesianChart","forwardRef","hideTickOverlap","props","forwardedRef","chartContainer","useRef","legendContainer","minLegendContainerHeight","xAxisElement","yAxisElement","yAxisElementSecondary","margins","idForGraph","_reqID","_useRtl","_tickLabels","_isFirstRender","_xScale","isIntegralDataset","useMemo","points","some","point","y","_tooltipId","_removalValueForTextTuncate","_yAxisTickText","containerWidth","setContainerWidth","useState","containerHeight","setContainerHeight","startFromX","setStartFromX","prevWidthRef","undefined","prevHeightRef","classes","focusAttributes","arrowAttributes","axis","useEffect","_fitParentContainer","showYAxisLables","maxYAxisLabelLength","calculateMaxYAxisLabelLength","yAxis","cancelAnimationFrame","current","width","height","chartType","yAxisType","useImperativeHandle","componentRef","_generateCallout","calloutProps","className","formatTickLabel","str","showYAxisLablesTooltip","noOfCharsToTruncate","map","label","svgProps","culture","dateLocalizeOptions","timeFormatLocale","customDateTimeFormatter","parentRef","_calcMargins","getmargins","callout","yScalePrimary","yScaleSecondary","children","enableFirstRenderOptimization","XAxisParams","domainNRangeValues","getDomainNRangeValues","getDomainMargins","xAxisType","barwidth","tickValues","showRoundOffXTickValues","xAxisCount","xAxisTickCount","xAxistickSize","tickPadding","showXAxisLablesTooltip","xAxisPadding","xAxisInnerPadding","xAxisOuterPadding","rotateXAxisLables","xAxis","tickLayout","calcMaxLabelWidth","_calcMaxLabelWidthWithTransform","xMinValue","xMaxValue","xScale","tickLabels","NumericAxis","tickParams","xScaleType","DateAxis","useUTC","StringAxis","datasetForXAxisDomain","_transformXAxisLabels","YAxisParams","getYDomainMargins","yAxisTickFormat","yAxisTickCount","yMinValue","yMaxValue","maxOfYVal","yMinMaxValues","getMinMaxOfYAxis","yAxisPadding","yAxisTickValues","axisData","yAxisDomainValues","yAxisTickText","createStringYAxis","stringDatasetForYAxisDomain","secondaryYScaleOptions","YAxisParamsSecondary","createYAxis","roundedTicks","secondaryYScaleType","yScaleType","getAxisData","document","getElementById","remove","e","_xAxisElement","call","tooltipProps","tooltipCls","tooltip","id","container","_yAxisElement","ytooltipProps","_getData","getGraphData","hideTooltip","isPopoverOpen","svgDimensions","plotWidth","Math","max","left","right","plotHeight","top","bottom","plotRect","x","annotations","hasAnnotations","length","annotationContext","svgRect","isRtl","xAxisTitleMaxWidth","yAxisTitleMaxHeight","yAxisTitleCenterY","yAxisTitleCenterX","secondaryYAxisTitleCenterX","commonSvgToolTipProps","showBackground","svgTooltip","content","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","currentContainerWidth","reflowProps","mode","_calculateChartMinWidth","currentContainerHeight","shouldResize","_onChartLeave","onChartMouseLeave","labelWidth","minChartWidth","GroupedVerticalBarChart","VerticalBarChart","VerticalStackedBarChart","includes","minDomainMargin","_getChartDescription","chartTitle","_getAxisTitle","xAxisTitle","yAxisTitle","secondaryYAxistitle","axisLabel","axisTitle","axisType","wrapXAxisLables","longestLabelWidth","ceil","cos","PI","val","numChars","toString","slice","words","forEach","push","split","maxXAxisLabelWidth","step","wrapLabelProps","node","rotateLabelProps","rotatedHeight","_margins","_getDefaultMargins","_applyTitleMargins","_applyAnnotationMargins","_swapRtlMargins","updated","xAxisAnnotation","yAxisAnnotation","div","root","role","ref","rootElem","onMouseLeave","chartWrapper","svg","aria-label","style","display","chart","g","transform","textProps","textAnchor","maxWidth","axisAnnotation","context","annotationLayer","legendBars","Suspense","fallback","displayName"],"mappings":"AAAA;;;;;+BA8CagC;;;;;;;iEA5CU,QAAQ;+CAGS,mCAAmC;6BACxC,eAAe;uBAqB3C,wBAAwB;gCACT,4BAA4B;gCAEE,iCAAiC;sCAChD,qCAAqC;8BAE7C,iBAAiB;8BACa,0BAA0B;AAErF,MAAML,oCAAoC;AAC1C,MAAMC,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AAA,MAAM0M,mBAAmB,KAAKzK,aAAajC,MAAM0M,mBAAmB,KAAK,EAAA,CAAC,IAAA,WAAA,GACzE,OAAA,aAAA,CAACvN,8BAAAA,EAAAA;QACE,GAAGuL,qBAAqB;QACzBG,SAAS7K,MAAMwO,eAAe;QAC9Be,WAAW;YACTzF,GAAGW;YACHpJ,GAAGkJ;YACHiF,YAAY;YACZF,WAAW,CAAC,YAAY,EAAE7E,2BAA2B,EAAE,EAAEF,kBAAkB,CAAC,CAAC;YAC7EhH,WAAWpB,QAAQuN,cAAc;YACjC,eAAe;QACjB;QACAD,UAAUnF;SAIjBN,kBAAkBE,qBAAAA,WAAAA,GACjB,OAAA,aAAA,CAAC9K,0CAAAA,EAAAA;QACC2K,aAAaA;QACb4F,SAASzF;QACT3G,WAAWpB,QAAQyN,eAAe;SAKvC,CAAC5P,MAAM+K,UAAU,IAAA,WAAA,GAChB,OAAA,aAAA,CAAC0D,OAAAA;QACCG,KAAK,CAACtG;YACJlI,kBAAkBkI;QACpB;QACA/E,WAAWpB,QAAQ/B,eAAe;OAEjCJ,MAAM6P,UAAU,GAIpBvL,WAAAA,WAAAA,GAAW,OAAA,aAAA,CAACzG,OAAMiS,QAAQ,EAAA;QAACC,UAAAA,WAAAA,GAAU,OAAA,aAAA,CAACtB,OAAAA,MAAI;OAAmBnK;AAGpE,GAAG;AACHzE,eAAemQ,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CommonComponents/CartesianChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { ModifiedCartesianChartProps } from '../../index';\nimport { useCartesianChartStyles } from './useCartesianChartStyles.styles';\nimport { select as d3Select } from 'd3-selection';\nimport {\n createNumericXAxis,\n createStringXAxis,\n IAxisData,\n createDateXAxis,\n IMargins,\n XAxisTypes,\n YAxisType,\n createWrapOfXLabels,\n rotateXAxisLabels,\n calculateLongestLabelWidth,\n createYAxisLabels,\n ChartTypes,\n wrapContent,\n useRtl,\n truncateString,\n tooltipOfAxislabels,\n getSecureProps,\n DEFAULT_WRAP_WIDTH,\n autoLayoutXAxisLabels,\n} from '../../utilities/index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { SVGTooltipText, SVGTooltipTextProps } from '../../utilities/SVGTooltipText';\nimport { ChartAnnotationLayer } from './Annotations/ChartAnnotationLayer';\nimport { ChartAnnotationContext } from './Annotations/ChartAnnotationLayer.types';\nimport { ChartPopover } from './ChartPopover';\nimport { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';\n\nconst HORIZONTAL_MARGIN_FOR_YAXIS_TITLE = 24;\nconst VERTICAL_MARGIN_FOR_XAXIS_TITLE = 20;\nconst AXIS_TITLE_PADDING = 8;\nconst DEFAULT_MARGIN_WITH_TICKS = 40;\nconst DEFAULT_MARGIN_NO_TICKS = 20;\n\n/**\n * Cartesian Chart component\n * {@docCategory CartesianChart}\n */\nexport const CartesianChart: React.FunctionComponent<ModifiedCartesianChartProps> = React.forwardRef<\n HTMLDivElement,\n ModifiedCartesianChartProps\n>(({ hideTickOverlap = true, ...props }, forwardedRef) => {\n const chartContainer = React.useRef<HTMLDivElement | null>(null);\n let legendContainer: HTMLDivElement;\n const minLegendContainerHeight: number = 40;\n const xAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElement = React.useRef<SVGSVGElement | null>(null);\n const yAxisElementSecondary = React.useRef<SVGSVGElement | null>(null);\n let margins: IMargins;\n const idForGraph: string = 'chart_';\n let _reqID: number | undefined;\n const _useRtl: boolean = useRtl();\n let _tickLabels: string[];\n const _isFirstRender = React.useRef<boolean>(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xScale: any;\n const isIntegralDataset = React.useMemo(() => {\n return !props.points.some((point: { y: number }) => point.y % 1 !== 0);\n }, [props.points]);\n let _tooltipId: string = useId('tooltip_');\n /* Used for when WrapXAxisLabels props appeared.\n * To display the total word (space separated words), Need to have more space than usual.\n * This height will get total height need to disaply total word.\n * These value need to be removed from actual svg height/graph height.\n * Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.\n */\n let _removalValueForTextTuncate: number = 0;\n const _yAxisTickText = React.useRef<string[]>([]);\n\n const [containerWidth, setContainerWidth] = React.useState<number>(0);\n const [containerHeight, setContainerHeight] = React.useState<number>(0);\n const [startFromX, setStartFromX] = React.useState<number>(0);\n const prevWidthRef = React.useRef<number | undefined>(undefined);\n const prevHeightRef = React.useRef<number | undefined>(undefined);\n\n const classes = useCartesianChartStyles(props);\n const focusAttributes = useFocusableGroup();\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n // ComponentdidMount and Componentwillunmount logic\n React.useEffect(() => {\n _fitParentContainer();\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n return () => {\n if (_reqID !== undefined) {\n cancelAnimationFrame(_reqID);\n }\n };\n }, [props]);\n\n // ComponentDidUpdate logic\n React.useEffect(() => {\n // Check if height or width changed\n if (\n prevWidthRef.current !== undefined &&\n prevHeightRef.current !== undefined &&\n (prevWidthRef.current !== props.width || prevHeightRef.current !== props.height)\n ) {\n _fitParentContainer();\n }\n // Update refs with current values\n prevWidthRef.current = props.width;\n prevHeightRef.current = props.height;\n\n if (props.showYAxisLables) {\n const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis!);\n if (startFromX !== maxYAxisLabelLength) {\n setStartFromX(maxYAxisLabelLength);\n }\n } else if (startFromX !== 0) {\n setStartFromX(0);\n }\n }, [props.width, props.height, props.chartType, props.showYAxisLables, props.yAxisType]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: chartContainer.current ?? null,\n }),\n [],\n );\n\n /**\n * Dedicated function to return the Callout JSX Element , which can further be used to only call this when\n * only the calloutprops and charthover props changes.\n * @param calloutProps\n * @param chartHoverProps\n * @returns\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _generateCallout(calloutProps: any): JSXElement {\n return <ChartPopover {...calloutProps} />;\n }\n\n function calculateMaxYAxisLabelLength(className: string): number {\n const formatTickLabel = (str: string) => {\n if (props.showYAxisLablesTooltip) {\n return truncateString(str, props.noOfCharsToTruncate || 4);\n }\n\n return str;\n };\n return calculateLongestLabelWidth(\n _yAxisTickText.current.map(label => formatTickLabel(label)),\n `.${className} text`,\n );\n }\n\n const {\n calloutProps,\n points,\n chartType,\n svgProps,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n } = props;\n if (props.parentRef) {\n _fitParentContainer();\n }\n\n margins = _calcMargins();\n // Callback for margins to the chart\n props.getmargins && props.getmargins(margins);\n\n let callout: JSXElement | null = null;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScalePrimary: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let yScaleSecondary: any;\n\n let children = null;\n if ((props.enableFirstRenderOptimization && chartContainer.current) || !props.enableFirstRenderOptimization) {\n _isFirstRender.current = false;\n const XAxisParams = {\n domainNRangeValues: props.getDomainNRangeValues(\n points,\n props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins,\n containerWidth,\n chartType,\n _useRtl,\n props.xAxisType,\n props.barwidth!,\n props.tickValues!,\n ),\n // FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.\n // Since the x-axis in HBWA is numeric, it typically doesn't require transformation.\n // However, if transformation props are enabled, the updated _removalValueForTextTuncate\n // will only be available in the next render, as it's set after the axis is created.\n // Solution: Delay the creation of gridlines until after the transformation has been applied,\n // or precompute the required height for transformed labels (_removalValueForTextTuncate).\n containerHeight: containerHeight - _removalValueForTextTuncate,\n margins: margins,\n xAxisElement: xAxisElement.current!,\n showRoundOffXTickValues: props.showRoundOffXTickValues ?? true,\n xAxisCount: props.xAxisTickCount,\n xAxistickSize: props.xAxistickSize,\n tickPadding: props.tickPadding || props.showXAxisLablesTooltip ? 5 : 10,\n xAxisPadding: props.xAxisPadding,\n xAxisInnerPadding: props.xAxisInnerPadding,\n xAxisOuterPadding: props.xAxisOuterPadding,\n containerWidth: containerWidth,\n hideTickOverlap: props.rotateXAxisLables || props.xAxis?.tickLayout === 'auto' ? false : hideTickOverlap,\n calcMaxLabelWidth: _calcMaxLabelWidthWithTransform,\n xMinValue: props.xMinValue,\n xMaxValue: props.xMaxValue,\n ...props.xAxis,\n };\n\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let xScale: any;\n let tickValues: number[] | Date[] | string[];\n let tickLabels: string[];\n switch (props.xAxisType!) {\n case XAxisTypes.NumericAxis:\n ({ xScale, tickValues, tickLabels } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n break;\n case XAxisTypes.DateAxis:\n ({ xScale, tickValues, tickLabels } = createDateXAxis(\n XAxisParams,\n props.tickParams!,\n culture,\n dateLocalizeOptions,\n timeFormatLocale,\n customDateTimeFormatter,\n props.useUTC,\n props.chartType,\n ));\n break;\n case XAxisTypes.StringAxis:\n ({ xScale, tickValues, tickLabels } = createStringXAxis(\n XAxisParams,\n props.tickParams!,\n props.datasetForXAxisDomain!,\n culture,\n _useRtl,\n ));\n break;\n default:\n ({ xScale, tickValues, tickLabels } = createNumericXAxis(\n XAxisParams,\n props.tickParams!,\n props.chartType,\n culture,\n props.xScaleType,\n _useRtl,\n ));\n }\n _xScale = xScale;\n _tickLabels = tickLabels;\n\n if (props.xAxis?.tickLayout === 'auto') {\n _removalValueForTextTuncate = autoLayoutXAxisLabels(\n tickValues,\n _tickLabels,\n _xScale,\n xAxisElement.current,\n containerWidth,\n chartContainer.current,\n );\n } else {\n _transformXAxisLabels();\n }\n\n const YAxisParams = {\n margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate,\n yAxisElement: yAxisElement.current!,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.yMinValue || 0,\n yMaxValue: props.yMaxValue || 0,\n tickPadding: 10,\n maxOfYVal: props.maxOfYVal,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),\n // please note these padding default values must be consistent in here\n // and the parent chart(HBWA/Vertical etc..) for more details refer example\n // http://using-d3js.com/04_07_ordinal_scales.html\n yAxisPadding: props.yAxisPadding || 0,\n tickValues: props.yAxisTickValues,\n ...props.yAxis,\n };\n /**\n * These scales used for 2 purposes.\n * 1. To create x and y axis\n * 2. To draw the graph.\n * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.\n */\n const axisData: IAxisData = { yAxisDomainValues: [], yAxisTickText: [] };\n if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {\n yScalePrimary = props.createStringYAxis(\n YAxisParams,\n props.stringDatasetForYAxisDomain!,\n _useRtl,\n axisData,\n props.barwidth,\n props.chartType,\n );\n } else {\n // TODO: Since the scale domain values are now computed independently for both the primary and\n // secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately\n // rendering the secondary y-axis. Therefore, rather than checking the secondaryYScaleOptions\n // prop to determine whether to create a secondary y-axis, it's more appropriate to check if any\n // data points are assigned to use the secondary y-scale.\n if (props?.secondaryYScaleOptions) {\n const YAxisParamsSecondary = {\n margins: margins,\n containerWidth: containerWidth,\n containerHeight: containerHeight - _removalValueForTextTuncate!,\n yAxisElement: yAxisElementSecondary.current,\n yAxisTickFormat: props.yAxisTickFormat!,\n yAxisTickCount: props.yAxisTickCount!,\n yMinValue: props.secondaryYScaleOptions?.yMinValue || 0,\n yMaxValue: props.secondaryYScaleOptions?.yMaxValue ?? 100,\n tickPadding: 10,\n yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType, true),\n yAxisPadding: props.yAxisPadding,\n };\n\n yScaleSecondary = props.createYAxis(\n YAxisParamsSecondary,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n true,\n props.roundedTicks!,\n props.secondaryYScaleType,\n _useRtl,\n );\n }\n yScalePrimary = props.createYAxis(\n YAxisParams,\n _useRtl,\n axisData,\n isIntegralDataset,\n chartType,\n false,\n props.roundedTicks!,\n props.yScaleType,\n _useRtl,\n );\n }\n _yAxisTickText.current = axisData.yAxisTickText;\n props.getAxisData && props.getAxisData(axisData);\n\n // Removing previously created tooltips.\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 // Used to display tooltip at x axis labels.\n if (props.showXAxisLablesTooltip || props.xAxis?.tickLayout === 'auto') {\n const _xAxisElement = xAxisElement.current ? d3Select(xAxisElement.current).call(xScale) : null;\n const tooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: _xAxisElement,\n container: chartContainer.current,\n };\n _xAxisElement && tooltipOfAxislabels(tooltipProps);\n }\n // Used to display tooltip at y axis labels.\n if (props.showYAxisLablesTooltip) {\n // To create y axis tick values by if specified truncating the rest of the text\n // and showing elipsis or showing the whole string,\n yScalePrimary &&\n createYAxisLabels(\n yAxisElement.current!,\n yScalePrimary,\n props.noOfCharsToTruncate || 4,\n props.showYAxisLablesTooltip || false,\n _useRtl,\n );\n\n const _yAxisElement = yAxisElement.current ? d3Select(yAxisElement.current).call(yScalePrimary) : null;\n const ytooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: _yAxisElement,\n container: chartContainer.current,\n };\n _yAxisElement && tooltipOfAxislabels(ytooltipProps);\n }\n\n // Call back to the chart.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _getData = (xScale: any, yScalePrimary: any, yScaleSecondary: any) => {\n props.getGraphData &&\n props.getGraphData(\n xScale,\n yScalePrimary,\n containerHeight - _removalValueForTextTuncate!,\n containerWidth,\n xAxisElement.current,\n yAxisElement.current,\n yScaleSecondary,\n );\n };\n\n // Callback function for chart, returns axis\n _getData(xScale, yScalePrimary, yScaleSecondary);\n\n children = props.children({\n xScale,\n yScalePrimary,\n yScaleSecondary,\n containerHeight,\n containerWidth,\n });\n\n if (!props.hideTooltip && calloutProps!.isPopoverOpen) {\n callout = _generateCallout(calloutProps);\n }\n }\n const svgDimensions = {\n width: containerWidth,\n height: containerHeight,\n };\n\n const plotWidth = Math.max(0, svgDimensions.width - margins.left! - margins.right!);\n const plotHeight = Math.max(0, svgDimensions.height - margins.top! - margins.bottom! - _removalValueForTextTuncate);\n\n const plotRect = {\n x: margins.left!,\n y: margins.top!,\n width: plotWidth,\n height: plotHeight,\n };\n\n const annotations = props.annotations ?? [];\n const hasAnnotations = annotations.length > 0;\n const annotationContext: ChartAnnotationContext | undefined = hasAnnotations\n ? {\n plotRect,\n svgRect: svgDimensions,\n isRtl: _useRtl,\n xScale: _xScale,\n yScalePrimary,\n yScaleSecondary,\n }\n : undefined;\n\n const xAxisTitleMaxWidth = svgDimensions.width - margins.left! - margins.right! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleMaxHeight =\n svgDimensions.height - margins.bottom! - margins.top! - _removalValueForTextTuncate! - AXIS_TITLE_PADDING * 2;\n const yAxisTitleCenterY = margins.top! + AXIS_TITLE_PADDING + yAxisTitleMaxHeight / 2;\n const yAxisTitleCenterX = _useRtl\n ? svgDimensions.width - AXIS_TITLE_PADDING\n : HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING;\n const secondaryYAxisTitleCenterX = _useRtl\n ? HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING\n : svgDimensions.width - AXIS_TITLE_PADDING;\n\n const commonSvgToolTipProps: SVGTooltipTextProps = {\n wrapContent,\n showBackground: true,\n className: classes.svgTooltip,\n content: '',\n };\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer && getComputedStyle(legendContainer);\n legendContainerHeight =\n ((legendContainer && legendContainer.getBoundingClientRect().height) || minLegendContainerHeight) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || chartContainer.current) {\n const container = props.parentRef ? props.parentRef : chartContainer.current!;\n const currentContainerWidth =\n props.reflowProps?.mode === 'min-width' && !_isFirstRender.current\n ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth())\n : container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 350;\n const shouldResize =\n containerWidth !== currentContainerWidth || containerHeight !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setContainerWidth(currentContainerWidth);\n setContainerHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n function _onChartLeave(): void {\n props.onChartMouseLeave && props.onChartMouseLeave();\n }\n\n function _calculateChartMinWidth(): number {\n // Adding 10px for padding on both sides\n const labelWidth = _calcMaxLabelWidthWithTransform(_tickLabels) + 10;\n\n let minChartWidth = margins.left! + margins.right! + labelWidth * (_tickLabels.length - 1);\n\n if (\n [ChartTypes.GroupedVerticalBarChart, ChartTypes.VerticalBarChart, ChartTypes.VerticalStackedBarChart].includes(\n props.chartType,\n )\n ) {\n const minDomainMargin = 8;\n minChartWidth += minDomainMargin * 2;\n }\n\n return minChartWidth;\n }\n\n function _getChartDescription(): string {\n return (\n (props.chartTitle || 'Chart. ') +\n _getAxisTitle('X', props.xAxisTitle, props.xAxisType) +\n _getAxisTitle('Y', props.yAxisTitle, props.yAxisType || YAxisType.NumericAxis) +\n (props.secondaryYScaleOptions\n ? _getAxisTitle('secondary Y', props.secondaryYAxistitle, YAxisType.NumericAxis)\n : '')\n );\n }\n\n function _getAxisTitle(axisLabel: string, axisTitle: string | undefined, axisType: XAxisTypes | YAxisType): string {\n return (\n `The ${axisLabel} axis displays ` +\n (axisTitle ||\n (axisType === XAxisTypes.StringAxis || axisType === YAxisType.StringAxis\n ? 'categories'\n : axisType === XAxisTypes.DateAxis || axisType === YAxisType.DateAxis\n ? 'time'\n : 'values')) +\n '. '\n );\n }\n\n function _calcMaxLabelWidthWithTransform(x: (string | number)[]) {\n // Case: rotated labels\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));\n }\n\n // Case: truncated labels\n if (props.showXAxisLablesTooltip) {\n const tickLabels = x.map(val => {\n const numChars = props.noOfCharsToTruncate || 4;\n return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;\n });\n\n const longestLabelWidth = calculateLongestLabelWidth(tickLabels, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n // Case: wrapped labels\n if (props.wrapXAxisLables) {\n // FIXME: Calculate the max width of lines instead of words. This requires applying\n // the wrapping transformation earlier to obtain the actual rendered lines.\n const words: string[] = [];\n x.forEach((val: string) => {\n words.push(...val.toString().split(/\\s+/));\n });\n\n // This approach works well in most cases, since overflow typically occurs only when\n // a single word exceeds the specified width — otherwise, the text will wrap as expected.\n const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);\n return Math.max(Math.ceil(longestLabelWidth), DEFAULT_WRAP_WIDTH);\n }\n\n // Default case\n const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);\n return Math.ceil(longestLabelWidth);\n }\n\n function _transformXAxisLabels() {\n _removalValueForTextTuncate = 0;\n\n /*\n * To enable wrapping of x axis tick values or to display complete x axis tick values,\n * we need to calculate how much space it needed to render the text.\n * No need to re-calculate every time the chart renders and same time need to get an update. So using setState.\n * Required space will be calculated first time chart rendering and if any width/height of chart updated.\n * */\n if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {\n let maxXAxisLabelWidth: number | undefined;\n if (props.xAxisType === XAxisTypes.StringAxis) {\n if ((props.datasetForXAxisDomain?.length || 0) > 1) {\n maxXAxisLabelWidth = _xScale.step();\n } else {\n maxXAxisLabelWidth = containerWidth;\n }\n }\n\n const wrapLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,\n noOfCharsToTruncate: props.noOfCharsToTruncate || 4,\n width: maxXAxisLabelWidth,\n container: chartContainer.current,\n };\n _removalValueForTextTuncate = createWrapOfXLabels(wrapLabelProps) ?? 0;\n }\n\n if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType! === XAxisTypes.StringAxis) {\n const rotateLabelProps = {\n node: xAxisElement.current!,\n xAxis: _xScale,\n };\n const rotatedHeight = rotateXAxisLabels(rotateLabelProps) ?? 0;\n // margins.bottom is used as padding here\n _removalValueForTextTuncate = rotatedHeight + margins.bottom!;\n }\n }\n\n function _calcMargins(): IMargins {\n let _margins = _getDefaultMargins();\n\n _margins = _applyTitleMargins(_margins);\n _margins = _applyAnnotationMargins(_margins);\n\n if (_useRtl) {\n _margins = _swapRtlMargins(_margins);\n }\n\n return {\n ..._margins,\n ...props.margins,\n };\n }\n\n function _getDefaultMargins(): IMargins {\n return {\n top: DEFAULT_MARGIN_NO_TICKS,\n // Smaller than the default because it is based on the line height rather than\n // the length of the tick labels.\n bottom: DEFAULT_MARGIN_WITH_TICKS - 5,\n // For the actual margin, add the tick size, tick padding, and some extra space to\n // the width of the longest yaxis tick label (startFromX).\n left: Math.max(DEFAULT_MARGIN_WITH_TICKS, startFromX + 20),\n right: props.secondaryYScaleOptions ? DEFAULT_MARGIN_WITH_TICKS : DEFAULT_MARGIN_NO_TICKS,\n };\n }\n\n function _applyTitleMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {\n updated.bottom! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {\n updated.left! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n if (props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '') {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _applyAnnotationMargins(_margins: IMargins): IMargins {\n const updated = { ..._margins };\n if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {\n updated.top! += VERTICAL_MARGIN_FOR_XAXIS_TITLE;\n }\n if (\n props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')\n ) {\n updated.right! += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;\n }\n return updated;\n }\n\n function _swapRtlMargins(_margins: IMargins): IMargins {\n return {\n ..._margins,\n left: _margins.right,\n right: _margins.left,\n };\n }\n\n /**\n * We have use the {@link defaultTabbableElement } to fix\n * the Focus not landing on chart while tabbing, instead goes to legend.\n * This issue is observed in Area, line chart after performance optimization done in the PR {@link https://github.com/microsoft/fluentui/pull/27721 }\n * This issue is observed in Bar charts after the changes done by FocusZone team in the PR: {@link https://github.com/microsoft/fluentui/pull/24175 }\n * The issue in Bar Charts(VB and VSB) is due to a {@link FocusZone } update where previously an event listener was\n * attached on keydown to the window, so that whenever the tab key is pressed all outer FocusZone's\n * tab-indexes are updated (an outer FocusZone is a FocusZone that is not within another one).\n * But now after the above PR : they are attaching the\n * listeners to the FocusZone elements instead of the window. So in the first render cycle in Bar charts\n * bars are not created as in the first render cycle the size of the chart container is not known( or is 0)\n * which creates bars of height 0 so instead we do not create any bars and instead return empty fragments.\n *\n * We have tried 2 Approaches to fix the issue:\n * 1. Using the {@link elementRef} property of FocusZone where we dispatch event for tab keydown\n * after the second render cycle which triggers an update of the tab index in FocusZone.\n * But this is a hacky solution and not a proper fix and also elementRef is deprecated.\n * 2. Using the default tabbable element to fix the issue.\n */\n\n return (\n <div\n id={idForGraph}\n className={classes.root}\n role={'presentation'}\n ref={(rootElem: HTMLDivElement) => {\n chartContainer.current = rootElem;\n }}\n onMouseLeave={_onChartLeave}\n >\n <div className={classes.chartWrapper} {...focusAttributes} {...arrowAttributes}>\n {_isFirstRender.current}\n <svg\n width={svgDimensions.width}\n height={svgDimensions.height}\n role=\"region\"\n aria-label={_getChartDescription()}\n style={{ display: 'block' }}\n className={classes.chart}\n {...getSecureProps(svgProps)}\n >\n <g\n ref={(e: SVGSVGElement | null) => {\n xAxisElement.current = e!;\n }}\n id={`xAxisGElement${idForGraph}`}\n // To add wrap of x axis lables feature, need to remove word height from svg height.\n transform={`translate(0, ${svgDimensions.height - margins.bottom! - _removalValueForTextTuncate!})`}\n className={classes.xAxis}\n />\n {props.xAxisTitle !== undefined && props.xAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisTitle}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: svgDimensions.height - AXIS_TITLE_PADDING,\n className: classes.axisTitle!,\n textAnchor: 'middle',\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n {props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.xAxisAnnotation}\n textProps={{\n x: margins.left! + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,\n y: VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING,\n className: classes.axisAnnotation!,\n textAnchor: 'middle',\n 'aria-hidden': true,\n }}\n maxWidth={xAxisTitleMaxWidth}\n />\n )}\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElement.current = e!;\n }}\n id={`yAxisGElement${idForGraph}`}\n transform={`translate(${_useRtl ? svgDimensions.width - margins.right! : margins.left!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYScaleOptions && (\n <g>\n <g\n ref={(e: SVGSVGElement | null) => {\n yAxisElementSecondary.current = e!;\n }}\n id={`yAxisGElementSecondary${idForGraph}`}\n transform={`translate(${_useRtl ? margins.left! : svgDimensions.width - margins.right!}, 0)`}\n className={classes.yAxis}\n />\n {props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.secondaryYAxistitle}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </g>\n )}\n {children}\n {props.yAxisTitle !== undefined && props.yAxisTitle !== '' && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisTitle}\n textProps={{\n x: yAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${yAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisTitle!,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n {props.yAxisAnnotation !== undefined &&\n props.yAxisAnnotation !== '' &&\n (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && (\n <SVGTooltipText\n {...commonSvgToolTipProps}\n content={props.yAxisAnnotation}\n textProps={{\n x: secondaryYAxisTitleCenterX,\n y: yAxisTitleCenterY,\n textAnchor: 'middle',\n transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,\n className: classes.axisAnnotation!,\n 'aria-hidden': true,\n }}\n maxWidth={yAxisTitleMaxHeight}\n />\n )}\n </svg>\n {hasAnnotations && annotationContext && (\n <ChartAnnotationLayer\n annotations={annotations}\n context={annotationContext}\n className={classes.annotationLayer}\n />\n )}\n </div>\n\n {!props.hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer = e;\n }}\n className={classes.legendContainer}\n >\n {props.legendBars}\n </div>\n )}\n {/** The callout is used for narration, so keep it mounted on the DOM */}\n {callout && <React.Suspense fallback={<div>Loading...</div>}>{callout}</React.Suspense>}\n </div>\n );\n});\nCartesianChart.displayName = 'CartesianChart';\n"],"names":["React","useCartesianChartStyles","select","d3Select","createNumericXAxis","createStringXAxis","createDateXAxis","XAxisTypes","YAxisType","createWrapOfXLabels","rotateXAxisLabels","calculateLongestLabelWidth","createYAxisLabels","ChartTypes","wrapContent","useRtl","truncateString","tooltipOfAxislabels","getSecureProps","DEFAULT_WRAP_WIDTH","autoLayoutXAxisLabels","useId","SVGTooltipText","ChartAnnotationLayer","ChartPopover","useFocusableGroup","useArrowNavigationGroup","HORIZONTAL_MARGIN_FOR_YAXIS_TITLE","VERTICAL_MARGIN_FOR_XAXIS_TITLE","AXIS_TITLE_PADDING","DEFAULT_MARGIN_WITH_TICKS","DEFAULT_MARGIN_NO_TICKS","CartesianChart","forwardRef","hideTickOverlap","props","forwardedRef","chartContainer","useRef","legendContainer","minLegendContainerHeight","xAxisElement","yAxisElement","yAxisElementSecondary","margins","idForGraph","_reqID","_useRtl","_tickLabels","_isFirstRender","_xScale","isIntegralDataset","useMemo","points","some","point","y","_tooltipId","_removalValueForTextTuncate","_yAxisTickText","containerWidth","setContainerWidth","useState","containerHeight","setContainerHeight","startFromX","setStartFromX","prevWidthRef","undefined","prevHeightRef","classes","focusAttributes","arrowAttributes","circular","axis","useEffect","_fitParentContainer","showYAxisLables","maxYAxisLabelLength","calculateMaxYAxisLabelLength","yAxis","cancelAnimationFrame","current","width","height","chartType","yAxisType","useImperativeHandle","componentRef","_generateCallout","calloutProps","className","formatTickLabel","str","showYAxisLablesTooltip","noOfCharsToTruncate","map","label","svgProps","culture","dateLocalizeOptions","timeFormatLocale","customDateTimeFormatter","parentRef","_calcMargins","getmargins","callout","yScalePrimary","yScaleSecondary","children","enableFirstRenderOptimization","XAxisParams","domainNRangeValues","getDomainNRangeValues","getDomainMargins","xAxisType","barwidth","tickValues","showRoundOffXTickValues","xAxisCount","xAxisTickCount","xAxistickSize","tickPadding","showXAxisLablesTooltip","xAxisPadding","xAxisInnerPadding","xAxisOuterPadding","rotateXAxisLables","xAxis","tickLayout","calcMaxLabelWidth","_calcMaxLabelWidthWithTransform","xMinValue","xMaxValue","xScale","tickLabels","NumericAxis","tickParams","xScaleType","DateAxis","useUTC","StringAxis","datasetForXAxisDomain","_transformXAxisLabels","YAxisParams","getYDomainMargins","yAxisTickFormat","yAxisTickCount","yMinValue","yMaxValue","maxOfYVal","yMinMaxValues","getMinMaxOfYAxis","yAxisPadding","yAxisTickValues","axisData","yAxisDomainValues","yAxisTickText","createStringYAxis","stringDatasetForYAxisDomain","secondaryYScaleOptions","YAxisParamsSecondary","createYAxis","roundedTicks","secondaryYScaleType","yScaleType","getAxisData","document","getElementById","remove","e","_xAxisElement","call","tooltipProps","tooltipCls","tooltip","id","container","_yAxisElement","ytooltipProps","_getData","getGraphData","hideTooltip","isPopoverOpen","svgDimensions","plotWidth","Math","max","left","right","plotHeight","top","bottom","plotRect","x","annotations","hasAnnotations","length","annotationContext","svgRect","isRtl","xAxisTitleMaxWidth","yAxisTitleMaxHeight","yAxisTitleCenterY","yAxisTitleCenterX","secondaryYAxisTitleCenterX","commonSvgToolTipProps","showBackground","svgTooltip","content","legendContainerHeight","hideLegend","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","currentContainerWidth","reflowProps","mode","_calculateChartMinWidth","currentContainerHeight","shouldResize","_onChartLeave","onChartMouseLeave","labelWidth","minChartWidth","GroupedVerticalBarChart","VerticalBarChart","VerticalStackedBarChart","includes","minDomainMargin","_getChartDescription","chartTitle","_getAxisTitle","xAxisTitle","yAxisTitle","secondaryYAxistitle","axisLabel","axisTitle","axisType","wrapXAxisLables","longestLabelWidth","ceil","cos","PI","val","numChars","toString","slice","words","forEach","push","split","maxXAxisLabelWidth","step","wrapLabelProps","node","rotateLabelProps","rotatedHeight","_margins","_getDefaultMargins","_applyTitleMargins","_applyAnnotationMargins","_swapRtlMargins","updated","xAxisAnnotation","yAxisAnnotation","div","root","role","ref","rootElem","onMouseLeave","chartWrapper","svg","aria-label","style","display","chart","g","transform","textProps","textAnchor","maxWidth","axisAnnotation","context","annotationLayer","legendBars","Suspense","fallback","displayName"],"mappings":"AAAA;;;;;+BA8CagC;;;;;;;iEA5CU,QAAQ;+CAGS,mCAAmC;6BACxC,eAAe;uBAqB3C,wBAAwB;gCACT,4BAA4B;gCAEE,iCAAiC;sCAChD,qCAAqC;8BAE7C,iBAAiB;8BACa,0BAA0B;AAErF,MAAML,oCAAoC;AAC1C,MAAMC,kCAAkC;AACxC,MAAMC,qBAAqB;AAC3B,MAAMC,4BAA4B;AAClC,MAAMC,0BAA0B;AAMzB,uBAAMC,WAAAA,GAAuEhC,OAAMiC,UAAU,CAGlG,CAAC,EAAEC,kBAAkB,IAAI,EAAE,GAAGC,OAAO,EAAEC;IACvC,MAAMC,iBAAiBrC,OAAMsC,MAAM,CAAwB;IAC3D,IAAIC;IACJ,MAAMC,2BAAmC;IACzC,MAAMC,eAAezC,OAAMsC,MAAM,CAAuB;IACxD,MAAMI,eAAe1C,OAAMsC,MAAM,CAAuB;IACxD,MAAMK,wBAAwB3C,OAAMsC,MAAM,CAAuB;IACjE,IAAIM;IACJ,MAAMC,aAAqB;IAC3B,IAAIC;IACJ,MAAMC,cAAmBhC,aAAAA;IACzB,IAAIiC;IACJ,MAAMC,iBAAiBjD,OAAMsC,M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e;SAKvC,CAAC7P,MAAMgL,UAAU,IAAA,WAAA,GAChB,OAAA,aAAA,CAAC0D,OAAAA;QACCG,KAAK,CAACtG;YACJnI,kBAAkBmI;QACpB;QACA/E,WAAWrB,QAAQ/B,eAAe;OAEjCJ,MAAM8P,UAAU,GAIpBvL,WAAAA,WAAAA,GAAW,OAAA,aAAA,CAAC1G,OAAMkS,QAAQ,EAAA;QAACC,UAAAA,WAAAA,GAAU,OAAA,aAAA,CAACtB,OAAAA,MAAI;OAAmBnK;AAGpE,GAAG;AACH1E,eAAeoQ,WAAW,GAAG"}
|
|
@@ -257,7 +257,10 @@ const DonutChart = /*#__PURE__*/ _react.forwardRef(({ innerRadius = 0, hideLabel
|
|
|
257
257
|
const outerRadius = Math.min(_width - donutMarginHorizontal, _height - donutMarginVertical) / 2;
|
|
258
258
|
const chartData = _elevateToMinimums(points);
|
|
259
259
|
const valueInsideDonut = props.innerRadius > _index1.MIN_DONUT_RADIUS ? _valueInsideDonut(props.valueInsideDonut, chartData) : '';
|
|
260
|
-
const
|
|
260
|
+
const arrowAttributes = (0, _reacttabster.useArrowNavigationGroup)({
|
|
261
|
+
circular: true,
|
|
262
|
+
axis: 'horizontal'
|
|
263
|
+
});
|
|
261
264
|
return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement("div", {
|
|
262
265
|
className: classes.root,
|
|
263
266
|
ref: (rootElem)=>{
|
|
@@ -271,7 +274,7 @@ const DonutChart = /*#__PURE__*/ _react.forwardRef(({ innerRadius = 0, hideLabel
|
|
|
271
274
|
textAnchor: "middle"
|
|
272
275
|
}, props.xAxisAnnotation), /*#__PURE__*/ _react.createElement("div", {
|
|
273
276
|
className: classes.chartWrapper,
|
|
274
|
-
...
|
|
277
|
+
...arrowAttributes
|
|
275
278
|
}, /*#__PURE__*/ _react.createElement("svg", {
|
|
276
279
|
className: classes.chart,
|
|
277
280
|
"aria-label": data === null || data === void 0 ? void 0 : data.chartTitle,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable react/jsx-no-bind */\nimport * as React from 'react';\nimport { Pie } from './Pie/index';\nimport { DonutChartProps } from './DonutChart.types';\nimport { useDonutChartStyles } from './useDonutChartStyles.styles';\nimport { ChartDataPoint } from '../../DonutChart';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { areArraysEqual, getColorFromToken, getNextColor, MIN_DONUT_RADIUS } from '../../utilities/index';\nimport { Legend, Legends } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst MIN_LEGEND_CONTAINER_HEIGHT = 40;\n\n// Create a DonutChart variant which uses these default styles and this styled subcomponent.\n/**\n * Donutchart component.\n * {@docCategory DonutChart}\n */\nexport const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwardRef<HTMLDivElement, DonutChartProps>(\n ({ innerRadius = 0, hideLabels = true, ...restProps }, forwardedRef) => {\n const props = { innerRadius, hideLabels, ...restProps };\n const { chartContainerRef: _rootElem, legendsRef: _legendsRef } = useImageExport(\n props.componentRef,\n props.hideLegend,\n false,\n );\n const _uniqText: string = useId('_Pie_');\n /* eslint-disable @typescript-eslint/no-explicit-any */\n let _calloutAnchorPoint: ChartDataPoint | null;\n let _emptyChartId: string | null;\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const prevSize = React.useRef<{ width?: number; height?: number }>({});\n\n const [value, setValue] = React.useState<string | undefined>('');\n const [legend, setLegend] = React.useState<string | undefined>('');\n const [_width, setWidth] = React.useState<number | undefined>(props.width || 200);\n const [_height, setHeight] = React.useState<number | undefined>(props.height || 200);\n const [activeLegend, setActiveLegend] = React.useState<string | undefined>(undefined);\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const prevPropsRef = React.useRef<DonutChartProps | null>(null);\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\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.useEffect(() => {\n if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {\n _fitParentContainer();\n }\n prevSize.current.height = props.height;\n prevSize.current.width = props.width;\n }, [props.width, props.height]);\n\n function _elevateToMinimums(data: ChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: ChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n function _createLegends(chartData: ChartDataPoint[]): JSXElement {\n if (props.order === 'sorted') {\n chartData.sort((a: ChartDataPoint, b: ChartDataPoint) => {\n return b.data! - a.data!;\n });\n }\n const legendDataItems = chartData.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend(undefined);\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n function _onLegendSelectionChange(\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps && 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 _focusCallback(\n data: ChartDataPoint,\n id: string,\n e: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setFocusedArcId(id);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n\n function _hoverCallback(\n data: ChartDataPoint,\n e: React.MouseEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n }\n function _onBlur(): void {\n setFocusedArcId('');\n }\n\n function _hoverLeave(): void {\n /**/\n }\n\n function _handleChartMouseLeave() {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n function _valueInsideDonut(valueInsideDonut: string | number | undefined, data: ChartDataPoint[]) {\n const highlightedLegends = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegends.length === 1 || isPopoverOpen)) {\n const pointValue = data.find(point => _isLegendHighlighted(point.legend));\n return pointValue\n ? pointValue.yAxisCalloutData\n ? pointValue.yAxisCalloutData\n : pointValue.data!\n : valueInsideDonut;\n } else if (highlightedLegends.length > 0) {\n let totalValue = 0;\n data.forEach(point => {\n if (highlightedLegends.includes(point.legend!)) {\n totalValue += point.data!;\n }\n });\n return totalValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n function _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, props.culture);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n */\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _isLegendHighlighted(legend: string | undefined): boolean {\n return _getHighlightedLegend().includes(legend!);\n }\n\n function _noLegendsHighlighted(): boolean {\n return _getHighlightedLegend().length === 0;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.chartData &&\n props.data.chartData!.filter((d: ChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n function _addDefaultColors(donutChartDataPoint?: ChartDataPoint[]): ChartDataPoint[] {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let defaultColor: string;\n if (typeof item.color === 'undefined') {\n defaultColor = getNextColor(index, 0);\n } else {\n defaultColor = getColorFromToken(item.color);\n }\n return { ...item, defaultColor };\n })\n : [];\n }\n\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);\n legendContainerHeight =\n ((legendContainer.current && legendContainer.current.getBoundingClientRect().height) ||\n MIN_LEGEND_CONTAINER_HEIGHT) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || _rootElem.current) {\n const container = props.parentRef ? props.parentRef : _rootElem.current!;\n const currentContainerWidth = container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 200;\n const shouldResize =\n _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setWidth(currentContainerWidth);\n setHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n const { data, hideLegend = false } = props;\n const points = _addDefaultColors(data?.chartData);\n\n const classes = useDonutChartStyles(props);\n\n const legendBars = _createLegends(points.filter(d => d.data! >= 0));\n const donutMarginHorizontal = props.hideLabels ? 0 : 80;\n const donutMarginVertical = props.hideLabels ? 0 : 40;\n const outerRadius = Math.min(_width! - donutMarginHorizontal, _height! - donutMarginVertical) / 2;\n const chartData = _elevateToMinimums(points);\n const valueInsideDonut =\n props.innerRadius! > MIN_DONUT_RADIUS ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => {\n _rootElem.current = rootElem;\n }}\n onMouseLeave={_handleChartMouseLeave}\n >\n {props.xAxisAnnotation && (\n <text className={classes.axisAnnotation} x={_width! / 2} y={_height! - 10} textAnchor=\"middle\">\n {props.xAxisAnnotation}\n </text>\n )}\n <div className={classes.chartWrapper} {...focusAttributes}>\n <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}>\n <Pie\n width={_width!}\n height={_height!}\n outerRadius={outerRadius}\n innerRadius={props.innerRadius!}\n data={chartData!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n hoverLeaveCallback={_hoverLeave}\n uniqText={_uniqText}\n onBlurCallback={_onBlur}\n activeArc={_getHighlightedLegend()}\n focusedArcId={focusedArcId || ''}\n href={props.href!}\n valueInsideDonut={_toLocaleString(valueInsideDonut)}\n showLabelsInPercent={props.showLabelsInPercent}\n hideLabels={props.hideLabels}\n />\n </svg>\n </div>\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={\n !props.hideTooltip && isPopoverOpen && (_noLegendsHighlighted() || _isLegendHighlighted(legend))\n }\n legend={legend!}\n YValue={value!}\n color={color}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer.current = e;\n }}\n className={classes.legendContainer}\n >\n {legendBars}\n </div>\n )}\n </div>\n ) : (\n <div id={_emptyChartId!} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n\nDonutChart.displayName = 'DonutChart';\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","areArraysEqual","getColorFromToken","getNextColor","MIN_DONUT_RADIUS","Legends","useId","useFocusableGroup","ChartPopover","useImageExport","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","innerRadius","hideLabels","restProps","forwardedRef","props","chartContainerRef","_rootElem","legendsRef","_legendsRef","componentRef","hideLegend","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","useRef","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","undefined","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","refSelected","setRefSelected","isPopoverOpen","setPopoverOpen","prevPropsRef","useEffect","_fitParentContainer","current","prevProps","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","toLocaleString","_createLegends","chartData","order","sort","a","b","legendDataItems","map","point","index","title","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","onChange","_onLegendSelectionChange","legendRef","event","currentLegend","canSelectMultipleLegends","slice","_focusCallback","id","e","targetElement","_noLegendsHighlighted","_isLegendHighlighted","toString","xAxisCalloutData","_hoverCallback","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegends","_getHighlightedLegend","length","pointValue","find","totalValue","includes","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","_addDefaultColors","donutChartDataPoint","defaultColor","legendContainerHeight","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","donutMarginVertical","outerRadius","Math","min","focusAttributes","div","className","root","ref","rootElem","onMouseLeave","xAxisAnnotation","text","axisAnnotation","x","y","textAnchor","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","positioning","target","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName"],"mappings":"AAAA;;;;;+BAwBac;;;;;;;iEArBU,QAAQ;uBACX,cAAc;2CAEE,+BAA+B;gCAE9B,4BAA4B;wBACiB,wBAAwB;wBAC1E,cAAc;gCACxB,4BAA4B;8BAEhB,0BAA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pH,eAAe;OAEjCqH,eAAAA,WAAAA,GAKP,OAAA,aAAA,CAACO,OAAAA;QAAIjD,IAAI5E;QAAgBiK,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGvB,cAAY;;AAEjF,GACA;AAEF3J,WAAWmL,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/DonutChart/DonutChart.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable react/jsx-no-bind */\nimport * as React from 'react';\nimport { Pie } from './Pie/index';\nimport { DonutChartProps } from './DonutChart.types';\nimport { useDonutChartStyles } from './useDonutChartStyles.styles';\nimport { ChartDataPoint } from '../../DonutChart';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { areArraysEqual, getColorFromToken, getNextColor, MIN_DONUT_RADIUS } from '../../utilities/index';\nimport { Legend, Legends } from '../../index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst MIN_LEGEND_CONTAINER_HEIGHT = 40;\n\n// Create a DonutChart variant which uses these default styles and this styled subcomponent.\n/**\n * Donutchart component.\n * {@docCategory DonutChart}\n */\nexport const DonutChart: React.FunctionComponent<DonutChartProps> = React.forwardRef<HTMLDivElement, DonutChartProps>(\n ({ innerRadius = 0, hideLabels = true, ...restProps }, forwardedRef) => {\n const props = { innerRadius, hideLabels, ...restProps };\n const { chartContainerRef: _rootElem, legendsRef: _legendsRef } = useImageExport(\n props.componentRef,\n props.hideLegend,\n false,\n );\n const _uniqText: string = useId('_Pie_');\n /* eslint-disable @typescript-eslint/no-explicit-any */\n let _calloutAnchorPoint: ChartDataPoint | null;\n let _emptyChartId: string | null;\n const legendContainer = React.useRef<HTMLDivElement | null>(null);\n const prevSize = React.useRef<{ width?: number; height?: number }>({});\n\n const [value, setValue] = React.useState<string | undefined>('');\n const [legend, setLegend] = React.useState<string | undefined>('');\n const [_width, setWidth] = React.useState<number | undefined>(props.width || 200);\n const [_height, setHeight] = React.useState<number | undefined>(props.height || 200);\n const [activeLegend, setActiveLegend] = React.useState<string | undefined>(undefined);\n const [color, setColor] = React.useState<string | undefined>('');\n const [xCalloutValue, setXCalloutValue] = React.useState<string>('');\n const [yCalloutValue, setYCalloutValue] = React.useState<string>('');\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [focusedArcId, setFocusedArcId] = React.useState<string>('');\n const [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<ChartDataPoint | undefined>();\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const prevPropsRef = React.useRef<DonutChartProps | null>(null);\n\n React.useEffect(() => {\n _fitParentContainer();\n }, []);\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.useEffect(() => {\n if (prevSize.current.height !== props.height || prevSize.current.width !== props.width) {\n _fitParentContainer();\n }\n prevSize.current.height = props.height;\n prevSize.current.width = props.width;\n }, [props.width, props.height]);\n\n function _elevateToMinimums(data: ChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: ChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n function _createLegends(chartData: ChartDataPoint[]): JSXElement {\n if (props.order === 'sorted') {\n chartData.sort((a: ChartDataPoint, b: ChartDataPoint) => {\n return b.data! - a.data!;\n });\n }\n const legendDataItems = chartData.map((point: ChartDataPoint, index: number) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend!);\n },\n onMouseOutAction: () => {\n setActiveLegend(undefined);\n },\n };\n return legend;\n });\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }\n function _onLegendSelectionChange(\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps && 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 _focusCallback(\n data: ChartDataPoint,\n id: string,\n e: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setFocusedArcId(id);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n\n function _hoverCallback(\n data: ChartDataPoint,\n e: React.MouseEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n if (_calloutAnchorPoint !== data) {\n _calloutAnchorPoint = data;\n setPopoverOpen(_noLegendsHighlighted() || _isLegendHighlighted(data.legend));\n setValue(data.data!.toString());\n setLegend(data.legend);\n setColor(data.color!);\n setXCalloutValue(data.xAxisCalloutData!);\n setYCalloutValue(data.yAxisCalloutData!);\n setDataPointCalloutProps(data);\n setRefSelected(targetElement!);\n }\n }\n function _onBlur(): void {\n setFocusedArcId('');\n }\n\n function _hoverLeave(): void {\n /**/\n }\n\n function _handleChartMouseLeave() {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n function _valueInsideDonut(valueInsideDonut: string | number | undefined, data: ChartDataPoint[]) {\n const highlightedLegends = _getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegends.length === 1 || isPopoverOpen)) {\n const pointValue = data.find(point => _isLegendHighlighted(point.legend));\n return pointValue\n ? pointValue.yAxisCalloutData\n ? pointValue.yAxisCalloutData\n : pointValue.data!\n : valueInsideDonut;\n } else if (highlightedLegends.length > 0) {\n let totalValue = 0;\n data.forEach(point => {\n if (highlightedLegends.includes(point.legend!)) {\n totalValue += point.data!;\n }\n });\n return totalValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n function _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, props.culture);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n */\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _isLegendHighlighted(legend: string | undefined): boolean {\n return _getHighlightedLegend().includes(legend!);\n }\n\n function _noLegendsHighlighted(): boolean {\n return _getHighlightedLegend().length === 0;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.chartData &&\n props.data.chartData!.filter((d: ChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n function _addDefaultColors(donutChartDataPoint?: ChartDataPoint[]): ChartDataPoint[] {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let defaultColor: string;\n if (typeof item.color === 'undefined') {\n defaultColor = getNextColor(index, 0);\n } else {\n defaultColor = getColorFromToken(item.color);\n }\n return { ...item, defaultColor };\n })\n : [];\n }\n\n /**\n * When screen resizes, along with screen, chart also auto adjusted.\n * This method used to adjust height and width of the charts.\n */\n function _fitParentContainer(): void {\n //_reqID = requestAnimationFrame(() => {\n let legendContainerHeight;\n if (props.hideLegend) {\n // If there is no legend, need not to allocate some space from total chart space.\n legendContainerHeight = 0;\n } else {\n const legendContainerComputedStyles = legendContainer.current && getComputedStyle(legendContainer.current);\n legendContainerHeight =\n ((legendContainer.current && legendContainer.current.getBoundingClientRect().height) ||\n MIN_LEGEND_CONTAINER_HEIGHT) +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginTop) || '0') +\n parseFloat((legendContainerComputedStyles && legendContainerComputedStyles.marginBottom) || '0');\n }\n if (props.parentRef || _rootElem.current) {\n const container = props.parentRef ? props.parentRef : _rootElem.current!;\n const currentContainerWidth = container.getBoundingClientRect().width;\n const currentContainerHeight =\n container.getBoundingClientRect().height > legendContainerHeight\n ? container.getBoundingClientRect().height\n : 200;\n const shouldResize =\n _width !== currentContainerWidth || _height !== currentContainerHeight - legendContainerHeight;\n if (shouldResize) {\n setWidth(currentContainerWidth);\n setHeight(currentContainerHeight - legendContainerHeight);\n }\n }\n //});\n }\n\n const { data, hideLegend = false } = props;\n const points = _addDefaultColors(data?.chartData);\n\n const classes = useDonutChartStyles(props);\n\n const legendBars = _createLegends(points.filter(d => d.data! >= 0));\n const donutMarginHorizontal = props.hideLabels ? 0 : 80;\n const donutMarginVertical = props.hideLabels ? 0 : 40;\n const outerRadius = Math.min(_width! - donutMarginHorizontal, _height! - donutMarginVertical) / 2;\n const chartData = _elevateToMinimums(points);\n const valueInsideDonut =\n props.innerRadius! > MIN_DONUT_RADIUS ? _valueInsideDonut(props.valueInsideDonut!, chartData!) : '';\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n return !_isChartEmpty() ? (\n <div\n className={classes.root}\n ref={(rootElem: HTMLDivElement | null) => {\n _rootElem.current = rootElem;\n }}\n onMouseLeave={_handleChartMouseLeave}\n >\n {props.xAxisAnnotation && (\n <text className={classes.axisAnnotation} x={_width! / 2} y={_height! - 10} textAnchor=\"middle\">\n {props.xAxisAnnotation}\n </text>\n )}\n <div className={classes.chartWrapper} {...arrowAttributes}>\n <svg className={classes.chart} aria-label={data?.chartTitle} width={_width} height={_height}>\n <Pie\n width={_width!}\n height={_height!}\n outerRadius={outerRadius}\n innerRadius={props.innerRadius!}\n data={chartData!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n hoverLeaveCallback={_hoverLeave}\n uniqText={_uniqText}\n onBlurCallback={_onBlur}\n activeArc={_getHighlightedLegend()}\n focusedArcId={focusedArcId || ''}\n href={props.href!}\n valueInsideDonut={_toLocaleString(valueInsideDonut)}\n showLabelsInPercent={props.showLabelsInPercent}\n hideLabels={props.hideLabels}\n />\n </svg>\n </div>\n <ChartPopover\n xCalloutValue={xCalloutValue}\n yCalloutValue={yCalloutValue}\n culture={props.culture}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={\n !props.hideTooltip && isPopoverOpen && (_noLegendsHighlighted() || _isLegendHighlighted(legend))\n }\n legend={legend!}\n YValue={value!}\n color={color}\n isCalloutForStack={false}\n customCallout={{\n customizedCallout: props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps!)\n : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n }}\n isCartesian={false}\n />\n {!hideLegend && (\n <div\n ref={(e: HTMLDivElement) => {\n legendContainer.current = e;\n }}\n className={classes.legendContainer}\n >\n {legendBars}\n </div>\n )}\n </div>\n ) : (\n <div id={_emptyChartId!} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n\nDonutChart.displayName = 'DonutChart';\n"],"names":["React","Pie","useDonutChartStyles","formatToLocaleString","areArraysEqual","getColorFromToken","getNextColor","MIN_DONUT_RADIUS","Legends","useId","useArrowNavigationGroup","ChartPopover","useImageExport","MIN_LEGEND_CONTAINER_HEIGHT","DonutChart","forwardRef","innerRadius","hideLabels","restProps","forwardedRef","props","chartContainerRef","_rootElem","legendsRef","_legendsRef","componentRef","hideLegend","_uniqText","_calloutAnchorPoint","_emptyChartId","legendContainer","useRef","prevSize","value","setValue","useState","legend","setLegend","_width","setWidth","width","_height","setHeight","height","activeLegend","setActiveLegend","undefined","color","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","focusedArcId","setFocusedArcId","dataPointCalloutProps","setDataPointCalloutProps","refSelected","setRefSelected","isPopoverOpen","setPopoverOpen","prevPropsRef","useEffect","_fitParentContainer","current","prevProps","_elevateToMinimums","data","sumOfData","minPercent","elevatedData","forEach","item","push","yAxisCalloutData","toLocaleString","_createLegends","chartData","order","sort","a","b","legendDataItems","map","point","index","title","hoverAction","_handleChartMouseLeave","onMouseOutAction","legends","centerLegends","overflowText","legendsOverflowText","onChange","_onLegendSelectionChange","legendRef","event","currentLegend","canSelectMultipleLegends","slice","_focusCallback","id","e","targetElement","_noLegendsHighlighted","_isLegendHighlighted","toString","xAxisCalloutData","_hoverCallback","_onBlur","_hoverLeave","_valueInsideDonut","valueInsideDonut","highlightedLegends","_getHighlightedLegend","length","pointValue","find","totalValue","includes","_toLocaleString","localeString","culture","_isChartEmpty","filter","d","_addDefaultColors","donutChartDataPoint","defaultColor","legendContainerHeight","legendContainerComputedStyles","getComputedStyle","getBoundingClientRect","parseFloat","marginTop","marginBottom","parentRef","container","currentContainerWidth","currentContainerHeight","shouldResize","points","classes","legendBars","donutMarginHorizontal","donutMarginVertical","outerRadius","Math","min","arrowAttributes","circular","axis","div","className","root","ref","rootElem","onMouseLeave","xAxisAnnotation","text","axisAnnotation","x","y","textAnchor","chartWrapper","svg","chart","aria-label","chartTitle","onFocusCallback","hoverOnCallback","hoverLeaveCallback","uniqText","onBlurCallback","activeArc","href","showLabelsInPercent","positioning","target","hideTooltip","YValue","isCalloutForStack","customCallout","customizedCallout","onRenderCalloutPerDataPoint","customCalloutProps","calloutPropsPerDataPoint","isCartesian","role","style","opacity","displayName"],"mappings":"AAAA;;;;;+BAwBac;;;;;;;iEArBU,QAAQ;uBACX,cAAc;2CAEE,+BAA+B;gCAE9B,4BAA4B;wBACiB,wBAAwB;wBAC1E,cAAc;gCACxB,4BAA4B;8BAEV,0BAA0B;8BACrC,mCAAmC;uBACjC,wBAAwB;AAEvD,MAAMD,8BAA8B;AAO7B,mBAAMC,WAAAA,GAAuDd,OAAMe,UAAU,CAClF,CAAC,EAAEC,cAAc,CAAC,EAAEC,aAAa,IAAI,EAAE,GAAGC,WAAW,EAAEC;QAsBkBC;IArBvE,MAAMA,QAAQ;QAAEJ;QAAaC;QAAY,GAAGC,SAAS;IAAC;IACtD,MAAM,EAAEG,mBAAmBC,SAAS,EAAEC,YAAYC,WAAW,EAAE,OAAGZ,qBAAAA,EAChEQ,MAAMK,YAAY,EAClBL,MAAMM,UAAU,EAChB;IAEF,MAAMC,gBAAoBlB,qBAAAA,EAAM;IAChC,qDAAqD,GACrD,IAAImB;IACJ,IAAIC;IACJ,MAAMC,kBAAkB9B,OAAM+B,MAAM,CAAwB;IAC5D,MAAMC,WAAWhC,OAAM+B,MAAM,CAAsC,CAAC;IAEpE,MAAM,CAACE,OAAOC,SAAS,GAAGlC,OAAMmC,QAAQ,CAAqB;IAC7D,MAAM,CAACC,QAAQC,UAAU,GAAGrC,OAAMmC,QAAQ,CAAqB;IAC/D,MAAM,CAACG,QAAQC,SAAS,GAAGvC,OAAMmC,QAAQ,CAAqBf,MAAMoB,KAAK,IAAI;IAC7E,MAAM,CAACC,SAASC,UAAU,GAAG1C,OAAMmC,QAAQ,CAAqBf,MAAMuB,MAAM,IAAI;IAChF,MAAM,CAACC,cAAcC,gBAAgB,GAAG7C,OAAMmC,QAAQ,CAAqBW;IAC3E,MAAM,CAACC,OAAOC,SAAS,GAAGhD,OAAMmC,QAAQ,CAAqB;IAC7D,MAAM,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B,GAChDxK,MAAMwK,2BAA2B,CAAClI,yBAClCZ;YACJ+I,oBAAoBzK,MAAM0K,wBAAwB,GAC9C1K,MAAM0K,wBAAwB,CAACpI,yBAC/BZ;QACN;QACAiJ,aAAa;QAEd,CAACrK,cAAAA,WAAAA,GACA,OAAA,aAAA,CAACkI,OAAAA;QACCG,KAAK,CAACrD;YACJ5E,gBAAgBqC,OAAO,GAAGuC;QAC5B;QACAmD,WAAWX,QAAQpH,eAAe;OAEjCqH,eAAAA,WAAAA,GAKP,OAAA,aAAA,CAACS,OAAAA;QAAInD,IAAI5E;QAAgBmK,MAAM;QAASC,OAAO;YAAEC,SAAS;QAAI;QAAGvB,cAAY;;AAEjF,GACA;AAEF7J,WAAWqL,WAAW,GAAG"}
|
|
@@ -347,11 +347,14 @@ const FunnelChart = /*#__PURE__*/ _react.forwardRef(({ orientation = 'vertical',
|
|
|
347
347
|
const funnelMarginTop = 40;
|
|
348
348
|
const funnelWidth = width * 0.8;
|
|
349
349
|
const funnelOffsetX = (width - funnelWidth) / 2;
|
|
350
|
-
const
|
|
350
|
+
const arrowAttributes = (0, _reacttabster.useArrowNavigationGroup)({
|
|
351
|
+
circular: true,
|
|
352
|
+
axis: 'horizontal'
|
|
353
|
+
});
|
|
351
354
|
return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement("div", {
|
|
352
355
|
ref: chartContainerRef,
|
|
353
356
|
className: classes.root,
|
|
354
|
-
...
|
|
357
|
+
...arrowAttributes,
|
|
355
358
|
style: {
|
|
356
359
|
width,
|
|
357
360
|
height
|