@fluentui/react-charts 9.3.4 → 9.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -2
- package/dist/index.d.ts +2 -2
- package/lib/components/ChartTable/ChartTable.js +3 -1
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +25 -21
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +3 -6
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +8 -4
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +42 -17
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +12 -7
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +5 -5
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +3 -1
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +5 -5
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +3 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/Legends/Legends.js +3 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +5 -4
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +1 -1
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +3 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +12 -4
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +8 -8
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +3 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +25 -21
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +3 -6
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +8 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +12 -7
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +5 -5
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +3 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -5
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +3 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +3 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +5 -4
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +3 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +12 -4
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +8 -8
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/package.json +8 -8
|
@@ -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 className={classes.root} ref={el => (_rootElem.current = el)}>\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,SAA8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,cAAcJ,CAAAA,IAAKK,iBAAiBL,GAAGtH,QAAQG,MAAM,EAAEgO;YACvDL,cAAcxG,CAAAA,IAAKmC;YACnB7B,aAAaN,CAAAA,IAAKK,iBAAiBL,GAAGtH,QAAQG,MAAM,EAAEgO;YACtDI,UAAUzF,mBAAmB9I,QAAQG,MAAM,KAAK8I,yBAAyB,IAAIsD;;IAIrF,IACC/F,+BACD,oBAACM;QACCY,cAAcJ,CAAAA,IAAKK,iBAAiBL,GAAG;QACvCM,aAAaN,CAAAA,IAAKK,iBAAiBL,GAAG;qBAEtC,oBAAC7I;QACCyL,SAAS1J,mBAAmBM,MAAMnB,UAAU,EAAEiE,WAAWC,WAAW/C,MAAML,gBAAgB;QAC1F+N,WAAW;YACTT,GAAG;YACHhE,GAAG;YACHiE,YAAY;YACZ9G,WAAWxC,QAAQ/E,UAAU;YAC7BF,UAAUgE;YACV,eAAe;QACjB;QACA0G,UAAUxG,eAAe,IAAI;QAC7B8K,aAAaxE;SAGhBnJ,MAAMO,QAAQ,kBACb,oBAAC5C;QACCyL,SAASpJ,MAAMO,QAAQ;QACvBmN,WAAW;YACTT,GAAG;YACHhE,GAAG;YACHiE,YAAY;YACZU,kBAAkB;YAClBxH,WAAWxC,QAAQrD,QAAQ;QAC7B;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, 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,OA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AAmB;gBAAE7H,aAAaA;gBAAaiI,aAAa/H;YAAa;QAC9F;;AAKV,GACA;AACFnC,WAAWoO,WAAW,GAAG"}
|
|
@@ -23,13 +23,13 @@ export const HeatMapChart = /*#__PURE__*/ React.forwardRef((props = {
|
|
|
23
23
|
const _stringYAxisDataPoints = React.useRef([]);
|
|
24
24
|
const _dataSet = React.useRef({});
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
const _colorScale = React.useRef();
|
|
26
|
+
const _colorScale = React.useRef(undefined);
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
const _xAxisScale = React.useRef();
|
|
28
|
+
const _xAxisScale = React.useRef(undefined);
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
-
const _yAxisScale = React.useRef();
|
|
31
|
-
const _xAxisType = React.useRef();
|
|
32
|
-
const _yAxisType = React.useRef();
|
|
30
|
+
const _yAxisScale = React.useRef(undefined);
|
|
31
|
+
const _xAxisType = React.useRef(undefined);
|
|
32
|
+
const _yAxisType = React.useRef(undefined);
|
|
33
33
|
const _calloutAnchorPoint = React.useRef(null);
|
|
34
34
|
const _emptyChartId = useId('_HeatMap_empty');
|
|
35
35
|
const _margins = React.useRef({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/HeatMapChart/HeatMapChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { HeatMapChartProps } from './HeatMapChart.types';\nimport {\n AccessibilityProps,\n Chart,\n HeatMapChartData,\n HeatMapChartDataPoint,\n Margins,\n ImageExportOptions,\n} from '../../types/index';\nimport {\n ChartTypes,\n getAccessibleDataObject,\n getColorContrast,\n getTypeOfAxis,\n resolveCSSVariables,\n XAxisTypes,\n YAxisType,\n createNumericYAxis,\n IMargins,\n IDomainNRange,\n domainRangeOfXStringAxis,\n createStringYAxis,\n useRtl,\n sortAxisCategories,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { CartesianChart, ChartPopoverProps, ChildProps } from '../CommonComponents/index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { useHeatMapChartStyles } from './useHeatMapChartStyles.styles';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { format as d3Format } from 'd3-format';\nimport { timeFormat as d3TimeFormat } from 'd3-time-format';\nimport { toImage } from '../../utilities/image-export-utils';\n\ntype DataSet = {\n dataSet: RectanglesGraphData;\n yAxisPoints: string[];\n xAxisPoints: string[];\n};\ntype FlattenData = HeatMapChartDataPoint & {\n legend: string;\n};\ntype RectanglesGraphData = { [key: string]: FlattenData[] };\n\nexport const HeatMapChart: React.FunctionComponent<HeatMapChartProps> = React.forwardRef<\n HTMLDivElement,\n HeatMapChartProps\n>(\n (\n props = {\n xAxisCategoryOrder: 'default',\n yAxisCategoryOrder: 'default',\n data: [],\n domainValuesForColorScale: [],\n rangeValuesForColorScale: [],\n },\n forwardedRef,\n ) => {\n const classes = useHeatMapChartStyles(props);\n const _stringXAxisDataPoints = React.useRef<string[]>([]);\n const _stringYAxisDataPoints = React.useRef<string[]>([]);\n const _dataSet = React.useRef<RectanglesGraphData>({});\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _colorScale = React.useRef<any>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _xAxisScale = React.useRef<any>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _yAxisScale = React.useRef<any>();\n const _xAxisType = React.useRef<XAxisTypes>();\n const _yAxisType = React.useRef<YAxisType>();\n const _calloutAnchorPoint = React.useRef<FlattenData | null>(null);\n const _emptyChartId = useId('_HeatMap_empty');\n const _margins = React.useRef<Margins>({});\n const cartesianChartRef = React.useRef<Chart>(null);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRtl = useRtl();\n\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [isPopoverOpen, setPopoverOpen] = React.useState<boolean>(false);\n const [calloutLegend, setCalloutLegend] = React.useState<string>('');\n const [calloutTextColor, setCalloutTextColor] = React.useState<string>('');\n const [calloutYValue, setCalloutYValue] = React.useState<string>('');\n const [ratio, setRatio] = React.useState<[number, number]>();\n const [descriptionMessage, setDescriptionMessage] = React.useState<string>('');\n const [callOutAccessibilityData, setCallOutAccessibilityData] = React.useState<AccessibilityProps>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\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 function _getMinMaxOfYAxis() {\n return { startValue: 0, endValue: 0 };\n }\n\n function _getDomainNRangeValues(\n points: HeatMapChartDataPoint[],\n margins: IMargins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis || xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };\n } else {\n domainNRangeValue = domainRangeOfXStringAxis(_margins.current, width, isRTL);\n }\n return domainNRangeValue;\n }\n\n const _getXandY = (): { x: string | Date | number; y: string | Date | number } => {\n let x: string | Date | number = '';\n let y: string | Date | number = '';\n props.data.forEach((item: HeatMapChartData) => {\n if (item.data && item.data.length > 0) {\n x = item.data[0].x;\n y = item.data[0].y;\n return { x, y };\n }\n });\n return { x, y };\n };\n\n const _getMargins = (margins: Margins) => {\n _margins.current = margins;\n };\n\n const _getOpacity = (legendTitle: string): string => {\n const opacity = _legendHighlighted(legendTitle) || _noLegendHighlighted() ? '1' : '0.1';\n return opacity;\n };\n\n const _onRectFocus = (id: string, data: FlattenData, focusEvent: React.FocusEvent<SVGGElement>): void => {\n const boundingRect = focusEvent.currentTarget.getBoundingClientRect();\n const clientX = boundingRect.left + boundingRect.width / 2;\n const clientY = boundingRect.top + boundingRect.height / 2;\n updatePosition(clientX, clientY);\n /** Show the callout if highlighted rectangle is focused and Hide it if unhighlighted rectangle is focused */\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setCalloutYValue(`${data.rectText}`);\n setCalloutTextColor(Number.isNaN(data.value) ? tokens.colorNeutralForeground1 : _colorScale.current(data.value));\n setCalloutLegend(data.legend);\n setRatio(data.ratio);\n setDescriptionMessage(data.descriptionMessage || '');\n setCallOutAccessibilityData(data.callOutAccessibilityData);\n };\n\n const _onRectMouseOver = (id: string, data: FlattenData, mouseEvent: React.MouseEvent<SVGGElement>): void => {\n mouseEvent.persist();\n if (_calloutAnchorPoint.current !== data) {\n _calloutAnchorPoint.current = data;\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n /** Show the callout if highlighted rectangle is hovered and Hide it if unhighlighted rectangle is hovered */\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setCalloutYValue(`${data.rectText}`);\n setCalloutTextColor(\n Number.isNaN(data.value) ? tokens.colorNeutralForeground1 : _colorScale.current(data.value),\n );\n setCalloutLegend(data.legend);\n setRatio(data.ratio);\n setDescriptionMessage(data.descriptionMessage || '');\n setCallOutAccessibilityData(data.callOutAccessibilityData);\n }\n };\n\n const _onRectBlurOrMouseOut = (): void => {\n /**/\n };\n\n const _handleChartMouseLeave = (): void => {\n _calloutAnchorPoint.current = null;\n setPopoverOpen(false);\n };\n\n const _getInvertedTextColor = (color: string): string => {\n return color === tokens.colorNeutralForeground1 ? tokens.colorNeutralBackground1 : tokens.colorNeutralForeground1;\n };\n\n /**\n * This is the function which is responsible for\n * drawing the rectangle in the graph and also\n * attaching dom events to that rectangles\n */\n const _createRectangles = (): React.ReactNode => {\n const rectangles: JSXElement[] = [];\n const yAxisDataPoints = _stringYAxisDataPoints.current.slice().reverse();\n /**\n * yAxisDataPoint is noting but the DataPoint\n * which will be rendered on the y-axis\n */\n yAxisDataPoints.forEach((yAxisDataPoint: string) => {\n let index = 0;\n _stringXAxisDataPoints.current.forEach((xAxisDataPoint: string) => {\n let rectElement: JSXElement;\n const id = `x${xAxisDataPoint}y${yAxisDataPoint}`;\n if (\n _dataSet.current[yAxisDataPoint][index]?.x === xAxisDataPoint &&\n typeof _dataSet.current[yAxisDataPoint][index]?.value === 'number'\n ) {\n /**\n * dataPointObject is an object where it contains information on single\n * data point such as x, y , value, rectText property of the rectangle\n */\n const dataPointObject = _dataSet.current[yAxisDataPoint][index];\n let styleRules = '';\n let foregroundColor = tokens.colorNeutralForeground1;\n if (cartesianChartRef.current?.chartContainer) {\n styleRules = resolveCSSVariables(cartesianChartRef.current.chartContainer, foregroundColor);\n }\n const contrastRatio = getColorContrast(styleRules, _colorScale.current(dataPointObject.value));\n if (contrastRatio < 3) {\n foregroundColor = _getInvertedTextColor(foregroundColor);\n }\n rectElement = (\n <g\n key={id}\n role=\"img\"\n aria-label={_getAriaLabel(dataPointObject)}\n tabIndex={_legendHighlighted(dataPointObject.legend) || _noLegendHighlighted() ? 0 : -1}\n fillOpacity={_getOpacity(dataPointObject.legend)}\n transform={`translate(${_xAxisScale.current(dataPointObject.x)}, ${_yAxisScale.current(\n dataPointObject.y,\n )})`}\n onFocus={e => _onRectFocus(id, dataPointObject, e)}\n onBlur={_onRectBlurOrMouseOut}\n onMouseOver={e => _onRectMouseOver(id, dataPointObject, e)}\n onMouseOut={_onRectBlurOrMouseOut}\n >\n <rect\n fill={_colorScale.current(dataPointObject.value)}\n width={_xAxisScale.current.bandwidth()}\n height={_yAxisScale.current.bandwidth()}\n onClick={dataPointObject.onClick}\n />\n <text\n dominantBaseline={'middle'}\n textAnchor={'middle'}\n className={classes.text}\n transform={`translate(${_xAxisScale.current.bandwidth() / 2}, ${\n _yAxisScale.current.bandwidth() / 2\n })`}\n fill={foregroundColor}\n >\n {formatToLocaleString(dataPointObject.rectText, props.culture, props.useUTC) as React.ReactNode}\n </text>\n </g>\n );\n index++;\n } else {\n const dataPointObject: FlattenData = {\n x: xAxisDataPoint,\n y: yAxisDataPoint,\n value: NaN,\n rectText: 'No data available',\n legend: '',\n };\n rectElement = (\n <g\n key={id}\n role=\"img\"\n aria-label={_getAriaLabel(dataPointObject)}\n tabIndex={_noLegendHighlighted() ? 0 : -1}\n transform={`translate(${_xAxisScale.current(dataPointObject.x)}, ${_yAxisScale.current(\n dataPointObject.y,\n )})`}\n onFocus={e => _onRectFocus(id, dataPointObject, e)}\n onBlur={_onRectBlurOrMouseOut}\n onMouseOver={e => _onRectMouseOver(id, dataPointObject, e)}\n onMouseOut={_onRectBlurOrMouseOut}\n >\n <rect\n fill=\"transparent\"\n width={_xAxisScale.current.bandwidth()}\n height={_yAxisScale.current.bandwidth()}\n />\n </g>\n );\n }\n rectangles.push(rectElement);\n });\n });\n return rectangles;\n };\n /**\n * when the legend is hovered we need to highlight\n * all the rectangles which fall under that category\n * and un-highlight the rest of them\n * @param legendTitle\n */\n const _onLegendHover = (legendTitle: string): void => {\n setActiveLegend(legendTitle);\n };\n\n /**\n * when the mouse is out from the legend , we need\n * to show the graph in initial mode.\n */\n const _onLegendLeave = (): void => {\n setActiveLegend('');\n };\n /**\n * @param legendTitle\n * when the legend is clicked we need to highlight\n * all the rectangles which fall under that category\n * and un highlight the rest of them\n */\n const _onLegendClick = (legendTitle: string): void => {\n /**\n * check if the legend is already selceted,\n * if yes, un-select the legend, else\n * set the selected legend state to legendTitle\n */\n if (selectedLegend === legendTitle) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(legendTitle);\n }\n };\n const _createLegendBars = (): JSXElement => {\n const { data, legendProps } = props;\n const legends: Legend[] = [];\n data.forEach((item: HeatMapChartData) => {\n const legend: Legend = {\n title: item.legend,\n color: _colorScale.current(item.value),\n action: () => {\n _onLegendClick(item.legend);\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(item.legend);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n legends.push(legend);\n });\n return <Legends {...legendProps} legends={legends} legendRef={_legendsRef} />;\n };\n\n const _getColorScale = () => {\n const { domainValuesForColorScale, rangeValuesForColorScale } = props;\n return d3ScaleLinear()\n .domain(domainValuesForColorScale)\n .range(rangeValuesForColorScale as unknown as number[]);\n };\n\n const _getXIndex = (value: string | Date | number): string => {\n if (_xAxisType.current === XAxisTypes.DateAxis) {\n return `${(value as Date).getTime()}`;\n } else if (_xAxisType.current === XAxisTypes.StringAxis) {\n return value as string;\n } else if (_xAxisType.current === XAxisTypes.NumericAxis) {\n return `${value}`;\n } else {\n return '';\n }\n };\n const _getYIndex = (value: string | Date | number): string => {\n if (_yAxisType.current === YAxisType.DateAxis) {\n return `${(value as Date).getTime()}`;\n } else if (_yAxisType.current === YAxisType.StringAxis) {\n return value as string;\n } else if (_yAxisType.current === YAxisType.NumericAxis) {\n return `${value}`;\n } else {\n return '';\n }\n };\n\n const { xAxisStringFormatter } = props;\n const _getFormattedLabelForXAxisDataPoint = React.useCallback(\n (point: string): string => {\n return xAxisStringFormatter ? xAxisStringFormatter(point) : point;\n },\n [xAxisStringFormatter],\n );\n\n const { yAxisStringFormatter } = props;\n const _getFormattedLabelForYAxisDataPoint = React.useCallback(\n (point: string): string => {\n return yAxisStringFormatter ? yAxisStringFormatter(point) : point;\n },\n [yAxisStringFormatter],\n );\n\n /**\n * This function will return the final sorted and formatted x-axis points\n * which will be rendered on the x-axis\n * @param points\n * @returns x-axis points\n */\n const _getXAxisDataPoints = React.useCallback(\n (points: { [key: string]: '1' }): string[] => {\n let xAxisPoints: string[] = [];\n const unFormattedXAxisDataPoints = _getOrderedXAxisLabels(points);\n xAxisPoints = unFormattedXAxisDataPoints.map((xPoint: string) => {\n if (_xAxisType.current === XAxisTypes.DateAxis) {\n return _getStringFormattedDate(xPoint, props.xAxisDateFormatString);\n } else if (_xAxisType.current === XAxisTypes.NumericAxis) {\n return _getStringFormattedNumber(xPoint, props.xAxisNumberFormatString);\n } else {\n return _getFormattedLabelForXAxisDataPoint(xPoint);\n }\n });\n\n return xAxisPoints;\n },\n [\n _getFormattedLabelForXAxisDataPoint,\n props.sortOrder,\n props.xAxisDateFormatString,\n props.xAxisNumberFormatString,\n ],\n );\n\n /**\n * This function will return the final sorted and formatted y-axis points\n * which will be rendered on the y-axis\n * @param points\n * @returns yaxis points\n */\n const _getYAxisDataPoints = React.useCallback(\n (points: { [key: string]: '1' }): string[] => {\n let yAxisPoints: string[] = [];\n const unFormattedYAxisDataPoints = _getOrderedYAxisLabels(points);\n yAxisPoints = unFormattedYAxisDataPoints.map((yPoint: string) => {\n if (_yAxisType.current === YAxisType.DateAxis) {\n return _getStringFormattedDate(yPoint, props.yAxisDateFormatString);\n } else if (_yAxisType.current === YAxisType.NumericAxis) {\n return _getStringFormattedNumber(yPoint, props.yAxisNumberFormatString);\n } else {\n return _getFormattedLabelForYAxisDataPoint(yPoint);\n }\n });\n\n return yAxisPoints;\n },\n [\n _getFormattedLabelForYAxisDataPoint,\n props.sortOrder,\n props.yAxisDateFormatString,\n props.yAxisNumberFormatString,\n ],\n );\n\n /**\n * This will create a new data set based on the prop\n * @data\n * We will be using This data set to contsruct our rectangles\n * in the chart, we use this data set becuase, when we loop in this\n * data and build the heat map, it will support accessibility as\n * specified in the figma\n */\n\n const _createNewDataSet = React.useCallback(\n (\n data: HeatMapChartData[],\n xAxisDateFormatString: string | undefined,\n xAxisNumberFormatString: string | undefined,\n yAxisDateFormatString: string | undefined,\n yAxisNumberFormatString: string | undefined,\n ): DataSet => {\n /**\n * please do not destructure any of the props here,\n * instead send them as parameter to this functions so that\n * this functions get called whenever the prop changes\n */\n const flattenData: FlattenData[] = [];\n /**\n * below for each loop will store all the datapoints in the one array.\n * basically it will flatten the nestesd array (data prop) into single array\n * of object. where each object contains x, y, rectText , value and legend propety of single\n * data point.\n */\n data.forEach((item: HeatMapChartData) => {\n item.data.forEach((point: HeatMapChartDataPoint) => {\n flattenData.push({ ...point, legend: item.legend });\n });\n });\n const yPoints: RectanglesGraphData = {};\n const uniqueYPoints: { [key: string]: '1' } = {};\n const uniqueXPoints: { [key: string]: '1' } = {};\n flattenData.forEach((item: FlattenData) => {\n const posX = _getXIndex(item.x);\n const posY = _getYIndex(item.y);\n\n uniqueXPoints[posX] = '1';\n uniqueYPoints[posY] = '1';\n /** we will check if the property(posY) is already there in object, if Yes,\n * then we will append the item in the Array related to the pos, if not\n * then we will simply append the item in the new Array and\n * assign that array to the property (posY) in the Object\n * and finally we will get the array of Objects associated to each\n * property (which is nothing but y data point) and object in the\n * array are noting but x data points associated to the property y\n */\n if (yPoints[posY]) {\n yPoints[posY] = [...yPoints[posY], item];\n } else {\n yPoints[posY] = [item];\n }\n });\n /**\n * we will now sort(ascending) the array's of y data point based on the x value\n * sorting is important to achive the accessibility order of the\n * rectangles and then format the x and y datapoints respectively\n */\n Object.keys(yPoints).forEach((item: string) => {\n yPoints[item] = _getOrderedXPoints(yPoints[item]);\n\n yPoints[item].forEach((datapoint: HeatMapChartDataPoint) => {\n if (_xAxisType.current === XAxisTypes.DateAxis) {\n datapoint.x = _getStringFormattedDate(datapoint.x as string, xAxisDateFormatString);\n }\n if (_xAxisType.current === XAxisTypes.NumericAxis) {\n datapoint.x = _getStringFormattedNumber(datapoint.x as string, xAxisNumberFormatString);\n }\n if (_xAxisType.current === XAxisTypes.StringAxis) {\n datapoint.x = _getFormattedLabelForXAxisDataPoint(datapoint.x as string);\n }\n if (_yAxisType.current === YAxisType.DateAxis) {\n datapoint.y = _getStringFormattedDate(datapoint.y as string, yAxisDateFormatString);\n }\n if (_yAxisType.current === YAxisType.NumericAxis) {\n datapoint.y = _getStringFormattedNumber(datapoint.y as string, yAxisNumberFormatString);\n }\n if (_yAxisType.current === YAxisType.StringAxis) {\n datapoint.y = _getFormattedLabelForYAxisDataPoint(datapoint.y as string);\n }\n });\n });\n /**\n * if y-axis data points are of type date or number or if we have string formatter,\n * then we need to change data points to their respective string\n * format, becuase in the private variable _stringYAxisDatapoints, points will be stored in\n * string format. and in here `yPoint` are not so we need to change, so that\n * function `_createRectangles` should work perfetcly while looping, and if we don't change\n * then `_createRectangles` will fail while looping, causing the error\n * Cannot read property 'forEach' of undefined\n */\n\n Object.keys(yPoints).forEach((yPoint: string) => {\n if (_yAxisType.current === YAxisType.DateAxis) {\n yPoints[_getStringFormattedDate(yPoint, yAxisDateFormatString)] = yPoints[yPoint];\n } else if (_yAxisType.current === YAxisType.NumericAxis) {\n yPoints[`${_getStringFormattedNumber(yPoint, yAxisNumberFormatString)}`] = yPoints[yPoint];\n } else {\n yPoints[_getFormattedLabelForYAxisDataPoint(yPoint)] = yPoints[yPoint];\n }\n });\n /**\n * assigning new data set\n */\n const dataSet = yPoints;\n /**\n * These are the Y axis data points which will get rendered in the\n * Y axis in graph\n */\n const yAxisPoints = _getYAxisDataPoints(uniqueYPoints);\n /**\n * These are the x axis data points which will get rendered in the\n * x axis in the graph\n */\n\n const xAxisPoints = _getXAxisDataPoints(uniqueXPoints);\n return {\n dataSet,\n yAxisPoints,\n xAxisPoints,\n };\n },\n [\n _getFormattedLabelForXAxisDataPoint,\n _getFormattedLabelForYAxisDataPoint,\n _getXAxisDataPoints,\n _getYAxisDataPoints,\n props.sortOrder,\n ],\n );\n\n const _getStringFormattedDate = (point: string, formatString?: string): string => {\n const date = new Date();\n date.setTime(+point);\n return d3TimeFormat(formatString || '%b/%d')(date);\n };\n\n const _getStringFormattedNumber = (point: string, formatString?: string): string => {\n return d3Format(formatString || '.2~s')(+point);\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 const _legendHighlighted = (legendTitle: string) => {\n return selectedLegend === legendTitle || (selectedLegend === '' && activeLegend === legendTitle);\n };\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n const _noLegendHighlighted = () => {\n return selectedLegend === '' && activeLegend === '';\n };\n\n const _getAriaLabel = (point: FlattenData): string => {\n const xValue = point.x;\n const yValue = point.y;\n const legend = point.legend;\n const zValue = point.ratio ? `${point.ratio[0]}/${point.ratio[1]}` : point.rectText || point.value;\n const description = point.descriptionMessage;\n return (\n point.callOutAccessibilityData?.ariaLabel ||\n `${xValue}, ${yValue}. ${legend}, ${zValue}.` + (description ? ` ${description}.` : '')\n );\n };\n\n const _isChartEmpty = (): boolean => {\n return !(props.data && props.data.length > 0);\n };\n\n const _getChartTitle = (): string => {\n const { chartTitle } = props;\n const numDataPoints = props.data.reduce((acc, curr) => acc + curr.data.length, 0);\n return (chartTitle ? `${chartTitle}. ` : '') + `Heat map chart with ${numDataPoints} data points. `;\n };\n\n const _getOrderedXAxisLabels = (points: { [key: string]: '1' }) => {\n if (!_shouldOrderXAxisLabelsByCategoryOrder()) {\n // Keep the original ordering logic as the default behavior to ensure backward compatibility\n return Object.keys(points).sort((a: string, b: string) => {\n if (_xAxisType.current === XAxisTypes.DateAxis || _xAxisType.current === XAxisTypes.NumericAxis) {\n return +a - +b;\n } else {\n return props.sortOrder === 'none' ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 : -1;\n }\n });\n }\n\n return sortAxisCategories(_mapCategoryToValues(), props.xAxisCategoryOrder);\n };\n\n const _getOrderedYAxisLabels = (points: { [key: string]: '1' }) => {\n if (!_shouldOrderYAxisLabelsByCategoryOrder()) {\n // Keep the original ordering logic as the default behavior to ensure backward compatibility\n return Object.keys(points).sort((a: string, b: string) => {\n if (_yAxisType.current === YAxisType.DateAxis || _yAxisType.current === YAxisType.NumericAxis) {\n return +a - +b;\n } else {\n return props.sortOrder === 'none' ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 : -1;\n }\n });\n }\n\n return sortAxisCategories(_mapCategoryToValues(true), props.yAxisCategoryOrder);\n };\n\n const _getOrderedXPoints = (xPoints: FlattenData[]) => {\n if (!_shouldOrderXAxisLabelsByCategoryOrder()) {\n return xPoints.sort((a: HeatMapChartDataPoint, b: HeatMapChartDataPoint) => {\n if (_xAxisType.current === XAxisTypes.StringAxis) {\n return props.sortOrder === 'none'\n ? 0\n : (a.x as string).toLowerCase() > (b.x as string).toLowerCase()\n ? 1\n : -1;\n } else if (_xAxisType.current === XAxisTypes.DateAxis) {\n return (a.x as Date).getTime() - (b.x as Date).getTime();\n } else if (_xAxisType.current === XAxisTypes.NumericAxis) {\n return +(a.x as string) > +(b.x as string) ? 1 : -1;\n } else {\n return a.x > b.x ? 1 : -1;\n }\n });\n }\n\n const result: FlattenData[] = [];\n\n const xValueToPoints: Record<string, FlattenData[]> = {};\n xPoints.forEach(point => {\n const xValue = point.x as string;\n if (!xValueToPoints[xValue]) {\n xValueToPoints[xValue] = [];\n }\n xValueToPoints[xValue].push(point);\n });\n\n const xAxisLabels = _getOrderedXAxisLabels({});\n xAxisLabels.forEach(xValue => {\n if (xValueToPoints[xValue]) {\n result.push(...xValueToPoints[xValue]);\n }\n });\n\n return result;\n };\n\n const _shouldOrderXAxisLabelsByCategoryOrder = () => {\n return _xAxisType.current === XAxisTypes.StringAxis && props.xAxisCategoryOrder !== 'default';\n };\n\n const _shouldOrderYAxisLabelsByCategoryOrder = () => {\n return _yAxisType.current === YAxisType.StringAxis && props.yAxisCategoryOrder !== 'default';\n };\n\n const _mapCategoryToValues = (isYAxis = false) => {\n const categoryToValues: Record<string, number[]> = {};\n props.data.forEach(item => {\n item.data.forEach(point => {\n const category = (isYAxis ? point.y : point.x) as string;\n if (!categoryToValues[category]) {\n categoryToValues[category] = [];\n }\n categoryToValues[category].push(point.value);\n });\n });\n return categoryToValues;\n };\n\n const 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 }\n };\n\n const { x, y } = _getXandY();\n _xAxisType.current = getTypeOfAxis(x, true) as XAxisTypes;\n _yAxisType.current = getTypeOfAxis(y, false) as YAxisType;\n const { data, xAxisDateFormatString, xAxisNumberFormatString, yAxisDateFormatString, yAxisNumberFormatString } =\n props;\n _colorScale.current = _getColorScale();\n const { dataSet, xAxisPoints, yAxisPoints } = React.useMemo(\n () =>\n _createNewDataSet(\n data,\n xAxisDateFormatString,\n xAxisNumberFormatString,\n yAxisDateFormatString,\n yAxisNumberFormatString,\n ),\n [\n _createNewDataSet,\n data,\n xAxisDateFormatString,\n xAxisNumberFormatString,\n yAxisDateFormatString,\n yAxisNumberFormatString,\n ],\n );\n _dataSet.current = dataSet;\n _stringYAxisDataPoints.current = yAxisPoints;\n _stringXAxisDataPoints.current = xAxisPoints;\n const calloutProps: ChartPopoverProps = {\n ...props.calloutProps,\n isPopoverOpen,\n YValue: calloutYValue,\n legend: calloutLegend,\n color: calloutTextColor,\n ratio,\n descriptionMessage,\n clickPosition,\n ...getAccessibleDataObject(callOutAccessibilityData, 'text', false),\n styles: {\n calloutContentRoot: classes.calloutContentRoot!,\n },\n };\n const tickParams = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n return !_isChartEmpty() ? (\n <CartesianChart\n {...props}\n chartTitle={_getChartTitle()}\n points={data}\n chartType={ChartTypes.HeatMapChart}\n xAxisType={XAxisTypes.StringAxis}\n yAxisType={YAxisType.StringAxis}\n calloutProps={calloutProps}\n createYAxis={createNumericYAxis}\n datasetForXAxisDomain={_stringXAxisDataPoints.current}\n stringDatasetForYAxisDomain={_stringYAxisDataPoints.current}\n createStringYAxis={createStringYAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n getMinMaxOfYAxis={_getMinMaxOfYAxis}\n getmargins={_getMargins}\n xAxisTickCount={_stringXAxisDataPoints.current.length}\n xAxistickSize={0}\n xAxisPadding={0.02}\n yAxisPadding={0.02}\n legendBars={_createLegendBars()}\n onChartMouseLeave={_handleChartMouseLeave}\n componentRef={cartesianChartRef}\n tickParams={tickParams}\n /* eslint-disable react/jsx-no-bind */\n children={(p: ChildProps) => {\n _xAxisScale.current = p.xScale;\n _yAxisScale.current = p.yScalePrimary;\n return _createRectangles();\n }}\n />\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n"],"names":["React","ChartTypes","getAccessibleDataObject","getColorContrast","getTypeOfAxis","resolveCSSVariables","XAxisTypes","YAxisType","createNumericYAxis","domainRangeOfXStringAxis","createStringYAxis","useRtl","sortAxisCategories","formatToLocaleString","CartesianChart","useId","tokens","useHeatMapChartStyles","Legends","scaleLinear","d3ScaleLinear","format","d3Format","timeFormat","d3TimeFormat","toImage","HeatMapChart","forwardRef","props","xAxisCategoryOrder","yAxisCategoryOrder","data","domainValuesForColorScale","rangeValuesForColorScale","forwardedRef","classes","_stringXAxisDataPoints","useRef","_stringYAxisDataPoints","_dataSet","_colorScale","_xAxisScale","_yAxisScale","_xAxisType","_yAxisType","_calloutAnchorPoint","_emptyChartId","_margins","cartesianChartRef","_legendsRef","_isRtl","selectedLegend","setSelectedLegend","useState","activeLegend","setActiveLegend","isPopoverOpen","setPopoverOpen","calloutLegend","setCalloutLegend","calloutTextColor","setCalloutTextColor","calloutYValue","setCalloutYValue","ratio","setRatio","descriptionMessage","setDescriptionMessage","callOutAccessibilityData","setCallOutAccessibilityData","clickPosition","setClickPosition","x","y","useImperativeHandle","componentRef","chartContainer","current","opts","toSVG","_getMinMaxOfYAxis","startValue","endValue","_getDomainNRangeValues","points","margins","width","chartType","isRTL","xAxisType","barWidth","tickValues","shiftX","domainNRangeValue","NumericAxis","DateAxis","dStartValue","dEndValue","rStartValue","rEndValue","_getXandY","forEach","item","length","_getMargins","_getOpacity","legendTitle","opacity","_legendHighlighted","_noLegendHighlighted","_onRectFocus","id","focusEvent","boundingRect","currentTarget","getBoundingClientRect","clientX","left","clientY","top","height","updatePosition","legend","rectText","Number","isNaN","value","colorNeutralForeground1","_onRectMouseOver","mouseEvent","persist","_onRectBlurOrMouseOut","_handleChartMouseLeave","_getInvertedTextColor","color","colorNeutralBackground1","_createRectangles","rectangles","yAxisDataPoints","slice","reverse","yAxisDataPoint","index","xAxisDataPoint","rectElement","dataPointObject","styleRules","foregroundColor","contrastRatio","g","key","role","aria-label","_getAriaLabel","tabIndex","fillOpacity","transform","onFocus","e","onBlur","onMouseOver","onMouseOut","rect","fill","bandwidth","onClick","text","dominantBaseline","textAnchor","className","culture","useUTC","NaN","push","_onLegendHover","_onLegendLeave","_onLegendClick","_createLegendBars","legendProps","legends","title","action","hoverAction","onMouseOutAction","legendRef","_getColorScale","domain","range","_getXIndex","getTime","StringAxis","_getYIndex","xAxisStringFormatter","_getFormattedLabelForXAxisDataPoint","useCallback","point","yAxisStringFormatter","_getFormattedLabelForYAxisDataPoint","_getXAxisDataPoints","xAxisPoints","unFormattedXAxisDataPoints","_getOrderedXAxisLabels","map","xPoint","_getStringFormattedDate","xAxisDateFormatString","_getStringFormattedNumber","xAxisNumberFormatString","sortOrder","_getYAxisDataPoints","yAxisPoints","unFormattedYAxisDataPoints","_getOrderedYAxisLabels","yPoint","yAxisDateFormatString","yAxisNumberFormatString","_createNewDataSet","flattenData","yPoints","uniqueYPoints","uniqueXPoints","posX","posY","Object","keys","_getOrderedXPoints","datapoint","dataSet","formatString","date","Date","setTime","xValue","yValue","zValue","description","ariaLabel","_isChartEmpty","_getChartTitle","chartTitle","numDataPoints","reduce","acc","curr","_shouldOrderXAxisLabelsByCategoryOrder","sort","a","b","toLowerCase","_mapCategoryToValues","_shouldOrderYAxisLabelsByCategoryOrder","xPoints","result","xValueToPoints","xAxisLabels","isYAxis","categoryToValues","category","newX","newY","threshold","distance","Math","sqrt","pow","useMemo","calloutProps","YValue","styles","calloutContentRoot","tickParams","tickFormat","yAxisType","createYAxis","datasetForXAxisDomain","stringDatasetForYAxisDomain","getDomainNRangeValues","getMinMaxOfYAxis","getmargins","xAxisTickCount","xAxistickSize","xAxisPadding","yAxisPadding","legendBars","onChartMouseLeave","children","p","xScale","yScalePrimary","div","style"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAU/B,SACEC,UAAU,EACVC,uBAAuB,EACvBC,gBAAgB,EAChBC,aAAa,EACbC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,kBAAkB,EAGlBC,wBAAwB,EACxBC,iBAAiB,EACjBC,MAAM,EACNC,kBAAkB,QACb,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,cAAc,QAAuC,4BAA4B;AAC1F,SAASC,KAAK,QAAQ,4BAA4B;AAElD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAAiBC,OAAO,QAAyB,mBAAmB;AACpE,SAASC,eAAeC,aAAa,QAAQ,WAAW;AACxD,SAASC,UAAUC,QAAQ,QAAQ,YAAY;AAC/C,SAASC,cAAcC,YAAY,QAAQ,iBAAiB;AAC5D,SAASC,OAAO,QAAQ,qCAAqC;AAY7D,OAAO,MAAMC,6BAA2D1B,MAAM2B,UAAU,CAItF,CACEC,QAAQ;IACNC,oBAAoB;IACpBC,oBAAoB;IACpBC,MAAM,EAAE;IACRC,2BAA2B,EAAE;IAC7BC,0BAA0B,EAAE;AAC9B,CAAC,EACDC;IAEA,MAAMC,UAAUlB,sBAAsBW;IACtC,MAAMQ,yBAAyBpC,MAAMqC,MAAM,CAAW,EAAE;IACxD,MAAMC,yBAAyBtC,MAAMqC,MAAM,CAAW,EAAE;IACxD,MAAME,WAAWvC,MAAMqC,MAAM,CAAsB,CAAC;IACpD,8DAA8D;IAC9D,MAAMG,cAAcxC,MAAMqC,MAAM;IAChC,8DAA8D;IAC9D,MAAMI,cAAczC,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L,SAAS;QAAI;QAAG6C,cAAY;;AAEhF,GACA"}
|
|
1
|
+
{"version":3,"sources":["../src/components/HeatMapChart/HeatMapChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { HeatMapChartProps } from './HeatMapChart.types';\nimport {\n AccessibilityProps,\n Chart,\n HeatMapChartData,\n HeatMapChartDataPoint,\n Margins,\n ImageExportOptions,\n} from '../../types/index';\nimport {\n ChartTypes,\n getAccessibleDataObject,\n getColorContrast,\n getTypeOfAxis,\n resolveCSSVariables,\n XAxisTypes,\n YAxisType,\n createNumericYAxis,\n IMargins,\n IDomainNRange,\n domainRangeOfXStringAxis,\n createStringYAxis,\n useRtl,\n sortAxisCategories,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { CartesianChart, ChartPopoverProps, ChildProps } from '../CommonComponents/index';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\nimport { useHeatMapChartStyles } from './useHeatMapChartStyles.styles';\nimport { Legend, Legends, LegendContainer } from '../Legends/index';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { format as d3Format } from 'd3-format';\nimport { timeFormat as d3TimeFormat } from 'd3-time-format';\nimport { toImage } from '../../utilities/image-export-utils';\n\ntype DataSet = {\n dataSet: RectanglesGraphData;\n yAxisPoints: string[];\n xAxisPoints: string[];\n};\ntype FlattenData = HeatMapChartDataPoint & {\n legend: string;\n};\ntype RectanglesGraphData = { [key: string]: FlattenData[] };\n\nexport const HeatMapChart: React.FunctionComponent<HeatMapChartProps> = React.forwardRef<\n HTMLDivElement,\n HeatMapChartProps\n>(\n (\n props = {\n xAxisCategoryOrder: 'default',\n yAxisCategoryOrder: 'default',\n data: [],\n domainValuesForColorScale: [],\n rangeValuesForColorScale: [],\n },\n forwardedRef,\n ) => {\n const classes = useHeatMapChartStyles(props);\n const _stringXAxisDataPoints = React.useRef<string[]>([]);\n const _stringYAxisDataPoints = React.useRef<string[]>([]);\n const _dataSet = React.useRef<RectanglesGraphData>({});\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _colorScale = React.useRef<any>(undefined);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _xAxisScale = React.useRef<any>(undefined);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _yAxisScale = React.useRef<any>(undefined);\n const _xAxisType = React.useRef<XAxisTypes | undefined>(undefined);\n const _yAxisType = React.useRef<YAxisType | undefined>(undefined);\n const _calloutAnchorPoint = React.useRef<FlattenData | null>(null);\n const _emptyChartId = useId('_HeatMap_empty');\n const _margins = React.useRef<Margins>({});\n const cartesianChartRef = React.useRef<Chart>(null);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRtl = useRtl();\n\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [isPopoverOpen, setPopoverOpen] = React.useState<boolean>(false);\n const [calloutLegend, setCalloutLegend] = React.useState<string>('');\n const [calloutTextColor, setCalloutTextColor] = React.useState<string>('');\n const [calloutYValue, setCalloutYValue] = React.useState<string>('');\n const [ratio, setRatio] = React.useState<[number, number]>();\n const [descriptionMessage, setDescriptionMessage] = React.useState<string>('');\n const [callOutAccessibilityData, setCallOutAccessibilityData] = React.useState<AccessibilityProps>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\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 function _getMinMaxOfYAxis() {\n return { startValue: 0, endValue: 0 };\n }\n\n function _getDomainNRangeValues(\n points: HeatMapChartDataPoint[],\n margins: IMargins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis || xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };\n } else {\n domainNRangeValue = domainRangeOfXStringAxis(_margins.current, width, isRTL);\n }\n return domainNRangeValue;\n }\n\n const _getXandY = (): { x: string | Date | number; y: string | Date | number } => {\n let x: string | Date | number = '';\n let y: string | Date | number = '';\n props.data.forEach((item: HeatMapChartData) => {\n if (item.data && item.data.length > 0) {\n x = item.data[0].x;\n y = item.data[0].y;\n return { x, y };\n }\n });\n return { x, y };\n };\n\n const _getMargins = (margins: Margins) => {\n _margins.current = margins;\n };\n\n const _getOpacity = (legendTitle: string): string => {\n const opacity = _legendHighlighted(legendTitle) || _noLegendHighlighted() ? '1' : '0.1';\n return opacity;\n };\n\n const _onRectFocus = (id: string, data: FlattenData, focusEvent: React.FocusEvent<SVGGElement>): void => {\n const boundingRect = focusEvent.currentTarget.getBoundingClientRect();\n const clientX = boundingRect.left + boundingRect.width / 2;\n const clientY = boundingRect.top + boundingRect.height / 2;\n updatePosition(clientX, clientY);\n /** Show the callout if highlighted rectangle is focused and Hide it if unhighlighted rectangle is focused */\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setCalloutYValue(`${data.rectText}`);\n setCalloutTextColor(Number.isNaN(data.value) ? tokens.colorNeutralForeground1 : _colorScale.current(data.value));\n setCalloutLegend(data.legend);\n setRatio(data.ratio);\n setDescriptionMessage(data.descriptionMessage || '');\n setCallOutAccessibilityData(data.callOutAccessibilityData);\n };\n\n const _onRectMouseOver = (id: string, data: FlattenData, mouseEvent: React.MouseEvent<SVGGElement>): void => {\n mouseEvent.persist();\n if (_calloutAnchorPoint.current !== data) {\n _calloutAnchorPoint.current = data;\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n /** Show the callout if highlighted rectangle is hovered and Hide it if unhighlighted rectangle is hovered */\n setPopoverOpen(selectedLegend === '' || selectedLegend === data.legend);\n setCalloutYValue(`${data.rectText}`);\n setCalloutTextColor(\n Number.isNaN(data.value) ? tokens.colorNeutralForeground1 : _colorScale.current(data.value),\n );\n setCalloutLegend(data.legend);\n setRatio(data.ratio);\n setDescriptionMessage(data.descriptionMessage || '');\n setCallOutAccessibilityData(data.callOutAccessibilityData);\n }\n };\n\n const _onRectBlurOrMouseOut = (): void => {\n /**/\n };\n\n const _handleChartMouseLeave = (): void => {\n _calloutAnchorPoint.current = null;\n setPopoverOpen(false);\n };\n\n const _getInvertedTextColor = (color: string): string => {\n return color === tokens.colorNeutralForeground1 ? tokens.colorNeutralBackground1 : tokens.colorNeutralForeground1;\n };\n\n /**\n * This is the function which is responsible for\n * drawing the rectangle in the graph and also\n * attaching dom events to that rectangles\n */\n const _createRectangles = (): React.ReactNode => {\n const rectangles: JSXElement[] = [];\n const yAxisDataPoints = _stringYAxisDataPoints.current.slice().reverse();\n /**\n * yAxisDataPoint is noting but the DataPoint\n * which will be rendered on the y-axis\n */\n yAxisDataPoints.forEach((yAxisDataPoint: string) => {\n let index = 0;\n _stringXAxisDataPoints.current.forEach((xAxisDataPoint: string) => {\n let rectElement: JSXElement;\n const id = `x${xAxisDataPoint}y${yAxisDataPoint}`;\n if (\n _dataSet.current[yAxisDataPoint][index]?.x === xAxisDataPoint &&\n typeof _dataSet.current[yAxisDataPoint][index]?.value === 'number'\n ) {\n /**\n * dataPointObject is an object where it contains information on single\n * data point such as x, y , value, rectText property of the rectangle\n */\n const dataPointObject = _dataSet.current[yAxisDataPoint][index];\n let styleRules = '';\n let foregroundColor = tokens.colorNeutralForeground1;\n if (cartesianChartRef.current?.chartContainer) {\n styleRules = resolveCSSVariables(cartesianChartRef.current.chartContainer, foregroundColor);\n }\n const contrastRatio = getColorContrast(styleRules, _colorScale.current(dataPointObject.value));\n if (contrastRatio < 3) {\n foregroundColor = _getInvertedTextColor(foregroundColor);\n }\n rectElement = (\n <g\n key={id}\n role=\"img\"\n aria-label={_getAriaLabel(dataPointObject)}\n tabIndex={_legendHighlighted(dataPointObject.legend) || _noLegendHighlighted() ? 0 : -1}\n fillOpacity={_getOpacity(dataPointObject.legend)}\n transform={`translate(${_xAxisScale.current(dataPointObject.x)}, ${_yAxisScale.current(\n dataPointObject.y,\n )})`}\n onFocus={e => _onRectFocus(id, dataPointObject, e)}\n onBlur={_onRectBlurOrMouseOut}\n onMouseOver={e => _onRectMouseOver(id, dataPointObject, e)}\n onMouseOut={_onRectBlurOrMouseOut}\n >\n <rect\n fill={_colorScale.current(dataPointObject.value)}\n width={_xAxisScale.current.bandwidth()}\n height={_yAxisScale.current.bandwidth()}\n onClick={dataPointObject.onClick}\n />\n <text\n dominantBaseline={'middle'}\n textAnchor={'middle'}\n className={classes.text}\n transform={`translate(${_xAxisScale.current.bandwidth() / 2}, ${\n _yAxisScale.current.bandwidth() / 2\n })`}\n fill={foregroundColor}\n >\n {formatToLocaleString(dataPointObject.rectText, props.culture, props.useUTC) as React.ReactNode}\n </text>\n </g>\n );\n index++;\n } else {\n const dataPointObject: FlattenData = {\n x: xAxisDataPoint,\n y: yAxisDataPoint,\n value: NaN,\n rectText: 'No data available',\n legend: '',\n };\n rectElement = (\n <g\n key={id}\n role=\"img\"\n aria-label={_getAriaLabel(dataPointObject)}\n tabIndex={_noLegendHighlighted() ? 0 : -1}\n transform={`translate(${_xAxisScale.current(dataPointObject.x)}, ${_yAxisScale.current(\n dataPointObject.y,\n )})`}\n onFocus={e => _onRectFocus(id, dataPointObject, e)}\n onBlur={_onRectBlurOrMouseOut}\n onMouseOver={e => _onRectMouseOver(id, dataPointObject, e)}\n onMouseOut={_onRectBlurOrMouseOut}\n >\n <rect\n fill=\"transparent\"\n width={_xAxisScale.current.bandwidth()}\n height={_yAxisScale.current.bandwidth()}\n />\n </g>\n );\n }\n rectangles.push(rectElement);\n });\n });\n return rectangles;\n };\n /**\n * when the legend is hovered we need to highlight\n * all the rectangles which fall under that category\n * and un-highlight the rest of them\n * @param legendTitle\n */\n const _onLegendHover = (legendTitle: string): void => {\n setActiveLegend(legendTitle);\n };\n\n /**\n * when the mouse is out from the legend , we need\n * to show the graph in initial mode.\n */\n const _onLegendLeave = (): void => {\n setActiveLegend('');\n };\n /**\n * @param legendTitle\n * when the legend is clicked we need to highlight\n * all the rectangles which fall under that category\n * and un highlight the rest of them\n */\n const _onLegendClick = (legendTitle: string): void => {\n /**\n * check if the legend is already selceted,\n * if yes, un-select the legend, else\n * set the selected legend state to legendTitle\n */\n if (selectedLegend === legendTitle) {\n setSelectedLegend('');\n } else {\n setSelectedLegend(legendTitle);\n }\n };\n const _createLegendBars = (): JSXElement => {\n const { data, legendProps } = props;\n const legends: Legend[] = [];\n data.forEach((item: HeatMapChartData) => {\n const legend: Legend = {\n title: item.legend,\n color: _colorScale.current(item.value),\n action: () => {\n _onLegendClick(item.legend);\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n _onLegendHover(item.legend);\n },\n onMouseOutAction: () => {\n _onLegendLeave();\n },\n };\n legends.push(legend);\n });\n return <Legends {...legendProps} legends={legends} legendRef={_legendsRef} />;\n };\n\n const _getColorScale = () => {\n const { domainValuesForColorScale, rangeValuesForColorScale } = props;\n return d3ScaleLinear()\n .domain(domainValuesForColorScale)\n .range(rangeValuesForColorScale as unknown as number[]);\n };\n\n const _getXIndex = (value: string | Date | number): string => {\n if (_xAxisType.current === XAxisTypes.DateAxis) {\n return `${(value as Date).getTime()}`;\n } else if (_xAxisType.current === XAxisTypes.StringAxis) {\n return value as string;\n } else if (_xAxisType.current === XAxisTypes.NumericAxis) {\n return `${value}`;\n } else {\n return '';\n }\n };\n const _getYIndex = (value: string | Date | number): string => {\n if (_yAxisType.current === YAxisType.DateAxis) {\n return `${(value as Date).getTime()}`;\n } else if (_yAxisType.current === YAxisType.StringAxis) {\n return value as string;\n } else if (_yAxisType.current === YAxisType.NumericAxis) {\n return `${value}`;\n } else {\n return '';\n }\n };\n\n const { xAxisStringFormatter } = props;\n const _getFormattedLabelForXAxisDataPoint = React.useCallback(\n (point: string): string => {\n return xAxisStringFormatter ? xAxisStringFormatter(point) : point;\n },\n [xAxisStringFormatter],\n );\n\n const { yAxisStringFormatter } = props;\n const _getFormattedLabelForYAxisDataPoint = React.useCallback(\n (point: string): string => {\n return yAxisStringFormatter ? yAxisStringFormatter(point) : point;\n },\n [yAxisStringFormatter],\n );\n\n /**\n * This function will return the final sorted and formatted x-axis points\n * which will be rendered on the x-axis\n * @param points\n * @returns x-axis points\n */\n const _getXAxisDataPoints = React.useCallback(\n (points: { [key: string]: '1' }): string[] => {\n let xAxisPoints: string[] = [];\n const unFormattedXAxisDataPoints = _getOrderedXAxisLabels(points);\n xAxisPoints = unFormattedXAxisDataPoints.map((xPoint: string) => {\n if (_xAxisType.current === XAxisTypes.DateAxis) {\n return _getStringFormattedDate(xPoint, props.xAxisDateFormatString);\n } else if (_xAxisType.current === XAxisTypes.NumericAxis) {\n return _getStringFormattedNumber(xPoint, props.xAxisNumberFormatString);\n } else {\n return _getFormattedLabelForXAxisDataPoint(xPoint);\n }\n });\n\n return xAxisPoints;\n },\n [\n _getFormattedLabelForXAxisDataPoint,\n props.sortOrder,\n props.xAxisDateFormatString,\n props.xAxisNumberFormatString,\n ],\n );\n\n /**\n * This function will return the final sorted and formatted y-axis points\n * which will be rendered on the y-axis\n * @param points\n * @returns yaxis points\n */\n const _getYAxisDataPoints = React.useCallback(\n (points: { [key: string]: '1' }): string[] => {\n let yAxisPoints: string[] = [];\n const unFormattedYAxisDataPoints = _getOrderedYAxisLabels(points);\n yAxisPoints = unFormattedYAxisDataPoints.map((yPoint: string) => {\n if (_yAxisType.current === YAxisType.DateAxis) {\n return _getStringFormattedDate(yPoint, props.yAxisDateFormatString);\n } else if (_yAxisType.current === YAxisType.NumericAxis) {\n return _getStringFormattedNumber(yPoint, props.yAxisNumberFormatString);\n } else {\n return _getFormattedLabelForYAxisDataPoint(yPoint);\n }\n });\n\n return yAxisPoints;\n },\n [\n _getFormattedLabelForYAxisDataPoint,\n props.sortOrder,\n props.yAxisDateFormatString,\n props.yAxisNumberFormatString,\n ],\n );\n\n /**\n * This will create a new data set based on the prop\n * @data\n * We will be using This data set to contsruct our rectangles\n * in the chart, we use this data set becuase, when we loop in this\n * data and build the heat map, it will support accessibility as\n * specified in the figma\n */\n\n const _createNewDataSet = React.useCallback(\n (\n data: HeatMapChartData[],\n xAxisDateFormatString: string | undefined,\n xAxisNumberFormatString: string | undefined,\n yAxisDateFormatString: string | undefined,\n yAxisNumberFormatString: string | undefined,\n ): DataSet => {\n /**\n * please do not destructure any of the props here,\n * instead send them as parameter to this functions so that\n * this functions get called whenever the prop changes\n */\n const flattenData: FlattenData[] = [];\n /**\n * below for each loop will store all the datapoints in the one array.\n * basically it will flatten the nestesd array (data prop) into single array\n * of object. where each object contains x, y, rectText , value and legend propety of single\n * data point.\n */\n data.forEach((item: HeatMapChartData) => {\n item.data.forEach((point: HeatMapChartDataPoint) => {\n flattenData.push({ ...point, legend: item.legend });\n });\n });\n const yPoints: RectanglesGraphData = {};\n const uniqueYPoints: { [key: string]: '1' } = {};\n const uniqueXPoints: { [key: string]: '1' } = {};\n flattenData.forEach((item: FlattenData) => {\n const posX = _getXIndex(item.x);\n const posY = _getYIndex(item.y);\n\n uniqueXPoints[posX] = '1';\n uniqueYPoints[posY] = '1';\n /** we will check if the property(posY) is already there in object, if Yes,\n * then we will append the item in the Array related to the pos, if not\n * then we will simply append the item in the new Array and\n * assign that array to the property (posY) in the Object\n * and finally we will get the array of Objects associated to each\n * property (which is nothing but y data point) and object in the\n * array are noting but x data points associated to the property y\n */\n if (yPoints[posY]) {\n yPoints[posY] = [...yPoints[posY], item];\n } else {\n yPoints[posY] = [item];\n }\n });\n /**\n * we will now sort(ascending) the array's of y data point based on the x value\n * sorting is important to achive the accessibility order of the\n * rectangles and then format the x and y datapoints respectively\n */\n Object.keys(yPoints).forEach((item: string) => {\n yPoints[item] = _getOrderedXPoints(yPoints[item]);\n\n yPoints[item].forEach((datapoint: HeatMapChartDataPoint) => {\n if (_xAxisType.current === XAxisTypes.DateAxis) {\n datapoint.x = _getStringFormattedDate(datapoint.x as string, xAxisDateFormatString);\n }\n if (_xAxisType.current === XAxisTypes.NumericAxis) {\n datapoint.x = _getStringFormattedNumber(datapoint.x as string, xAxisNumberFormatString);\n }\n if (_xAxisType.current === XAxisTypes.StringAxis) {\n datapoint.x = _getFormattedLabelForXAxisDataPoint(datapoint.x as string);\n }\n if (_yAxisType.current === YAxisType.DateAxis) {\n datapoint.y = _getStringFormattedDate(datapoint.y as string, yAxisDateFormatString);\n }\n if (_yAxisType.current === YAxisType.NumericAxis) {\n datapoint.y = _getStringFormattedNumber(datapoint.y as string, yAxisNumberFormatString);\n }\n if (_yAxisType.current === YAxisType.StringAxis) {\n datapoint.y = _getFormattedLabelForYAxisDataPoint(datapoint.y as string);\n }\n });\n });\n /**\n * if y-axis data points are of type date or number or if we have string formatter,\n * then we need to change data points to their respective string\n * format, becuase in the private variable _stringYAxisDatapoints, points will be stored in\n * string format. and in here `yPoint` are not so we need to change, so that\n * function `_createRectangles` should work perfetcly while looping, and if we don't change\n * then `_createRectangles` will fail while looping, causing the error\n * Cannot read property 'forEach' of undefined\n */\n\n Object.keys(yPoints).forEach((yPoint: string) => {\n if (_yAxisType.current === YAxisType.DateAxis) {\n yPoints[_getStringFormattedDate(yPoint, yAxisDateFormatString)] = yPoints[yPoint];\n } else if (_yAxisType.current === YAxisType.NumericAxis) {\n yPoints[`${_getStringFormattedNumber(yPoint, yAxisNumberFormatString)}`] = yPoints[yPoint];\n } else {\n yPoints[_getFormattedLabelForYAxisDataPoint(yPoint)] = yPoints[yPoint];\n }\n });\n /**\n * assigning new data set\n */\n const dataSet = yPoints;\n /**\n * These are the Y axis data points which will get rendered in the\n * Y axis in graph\n */\n const yAxisPoints = _getYAxisDataPoints(uniqueYPoints);\n /**\n * These are the x axis data points which will get rendered in the\n * x axis in the graph\n */\n\n const xAxisPoints = _getXAxisDataPoints(uniqueXPoints);\n return {\n dataSet,\n yAxisPoints,\n xAxisPoints,\n };\n },\n [\n _getFormattedLabelForXAxisDataPoint,\n _getFormattedLabelForYAxisDataPoint,\n _getXAxisDataPoints,\n _getYAxisDataPoints,\n props.sortOrder,\n ],\n );\n\n const _getStringFormattedDate = (point: string, formatString?: string): string => {\n const date = new Date();\n date.setTime(+point);\n return d3TimeFormat(formatString || '%b/%d')(date);\n };\n\n const _getStringFormattedNumber = (point: string, formatString?: string): string => {\n return d3Format(formatString || '.2~s')(+point);\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 const _legendHighlighted = (legendTitle: string) => {\n return selectedLegend === legendTitle || (selectedLegend === '' && activeLegend === legendTitle);\n };\n\n /**\n * This function checks if none of the legends is selected or hovered.\n */\n const _noLegendHighlighted = () => {\n return selectedLegend === '' && activeLegend === '';\n };\n\n const _getAriaLabel = (point: FlattenData): string => {\n const xValue = point.x;\n const yValue = point.y;\n const legend = point.legend;\n const zValue = point.ratio ? `${point.ratio[0]}/${point.ratio[1]}` : point.rectText || point.value;\n const description = point.descriptionMessage;\n return (\n point.callOutAccessibilityData?.ariaLabel ||\n `${xValue}, ${yValue}. ${legend}, ${zValue}.` + (description ? ` ${description}.` : '')\n );\n };\n\n const _isChartEmpty = (): boolean => {\n return !(props.data && props.data.length > 0);\n };\n\n const _getChartTitle = (): string => {\n const { chartTitle } = props;\n const numDataPoints = props.data.reduce((acc, curr) => acc + curr.data.length, 0);\n return (chartTitle ? `${chartTitle}. ` : '') + `Heat map chart with ${numDataPoints} data points. `;\n };\n\n const _getOrderedXAxisLabels = (points: { [key: string]: '1' }) => {\n if (!_shouldOrderXAxisLabelsByCategoryOrder()) {\n // Keep the original ordering logic as the default behavior to ensure backward compatibility\n return Object.keys(points).sort((a: string, b: string) => {\n if (_xAxisType.current === XAxisTypes.DateAxis || _xAxisType.current === XAxisTypes.NumericAxis) {\n return +a - +b;\n } else {\n return props.sortOrder === 'none' ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 : -1;\n }\n });\n }\n\n return sortAxisCategories(_mapCategoryToValues(), props.xAxisCategoryOrder);\n };\n\n const _getOrderedYAxisLabels = (points: { [key: string]: '1' }) => {\n if (!_shouldOrderYAxisLabelsByCategoryOrder()) {\n // Keep the original ordering logic as the default behavior to ensure backward compatibility\n return Object.keys(points).sort((a: string, b: string) => {\n if (_yAxisType.current === YAxisType.DateAxis || _yAxisType.current === YAxisType.NumericAxis) {\n return +a - +b;\n } else {\n return props.sortOrder === 'none' ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 : -1;\n }\n });\n }\n\n return sortAxisCategories(_mapCategoryToValues(true), props.yAxisCategoryOrder);\n };\n\n const _getOrderedXPoints = (xPoints: FlattenData[]) => {\n if (!_shouldOrderXAxisLabelsByCategoryOrder()) {\n return xPoints.sort((a: HeatMapChartDataPoint, b: HeatMapChartDataPoint) => {\n if (_xAxisType.current === XAxisTypes.StringAxis) {\n return props.sortOrder === 'none'\n ? 0\n : (a.x as string).toLowerCase() > (b.x as string).toLowerCase()\n ? 1\n : -1;\n } else if (_xAxisType.current === XAxisTypes.DateAxis) {\n return (a.x as Date).getTime() - (b.x as Date).getTime();\n } else if (_xAxisType.current === XAxisTypes.NumericAxis) {\n return +(a.x as string) > +(b.x as string) ? 1 : -1;\n } else {\n return a.x > b.x ? 1 : -1;\n }\n });\n }\n\n const result: FlattenData[] = [];\n\n const xValueToPoints: Record<string, FlattenData[]> = {};\n xPoints.forEach(point => {\n const xValue = point.x as string;\n if (!xValueToPoints[xValue]) {\n xValueToPoints[xValue] = [];\n }\n xValueToPoints[xValue].push(point);\n });\n\n const xAxisLabels = _getOrderedXAxisLabels({});\n xAxisLabels.forEach(xValue => {\n if (xValueToPoints[xValue]) {\n result.push(...xValueToPoints[xValue]);\n }\n });\n\n return result;\n };\n\n const _shouldOrderXAxisLabelsByCategoryOrder = () => {\n return _xAxisType.current === XAxisTypes.StringAxis && props.xAxisCategoryOrder !== 'default';\n };\n\n const _shouldOrderYAxisLabelsByCategoryOrder = () => {\n return _yAxisType.current === YAxisType.StringAxis && props.yAxisCategoryOrder !== 'default';\n };\n\n const _mapCategoryToValues = (isYAxis = false) => {\n const categoryToValues: Record<string, number[]> = {};\n props.data.forEach(item => {\n item.data.forEach(point => {\n const category = (isYAxis ? point.y : point.x) as string;\n if (!categoryToValues[category]) {\n categoryToValues[category] = [];\n }\n categoryToValues[category].push(point.value);\n });\n });\n return categoryToValues;\n };\n\n const 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 }\n };\n\n const { x, y } = _getXandY();\n _xAxisType.current = getTypeOfAxis(x, true) as XAxisTypes;\n _yAxisType.current = getTypeOfAxis(y, false) as YAxisType;\n const { data, xAxisDateFormatString, xAxisNumberFormatString, yAxisDateFormatString, yAxisNumberFormatString } =\n props;\n _colorScale.current = _getColorScale();\n const { dataSet, xAxisPoints, yAxisPoints } = React.useMemo(\n () =>\n _createNewDataSet(\n data,\n xAxisDateFormatString,\n xAxisNumberFormatString,\n yAxisDateFormatString,\n yAxisNumberFormatString,\n ),\n [\n _createNewDataSet,\n data,\n xAxisDateFormatString,\n xAxisNumberFormatString,\n yAxisDateFormatString,\n yAxisNumberFormatString,\n ],\n );\n _dataSet.current = dataSet;\n _stringYAxisDataPoints.current = yAxisPoints;\n _stringXAxisDataPoints.current = xAxisPoints;\n const calloutProps: ChartPopoverProps = {\n ...props.calloutProps,\n isPopoverOpen,\n YValue: calloutYValue,\n legend: calloutLegend,\n color: calloutTextColor,\n ratio,\n descriptionMessage,\n clickPosition,\n ...getAccessibleDataObject(callOutAccessibilityData, 'text', false),\n styles: {\n calloutContentRoot: classes.calloutContentRoot!,\n },\n };\n const tickParams = {\n tickValues: props.tickValues,\n tickFormat: props.tickFormat,\n };\n return !_isChartEmpty() ? (\n <CartesianChart\n {...props}\n chartTitle={_getChartTitle()}\n points={data}\n chartType={ChartTypes.HeatMapChart}\n xAxisType={XAxisTypes.StringAxis}\n yAxisType={YAxisType.StringAxis}\n calloutProps={calloutProps}\n createYAxis={createNumericYAxis}\n datasetForXAxisDomain={_stringXAxisDataPoints.current}\n stringDatasetForYAxisDomain={_stringYAxisDataPoints.current}\n createStringYAxis={createStringYAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n getMinMaxOfYAxis={_getMinMaxOfYAxis}\n getmargins={_getMargins}\n xAxisTickCount={_stringXAxisDataPoints.current.length}\n xAxistickSize={0}\n xAxisPadding={0.02}\n yAxisPadding={0.02}\n legendBars={_createLegendBars()}\n onChartMouseLeave={_handleChartMouseLeave}\n componentRef={cartesianChartRef}\n tickParams={tickParams}\n /* eslint-disable react/jsx-no-bind */\n children={(p: ChildProps) => {\n _xAxisScale.current = p.xScale;\n _yAxisScale.current = p.yScalePrimary;\n return _createRectangles();\n }}\n />\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\n"],"names":["React","ChartTypes","getAccessibleDataObject","getColorContrast","getTypeOfAxis","resolveCSSVariables","XAxisTypes","YAxisType","createNumericYAxis","domainRangeOfXStringAxis","createStringYAxis","useRtl","sortAxisCategories","formatToLocaleString","CartesianChart","useId","tokens","useHeatMapChartStyles","Legends","scaleLinear","d3ScaleLinear","format","d3Format","timeFormat","d3TimeFormat","toImage","HeatMapChart","forwardRef","props","xAxisCategoryOrder","yAxisCategoryOrder","data","domainValuesForColorScale","rangeValuesForColorScale","forwardedRef","classes","_stringXAxisDataPoints","useRef","_stringYAxisDataPoints","_dataSet","_colorScale","undefined","_xAxisScale","_yAxisScale","_xAxisType","_yAxisType","_calloutAnchorPoint","_emptyChartId","_margins","cartesianChartRef","_legendsRef","_isRtl","selectedLegend","setSelectedLegend","useState","activeLegend","setActiveLegend","isPopoverOpen","setPopoverOpen","calloutLegend","setCalloutLegend","calloutTextColor","setCalloutTextColor","calloutYValue","setCalloutYValue","ratio","setRatio","descriptionMessage","setDescriptionMessage","callOutAccessibilityData","setCallOutAccessibilityData","clickPosition","setClickPosition","x","y","useImperativeHandle","componentRef","chartContainer","current","opts","toSVG","_getMinMaxOfYAxis","startValue","endValue","_getDomainNRangeValues","points","margins","width","chartType","isRTL","xAxisType","barWidth","tickValues","shiftX","domainNRangeValue","NumericAxis","DateAxis","dStartValue","dEndValue","rStartValue","rEndValue","_getXandY","forEach","item","length","_getMargins","_getOpacity","legendTitle","opacity","_legendHighlighted","_noLegendHighlighted","_onRectFocus","id","focusEvent","boundingRect","currentTarget","getBoundingClientRect","clientX","left","clientY","top","height","updatePosition","legend","rectText","Number","isNaN","value","colorNeutralForeground1","_onRectMouseOver","mouseEvent","persist","_onRectBlurOrMouseOut","_handleChartMouseLeave","_getInvertedTextColor","color","colorNeutralBackground1","_createRectangles","rectangles","yAxisDataPoints","slice","reverse","yAxisDataPoint","index","xAxisDataPoint","rectElement","dataPointObject","styleRules","foregroundColor","contrastRatio","g","key","role","aria-label","_getAriaLabel","tabIndex","fillOpacity","transform","onFocus","e","onBlur","onMouseOver","onMouseOut","rect","fill","bandwidth","onClick","text","dominantBaseline","textAnchor","className","culture","useUTC","NaN","push","_onLegendHover","_onLegendLeave","_onLegendClick","_createLegendBars","legendProps","legends","title","action","hoverAction","onMouseOutAction","legendRef","_getColorScale","domain","range","_getXIndex","getTime","StringAxis","_getYIndex","xAxisStringFormatter","_getFormattedLabelForXAxisDataPoint","useCallback","point","yAxisStringFormatter","_getFormattedLabelForYAxisDataPoint","_getXAxisDataPoints","xAxisPoints","unFormattedXAxisDataPoints","_getOrderedXAxisLabels","map","xPoint","_getStringFormattedDate","xAxisDateFormatString","_getStringFormattedNumber","xAxisNumberFormatString","sortOrder","_getYAxisDataPoints","yAxisPoints","unFormattedYAxisDataPoints","_getOrderedYAxisLabels","yPoint","yAxisDateFormatString","yAxisNumberFormatString","_createNewDataSet","flattenData","yPoints","uniqueYPoints","uniqueXPoints","posX","posY","Object","keys","_getOrderedXPoints","datapoint","dataSet","formatString","date","Date","setTime","xValue","yValue","zValue","description","ariaLabel","_isChartEmpty","_getChartTitle","chartTitle","numDataPoints","reduce","acc","curr","_shouldOrderXAxisLabelsByCategoryOrder","sort","a","b","toLowerCase","_mapCategoryToValues","_shouldOrderYAxisLabelsByCategoryOrder","xPoints","result","xValueToPoints","xAxisLabels","isYAxis","categoryToValues","category","newX","newY","threshold","distance","Math","sqrt","pow","useMemo","calloutProps","YValue","styles","calloutContentRoot","tickParams","tickFormat","yAxisType","createYAxis","datasetForXAxisDomain","stringDatasetForYAxisDomain","getDomainNRangeValues","getMinMaxOfYAxis","getmargins","xAxisTickCount","xAxistickSize","xAxisPadding","yAxisPadding","legendBars","onChartMouseLeave","children","p","xScale","yScalePrimary","div","style"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAU/B,SACEC,UAAU,EACVC,uBAAuB,EACvBC,gBAAgB,EAChBC,aAAa,EACbC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,kBAAkB,EAGlBC,wBAAwB,EACxBC,iBAAiB,EACjBC,MAAM,EACNC,kBAAkB,QACb,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,cAAc,QAAuC,4BAA4B;AAC1F,SAASC,KAAK,QAAQ,4BAA4B;AAElD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAAiBC,OAAO,QAAyB,mBAAmB;AACpE,SAASC,eAAeC,aAAa,QAAQ,WAAW;AACxD,SAASC,UAAUC,QAAQ,QAAQ,YAAY;AAC/C,SAASC,cAAcC,YAAY,QAAQ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ACdO,aAAa1Q;QACb2Q,uBAAuB/O,uBAAuB0C,OAAO;QACrDsM,6BAA6B9O,uBAAuBwC,OAAO;QAC3DpE,mBAAmBA;QACnB2Q,uBAAuBjM;QACvBkM,kBAAkBrM;QAClBsM,YAAY9K;QACZ+K,gBAAgBpP,uBAAuB0C,OAAO,CAAC0B,MAAM;QACrDiL,eAAe;QACfC,cAAc;QACdC,cAAc;QACdC,YAAY1G;QACZ2G,mBAAmBxJ;QACnBzD,cAAc3B;QACd8N,YAAYA;QACZ,oCAAoC,GACpCe,UAAU,CAACC;YACTrP,YAAYoC,OAAO,GAAGiN,EAAEC,MAAM;YAC9BrP,YAAYmC,OAAO,GAAGiN,EAAEE,aAAa;YACrC,OAAOxJ;QACT;uBAGF,oBAACyJ;QAAIlL,IAAIjE;QAAeyG,MAAM;QAAS2I,OAAO;YAAEvL,SAAS;QAAI;QAAG6C,cAAY;;AAEhF,GACA"}
|
|
@@ -394,7 +394,9 @@ import { Legends } from '../../index';
|
|
|
394
394
|
},
|
|
395
395
|
isCartesian: false
|
|
396
396
|
}), !isSingleBar && /*#__PURE__*/ React.createElement("div", {
|
|
397
|
-
ref: (e)=>
|
|
397
|
+
ref: (e)=>{
|
|
398
|
+
legendContainer.current = e;
|
|
399
|
+
},
|
|
398
400
|
className: classes.legendContainer
|
|
399
401
|
}, legendButtons)) : /*#__PURE__*/ React.createElement("div", {
|
|
400
402
|
id: _emptyChartId,
|