@fluentui/react-charts 9.3.6 → 9.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/CHANGELOG.md +21 -2
  2. package/dist/index.d.ts +17 -12
  3. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  4. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  6. package/lib/components/AreaChart/AreaChart.js +3 -16
  7. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  8. package/lib/components/ChartTable/ChartTable.js +2 -10
  9. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  10. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.js +2 -0
  12. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  13. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  14. package/lib/components/CommonComponents/ChartPopover.js +1 -2
  15. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +4 -2
  17. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  18. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -2
  19. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  20. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  21. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  22. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  23. package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -25
  24. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  25. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +48 -22
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  27. package/lib/components/DonutChart/DonutChart.js +3 -12
  28. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  29. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  30. package/lib/components/DonutChart/Pie/Pie.js +4 -2
  31. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  32. package/lib/components/FunnelChart/FunnelChart.js +2 -10
  33. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  34. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  35. package/lib/components/GanttChart/GanttChart.js +3 -16
  36. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  37. package/lib/components/GaugeChart/GaugeChart.js +2 -10
  38. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  39. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  40. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +7 -19
  41. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  42. package/lib/components/HeatMapChart/HeatMapChart.js +3 -16
  43. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  44. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +3 -21
  45. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  46. package/lib/components/Legends/Legends.types.js.map +1 -1
  47. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  48. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  49. package/lib/components/LineChart/LineChart.js +10 -19
  50. package/lib/components/LineChart/LineChart.js.map +1 -1
  51. package/lib/components/LineChart/LineChart.types.js +1 -1
  52. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  53. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
  54. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  55. package/lib/components/SankeyChart/SankeyChart.js +3 -9
  56. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  57. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  58. package/lib/components/ScatterChart/ScatterChart.js +23 -23
  59. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  60. package/lib/components/Sparkline/Sparkline.js +11 -7
  61. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  62. package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -14
  63. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  64. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +7 -17
  65. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  66. package/lib/types/DataPoint.js.map +1 -1
  67. package/lib/utilities/FocusableTooltipText.js +1 -1
  68. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  69. package/lib/utilities/getWindow.js +0 -1
  70. package/lib/utilities/getWindow.js.map +1 -1
  71. package/lib/utilities/hooks.js +34 -0
  72. package/lib/utilities/hooks.js.map +1 -0
  73. package/lib/utilities/image-export-utils.js +115 -75
  74. package/lib/utilities/image-export-utils.js.map +1 -1
  75. package/lib/utilities/utilities.js +23 -24
  76. package/lib/utilities/utilities.js.map +1 -1
  77. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  78. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  79. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  80. package/lib-commonjs/components/AreaChart/AreaChart.js +2 -15
  81. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  82. package/lib-commonjs/components/ChartTable/ChartTable.js +3 -10
  83. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  84. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  85. package/lib-commonjs/components/CommonComponents/CartesianChart.js +2 -0
  86. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  87. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  88. package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
  89. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  90. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +4 -2
  91. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  92. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -2
  93. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  94. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  95. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  96. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  97. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -25
  98. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +48 -22
  100. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  101. package/lib-commonjs/components/DonutChart/DonutChart.js +2 -11
  102. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  103. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  104. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  105. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  106. package/lib-commonjs/components/FunnelChart/FunnelChart.js +2 -10
  107. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  108. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  109. package/lib-commonjs/components/GanttChart/GanttChart.js +2 -15
  110. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  111. package/lib-commonjs/components/GaugeChart/GaugeChart.js +2 -10
  112. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  113. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  114. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +7 -19
  115. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  116. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -15
  117. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  118. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -19
  119. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  120. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  121. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  122. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  123. package/lib-commonjs/components/LineChart/LineChart.js +10 -19
  124. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  125. package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
  126. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  127. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
  128. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  129. package/lib-commonjs/components/SankeyChart/SankeyChart.js +3 -9
  130. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  131. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  132. package/lib-commonjs/components/ScatterChart/ScatterChart.js +21 -21
  133. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  134. package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
  135. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  136. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +2 -14
  137. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  138. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +6 -16
  139. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  140. package/lib-commonjs/types/DataPoint.js.map +1 -1
  141. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  142. package/lib-commonjs/utilities/getWindow.js +0 -1
  143. package/lib-commonjs/utilities/getWindow.js.map +1 -1
  144. package/lib-commonjs/utilities/hooks.js +45 -0
  145. package/lib-commonjs/utilities/hooks.js.map +1 -0
  146. package/lib-commonjs/utilities/image-export-utils.js +116 -76
  147. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  148. package/lib-commonjs/utilities/utilities.js +21 -20
  149. package/lib-commonjs/utilities/utilities.js.map +1 -1
  150. package/package.json +3 -3
@@ -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 { ScaleLinear, ScaleBand, ScaleTime } from 'd3-scale';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { Margins, GanttChartDataPoint } from '../../types/DataPoint';\nimport { CartesianChart, ModifiedCartesianChartProps } from '../CommonComponents/index';\nimport { GanttChartProps } from './GanttChart.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ChartPopoverProps, ImageExportOptions, Chart } from '../../index';\nimport {\n ChartTypes,\n YAxisType,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n IDomainNRange,\n createStringYAxisForHorizontalBarChartWithAxis,\n areArraysEqual,\n MIN_DOMAIN_MARGIN,\n sortAxisCategories,\n calculateAppropriateBarWidth,\n getColorFromToken,\n getScalePadding,\n getDateFormatLevel,\n useRtl,\n} from '../../utilities/index';\nimport { formatDateToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';\nimport { toImage } from '../../utilities/image-export-utils';\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 = React.useRef<Chart>(null);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL = useRtl();\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 React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(cartesianChartRef.current?.chartContainer, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\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[]> = {};\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[]> = {};\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.abs(rectEndX - rectStartX)}\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=\"img\"\n aria-label={_getAriaLabel(point)}\n />\n );\n });\n return (\n <g>\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","useRtl","formatDateToLocaleString","getMultiLevelDateTimeFormatOptions","toImage","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","_isRTL","useEffect","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_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","push","_getOrderedYAxisLabels","Object","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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,EAAEC,OAAOC,KAAK,QAAQ,WAAW;AAEtD,SAASC,KAAK,QAAQ,4BAA4B;AAElD,SAAiBC,OAAO,QAAyB,mBAAmB;AAEpE,SAASC,cAAc,QAAqC,4BAA4B;AAExF,SAASC,YAAY,QAAQ,mCAAmC;AAEhE,SACEC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,aAAa,EACbC,YAAY,EACZC,yBAAyB,EACzBC,wCAAwC,EAExCC,8CAA8C,EAC9CC,cAAc,EACdC,iBAAiB,EACjBC,kBAAkB,EAClBC,4BAA4B,EAC5BC,iBAAiB,EACjBC,eAAe,EACfC,kBAAkB,EAClBC,MAAM,QACD,wBAAwB;AAC/B,SAASC,wBAAwB,EAAEC,kCAAkC,QAAQ,4BAA4B;AACzG,SAASC,OAAO,QAAQ,qCAAqC;AAM7D,MAAMC,qBAAqB;AAC3B,MAAMC,iBAAiB;AAEvB,OAAO,MAAMC,2BAAuD9B,MAAM+B,UAAU,CAClF,CAAC,EAAEC,SAAS,IAAI,EAAEC,qBAAqB,SAAS,EAAEC,eAAe,EAAE,EAAE,GAAGC,OAAO,EAAEC;QAcRD;IAbvE,MAAME,aAAarC,MAAMsC,MAAM,CAASV;IACxC,MAAMW,WAAWvC,MAAMsC,MAAM,CAAU,CAAC;IACxC,MAAME,sBAAsBxC,MA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AAYlO,MAAMkO,UAAU;QAC9B;QAEA,qBACE,oBAAC9P;YACE,GAAG4B,KAAK;YACT8D,cAAcD;YACdgJ,YAAYD;YACZtH,QAAQ5C;YACR+C,WAAWnH,WAAWqB,UAAU;YAChCgG,WAAWpC;YACX4K,WAAWxK;YACXrB,cAAcN;YACdoM,6BAA6BhJ;YAC7B4I,cAAcA;YACdC,YAAYA;YACZI,YAAYrC;YACZsC,aAAa1P;YACb2P,uBAAuBlJ;YACvBmJ,mBAAmB3P;YACnB4P,kBAAkB9P;YAClB+P,mBAAmB7H;YACnB8H,YAAYpI;YACZqI,mBAAmB7B;YACnB8B,mBAAmBnG;YACnB7I,QAAQA;YACRiP,UAAU5F;;IAGhB,OAAO;QACL,qBACE,oBAAC6F;YAAIzL,IAAIhD;YAAe8K,MAAM;YAAS4D,OAAO;gBAAEpE,SAAS;YAAI;YAAGS,cAAY;;IAEhF;AACF,GACA;AAEF1L,WAAWsP,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 { ScaleLinear, ScaleBand, ScaleTime } from 'd3-scale';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { Legend, Legends } from '../Legends/index';\nimport { Margins, GanttChartDataPoint } from '../../types/DataPoint';\nimport { CartesianChart, ModifiedCartesianChartProps } from '../CommonComponents/index';\nimport { GanttChartProps } from './GanttChart.types';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ChartPopoverProps } from '../../index';\nimport {\n ChartTypes,\n YAxisType,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n findHBCWANumericMinMaxOfY,\n createYAxisForHorizontalBarChartWithAxis,\n IDomainNRange,\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[]> = {};\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[]> = {};\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.abs(rectEndX - rectStartX)}\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=\"img\"\n aria-label={_getAriaLabel(point)}\n />\n );\n });\n return (\n <g>\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","push","_getOrderedYAxisLabels","Object","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;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,OAAOC,KAAK,EAAEC,OAAOC,KAAK,QAAQ,WAAW;AAEtD,SAASC,KAAK,QAAQ,4BAA4B;AAElD,SAAiBC,OAAO,QAAQ,mBAAmB;AAEnD,SAASC,cAAc,QAAqC,4BAA4B;AAExF,SAASC,YAAY,QAAQ,mCAAmC;AAEhE,SACEC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,aAAa,EACbC,YAAY,EACZC,yBAAyB,EACzBC,wCAAwC,EAExCC,8CAA8C,EAC9CC,cAAc,EACdC,iBAAiB,EACjBC,kBAAkB,EAClBC,4BAA4B,EAC5BC,iBAAiB,EACjBC,eAAe,EACfC,kBAAkB,QACb,wBAAwB;AAC/B,SAASC,wBAAwB,EAAEC,kCAAkC,QAAQ,4BAA4B;AACzG,SAASC,cAAc,QAAQ,wBAAwB;AAMvD,MAAMC,qBAAqB;AAC3B,MAAMC,iBAAiB;AAEvB,OAAO,MAAMC,2BAAuD7B,MAAM8B,UAAU,CAClF,CAAC,EAAEC,SAAS,IAAI,EAAEC,qBAAqB,SAAS,EAAEC,eAAe,EAAE,EAAE,GAAGC,OAAO,EAAEC;QAcRD;IAbvE,MAAME,aAAapC,MAAMqC,MAAM,CAASV;IACxC,MAAMW,WAAWtC,MAAMqC,MAAM,CAAU,CAAC;IACxC,MAAME,sBAAsBvC,MAAMqC,MAAM,CAA6B;IACrE,MAAMG,gBAAgBnC,MAAM;IAC5B,MAAMoC,YAAYpC,MAAM;IACxB,MAAMqC,aAAa1C,MAAMqC,MAAM,CAAuE,CAAC;IACvG,MAAMM,aAAa3C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W,GAAG"}
@@ -9,7 +9,7 @@ import { SVGTooltipText } from '../../utilities/SVGTooltipText';
9
9
  import { Legends, Shape } from '../Legends/index';
10
10
  import { useFocusableGroup } from '@fluentui/react-tabster';
11
11
  import { ChartPopover } from '../CommonComponents/ChartPopover';
12
- import { toImage } from '../../utilities/image-export-utils';
12
+ import { useImageExport } from '../../utilities/hooks';
13
13
  const GAUGE_MARGIN = 16;
14
14
  const LABEL_WIDTH = 36;
15
15
  const LABEL_HEIGHT = 16;
@@ -77,7 +77,6 @@ export const getChartValueLabel = (chartValue, minValue, maxValue, chartValueFor
77
77
  };
78
78
  export const GaugeChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
79
79
  var _props_legendProps;
80
- const _legendsRef = React.useRef(null);
81
80
  const _getMargins = ()=>{
82
81
  const { hideMinMax, chartTitle, sublabel } = props;
83
82
  return {
@@ -89,7 +88,7 @@ export const GaugeChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>
89
88
  };
90
89
  const _margins = _getMargins();
91
90
  const _legendsHeight = !props.hideLegend ? 32 : 0;
92
- const _rootElem = React.useRef(null);
91
+ const { chartContainerRef: _rootElem, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend, false);
93
92
  const _isRTL = useRtl();
94
93
  const [width, setWidth] = React.useState(140 + _getMargins().left + _getMargins().right);
95
94
  const [height, setHeight] = React.useState(70 + _getMargins().top + _getMargins().bottom + _legendsHeight);
@@ -129,13 +128,6 @@ export const GaugeChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>
129
128
  }, [
130
129
  props
131
130
  ]);
132
- React.useImperativeHandle(props.componentRef, ()=>({
133
- chartContainer: _rootElem.current,
134
- toImage: (opts)=>{
135
- var _legendsRef_current;
136
- return toImage(_rootElem.current, (_legendsRef_current = _legendsRef.current) === null || _legendsRef_current === void 0 ? void 0 : _legendsRef_current.toSVG, _isRTL, opts);
137
- }
138
- }), []);
139
131
  const classes = useGaugeChartStyles(props);
140
132
  function _getStylesBasedOnBreakpoint() {
141
133
  for(let index = BREAKPOINTS.length - 1; index >= 0; index -= 1){
@@ -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 { YValueHover } from '../../index';\nimport {\n Points,\n areArraysEqual,\n formatScientificLimitWidth,\n getAccessibleDataObject,\n getColorFromToken,\n getNextColor,\n pointTypes,\n useRtl,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { SVGTooltipText } from '../../utilities/SVGTooltipText';\nimport { Legend, LegendShape, Legends, Shape, LegendContainer } from '../Legends/index';\nimport { GaugeChartVariant, GaugeValueFormat, GaugeChartProps, GaugeChartSegment } from './GaugeChart.types';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { ChartPopover } from '../CommonComponents/ChartPopover';\nimport { ImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\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 _legendsRef = React.useRef<LegendContainer>(null);\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 _rootElem = React.useRef<HTMLDivElement | null>(null);\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 [hoverXValue, setHoverXValue] = React.useState<string | number>('');\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 React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: _rootElem.current,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(_rootElem.current, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\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 // eslint-disable-next-line @typescript-eslint/no-shadow\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 // eslint-disable-next-line react/jsx-no-bind\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 = document.getElementById(elementId!);\n _calloutAnchor = legend;\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const hoverXValue: string =\n 'Current value is ' + getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat, true);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const hoverYValues: YValue[] = _segments.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 setHoverXValue(hoverXValue);\n setHoverYValues(hoverYValues);\n if (isFocusEvent) {\n setFocusedElement(legend);\n }\n }\n\n function _hideCallout(isBlurEvent?: boolean) {\n _calloutAnchor = '';\n setPopoverOpen(false);\n setHoverXValue('');\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 _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 focusAttributes = useFocusableGroup();\n return (\n <div\n className={classes.root}\n ref={el => {\n _rootElem.current = el;\n }}\n >\n <div className={classes.chartWrapper} {...focusAttributes}>\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 <text\n x={0}\n y={-(_outerRadius + TITLE_OFFSET)}\n textAnchor=\"middle\"\n className={classes.chartTitle}\n aria-hidden={true}\n >\n {props.chartTitle}\n </text>\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 {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 'img',\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 {_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: _multiValueCallout({ hoverXValue: hoverXValue, YValueHover: hoverYValues }),\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","formatToLocaleString","SVGTooltipText","Legends","Shape","useFocusableGroup","ChartPopover","toImage","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","_legendsRef","useRef","_getMargins","hideMinMax","chartTitle","sublabel","left","right","top","bottom","_margins","_legendsHeight","hideLegend","_rootElem","_isRTL","width","setWidth","useState","height","setHeight","hoveredLegend","setHoveredLegend","selectedLegends","setSelectedLegends","legendProps","focusedElement","setFocusedElement","isPopoverOpen","setPopoverOpen","hoverXValue","setHoverXValue","hoverYValues","setHoverYValues","refSelected","setRefSelected","prevPropsRef","_width","_height","_outerRadius","Math","min","chartValueSize","_getStylesBasedOnBreakpoint","_innerRadius","_minValue","_maxValue","_segments","_calloutAnchor","useEffect","current","clientWidth","clientHeight","prevProps","useImperativeHandle","componentRef","chartContainer","opts","toSVG","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","yValue","y","isBlurEvent","_wrapContent","content","maxWidth","textElement","text","node","isOverflowing","textLength","getComputedTextLength","_multiValueCallout","calloutProps","yValueHoverSubCountsExists","_yValueHoverSubCountsExists","YValueHover","calloutContentRoot","calloutDateTimeContainer","style","marginBottom","calloutContentX","xAxisCalloutAccessibilityData","culture","calloutInfoContainer","display","yValues","isLast","shouldDrawBorderBottom","callOutAccessibilityData","key","paddingBottom","_getCalloutContent","descriptionMessage","yValueHover","some","yAxisCalloutData","xValue","marginStyle","marginRight","toDrawShape","undefined","calloutBlockContainer","borderInlineStart","svgProps","shapeStyles","pathProps","fill","shape","Object","keys","calloutlegendText","calloutContentY","data","subcounts","subcountName","_getChartTitle","focusAttributes","root","ref","el","chartWrapper","svg","chart","onMouseLeave","x","textAnchor","aria-hidden","limits","arcId","Fragment","opacity","ariaLabel","tabIndex","textProps","wrapContent","dominantBaseline","hideTooltip","positioning","target","customCallout","customizedCallout","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,UAAUC,QAAQ,QAAQ,eAAe;AAClD,SAASC,OAAOC,KAAK,QAAQ,WAAW;AAExC,SACEC,MAAM,EACNC,cAAc,EACdC,0BAA0B,EAC1BC,uBAAuB,EACvBC,iBAAiB,EACjBC,YAAY,EACZC,UAAU,EACVC,MAAM,QACD,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAA8BC,OAAO,EAAEC,KAAK,QAAyB,mBAAmB;AAExF,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,YAAY,QAAQ,mCAAmC;AAEhE,SAASC,OAAO,QAAQ,qCAAqC;AAE7D,MAAMC,eAAe;AACrB,MAAMC,cAAc;AACpB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,sBAAsB;AAC5B,OAAO,MAAMC,cAAc,EAAE;AAC7B,OAAO,MAAMC,cAAc;IACzB;QAAEC,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;AAEF,OAAO,MAAMC,qBAAqB,CAACC,YAAoBC,UAAkBC;IACvE,IAAIC,iBAAiB,AAAEH,CAAAA,aAAaC,QAAO,IAAMC,CAAAA,WAAWD,QAAO,IAAM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C7B;QACA8I,UAAUxG,eAAe;QACzB8K,aAAaxE;WAMtBlC,kBACA,CAACjH,MAAM6N,WAAW,IAAIhM,+BACrB,oBAAC9D;QACE,GAAGiC,MAAM6J,YAAY;QACtBiE,aAAa;YACXC,QAAQ5L;QACV;QACAN,eAAeA;QACfmM,eAAe;YACbC,mBAAmBrE,mBAAmB;gBAAE7H,aAAaA;gBAAaiI,aAAa/H;YAAa;QAC9F;;AAKV,GACA;AACFnC,WAAWoO,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 { YValueHover } from '../../index';\nimport {\n Points,\n areArraysEqual,\n formatScientificLimitWidth,\n getAccessibleDataObject,\n getColorFromToken,\n getNextColor,\n pointTypes,\n useRtl,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { SVGTooltipText } from '../../utilities/SVGTooltipText';\nimport { Legend, LegendShape, Legends, Shape } from '../Legends/index';\nimport { GaugeChartVariant, GaugeValueFormat, GaugeChartProps, GaugeChartSegment } from './GaugeChart.types';\nimport { useFocusableGroup } 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 [hoverXValue, setHoverXValue] = React.useState<string | number>('');\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 // eslint-disable-next-line @typescript-eslint/no-shadow\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 // eslint-disable-next-line react/jsx-no-bind\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 = document.getElementById(elementId!);\n _calloutAnchor = legend;\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const hoverXValue: string =\n 'Current value is ' + getChartValueLabel(props.chartValue, _minValue, _maxValue, props.chartValueFormat, true);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const hoverYValues: YValue[] = _segments.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 setHoverXValue(hoverXValue);\n setHoverYValues(hoverYValues);\n if (isFocusEvent) {\n setFocusedElement(legend);\n }\n }\n\n function _hideCallout(isBlurEvent?: boolean) {\n _calloutAnchor = '';\n setPopoverOpen(false);\n setHoverXValue('');\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 _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 focusAttributes = useFocusableGroup();\n return (\n <div\n className={classes.root}\n ref={el => {\n _rootElem.current = el;\n }}\n >\n <div className={classes.chartWrapper} {...focusAttributes}>\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 <text\n x={0}\n y={-(_outerRadius + TITLE_OFFSET)}\n textAnchor=\"middle\"\n className={classes.chartTitle}\n aria-hidden={true}\n >\n {props.chartTitle}\n </text>\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 {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 'img',\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 {_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: _multiValueCallout({ hoverXValue: hoverXValue, YValueHover: hoverYValues }),\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","formatToLocaleString","SVGTooltipText","Legends","Shape","useFocusableGroup","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","hoverXValue","setHoverXValue","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","yValue","y","isBlurEvent","_wrapContent","content","maxWidth","textElement","text","node","isOverflowing","textLength","getComputedTextLength","_multiValueCallout","calloutProps","yValueHoverSubCountsExists","_yValueHoverSubCountsExists","YValueHover","calloutContentRoot","calloutDateTimeContainer","style","marginBottom","calloutContentX","xAxisCalloutAccessibilityData","culture","calloutInfoContainer","display","yValues","isLast","shouldDrawBorderBottom","callOutAccessibilityData","key","paddingBottom","_getCalloutContent","descriptionMessage","yValueHover","some","yAxisCalloutData","xValue","marginStyle","marginRight","toDrawShape","undefined","calloutBlockContainer","borderInlineStart","svgProps","shapeStyles","pathProps","fill","shape","Object","keys","calloutlegendText","calloutContentY","data","subcounts","subcountName","_getChartTitle","focusAttributes","root","ref","el","chartWrapper","svg","chart","onMouseLeave","x","textAnchor","aria-hidden","limits","arcId","Fragment","opacity","ariaLabel","tabIndex","textProps","wrapContent","dominantBaseline","hideTooltip","positioning","target","customCallout","customizedCallout","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,UAAUC,QAAQ,QAAQ,eAAe;AAClD,SAASC,OAAOC,KAAK,QAAQ,WAAW;AAExC,SACEC,MAAM,EACNC,cAAc,EACdC,0BAA0B,EAC1BC,uBAAuB,EACvBC,iBAAiB,EACjBC,YAAY,EACZC,UAAU,EACVC,MAAM,QACD,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAA8BC,OAAO,EAAEC,KAAK,QAAQ,mBAAmB;AAEvE,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,YAAY,QAAQ,mCAAmC;AAChE,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,MAAMC,eAAe;AACrB,MAAMC,cAAc;AACpB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,eAAe;AACrB,MAAMC,sBAAsB;AAC5B,OAAO,MAAMC,cAAc,EAAE;AAC7B,OAAO,MAAMC,cAAc;IACzB;QAAEC,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;AAEF,OAAO,MAAMC,qBAAqB,CAACC,YAAoBC,UAAkBC;IACvE,IAAIC,iBAAiB,AAAEH,CAAAA,aAAa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f+L,eAAe;YACbC,mBAAmBrE,mBAAmB;gBAAEzH,aAAaA;gBAAa6H,aAAa3H;YAAa;QAC9F;;AAKV,GACA;AACFrC,WAAWkO,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/GaugeChart/GaugeChart.types.ts"],"sourcesContent":["import { LegendsProps } from '../Legends/index';\nimport { AccessibilityProps, Chart } from '../../types/index';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\n\n/**\n * Gauge Chart segment interface.\n * {@docCategory GaugeChart}\n */\nexport interface GaugeChartSegment {\n /**\n * Legend text for a segment\n */\n legend: string;\n\n /**\n * Size of the segment\n */\n size: number;\n\n /**\n * Color of the segment\n */\n color?: string;\n\n /**\n * Gradient color of the segment\n */\n gradient?: [string, string];\n\n /**\n * Accessibility data for the segment\n */\n accessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory GaugeChart}\n */\nexport type GaugeValueFormat = 'percentage' | 'fraction';\n\n/**\n * {@docCategory GaugeChart}\n */\nexport type GaugeChartVariant = 'single-segment' | 'multiple-segments';\n\n/**\n * Gauge Chart properties\n * {@docCategory GaugeChart}\n */\nexport interface GaugeChartProps {\n /**\n * Width of the chart\n */\n width?: number;\n\n /**\n * Height of the chart\n */\n height?: number;\n\n /**\n * Title of the chart\n */\n chartTitle?: string;\n\n /**\n * Current value of the gauge\n */\n chartValue: number;\n\n /**\n * Sections of the gauge\n */\n segments: GaugeChartSegment[];\n\n /**\n * Minimum value of the gauge\n * @defaultvalue 0\n */\n minValue?: number;\n\n /**\n * Maximum value of the gauge\n */\n maxValue?: number;\n\n /**\n * Additional text to display below the chart value\n */\n sublabel?: string;\n\n /**\n * Hide the min and max values of the gauge\n * @defaultvalue false\n */\n hideMinMax?: boolean;\n\n /**\n * Format of the chart value\n * @defaultvalue GaugeValueFormat.Percentage\n */\n chartValueFormat?: GaugeValueFormat | ((sweepFraction: [number, number]) => string);\n\n /**\n * Decides whether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /*\n * Props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /**\n * Do not show tooltips in chart\n * @defaultvalue false\n */\n hideTooltip?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules\n */\n styles?: GaugeChartStyles;\n\n /**\n * Defines the culture to localize the numbers and dates\n */\n culture?: string;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ChartPopoverProps>;\n\n /**\n * Specifies the variant of GaugeChart to be rendered\n * @defaultvalue GaugeChartVariant.MultipleSegments\n */\n variant?: GaugeChartVariant;\n\n /**\n * Prop to enable the gradient in the chart\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<Chart>;\n}\n\n/**\n * Gauge Chart styles\n * {@docCategory GaugeChart}\n */\nexport interface GaugeChartStyles {\n /**\n * Styles for the root element\n */\n root?: string;\n\n /**\n * Styles for the chart\n */\n chart?: string;\n\n /**\n * Styles for the min and max values\n */\n limits?: string;\n\n /**\n * Styles for the chart value\n */\n chartValue?: string;\n\n /**\n * Styles for the sublabel\n */\n sublabel?: string;\n\n /**\n * Styles for the needle\n */\n needle?: string;\n\n /**\n * Styles for the chart title\n */\n chartTitle?: string;\n\n /**\n * Styles for the segments\n */\n segment?: string;\n\n /**\n * Styles for gradient segments\n */\n gradientSegment?: string;\n\n /**\n * Styles for the legends container\n */\n legendsContainer?: string;\n\n /**\n * Styles for callout root-content\n */\n calloutContentRoot?: string;\n\n /**\n * Styles for callout x-content\n */\n calloutContentX?: string;\n\n /**\n * Styles for callout y-content\n */\n calloutContentY?: string;\n\n /**\n * Styles for description message\n */\n descriptionMessage?: string;\n\n /**\n * Styles for callout Date time container\n */\n calloutDateTimeContainer?: string;\n\n /**\n * Styles for callout info container\n */\n calloutInfoContainer?: string;\n\n /**\n * Styles for callout block container\n */\n calloutBlockContainer?: string;\n\n /**\n * Styles for callout legend text\n */\n calloutlegendText?: string;\n\n /**\n * Styles for the shape object in the callout\n */\n shapeStyles?: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n"],"names":[],"mappings":"AAgKA;;;CAGC,GACD,WAoGC"}
1
+ {"version":3,"sources":["../src/components/GaugeChart/GaugeChart.types.ts"],"sourcesContent":["import { LegendsProps } from '../Legends/index';\nimport { AccessibilityProps, Chart } from '../../types/index';\nimport { ChartPopoverProps } from '../CommonComponents/ChartPopover.types';\n\n/**\n * Gauge Chart segment interface.\n * {@docCategory GaugeChart}\n */\nexport interface GaugeChartSegment {\n /**\n * Legend text for a segment\n */\n legend: string;\n\n /**\n * Size of the segment\n */\n size: number;\n\n /**\n * Color of the segment\n */\n color?: string;\n\n /**\n * Gradient color of the segment\n */\n gradient?: [string, string];\n\n /**\n * Accessibility data for the segment\n */\n accessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory GaugeChart}\n */\nexport type GaugeValueFormat = 'percentage' | 'fraction';\n\n/**\n * {@docCategory GaugeChart}\n */\nexport type GaugeChartVariant = 'single-segment' | 'multiple-segments';\n\n/**\n * Gauge Chart properties\n * {@docCategory GaugeChart}\n */\nexport interface GaugeChartProps {\n /**\n * Width of the chart\n */\n width?: number;\n\n /**\n * Height of the chart\n */\n height?: number;\n\n /**\n * Title of the chart\n */\n chartTitle?: string;\n\n /**\n * Current value of the gauge\n */\n chartValue: number;\n\n /**\n * Sections of the gauge\n */\n segments: GaugeChartSegment[];\n\n /**\n * Minimum value of the gauge\n * @defaultvalue 0\n */\n minValue?: number;\n\n /**\n * Maximum value of the gauge\n */\n maxValue?: number;\n\n /**\n * Additional text to display below the chart value\n */\n sublabel?: string;\n\n /**\n * Hide the min and max values of the gauge\n * @defaultvalue false\n */\n hideMinMax?: boolean;\n\n /**\n * Format of the chart value\n * @defaultvalue GaugeValueFormat.Percentage\n */\n chartValueFormat?: GaugeValueFormat | ((sweepFraction: [number, number]) => string);\n\n /**\n * Decides whether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /*\n * Props for the legends in the chart\n */\n legendProps?: Partial<LegendsProps>;\n\n /**\n * Do not show tooltips in chart\n * @defaultvalue false\n */\n hideTooltip?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules\n */\n styles?: GaugeChartStyles;\n\n /**\n * Defines the culture to localize the numbers and dates\n */\n culture?: string;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ChartPopoverProps>;\n\n /**\n * Specifies the variant of GaugeChart to be rendered\n * @defaultvalue GaugeChartVariant.MultipleSegments\n */\n variant?: GaugeChartVariant;\n\n /**\n * Prop to enable the gradient in the chart\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.Ref<Chart>;\n}\n\n/**\n * Gauge Chart styles\n * {@docCategory GaugeChart}\n */\nexport interface GaugeChartStyles {\n /**\n * Styles for the root element\n */\n root?: string;\n\n /**\n * Styles for the chart\n */\n chart?: string;\n\n /**\n * Styles for the min and max values\n */\n limits?: string;\n\n /**\n * Styles for the chart value\n */\n chartValue?: string;\n\n /**\n * Styles for the sublabel\n */\n sublabel?: string;\n\n /**\n * Styles for the needle\n */\n needle?: string;\n\n /**\n * Styles for the chart title\n */\n chartTitle?: string;\n\n /**\n * Styles for the segments\n */\n segment?: string;\n\n /**\n * Styles for gradient segments\n */\n gradientSegment?: string;\n\n /**\n * Styles for the legends container\n */\n legendsContainer?: string;\n\n /**\n * Styles for callout root-content\n */\n calloutContentRoot?: string;\n\n /**\n * Styles for callout x-content\n */\n calloutContentX?: string;\n\n /**\n * Styles for callout y-content\n */\n calloutContentY?: string;\n\n /**\n * Styles for description message\n */\n descriptionMessage?: string;\n\n /**\n * Styles for callout Date time container\n */\n calloutDateTimeContainer?: string;\n\n /**\n * Styles for callout info container\n */\n calloutInfoContainer?: string;\n\n /**\n * Styles for callout block container\n */\n calloutBlockContainer?: string;\n\n /**\n * Styles for callout legend text\n */\n calloutlegendText?: string;\n\n /**\n * Styles for the shape object in the callout\n */\n shapeStyles?: string;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: string;\n}\n"],"names":[],"mappings":"AAgKA;;;CAGC,GACD,WAoGC"}
@@ -7,14 +7,15 @@ import { scaleBand as d3ScaleBand } from 'd3-scale';
7
7
  import { useId } from '@fluentui/react-utilities';
8
8
  import { ChartTypes, getAccessibleDataObject, tooltipOfAxislabels, XAxisTypes, getTypeOfAxis, formatScientificLimitWidth, getScalePadding, getBarWidth, isScalePaddingDefined, createNumericYAxis, domainRangeOfXStringAxis, createStringYAxis, getNextColor, areArraysEqual, calculateLongestLabelWidth, useRtl, calcRequiredWidth, calcTotalWidth, calcBandwidth, calcTotalBandUnits, sortAxisCategories } from '../../utilities/index';
9
9
  import { CartesianChart, Legends, getColorFromToken } from '../../index';
10
- import { toImage } from '../../utilities/image-export-utils';
11
10
  import { tokens } from '@fluentui/react-theme';
11
+ import { useImageExport } from '../../utilities/hooks';
12
+ import { isInvalidValue } from '@fluentui/chart-utilities';
12
13
  const MIN_DOMAIN_MARGIN = 8;
13
14
  const X1_INNER_PADDING = 0.1;
14
15
  const VERTICAL_BAR_GAP = 1;
15
16
  const MIN_BAR_HEIGHT = 1;
16
17
  export const GroupedVerticalBarChart = /*#__PURE__*/ React.forwardRef((_props, forwardedRef)=>{
17
- var _props_legendProps, _props_legendProps1;
18
+ var _props_legendProps, _props_legendProps1, _barData_, _lineData__data_, _lineData_;
18
19
  const props = {
19
20
  xAxisCategoryOrder: 'default',
20
21
  maxBarWidth: 24,
@@ -42,9 +43,8 @@ export const GroupedVerticalBarChart = /*#__PURE__*/ React.forwardRef((_props, f
42
43
  let _barLegends = [];
43
44
  let _lineLegends = [];
44
45
  let _legendColorMap = {};
45
- const cartesianChartRef = React.useRef(null);
46
+ const { cartesianChartRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);
46
47
  const Y_ORIGIN = 0;
47
- const _legendsRef = React.useRef(null);
48
48
  const _rectRef = React.useRef(null);
49
49
  const _uniqDotId = useId('gvbc_dot_');
50
50
  const [color, setColor] = React.useState('');
@@ -70,17 +70,6 @@ export const GroupedVerticalBarChart = /*#__PURE__*/ React.forwardRef((_props, f
70
70
  }, [
71
71
  (_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.selectedLegends
72
72
  ]);
73
- React.useImperativeHandle(props.componentRef, ()=>{
74
- var _cartesianChartRef_current;
75
- var _cartesianChartRef_current_chartContainer;
76
- return {
77
- chartContainer: (_cartesianChartRef_current_chartContainer = (_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer) !== null && _cartesianChartRef_current_chartContainer !== void 0 ? _cartesianChartRef_current_chartContainer : null,
78
- toImage: (opts)=>{
79
- var _cartesianChartRef_current, _legendsRef_current;
80
- return toImage((_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer, (_legendsRef_current = _legendsRef.current) === null || _legendsRef_current === void 0 ? void 0 : _legendsRef_current.toSVG, _useRtl, opts);
81
- }
82
- };
83
- }, []);
84
73
  const _adjustProps = ()=>{
85
74
  _barWidth = getBarWidth(props.barWidth, props.maxBarWidth);
86
75
  // x0_inner_padding = space_between_groups / (space_between_groups + group_width)
@@ -178,7 +167,6 @@ export const GroupedVerticalBarChart = /*#__PURE__*/ React.forwardRef((_props, f
178
167
  props.legendProps.onChange(selectedLegends, event, currentLegend);
179
168
  }
180
169
  };
181
- // eslint-disable-next-line @typescript-eslint/no-deprecated
182
170
  const _getLegendData = ()=>{
183
171
  const actions = [];
184
172
  const addLegendButton = (legendTitle, isLineLegendInBarChart)=>{
@@ -323,7 +311,9 @@ export const GroupedVerticalBarChart = /*#__PURE__*/ React.forwardRef((_props, f
323
311
  return categoryToValues;
324
312
  };
325
313
  const { barData, lineData } = _prepareChartData();
326
- const _xAxisType = getTypeOfAxis(barData[0].name, true);
314
+ var _barData__name;
315
+ const firstXValue = (_barData__name = (_barData_ = barData[0]) === null || _barData_ === void 0 ? void 0 : _barData_.name) !== null && _barData__name !== void 0 ? _barData__name : (_lineData_ = lineData[0]) === null || _lineData_ === void 0 ? void 0 : (_lineData__data_ = _lineData_.data[0]) === null || _lineData__data_ === void 0 ? void 0 : _lineData__data_.x;
316
+ const _xAxisType = isInvalidValue(firstXValue) ? XAxisTypes.StringAxis : getTypeOfAxis(firstXValue, true);
327
317
  const { barLegends, lineLegends, xAxisLabels, datasetForBars } = _createDataSetOfGVBC(barData, lineData);
328
318
  _barLegends = barLegends;
329
319
  _lineLegends = lineLegends;
@@ -425,9 +415,7 @@ export const GroupedVerticalBarChart = /*#__PURE__*/ React.forwardRef((_props, f
425
415
  singleSet, // eslint-disable-next-line @typescript-eslint/no-explicit-any
426
416
  xScale0, // eslint-disable-next-line @typescript-eslint/no-explicit-any
427
417
  xScale1, yScalePrimary, yScaleSecondary, containerHeight, xElement)=>{
428
- // eslint-disable-next-line @typescript-eslint/no-deprecated
429
418
  const singleGroup = [];
430
- // eslint-disable-next-line @typescript-eslint/no-deprecated
431
419
  const barLabelsForGroup = [];
432
420
  // Get the actual legends present at this x-axis point
433
421
  const presentLegends = _barLegends.filter((key)=>key in singleSet);