@fluentui/react-charts 0.0.0-nightly-20250718-0405.1 → 0.0.0-nightly-20250722-0406.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -15
- package/lib/components/AreaChart/AreaChart.js +10 -2
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +5 -5
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +7 -1
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +10 -5
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +9 -3
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +11 -4
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +8 -2
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +6 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +10 -2
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +5 -5
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +7 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +10 -5
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +9 -3
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +11 -4
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +8 -2
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +6 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["HorizontalBarChartWithAxis.tsx"],"sourcesContent":["import * as React from 'react';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport { scaleLinear as d3ScaleLinear, ScaleLinear as D3ScaleLinear, scaleBand as d3ScaleBand } from 'd3-scale';\nimport { Legend } from '../../components/Legends/Legends.types';\nimport { Legends } from '../../components/Legends/Legends';\nimport { useId } from '@fluentui/react-utilities';\nimport {\n AccessibilityProps,\n HorizontalBarChartWithAxisDataPoint,\n RefArrayData,\n Margins,\n ChartPopoverProps,\n Chart,\n} from '../../index';\nimport { ChildProps } from '../CommonComponents/CartesianChart.types';\nimport { CartesianChart } from '../CommonComponents/CartesianChart';\nimport { HorizontalBarChartWithAxisProps } from './HorizontalBarChartWithAxis.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport {\n ChartTypes,\n IAxisData,\n getAccessibleDataObject,\n YAxisType,\n XAxisTypes,\n NumericAxis,\n StringAxis,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n IDomainNRange,\n domainRangeOfNumericForHorizontalBarChartWithAxis,\n createStringYAxisForHorizontalBarChartWithAxis,\n areArraysEqual,\n useRtl,\n DataVizPalette,\n getColorFromToken,\n computeLongestBars,\n groupChartDataByYValue,\n MIN_DOMAIN_MARGIN,\n} from '../../utilities/index';\nimport { getClosestPairDiffAndRange } from '../../utilities/vbc-utils';\ntype ColorScale = (_p?: number) => string;\n\nexport const HorizontalBarChartWithAxis: React.FunctionComponent<HorizontalBarChartWithAxisProps> = React.forwardRef<\n HTMLDivElement,\n HorizontalBarChartWithAxisProps\n>((props, forwardedRef) => {\n const _refArray: RefArrayData[] = [];\n const _calloutId: string = useId('callout');\n const _isRtl: boolean = useRtl();\n const _xAxisType: XAxisTypes =\n props.data! && props.data!.length > 0\n ? (getTypeOfAxis(props.data![0].x, true) as XAxisTypes)\n : XAxisTypes.NumericAxis;\n const _yAxisType: YAxisType =\n props.data! && props.data!.length > 0\n ? (getTypeOfAxis(props.data![0].y, false) as YAxisType)\n : YAxisType.StringAxis;\n const _emptyChartId: string = useId('_HBCWithAxis_empty');\n let _points: HorizontalBarChartWithAxisDataPoint[] = [];\n let _barHeight: number = 0;\n let _colors: string[] = [];\n let _margins: Margins;\n let _bars: JSX.Element[];\n let _yAxisLabels: string[];\n let _xMax: number;\n let _calloutAnchorPoint: HorizontalBarChartWithAxisDataPoint | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _longestBarPositiveTotalValue: number;\n let _longestBarNegativeTotalValue: number;\n let _domainMargin: number = MIN_DOMAIN_MARGIN;\n let _yAxisPadding: number = props.yAxisPadding ?? 0.5;\n const cartesianChartRef = React.useRef<Chart>(null);\n const X_ORIGIN: number = 0;\n\n const [color, setColor] = React.useState<string>('');\n const [dataForHoverCard, setDataForHoverCard] = React.useState<number>(0);\n const [isLegendSelected, setIsLegendSelected] = React.useState<boolean>(\n (props.legendProps?.selectedLegends && props.legendProps.selectedLegends.length > 0) ||\n props.legendProps?.selectedLegend !== undefined,\n );\n const [isLegendHovered, setIsLegendHovered] = React.useState<boolean>(false);\n const [selectedLegendTitle, setSelectedLegendTitle] = React.useState<string>(props.legendProps?.selectedLegend ?? '');\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 [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<HorizontalBarChartWithAxisDataPoint>();\n const [callOutAccessibilityData, setCallOutAccessibilityData] = React.useState<AccessibilityProps>();\n const [isPopoverOpen, setPopoverOpen] = React.useState<boolean>(false);\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const prevPropsRef = React.useRef<HorizontalBarChartWithAxisProps | null>(null);\n\n React.useEffect(() => {\n if (prevPropsRef.current) {\n const prevProps = prevPropsRef.current;\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n }\n prevPropsRef.current = props;\n }, [props]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n }),\n [],\n );\n\n function _adjustProps(): void {\n _points = props.data || [];\n _barHeight = props.barHeight || 32;\n const defaultPalette: string[] = [\n getColorFromToken(DataVizPalette.color6),\n getColorFromToken(DataVizPalette.color1),\n getColorFromToken(DataVizPalette.color5),\n getColorFromToken(DataVizPalette.color7),\n ];\n _colors = props.colors! || defaultPalette;\n }\n\n function _getMargins(margins: Margins) {\n _margins = margins;\n }\n\n function _renderContentForOnlyBars(point: HorizontalBarChartWithAxisDataPoint): JSX.Element {\n const { useSingleColor = false } = props;\n let selectedPointIndex = 0;\n props.data!.forEach((yDataPoint: HorizontalBarChartWithAxisDataPoint, index: number) => {\n if (yDataPoint.y === point.y) {\n selectedPointIndex = index;\n }\n });\n // eslint-disable-next-line @typescript-eslint/no-shadow\n let color: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n color = props.colors ? _createColors()(1) : getNextColor(1, 0);\n } else {\n color = point.color ? point.color : props.colors ? _createColors()(point.x) : getNextColor(selectedPointIndex, 0);\n }\n return (\n <>\n <ChartPopover\n XValue={point.xAxisCalloutData || point.x.toString()}\n legend={point.legend}\n YValue={point.yAxisCalloutData || point.y}\n color={color}\n culture={props.culture ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={isPopoverOpen}\n />\n </>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n function _renderCallout(props?: HorizontalBarChartWithAxisDataPoint): JSX.Element | null {\n return props ? _renderContentForOnlyBars(props) : null;\n }\n\n function _getCustomizedCallout() {\n return props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout)\n : null;\n }\n\n function _getGraphData(\n xScale: NumericAxis,\n yScale: NumericAxis | StringAxis,\n containerHeight: number,\n containerWidth: number,\n xElement?: SVGElement | null,\n yElement?: SVGElement | null,\n ) {\n const stackedChartData = groupChartDataByYValue(_points);\n const longestBars = computeLongestBars(stackedChartData, X_ORIGIN);\n _longestBarPositiveTotalValue = longestBars.longestPositiveBar;\n _longestBarNegativeTotalValue = longestBars.longestNegativeBar;\n\n const { xBarScale, yBarScale } =\n _yAxisType === YAxisType.NumericAxis\n ? _getScales(containerHeight, containerWidth, true)\n : _getScales(containerHeight, containerWidth, false);\n const xRange = xBarScale.range();\n let allBars: JSX.Element[] = [];\n // when the chart mounts, the xRange[1] is sometimes seen to be < 0 (like -40) while xRange[0] > 0.\n if (xRange[0] < xRange[1]) {\n allBars = stackedChartData\n .map(singleBarData =>\n _yAxisType === YAxisType.NumericAxis\n ? _createNumericBars(\n containerHeight,\n containerWidth,\n xElement!,\n yElement!,\n singleBarData,\n xBarScale,\n yBarScale,\n )\n : _createStringBars(\n containerHeight,\n containerWidth,\n xElement!,\n yElement!,\n singleBarData,\n xBarScale,\n yBarScale,\n ),\n )\n .flat();\n }\n\n return (_bars = allBars);\n }\n\n function _createColors(): D3ScaleLinear<string, string> | ColorScale {\n const increment = _colors.length <= 1 ? 1 : 1 / (_colors.length - 1);\n const { useSingleColor = false } = props;\n if (useSingleColor) {\n return (_p?: number) => {\n const { colors } = props;\n return colors && colors.length > 0 ? colors[0] : getColorFromToken(DataVizPalette.color16);\n };\n }\n const domainValues = [];\n for (let i = 0; i < _colors.length; i++) {\n domainValues.push(increment * i * _xMax);\n }\n const colorScale = d3ScaleLinear<string>().domain(domainValues).range(_colors);\n return colorScale;\n }\n\n function _refCallback(element: SVGRectElement, legendTitle: string): void {\n _refArray.push({ index: legendTitle, refElement: element });\n }\n\n function _onBarHover(\n point: HorizontalBarChartWithAxisDataPoint,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n color: string,\n mouseEvent: React.MouseEvent<SVGElement, MouseEvent>,\n ): void {\n mouseEvent.persist();\n // eslint-disable-next-line @typescript-eslint/no-shadow\n if ((isLegendSelected === false || _isLegendHighlighted(point.legend)) && _calloutAnchorPoint !== point) {\n _calloutAnchorPoint = point;\n setPopoverOpen(true);\n _updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setDataForHoverCard(point.x);\n setSelectedLegendTitle(point.legend!);\n setColor(props.useSingleColor || props.enableGradient ? color : point.color!);\n // To display callout value, if no callout value given, taking given point.x value as a string.\n setXCalloutValue(point.yAxisCalloutData! || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData || point.x.toString());\n setDataPointCalloutProps(point);\n setCallOutAccessibilityData(point.callOutAccessibilityData);\n }\n }\n\n function _onBarLeave(): void {\n setPopoverOpen(false);\n }\n\n function _handleChartMouseLeave(): void {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n function _onBarFocus(point: HorizontalBarChartWithAxisDataPoint, refArrayIndexNumber: number, color: string): void {\n if ((isLegendSelected === false || _isLegendHighlighted(point.legend)) && _calloutAnchorPoint !== point) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n _refArray.forEach((obj: RefArrayData, index: number) => {\n if (refArrayIndexNumber === index) {\n setPopoverOpen(true);\n setSelectedLegendTitle(point.legend!);\n setDataForHoverCard(point.x);\n setColor(props.useSingleColor ? color : point.color!);\n setXCalloutValue(point.yAxisCalloutData || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData! || point.x.toString());\n setDataPointCalloutProps(point);\n setCallOutAccessibilityData(point.callOutAccessibilityData);\n }\n });\n }\n }\n\n function _getScales(\n containerHeight: number,\n containerWidth: number,\n isNumericScale: boolean,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): { xBarScale: any; yBarScale: any } {\n const xMax = _longestBarPositiveTotalValue;\n const xMin = _longestBarNegativeTotalValue;\n const xDomain = [Math.min(X_ORIGIN, xMin), Math.max(X_ORIGIN, xMax)];\n if (isNumericScale) {\n const yMax = d3Max(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.y as number)!;\n const yMin = d3Min(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.y as number)!;\n const yDomainMax = Math.max(yMax, props.yMaxValue || 0);\n // Default to 0 if yMinValue is not provided.\n const yMinProp = props.yMinValue || 0;\n const yDomainMin = Math.min(yMin, yMinProp);\n const xBarScale = d3ScaleLinear()\n .domain(xDomain)\n .nice()\n .range([_margins.left!, containerWidth - _margins.right!]);\n const yBarScale = d3ScaleLinear()\n .domain([yDomainMin, yDomainMax])\n .range([containerHeight - (_margins.bottom! + _domainMargin), _margins.top! + _domainMargin]);\n return { xBarScale, yBarScale };\n } else {\n // please note these padding default values must be consistent in here\n // and CatrtesianChartBase w for more details refer example\n // http://using-d3js.com/04_07_ordinal_scales.html\n const yBarScale = d3ScaleBand()\n .domain(_yAxisLabels)\n .range([containerHeight - (_margins.bottom! + _domainMargin), _margins.top! + _domainMargin])\n .padding(_yAxisPadding);\n\n const xBarScale = d3ScaleLinear()\n .domain(xDomain)\n .nice()\n .range([_margins.left!, containerWidth - _margins.right!]);\n return { xBarScale, yBarScale };\n }\n }\n\n function _createNumericBars(\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement,\n yElement: SVGElement,\n singleBarData: HorizontalBarChartWithAxisDataPoint[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xBarScale: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yBarScale: any,\n ): JSX.Element[] {\n const { useSingleColor = false } = props;\n const sortedBars: HorizontalBarChartWithAxisDataPoint[] = [...singleBarData];\n sortedBars.sort((a, b) => {\n const aValue = typeof a.y === 'number' ? a.y : parseFloat(a.y);\n const bValue = typeof b.y === 'number' ? b.y : parseFloat(b.y);\n return bValue - aValue;\n });\n\n let prevWidthPositive = 0;\n let prevWidthNegative = 0;\n let prevPoint = 0;\n\n const totalPositiveBars = singleBarData.filter(\n (point: HorizontalBarChartWithAxisDataPoint) => point.x >= X_ORIGIN,\n ).length;\n const totalNegativeBars = singleBarData.length - totalPositiveBars;\n let currPositiveCounter = 0;\n let currNegativeCounter = 0;\n\n const bars = sortedBars.map((point: HorizontalBarChartWithAxisDataPoint, index: number) => {\n let shouldHighlight = true;\n if (isLegendHovered || isLegendSelected) {\n shouldHighlight = _isLegendHighlighted(point.legend);\n }\n if (point.x >= X_ORIGIN) {\n ++currPositiveCounter;\n }\n if (point.x < X_ORIGIN) {\n ++currNegativeCounter;\n }\n const barStartX = _isRtl\n ? containerWidth -\n (_margins.right! + Math.max(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN)) - _margins.left!)\n : Math.min(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN));\n const barHeight: number = Math.max(yBarScale(point.y), 0);\n if (barHeight < 1) {\n return <React.Fragment key={point.x}> </React.Fragment>;\n }\n let startColor: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n startColor = props.colors ? _createColors()(1) : getNextColor(1, 0);\n } else {\n startColor = props.colors ? _createColors()(point.x) : getNextColor(index, 0);\n }\n\n startColor = point.color && !useSingleColor ? point.color : startColor;\n\n const prevBarWidth = Math.abs(xBarScale(prevPoint + X_ORIGIN) - xBarScale(X_ORIGIN));\n prevPoint > X_ORIGIN ? (prevWidthPositive += prevBarWidth) : (prevWidthNegative += prevBarWidth);\n const currentWidth = Math.abs(xBarScale(point.x + X_ORIGIN) - xBarScale(X_ORIGIN));\n const gapWidthLTR =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && currPositiveCounter !== totalPositiveBars) ||\n (point.x < X_ORIGIN && (totalPositiveBars !== 0 || currNegativeCounter > 1)))\n ? 2\n : 0;\n const gapWidthRTL =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && (totalNegativeBars !== 0 || currPositiveCounter > 1)) ||\n (point.x < X_ORIGIN && currNegativeCounter !== totalNegativeBars))\n ? 2\n : 0;\n let xStart = X_ORIGIN;\n if (_isRtl) {\n xStart = point.x > X_ORIGIN ? barStartX - prevWidthPositive : barStartX + prevWidthNegative;\n } else {\n xStart = point.x > X_ORIGIN ? barStartX + prevWidthPositive : barStartX - prevWidthNegative;\n }\n prevPoint = point.x;\n\n return (\n <React.Fragment key={`${index}_${point.x}`}>\n <rect\n key={point.y}\n x={xStart}\n y={yBarScale(point.y) - _barHeight / 2}\n data-is-focusable={shouldHighlight}\n width={currentWidth - (_isRtl ? gapWidthRTL : gapWidthLTR)}\n height={_barHeight}\n ref={(e: SVGRectElement) => {\n _refCallback(e, point.legend!);\n }}\n rx={props.roundCorners ? 3 : 0}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement, MouseEvent>) => _onBarHover(point, startColor, event)}\n aria-label={_getAriaLabel(point)}\n role=\"img\"\n aria-labelledby={`toolTip${_calloutId}`}\n onMouseLeave={_onBarLeave}\n onFocus={() => _onBarFocus(point, index, startColor)}\n onBlur={_onBarLeave}\n fill={startColor}\n opacity={shouldHighlight ? 1 : 0.1}\n tabIndex={point.legend !== '' ? 0 : undefined}\n />\n </React.Fragment>\n );\n });\n return bars;\n }\n\n function _getUniqueYValues() {\n const mapY: Record<string, number | string> = {};\n props.data?.forEach((point: HorizontalBarChartWithAxisDataPoint) => {\n mapY[point.y] = point.y;\n });\n const uniqueY = Object.values(mapY);\n return uniqueY;\n }\n\n function _calculateAppropriateBarHeight(data: number[] | Date[], totalWidth: number, innerPadding: number) {\n const result = getClosestPairDiffAndRange(data);\n if (!result || result[1] === 0) {\n return 16;\n }\n const closestPairDiff = result[0];\n let range = result[1];\n const yMax = d3Max(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.y as number)!;\n // Since we are always rendering from 0 to yMax, we need to ensure that the range is at least yMax\n // to calculate the bar height correctly.\n range = Math.max(range, yMax);\n // Refer to https://microsoft.github.io/fluentui-charting-contrib/docs/rfcs/fix-overlapping-bars-on-continuous-axes\n // for the derivation of the following formula.\n const barWidth = Math.floor(\n (totalWidth * closestPairDiff * (1 - innerPadding)) / (range + closestPairDiff * (1 - innerPadding)),\n );\n return barWidth;\n }\n\n function _getDomainMarginsForHorizontalBarChart(containerHeight: number): Margins {\n _domainMargin = MIN_DOMAIN_MARGIN;\n const uniqueY = _getUniqueYValues();\n /** Rate at which the space between the bars changes wrt the bar height */\n _yAxisPadding = _yAxisPadding === 1 ? 0.99 : _yAxisPadding;\n const barGapRate = _yAxisPadding / (1 - _yAxisPadding);\n const numBars = uniqueY.length + (uniqueY.length - 1) * barGapRate;\n // Total height available to render the bars\n const totalHeight = containerHeight - (_margins.top! + MIN_DOMAIN_MARGIN) - (_margins.bottom! + MIN_DOMAIN_MARGIN);\n if (_yAxisType !== YAxisType.StringAxis) {\n // Calculate bar height dynamically\n _barHeight =\n props.barHeight || _calculateAppropriateBarHeight(uniqueY as number[] | Date[], totalHeight, _yAxisPadding);\n _barHeight = Math.max(_barHeight, 1);\n _domainMargin += _barHeight / 2;\n } else {\n // Calculate the appropriate bar height\n _barHeight = props.barHeight || totalHeight / numBars;\n /** Total height required to render the bars. Directly proportional to bar height */\n const reqHeight = numBars * _barHeight;\n if (totalHeight >= reqHeight) {\n // Center align the chart by setting equal left and right margins for domain\n _domainMargin = MIN_DOMAIN_MARGIN + (totalHeight - reqHeight) / 2;\n }\n }\n\n return {\n ..._margins,\n top: _margins.top! + _domainMargin,\n bottom: _margins.bottom! + _domainMargin,\n };\n }\n\n function _createStringBars(\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement,\n yElement: SVGElement,\n singleBarData: HorizontalBarChartWithAxisDataPoint[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xBarScale: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yBarScale: any,\n ): JSX.Element[] {\n const { useSingleColor = false } = props;\n let prevWidthPositive = 0;\n let prevWidthNegative = 0;\n let prevPoint = 0;\n const totalPositiveBars = singleBarData.filter(\n (point: HorizontalBarChartWithAxisDataPoint) => point.x >= X_ORIGIN,\n ).length;\n const totalNegativeBars = singleBarData.length - totalPositiveBars;\n let currPositiveCounter = 0;\n let currNegativeCounter = 0;\n const bars = singleBarData.map((point: HorizontalBarChartWithAxisDataPoint, index: number) => {\n let shouldHighlight = true;\n if (isLegendHovered || isLegendSelected) {\n shouldHighlight = _isLegendHighlighted(point.legend);\n }\n if (point.x >= X_ORIGIN) {\n ++currPositiveCounter;\n }\n if (point.x < X_ORIGIN) {\n ++currNegativeCounter;\n }\n const barStartX = _isRtl\n ? containerWidth -\n (_margins.right! + Math.max(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN)) - _margins.left!)\n : Math.min(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN));\n const barHeight: number = Math.max(yBarScale(point.y), 0);\n if (barHeight < 1) {\n return <React.Fragment key={point.x}> </React.Fragment>;\n }\n let startColor: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n startColor = props.colors ? _createColors()(1) : getNextColor(1, 0);\n } else {\n startColor = props.colors ? _createColors()(point.x) : getNextColor(index, 0);\n }\n\n startColor = point.color && !useSingleColor ? point.color : startColor;\n const prevBarWidth = Math.abs(xBarScale(prevPoint + X_ORIGIN) - xBarScale(X_ORIGIN));\n prevPoint > 0 ? (prevWidthPositive += prevBarWidth) : (prevWidthNegative += prevBarWidth);\n const currentWidth = Math.abs(xBarScale(point.x + X_ORIGIN) - xBarScale(X_ORIGIN));\n const gapWidthLTR =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && currPositiveCounter !== totalPositiveBars) ||\n (point.x < X_ORIGIN && (totalPositiveBars !== 0 || currNegativeCounter > 1)))\n ? 2\n : 0;\n const gapWidthRTL =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && (totalNegativeBars !== 0 || currPositiveCounter > 1)) ||\n (point.x < X_ORIGIN && currNegativeCounter !== totalNegativeBars))\n ? 2\n : 0;\n prevPoint = point.x;\n let xStart = X_ORIGIN;\n if (_isRtl) {\n xStart = point.x > X_ORIGIN ? barStartX - prevWidthPositive : barStartX + prevWidthNegative;\n } else {\n xStart = point.x > X_ORIGIN ? barStartX + prevWidthPositive : barStartX - prevWidthNegative;\n }\n return (\n <React.Fragment key={`${index}_${point.x}`}>\n <rect\n transform={`translate(0,${0.5 * (yBarScale.bandwidth() - _barHeight)})`}\n key={point.x}\n x={xStart}\n y={yBarScale(point.y)}\n rx={props.roundCorners ? 3 : 0}\n width={currentWidth - (_isRtl ? gapWidthRTL : gapWidthLTR)}\n height={_barHeight}\n aria-labelledby={`toolTip${_calloutId}`}\n aria-label={_getAriaLabel(point)}\n role=\"img\"\n ref={(e: SVGRectElement) => {\n _refCallback(e, point.legend!);\n }}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement, MouseEvent>) => _onBarHover(point, startColor, event)}\n onMouseLeave={_onBarLeave}\n onBlur={_onBarLeave}\n data-is-focusable={shouldHighlight}\n opacity={shouldHighlight ? 1 : 0.1}\n onFocus={() => _onBarFocus(point, index, startColor)}\n fill={startColor}\n tabIndex={point.legend !== '' ? 0 : undefined}\n />\n </React.Fragment>\n );\n });\n return bars;\n }\n\n function _onLegendHover(customMessage: string): void {\n if (!_isLegendSelected()) {\n setIsLegendHovered(true);\n setSelectedLegendTitle(customMessage);\n }\n }\n\n function _onLegendLeave(isLegendFocused?: boolean): void {\n if (!!isLegendFocused || !_isLegendSelected()) {\n setIsLegendHovered(false);\n setSelectedLegendTitle('');\n setIsLegendSelected(isLegendFocused ? false : _isLegendSelected());\n }\n }\n\n function _getLegendData(data: HorizontalBarChartWithAxisDataPoint[]): JSX.Element {\n const { useSingleColor } = props;\n const actions: Legend[] = [];\n const mapLegendToColor: Record<string, string> = {};\n\n data.forEach((point: HorizontalBarChartWithAxisDataPoint, _index: number) => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const color: string = useSingleColor ? (props.colors ? _createColors()(1) : getNextColor(1, 0)) : point.color!;\n\n mapLegendToColor[point.legend!] = color;\n });\n Object.entries(mapLegendToColor).forEach(([legendTitle, color]) => {\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: legendTitle,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(legendTitle);\n },\n // eslint-disable-next-line @typescript-eslint/no-shadow\n onMouseOutAction: (isLegendSelected?: boolean) => {\n _onLegendLeave(isLegendSelected);\n },\n };\n actions.push(legend);\n });\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n onChange={_onLegendSelectionChange}\n />\n );\n return legends;\n }\n\n function _isLegendSelected(): boolean {\n return isLegendSelected!;\n }\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n function _isLegendHighlighted(legend?: string) {\n return _getHighlightedLegend().includes(legend!);\n }\n\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : selectedLegendTitle ? [selectedLegendTitle] : [];\n }\n\n function _onLegendSelectionChange(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n setSelectedLegendTitle(currentLegend?.title!);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n setSelectedLegendTitle(currentLegend?.title!);\n }\n setIsLegendSelected(selectedLegends.length > 0);\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n function _getAxisData(yAxisData: IAxisData) {\n if (yAxisData && yAxisData.yAxisDomainValues.length) {\n // For HBCWA x and y Values are swapped\n const { yAxisDomainValues: domainValue } = yAxisData;\n _xMax = Math.max(domainValue[domainValue.length - 1], props.xMaxValue || 0);\n }\n }\n function _getAriaLabel(point: HorizontalBarChartWithAxisDataPoint): string {\n const xValue = point.xAxisCalloutData || point.x;\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${xValue}. ` + `${yValue}.`;\n }\n\n function _getChartTitle(): string {\n const { chartTitle, data } = props;\n return (chartTitle ? `${chartTitle}. ` : '') + `Horizontal bar chart with ${data?.length || 0} bars. `;\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n function _updatePosition(newX: number, newY: number): void {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n function _getDomainNRangeValues(\n points: HorizontalBarChartWithAxisDataPoint[],\n margins: Margins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(\n points,\n margins,\n width,\n isRTL,\n shiftX,\n X_ORIGIN,\n );\n } else {\n domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };\n }\n return domainNRangeValue;\n }\n\n if (!_isChartEmpty()) {\n _adjustProps();\n const calloutProps: ChartPopoverProps = {\n color: color,\n legend: selectedLegendTitle,\n XValue: xCalloutValue,\n YValue: yCalloutValue ? yCalloutValue : dataForHoverCard,\n ...props.calloutProps,\n ...getAccessibleDataObject(callOutAccessibilityData),\n customCallout: {\n customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout()! : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n },\n isCartesian: true,\n isPopoverOpen,\n clickPosition,\n };\n const tickParams = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n const reversedBars = [..._points].reverse();\n _yAxisLabels = reversedBars.map((point: HorizontalBarChartWithAxisDataPoint) => point.y as string);\n _xMax = Math.max(d3Max(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.x)!, props.xMaxValue || 0);\n const legendBars: JSX.Element = _getLegendData(_points);\n return (\n <CartesianChart\n yAxisPadding={_yAxisPadding}\n {...props}\n chartTitle={_getChartTitle()}\n points={_points}\n chartType={ChartTypes.HorizontalBarChartWithAxis}\n xAxisType={_xAxisType}\n yAxisType={_yAxisType}\n getDomainNRangeValues={_getDomainNRangeValues}\n stringDatasetForYAxisDomain={_yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={legendBars}\n createYAxis={createYAxisForHorizontalBarChartWithAxis}\n createStringYAxis={createStringYAxisForHorizontalBarChartWithAxis}\n getMinMaxOfYAxis={findHBCWANumericMinMaxOfY}\n barwidth={_barHeight}\n getmargins={_getMargins}\n getYDomainMargins={_getDomainMarginsForHorizontalBarChart}\n getGraphData={_getGraphData}\n getAxisData={_getAxisData}\n onChartMouseLeave={_handleChartMouseLeave}\n componentRef={cartesianChartRef}\n /* eslint-disable react/jsx-no-bind */\n // eslint-disable-next-line @typescript-eslint/no-shadow\n children={(props: ChildProps) => {\n return (\n <>\n <g>{_bars}</g>\n </>\n );\n }}\n />\n );\n } else {\n return (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n }\n});\nHorizontalBarChartWithAxis.displayName = 'HorizontalBarChartWithAxis';\n"],"names":["React","max","d3Max","min","d3Min","scaleLinear","d3ScaleLinear","scaleBand","d3ScaleBand","Legends","useId","CartesianChart","ChartPopover","ChartTypes","getAccessibleDataObject","YAxisType","XAxisTypes","getTypeOfAxis","getNextColor","findHBCWANumericMinMaxOfY","createYAxisForHorizontalBarChartWithAxis","domainRangeOfNumericForHorizontalBarChartWithAxis","createStringYAxisForHorizontalBarChartWithAxis","areArraysEqual","useRtl","DataVizPalette","getColorFromToken","computeLongestBars","groupChartDataByYValue","MIN_DOMAIN_MARGIN","getClosestPairDiffAndRange","HorizontalBarChartWithAxis","forwardRef","props","forwardedRef","_refArray","_calloutId","_isRtl","_xAxisType","data","length","x","NumericAxis","_yAxisType","y","StringAxis","_emptyChartId","_points","_barHeight","_colors","_margins","_bars","_yAxisLabels","_xMax","_calloutAnchorPoint","_longestBarPositiveTotalValue","_longestBarNegativeTotalValue","_domainMargin","_yAxisPadding","yAxisPadding","cartesianChartRef","useRef","X_ORIGIN","color","setColor","useState","dataForHoverCard","setDataForHoverCard","isLegendSelected","setIsLegendSelected","legendProps","selectedLegends","selectedLegend","undefined","isLegendHovered","setIsLegendHovered","selectedLegendTitle","setSelectedLegendTitle","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","setSelectedLegends","dataPointCalloutProps","setDataPointCalloutProps","callOutAccessibilityData","setCallOutAccessibilityData","isPopoverOpen","setPopoverOpen","clickPosition","setClickPosition","prevPropsRef","useEffect","current","prevProps","useImperativeHandle","componentRef","chartContainer","_adjustProps","barHeight","defaultPalette","color6","color1","color5","color7","colors","_getMargins","margins","_renderContentForOnlyBars","point","useSingleColor","selectedPointIndex","forEach","yDataPoint","index","_createColors","XValue","xAxisCalloutData","toString","legend","YValue","yAxisCalloutData","culture","_renderCallout","_getCustomizedCallout","onRenderCalloutPerDataPoint","_getGraphData","xScale","yScale","containerHeight","containerWidth","xElement","yElement","stackedChartData","longestBars","longestPositiveBar","longestNegativeBar","xBarScale","yBarScale","_getScales","xRange","range","allBars","map","singleBarData","_createNumericBars","_createStringBars","flat","increment","_p","color16","domainValues","i","push","colorScale","domain","_refCallback","element","legendTitle","refElement","_onBarHover","mouseEvent","persist","_isLegendHighlighted","_updatePosition","clientX","clientY","enableGradient","_onBarLeave","_handleChartMouseLeave","_onBarFocus","refArrayIndexNumber","obj","isNumericScale","xMax","xMin","xDomain","Math","yMax","yMin","yDomainMax","yMaxValue","yMinProp","yMinValue","yDomainMin","nice","left","right","bottom","top","padding","sortedBars","sort","a","b","aValue","parseFloat","bValue","prevWidthPositive","prevWidthNegative","prevPoint","totalPositiveBars","filter","totalNegativeBars","currPositiveCounter","currNegativeCounter","bars","shouldHighlight","barStartX","Fragment","key","startColor","prevBarWidth","abs","currentWidth","gapWidthLTR","gapWidthRTL","xStart","rect","data-is-focusable","width","height","ref","e","rx","roundCorners","onClick","onMouseOver","event","aria-label","_getAriaLabel","role","aria-labelledby","onMouseLeave","onFocus","onBlur","fill","opacity","tabIndex","_getUniqueYValues","mapY","uniqueY","Object","values","_calculateAppropriateBarHeight","totalWidth","innerPadding","result","closestPairDiff","barWidth","floor","_getDomainMarginsForHorizontalBarChart","barGapRate","numBars","totalHeight","reqHeight","transform","bandwidth","_onLegendHover","customMessage","_isLegendSelected","_onLegendLeave","isLegendFocused","_getLegendData","actions","mapLegendToColor","_index","entries","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","onChange","_onLegendSelectionChange","_getHighlightedLegend","includes","currentLegend","canSelectMultipleLegends","slice","_getAxisData","yAxisData","yAxisDomainValues","domainValue","xMaxValue","xValue","yValue","ariaLabel","_getChartTitle","chartTitle","_isChartEmpty","newX","newY","threshold","distance","sqrt","pow","_getDomainNRangeValues","points","chartType","isRTL","xAxisType","tickValues","shiftX","domainNRangeValue","dStartValue","dEndValue","rStartValue","rEndValue","calloutProps","customCallout","customizedCallout","customCalloutProps","calloutPropsPerDataPoint","isCartesian","tickParams","tickFormat","reversedBars","reverse","legendBars","yAxisType","getDomainNRangeValues","stringDatasetForYAxisDomain","createYAxis","createStringYAxis","getMinMaxOfYAxis","barwidth","getmargins","getYDomainMargins","getGraphData","getAxisData","onChartMouseLeave","children","g","div","id","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ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AAeyL,MAAM;YAAS4G,OAAO;gBAAEtG,SAAS;YAAI;YAAGR,cAAY;;IAEhF;AACF,GAAG;AACHtM,2BAA2BqT,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["HorizontalBarChartWithAxis.tsx"],"sourcesContent":["import * as React from 'react';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport { scaleLinear as d3ScaleLinear, ScaleLinear as D3ScaleLinear, scaleBand as d3ScaleBand } from 'd3-scale';\nimport { Legend } from '../../components/Legends/Legends.types';\nimport { Legends } from '../../components/Legends/Legends';\nimport { useId } from '@fluentui/react-utilities';\nimport {\n AccessibilityProps,\n HorizontalBarChartWithAxisDataPoint,\n RefArrayData,\n Margins,\n ChartPopoverProps,\n Chart,\n} from '../../index';\nimport { ChildProps } from '../CommonComponents/CartesianChart.types';\nimport { CartesianChart } from '../CommonComponents/CartesianChart';\nimport { HorizontalBarChartWithAxisProps } from './HorizontalBarChartWithAxis.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport {\n ChartTypes,\n IAxisData,\n getAccessibleDataObject,\n YAxisType,\n XAxisTypes,\n NumericAxis,\n StringAxis,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n IDomainNRange,\n domainRangeOfNumericForHorizontalBarChartWithAxis,\n createStringYAxisForHorizontalBarChartWithAxis,\n areArraysEqual,\n useRtl,\n DataVizPalette,\n getColorFromToken,\n computeLongestBars,\n groupChartDataByYValue,\n MIN_DOMAIN_MARGIN,\n} from '../../utilities/index';\nimport { getClosestPairDiffAndRange } from '../../utilities/vbc-utils';\ntype ColorScale = (_p?: number) => string;\n\nexport const HorizontalBarChartWithAxis: React.FunctionComponent<HorizontalBarChartWithAxisProps> = React.forwardRef<\n HTMLDivElement,\n HorizontalBarChartWithAxisProps\n>((props, forwardedRef) => {\n const _refArray: RefArrayData[] = [];\n const _calloutId: string = useId('callout');\n const _isRtl: boolean = useRtl();\n const _xAxisType: XAxisTypes =\n props.data! && props.data!.length > 0\n ? (getTypeOfAxis(props.data![0].x, true) as XAxisTypes)\n : XAxisTypes.NumericAxis;\n const _yAxisType: YAxisType =\n props.data! && props.data!.length > 0\n ? (getTypeOfAxis(props.data![0].y, false) as YAxisType)\n : YAxisType.StringAxis;\n const _emptyChartId: string = useId('_HBCWithAxis_empty');\n let _points: HorizontalBarChartWithAxisDataPoint[] = [];\n let _barHeight: number = 0;\n let _colors: string[] = [];\n let _margins: Margins;\n let _bars: JSX.Element[];\n let _yAxisLabels: string[];\n let _xMax: number;\n let _calloutAnchorPoint: HorizontalBarChartWithAxisDataPoint | null;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _longestBarPositiveTotalValue: number;\n let _longestBarNegativeTotalValue: number;\n let _domainMargin: number = MIN_DOMAIN_MARGIN;\n let _yAxisPadding: number = props.yAxisPadding ?? 0.5;\n const cartesianChartRef = React.useRef<Chart>(null);\n const X_ORIGIN: number = 0;\n\n const [color, setColor] = React.useState<string>('');\n const [dataForHoverCard, setDataForHoverCard] = React.useState<number>(0);\n const [isLegendSelected, setIsLegendSelected] = React.useState<boolean>(\n (props.legendProps?.selectedLegends && props.legendProps.selectedLegends.length > 0) ||\n props.legendProps?.selectedLegend !== undefined,\n );\n const [isLegendHovered, setIsLegendHovered] = React.useState<boolean>(false);\n const [selectedLegendTitle, setSelectedLegendTitle] = React.useState<string>(props.legendProps?.selectedLegend ?? '');\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 [dataPointCalloutProps, setDataPointCalloutProps] = React.useState<HorizontalBarChartWithAxisDataPoint>();\n const [callOutAccessibilityData, setCallOutAccessibilityData] = React.useState<AccessibilityProps>();\n const [isPopoverOpen, setPopoverOpen] = React.useState<boolean>(false);\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const prevPropsRef = React.useRef<HorizontalBarChartWithAxisProps | null>(null);\n\n React.useEffect(() => {\n if (prevPropsRef.current) {\n const prevProps = prevPropsRef.current;\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n }\n prevPropsRef.current = props;\n }, [props]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n }),\n [],\n );\n\n function _adjustProps(): void {\n _points = props.data || [];\n _barHeight = props.barHeight || 32;\n const defaultPalette: string[] = [\n getColorFromToken(DataVizPalette.color6),\n getColorFromToken(DataVizPalette.color1),\n getColorFromToken(DataVizPalette.color5),\n getColorFromToken(DataVizPalette.color7),\n ];\n _colors = props.colors! || defaultPalette;\n }\n\n function _getMargins(margins: Margins) {\n _margins = margins;\n }\n\n function _renderContentForOnlyBars(point: HorizontalBarChartWithAxisDataPoint): JSX.Element {\n const { useSingleColor = false } = props;\n let selectedPointIndex = 0;\n props.data!.forEach((yDataPoint: HorizontalBarChartWithAxisDataPoint, index: number) => {\n if (yDataPoint.y === point.y) {\n selectedPointIndex = index;\n }\n });\n // eslint-disable-next-line @typescript-eslint/no-shadow\n let color: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n color = props.colors ? _createColors()(1) : getNextColor(1, 0);\n } else {\n color = point.color ? point.color : props.colors ? _createColors()(point.x) : getNextColor(selectedPointIndex, 0);\n }\n return (\n <>\n <ChartPopover\n XValue={point.xAxisCalloutData || point.x.toString()}\n legend={point.legend}\n YValue={point.yAxisCalloutData || point.y}\n color={color}\n culture={props.culture ?? 'en-us'}\n clickPosition={clickPosition}\n isPopoverOpen={isPopoverOpen}\n />\n </>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n function _renderCallout(props?: HorizontalBarChartWithAxisDataPoint): JSX.Element | null {\n return props ? _renderContentForOnlyBars(props) : null;\n }\n\n function _getCustomizedCallout() {\n return props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout)\n : null;\n }\n\n function _getGraphData(\n xScale: NumericAxis,\n yScale: NumericAxis | StringAxis,\n containerHeight: number,\n containerWidth: number,\n xElement?: SVGElement | null,\n yElement?: SVGElement | null,\n ) {\n const stackedChartData = groupChartDataByYValue(_points);\n const longestBars = computeLongestBars(stackedChartData, X_ORIGIN);\n _longestBarPositiveTotalValue = longestBars.longestPositiveBar;\n _longestBarNegativeTotalValue = longestBars.longestNegativeBar;\n\n const { xBarScale, yBarScale } =\n _yAxisType === YAxisType.NumericAxis\n ? _getScales(containerHeight, containerWidth, true)\n : _getScales(containerHeight, containerWidth, false);\n const xRange = xBarScale.range();\n let allBars: JSX.Element[] = [];\n // when the chart mounts, the xRange[1] is sometimes seen to be < 0 (like -40) while xRange[0] > 0.\n if (xRange[0] < xRange[1]) {\n allBars = stackedChartData\n .map(singleBarData =>\n _yAxisType === YAxisType.NumericAxis\n ? _createNumericBars(\n containerHeight,\n containerWidth,\n xElement!,\n yElement!,\n singleBarData,\n xBarScale,\n yBarScale,\n )\n : _createStringBars(\n containerHeight,\n containerWidth,\n xElement!,\n yElement!,\n singleBarData,\n xBarScale,\n yBarScale,\n ),\n )\n .flat();\n }\n\n return (_bars = allBars);\n }\n\n function _createColors(): D3ScaleLinear<string, string> | ColorScale {\n const increment = _colors.length <= 1 ? 1 : 1 / (_colors.length - 1);\n const { useSingleColor = false } = props;\n if (useSingleColor) {\n return (_p?: number) => {\n const { colors } = props;\n return colors && colors.length > 0 ? colors[0] : getColorFromToken(DataVizPalette.color16);\n };\n }\n const domainValues = [];\n for (let i = 0; i < _colors.length; i++) {\n domainValues.push(increment * i * _xMax);\n }\n const colorScale = d3ScaleLinear<string>().domain(domainValues).range(_colors);\n return colorScale;\n }\n\n function _refCallback(element: SVGRectElement, legendTitle: string): void {\n _refArray.push({ index: legendTitle, refElement: element });\n }\n\n function _onBarHover(\n point: HorizontalBarChartWithAxisDataPoint,\n // eslint-disable-next-line @typescript-eslint/no-shadow\n color: string,\n mouseEvent: React.MouseEvent<SVGElement, MouseEvent>,\n ): void {\n mouseEvent.persist();\n // eslint-disable-next-line @typescript-eslint/no-shadow\n if ((isLegendSelected === false || _isLegendHighlighted(point.legend)) && _calloutAnchorPoint !== point) {\n _calloutAnchorPoint = point;\n setPopoverOpen(true);\n _updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setDataForHoverCard(point.x);\n setSelectedLegendTitle(point.legend!);\n setColor(props.useSingleColor || props.enableGradient ? color : point.color!);\n // To display callout value, if no callout value given, taking given point.x value as a string.\n setXCalloutValue(point.yAxisCalloutData! || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData || point.x.toString());\n setDataPointCalloutProps(point);\n setCallOutAccessibilityData(point.callOutAccessibilityData);\n }\n }\n\n function _onBarLeave(): void {\n setPopoverOpen(false);\n }\n\n function _handleChartMouseLeave(): void {\n _calloutAnchorPoint = null;\n setPopoverOpen(false);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n function _onBarFocus(\n event: React.FocusEvent<SVGRectElement, Element>,\n point: HorizontalBarChartWithAxisDataPoint,\n refArrayIndexNumber: number,\n color: string,\n ): void {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (event.target as SVGRectElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n _updatePosition(cx, cy);\n if ((isLegendSelected === false || _isLegendHighlighted(point.legend)) && _calloutAnchorPoint !== point) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n _refArray.forEach((obj: RefArrayData, index: number) => {\n if (refArrayIndexNumber === index) {\n setPopoverOpen(true);\n setSelectedLegendTitle(point.legend!);\n setDataForHoverCard(point.x);\n setColor(props.useSingleColor ? color : point.color!);\n setXCalloutValue(point.yAxisCalloutData || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData! || point.x.toString());\n setDataPointCalloutProps(point);\n setCallOutAccessibilityData(point.callOutAccessibilityData);\n }\n });\n }\n }\n\n function _getScales(\n containerHeight: number,\n containerWidth: number,\n isNumericScale: boolean,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): { xBarScale: any; yBarScale: any } {\n const xMax = _longestBarPositiveTotalValue;\n const xMin = _longestBarNegativeTotalValue;\n const xDomain = [Math.min(X_ORIGIN, xMin), Math.max(X_ORIGIN, xMax)];\n if (isNumericScale) {\n const yMax = d3Max(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.y as number)!;\n const yMin = d3Min(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.y as number)!;\n const yDomainMax = Math.max(yMax, props.yMaxValue || 0);\n // Default to 0 if yMinValue is not provided.\n const yMinProp = props.yMinValue || 0;\n const yDomainMin = Math.min(yMin, yMinProp);\n const xBarScale = d3ScaleLinear()\n .domain(xDomain)\n .nice()\n .range([_margins.left!, containerWidth - _margins.right!]);\n const yBarScale = d3ScaleLinear()\n .domain([yDomainMin, yDomainMax])\n .range([containerHeight - (_margins.bottom! + _domainMargin), _margins.top! + _domainMargin]);\n return { xBarScale, yBarScale };\n } else {\n // please note these padding default values must be consistent in here\n // and CatrtesianChartBase w for more details refer example\n // http://using-d3js.com/04_07_ordinal_scales.html\n const yBarScale = d3ScaleBand()\n .domain(_yAxisLabels)\n .range([containerHeight - (_margins.bottom! + _domainMargin), _margins.top! + _domainMargin])\n .padding(_yAxisPadding);\n\n const xBarScale = d3ScaleLinear()\n .domain(xDomain)\n .nice()\n .range([_margins.left!, containerWidth - _margins.right!]);\n return { xBarScale, yBarScale };\n }\n }\n\n function _createNumericBars(\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement,\n yElement: SVGElement,\n singleBarData: HorizontalBarChartWithAxisDataPoint[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xBarScale: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yBarScale: any,\n ): JSX.Element[] {\n const { useSingleColor = false } = props;\n const sortedBars: HorizontalBarChartWithAxisDataPoint[] = [...singleBarData];\n sortedBars.sort((a, b) => {\n const aValue = typeof a.y === 'number' ? a.y : parseFloat(a.y);\n const bValue = typeof b.y === 'number' ? b.y : parseFloat(b.y);\n return bValue - aValue;\n });\n\n let prevWidthPositive = 0;\n let prevWidthNegative = 0;\n let prevPoint = 0;\n\n const totalPositiveBars = singleBarData.filter(\n (point: HorizontalBarChartWithAxisDataPoint) => point.x >= X_ORIGIN,\n ).length;\n const totalNegativeBars = singleBarData.length - totalPositiveBars;\n let currPositiveCounter = 0;\n let currNegativeCounter = 0;\n\n const bars = sortedBars.map((point: HorizontalBarChartWithAxisDataPoint, index: number) => {\n let shouldHighlight = true;\n if (isLegendHovered || isLegendSelected) {\n shouldHighlight = _isLegendHighlighted(point.legend);\n }\n if (point.x >= X_ORIGIN) {\n ++currPositiveCounter;\n }\n if (point.x < X_ORIGIN) {\n ++currNegativeCounter;\n }\n const barStartX = _isRtl\n ? containerWidth -\n (_margins.right! + Math.max(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN)) - _margins.left!)\n : Math.min(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN));\n const barHeight: number = Math.max(yBarScale(point.y), 0);\n if (barHeight < 1) {\n return <React.Fragment key={point.x}> </React.Fragment>;\n }\n let startColor: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n startColor = props.colors ? _createColors()(1) : getNextColor(1, 0);\n } else {\n startColor = props.colors ? _createColors()(point.x) : getNextColor(index, 0);\n }\n\n startColor = point.color && !useSingleColor ? point.color : startColor;\n\n const prevBarWidth = Math.abs(xBarScale(prevPoint + X_ORIGIN) - xBarScale(X_ORIGIN));\n prevPoint > X_ORIGIN ? (prevWidthPositive += prevBarWidth) : (prevWidthNegative += prevBarWidth);\n const currentWidth = Math.abs(xBarScale(point.x + X_ORIGIN) - xBarScale(X_ORIGIN));\n const gapWidthLTR =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && currPositiveCounter !== totalPositiveBars) ||\n (point.x < X_ORIGIN && (totalPositiveBars !== 0 || currNegativeCounter > 1)))\n ? 2\n : 0;\n const gapWidthRTL =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && (totalNegativeBars !== 0 || currPositiveCounter > 1)) ||\n (point.x < X_ORIGIN && currNegativeCounter !== totalNegativeBars))\n ? 2\n : 0;\n let xStart = X_ORIGIN;\n if (_isRtl) {\n xStart = point.x > X_ORIGIN ? barStartX - prevWidthPositive : barStartX + prevWidthNegative;\n } else {\n xStart = point.x > X_ORIGIN ? barStartX + prevWidthPositive : barStartX - prevWidthNegative;\n }\n prevPoint = point.x;\n\n return (\n <React.Fragment key={`${index}_${point.x}`}>\n <rect\n key={point.y}\n x={xStart}\n y={yBarScale(point.y) - _barHeight / 2}\n data-is-focusable={shouldHighlight}\n width={currentWidth - (_isRtl ? gapWidthRTL : gapWidthLTR)}\n height={_barHeight}\n ref={(e: SVGRectElement) => {\n _refCallback(e, point.legend!);\n }}\n rx={props.roundCorners ? 3 : 0}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement, MouseEvent>) => _onBarHover(point, startColor, event)}\n aria-label={_getAriaLabel(point)}\n role=\"img\"\n aria-labelledby={`toolTip${_calloutId}`}\n onMouseLeave={_onBarLeave}\n onFocus={event => _onBarFocus(event, point, index, startColor)}\n onBlur={_onBarLeave}\n fill={startColor}\n opacity={shouldHighlight ? 1 : 0.1}\n tabIndex={point.legend !== '' ? 0 : undefined}\n />\n </React.Fragment>\n );\n });\n return bars;\n }\n\n function _getUniqueYValues() {\n const mapY: Record<string, number | string> = {};\n props.data?.forEach((point: HorizontalBarChartWithAxisDataPoint) => {\n mapY[point.y] = point.y;\n });\n const uniqueY = Object.values(mapY);\n return uniqueY;\n }\n\n function _calculateAppropriateBarHeight(data: number[] | Date[], totalWidth: number, innerPadding: number) {\n const result = getClosestPairDiffAndRange(data);\n if (!result || result[1] === 0) {\n return 16;\n }\n const closestPairDiff = result[0];\n let range = result[1];\n const yMax = d3Max(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.y as number)!;\n // Since we are always rendering from 0 to yMax, we need to ensure that the range is at least yMax\n // to calculate the bar height correctly.\n range = Math.max(range, yMax);\n // Refer to https://microsoft.github.io/fluentui-charting-contrib/docs/rfcs/fix-overlapping-bars-on-continuous-axes\n // for the derivation of the following formula.\n const barWidth = Math.floor(\n (totalWidth * closestPairDiff * (1 - innerPadding)) / (range + closestPairDiff * (1 - innerPadding)),\n );\n return barWidth;\n }\n\n function _getDomainMarginsForHorizontalBarChart(containerHeight: number): Margins {\n _domainMargin = MIN_DOMAIN_MARGIN;\n const uniqueY = _getUniqueYValues();\n /** Rate at which the space between the bars changes wrt the bar height */\n _yAxisPadding = _yAxisPadding === 1 ? 0.99 : _yAxisPadding;\n const barGapRate = _yAxisPadding / (1 - _yAxisPadding);\n const numBars = uniqueY.length + (uniqueY.length - 1) * barGapRate;\n // Total height available to render the bars\n const totalHeight = containerHeight - (_margins.top! + MIN_DOMAIN_MARGIN) - (_margins.bottom! + MIN_DOMAIN_MARGIN);\n if (_yAxisType !== YAxisType.StringAxis) {\n // Calculate bar height dynamically\n _barHeight =\n props.barHeight || _calculateAppropriateBarHeight(uniqueY as number[] | Date[], totalHeight, _yAxisPadding);\n _barHeight = Math.max(_barHeight, 1);\n _domainMargin += _barHeight / 2;\n } else {\n // Calculate the appropriate bar height\n _barHeight = props.barHeight || totalHeight / numBars;\n /** Total height required to render the bars. Directly proportional to bar height */\n const reqHeight = numBars * _barHeight;\n if (totalHeight >= reqHeight) {\n // Center align the chart by setting equal left and right margins for domain\n _domainMargin = MIN_DOMAIN_MARGIN + (totalHeight - reqHeight) / 2;\n }\n }\n\n return {\n ..._margins,\n top: _margins.top! + _domainMargin,\n bottom: _margins.bottom! + _domainMargin,\n };\n }\n\n function _createStringBars(\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement,\n yElement: SVGElement,\n singleBarData: HorizontalBarChartWithAxisDataPoint[],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n xBarScale: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n yBarScale: any,\n ): JSX.Element[] {\n const { useSingleColor = false } = props;\n let prevWidthPositive = 0;\n let prevWidthNegative = 0;\n let prevPoint = 0;\n const totalPositiveBars = singleBarData.filter(\n (point: HorizontalBarChartWithAxisDataPoint) => point.x >= X_ORIGIN,\n ).length;\n const totalNegativeBars = singleBarData.length - totalPositiveBars;\n let currPositiveCounter = 0;\n let currNegativeCounter = 0;\n const bars = singleBarData.map((point: HorizontalBarChartWithAxisDataPoint, index: number) => {\n let shouldHighlight = true;\n if (isLegendHovered || isLegendSelected) {\n shouldHighlight = _isLegendHighlighted(point.legend);\n }\n if (point.x >= X_ORIGIN) {\n ++currPositiveCounter;\n }\n if (point.x < X_ORIGIN) {\n ++currNegativeCounter;\n }\n const barStartX = _isRtl\n ? containerWidth -\n (_margins.right! + Math.max(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN)) - _margins.left!)\n : Math.min(xBarScale(point.x + X_ORIGIN), xBarScale(X_ORIGIN));\n const barHeight: number = Math.max(yBarScale(point.y), 0);\n if (barHeight < 1) {\n return <React.Fragment key={point.x}> </React.Fragment>;\n }\n let startColor: string;\n if (useSingleColor) {\n //if useSingle color , then check if user has given a palette or not\n // and pick the first color from that or else from our paltette.\n startColor = props.colors ? _createColors()(1) : getNextColor(1, 0);\n } else {\n startColor = props.colors ? _createColors()(point.x) : getNextColor(index, 0);\n }\n\n startColor = point.color && !useSingleColor ? point.color : startColor;\n const prevBarWidth = Math.abs(xBarScale(prevPoint + X_ORIGIN) - xBarScale(X_ORIGIN));\n prevPoint > 0 ? (prevWidthPositive += prevBarWidth) : (prevWidthNegative += prevBarWidth);\n const currentWidth = Math.abs(xBarScale(point.x + X_ORIGIN) - xBarScale(X_ORIGIN));\n const gapWidthLTR =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && currPositiveCounter !== totalPositiveBars) ||\n (point.x < X_ORIGIN && (totalPositiveBars !== 0 || currNegativeCounter > 1)))\n ? 2\n : 0;\n const gapWidthRTL =\n currentWidth > 2 &&\n ((point.x > X_ORIGIN && (totalNegativeBars !== 0 || currPositiveCounter > 1)) ||\n (point.x < X_ORIGIN && currNegativeCounter !== totalNegativeBars))\n ? 2\n : 0;\n prevPoint = point.x;\n let xStart = X_ORIGIN;\n if (_isRtl) {\n xStart = point.x > X_ORIGIN ? barStartX - prevWidthPositive : barStartX + prevWidthNegative;\n } else {\n xStart = point.x > X_ORIGIN ? barStartX + prevWidthPositive : barStartX - prevWidthNegative;\n }\n return (\n <React.Fragment key={`${index}_${point.x}`}>\n <rect\n transform={`translate(0,${0.5 * (yBarScale.bandwidth() - _barHeight)})`}\n key={point.x}\n x={xStart}\n y={yBarScale(point.y)}\n rx={props.roundCorners ? 3 : 0}\n width={currentWidth - (_isRtl ? gapWidthRTL : gapWidthLTR)}\n height={_barHeight}\n aria-labelledby={`toolTip${_calloutId}`}\n aria-label={_getAriaLabel(point)}\n role=\"img\"\n ref={(e: SVGRectElement) => {\n _refCallback(e, point.legend!);\n }}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement, MouseEvent>) => _onBarHover(point, startColor, event)}\n onMouseLeave={_onBarLeave}\n onBlur={_onBarLeave}\n data-is-focusable={shouldHighlight}\n opacity={shouldHighlight ? 1 : 0.1}\n onFocus={event => _onBarFocus(event, point, index, startColor)}\n fill={startColor}\n tabIndex={point.legend !== '' ? 0 : undefined}\n />\n </React.Fragment>\n );\n });\n return bars;\n }\n\n function _onLegendHover(customMessage: string): void {\n if (!_isLegendSelected()) {\n setIsLegendHovered(true);\n setSelectedLegendTitle(customMessage);\n }\n }\n\n function _onLegendLeave(isLegendFocused?: boolean): void {\n if (!!isLegendFocused || !_isLegendSelected()) {\n setIsLegendHovered(false);\n setSelectedLegendTitle('');\n setIsLegendSelected(isLegendFocused ? false : _isLegendSelected());\n }\n }\n\n function _getLegendData(data: HorizontalBarChartWithAxisDataPoint[]): JSX.Element {\n const { useSingleColor } = props;\n const actions: Legend[] = [];\n const mapLegendToColor: Record<string, string> = {};\n\n data.forEach((point: HorizontalBarChartWithAxisDataPoint, _index: number) => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const color: string = useSingleColor ? (props.colors ? _createColors()(1) : getNextColor(1, 0)) : point.color!;\n\n mapLegendToColor[point.legend!] = color;\n });\n Object.entries(mapLegendToColor).forEach(([legendTitle, color]) => {\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: legendTitle,\n color,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(legendTitle);\n },\n // eslint-disable-next-line @typescript-eslint/no-shadow\n onMouseOutAction: (isLegendSelected?: boolean) => {\n _onLegendLeave(isLegendSelected);\n },\n };\n actions.push(legend);\n });\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n {...props.legendProps}\n onChange={_onLegendSelectionChange}\n />\n );\n return legends;\n }\n\n function _isLegendSelected(): boolean {\n return isLegendSelected!;\n }\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n function _isLegendHighlighted(legend?: string) {\n return _getHighlightedLegend().includes(legend!);\n }\n\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : selectedLegendTitle ? [selectedLegendTitle] : [];\n }\n\n function _onLegendSelectionChange(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n setSelectedLegendTitle(currentLegend?.title!);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n setSelectedLegendTitle(currentLegend?.title!);\n }\n setIsLegendSelected(selectedLegends.length > 0);\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n function _getAxisData(yAxisData: IAxisData) {\n if (yAxisData && yAxisData.yAxisDomainValues.length) {\n // For HBCWA x and y Values are swapped\n const { yAxisDomainValues: domainValue } = yAxisData;\n _xMax = Math.max(domainValue[domainValue.length - 1], props.xMaxValue || 0);\n }\n }\n function _getAriaLabel(point: HorizontalBarChartWithAxisDataPoint): string {\n const xValue = point.xAxisCalloutData || point.x;\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${xValue}. ` + `${yValue}.`;\n }\n\n function _getChartTitle(): string {\n const { chartTitle, data } = props;\n return (chartTitle ? `${chartTitle}. ` : '') + `Horizontal bar chart with ${data?.length || 0} bars. `;\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n function _updatePosition(newX: number, newY: number): void {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n function _getDomainNRangeValues(\n points: HorizontalBarChartWithAxisDataPoint[],\n margins: Margins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(\n points,\n margins,\n width,\n isRTL,\n shiftX,\n X_ORIGIN,\n );\n } else {\n domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };\n }\n return domainNRangeValue;\n }\n\n if (!_isChartEmpty()) {\n _adjustProps();\n const calloutProps: ChartPopoverProps = {\n color: color,\n legend: selectedLegendTitle,\n XValue: xCalloutValue,\n YValue: yCalloutValue ? yCalloutValue : dataForHoverCard,\n ...props.calloutProps,\n ...getAccessibleDataObject(callOutAccessibilityData),\n customCallout: {\n customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout()! : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n },\n isCartesian: true,\n isPopoverOpen,\n clickPosition,\n };\n const tickParams = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n const reversedBars = [..._points].reverse();\n _yAxisLabels = reversedBars.map((point: HorizontalBarChartWithAxisDataPoint) => point.y as string);\n _xMax = Math.max(d3Max(_points, (point: HorizontalBarChartWithAxisDataPoint) => point.x)!, props.xMaxValue || 0);\n const legendBars: JSX.Element = _getLegendData(_points);\n return (\n <CartesianChart\n yAxisPadding={_yAxisPadding}\n {...props}\n chartTitle={_getChartTitle()}\n points={_points}\n chartType={ChartTypes.HorizontalBarChartWithAxis}\n xAxisType={_xAxisType}\n yAxisType={_yAxisType}\n getDomainNRangeValues={_getDomainNRangeValues}\n stringDatasetForYAxisDomain={_yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={legendBars}\n createYAxis={createYAxisForHorizontalBarChartWithAxis}\n createStringYAxis={createStringYAxisForHorizontalBarChartWithAxis}\n getMinMaxOfYAxis={findHBCWANumericMinMaxOfY}\n barwidth={_barHeight}\n getmargins={_getMargins}\n getYDomainMargins={_getDomainMarginsForHorizontalBarChart}\n getGraphData={_getGraphData}\n getAxisData={_getAxisData}\n onChartMouseLeave={_handleChartMouseLeave}\n componentRef={cartesianChartRef}\n /* eslint-disable react/jsx-no-bind */\n // eslint-disable-next-line @typescript-eslint/no-shadow\n children={(props: ChildProps) => {\n return (\n <>\n <g>{_bars}</g>\n </>\n );\n }}\n />\n );\n } else {\n return (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n }\n});\nHorizontalBarChartWithAxis.displayName = 'HorizontalBarChartWithAxis';\n"],"names":["React","max","d3Max","min","d3Min","scaleLinear","d3ScaleLinear","scaleBand","d3ScaleBand","Legends","useId","CartesianChart","ChartPopover","ChartTypes","getAccessibleDataObject","YAxisType","XAxisTypes","getTypeOfAxis","getNextColor","findHBCWANumericMinMaxOfY","createYAxisForHorizontalBarChartWithAxis","domainRangeOfNumericForHorizontalBarChartWithAxis","createStringYAxisForHorizontalBarChartWithAxis","areArraysEqual","useRtl","DataVizPalette","getColorFromToken","computeLongestBars","groupChartDataByYValue","MIN_DOMAIN_MARGIN","getClosestPairDiffAndRange","HorizontalBarChartWithAxis","forwardRef","props","forwardedRef","_refArray","_calloutId","_isRtl","_xAxisType","data","length","x","NumericAxis","_yAxisType","y","StringAxis","_emptyChartId","_points","_barHeight","_colors","_margins","_bars","_yAxisLabels","_xMax","_calloutAnchorPoint","_longestBarPositiveTotalValue","_longestBarNegativeTotalValue","_domainMargin","_yAxisPadding","yAxisPadding","cartesianChartRef","useRef","X_ORIGIN","color","setColor","useState","dataForHoverCard","setDataForHoverCard","isLegendSelected","setIsLegendSelected","legendProps","selectedLegends","selectedLegend","undefined","isLegendHovered","setIsLegendHovered","selectedLegendTitle","setSelectedLegendTitle","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","setSelectedLegends","dataPointCalloutProps","setDataPointCalloutProps","callOutAccessibilityData","setCallOutAccessibilityData","isPopoverOpen","setPopoverOpen","clickPosition","setClickPosition","prevPropsRef","useEffect","current","prevProps","useImperativeHandle","componentRef","chartContainer","_adjustProps","barHeight","defaultPalette","color6","color1","color5","color7","colors","_getMargins","margins","_renderContentForOnlyBars","point","useSingleColor","selectedPointIndex","forEach","yDataPoint","index","_createColors","XValue","xAxisCalloutData","toString","legend","YValue","yAxisCalloutData","culture","_renderCallout","_getCustomizedCallout","onRenderCalloutPerDataPoint","_getGraphData","xScale","yScale","containerHeight","containerWidth","xElement","yElement","stackedChartData","longestBars","longestPositiveBar","longestNegativeBar","xBarScale","yBarScale","_getScales","xRange","range","allBars","map","singleBarData","_createNumericBars","_createStringBars","flat","increment","_p","color16","domainValues","i","push","colorScale","domain","_refCallback","element","legendTitle","refElement","_onBarHover","mouseEvent","persist","_isLegendHighlighted","_updatePosition","clientX","clientY","enableGradient","_onBarLeave","_handleChartMouseLeave","_onBarFocus","event","refArrayIndexNumber","cx","cy","targetRect","target","getBoundingClientRect","left","width","top","height","obj","isNumericScale","xMax","xMin","xDomain","Math","yMax","yMin","yDomainMax","yMaxValue","yMinProp","yMinValue","yDomainMin","nice","right","bottom","padding","sortedBars","sort","a","b","aValue","parseFloat","bValue","prevWidthPositive","prevWidthNegative","prevPoint","totalPositiveBars","filter","totalNegativeBars","currPositiveCounter","currNegativeCounter","bars","shouldHighlight","barStartX","Fragment","key","startColor","prevBarWidth","abs","currentWidth","gapWidthLTR","gapWidthRTL","xStart","rect","data-is-focusable","ref","e","rx","roundCorners","onClick","onMouseOver","aria-label","_getAriaLabel","role","aria-labelledby","onMouseLeave","onFocus","onBlur","fill","opacity","tabIndex","_getUniqueYValues","mapY","uniqueY","Object","values","_calculateAppropriateBarHeight","totalWidth","innerPadding","result","closestPairDiff","barWidth","floor","_getDomainMarginsForHorizontalBarChart","barGapRate","numBars","totalHeight","reqHeight","transform","bandwidth","_onLegendHover","customMessage","_isLegendSelected","_onLegendLeave","isLegendFocused","_getLegendData","actions","mapLegendToColor","_index","entries","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","onChange","_onLegendSelectionChange","_getHighlightedLegend","includes","currentLegend","canSelectMultipleLegends","slice","_getAxisData","yAxisData","yAxisDomainValues","domainValue","xMaxValue","xValue","yValue","ariaLabel","_getChartTitle","chartTitle","_isChartEmpty","newX","newY","threshold","distance","sqrt","pow","_getDomainNRangeValues","points","chartType","isRTL","xAxisType","tickValues","shiftX","domainNRangeValue","dStartValue","dEndValue","rStartValue","rEndValue","calloutProps","customCallout","customizedCallout","customCalloutProps","calloutPropsPerDataPoint","isCartesian","tickParams","tickFormat","reversedBars","reverse","legendBars","yAxisType","getDomainNRangeValues","stringDatasetForYAxisDomain","createYAxis","createStringYAxis","getMinMaxOfYAxis","barwidth","getmargins","getYDomainMargins","getGraphData","getAxisData","onChartMouseLeave","children","g","div","id","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,EAAEC,OAAOC,KAAK,QAAQ,WAAW;AACtD,SAASC,eAAeC,aAAa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F,cAAcnN;YACdoN,aAAalD;YACbmD,mBAAmB1K;YACnBzE,cAAcpC;YACd,oCAAoC,GACpC,wDAAwD;YACxDwR,UAAU,CAACnT;gBACT,qBACE,wDACE,oBAACoT,WAAGlS;YAGV;;IAGN,OAAO;QACL,qBACE,oBAACmS;YAAIC,IAAIzS;YAAe8L,MAAM;YAAS4G,OAAO;gBAAEtG,SAAS;YAAI;YAAGR,cAAY;;IAEhF;AACF,GAAG;AACH3M,2BAA2B0T,WAAW,GAAG"}
|
|
@@ -401,7 +401,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
401
401
|
ref: (e)=>{
|
|
402
402
|
_refCallback(e, circleId);
|
|
403
403
|
},
|
|
404
|
-
onFocus: ()=>_handleFocus(circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
404
|
+
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
405
405
|
onBlur: _handleMouseOut,
|
|
406
406
|
..._getClickHandler(_points[i].data[0].onDataPointClick)
|
|
407
407
|
}));
|
|
@@ -513,7 +513,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
513
513
|
onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
514
514
|
onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event, yScale),
|
|
515
515
|
onMouseOut: _handleMouseOut,
|
|
516
|
-
onFocus: ()=>_handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
516
|
+
onFocus: (event)=>_handleFocus(event, lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
517
517
|
onBlur: _handleMouseOut,
|
|
518
518
|
..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
|
|
519
519
|
opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
|
|
@@ -541,7 +541,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
541
541
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
542
542
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
543
543
|
onMouseOut: _handleMouseOut,
|
|
544
|
-
onFocus: ()=>_handleFocus(lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
544
|
+
onFocus: (event)=>_handleFocus(event, lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
|
|
545
545
|
onBlur: _handleMouseOut,
|
|
546
546
|
..._getClickHandler(_points[i].data[j].onDataPointClick),
|
|
547
547
|
opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
|
|
@@ -561,6 +561,7 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
561
561
|
width: 0,
|
|
562
562
|
onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
563
563
|
onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event, yScale),
|
|
564
|
+
onFocus: (event)=>_handleFocus(event, circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
|
|
564
565
|
onMouseOut: _handleMouseOut,
|
|
565
566
|
strokeWidth: 0,
|
|
566
567
|
focusable: false,
|
|
@@ -805,7 +806,13 @@ const PATH_MULTIPLY_SIZE = 2.5;
|
|
|
805
806
|
setActivePoint('');
|
|
806
807
|
}
|
|
807
808
|
};
|
|
808
|
-
function _handleFocus(lineId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
|
|
809
|
+
function _handleFocus(event, lineId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
|
|
810
|
+
let cx = 0;
|
|
811
|
+
let cy = 0;
|
|
812
|
+
const targetRect = event.target.getBoundingClientRect();
|
|
813
|
+
cx = targetRect.left + targetRect.width / 2;
|
|
814
|
+
cy = targetRect.top + targetRect.height / 2;
|
|
815
|
+
updatePosition(cx, cy);
|
|
809
816
|
_uniqueCallOutID = circleId;
|
|
810
817
|
const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;
|
|
811
818
|
const xVal = x instanceof Date ? x.getTime() : x;
|