@fluentui/react-charts 9.3.26 → 9.3.28
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 +34 -2
- package/dist/index.d.cts +61 -5
- package/dist/index.d.ts +61 -5
- package/lib/components/AreaChart/AreaChart.js +33 -3
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +6 -0
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +2 -1
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +1 -0
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +33 -12
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +25 -25
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +1 -0
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js +15 -18
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js +13 -10
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +17 -13
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +2 -1
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +1 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +1 -1
- package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +52 -44
- package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/test-data/specialChartNames.js +11 -0
- package/lib/utilities/test-data/specialChartNames.js.map +1 -0
- package/lib/utilities/utilities.js +4 -1
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.cjs +33 -3
- package/lib-commonjs/components/AreaChart/AreaChart.cjs.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.cjs +6 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.cjs.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.cjs.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.cjs +2 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.cjs.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.cjs +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.cjs.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.cjs +33 -12
- package/lib-commonjs/components/GaugeChart/GaugeChart.cjs.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.cjs.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.cjs +24 -23
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.cjs.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.cjs +1 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.cjs.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.cjs +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.cjs.map +1 -1
- package/lib-commonjs/components/Legends/Legends.cjs +15 -17
- package/lib-commonjs/components/Legends/Legends.cjs.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.cjs +12 -9
- package/lib-commonjs/components/Legends/OverflowMenu.cjs.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.cjs +17 -13
- package/lib-commonjs/components/LineChart/LineChart.cjs.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.cjs +2 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.cjs.map +1 -1
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.cjs +1 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.cjs.map +1 -1
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.cjs +52 -44
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.cjs.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.cjs +2 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.cjs.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.cjs +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.cjs.map +1 -1
- package/lib-commonjs/types/DataPoint.cjs.map +1 -1
- package/lib-commonjs/utilities/test-data/specialChartNames.cjs +21 -0
- package/lib-commonjs/utilities/test-data/specialChartNames.cjs.map +1 -0
- package/lib-commonjs/utilities/utilities.cjs +4 -1
- package/lib-commonjs/utilities/utilities.cjs.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/GanttChart/GanttChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport type { ScaleLinear, ScaleBand, ScaleTime } from 'd3-scale';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { Legend } from '../Legends/index';\nimport { Legends } from '../Legends/index';\nimport type { Margins, GanttChartDataPoint } from '../../types/DataPoint';\nimport type { ModifiedCartesianChartProps } from '../CommonComponents/index';\nimport { CartesianChart } from '../CommonComponents/index';\nimport type { GanttChartProps } from './GanttChart.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport type { ChartPopoverProps } from '../../index';\nimport type { IDomainNRange } from '../../utilities/index';\nimport {\n ChartTypes,\n YAxisType,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n createStringYAxisForHorizontalBarChartWithAxis,\n areArraysEqual,\n MIN_DOMAIN_MARGIN,\n sortAxisCategories,\n calculateAppropriateBarWidth,\n getColorFromToken,\n getScalePadding,\n getDateFormatLevel,\n} from '../../utilities/index';\nimport { formatDateToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';\nimport { useImageExport } from '../../utilities/hooks';\n\ntype NumberScale = ScaleLinear<number, number>;\ntype StringScale = ScaleBand<string>;\ntype DateScale = ScaleTime<Date, number>;\n\nconst DEFAULT_BAR_HEIGHT = 24;\nconst MIN_BAR_HEIGHT = 1;\n\nexport const GanttChart: React.FunctionComponent<GanttChartProps> = React.forwardRef<HTMLDivElement, GanttChartProps>(\n ({ useUTC = true, yAxisCategoryOrder = 'default', maxBarHeight = 24, ...props }, forwardedRef) => {\n const _barHeight = React.useRef<number>(DEFAULT_BAR_HEIGHT);\n const _margins = React.useRef<Margins>({});\n const _calloutAnchorPoint = React.useRef<GanttChartDataPoint | null>(null);\n const _emptyChartId = useId('Gantt_empty');\n const _legendId = useId('gantt_legend');\n const _legendMap = React.useRef<Record<string, { id: string; startColor: string; endColor: string }>>({});\n const _prevProps = React.useRef<Partial<GanttChartProps>>({});\n\n const [calloutColor, setCalloutColor] = React.useState<string>('');\n const [hoveredLegend, setHoveredLegend] = React.useState<string>('');\n const [calloutLegend, setCalloutLegend] = React.useState<string>('');\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 [calloutDataPoint, setCalloutDataPoint] = React.useState<GanttChartDataPoint>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const { cartesianChartRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);\n\n React.useEffect(() => {\n if (!areArraysEqual(_prevProps.current.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n _prevProps.current = props;\n }, [props]);\n\n const _points = React.useMemo(() => {\n _legendMap.current = {};\n let colorIndex = 0;\n\n return (\n props.data?.map(point => {\n const legend = `${point.legend}`;\n if (!_legendMap.current[legend]) {\n let startColor = point.color ? getColorFromToken(point.color) : getNextColor(colorIndex, 0);\n let endColor = startColor;\n\n if (props.enableGradient) {\n startColor = point.gradient?.[0]!;\n endColor = point.gradient?.[1]!;\n }\n\n _legendMap.current[legend] = { id: `${_legendId}_${colorIndex}`, startColor, endColor };\n colorIndex += 1;\n }\n\n const { startColor, endColor } = _legendMap.current[legend];\n return {\n ...point,\n color: startColor,\n ...(props.enableGradient ? { gradient: [startColor, endColor] as [string, string] } : {}),\n };\n }) ?? []\n );\n }, [props.data, props.enableGradient]);\n\n const _xAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].x.start, true) as XAxisTypes;\n }\n return XAxisTypes.DateAxis;\n }, [_points]);\n\n const _yAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].y, false) as YAxisType;\n }\n return YAxisType.StringAxis;\n }, [_points]);\n\n const _yAxisPadding = React.useMemo(() => {\n return getScalePadding(props.yAxisPadding, undefined, 1 / 2);\n }, [props.yAxisPadding]);\n\n const _dateFormatOptions = React.useMemo(() => {\n if (_xAxisType !== XAxisTypes.DateAxis) {\n return undefined;\n }\n\n let lowestFormatLevel = 100;\n let highestFormatLevel = -1;\n _points.forEach(p => {\n const startFormatLevel = getDateFormatLevel(p.x.start as Date, useUTC as boolean);\n const endFormatLevel = getDateFormatLevel(p.x.end as Date, useUTC as boolean);\n lowestFormatLevel = Math.min(lowestFormatLevel, startFormatLevel, endFormatLevel);\n highestFormatLevel = Math.max(highestFormatLevel, startFormatLevel, endFormatLevel);\n });\n\n return getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);\n }, [useUTC, _points, _xAxisType]);\n\n const _mapYValueToXValues = React.useCallback(() => {\n const yValueToXValues: Record<string, number[]> = Object.create(null);\n _points.forEach(point => {\n if (!yValueToXValues[point.y]) {\n yValueToXValues[point.y] = [];\n }\n yValueToXValues[point.y].push(+point.x.end - +point.x.start);\n });\n return yValueToXValues;\n }, [_points]);\n\n const _getOrderedYAxisLabels = React.useCallback(() => {\n const yValueToXValues = _mapYValueToXValues();\n\n if (_yAxisType !== YAxisType.StringAxis) {\n return Object.keys(yValueToXValues).sort((a, b) => +a - +b);\n }\n\n if (yAxisCategoryOrder === 'default') {\n return Object.keys(yValueToXValues).reverse();\n }\n return sortAxisCategories(yValueToXValues, yAxisCategoryOrder);\n }, [_mapYValueToXValues, _yAxisType, yAxisCategoryOrder]);\n\n const _yAxisLabels = React.useMemo(() => _getOrderedYAxisLabels(), [_getOrderedYAxisLabels]);\n\n const _getDomainNRangeValues = React.useCallback(\n (\n points: GanttChartDataPoint[],\n margins: Margins,\n containerWidth: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n ): IDomainNRange => {\n const xValues: (Date | number)[] = [];\n points.forEach(point => {\n xValues.push(point.x.start, point.x.end);\n });\n\n const xMin = d3Min(xValues) || 0;\n const xMax = d3Max(xValues) || 0;\n\n return {\n dStartValue: isRTL ? xMax : xMin,\n dEndValue: isRTL ? xMin : xMax,\n rStartValue: margins.left!,\n rEndValue: containerWidth - margins.right!,\n };\n },\n [],\n );\n\n const _getMargins = React.useCallback((margins: Margins) => {\n _margins.current = margins;\n }, []);\n\n const _getFormattedXValue = React.useCallback(\n (point: GanttChartDataPoint): string => {\n let formattedStartX: string;\n let formattedEndX: string;\n\n if (_xAxisType === XAxisTypes.DateAxis) {\n formattedStartX = formatDateToLocaleString(\n point.x.start as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n formattedEndX = formatDateToLocaleString(\n point.x.end as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n } else {\n formattedStartX = point.x.start.toString();\n formattedEndX = point.x.end.toString();\n }\n\n return `${formattedStartX} - ${formattedEndX}`;\n },\n [props.culture, useUTC, _dateFormatOptions, _xAxisType],\n );\n\n const _getCustomizedCallout = React.useCallback(() => {\n const defaultRender = (point?: GanttChartDataPoint): JSXElement | null => {\n return point ? (\n <ChartPopover\n isPopoverOpen={isPopoverOpen}\n clickPosition={clickPosition}\n XValue={point.yAxisCalloutData || point.y.toString()}\n legend={point.legend}\n YValue={point.xAxisCalloutData || _getFormattedXValue(point)}\n color={point.color}\n culture={props.culture}\n />\n ) : null;\n };\n\n return props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(calloutDataPoint, defaultRender)\n : null;\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_getFormattedXValue, calloutDataPoint, props.culture, props.onRenderCalloutPerDataPoint]);\n\n const _getAriaLabel = React.useCallback(\n (point: GanttChartDataPoint): string => {\n const xValue = point.xAxisCalloutData || _getFormattedXValue(point);\n const yValue = point.yAxisCalloutData || point.y;\n return (\n point.callOutAccessibilityData?.ariaLabel ||\n `${yValue}. ` + (point.legend ? `${point.legend}, ` : '') + `${xValue}.`\n );\n },\n [_getFormattedXValue],\n );\n\n const _getHighlightedLegend = React.useCallback(() => {\n return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];\n }, [hoveredLegend, selectedLegends]);\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 const _legendHighlighted = React.useCallback(\n (legend: string | undefined) => {\n return _getHighlightedLegend().includes(`${legend}`);\n },\n [_getHighlightedLegend],\n );\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n const _noLegendHighlighted = React.useCallback(() => {\n return _getHighlightedLegend().length === 0;\n }, [_getHighlightedLegend]);\n\n const _showCallout = React.useCallback(\n (target: React.MouseEvent<SVGElement> | React.FocusEvent<SVGElement>, point: GanttChartDataPoint) => {\n if (!(_noLegendHighlighted() || _legendHighlighted(point.legend)) || _calloutAnchorPoint.current === point) {\n return;\n }\n if ('clientX' in target && 'clientY' in target) {\n updatePosition(target.clientX, target.clientY);\n } else {\n const rect = (target.target as SVGElement).getBoundingClientRect();\n updatePosition(rect.left, rect.top);\n }\n _calloutAnchorPoint.current = point;\n setPopoverOpen(true);\n setCalloutLegend(point.legend!);\n setCalloutColor(point.color!);\n setXCalloutValue(point.yAxisCalloutData || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData! || _getFormattedXValue(point));\n setCalloutDataPoint(point);\n },\n [_getFormattedXValue, _legendHighlighted, _noLegendHighlighted],\n );\n\n const _onBarFocus = React.useCallback(\n (point: GanttChartDataPoint, focusEvent: React.FocusEvent<SVGElement>): void => {\n _showCallout(focusEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarHover = React.useCallback(\n (point: GanttChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>): void => {\n _showCallout(mouseEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarLeave = React.useCallback((): void => {\n // do nothing\n }, []);\n\n const _handleChartMouseLeave = React.useCallback((): void => {\n _calloutAnchorPoint.current = null;\n setPopoverOpen(false);\n setCalloutLegend('');\n setCalloutColor('');\n setXCalloutValue('');\n setYCalloutValue('');\n setCalloutDataPoint(undefined);\n }, []);\n\n const _getBarHeight = React.useCallback(\n (adjustedValue: number): number => {\n let barHeight: number;\n if (typeof props.barHeight === 'number') {\n barHeight = props.barHeight;\n } else {\n barHeight = adjustedValue;\n }\n if (typeof maxBarHeight === 'number') {\n barHeight = Math.min(barHeight, maxBarHeight);\n }\n barHeight = Math.max(barHeight, MIN_BAR_HEIGHT);\n return barHeight;\n },\n [maxBarHeight, props.barHeight],\n );\n\n const _getOrderedDataPoints = React.useCallback(() => {\n const result: GanttChartDataPoint[] = [];\n\n const yValueToPoints: Record<string, GanttChartDataPoint[]> = Object.create(null);\n _points.forEach(point => {\n if (!yValueToPoints[point.y]) {\n yValueToPoints[point.y] = [];\n }\n yValueToPoints[point.y].push(point);\n });\n\n for (let i = _yAxisLabels.length - 1; i >= 0; i--) {\n const yValue = _yAxisLabels[i];\n if (yValueToPoints[yValue]) {\n result.push(...yValueToPoints[yValue].sort((a, b) => +a.x.start - +b.x.start));\n }\n }\n\n return result;\n }, [_points, _yAxisLabels]);\n\n const _createBars = React.useCallback(\n ({\n xScale,\n yScalePrimary: yScale,\n }: {\n xScale: DateScale | NumberScale;\n yScalePrimary: NumberScale | StringScale;\n }): JSXElement => {\n const getGradientId = (legend: string | undefined) => {\n const legendId = _legendMap.current[`${legend}`].id;\n return `${legendId}_gradient`;\n };\n\n const gradientDefs: JSXElement[] = [];\n if (props.enableGradient) {\n Object.keys(_legendMap.current).forEach((legend: string, index: number) => {\n const { startColor, endColor } = _legendMap.current[legend];\n gradientDefs.push(\n <linearGradient key={index} id={getGradientId(legend)}>\n <stop offset=\"0\" stopColor={startColor} />\n <stop offset=\"100%\" stopColor={endColor} />\n </linearGradient>,\n );\n });\n }\n\n let scaleBandwidth = 0;\n if (_yAxisType === YAxisType.StringAxis) {\n scaleBandwidth = (yScale as StringScale).bandwidth();\n _barHeight.current = _getBarHeight(scaleBandwidth);\n }\n\n const points = _getOrderedDataPoints();\n const bars = points.map((point: GanttChartDataPoint, index: number) => {\n const rectStartX = xScale(point.x.start);\n const rectEndX = xScale(point.x.end);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rectY = yScale(point.y as any)! + (scaleBandwidth - _barHeight.current) / 2;\n\n const shouldHighlight = _noLegendHighlighted() || _legendHighlighted(point.legend);\n\n return (\n <rect\n key={index}\n x={Math.min(rectStartX, rectEndX)}\n y={rectY}\n width={Math.max(Math.abs(rectEndX - rectStartX), 2)}\n height={_barHeight.current}\n rx={props.roundCorners ? 3 : 0}\n fill={props.enableGradient ? `url(#${getGradientId(point.legend)})` : point.color}\n opacity={shouldHighlight ? 1 : 0.1}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement>) => _onBarHover(point, event)}\n onMouseLeave={_onBarLeave}\n onFocus={(event: React.FocusEvent<SVGElement>) => _onBarFocus(point, event)}\n onBlur={_onBarLeave}\n tabIndex={shouldHighlight ? 0 : -1}\n role=\"option\"\n aria-label={_getAriaLabel(point)}\n />\n );\n });\n return (\n <g role=\"listbox\" aria-label={`${points.length} ${points.length === 1 ? 'bar' : 'bars'}`}>\n {gradientDefs.length > 0 ? <defs>{gradientDefs}</defs> : null}\n {bars}\n </g>\n );\n },\n [\n _getAriaLabel,\n _getBarHeight,\n _getOrderedDataPoints,\n _legendHighlighted,\n _noLegendHighlighted,\n _onBarFocus,\n _onBarHover,\n _onBarLeave,\n _yAxisType,\n props.enableGradient,\n props.roundCorners,\n ],\n );\n\n const _onLegendHover = React.useCallback((legend: string): void => {\n setHoveredLegend(legend);\n }, []);\n\n const _onLegendLeave = React.useCallback((): void => {\n setHoveredLegend('');\n }, []);\n\n const _onLegendSelectionChange = React.useCallback(\n (_selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: Legend): void => {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(_selectedLegends);\n } else {\n setSelectedLegends(_selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(_selectedLegends, event, currentLegend);\n }\n },\n [props.legendProps],\n );\n\n const _getLegendData = React.useCallback((): JSXElement => {\n const actions: Legend[] = [];\n\n Object.keys(_legendMap.current).forEach((legendTitle: string) => {\n const legend: Legend = {\n title: legendTitle,\n color: _legendMap.current[legendTitle].startColor,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(legendTitle);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n\n actions.push(legend);\n });\n\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n onChange={_onLegendSelectionChange}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }, [\n _handleChartMouseLeave,\n _onLegendHover,\n _onLegendLeave,\n _onLegendSelectionChange,\n props.enabledLegendsWrapLines,\n props.legendProps,\n props.legendsOverflowText,\n ]);\n\n const _getChartTitle = React.useCallback((): string => {\n return (props.chartTitle ? `${props.chartTitle}. ` : '') + `Gantt chart with ${_points.length} data points. `;\n }, [_points.length, props.chartTitle]);\n\n const _isChartEmpty = React.useCallback((): boolean => {\n return _points.length === 0;\n }, [_points.length]);\n\n const _getYDomainMargins = React.useCallback(\n (containerHeight: number): Margins => {\n let domainMargin = MIN_DOMAIN_MARGIN;\n\n const ySet = new Set<string | number>();\n _points.forEach((point: GanttChartDataPoint) => {\n ySet.add(point.y);\n });\n const uniqueY = Array.from(ySet);\n\n /** Total height available to render the bars */\n const totalHeight =\n containerHeight -\n (_margins.current.top! + MIN_DOMAIN_MARGIN) -\n (_margins.current.bottom! + MIN_DOMAIN_MARGIN);\n\n if (_yAxisType !== YAxisType.StringAxis) {\n _barHeight.current = _getBarHeight(\n calculateAppropriateBarWidth(uniqueY as number[] | Date[], totalHeight, _yAxisPadding),\n );\n domainMargin += _barHeight.current / 2;\n }\n\n return {\n ..._margins.current,\n top: _margins.current.top! + domainMargin,\n bottom: _margins.current.bottom! + domainMargin,\n };\n },\n [_getBarHeight, _points, _yAxisPadding, _yAxisType],\n );\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n if (!_isChartEmpty()) {\n _barHeight.current = _getBarHeight(DEFAULT_BAR_HEIGHT);\n\n const calloutProps: ChartPopoverProps = {\n isPopoverOpen,\n clickPosition,\n color: calloutColor,\n legend: calloutLegend,\n XValue: xCalloutValue,\n YValue: yCalloutValue,\n ...props.calloutProps,\n };\n const tickParams: ModifiedCartesianChartProps['tickParams'] = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n return (\n <CartesianChart\n {...props}\n yAxisPadding={_yAxisPadding}\n chartTitle={_getChartTitle()}\n points={_points}\n chartType={ChartTypes.GanttChart}\n xAxisType={_xAxisType}\n yAxisType={_yAxisType}\n componentRef={cartesianChartRef}\n stringDatasetForYAxisDomain={_yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={_getLegendData()}\n createYAxis={createYAxisForHorizontalBarChartWithAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n createStringYAxis={createStringYAxisForHorizontalBarChartWithAxis}\n getMinMaxOfYAxis={findHBCWANumericMinMaxOfY}\n customizedCallout={_getCustomizedCallout()}\n getmargins={_getMargins}\n getYDomainMargins={_getYDomainMargins}\n onChartMouseLeave={_handleChartMouseLeave}\n useUTC={useUTC}\n children={_createBars}\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 },\n);\n\nGanttChart.displayName = 'GanttChart';\n"],"names":["React","max","d3Max","min","d3Min","useId","Legends","CartesianChart","ChartPopover","ChartTypes","YAxisType","XAxisTypes","getTypeOfAxis","getNextColor","findHBCWANumericMinMaxOfY","createYAxisForHorizontalBarChartWithAxis","createStringYAxisForHorizontalBarChartWithAxis","areArraysEqual","MIN_DOMAIN_MARGIN","sortAxisCategories","calculateAppropriateBarWidth","getColorFromToken","getScalePadding","getDateFormatLevel","formatDateToLocaleString","getMultiLevelDateTimeFormatOptions","useImageExport","DEFAULT_BAR_HEIGHT","MIN_BAR_HEIGHT","GanttChart","forwardRef","useUTC","yAxisCategoryOrder","maxBarHeight","props","forwardedRef","_barHeight","useRef","_margins","_calloutAnchorPoint","_emptyChartId","_legendId","_legendMap","_prevProps","calloutColor","setCalloutColor","useState","hoveredLegend","setHoveredLegend","calloutLegend","setCalloutLegend","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","calloutDataPoint","setCalloutDataPoint","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","cartesianChartRef","legendsRef","_legendsRef","componentRef","hideLegend","useEffect","current","_points","useMemo","colorIndex","data","map","point","legend","startColor","color","endColor","enableGradient","gradient","id","_xAxisType","length","start","DateAxis","_yAxisType","StringAxis","_yAxisPadding","yAxisPadding","undefined","_dateFormatOptions","lowestFormatLevel","highestFormatLevel","forEach","p","startFormatLevel","endFormatLevel","end","Math","_mapYValueToXValues","useCallback","yValueToXValues","Object","create","push","_getOrderedYAxisLabels","keys","sort","a","b","reverse","_yAxisLabels","_getDomainNRangeValues","points","margins","containerWidth","chartType","isRTL","xAxisType","barWidth","tickValues","xValues","xMin","xMax","dStartValue","dEndValue","rStartValue","left","rEndValue","right","_getMargins","_getFormattedXValue","formattedStartX","formattedEndX","culture","toString","_getCustomizedCallout","defaultRender","XValue","yAxisCalloutData","YValue","xAxisCalloutData","onRenderCalloutPerDataPoint","_getAriaLabel","xValue","yValue","callOutAccessibilityData","ariaLabel","_getHighlightedLegend","_legendHighlighted","includes","_noLegendHighlighted","_showCallout","target","updatePosition","clientX","clientY","rect","getBoundingClientRect","top","_onBarFocus","focusEvent","_onBarHover","mouseEvent","_onBarLeave","_handleChartMouseLeave","_getBarHeight","adjustedValue","barHeight","_getOrderedDataPoints","result","yValueToPoints","i","_createBars","xScale","yScalePrimary","yScale","getGradientId","legendId","gradientDefs","index","linearGradient","key","stop","offset","stopColor","scaleBandwidth","bandwidth","bars","rectStartX","rectEndX","rectY","shouldHighlight","width","abs","height","rx","roundCorners","fill","opacity","onClick","onMouseOver","event","onMouseLeave","onFocus","onBlur","tabIndex","role","aria-label","g","defs","_onLegendHover","_onLegendLeave","_onLegendSelectionChange","_selectedLegends","currentLegend","canSelectMultipleLegends","slice","onChange","_getLegendData","actions","legendTitle","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","legendRef","_getChartTitle","chartTitle","_isChartEmpty","_getYDomainMargins","containerHeight","domainMargin","ySet","Set","add","uniqueY","Array","from","totalHeight","bottom","newX","newY","threshold","distance","sqrt","pow","calloutProps","tickParams","tickFormat","yAxisType","stringDatasetForYAxisDomain","legendBars","createYAxis","getDomainNRangeValues","createStringYAxis","getMinMaxOfYAxis","customizedCallout","getmargins","getYDomainMargins","onChartMouseLeave","children","div","style","displayName"],"mappings":"AAAA;;;;;+BA2Ca6B;;;;;;;iEAzCU,QAAQ;yBACY,WAAW;gCAEhC,4BAA4B;uBAG1B,sBAAmB;wBAGZ,+BAA4B;8BAE9B,sCAAmC;wBAmBzD,2BAAwB;gCAC8C,4BAA4B;uBAC1E,2BAAwB;AAMvD,MAAMF,qBAAqB;AAC3B,MAAMC,iBAAiB;AAEhB,mBAAMC,WAAAA,GAAuD7B,OAAM8B,UAAU,CAClF,CAAC,EAAEC,SAAS,IAAI,EAAEC,qBAAqB,SAAS,EAAEC,eAAe,EAAE,EAAE,GAAGC,O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ClB4P,mBAAmB7H;YACnB8H,YAAYpI;YACZqI,mBAAmB7B;YACnB8B,mBAAmBnG;YACnB3I,QAAQA;YACR+O,UAAU5F;;IAGhB,OAAO;QACL,OAAA,WAAA,GACE,OAAA,aAAA,CAAC6F,OAAAA;YAAI1L,IAAI7C;YAAe4K,MAAM;YAAS4D,OAAO;gBAAEpE,SAAS;YAAI;YAAGS,cAAY;;IAEhF;AACF,GACA;AAEFxL,WAAWoP,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/GanttChart/GanttChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport type { ScaleLinear, ScaleBand, ScaleTime } from 'd3-scale';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { Legend } from '../Legends/index';\nimport { Legends } from '../Legends/index';\nimport type { Margins, GanttChartDataPoint } from '../../types/DataPoint';\nimport type { ModifiedCartesianChartProps } from '../CommonComponents/index';\nimport { CartesianChart } from '../CommonComponents/index';\nimport type { GanttChartProps } from './GanttChart.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport type { ChartPopoverProps } from '../../index';\nimport type { IDomainNRange } from '../../utilities/index';\nimport {\n ChartTypes,\n YAxisType,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n createStringYAxisForHorizontalBarChartWithAxis,\n areArraysEqual,\n MIN_DOMAIN_MARGIN,\n sortAxisCategories,\n calculateAppropriateBarWidth,\n getColorFromToken,\n getScalePadding,\n getDateFormatLevel,\n} from '../../utilities/index';\nimport { formatDateToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';\nimport { useImageExport } from '../../utilities/hooks';\n\ntype NumberScale = ScaleLinear<number, number>;\ntype StringScale = ScaleBand<string>;\ntype DateScale = ScaleTime<Date, number>;\n\nconst DEFAULT_BAR_HEIGHT = 24;\nconst MIN_BAR_HEIGHT = 1;\n\nexport const GanttChart: React.FunctionComponent<GanttChartProps> = React.forwardRef<HTMLDivElement, GanttChartProps>(\n ({ useUTC = true, yAxisCategoryOrder = 'default', maxBarHeight = 24, ...props }, forwardedRef) => {\n const _barHeight = React.useRef<number>(DEFAULT_BAR_HEIGHT);\n const _margins = React.useRef<Margins>({});\n const _calloutAnchorPoint = React.useRef<GanttChartDataPoint | null>(null);\n const _emptyChartId = useId('Gantt_empty');\n const _legendId = useId('gantt_legend');\n const _legendMap = React.useRef<Record<string, { id: string; startColor: string; endColor: string }>>({});\n const _prevProps = React.useRef<Partial<GanttChartProps>>({});\n\n const [calloutColor, setCalloutColor] = React.useState<string>('');\n const [hoveredLegend, setHoveredLegend] = React.useState<string>('');\n const [calloutLegend, setCalloutLegend] = React.useState<string>('');\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 [calloutDataPoint, setCalloutDataPoint] = React.useState<GanttChartDataPoint>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const { cartesianChartRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);\n\n React.useEffect(() => {\n if (!areArraysEqual(_prevProps.current.legendProps?.selectedLegends, props.legendProps?.selectedLegends)) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n _prevProps.current = props;\n }, [props]);\n\n const _points = React.useMemo(() => {\n _legendMap.current = {};\n let colorIndex = 0;\n\n return (\n props.data?.map(point => {\n const legend = `${point.legend}`;\n if (!_legendMap.current[legend]) {\n let startColor = point.color ? getColorFromToken(point.color) : getNextColor(colorIndex, 0);\n let endColor = startColor;\n\n if (props.enableGradient) {\n startColor = point.gradient?.[0]!;\n endColor = point.gradient?.[1]!;\n }\n\n _legendMap.current[legend] = { id: `${_legendId}_${colorIndex}`, startColor, endColor };\n colorIndex += 1;\n }\n\n const { startColor, endColor } = _legendMap.current[legend];\n return {\n ...point,\n color: startColor,\n ...(props.enableGradient ? { gradient: [startColor, endColor] as [string, string] } : {}),\n };\n }) ?? []\n );\n }, [props.data, props.enableGradient]);\n\n const _xAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].x.start, true) as XAxisTypes;\n }\n return XAxisTypes.DateAxis;\n }, [_points]);\n\n const _yAxisType = React.useMemo(() => {\n if (_points.length > 0) {\n return getTypeOfAxis(_points[0].y, false) as YAxisType;\n }\n return YAxisType.StringAxis;\n }, [_points]);\n\n const _yAxisPadding = React.useMemo(() => {\n return getScalePadding(props.yAxisPadding, undefined, 1 / 2);\n }, [props.yAxisPadding]);\n\n const _dateFormatOptions = React.useMemo(() => {\n if (_xAxisType !== XAxisTypes.DateAxis) {\n return undefined;\n }\n\n let lowestFormatLevel = 100;\n let highestFormatLevel = -1;\n _points.forEach(p => {\n const startFormatLevel = getDateFormatLevel(p.x.start as Date, useUTC as boolean);\n const endFormatLevel = getDateFormatLevel(p.x.end as Date, useUTC as boolean);\n lowestFormatLevel = Math.min(lowestFormatLevel, startFormatLevel, endFormatLevel);\n highestFormatLevel = Math.max(highestFormatLevel, startFormatLevel, endFormatLevel);\n });\n\n return getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);\n }, [useUTC, _points, _xAxisType]);\n\n const _mapYValueToXValues = React.useCallback(() => {\n const yValueToXValues: Record<string, number[]> = Object.create(null);\n _points.forEach(point => {\n if (!yValueToXValues[point.y]) {\n yValueToXValues[point.y] = [];\n }\n yValueToXValues[point.y].push(+point.x.end - +point.x.start);\n });\n return yValueToXValues;\n }, [_points]);\n\n const _getOrderedYAxisLabels = React.useCallback(() => {\n const yValueToXValues = _mapYValueToXValues();\n\n if (_yAxisType !== YAxisType.StringAxis) {\n return Object.keys(yValueToXValues).sort((a, b) => +a - +b);\n }\n\n if (yAxisCategoryOrder === 'default') {\n return Object.keys(yValueToXValues).reverse();\n }\n return sortAxisCategories(yValueToXValues, yAxisCategoryOrder);\n }, [_mapYValueToXValues, _yAxisType, yAxisCategoryOrder]);\n\n const _yAxisLabels = React.useMemo(() => _getOrderedYAxisLabels(), [_getOrderedYAxisLabels]);\n\n const _getDomainNRangeValues = React.useCallback(\n (\n points: GanttChartDataPoint[],\n margins: Margins,\n containerWidth: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n ): IDomainNRange => {\n const xValues: (Date | number)[] = [];\n points.forEach(point => {\n xValues.push(point.x.start, point.x.end);\n });\n\n const xMin = d3Min(xValues) || 0;\n const xMax = d3Max(xValues) || 0;\n\n return {\n dStartValue: isRTL ? xMax : xMin,\n dEndValue: isRTL ? xMin : xMax,\n rStartValue: margins.left!,\n rEndValue: containerWidth - margins.right!,\n };\n },\n [],\n );\n\n const _getMargins = React.useCallback((margins: Margins) => {\n _margins.current = margins;\n }, []);\n\n const _getFormattedXValue = React.useCallback(\n (point: GanttChartDataPoint): string => {\n let formattedStartX: string;\n let formattedEndX: string;\n\n if (_xAxisType === XAxisTypes.DateAxis) {\n formattedStartX = formatDateToLocaleString(\n point.x.start as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n formattedEndX = formatDateToLocaleString(\n point.x.end as Date,\n props.culture,\n useUTC as boolean,\n false,\n _dateFormatOptions,\n );\n } else {\n formattedStartX = point.x.start.toString();\n formattedEndX = point.x.end.toString();\n }\n\n return `${formattedStartX} - ${formattedEndX}`;\n },\n [props.culture, useUTC, _dateFormatOptions, _xAxisType],\n );\n\n const _getCustomizedCallout = React.useCallback(() => {\n const defaultRender = (point?: GanttChartDataPoint): JSXElement | null => {\n return point ? (\n <ChartPopover\n isPopoverOpen={isPopoverOpen}\n clickPosition={clickPosition}\n XValue={point.yAxisCalloutData || point.y.toString()}\n legend={point.legend}\n YValue={point.xAxisCalloutData || _getFormattedXValue(point)}\n color={point.color}\n culture={props.culture}\n />\n ) : null;\n };\n\n return props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(calloutDataPoint, defaultRender)\n : null;\n //eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_getFormattedXValue, calloutDataPoint, props.culture, props.onRenderCalloutPerDataPoint]);\n\n const _getAriaLabel = React.useCallback(\n (point: GanttChartDataPoint): string => {\n const xValue = point.xAxisCalloutData || _getFormattedXValue(point);\n const yValue = point.yAxisCalloutData || point.y;\n return (\n point.callOutAccessibilityData?.ariaLabel ||\n `${yValue}. ` + (point.legend ? `${point.legend}, ` : '') + `${xValue}.`\n );\n },\n [_getFormattedXValue],\n );\n\n const _getHighlightedLegend = React.useCallback(() => {\n return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];\n }, [hoveredLegend, selectedLegends]);\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 const _legendHighlighted = React.useCallback(\n (legend: string | undefined) => {\n return _getHighlightedLegend().includes(`${legend}`);\n },\n [_getHighlightedLegend],\n );\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n const _noLegendHighlighted = React.useCallback(() => {\n return _getHighlightedLegend().length === 0;\n }, [_getHighlightedLegend]);\n\n const _showCallout = React.useCallback(\n (target: React.MouseEvent<SVGElement> | React.FocusEvent<SVGElement>, point: GanttChartDataPoint) => {\n if (!(_noLegendHighlighted() || _legendHighlighted(point.legend)) || _calloutAnchorPoint.current === point) {\n return;\n }\n if ('clientX' in target && 'clientY' in target) {\n updatePosition(target.clientX, target.clientY);\n } else {\n const rect = (target.target as SVGElement).getBoundingClientRect();\n updatePosition(rect.left, rect.top);\n }\n _calloutAnchorPoint.current = point;\n setPopoverOpen(true);\n setCalloutLegend(point.legend!);\n setCalloutColor(point.color!);\n setXCalloutValue(point.yAxisCalloutData || point.y.toString());\n setYCalloutValue(point.xAxisCalloutData! || _getFormattedXValue(point));\n setCalloutDataPoint(point);\n },\n [_getFormattedXValue, _legendHighlighted, _noLegendHighlighted],\n );\n\n const _onBarFocus = React.useCallback(\n (point: GanttChartDataPoint, focusEvent: React.FocusEvent<SVGElement>): void => {\n _showCallout(focusEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarHover = React.useCallback(\n (point: GanttChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>): void => {\n _showCallout(mouseEvent, point);\n },\n [_showCallout],\n );\n\n const _onBarLeave = React.useCallback((): void => {\n // do nothing\n }, []);\n\n const _handleChartMouseLeave = React.useCallback((): void => {\n _calloutAnchorPoint.current = null;\n setPopoverOpen(false);\n setCalloutLegend('');\n setCalloutColor('');\n setXCalloutValue('');\n setYCalloutValue('');\n setCalloutDataPoint(undefined);\n }, []);\n\n const _getBarHeight = React.useCallback(\n (adjustedValue: number): number => {\n let barHeight: number;\n if (typeof props.barHeight === 'number') {\n barHeight = props.barHeight;\n } else {\n barHeight = adjustedValue;\n }\n if (typeof maxBarHeight === 'number') {\n barHeight = Math.min(barHeight, maxBarHeight);\n }\n barHeight = Math.max(barHeight, MIN_BAR_HEIGHT);\n return barHeight;\n },\n [maxBarHeight, props.barHeight],\n );\n\n const _getOrderedDataPoints = React.useCallback(() => {\n const result: GanttChartDataPoint[] = [];\n\n const yValueToPoints: Record<string, GanttChartDataPoint[]> = Object.create(null);\n _points.forEach(point => {\n if (!yValueToPoints[point.y]) {\n yValueToPoints[point.y] = [];\n }\n yValueToPoints[point.y].push(point);\n });\n\n for (let i = _yAxisLabels.length - 1; i >= 0; i--) {\n const yValue = _yAxisLabels[i];\n if (yValueToPoints[yValue]) {\n result.push(...yValueToPoints[yValue].sort((a, b) => +a.x.start - +b.x.start));\n }\n }\n\n return result;\n }, [_points, _yAxisLabels]);\n\n const _createBars = React.useCallback(\n ({\n xScale,\n yScalePrimary: yScale,\n }: {\n xScale: DateScale | NumberScale;\n yScalePrimary: NumberScale | StringScale;\n }): JSXElement => {\n const getGradientId = (legend: string | undefined) => {\n const legendId = _legendMap.current[`${legend}`].id;\n return `${legendId}_gradient`;\n };\n\n const gradientDefs: JSXElement[] = [];\n if (props.enableGradient) {\n Object.keys(_legendMap.current).forEach((legend: string, index: number) => {\n const { startColor, endColor } = _legendMap.current[legend];\n gradientDefs.push(\n <linearGradient key={index} id={getGradientId(legend)}>\n <stop offset=\"0\" stopColor={startColor} />\n <stop offset=\"100%\" stopColor={endColor} />\n </linearGradient>,\n );\n });\n }\n\n let scaleBandwidth = 0;\n if (_yAxisType === YAxisType.StringAxis) {\n scaleBandwidth = (yScale as StringScale).bandwidth();\n _barHeight.current = _getBarHeight(scaleBandwidth);\n }\n\n const points = _getOrderedDataPoints();\n const bars = points.map((point: GanttChartDataPoint, index: number) => {\n const rectStartX = xScale(point.x.start);\n const rectEndX = xScale(point.x.end);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const rectY = yScale(point.y as any)! + (scaleBandwidth - _barHeight.current) / 2;\n\n const shouldHighlight = _noLegendHighlighted() || _legendHighlighted(point.legend);\n\n return (\n <rect\n key={index}\n x={Math.min(rectStartX, rectEndX)}\n y={rectY}\n width={Math.max(Math.abs(rectEndX - rectStartX), 2)}\n height={_barHeight.current}\n rx={props.roundCorners ? 3 : 0}\n fill={props.enableGradient ? `url(#${getGradientId(point.legend)})` : point.color}\n opacity={shouldHighlight ? 1 : 0.1}\n onClick={point.onClick}\n onMouseOver={(event: React.MouseEvent<SVGElement>) => _onBarHover(point, event)}\n onMouseLeave={_onBarLeave}\n onFocus={(event: React.FocusEvent<SVGElement>) => _onBarFocus(point, event)}\n onBlur={_onBarLeave}\n tabIndex={shouldHighlight ? 0 : -1}\n role=\"option\"\n aria-label={_getAriaLabel(point)}\n />\n );\n });\n return (\n <g role=\"listbox\" aria-label={`${points.length} ${points.length === 1 ? 'bar' : 'bars'}`}>\n {gradientDefs.length > 0 ? <defs>{gradientDefs}</defs> : null}\n {bars}\n </g>\n );\n },\n [\n _getAriaLabel,\n _getBarHeight,\n _getOrderedDataPoints,\n _legendHighlighted,\n _noLegendHighlighted,\n _onBarFocus,\n _onBarHover,\n _onBarLeave,\n _yAxisType,\n props.enableGradient,\n props.roundCorners,\n ],\n );\n\n const _onLegendHover = React.useCallback((legend: string): void => {\n setHoveredLegend(legend);\n }, []);\n\n const _onLegendLeave = React.useCallback((): void => {\n setHoveredLegend('');\n }, []);\n\n const _onLegendSelectionChange = React.useCallback(\n (_selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: Legend): void => {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(_selectedLegends);\n } else {\n setSelectedLegends(_selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(_selectedLegends, event, currentLegend);\n }\n },\n [props.legendProps],\n );\n\n const _getLegendData = React.useCallback((): JSXElement => {\n const actions: Legend[] = [];\n\n Object.keys(_legendMap.current).forEach((legendTitle: string) => {\n const legend: Legend = {\n title: legendTitle,\n color: _legendMap.current[legendTitle].startColor,\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(legendTitle);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n\n actions.push(legend);\n });\n\n const legends = (\n <Legends\n legends={actions}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n onChange={_onLegendSelectionChange}\n {...props.legendProps}\n legendRef={_legendsRef}\n />\n );\n return legends;\n }, [\n _handleChartMouseLeave,\n _onLegendHover,\n _onLegendLeave,\n _onLegendSelectionChange,\n props.enabledLegendsWrapLines,\n props.legendProps,\n props.legendsOverflowText,\n ]);\n\n const _getChartTitle = React.useCallback((): string => {\n return (props.chartTitle ? `${props.chartTitle}. ` : '') + `Gantt chart with ${_points.length} data points. `;\n }, [_points.length, props.chartTitle]);\n\n const _isChartEmpty = React.useCallback((): boolean => {\n return _points.length === 0;\n }, [_points.length]);\n\n const _getYDomainMargins = React.useCallback(\n (containerHeight: number): Margins => {\n let domainMargin = MIN_DOMAIN_MARGIN;\n\n const ySet = new Set<string | number>();\n _points.forEach((point: GanttChartDataPoint) => {\n ySet.add(point.y);\n });\n const uniqueY = Array.from(ySet);\n\n /** Total height available to render the bars */\n const totalHeight =\n containerHeight -\n (_margins.current.top! + MIN_DOMAIN_MARGIN) -\n (_margins.current.bottom! + MIN_DOMAIN_MARGIN);\n\n if (_yAxisType !== YAxisType.StringAxis) {\n _barHeight.current = _getBarHeight(\n calculateAppropriateBarWidth(uniqueY as number[] | Date[], totalHeight, _yAxisPadding),\n );\n domainMargin += _barHeight.current / 2;\n }\n\n return {\n ..._margins.current,\n top: _margins.current.top! + domainMargin,\n bottom: _margins.current.bottom! + domainMargin,\n };\n },\n [_getBarHeight, _points, _yAxisPadding, _yAxisType],\n );\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n if (!_isChartEmpty()) {\n _barHeight.current = _getBarHeight(DEFAULT_BAR_HEIGHT);\n\n const calloutProps: ChartPopoverProps = {\n isPopoverOpen,\n clickPosition,\n color: calloutColor,\n legend: calloutLegend,\n XValue: xCalloutValue,\n YValue: yCalloutValue,\n ...props.calloutProps,\n };\n const tickParams: ModifiedCartesianChartProps['tickParams'] = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n\n return (\n <CartesianChart\n {...props}\n yAxisPadding={_yAxisPadding}\n chartTitle={_getChartTitle()}\n points={_points}\n chartType={ChartTypes.GanttChart}\n xAxisType={_xAxisType}\n yAxisType={_yAxisType}\n componentRef={cartesianChartRef}\n stringDatasetForYAxisDomain={_yAxisLabels}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={_getLegendData()}\n createYAxis={createYAxisForHorizontalBarChartWithAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n createStringYAxis={createStringYAxisForHorizontalBarChartWithAxis}\n getMinMaxOfYAxis={findHBCWANumericMinMaxOfY}\n customizedCallout={_getCustomizedCallout()}\n getmargins={_getMargins}\n getYDomainMargins={_getYDomainMargins}\n onChartMouseLeave={_handleChartMouseLeave}\n onChartBlur={_handleChartMouseLeave}\n useUTC={useUTC}\n children={_createBars}\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 },\n);\n\nGanttChart.displayName = 'GanttChart';\n"],"names":["React","max","d3Max","min","d3Min","useId","Legends","CartesianChart","ChartPopover","ChartTypes","YAxisType","XAxisTypes","getTypeOfAxis","getNextColor","findHBCWANumericMinMaxOfY","createYAxisForHorizontalBarChartWithAxis","createStringYAxisForHorizontalBarChartWithAxis","areArraysEqual","MIN_DOMAIN_MARGIN","sortAxisCategories","calculateAppropriateBarWidth","getColorFromToken","getScalePadding","getDateFormatLevel","formatDateToLocaleString","getMultiLevelDateTimeFormatOptions","useImageExport","DEFAULT_BAR_HEIGHT","MIN_BAR_HEIGHT","GanttChart","forwardRef","useUTC","yAxisCategoryOrder","maxBarHeight","props","forwardedRef","_barHeight","useRef","_margins","_calloutAnchorPoint","_emptyChartId","_legendId","_legendMap","_prevProps","calloutColor","setCalloutColor","useState","hoveredLegend","setHoveredLegend","calloutLegend","setCalloutLegend","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","selectedLegends","setSelectedLegends","legendProps","calloutDataPoint","setCalloutDataPoint","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","cartesianChartRef","legendsRef","_legendsRef","componentRef","hideLegend","useEffect","current","_points","useMemo","colorIndex","data","map","point","legend","startColor","color","endColor","enableGradient","gradient","id","_xAxisType","length","start","DateAxis","_yAxisType","StringAxis","_yAxisPadding","yAxisPadding","undefined","_dateFormatOptions","lowestFormatLevel","highestFormatLevel","forEach","p","startFormatLevel","endFormatLevel","end","Math","_mapYValueToXValues","useCallback","yValueToXValues","Object","create","push","_getOrderedYAxisLabels","keys","sort","a","b","reverse","_yAxisLabels","_getDomainNRangeValues","points","margins","containerWidth","chartType","isRTL","xAxisType","barWidth","tickValues","xValues","xMin","xMax","dStartValue","dEndValue","rStartValue","left","rEndValue","right","_getMargins","_getFormattedXValue","formattedStartX","formattedEndX","culture","toString","_getCustomizedCallout","defaultRender","XValue","yAxisCalloutData","YValue","xAxisCalloutData","onRenderCalloutPerDataPoint","_getAriaLabel","xValue","yValue","callOutAccessibilityData","ariaLabel","_getHighlightedLegend","_legendHighlighted","includes","_noLegendHighlighted","_showCallout","target","updatePosition","clientX","clientY","rect","getBoundingClientRect","top","_onBarFocus","focusEvent","_onBarHover","mouseEvent","_onBarLeave","_handleChartMouseLeave","_getBarHeight","adjustedValue","barHeight","_getOrderedDataPoints","result","yValueToPoints","i","_createBars","xScale","yScalePrimary","yScale","getGradientId","legendId","gradientDefs","index","linearGradient","key","stop","offset","stopColor","scaleBandwidth","bandwidth","bars","rectStartX","rectEndX","rectY","shouldHighlight","width","abs","height","rx","roundCorners","fill","opacity","onClick","onMouseOver","event","onMouseLeave","onFocus","onBlur","tabIndex","role","aria-label","g","defs","_onLegendHover","_onLegendLeave","_onLegendSelectionChange","_selectedLegends","currentLegend","canSelectMultipleLegends","slice","onChange","_getLegendData","actions","legendTitle","title","hoverAction","onMouseOutAction","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","legendRef","_getChartTitle","chartTitle","_isChartEmpty","_getYDomainMargins","containerHeight","domainMargin","ySet","Set","add","uniqueY","Array","from","totalHeight","bottom","newX","newY","threshold","distance","sqrt","pow","calloutProps","tickParams","tickFormat","yAxisType","stringDatasetForYAxisDomain","legendBars","createYAxis","getDomainNRangeValues","createStringYAxis","getMinMaxOfYAxis","customizedCallout","getmargins","getYDomainMargins","onChartMouseLeave","onChartBlur","children","div","style","displayName"],"mappings":"AAAA;;;;;+BA2Ca6B;;;;;;;iEAzCU,QAAQ;yBACY,WAAW;gCAEhC,4BAA4B;uBAG1B,sBAAmB;wBAGZ,+BAA4B;8BAE9B,sCAAmC;wBAmBzD,2BAAwB;gCAC8C,4BAA4B;uBAC1E,2BAAwB;AAMvD,MAAMF,qBAAqB;AAC3B,MAAMC,iBAAiB;AAEhB,mBAAMC,WAAAA,GAAuD7B,OAAM8B,UAAU,CAClF,CAAC,EAAEC,SAAS,IAAI,EAAEC,qBAAqB,SAAS,EAAEC,eAAe,EAAE,EAAE,GAAGC,OAAO,EAAEC;QAcRD;IAbvE,MAAME,aAAapC,OAAMqC,MAAM,CAASV;IACxC,MAAMW,WAAWtC,OAAMqC,MAAM,CAAU,CAAC;IACxC,MAAME,sBAAsBvC,OAAMqC,MAAM,CAA6B;IACrE,MAAMG,oBAAgBnC,qBAAAA,EAAM;IAC5B,MAAMoC,gBAAYpC,qBAAAA,EAAM;IACxB,MAAMqC,aAAa1C,OAAMqC,MAAM,CAAuE,CAAC;IACvG,MAAMM,aAAa3C,OAAMqC,MAAM,CAA2B,CAAC;IAE3D,MAAM,CAACO,cAAcC,gBAAgB,GAAG7C,OAAM8C,QAAQ,CAAS;IAC/D,MAAM,CAACC,eAAeC,iBAAiB,GAAGhD,OAAM8C,QAAQ,CAAS;IACjE,MAAM,CAACG,eAAeC,iBAAiB,GAAGlD,OAAM8C,QAAQ,CAAS;IACjE,MAAM,CAACK,eAAeC,iBAAiB,GAAGpD,OAAM8C,QAAQ,CAAS;IACjE,MAAM,CAACO,eAAeC,iBAAiB,GAAGtD,OAAM8C,QAAQ,CAAS;IACjE,MAAM,CAACS,iBAAiBC,mBAAmB,GAAGxD,OAAM8C,QAAQ,CAAWZ,CAAAA,CAAAA,qBAAAA,MAAMuB,WAAAA,AAAW,MAAA,QAAjBvB,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QACA,MAAMC,aAAwD;YAC5DpI,YAAY3F,MAAM2F,UAAU;YAC5BqI,YAAYhO,MAAMgO,UAAU;QAC9B;QAEA,OAAA,WAAA,GACE,OAAA,aAAA,CAAC3P,sBAAAA,EAAAA;YACE,GAAG2B,KAAK;YACT2D,cAAcD;YACdiJ,YAAYD;YACZtH,QAAQ7C;YACRgD,WAAWhH,kBAAAA,CAAWoB,UAAU;YAChC8F,WAAWrC;YACX6K,WAAWzK;YACXrB,cAAcH;YACdkM,6BAA6BhJ;YAC7B4I,cAAcA;YACdC,YAAYA;YACZI,YAAYrC;YACZsC,aAAavP,gDAAAA;YACbwP,uBAAuBlJ;YACvBmJ,mBAAmBxP,sDAAAA;YACnByP,kBAAkB3P,iCAAAA;YAClB4P,mBAAmB7H;YACnB8H,YAAYpI;YACZqI,mBAAmB7B;YACnB8B,mBAAmBnG;YACnBoG,aAAapG;YACb3I,QAAQA;YACRgP,UAAU7F;;IAGhB,OAAO;QACL,OAAA,WAAA,GACE,OAAA,aAAA,CAAC8F,OAAAA;YAAI3L,IAAI7C;YAAe4K,MAAM;YAAS6D,OAAO;gBAAErE,SAAS;YAAI;YAAGS,cAAY;;IAEhF;AACF,GACA;AAEFxL,WAAWqP,WAAW,GAAG"}
|
|
@@ -25,6 +25,9 @@ _export(exports, {
|
|
|
25
25
|
getChartValueLabel: function() {
|
|
26
26
|
return getChartValueLabel;
|
|
27
27
|
},
|
|
28
|
+
getGaugeChartSegmentLabel: function() {
|
|
29
|
+
return getGaugeChartSegmentLabel;
|
|
30
|
+
},
|
|
28
31
|
getSegmentLabel: function() {
|
|
29
32
|
return getSegmentLabel;
|
|
30
33
|
}
|
|
@@ -39,6 +42,7 @@ const _chartutilities = require("@fluentui/chart-utilities");
|
|
|
39
42
|
const _SVGTooltipText = require("../../utilities/SVGTooltipText.cjs");
|
|
40
43
|
const _index1 = require("../Legends/index.cjs");
|
|
41
44
|
const _reacttabster = require("@fluentui/react-tabster");
|
|
45
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
42
46
|
const _ChartPopover = require("../CommonComponents/ChartPopover.cjs");
|
|
43
47
|
const _hooks = require("../../utilities/hooks.cjs");
|
|
44
48
|
const GAUGE_MARGIN = 16;
|
|
@@ -96,18 +100,31 @@ const getSegmentLabel = (segment, minValue, maxValue, variant, isAriaLabel = fal
|
|
|
96
100
|
return minValue === 0 && variant === 'single-segment' ? `${segment.size} (${(segment.size / maxValue * 100).toFixed()}%)` : `${segment.start} - ${segment.end}`;
|
|
97
101
|
};
|
|
98
102
|
const getChartValueLabel = (chartValue, minValue, maxValue, chartValueFormat, forCallout = false)=>{
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
if (typeof chartValueFormat === 'function') {
|
|
104
|
+
return chartValueFormat([
|
|
105
|
+
chartValue - minValue,
|
|
106
|
+
maxValue - minValue
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
if (chartValueFormat === 'fraction') {
|
|
110
|
+
return `${chartValue}/${maxValue}`;
|
|
111
|
+
}
|
|
112
|
+
return `${(chartValue / maxValue * 100).toFixed()}%`;
|
|
113
|
+
};
|
|
114
|
+
const getGaugeChartSegmentLabel = (segment, minValue, maxValue, variant, chartValueFormat, isAriaLabel = false)=>{
|
|
115
|
+
if (minValue === 0 && variant === 'single-segment' || typeof chartValueFormat === 'function') {
|
|
116
|
+
return getSegmentLabel(segment, minValue, maxValue, variant, isAriaLabel);
|
|
117
|
+
}
|
|
118
|
+
if (!chartValueFormat || chartValueFormat === 'percentage') {
|
|
119
|
+
const startPercentage = (segment.start / maxValue * 100).toFixed();
|
|
120
|
+
const endPercentage = (segment.end / maxValue * 100).toFixed();
|
|
121
|
+
return isAriaLabel ? `${segment.legend}, ${startPercentage}% to ${endPercentage}%` : `${startPercentage}% - ${endPercentage}%`;
|
|
103
122
|
}
|
|
104
|
-
return
|
|
105
|
-
chartValue - minValue,
|
|
106
|
-
maxValue - minValue
|
|
107
|
-
]) : minValue !== 0 ? chartValue.toString() : chartValueFormat === 'fraction' ? `${chartValue}/${maxValue}` : `${(chartValue / maxValue * 100).toFixed()}%`;
|
|
123
|
+
return isAriaLabel ? `${segment.legend}, ${segment.start} to ${segment.end}` : `${segment.start} - ${segment.end}`;
|
|
108
124
|
};
|
|
109
125
|
const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
110
126
|
var _props_legendProps;
|
|
127
|
+
const _gaugeChartId = (0, _reactutilities.useId)('gauge-chart');
|
|
111
128
|
const _getMargins = ()=>{
|
|
112
129
|
const { hideMinMax, chartTitle, sublabel } = props;
|
|
113
130
|
return {
|
|
@@ -231,7 +248,7 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
231
248
|
const strokeWidth = 2;
|
|
232
249
|
const halfStrokeWidth = strokeWidth / 2;
|
|
233
250
|
const needleLength = _outerRadius - _innerRadius + EXTRA_NEEDLE_LENGTH;
|
|
234
|
-
const needleId =
|
|
251
|
+
const needleId = `${_gaugeChartId}-needle`;
|
|
235
252
|
return /*#__PURE__*/ _react.createElement("g", {
|
|
236
253
|
transform: `rotate(${rtlSafeNeedleRotation}, 0, 0)`
|
|
237
254
|
}, /*#__PURE__*/ _react.createElement("path", {
|
|
@@ -337,7 +354,7 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
337
354
|
const hoverYValues = _segments.filter((segment)=>_noLegendHighlighted() || _legendHighlighted(segment.legend)).map((segment)=>{
|
|
338
355
|
const yValue = {
|
|
339
356
|
legend: segment.legend,
|
|
340
|
-
y:
|
|
357
|
+
y: getGaugeChartSegmentLabel(segment, _minValue, _maxValue, props.variant, props.chartValueFormat),
|
|
341
358
|
color: segment.color
|
|
342
359
|
};
|
|
343
360
|
return yValue;
|
|
@@ -541,7 +558,7 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
541
558
|
"aria-label": `${_segments.length} ${_segments.length === 1 ? 'segment' : 'segments'}`
|
|
542
559
|
}, arcs.map((arc, index)=>{
|
|
543
560
|
const segment = _segments[arc.segmentIndex];
|
|
544
|
-
const arcId =
|
|
561
|
+
const arcId = `${_gaugeChartId}-arc-${index}`;
|
|
545
562
|
return /*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
546
563
|
key: index
|
|
547
564
|
}, /*#__PURE__*/ _react.createElement("path", {
|
|
@@ -552,7 +569,7 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
552
569
|
fill: segment.color,
|
|
553
570
|
opacity: _legendHighlighted(segment.legend) || _noLegendHighlighted() ? 1 : 0.1,
|
|
554
571
|
...(0, _index.getAccessibleDataObject)({
|
|
555
|
-
ariaLabel:
|
|
572
|
+
ariaLabel: getGaugeChartSegmentLabel(segment, _minValue, _maxValue, props.variant, props.chartValueFormat, true),
|
|
556
573
|
...segment.accessibilityData
|
|
557
574
|
}, 'option', true),
|
|
558
575
|
onFocus: (e)=>_handleFocus(e, segment.legend, arcId),
|
|
@@ -598,10 +615,14 @@ const GaugeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
598
615
|
customizedCallout: (_ref = (()=>{
|
|
599
616
|
const calloutData = {
|
|
600
617
|
legend: calloutLegend,
|
|
618
|
+
chartTitle: props.chartTitle,
|
|
601
619
|
chartValue: props.chartValue,
|
|
602
620
|
minValue: _minValue,
|
|
603
621
|
maxValue: _maxValue,
|
|
604
622
|
chartValueLabel: getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat, true),
|
|
623
|
+
segments: _segments.slice(0, props.segments.length).map((segment)=>({
|
|
624
|
+
...segment
|
|
625
|
+
})),
|
|
605
626
|
segmentValues: hoverYValues
|
|
606
627
|
};
|
|
607
628
|
return props.onRenderCallout ? props.onRenderCallout(calloutData, _renderCallout) : _renderCallout(calloutData);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/GaugeChart/GaugeChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useGaugeChartStyles } from './useGaugeChartStyles.styles';\nimport { select as d3Select } from 'd3-selection';\nimport { arc as d3Arc } from 'd3-shape';\nimport type { YValueHover } from '../../index';\nimport {\n Points,\n areArraysEqual,\n formatScientificLimitWidth,\n getAccessibleDataObject,\n getColorFromToken,\n getNextColor,\n pointTypes,\n useRtl,\n ChartTitle,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { SVGTooltipText } from '../../utilities/SVGTooltipText';\nimport type { Legend, LegendShape } from '../Legends/index';\nimport { Legends, Shape } from '../Legends/index';\nimport type {\n GaugeChartCalloutData,\n GaugeChartVariant,\n GaugeValueFormat,\n GaugeChartProps,\n GaugeChartSegment,\n} from './GaugeChart.types';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst GAUGE_MARGIN = 16;\nconst LABEL_WIDTH = 36;\nconst LABEL_HEIGHT = 16;\nconst LABEL_OFFSET = 4;\nconst TITLE_OFFSET = 11;\nconst EXTRA_NEEDLE_LENGTH = 4;\nexport const ARC_PADDING = 2;\nexport const BREAKPOINTS = [\n { minRadius: 52, arcWidth: 12, fontSize: 20 },\n { minRadius: 70, arcWidth: 16, fontSize: 24 },\n { minRadius: 88, arcWidth: 20, fontSize: 32 },\n { minRadius: 106, arcWidth: 24, fontSize: 32 },\n { minRadius: 124, arcWidth: 28, fontSize: 40 },\n { minRadius: 142, arcWidth: 32, fontSize: 40 },\n];\n\nexport const calcNeedleRotation = (chartValue: number, minValue: number, maxValue: number): number => {\n let needleRotation = ((chartValue - minValue) / (maxValue - minValue)) * 180;\n if (needleRotation < 0) {\n needleRotation = 0;\n } else if (needleRotation > 180) {\n needleRotation = 180;\n }\n\n return needleRotation;\n};\n\nexport const getSegmentLabel = (\n segment: ExtendedSegment,\n minValue: number,\n maxValue: number,\n variant?: GaugeChartVariant,\n isAriaLabel: boolean = false,\n): string => {\n if (isAriaLabel) {\n return minValue === 0 && variant === 'single-segment'\n ? `${segment.legend}, ${segment.size} out of ${maxValue} or ${((segment.size / maxValue) * 100).toFixed()}%`\n : `${segment.legend}, ${segment.start} to ${segment.end}`;\n }\n\n return minValue === 0 && variant === 'single-segment'\n ? `${segment.size} (${((segment.size / maxValue) * 100).toFixed()}%)`\n : `${segment.start} - ${segment.end}`;\n};\n\nexport const getChartValueLabel = (\n chartValue: number,\n minValue: number,\n maxValue: number,\n chartValueFormat?: GaugeValueFormat | ((sweepFraction: [number, number]) => string),\n forCallout: boolean = false,\n): string => {\n if (forCallout) {\n // When displaying the chart value as a percentage, use fractions in the callout, and vice versa.\n // This helps clarify the actual value and avoid repetition.\n return minValue !== 0\n ? chartValue.toString()\n : chartValueFormat === 'fraction'\n ? `${((chartValue / maxValue) * 100).toFixed()}%`\n : `${chartValue}/${maxValue}`;\n }\n\n return typeof chartValueFormat === 'function'\n ? chartValueFormat([chartValue - minValue, maxValue - minValue])\n : minValue !== 0\n ? chartValue.toString()\n : chartValueFormat === 'fraction'\n ? `${chartValue}/${maxValue}`\n : `${((chartValue / maxValue) * 100).toFixed()}%`;\n};\n\ninterface YValue extends Omit<YValueHover, 'y'> {\n y?: string | number;\n}\nexport interface ExtendedSegment extends GaugeChartSegment {\n start: number;\n end: number;\n}\n\nexport const GaugeChart: React.FunctionComponent<GaugeChartProps> = React.forwardRef<HTMLDivElement, GaugeChartProps>(\n (props, forwardedRef) => {\n const _getMargins = () => {\n const { hideMinMax, chartTitle, sublabel } = props;\n return {\n left: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,\n right: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,\n top: (chartTitle ? TITLE_OFFSET + LABEL_HEIGHT : EXTRA_NEEDLE_LENGTH / 2) + GAUGE_MARGIN,\n bottom: (sublabel ? LABEL_OFFSET + LABEL_HEIGHT : 0) + GAUGE_MARGIN,\n };\n };\n const _margins: { left: number; right: number; top: number; bottom: number } = _getMargins();\n const _legendsHeight: number = !props.hideLegend ? 32 : 0;\n const { chartContainerRef: _rootElem, legendsRef: _legendsRef } = useImageExport(\n props.componentRef,\n props.hideLegend,\n false,\n );\n const _isRTL: boolean = useRtl();\n const [width, setWidth] = React.useState<number>(140 + _getMargins().left + _getMargins().right);\n const [height, setHeight] = React.useState<number>(70 + _getMargins().top + _getMargins().bottom + _legendsHeight);\n const [hoveredLegend, setHoveredLegend] = React.useState<string>('');\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [focusedElement, setFocusedElement] = React.useState<string | undefined>('');\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const [calloutLegend, setCalloutLegend] = React.useState('');\n const [hoverYValues, setHoverYValues] = React.useState<YValue[]>([]);\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const prevPropsRef = React.useRef<GaugeChartProps | null>(null);\n const _width = props.width || width;\n const _height = props.height || height;\n const _outerRadius: number = Math.min(\n (_width - (_margins.left + _margins.right)) / 2,\n _height - (_margins.top + _margins.bottom + _legendsHeight),\n );\n const { arcWidth, chartValueSize } = _getStylesBasedOnBreakpoint();\n const _innerRadius: number = _outerRadius - arcWidth;\n let _minValue!: number;\n let _maxValue!: number;\n let _segments!: ExtendedSegment[];\n let _calloutAnchor: string = '';\n\n React.useEffect(() => {\n if (_rootElem.current) {\n setWidth(_rootElem.current.clientWidth);\n setHeight(_rootElem.current.clientHeight);\n }\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 const classes = useGaugeChartStyles(props);\n function _getStylesBasedOnBreakpoint() {\n for (let index = BREAKPOINTS.length - 1; index >= 0; index -= 1) {\n if (_outerRadius >= BREAKPOINTS[index].minRadius) {\n return {\n arcWidth: BREAKPOINTS[index].arcWidth,\n chartValueSize: BREAKPOINTS[index].fontSize,\n };\n }\n }\n return {\n arcWidth: BREAKPOINTS[0].arcWidth,\n chartValueSize: BREAKPOINTS[0].fontSize,\n };\n }\n\n function _processProps() {\n const { minValue = 0, maxValue, segments, roundCorners } = props;\n\n let total = minValue;\n const processedSegments: ExtendedSegment[] = segments.map(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (segment: { size: number; legend: any; color: string; accessibilityData: any }, index: number) => {\n const size = Math.max(segment.size, 0);\n total += size;\n return {\n legend: segment.legend,\n size,\n color:\n typeof segment.color !== 'undefined'\n ? getColorFromToken(segment.color, false)\n : getNextColor(index, 0, false),\n accessibilityData: segment.accessibilityData,\n start: total - size,\n end: total,\n };\n },\n );\n if (typeof maxValue !== 'undefined' && total < maxValue) {\n processedSegments.push({\n legend: 'Unknown',\n size: maxValue - total,\n color: 'neutralLight',\n start: total,\n end: maxValue,\n });\n total = maxValue;\n }\n\n const arcGenerator = d3Arc()\n .cornerRadius(roundCorners ? 3 : 0)\n .padAngle(ARC_PADDING / _outerRadius)\n .padRadius(_outerRadius);\n const rtlSafeSegments = _isRTL ? Array.from(processedSegments).reverse() : processedSegments;\n let prevAngle = -Math.PI / 2;\n\n const arcs = rtlSafeSegments.map((segment, index) => {\n const endAngle = prevAngle + (segment.size / (total - minValue)) * Math.PI;\n const d = arcGenerator({\n innerRadius: _innerRadius,\n outerRadius: _outerRadius,\n startAngle: prevAngle,\n endAngle,\n })!;\n prevAngle = endAngle;\n return {\n d,\n segmentIndex: _isRTL ? processedSegments.length - 1 - index : index,\n startAngle: prevAngle - (segment.size / (total - minValue)) * Math.PI,\n endAngle,\n };\n });\n\n _minValue = minValue;\n _maxValue = total;\n _segments = processedSegments;\n\n return {\n arcs,\n };\n }\n\n function _renderNeedle() {\n const needleRotation = calcNeedleRotation(props.chartValue, _minValue, _maxValue);\n const rtlSafeNeedleRotation = _isRTL ? 180 - needleRotation : needleRotation;\n const strokeWidth = 2;\n const halfStrokeWidth = strokeWidth / 2;\n const needleLength = _outerRadius - _innerRadius + EXTRA_NEEDLE_LENGTH;\n const needleId = `gauge-chart-needle`;\n return (\n <g transform={`rotate(${rtlSafeNeedleRotation}, 0, 0)`}>\n <path\n d={`\n M 0,${-halfStrokeWidth - 3}\n L ${-needleLength},${-halfStrokeWidth - 1}\n A ${halfStrokeWidth + 1},${halfStrokeWidth + 1},0,0,0,${-needleLength},${halfStrokeWidth + 1}\n L 0,${halfStrokeWidth + 3}\n A ${halfStrokeWidth + 3},${halfStrokeWidth + 3},0,0,0,0,${-halfStrokeWidth - 3}\n `}\n id={needleId}\n strokeWidth={strokeWidth}\n className={classes.needle}\n transform={`translate(${-_innerRadius + EXTRA_NEEDLE_LENGTH / 2})`}\n data-is-focusable={true}\n onFocus={e => _handleFocus(e, 'Needle', needleId)}\n onBlur={_handleBlur}\n onMouseEnter={e => _handleMouseOver(e, 'Needle', needleId)}\n onMouseMove={e => _handleMouseOver(e, 'Needle', needleId)}\n role=\"img\"\n aria-label={\n 'Current value: ' + getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat)\n }\n />\n </g>\n );\n }\n\n function _renderLegends() {\n if (props.hideLegend) {\n return null;\n }\n\n const legends: Legend[] = _segments.map((segment, index) => {\n const color: string = segment.color || getNextColor(index, 0, false);\n\n return {\n title: segment.legend,\n color,\n hoverAction: () => {\n setHoveredLegend(segment.legend);\n },\n onMouseOutAction: () => {\n setHoveredLegend('');\n },\n };\n });\n\n return (\n <div className={classes.legendsContainer}>\n <Legends\n legends={legends}\n centerLegends\n {...props.legendProps}\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n </div>\n );\n }\n\n function _onLegendSelectionChange(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n function _legendHighlighted(legend: string) {\n return _getHighlightedLegend().includes(legend!);\n }\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n function _noLegendHighlighted() {\n return _getHighlightedLegend().length === 0;\n }\n\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n function _handleFocus(focusEvent: React.FocusEvent<SVGElement>, focusedElement: string, elementId?: string) {\n _showCallout(focusEvent, focusedElement, true, elementId);\n }\n\n function _handleBlur() {\n _hideCallout(true);\n }\n\n function _handleMouseOver(mouseEvent: React.MouseEvent<SVGElement>, hoveredElement: string, elementId?: string) {\n _showCallout(mouseEvent, hoveredElement, false, elementId);\n }\n\n function _handleMouseOut() {\n _hideCallout(false);\n }\n\n function _handleCalloutDismiss() {\n _hideCallout(false);\n }\n\n function _showCallout(\n event: React.MouseEvent<SVGElement, MouseEvent> | React.FocusEvent<SVGElement, Element>,\n legend: string,\n isFocusEvent: boolean,\n elementId?: string,\n ) {\n if (_calloutAnchor === legend) {\n return;\n }\n const targetElement = elementId\n ? document.getElementById(elementId)\n : (event.currentTarget as unknown as HTMLElement);\n _calloutAnchor = legend;\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const hoverYValues: YValue[] = _segments\n .filter(segment => _noLegendHighlighted() || _legendHighlighted(segment.legend))\n .map(segment => {\n const yValue: YValue = {\n legend: segment.legend,\n y: getSegmentLabel(segment, _minValue, _maxValue, props.variant),\n color: segment.color,\n };\n return yValue;\n });\n setPopoverOpen(\n ['Needle', 'Chart value'].includes(legend) || _noLegendHighlighted() || _legendHighlighted(legend),\n );\n setRefSelected(targetElement);\n setCalloutLegend(legend);\n setHoverYValues(hoverYValues);\n if (isFocusEvent) {\n setFocusedElement(legend);\n }\n }\n\n function _hideCallout(isBlurEvent?: boolean) {\n _calloutAnchor = '';\n setPopoverOpen(false);\n setCalloutLegend('');\n setHoverYValues([]);\n if (isBlurEvent) {\n setFocusedElement('');\n }\n }\n\n function _wrapContent(content: string, id: string, maxWidth: number) {\n const textElement = d3Select<SVGTextElement, {}>(`#${id}`);\n textElement.text(content);\n if (!textElement.node()) {\n return false;\n }\n\n let isOverflowing = false;\n let textLength = textElement.node()!.getComputedTextLength();\n while (textLength > maxWidth && content.length > 0) {\n content = content.slice(0, -1);\n textElement.text(content + '...');\n isOverflowing = true;\n textLength = textElement.node()!.getComputedTextLength();\n }\n return isOverflowing;\n }\n\n // TO DO: Write a common functional component for Multi value callout and divide sub count method\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _multiValueCallout(calloutProps: any) {\n const yValueHoverSubCountsExists: boolean = _yValueHoverSubCountsExists(calloutProps.YValueHover);\n return (\n <div className={classes.calloutContentRoot}>\n <div\n className={classes.calloutDateTimeContainer}\n style={yValueHoverSubCountsExists ? { marginBottom: '11px' } : {}}\n >\n <div\n className={classes.calloutContentX}\n {...getAccessibleDataObject(calloutProps!.xAxisCalloutAccessibilityData, 'text', false)}\n >\n {formatToLocaleString(calloutProps!.hoverXValue, props.culture) as React.ReactNode}\n </div>\n </div>\n <div className={classes.calloutInfoContainer} style={yValueHoverSubCountsExists ? { display: 'flex' } : {}}>\n {calloutProps!.YValueHover &&\n calloutProps!.YValueHover.map((yValue: YValueHover, index: number, yValues: YValueHover[]) => {\n const isLast: boolean = index + 1 === yValues.length;\n const { shouldDrawBorderBottom = false } = yValue;\n return (\n <div\n {...getAccessibleDataObject(yValue.callOutAccessibilityData, 'text', false)}\n key={`callout-content-${index}`}\n style={\n yValueHoverSubCountsExists\n ? {\n display: 'inline-block',\n ...(shouldDrawBorderBottom && {\n paddingBottom: '10px',\n }),\n }\n : {\n ...(shouldDrawBorderBottom && {\n paddingBottom: '10px',\n }),\n }\n }\n >\n {_getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)}\n </div>\n );\n })}\n {!!calloutProps.descriptionMessage && (\n <div className={classes.descriptionMessage}>{calloutProps.descriptionMessage}</div>\n )}\n </div>\n </div>\n );\n }\n\n function _renderCallout(calloutData?: GaugeChartCalloutData): React.ReactElement | null {\n return calloutData\n ? _multiValueCallout({\n hoverXValue: `Current value is ${calloutData.chartValueLabel}`,\n YValueHover: calloutData.segmentValues,\n })\n : null;\n }\n\n function _yValueHoverSubCountsExists(yValueHover?: YValueHover[]) {\n if (yValueHover) {\n return yValueHover.some(\n (yValue: {\n legend?: string;\n y?: number;\n color?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n }) => yValue.yAxisCalloutData && typeof yValue.yAxisCalloutData !== 'string',\n );\n }\n return false;\n }\n\n function _getCalloutContent(\n xValue: YValueHover,\n index: number,\n yValueHoverSubCountsExists: boolean,\n isLast: boolean,\n ): React.ReactNode {\n const marginStyle: React.CSSProperties = isLast ? {} : { marginRight: '16px' };\n const toDrawShape = xValue.index !== undefined && xValue.index !== -1;\n const { culture } = props;\n const yValue = formatToLocaleString(xValue.y, culture) as React.ReactNode;\n if (!xValue.yAxisCalloutData || typeof xValue.yAxisCalloutData === 'string') {\n return (\n <div style={yValueHoverSubCountsExists ? marginStyle : {}}>\n {yValueHoverSubCountsExists && (\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n )}\n <div\n id={`${index}_${xValue.y}`}\n className={classes.calloutBlockContainer}\n style={{ borderInlineStart: `4px solid ${xValue.color}` }}\n >\n {toDrawShape && (\n <Shape\n svgProps={{\n className: classes.shapeStyles,\n }}\n pathProps={{ fill: xValue.color }}\n shape={Points[xValue.index! % Object.keys(pointTypes).length] as LegendShape}\n style={{ display: 'flex' }}\n />\n )}\n <div>\n <div className={classes.calloutlegendText}> {xValue.legend}</div>\n <div className={classes.calloutContentY}>\n {\n formatToLocaleString(\n xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data,\n culture,\n ) as React.ReactNode\n }\n </div>\n </div>\n </div>\n </div>\n );\n } else {\n const subcounts: { [id: string]: number } = xValue.yAxisCalloutData as { [id: string]: number };\n return (\n <div style={marginStyle}>\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n {Object.keys(subcounts).map((subcountName: string) => {\n return (\n <div key={subcountName} className={classes.calloutBlockContainer}>\n <div className={classes.calloutlegendText}>\n {' '}\n {formatToLocaleString(subcountName, culture) as React.ReactNode}\n </div>\n <div className={classes.calloutContentY}>\n {formatToLocaleString(subcounts[subcountName], culture) as React.ReactNode}\n </div>\n </div>\n );\n })}\n </div>\n );\n }\n }\n\n function _getChartTitle(): string {\n const { chartTitle } = props;\n return (chartTitle ? `${chartTitle}. ` : '') + `Gauge chart with ${_segments.length} segments. `;\n }\n const { arcs } = _processProps();\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n return (\n <div\n className={classes.root}\n ref={el => {\n _rootElem.current = el;\n }}\n >\n <div className={classes.chartWrapper} {...arrowAttributes}>\n <svg\n className={classes.chart}\n width={_width}\n height={_height - _legendsHeight}\n role=\"region\"\n aria-label={_getChartTitle()}\n onMouseLeave={_handleMouseOut}\n >\n <g transform={`translate(${_width / 2}, ${_height - (_margins.bottom + _legendsHeight)})`}>\n {props.chartTitle && (\n <ChartTitle\n title={props.chartTitle}\n x={0}\n y={-(_outerRadius + TITLE_OFFSET)}\n className={classes.chartTitle}\n titleStyles={props.titleStyles}\n tooltipClassName={classes.svgTooltip}\n />\n )}\n {!props.hideMinMax && (\n <>\n <text\n x={(_isRTL ? 1 : -1) * (_outerRadius + LABEL_OFFSET)}\n y={0}\n textAnchor=\"end\"\n className={classes.limits}\n role=\"img\"\n aria-label={`Min value: ${_minValue}`}\n >\n {formatScientificLimitWidth(_minValue)}\n </text>\n <text\n x={(_isRTL ? -1 : 1) * (_outerRadius + LABEL_OFFSET)}\n y={0}\n textAnchor=\"start\"\n className={classes.limits}\n role=\"img\"\n aria-label={`Max value: ${_maxValue}`}\n >\n {formatScientificLimitWidth(_maxValue)}\n </text>\n </>\n )}\n <g role=\"listbox\" aria-label={`${_segments.length} ${_segments.length === 1 ? 'segment' : 'segments'}`}>\n {arcs.map((arc, index) => {\n const segment = _segments[arc.segmentIndex];\n const arcId = `gauge-chart-arc-${index}`;\n return (\n <React.Fragment key={index}>\n <path\n d={arc.d}\n id={arcId}\n strokeWidth={focusedElement === segment.legend ? ARC_PADDING : 0}\n className={classes.segment}\n fill={segment.color}\n opacity={_legendHighlighted(segment.legend) || _noLegendHighlighted() ? 1 : 0.1}\n {...getAccessibleDataObject(\n {\n ariaLabel: getSegmentLabel(segment, _minValue, _maxValue, props.variant, true),\n ...segment.accessibilityData,\n },\n 'option',\n true,\n )}\n onFocus={e => _handleFocus(e, segment.legend, arcId)}\n onBlur={_handleBlur}\n onMouseEnter={e => _handleMouseOver(e, segment.legend, arcId)}\n onMouseLeave={e => _handleCalloutDismiss()}\n onMouseMove={e => _handleMouseOver(e, segment.legend, arcId)}\n tabIndex={_legendHighlighted(segment.legend) || _noLegendHighlighted() ? 0 : undefined}\n />\n </React.Fragment>\n );\n })}\n </g>\n {_renderNeedle()}\n <g\n onMouseEnter={e => _handleMouseOver(e, 'Chart value')}\n onMouseMove={e => _handleMouseOver(e, 'Chart value')}\n >\n <SVGTooltipText\n content={getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat)}\n textProps={{\n x: 0,\n y: 0,\n textAnchor: 'middle',\n className: classes.chartValue,\n fontSize: chartValueSize,\n 'aria-hidden': 'true',\n }}\n maxWidth={_innerRadius * 2 - 24}\n wrapContent={_wrapContent}\n />\n </g>\n {props.sublabel && (\n <SVGTooltipText\n content={props.sublabel}\n textProps={{\n x: 0,\n y: 4,\n textAnchor: 'middle',\n dominantBaseline: 'hanging',\n className: classes.sublabel,\n }}\n maxWidth={_innerRadius * 2}\n wrapContent={_wrapContent}\n />\n )}\n </g>\n </svg>\n </div>\n {_renderLegends()}\n {!props.hideTooltip && isPopoverOpen && (\n <ChartPopover\n {...props.calloutProps}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={isPopoverOpen}\n customCallout={{\n customizedCallout:\n (() => {\n const calloutData: GaugeChartCalloutData = {\n legend: calloutLegend,\n chartValue: props.chartValue,\n minValue: _minValue,\n maxValue: _maxValue,\n chartValueLabel: getChartValueLabel(\n props.chartValue,\n _minValue,\n _maxValue,\n props.chartValueFormat,\n true,\n ),\n segmentValues: hoverYValues,\n };\n\n return props.onRenderCallout\n ? props.onRenderCallout(calloutData, _renderCallout)\n : _renderCallout(calloutData);\n })() ?? undefined,\n }}\n />\n )}\n </div>\n );\n },\n);\nGaugeChart.displayName = 'GaugeChart';\n"],"names":["React","useGaugeChartStyles","select","d3Select","arc","d3Arc","Points","areArraysEqual","formatScientificLimitWidth","getAccessibleDataObject","getColorFromToken","getNextColor","pointTypes","useRtl","ChartTitle","formatToLocaleString","SVGTooltipText","Legends","Shape","useArrowNavigationGroup","ChartPopover","useImageExport","GAUGE_MARGIN","LABEL_WIDTH","LABEL_HEIGHT","LABEL_OFFSET","TITLE_OFFSET","EXTRA_NEEDLE_LENGTH","ARC_PADDING","BREAKPOINTS","minRadius","arcWidth","fontSize","calcNeedleRotation","chartValue","minValue","maxValue","needleRotation","getSegmentLabel","segment","variant","isAriaLabel","legend","size","toFixed","start","end","getChartValueLabel","chartValueFormat","forCallout","toString","GaugeChart","forwardRef","props","forwardedRef","_getMargins","hideMinMax","chartTitle","sublabel","left","right","top","bottom","_margins","_legendsHeight","hideLegend","chartContainerRef","_rootElem","legendsRef","_legendsRef","componentRef","_isRTL","width","setWidth","useState","height","setHeight","hoveredLegend","setHoveredLegend","selectedLegends","setSelectedLegends","legendProps","focusedElement","setFocusedElement","isPopoverOpen","setPopoverOpen","calloutLegend","setCalloutLegend","hoverYValues","setHoverYValues","refSelected","setRefSelected","prevPropsRef","useRef","_width","_height","_outerRadius","Math","min","chartValueSize","_getStylesBasedOnBreakpoint","_innerRadius","_minValue","_maxValue","_segments","_calloutAnchor","useEffect","current","clientWidth","clientHeight","prevProps","classes","index","length","_processProps","segments","roundCorners","total","processedSegments","map","max","color","accessibilityData","push","arcGenerator","cornerRadius","padAngle","padRadius","rtlSafeSegments","Array","from","reverse","prevAngle","PI","arcs","endAngle","d","innerRadius","outerRadius","startAngle","segmentIndex","_renderNeedle","rtlSafeNeedleRotation","strokeWidth","halfStrokeWidth","needleLength","needleId","g","transform","path","id","className","needle","data-is-focusable","onFocus","e","_handleFocus","onBlur","_handleBlur","onMouseEnter","_handleMouseOver","onMouseMove","role","aria-label","_renderLegends","legends","title","hoverAction","onMouseOutAction","div","legendsContainer","centerLegends","onChange","_onLegendSelectionChange","legendRef","event","currentLegend","canSelectMultipleLegends","slice","_legendHighlighted","_getHighlightedLegend","includes","_noLegendHighlighted","focusEvent","elementId","_showCallout","_hideCallout","mouseEvent","hoveredElement","_handleMouseOut","_handleCalloutDismiss","isFocusEvent","targetElement","document","getElementById","currentTarget","filter","yValue","y","isBlurEvent","_wrapContent","content","maxWidth","textElement","text","node","isOverflowing","textLength","getComputedTextLength","_multiValueCallout","calloutProps","yValueHoverSubCountsExists","_yValueHoverSubCountsExists","YValueHover","calloutContentRoot","calloutDateTimeContainer","style","marginBottom","calloutContentX","xAxisCalloutAccessibilityData","hoverXValue","culture","calloutInfoContainer","display","yValues","isLast","shouldDrawBorderBottom","callOutAccessibilityData","key","paddingBottom","_getCalloutContent","descriptionMessage","_renderCallout","calloutData","chartValueLabel","segmentValues","yValueHover","some","yAxisCalloutData","xValue","marginStyle","marginRight","toDrawShape","undefined","calloutBlockContainer","borderInlineStart","svgProps","shapeStyles","pathProps","fill","shape","Object","keys","calloutlegendText","calloutContentY","data","subcounts","subcountName","_getChartTitle","arrowAttributes","circular","axis","root","ref","el","chartWrapper","svg","chart","onMouseLeave","x","titleStyles","tooltipClassName","svgTooltip","textAnchor","limits","arcId","Fragment","opacity","ariaLabel","tabIndex","textProps","wrapContent","dominantBaseline","hideTooltip","positioning","target","customCallout","customizedCallout","onRenderCallout","displayName"],"mappings":"AAAA;;;;;;;;;;;;IAuCa4B,WAAAA;;;IACAC,WAAAA;;;cAwEAsB;eAAAA;;sBA/DAlB;eAAAA;;sBA6BAc;eAAAA;;IAlBAT,eAAAA;;;;;iEA1DU,QAAQ;2CACK,kCAA+B;6BAChC,eAAe;yBACrB,WAAW;uBAYjC,2BAAwB;gCACM,4BAA4B;gCAClC,oCAAiC;wBAEjC,sBAAmB;8BAQV,0BAA0B;8BACrC,sCAAmC;uBACjC,2BAAwB;AAEvD,MAAMhB,eAAe;AACrB,MAAMC,cAAc;AACpB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,sBAAsB;AACrB,oBAAoB,EAAE;AACtB,oBAAoB;IACzB;QAAEG,WAAW;QAAIC,UAAU;QAAIC,UAAU;IAAG;IAC5C;QAAEF,WAAW;QAAIC,UAAU;QAAIC,UAAU;IAAG;IAC5C;QAAEF,WAAW;QAAIC,UAAU;QAAIC,UAAU;IAAG;IAC5C;QAAEF,WAAW;QAAKC,UAAU;QAAIC,UAAU;IAAG;IAC7C;QAAEF,WAAW;QAAKC,UAAU;QAAIC,UAAU;IAAG;IAC7C;QAAEF,WAAW;QAAKC,UAAU;QAAIC,UAAU;IAAG;CAC9C,CAAC;AAEK,2BAA2B,CAACE,YAAoBC,UAAkBC;IACvE,IAAIC,iBAAmBH,CAAAA,aAAaC,QAAAA,CAAO,IAAMC,WAAWD,QAAAA,CAAO,GAAM;IAC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;QAC7BoL,aAAajF;SAGhBnJ,MAAMK,QAAQ,IAAA,WAAA,GACb,OAAA,aAAA,CAAC1C,8BAAAA,EAAAA;QACCyL,SAASpJ,MAAMK,QAAQ;QACvB8N,WAAW;YACTX,GAAG;YACHvE,GAAG;YACH2E,YAAY;YACZS,kBAAkB;YAClBnI,WAAWxC,QAAQrD,QAAQ;QAC7B;QACAgJ,UAAUrG,eAAe;QACzBoL,aAAajF;WAMtBpC,kBACA,CAAC/G,MAAMsO,WAAW,IAAIvM,iBAAAA,WAAAA,GACrB,OAAA,aAAA,CAAChE,0BAAAA,EAAAA;QACE,GAAGiC,MAAM6J,YAAY;QACtB0E,aAAa;YACXC,QAAQnM;QACV;QACAN,eAAeA;QACf0M,eAAe;YACbC,mBACE,CAAA,OAAC,CAAA;gBACC,MAAMtD,cAAqC;oBACzC/L,QAAQ4C;oBACRpD,YAAYmB,MAAMnB,UAAU;oBAC5BC,UAAUmE;oBACVlE,UAAUmE;oBACVmI,iBAAiB3L,mBACfM,MAAMnB,UAAU,EAChBoE,WACAC,WACAlD,MAAML,gBAAgB,EACtB;oBAEF2L,eAAenJ;gBACjB;gBAEA,OAAOnC,MAAM2O,eAAe,GACxB3O,MAAM2O,eAAe,CAACvD,aAAaD,kBACnCA,eAAeC;aACrB,CAAA,EAAA,MAAA,QAnBA,SAAA,KAAA,IAAA,OAmBQU;QACZ;;AAKV,GACA;AACFhM,WAAW8O,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../src/components/GaugeChart/GaugeChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useGaugeChartStyles } from './useGaugeChartStyles.styles';\nimport { select as d3Select } from 'd3-selection';\nimport { arc as d3Arc } from 'd3-shape';\nimport type { YValueHover } from '../../index';\nimport {\n Points,\n areArraysEqual,\n formatScientificLimitWidth,\n getAccessibleDataObject,\n getColorFromToken,\n getNextColor,\n pointTypes,\n useRtl,\n ChartTitle,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { SVGTooltipText } from '../../utilities/SVGTooltipText';\nimport type { Legend, LegendShape } from '../Legends/index';\nimport { Legends, Shape } from '../Legends/index';\nimport type {\n GaugeChartCalloutData,\n GaugeChartVariant,\n GaugeValueFormat,\n GaugeChartProps,\n ExtendedSegment,\n} from './GaugeChart.types';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useId } from '@fluentui/react-utilities';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst GAUGE_MARGIN = 16;\nconst LABEL_WIDTH = 36;\nconst LABEL_HEIGHT = 16;\nconst LABEL_OFFSET = 4;\nconst TITLE_OFFSET = 11;\nconst EXTRA_NEEDLE_LENGTH = 4;\nexport const ARC_PADDING = 2;\nexport const BREAKPOINTS = [\n { minRadius: 52, arcWidth: 12, fontSize: 20 },\n { minRadius: 70, arcWidth: 16, fontSize: 24 },\n { minRadius: 88, arcWidth: 20, fontSize: 32 },\n { minRadius: 106, arcWidth: 24, fontSize: 32 },\n { minRadius: 124, arcWidth: 28, fontSize: 40 },\n { minRadius: 142, arcWidth: 32, fontSize: 40 },\n];\n\nexport const calcNeedleRotation = (chartValue: number, minValue: number, maxValue: number): number => {\n let needleRotation = ((chartValue - minValue) / (maxValue - minValue)) * 180;\n if (needleRotation < 0) {\n needleRotation = 0;\n } else if (needleRotation > 180) {\n needleRotation = 180;\n }\n\n return needleRotation;\n};\n\nexport const getSegmentLabel = (\n segment: ExtendedSegment,\n minValue: number,\n maxValue: number,\n variant?: GaugeChartVariant,\n isAriaLabel: boolean = false,\n): string => {\n if (isAriaLabel) {\n return minValue === 0 && variant === 'single-segment'\n ? `${segment.legend}, ${segment.size} out of ${maxValue} or ${((segment.size / maxValue) * 100).toFixed()}%`\n : `${segment.legend}, ${segment.start} to ${segment.end}`;\n }\n\n return minValue === 0 && variant === 'single-segment'\n ? `${segment.size} (${((segment.size / maxValue) * 100).toFixed()}%)`\n : `${segment.start} - ${segment.end}`;\n};\n\nexport const getChartValueLabel = (\n chartValue: number,\n minValue: number,\n maxValue: number,\n chartValueFormat?: GaugeValueFormat | ((sweepFraction: [number, number]) => string),\n forCallout: boolean = false,\n): string => {\n if (typeof chartValueFormat === 'function') {\n return chartValueFormat([chartValue - minValue, maxValue - minValue]);\n }\n\n if (chartValueFormat === 'fraction') {\n return `${chartValue}/${maxValue}`;\n }\n\n return `${((chartValue / maxValue) * 100).toFixed()}%`;\n};\n\n/**\n * Returns a GaugeChart segment label formatted for the chart's value format.\n * {@docCategory GaugeChart}\n */\nexport const getGaugeChartSegmentLabel = (\n segment: ExtendedSegment,\n minValue: number,\n maxValue: number,\n variant: GaugeChartVariant | undefined,\n chartValueFormat: GaugeChartProps['chartValueFormat'],\n isAriaLabel: boolean = false,\n): string => {\n if ((minValue === 0 && variant === 'single-segment') || typeof chartValueFormat === 'function') {\n return getSegmentLabel(segment, minValue, maxValue, variant, isAriaLabel);\n }\n\n if (!chartValueFormat || chartValueFormat === 'percentage') {\n const startPercentage = ((segment.start / maxValue) * 100).toFixed();\n const endPercentage = ((segment.end / maxValue) * 100).toFixed();\n return isAriaLabel\n ? `${segment.legend}, ${startPercentage}% to ${endPercentage}%`\n : `${startPercentage}% - ${endPercentage}%`;\n }\n\n return isAriaLabel ? `${segment.legend}, ${segment.start} to ${segment.end}` : `${segment.start} - ${segment.end}`;\n};\n\ninterface YValue extends Omit<YValueHover, 'y'> {\n y?: string | number;\n}\nexport type { ExtendedSegment } from './GaugeChart.types';\n\nexport const GaugeChart: React.FunctionComponent<GaugeChartProps> = React.forwardRef<HTMLDivElement, GaugeChartProps>(\n (props, forwardedRef) => {\n const _gaugeChartId = useId('gauge-chart');\n const _getMargins = () => {\n const { hideMinMax, chartTitle, sublabel } = props;\n return {\n left: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,\n right: (!hideMinMax ? LABEL_OFFSET + LABEL_WIDTH : 0) + GAUGE_MARGIN,\n top: (chartTitle ? TITLE_OFFSET + LABEL_HEIGHT : EXTRA_NEEDLE_LENGTH / 2) + GAUGE_MARGIN,\n bottom: (sublabel ? LABEL_OFFSET + LABEL_HEIGHT : 0) + GAUGE_MARGIN,\n };\n };\n const _margins: { left: number; right: number; top: number; bottom: number } = _getMargins();\n const _legendsHeight: number = !props.hideLegend ? 32 : 0;\n const { chartContainerRef: _rootElem, legendsRef: _legendsRef } = useImageExport(\n props.componentRef,\n props.hideLegend,\n false,\n );\n const _isRTL: boolean = useRtl();\n const [width, setWidth] = React.useState<number>(140 + _getMargins().left + _getMargins().right);\n const [height, setHeight] = React.useState<number>(70 + _getMargins().top + _getMargins().bottom + _legendsHeight);\n const [hoveredLegend, setHoveredLegend] = React.useState<string>('');\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const [focusedElement, setFocusedElement] = React.useState<string | undefined>('');\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const [calloutLegend, setCalloutLegend] = React.useState('');\n const [hoverYValues, setHoverYValues] = React.useState<YValue[]>([]);\n const [refSelected, setRefSelected] = React.useState<HTMLElement | null>(null);\n const prevPropsRef = React.useRef<GaugeChartProps | null>(null);\n const _width = props.width || width;\n const _height = props.height || height;\n const _outerRadius: number = Math.min(\n (_width - (_margins.left + _margins.right)) / 2,\n _height - (_margins.top + _margins.bottom + _legendsHeight),\n );\n const { arcWidth, chartValueSize } = _getStylesBasedOnBreakpoint();\n const _innerRadius: number = _outerRadius - arcWidth;\n let _minValue!: number;\n let _maxValue!: number;\n let _segments!: ExtendedSegment[];\n let _calloutAnchor: string = '';\n\n React.useEffect(() => {\n if (_rootElem.current) {\n setWidth(_rootElem.current.clientWidth);\n setHeight(_rootElem.current.clientHeight);\n }\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 const classes = useGaugeChartStyles(props);\n function _getStylesBasedOnBreakpoint() {\n for (let index = BREAKPOINTS.length - 1; index >= 0; index -= 1) {\n if (_outerRadius >= BREAKPOINTS[index].minRadius) {\n return {\n arcWidth: BREAKPOINTS[index].arcWidth,\n chartValueSize: BREAKPOINTS[index].fontSize,\n };\n }\n }\n return {\n arcWidth: BREAKPOINTS[0].arcWidth,\n chartValueSize: BREAKPOINTS[0].fontSize,\n };\n }\n\n function _processProps() {\n const { minValue = 0, maxValue, segments, roundCorners } = props;\n\n let total = minValue;\n const processedSegments: ExtendedSegment[] = segments.map(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (segment: { size: number; legend: any; color: string; accessibilityData: any }, index: number) => {\n const size = Math.max(segment.size, 0);\n total += size;\n return {\n legend: segment.legend,\n size,\n color:\n typeof segment.color !== 'undefined'\n ? getColorFromToken(segment.color, false)\n : getNextColor(index, 0, false),\n accessibilityData: segment.accessibilityData,\n start: total - size,\n end: total,\n };\n },\n );\n if (typeof maxValue !== 'undefined' && total < maxValue) {\n processedSegments.push({\n legend: 'Unknown',\n size: maxValue - total,\n color: 'neutralLight',\n start: total,\n end: maxValue,\n });\n total = maxValue;\n }\n\n const arcGenerator = d3Arc()\n .cornerRadius(roundCorners ? 3 : 0)\n .padAngle(ARC_PADDING / _outerRadius)\n .padRadius(_outerRadius);\n const rtlSafeSegments = _isRTL ? Array.from(processedSegments).reverse() : processedSegments;\n let prevAngle = -Math.PI / 2;\n\n const arcs = rtlSafeSegments.map((segment, index) => {\n const endAngle = prevAngle + (segment.size / (total - minValue)) * Math.PI;\n const d = arcGenerator({\n innerRadius: _innerRadius,\n outerRadius: _outerRadius,\n startAngle: prevAngle,\n endAngle,\n })!;\n prevAngle = endAngle;\n return {\n d,\n segmentIndex: _isRTL ? processedSegments.length - 1 - index : index,\n startAngle: prevAngle - (segment.size / (total - minValue)) * Math.PI,\n endAngle,\n };\n });\n\n _minValue = minValue;\n _maxValue = total;\n _segments = processedSegments;\n\n return {\n arcs,\n };\n }\n\n function _renderNeedle() {\n const needleRotation = calcNeedleRotation(props.chartValue, _minValue, _maxValue);\n const rtlSafeNeedleRotation = _isRTL ? 180 - needleRotation : needleRotation;\n const strokeWidth = 2;\n const halfStrokeWidth = strokeWidth / 2;\n const needleLength = _outerRadius - _innerRadius + EXTRA_NEEDLE_LENGTH;\n const needleId = `${_gaugeChartId}-needle`;\n return (\n <g transform={`rotate(${rtlSafeNeedleRotation}, 0, 0)`}>\n <path\n d={`\n M 0,${-halfStrokeWidth - 3}\n L ${-needleLength},${-halfStrokeWidth - 1}\n A ${halfStrokeWidth + 1},${halfStrokeWidth + 1},0,0,0,${-needleLength},${halfStrokeWidth + 1}\n L 0,${halfStrokeWidth + 3}\n A ${halfStrokeWidth + 3},${halfStrokeWidth + 3},0,0,0,0,${-halfStrokeWidth - 3}\n `}\n id={needleId}\n strokeWidth={strokeWidth}\n className={classes.needle}\n transform={`translate(${-_innerRadius + EXTRA_NEEDLE_LENGTH / 2})`}\n data-is-focusable={true}\n onFocus={e => _handleFocus(e, 'Needle', needleId)}\n onBlur={_handleBlur}\n onMouseEnter={e => _handleMouseOver(e, 'Needle', needleId)}\n onMouseMove={e => _handleMouseOver(e, 'Needle', needleId)}\n role=\"img\"\n aria-label={\n 'Current value: ' + getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat)\n }\n />\n </g>\n );\n }\n\n function _renderLegends() {\n if (props.hideLegend) {\n return null;\n }\n\n const legends: Legend[] = _segments.map((segment, index) => {\n const color: string = segment.color || getNextColor(index, 0, false);\n\n return {\n title: segment.legend,\n color,\n hoverAction: () => {\n setHoveredLegend(segment.legend);\n },\n onMouseOutAction: () => {\n setHoveredLegend('');\n },\n };\n });\n\n return (\n <div className={classes.legendsContainer}>\n <Legends\n legends={legends}\n centerLegends\n {...props.legendProps}\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n </div>\n );\n }\n\n function _onLegendSelectionChange(\n // eslint-disable-next-line @typescript-eslint/no-shadow\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(selectedLegends);\n } else {\n setSelectedLegends(selectedLegends.slice(-1));\n }\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it\n */\n function _legendHighlighted(legend: string) {\n return _getHighlightedLegend().includes(legend!);\n }\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n function _noLegendHighlighted() {\n return _getHighlightedLegend().length === 0;\n }\n\n function _getHighlightedLegend() {\n return selectedLegends.length > 0 ? selectedLegends : hoveredLegend ? [hoveredLegend] : [];\n }\n\n // eslint-disable-next-line @typescript-eslint/no-shadow\n function _handleFocus(focusEvent: React.FocusEvent<SVGElement>, focusedElement: string, elementId?: string) {\n _showCallout(focusEvent, focusedElement, true, elementId);\n }\n\n function _handleBlur() {\n _hideCallout(true);\n }\n\n function _handleMouseOver(mouseEvent: React.MouseEvent<SVGElement>, hoveredElement: string, elementId?: string) {\n _showCallout(mouseEvent, hoveredElement, false, elementId);\n }\n\n function _handleMouseOut() {\n _hideCallout(false);\n }\n\n function _handleCalloutDismiss() {\n _hideCallout(false);\n }\n\n function _showCallout(\n event: React.MouseEvent<SVGElement, MouseEvent> | React.FocusEvent<SVGElement, Element>,\n legend: string,\n isFocusEvent: boolean,\n elementId?: string,\n ) {\n if (_calloutAnchor === legend) {\n return;\n }\n const targetElement = elementId\n ? document.getElementById(elementId)\n : (event.currentTarget as unknown as HTMLElement);\n _calloutAnchor = legend;\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const hoverYValues: YValue[] = _segments\n .filter(segment => _noLegendHighlighted() || _legendHighlighted(segment.legend))\n .map(segment => {\n const yValue: YValue = {\n legend: segment.legend,\n y: getGaugeChartSegmentLabel(segment, _minValue, _maxValue, props.variant, props.chartValueFormat),\n color: segment.color,\n };\n return yValue;\n });\n setPopoverOpen(\n ['Needle', 'Chart value'].includes(legend) || _noLegendHighlighted() || _legendHighlighted(legend),\n );\n setRefSelected(targetElement);\n setCalloutLegend(legend);\n setHoverYValues(hoverYValues);\n if (isFocusEvent) {\n setFocusedElement(legend);\n }\n }\n\n function _hideCallout(isBlurEvent?: boolean) {\n _calloutAnchor = '';\n setPopoverOpen(false);\n setCalloutLegend('');\n setHoverYValues([]);\n if (isBlurEvent) {\n setFocusedElement('');\n }\n }\n\n function _wrapContent(content: string, id: string, maxWidth: number) {\n const textElement = d3Select<SVGTextElement, {}>(`#${id}`);\n textElement.text(content);\n if (!textElement.node()) {\n return false;\n }\n\n let isOverflowing = false;\n let textLength = textElement.node()!.getComputedTextLength();\n while (textLength > maxWidth && content.length > 0) {\n content = content.slice(0, -1);\n textElement.text(content + '...');\n isOverflowing = true;\n textLength = textElement.node()!.getComputedTextLength();\n }\n return isOverflowing;\n }\n\n // TO DO: Write a common functional component for Multi value callout and divide sub count method\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _multiValueCallout(calloutProps: any) {\n const yValueHoverSubCountsExists: boolean = _yValueHoverSubCountsExists(calloutProps.YValueHover);\n return (\n <div className={classes.calloutContentRoot}>\n <div\n className={classes.calloutDateTimeContainer}\n style={yValueHoverSubCountsExists ? { marginBottom: '11px' } : {}}\n >\n <div\n className={classes.calloutContentX}\n {...getAccessibleDataObject(calloutProps!.xAxisCalloutAccessibilityData, 'text', false)}\n >\n {formatToLocaleString(calloutProps!.hoverXValue, props.culture) as React.ReactNode}\n </div>\n </div>\n <div className={classes.calloutInfoContainer} style={yValueHoverSubCountsExists ? { display: 'flex' } : {}}>\n {calloutProps!.YValueHover &&\n calloutProps!.YValueHover.map((yValue: YValueHover, index: number, yValues: YValueHover[]) => {\n const isLast: boolean = index + 1 === yValues.length;\n const { shouldDrawBorderBottom = false } = yValue;\n return (\n <div\n {...getAccessibleDataObject(yValue.callOutAccessibilityData, 'text', false)}\n key={`callout-content-${index}`}\n style={\n yValueHoverSubCountsExists\n ? {\n display: 'inline-block',\n ...(shouldDrawBorderBottom && {\n paddingBottom: '10px',\n }),\n }\n : {\n ...(shouldDrawBorderBottom && {\n paddingBottom: '10px',\n }),\n }\n }\n >\n {_getCalloutContent(yValue, index, yValueHoverSubCountsExists, isLast)}\n </div>\n );\n })}\n {!!calloutProps.descriptionMessage && (\n <div className={classes.descriptionMessage}>{calloutProps.descriptionMessage}</div>\n )}\n </div>\n </div>\n );\n }\n\n function _renderCallout(calloutData?: GaugeChartCalloutData): React.ReactElement | null {\n return calloutData\n ? _multiValueCallout({\n hoverXValue: `Current value is ${calloutData.chartValueLabel}`,\n YValueHover: calloutData.segmentValues,\n })\n : null;\n }\n\n function _yValueHoverSubCountsExists(yValueHover?: YValueHover[]) {\n if (yValueHover) {\n return yValueHover.some(\n (yValue: {\n legend?: string;\n y?: number;\n color?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n }) => yValue.yAxisCalloutData && typeof yValue.yAxisCalloutData !== 'string',\n );\n }\n return false;\n }\n\n function _getCalloutContent(\n xValue: YValueHover,\n index: number,\n yValueHoverSubCountsExists: boolean,\n isLast: boolean,\n ): React.ReactNode {\n const marginStyle: React.CSSProperties = isLast ? {} : { marginRight: '16px' };\n const toDrawShape = xValue.index !== undefined && xValue.index !== -1;\n const { culture } = props;\n const yValue = formatToLocaleString(xValue.y, culture) as React.ReactNode;\n if (!xValue.yAxisCalloutData || typeof xValue.yAxisCalloutData === 'string') {\n return (\n <div style={yValueHoverSubCountsExists ? marginStyle : {}}>\n {yValueHoverSubCountsExists && (\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n )}\n <div\n id={`${index}_${xValue.y}`}\n className={classes.calloutBlockContainer}\n style={{ borderInlineStart: `4px solid ${xValue.color}` }}\n >\n {toDrawShape && (\n <Shape\n svgProps={{\n className: classes.shapeStyles,\n }}\n pathProps={{ fill: xValue.color }}\n shape={Points[xValue.index! % Object.keys(pointTypes).length] as LegendShape}\n style={{ display: 'flex' }}\n />\n )}\n <div>\n <div className={classes.calloutlegendText}> {xValue.legend}</div>\n <div className={classes.calloutContentY}>\n {\n formatToLocaleString(\n xValue.yAxisCalloutData ? xValue.yAxisCalloutData : xValue.y || xValue.data,\n culture,\n ) as React.ReactNode\n }\n </div>\n </div>\n </div>\n </div>\n );\n } else {\n const subcounts: { [id: string]: number } = xValue.yAxisCalloutData as { [id: string]: number };\n return (\n <div style={marginStyle}>\n <div className=\"ms-fontWeight-semibold\" style={{ fontSize: '12pt' }}>\n {xValue.legend!} ({yValue})\n </div>\n {Object.keys(subcounts).map((subcountName: string) => {\n return (\n <div key={subcountName} className={classes.calloutBlockContainer}>\n <div className={classes.calloutlegendText}>\n {' '}\n {formatToLocaleString(subcountName, culture) as React.ReactNode}\n </div>\n <div className={classes.calloutContentY}>\n {formatToLocaleString(subcounts[subcountName], culture) as React.ReactNode}\n </div>\n </div>\n );\n })}\n </div>\n );\n }\n }\n\n function _getChartTitle(): string {\n const { chartTitle } = props;\n return (chartTitle ? `${chartTitle}. ` : '') + `Gauge chart with ${_segments.length} segments. `;\n }\n const { arcs } = _processProps();\n const arrowAttributes = useArrowNavigationGroup({ circular: true, axis: 'horizontal' });\n return (\n <div\n className={classes.root}\n ref={el => {\n _rootElem.current = el;\n }}\n >\n <div className={classes.chartWrapper} {...arrowAttributes}>\n <svg\n className={classes.chart}\n width={_width}\n height={_height - _legendsHeight}\n role=\"region\"\n aria-label={_getChartTitle()}\n onMouseLeave={_handleMouseOut}\n >\n <g transform={`translate(${_width / 2}, ${_height - (_margins.bottom + _legendsHeight)})`}>\n {props.chartTitle && (\n <ChartTitle\n title={props.chartTitle}\n x={0}\n y={-(_outerRadius + TITLE_OFFSET)}\n className={classes.chartTitle}\n titleStyles={props.titleStyles}\n tooltipClassName={classes.svgTooltip}\n />\n )}\n {!props.hideMinMax && (\n <>\n <text\n x={(_isRTL ? 1 : -1) * (_outerRadius + LABEL_OFFSET)}\n y={0}\n textAnchor=\"end\"\n className={classes.limits}\n role=\"img\"\n aria-label={`Min value: ${_minValue}`}\n >\n {formatScientificLimitWidth(_minValue)}\n </text>\n <text\n x={(_isRTL ? -1 : 1) * (_outerRadius + LABEL_OFFSET)}\n y={0}\n textAnchor=\"start\"\n className={classes.limits}\n role=\"img\"\n aria-label={`Max value: ${_maxValue}`}\n >\n {formatScientificLimitWidth(_maxValue)}\n </text>\n </>\n )}\n <g role=\"listbox\" aria-label={`${_segments.length} ${_segments.length === 1 ? 'segment' : 'segments'}`}>\n {arcs.map((arc, index) => {\n const segment = _segments[arc.segmentIndex];\n const arcId = `${_gaugeChartId}-arc-${index}`;\n return (\n <React.Fragment key={index}>\n <path\n d={arc.d}\n id={arcId}\n strokeWidth={focusedElement === segment.legend ? ARC_PADDING : 0}\n className={classes.segment}\n fill={segment.color}\n opacity={_legendHighlighted(segment.legend) || _noLegendHighlighted() ? 1 : 0.1}\n {...getAccessibleDataObject(\n {\n ariaLabel: getGaugeChartSegmentLabel(\n segment,\n _minValue,\n _maxValue,\n props.variant,\n props.chartValueFormat,\n true,\n ),\n ...segment.accessibilityData,\n },\n 'option',\n true,\n )}\n onFocus={e => _handleFocus(e, segment.legend, arcId)}\n onBlur={_handleBlur}\n onMouseEnter={e => _handleMouseOver(e, segment.legend, arcId)}\n onMouseLeave={e => _handleCalloutDismiss()}\n onMouseMove={e => _handleMouseOver(e, segment.legend, arcId)}\n tabIndex={_legendHighlighted(segment.legend) || _noLegendHighlighted() ? 0 : undefined}\n />\n </React.Fragment>\n );\n })}\n </g>\n {_renderNeedle()}\n <g\n onMouseEnter={e => _handleMouseOver(e, 'Chart value')}\n onMouseMove={e => _handleMouseOver(e, 'Chart value')}\n >\n <SVGTooltipText\n content={getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat)}\n textProps={{\n x: 0,\n y: 0,\n textAnchor: 'middle',\n className: classes.chartValue,\n fontSize: chartValueSize,\n 'aria-hidden': 'true',\n }}\n maxWidth={_innerRadius * 2 - 24}\n wrapContent={_wrapContent}\n />\n </g>\n {props.sublabel && (\n <SVGTooltipText\n content={props.sublabel}\n textProps={{\n x: 0,\n y: 4,\n textAnchor: 'middle',\n dominantBaseline: 'hanging',\n className: classes.sublabel,\n }}\n maxWidth={_innerRadius * 2}\n wrapContent={_wrapContent}\n />\n )}\n </g>\n </svg>\n </div>\n {_renderLegends()}\n {!props.hideTooltip && isPopoverOpen && (\n <ChartPopover\n {...props.calloutProps}\n positioning={{\n target: refSelected,\n }}\n isPopoverOpen={isPopoverOpen}\n customCallout={{\n customizedCallout:\n (() => {\n const calloutData: GaugeChartCalloutData = {\n legend: calloutLegend,\n chartTitle: props.chartTitle,\n chartValue: props.chartValue,\n minValue: _minValue,\n maxValue: _maxValue,\n chartValueLabel: getChartValueLabel(\n props.chartValue,\n _minValue,\n _maxValue,\n props.chartValueFormat,\n true,\n ),\n segments: _segments.slice(0, props.segments.length).map(segment => ({ ...segment })),\n segmentValues: hoverYValues,\n };\n\n return props.onRenderCallout\n ? props.onRenderCallout(calloutData, _renderCallout)\n : _renderCallout(calloutData);\n })() ?? undefined,\n }}\n />\n )}\n </div>\n );\n },\n);\nGaugeChart.displayName = 'GaugeChart';\n"],"names":["React","useGaugeChartStyles","select","d3Select","arc","d3Arc","Points","areArraysEqual","formatScientificLimitWidth","getAccessibleDataObject","getColorFromToken","getNextColor","pointTypes","useRtl","ChartTitle","formatToLocaleString","SVGTooltipText","Legends","Shape","useArrowNavigationGroup","useId","ChartPopover","useImageExport","GAUGE_MARGIN","LABEL_WIDTH","LABEL_HEIGHT","LABEL_OFFSET","TITLE_OFFSET","EXTRA_NEEDLE_LENGTH","ARC_PADDING","BREAKPOINTS","minRadius","arcWidth","fontSize","calcNeedleRotation","chartValue","minValue","maxValue","needleRotation","getSegmentLabel","segment","variant","isAriaLabel","legend","size","toFixed","start","end","getChartValueLabel","chartValueFormat","forCallout","getGaugeChartSegmentLabel","startPercentage","endPercentage","GaugeChart","forwardRef","props","forwardedRef","_gaugeChartId","_getMargins","hideMinMax","chartTitle","sublabel","left","right","top","bottom","_margins","_legendsHeight","hideLegend","chartContainerRef","_rootElem","legendsRef","_legendsRef","componentRef","_isRTL","width","setWidth","useState","height","setHeight","hoveredLegend","setHoveredLegend","selectedLegends","setSelectedLegends","legendProps","focusedElement","setFocusedElement","isPopoverOpen","setPopoverOpen","calloutLegend","setCalloutLegend","hoverYValues","setHoverYValues","refSelected","setRefSelected","prevPropsRef","useRef","_width","_height","_outerRadius","Math","min","chartValueSize","_getStylesBasedOnBreakpoint","_innerRadius","_minValue","_maxValue","_segments","_calloutAnchor","useEffect","current","clientWidth","clientHeight","prevProps","classes","index","length","_processProps","segments","roundCorners","total","processedSegments","map","max","color","accessibilityData","push","arcGenerator","cornerRadius","padAngle","padRadius","rtlSafeSegments","Array","from","reverse","prevAngle","PI","arcs","endAngle","d","innerRadius","outerRadius","startAngle","segmentIndex","_renderNeedle","rtlSafeNeedleRotation","strokeWidth","halfStrokeWidth","needleLength","needleId","g","transform","path","id","className","needle","data-is-focusable","onFocus","e","_handleFocus","onBlur","_handleBlur","onMouseEnter","_handleMouseOver","onMouseMove","role","aria-label","_renderLegends","legends","title","hoverAction","onMouseOutAction","div","legendsContainer","centerLegends","onChange","_onLegendSelectionChange","legendRef","event","currentLegend","canSelectMultipleLegends","slice","_legendHighlighted","_getHighlightedLegend","includes","_noLegendHighlighted","focusEvent","elementId","_showCallout","_hideCallout","mouseEvent","hoveredElement","_handleMouseOut","_handleCalloutDismiss","isFocusEvent","targetElement","document","getElementById","currentTarget","filter","yValue","y","isBlurEvent","_wrapContent","content","maxWidth","textElement","text","node","isOverflowing","textLength","getComputedTextLength","_multiValueCallout","calloutProps","yValueHoverSubCountsExists","_yValueHoverSubCountsExists","YValueHover","calloutContentRoot","calloutDateTimeContainer","style","marginBottom","calloutContentX","xAxisCalloutAccessibilityData","hoverXValue","culture","calloutInfoContainer","display","yValues","isLast","shouldDrawBorderBottom","callOutAccessibilityData","key","paddingBottom","_getCalloutContent","descriptionMessage","_renderCallout","calloutData","chartValueLabel","segmentValues","yValueHover","some","yAxisCalloutData","xValue","marginStyle","marginRight","toDrawShape","undefined","calloutBlockContainer","borderInlineStart","svgProps","shapeStyles","pathProps","fill","shape","Object","keys","calloutlegendText","calloutContentY","data","subcounts","subcountName","_getChartTitle","arrowAttributes","circular","axis","root","ref","el","chartWrapper","svg","chart","onMouseLeave","x","titleStyles","tooltipClassName","svgTooltip","textAnchor","limits","arcId","Fragment","opacity","ariaLabel","tabIndex","textProps","wrapContent","dominantBaseline","hideTooltip","positioning","target","customCallout","customizedCallout","onRenderCallout","displayName"],"mappings":"AAAA;;;;;;;;;;;;IAwCa6B,WAAAA;;;IACAC,WAAAA;;;IAwFAwB,UAAAA;;;IA/EApB,kBAAAA;;;IA6BAc,kBAAAA;;;6BAsBAG;eAAAA;;mBAxCAZ;;;;;iEA3DU,QAAQ;2CACK,kCAA+B;6BAChC,eAAe;yBACrB,WAAW;uBAYjC,2BAAwB;gCACM,4BAA4B;gCAClC,oCAAiC;wBAEjC,sBAAmB;8BAQV,0BAA0B;gCAC5C,4BAA4B;8BACrB,sCAAmC;uBACjC,2BAAwB;AAEvD,MAAMhB,eAAe;AACrB,MAAMC,cAAc;AACpB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,sBAAsB;AACrB,oBAAoB,EAAE;AACtB,oBAAoB;IACzB;QAAEG,WAAW;QAAIC,UAAU;QAAIC,UAAU;IAAG;IAC5C;QAAEF,WAAW;QAAIC,UAAU;QAAIC,UAAU;IAAG;IAC5C;QAAEF,WAAW;QAAIC,UAAU;QAAIC,UAAU;IAAG;I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