@fluentui/react-charts 0.0.0-nightly-20250827-0407.1 → 0.0.0-nightly-20250828-0408.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -316,16 +316,7 @@ const ScatterChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
316
316
  }
317
317
  if (_isScatterPolarRef.current) {
318
318
  var _points_i;
319
- // Render category labels for all series at once to avoid overlap
320
- const allSeriesData = _points.map((s)=>({
321
- data: s.data.filter((pt)=>typeof pt.x === 'number' && typeof pt.y === 'number').map((pt)=>({
322
- x: pt.x,
323
- y: pt.y,
324
- text: pt.text
325
- }))
326
- }));
327
319
  pointsForSeries.push(...(0, _scatterpolarutils.renderScatterPolarCategoryLabels)({
328
- allSeriesData,
329
320
  xAxisScale: _xAxisScale.current,
330
321
  yAxisScale: _yAxisScale.current,
331
322
  className: classes.markerLabel || '',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ScatterChart/ScatterChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ScatterChartProps } from './ScatterChart.types';\nimport { useScatterChartStyles } from './useScatterChartStyles.styles';\nimport { Axis as D3Axis } from 'd3-axis';\nimport { select as d3Select } from 'd3-selection';\nimport { Legend, Legends } from '../Legends/index';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport {\n areArraysEqual,\n createNumericYAxis,\n createStringYAxis,\n domainRangeOfDateForScatterChart,\n domainRangeOfNumericForScatterChart,\n domainRangeOfXStringAxis,\n find,\n findNumericMinMaxOfY,\n IDomainNRange,\n YAxisType,\n useRtl,\n isTextMode,\n isScatterPolarSeries,\n} from '../../utilities/index';\nimport {\n AccessibilityProps,\n CartesianChart,\n ChildProps,\n CustomizedCalloutData,\n Margins,\n RefArrayData,\n ScatterChartDataPoint,\n Chart,\n ImageExportOptions,\n LegendContainer,\n ScatterChartPoints,\n} from '../../index';\nimport { tokens } from '@fluentui/react-theme';\nimport {\n calloutData,\n ChartTypes,\n XAxisTypes,\n tooltipOfAxislabels,\n getTypeOfAxis,\n getNextColor,\n getColorFromToken,\n formatDate,\n} from '../../utilities/index';\nimport { LineChartPoints } from '../../types/DataPoint';\nimport { toImage } from '../../utilities/image-export-utils';\nimport { ScaleLinear } from 'd3-scale';\nimport { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';\n\ntype NumericAxis = D3Axis<number | { valueOf(): number }>;\n\ntype ScatterChartDataWithIndex = ScatterChartPoints & { index: number };\n\n// Create a ScatterChart variant which uses these default styles and this styled subcomponent.\n/**\n * ScatterChart component\n * {@docCategory ScatterChart}\n */\nexport const ScatterChart: React.FunctionComponent<ScatterChartProps> = React.forwardRef<\n HTMLDivElement,\n ScatterChartProps\n>((props, forwardedRef) => {\n const _circleId: string = useId('circle');\n const _seriesId: string = useId('seriesID');\n const _verticalLine: string = useId('verticalLine');\n const _tooltipId: string = useId('ScatterChartTooltipId_');\n const _firstRenderOptimization = true;\n const _emptyChartId: string = useId('_ScatterChart_empty');\n let _points: ScatterChartDataWithIndex[] = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _calloutPoints: any[] = calloutData(_points) || [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xAxisScale: any = '';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _yAxisScale: any = '';\n let _uniqueCallOutID: string | null = '';\n let _refArray: RefArrayData[] = [];\n let margins: Margins;\n let renderSeries: JSXElement[];\n let _xAxisLabels: string[] = [];\n let xAxisCalloutAccessibilityData: AccessibilityProps = {};\n let _xBandwidth = 0;\n const cartesianChartRef = React.useRef<Chart>(null);\n const classes = useScatterChartStyles(props);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL: boolean = useRtl();\n\n const [hoverXValue, setHoverXValue] = React.useState<string | number>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [YValueHover, setYValueHover] = React.useState<[]>([]);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const [selectedLegendPoints, setSelectedLegendPoints] = React.useState<any[]>([]);\n const [isSelectedLegend, setIsSelectedLegend] = React.useState<boolean>(false);\n const [activePoint, setActivePoint] = React.useState<string>('');\n const [stackCalloutProps, setStackCalloutProps] = React.useState<CustomizedCalloutData>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const prevSelectedLegendsRef = React.useRef<string[] | undefined>(undefined);\n const _isTextMode = React.useRef(false);\n const _isScatterPolarRef = React.useRef(false);\n\n React.useEffect(() => {\n if (\n prevSelectedLegendsRef.current &&\n !areArraysEqual(prevSelectedLegendsRef.current, props.legendProps?.selectedLegends)\n ) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n prevSelectedLegendsRef.current = props.legendProps?.selectedLegends;\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(cartesianChartRef.current?.chartContainer, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\n\n const _xAxisType: XAxisTypes =\n props.data.scatterChartData! &&\n props.data.scatterChartData!.length > 0 &&\n props.data.scatterChartData![0].data &&\n props.data.scatterChartData![0].data.length > 0\n ? (getTypeOfAxis(props.data.scatterChartData![0].data[0].x, true) as XAxisTypes)\n : XAxisTypes.StringAxis;\n\n const pointsRef = React.useRef<ScatterChartDataWithIndex[] | []>([]);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const calloutPointsRef = React.useRef<any[]>([]);\n React.useEffect(() => {\n /** note that height and width are not used to resize or set as dimesions of the chart,\n * fitParentContainer is responisble for setting the height and width or resizing of the svg/chart\n */\n\n if (_points !== _injectIndexPropertyInScatterChartData(props.data.scatterChartData) || props.data !== _points) {\n pointsRef.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n calloutPointsRef.current = calloutData(pointsRef.current);\n }\n }, [props.height, props.width, props.data, _points]);\n\n function _injectIndexPropertyInScatterChartData(\n scatterChartData?: ScatterChartPoints[],\n ): ScatterChartDataWithIndex[] | [] {\n return scatterChartData\n ? scatterChartData.map((item: ScatterChartPoints, index: number) => {\n let color: string;\n if (typeof item.color === 'undefined') {\n color = getNextColor(index, 0);\n } else {\n color = getColorFromToken(item.color);\n }\n return {\n ...item,\n index: -1,\n color,\n };\n })\n : [];\n }\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n function _getNumericMinMaxOfY(\n points: ScatterChartPoints[],\n yAxisType?: YAxisType,\n ): { startValue: number; endValue: number } {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { startValue, endValue } = findNumericMinMaxOfY(points, yAxisType);\n let yPadding = 0;\n yPadding = (endValue - startValue) * 0.1;\n\n return {\n startValue: startValue - yPadding,\n endValue: endValue + yPadding,\n };\n }\n\n function _getDomainNRangeValues(\n points: any,\n margins: Margins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForScatterChart(points, margins, width, isRTL);\n } else if (xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues! as Date[]);\n } else {\n domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);\n }\n return domainNRangeValue;\n }\n\n function _getMargins(_margins: Margins) {\n margins = _margins;\n }\n\n function _initializeScatterChartData(\n xScale: NumericAxis,\n yScale: NumericAxis,\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement | null,\n ) {\n _xAxisScale = xScale;\n _yAxisScale = yScale;\n _isTextMode.current = isTextMode(_points);\n _isScatterPolarRef.current = isScatterPolarSeries(_points);\n renderSeries = _createPlot(xElement!, containerHeight!);\n }\n\n function _onHoverCardHide() {\n setSelectedLegendPoints([]);\n setIsSelectedLegend(false);\n }\n\n function _createLegends(data: ScatterChartDataWithIndex[]): JSXElement {\n const { legendProps } = props;\n const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);\n const mapLegendToPoints: Record<string, ScatterChartDataWithIndex[]> = {};\n data.forEach((point: ScatterChartDataWithIndex) => {\n if (point.legend) {\n if (!mapLegendToPoints[point.legend]) {\n mapLegendToPoints[point.legend] = [];\n }\n mapLegendToPoints[point.legend].push(point);\n }\n });\n const legendDataItems: Legend[] = Object.entries(mapLegendToPoints).map(([legendTitle, points]) => {\n const representativePoint = points[0];\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: legendTitle,\n color: representativePoint.color!,\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(legendTitle);\n },\n ...(representativePoint.legendShape && {\n shape: representativePoint.legendShape,\n }),\n };\n return legend;\n });\n\n return (\n <Legends\n legends={[...legendDataItems]}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n {...(isLegendMultiSelectEnabled && { onLegendHoverCardLeave: _onHoverCardHide })}\n {...props.legendProps}\n selectedLegends={selectedLegends}\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n );\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n function _getPointFill(seriesColor: string, pointId: string, pointIndex: number, isLastPoint: boolean) {\n if (activePoint === pointId) {\n return tokens.colorNeutralBackground1;\n } else {\n return seriesColor;\n }\n }\n\n function _getRangeForScatterMarkerSize(\n yScale: ScaleLinear<number, number>,\n yPadding: number,\n xMin: number,\n xMax: number,\n xPadding: number,\n ): number {\n const extraXPixels = _isRTL\n ? _xAxisScale(xMax - xPadding) - _xAxisScale(xMax)\n : _xAxisScale(xMin + xPadding) - _xAxisScale(xMin);\n\n const yMin = yScale.domain()[0];\n const extraYPixels = yScale(yMin) - yScale(yMin + yPadding);\n return Math.min(extraXPixels, extraYPixels);\n }\n\n function _createPlot(xElement: SVGElement, containerHeight: number): JSXElement[] {\n const series: JSXElement[] = [];\n if (isSelectedLegend) {\n _points = selectedLegendPoints;\n } else {\n _points = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n }\n\n const yMax = d3Max(points, (point: ScatterChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.y)!;\n })!;\n const yMin = d3Min(points, (point: ScatterChartPoints) => {\n return d3Min(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.y)!;\n })!;\n const yPadding = (yMax - yMin) * 0.1;\n\n let xPadding = 0;\n let xMin: number = 0;\n let xMax: number = 0;\n if (_xAxisType === XAxisTypes.StringAxis) {\n _xBandwidth = _xAxisScale.bandwidth() / 2;\n } else {\n const isDate = _xAxisType === XAxisTypes.DateAxis;\n const getX = (item: ScatterChartDataPoint) => (isDate ? (item.x as Date) : (item.x as number));\n\n const minVal = d3Min(_points, (point: ScatterChartPoints) => d3Min(point.data as ScatterChartDataPoint[], getX));\n const maxVal = d3Max(_points, (point: ScatterChartPoints) => d3Max(point.data as ScatterChartDataPoint[], getX));\n\n xMin = isDate ? (minVal as Date).getTime() : (minVal as number);\n xMax = isDate ? (maxVal as Date).getTime() : (maxVal as number);\n\n xPadding = (xMax - xMin) * 0.1;\n }\n\n const maxMarkerSize = d3Max(_points, (point: ScatterChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.markerSize as number;\n });\n })!;\n\n for (let i = _points.length - 1; i >= 0; i--) {\n const pointsForSeries: JSXElement[] = [];\n\n const legendVal: string = _points[i].legend;\n const seriesColor: string = _points[i].color!;\n const verticaLineHeight = containerHeight - margins.bottom! + 6;\n\n for (let j = 0; j < _points[i].data.length; j++) {\n const seriesId = `${_seriesId}_${i}_${j}`;\n const circleId = `${_circleId}_${i}_${j}`;\n const { x, y, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j];\n const pointMarkerSize = (_points[i].data[j] as ScatterChartDataPoint).markerSize;\n const extraMaxPixels =\n _xAxisType !== XAxisTypes.StringAxis\n ? _getRangeForScatterMarkerSize(_yAxisScale, yPadding, xMin, xMax, xPadding)\n : 0;\n const minPixel = 4;\n const maxPixel = 16;\n const circleRadius =\n pointMarkerSize && maxMarkerSize !== 0\n ? _xAxisType !== XAxisTypes.StringAxis\n ? (pointMarkerSize * extraMaxPixels) / maxMarkerSize\n : minPixel + ((pointMarkerSize - minPixel) / (maxMarkerSize - minPixel)) * (maxPixel - minPixel)\n : activePoint === circleId\n ? 6\n : 4;\n\n const isLegendSelected: boolean = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;\n\n const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;\n const text = _points?.[i].data[j]?.text;\n if (!_isTextMode.current) {\n pointsForSeries.push(\n <>\n <circle\n id={circleId}\n key={circleId}\n r={Math.max(circleRadius, 4)}\n cx={_xAxisScale(x) + _xBandwidth}\n cy={_yAxisScale(y)}\n data-is-focusable={isLegendSelected}\n onMouseOver={(event: React.MouseEvent<SVGElement>) =>\n _handleHover(\n x,\n y,\n verticaLineHeight,\n xAxisCalloutData,\n circleId,\n xAxisCalloutAccessibilityData,\n event,\n )\n }\n onMouseMove={(event: React.MouseEvent<SVGElement>) =>\n _handleHover(\n x,\n y,\n verticaLineHeight,\n xAxisCalloutData,\n circleId,\n xAxisCalloutAccessibilityData,\n event,\n )\n }\n onMouseOut={_handleMouseOut}\n onFocus={event =>\n _handleFocus(event, seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData)\n }\n onBlur={_handleMouseOut}\n {..._getClickHandler(_points[i].data[j].onDataPointClick)}\n opacity={isLegendSelected && !currentPointHidden ? 1 : 0.1}\n fill={_getPointFill(seriesColor, circleId, j, false)}\n stroke={seriesColor}\n role=\"img\"\n aria-label={_getAriaLabel(i, j)}\n tabIndex={isLegendSelected ? 0 : undefined}\n />\n ,\n {text && (\n <text\n key={`${circleId}-label`}\n x={_xAxisScale(x) + _xBandwidth}\n y={_yAxisScale(y) + Math.max(circleRadius + 12, 16)}\n className={classes.markerLabel}\n >\n {text}\n </text>\n )}\n </>,\n );\n }\n }\n\n if (_isScatterPolarRef.current) {\n // Render category labels for all series at once to avoid overlap\n const allSeriesData = _points.map(s => ({\n data: s.data\n .filter(pt => typeof pt.x === 'number' && typeof pt.y === 'number')\n .map(pt => ({ x: pt.x as number, y: pt.y as number, text: pt.text })),\n }));\n pointsForSeries.push(\n ...renderScatterPolarCategoryLabels({\n allSeriesData,\n xAxisScale: _xAxisScale.current,\n yAxisScale: _yAxisScale.current,\n className: classes.markerLabel || '',\n lineOptions: (_points?.[i] as Partial<LineChartPoints>)?.lineOptions,\n }),\n );\n }\n\n series.push(\n <g\n key={`series_${i}`}\n role=\"region\"\n aria-label={`${legendVal}, series ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`}\n >\n {pointsForSeries}\n </g>,\n );\n }\n // Removing un wanted tooltip div from DOM, when prop not provided.\n if (!props.showXAxisLablesTooltip) {\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n // Used to display tooltip at x axis labels.\n if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {\n const xAxisElement = d3Select(xElement).call(_xAxisScale);\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n const tooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: xAxisElement,\n };\n xAxisElement && tooltipOfAxislabels(tooltipProps);\n }\n return series;\n }\n\n function _handleFocus(\n event: React.FocusEvent<SVGCircleElement, Element>,\n seriesId: string,\n x: number | Date | string,\n xAxisCalloutData: string | undefined,\n circleId: string,\n xAxisCalloutAccessibilityData?: AccessibilityProps,\n ) {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (event.target as SVGCircleElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n updatePosition(cx, cy);\n _uniqueCallOutID = circleId;\n const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;\n const xVal = x instanceof Date ? x.getTime() : x;\n const found = find(_calloutPoints, (element: { x: string | number }) => element.x === xVal);\n // if no points need to be called out then don't show vertical line and callout card\n\n if (found) {\n d3Select(`#${_verticalLine}`)\n .attr('transform', () => `translate(${_xAxisScale(x) + _xBandwidth}, 0)`)\n .attr('visibility', 'visibility');\n _refArray.forEach((obj: RefArrayData) => {\n if (obj.index === seriesId) {\n setPopoverOpen(true);\n xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);\n setYValueHover(found.values);\n setStackCalloutProps(found!);\n setActivePoint(circleId);\n }\n });\n } else {\n setActivePoint(circleId);\n }\n }\n\n function _handleHover(\n x: number | Date | string,\n y: number | Date,\n lineHeight: number,\n xAxisCalloutData: string | undefined,\n circleId: string,\n xAxisCalloutAccessibilityData: AccessibilityProps | undefined,\n mouseEvent: React.MouseEvent<SVGElement>,\n ) {\n mouseEvent?.persist();\n const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;\n const xVal = x instanceof Date ? x.getTime() : x;\n const found = find(_calloutPoints, (element: { x: string | number }) => element.x === xVal);\n // if no points need to be called out then don't show vertical line and callout card\n\n if (found) {\n d3Select(`#${_verticalLine}`)\n .attr('transform', () => `translate(${_xAxisScale(x) + _xBandwidth}, ${_yAxisScale(y)})`)\n .attr('visibility', 'visibility')\n .attr('y2', `${lineHeight - _yAxisScale(y)}`);\n\n if (_uniqueCallOutID !== circleId) {\n _uniqueCallOutID = circleId;\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);\n setYValueHover(found.values);\n setStackCalloutProps(found!);\n setActivePoint(circleId);\n }\n } else {\n setActivePoint(circleId);\n }\n }\n\n /**\n * Screen readers announce an element as clickable if the onClick attribute is set.\n * This function sets the attribute only when a click event handler is provided.*/\n\n function _getClickHandler(func?: () => void): { onClick?: () => void } {\n if (func) {\n return {\n onClick: func,\n };\n }\n\n return {};\n }\n\n function _handleMouseOut() {\n d3Select(`#${_verticalLine}`).attr('visibility', 'hidden');\n }\n\n function _handleChartMouseLeave() {\n _uniqueCallOutID = null;\n setActivePoint('');\n if (isPopoverOpen) {\n setPopoverOpen(false);\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): boolean {\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(): boolean {\n return _getHighlightedLegend().length === 0;\n }\n\n function _getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _getAriaLabel(seriesIndex: number, pointIndex: number): string {\n const series = _points[seriesIndex];\n const point = series.data[pointIndex];\n const formattedDate = point.x instanceof Date ? formatDate(point.x, props.useUTC) : point.x;\n const xValue = point.xAxisCalloutData || formattedDate;\n const legend = series.legend;\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${xValue}. ${legend}, ${yValue}.`;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.scatterChartData &&\n props.data.scatterChartData.length > 0 &&\n props.data.scatterChartData.filter((item: ScatterChartPoints) => item.data.length).length > 0\n );\n }\n\n const _getMinMaxofXAxis = React.useCallback(\n (points: ScatterChartPoints[], yAxisType: YAxisType | undefined) =>\n _getNumericMinMaxOfY(points as ScatterChartPoints[], yAxisType),\n [],\n );\n\n const { legendProps, tickValues, tickFormat } = props;\n _points = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n\n let points = _points as ScatterChartPoints[];\n if (legendProps && !!legendProps.canSelectMultipleLegends) {\n points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;\n _calloutPoints = calloutData(points);\n }\n\n let legendBars = null;\n // reduce computation cost by only creating legendBars\n // if when hideLegend is false.\n // NOTE: they are rendered only when hideLegend is false in CartesianChart.\n if (!props.hideLegend && !_isTextMode.current) {\n legendBars = _createLegends(_points!); // ToDo: Memoize legends to improve performance.\n }\n const calloutProps = {\n YValueHover,\n hoverXValue,\n descriptionMessage:\n props.getCalloutDescriptionMessage && stackCalloutProps\n ? props.getCalloutDescriptionMessage(stackCalloutProps)\n : undefined,\n 'data-is-focusable': true,\n xAxisCalloutAccessibilityData,\n ...props.calloutProps,\n clickPosition,\n isPopoverOpen,\n isCalloutForStack: true,\n culture: props.culture ?? 'en-us',\n isCartesian: true,\n };\n const tickParams = {\n tickValues,\n tickFormat,\n };\n\n const xAxisLabels: string[] = _points\n .map((point: ScatterChartDataWithIndex) => point.data.map((dp: ScatterChartDataPoint) => dp.x as string))\n .flat();\n\n _xAxisLabels = [...new Set(xAxisLabels)];\n\n return !_isChartEmpty() ? (\n <CartesianChart\n {...props}\n chartTitle={props.data.chartTitle}\n points={points}\n chartType={ChartTypes.ScatterChart}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={legendBars}\n getmargins={_getMargins}\n getGraphData={_initializeScatterChartData}\n xAxisType={_xAxisType}\n getMinMaxOfYAxis={_getMinMaxofXAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n createYAxis={createNumericYAxis}\n createStringYAxis={createStringYAxis}\n onChartMouseLeave={_handleChartMouseLeave}\n enableFirstRenderOptimization={_firstRenderOptimization}\n datasetForXAxisDomain={_xAxisLabels}\n componentRef={cartesianChartRef}\n {...(_isScatterPolarRef.current ? { yMaxValue: 1, yMinValue: -1 } : {})}\n /* eslint-disable react/jsx-no-bind */\n // eslint-disable-next-line react/no-children-prop\n children={(props: ChildProps) => {\n _xAxisScale = props.xScale!;\n _yAxisScale = props.yScalePrimary!;\n return (\n <>\n <g>\n <line\n x1={0}\n y1={0}\n x2={0}\n y2={props.containerHeight}\n stroke={'#323130'}\n id={_verticalLine}\n visibility={'hidden'}\n strokeDasharray={'5,5'}\n />\n <g>{renderSeries}</g>\n </g>\n </>\n );\n }}\n />\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nScatterChart.displayName = 'ScatterChart';\n"],"names":["React","useScatterChartStyles","select","d3Select","Legends","max","d3Max","min","d3Min","useId","areArraysEqual","createNumericYAxis","createStringYAxis","domainRangeOfDateForScatterChart","domainRangeOfNumericForScatterChart","domainRangeOfXStringAxis","find","findNumericMinMaxOfY","useRtl","isTextMode","isScatterPolarSeries","CartesianChart","tokens","calloutData","ChartTypes","XAxisTypes","tooltipOfAxislabels","getTypeOfAxis","getNextColor","getColorFromToken","formatDate","toImage","renderScatterPolarCategoryLabels","ScatterChart","forwardRef","props","forwardedRef","_circleId","_seriesId","_verticalLine","_tooltipId","_firstRenderOptimization","_emptyChartId","_points","_injectIndexPropertyInScatterChartData","data","scatterChartData","_calloutPoints","_xAxisScale","_yAxisScale","_uniqueCallOutID","_refArray","margins","renderSeries","_xAxisLabels","xAxisCalloutAccessibilityData","_xBandwidth","cartesianChartRef","useRef","classes","_legendsRef","_isRTL","hoverXValue","setHoverXValue","useState","activeLegend","setActiveLegend","YValueHover","setYValueHover","selectedLegendPoints","setSelectedLegendPoints","isSelectedLegend","setIsSelectedLegend","activePoint","setActivePoint","stackCalloutProps","setStackCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","selectedLegends","setSelectedLegends","legendProps","prevSelectedLegendsRef","undefined","_isTextMode","_isScatterPolarRef","useEffect","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_xAxisType","length","StringAxis","pointsRef","calloutPointsRef","height","width","map","item","index","color","updatePosition","newX","newY","threshold","distance","Math","sqrt","pow","_getNumericMinMaxOfY","points","yAxisType","startValue","endValue","yPadding","_getDomainNRangeValues","chartType","isRTL","xAxisType","barWidth","tickValues","shiftX","domainNRangeValue","NumericAxis","DateAxis","_getMargins","_margins","_initializeScatterChartData","xScale","yScale","containerHeight","containerWidth","xElement","_createPlot","_onHoverCardHide","_createLegends","isLegendMultiSelectEnabled","canSelectMultipleLegends","mapLegendToPoints","forEach","point","legend","push","legendDataItems","Object","entries","legendTitle","representativePoint","title","onMouseOutAction","hoverAction","_handleChartMouseLeave","legendShape","shape","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","onLegendHoverCardLeave","onChange","_onLegendSelectionChange","legendRef","legendsSelected","event","currentLegend","slice","_getPointFill","seriesColor","pointId","pointIndex","isLastPoint","colorNeutralBackground1","_getRangeForScatterMarkerSize","xMin","xMax","xPadding","extraXPixels","yMin","domain","extraYPixels","series","yMax","bandwidth","isDate","getX","minVal","maxVal","getTime","maxMarkerSize","markerSize","i","pointsForSeries","legendVal","verticaLineHeight","bottom","j","seriesId","circleId","xAxisCalloutData","pointMarkerSize","extraMaxPixels","minPixel","maxPixel","circleRadius","isLegendSelected","_legendHighlighted","_noLegendHighlighted","currentPointHidden","hideNonActiveDots","text","circle","id","key","r","cx","cy","data-is-focusable","onMouseOver","_handleHover","onMouseMove","onMouseOut","_handleMouseOut","onFocus","_handleFocus","onBlur","_getClickHandler","onDataPointClick","opacity","fill","stroke","role","aria-label","_getAriaLabel","tabIndex","className","markerLabel","allSeriesData","s","filter","pt","xAxisScale","yAxisScale","lineOptions","g","showXAxisLablesTooltip","document","getElementById","remove","e","wrapXAxisLables","xAxisElement","call","tooltipProps","tooltipCls","tooltip","axis","targetRect","target","getBoundingClientRect","left","top","formattedData","Date","useUTC","xVal","found","element","attr","obj","values","lineHeight","mouseEvent","persist","clientX","clientY","func","onClick","_getHighlightedLegend","includes","seriesIndex","formattedDate","xValue","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_isChartEmpty","_getMinMaxofXAxis","useCallback","tickFormat","legendBars","hideLegend","calloutProps","descriptionMessage","getCalloutDescriptionMessage","isCalloutForStack","culture","isCartesian","tickParams","xAxisLabels","dp","flat","Set","chartTitle","getmargins","getGraphData","getMinMaxOfYAxis","getDomainNRangeValues","createYAxis","onChartMouseLeave","enableFirstRenderOptimization","datasetForXAxisDomain","yMaxValue","yMinValue","children","yScalePrimary","line","x1","y1","x2","y2","visibility","strokeDasharray","div","style","displayName"],"mappings":";;;;+BA8DaiC;;;;;;;iEA9DU,QAAQ;6CAEO,iCAAiC;6BAEpC,eAAe;uBAClB,mBAAmB;yBACR,WAAW;gCAChC,4BAA4B;wBAgB3C,wBAAwB;wBAaxB,cAAc;4BACE,wBAAwB;kCAYvB,qCAAqC;mCAEZ,qCAAqC;AAW/E,qBAAMA,WAAAA,GAA2DjC,OAAMkC,UAAU,CAGtF,CAACC,OAAOC;QAoC+DD,oBAanEA;IAhDJ,MAAME,gBAAoB5B,qBAAAA,EAAM;IAChC,MAAM6B,gBAAoB7B,qBAAA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aAAajT,0BAAAA;QACbC,mBAAmBA,yBAAAA;QACnBiT,mBAAmB/J;QACnBgK,+BAA+BrR;QAC/BsR,uBAAuBzQ;QACvBuC,cAAcpC;QACb,GAAIgC,mBAAmBE,OAAO,GAAG;YAAEqO,WAAW;YAAGC,WAAW,CAAC;QAAE,IAAI,CAAC,CAAC;QACtE,oCAAoC,GACpC,kDAAkD;QAClDC,UAAU,CAAC/R;YACTa,cAAcb,MAAMoG,MAAM;YAC1BtF,cAAcd,MAAMgS,aAAa;YACjC,OAAA,WAAA,GACE,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,MAAA,WAAA,GACE,OAAA,aAAA,CAACxE,KAAAA,MAAAA,WAAAA,GACC,OAAA,aAAA,CAACyE,QAAAA;gBACCC,IAAI;gBACJC,IAAI;gBACJC,IAAI;gBACJC,IAAIrS,MAAMsG,eAAe;gBACzBoG,QAAQ;gBACRlB,IAAIpL;gBACJkS,YAAY;gBACZC,iBAAiB;8BAEnB,OAAA,aAAA,CAAC/E,KAAAA,MAAGtM;QAIZ;uBAGF,OAAA,aAAA,CAACsR,OAAAA;QAAIhH,IAAIjL;QAAeoM,MAAM;QAAS8F,OAAO;YAAEjG,SAAS;QAAI;QAAGI,cAAY;;AAEhF,GAAG;AACH9M,aAAa4S,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/ScatterChart/ScatterChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ScatterChartProps } from './ScatterChart.types';\nimport { useScatterChartStyles } from './useScatterChartStyles.styles';\nimport { Axis as D3Axis } from 'd3-axis';\nimport { select as d3Select } from 'd3-selection';\nimport { Legend, Legends } from '../Legends/index';\nimport { max as d3Max, min as d3Min } from 'd3-array';\nimport { useId } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport {\n areArraysEqual,\n createNumericYAxis,\n createStringYAxis,\n domainRangeOfDateForScatterChart,\n domainRangeOfNumericForScatterChart,\n domainRangeOfXStringAxis,\n find,\n findNumericMinMaxOfY,\n IDomainNRange,\n YAxisType,\n useRtl,\n isTextMode,\n isScatterPolarSeries,\n} from '../../utilities/index';\nimport {\n AccessibilityProps,\n CartesianChart,\n ChildProps,\n CustomizedCalloutData,\n Margins,\n RefArrayData,\n ScatterChartDataPoint,\n Chart,\n ImageExportOptions,\n LegendContainer,\n ScatterChartPoints,\n} from '../../index';\nimport { tokens } from '@fluentui/react-theme';\nimport {\n calloutData,\n ChartTypes,\n XAxisTypes,\n tooltipOfAxislabels,\n getTypeOfAxis,\n getNextColor,\n getColorFromToken,\n formatDate,\n} from '../../utilities/index';\nimport { LineChartPoints } from '../../types/DataPoint';\nimport { toImage } from '../../utilities/image-export-utils';\nimport { ScaleLinear } from 'd3-scale';\nimport { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';\n\ntype NumericAxis = D3Axis<number | { valueOf(): number }>;\n\ntype ScatterChartDataWithIndex = ScatterChartPoints & { index: number };\n\n// Create a ScatterChart variant which uses these default styles and this styled subcomponent.\n/**\n * ScatterChart component\n * {@docCategory ScatterChart}\n */\nexport const ScatterChart: React.FunctionComponent<ScatterChartProps> = React.forwardRef<\n HTMLDivElement,\n ScatterChartProps\n>((props, forwardedRef) => {\n const _circleId: string = useId('circle');\n const _seriesId: string = useId('seriesID');\n const _verticalLine: string = useId('verticalLine');\n const _tooltipId: string = useId('ScatterChartTooltipId_');\n const _firstRenderOptimization = true;\n const _emptyChartId: string = useId('_ScatterChart_empty');\n let _points: ScatterChartDataWithIndex[] = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _calloutPoints: any[] = calloutData(_points) || [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _xAxisScale: any = '';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let _yAxisScale: any = '';\n let _uniqueCallOutID: string | null = '';\n let _refArray: RefArrayData[] = [];\n let margins: Margins;\n let renderSeries: JSXElement[];\n let _xAxisLabels: string[] = [];\n let xAxisCalloutAccessibilityData: AccessibilityProps = {};\n let _xBandwidth = 0;\n const cartesianChartRef = React.useRef<Chart>(null);\n const classes = useScatterChartStyles(props);\n const _legendsRef = React.useRef<LegendContainer>(null);\n const _isRTL: boolean = useRtl();\n\n const [hoverXValue, setHoverXValue] = React.useState<string | number>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [YValueHover, setYValueHover] = React.useState<[]>([]);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const [selectedLegendPoints, setSelectedLegendPoints] = React.useState<any[]>([]);\n const [isSelectedLegend, setIsSelectedLegend] = React.useState<boolean>(false);\n const [activePoint, setActivePoint] = React.useState<string>('');\n const [stackCalloutProps, setStackCalloutProps] = React.useState<CustomizedCalloutData>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n const [isPopoverOpen, setPopoverOpen] = React.useState(false);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>(props.legendProps?.selectedLegends || []);\n const prevSelectedLegendsRef = React.useRef<string[] | undefined>(undefined);\n const _isTextMode = React.useRef(false);\n const _isScatterPolarRef = React.useRef(false);\n\n React.useEffect(() => {\n if (\n prevSelectedLegendsRef.current &&\n !areArraysEqual(prevSelectedLegendsRef.current, props.legendProps?.selectedLegends)\n ) {\n setSelectedLegends(props.legendProps?.selectedLegends || []);\n }\n prevSelectedLegendsRef.current = props.legendProps?.selectedLegends;\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: cartesianChartRef.current?.chartContainer ?? null,\n toImage: (opts?: ImageExportOptions): Promise<string> => {\n return toImage(cartesianChartRef.current?.chartContainer, _legendsRef.current?.toSVG, _isRTL, opts);\n },\n }),\n [],\n );\n\n const _xAxisType: XAxisTypes =\n props.data.scatterChartData! &&\n props.data.scatterChartData!.length > 0 &&\n props.data.scatterChartData![0].data &&\n props.data.scatterChartData![0].data.length > 0\n ? (getTypeOfAxis(props.data.scatterChartData![0].data[0].x, true) as XAxisTypes)\n : XAxisTypes.StringAxis;\n\n const pointsRef = React.useRef<ScatterChartDataWithIndex[] | []>([]);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const calloutPointsRef = React.useRef<any[]>([]);\n React.useEffect(() => {\n /** note that height and width are not used to resize or set as dimesions of the chart,\n * fitParentContainer is responisble for setting the height and width or resizing of the svg/chart\n */\n\n if (_points !== _injectIndexPropertyInScatterChartData(props.data.scatterChartData) || props.data !== _points) {\n pointsRef.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n calloutPointsRef.current = calloutData(pointsRef.current);\n }\n }, [props.height, props.width, props.data, _points]);\n\n function _injectIndexPropertyInScatterChartData(\n scatterChartData?: ScatterChartPoints[],\n ): ScatterChartDataWithIndex[] | [] {\n return scatterChartData\n ? scatterChartData.map((item: ScatterChartPoints, index: number) => {\n let color: string;\n if (typeof item.color === 'undefined') {\n color = getNextColor(index, 0);\n } else {\n color = getColorFromToken(item.color);\n }\n return {\n ...item,\n index: -1,\n color,\n };\n })\n : [];\n }\n\n function updatePosition(newX: number, newY: number) {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n setPopoverOpen(true);\n }\n }\n\n function _getNumericMinMaxOfY(\n points: ScatterChartPoints[],\n yAxisType?: YAxisType,\n ): { startValue: number; endValue: number } {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { startValue, endValue } = findNumericMinMaxOfY(points, yAxisType);\n let yPadding = 0;\n yPadding = (endValue - startValue) * 0.1;\n\n return {\n startValue: startValue - yPadding,\n endValue: endValue + yPadding,\n };\n }\n\n function _getDomainNRangeValues(\n points: any,\n margins: Margins,\n width: number,\n chartType: ChartTypes,\n isRTL: boolean,\n xAxisType: XAxisTypes,\n barWidth: number,\n tickValues: Date[] | number[] | undefined,\n shiftX: number,\n ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForScatterChart(points, margins, width, isRTL);\n } else if (xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues! as Date[]);\n } else {\n domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);\n }\n return domainNRangeValue;\n }\n\n function _getMargins(_margins: Margins) {\n margins = _margins;\n }\n\n function _initializeScatterChartData(\n xScale: NumericAxis,\n yScale: NumericAxis,\n containerHeight: number,\n containerWidth: number,\n xElement: SVGElement | null,\n ) {\n _xAxisScale = xScale;\n _yAxisScale = yScale;\n _isTextMode.current = isTextMode(_points);\n _isScatterPolarRef.current = isScatterPolarSeries(_points);\n renderSeries = _createPlot(xElement!, containerHeight!);\n }\n\n function _onHoverCardHide() {\n setSelectedLegendPoints([]);\n setIsSelectedLegend(false);\n }\n\n function _createLegends(data: ScatterChartDataWithIndex[]): JSXElement {\n const { legendProps } = props;\n const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);\n const mapLegendToPoints: Record<string, ScatterChartDataWithIndex[]> = {};\n data.forEach((point: ScatterChartDataWithIndex) => {\n if (point.legend) {\n if (!mapLegendToPoints[point.legend]) {\n mapLegendToPoints[point.legend] = [];\n }\n mapLegendToPoints[point.legend].push(point);\n }\n });\n const legendDataItems: Legend[] = Object.entries(mapLegendToPoints).map(([legendTitle, points]) => {\n const representativePoint = points[0];\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: legendTitle,\n color: representativePoint.color!,\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(legendTitle);\n },\n ...(representativePoint.legendShape && {\n shape: representativePoint.legendShape,\n }),\n };\n return legend;\n });\n\n return (\n <Legends\n legends={[...legendDataItems]}\n enabledWrapLines={props.enabledLegendsWrapLines}\n overflowText={props.legendsOverflowText}\n {...(isLegendMultiSelectEnabled && { onLegendHoverCardLeave: _onHoverCardHide })}\n {...props.legendProps}\n selectedLegends={selectedLegends}\n onChange={_onLegendSelectionChange}\n legendRef={_legendsRef}\n />\n );\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: Legend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n function _getPointFill(seriesColor: string, pointId: string, pointIndex: number, isLastPoint: boolean) {\n if (activePoint === pointId) {\n return tokens.colorNeutralBackground1;\n } else {\n return seriesColor;\n }\n }\n\n function _getRangeForScatterMarkerSize(\n yScale: ScaleLinear<number, number>,\n yPadding: number,\n xMin: number,\n xMax: number,\n xPadding: number,\n ): number {\n const extraXPixels = _isRTL\n ? _xAxisScale(xMax - xPadding) - _xAxisScale(xMax)\n : _xAxisScale(xMin + xPadding) - _xAxisScale(xMin);\n\n const yMin = yScale.domain()[0];\n const extraYPixels = yScale(yMin) - yScale(yMin + yPadding);\n return Math.min(extraXPixels, extraYPixels);\n }\n\n function _createPlot(xElement: SVGElement, containerHeight: number): JSXElement[] {\n const series: JSXElement[] = [];\n if (isSelectedLegend) {\n _points = selectedLegendPoints;\n } else {\n _points = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n }\n\n const yMax = d3Max(points, (point: ScatterChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.y)!;\n })!;\n const yMin = d3Min(points, (point: ScatterChartPoints) => {\n return d3Min(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.y)!;\n })!;\n const yPadding = (yMax - yMin) * 0.1;\n\n let xPadding = 0;\n let xMin: number = 0;\n let xMax: number = 0;\n if (_xAxisType === XAxisTypes.StringAxis) {\n _xBandwidth = _xAxisScale.bandwidth() / 2;\n } else {\n const isDate = _xAxisType === XAxisTypes.DateAxis;\n const getX = (item: ScatterChartDataPoint) => (isDate ? (item.x as Date) : (item.x as number));\n\n const minVal = d3Min(_points, (point: ScatterChartPoints) => d3Min(point.data as ScatterChartDataPoint[], getX));\n const maxVal = d3Max(_points, (point: ScatterChartPoints) => d3Max(point.data as ScatterChartDataPoint[], getX));\n\n xMin = isDate ? (minVal as Date).getTime() : (minVal as number);\n xMax = isDate ? (maxVal as Date).getTime() : (maxVal as number);\n\n xPadding = (xMax - xMin) * 0.1;\n }\n\n const maxMarkerSize = d3Max(_points, (point: ScatterChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.markerSize as number;\n });\n })!;\n\n for (let i = _points.length - 1; i >= 0; i--) {\n const pointsForSeries: JSXElement[] = [];\n\n const legendVal: string = _points[i].legend;\n const seriesColor: string = _points[i].color!;\n const verticaLineHeight = containerHeight - margins.bottom! + 6;\n\n for (let j = 0; j < _points[i].data.length; j++) {\n const seriesId = `${_seriesId}_${i}_${j}`;\n const circleId = `${_circleId}_${i}_${j}`;\n const { x, y, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j];\n const pointMarkerSize = (_points[i].data[j] as ScatterChartDataPoint).markerSize;\n const extraMaxPixels =\n _xAxisType !== XAxisTypes.StringAxis\n ? _getRangeForScatterMarkerSize(_yAxisScale, yPadding, xMin, xMax, xPadding)\n : 0;\n const minPixel = 4;\n const maxPixel = 16;\n const circleRadius =\n pointMarkerSize && maxMarkerSize !== 0\n ? _xAxisType !== XAxisTypes.StringAxis\n ? (pointMarkerSize * extraMaxPixels) / maxMarkerSize\n : minPixel + ((pointMarkerSize - minPixel) / (maxMarkerSize - minPixel)) * (maxPixel - minPixel)\n : activePoint === circleId\n ? 6\n : 4;\n\n const isLegendSelected: boolean = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;\n\n const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;\n const text = _points?.[i].data[j]?.text;\n if (!_isTextMode.current) {\n pointsForSeries.push(\n <>\n <circle\n id={circleId}\n key={circleId}\n r={Math.max(circleRadius, 4)}\n cx={_xAxisScale(x) + _xBandwidth}\n cy={_yAxisScale(y)}\n data-is-focusable={isLegendSelected}\n onMouseOver={(event: React.MouseEvent<SVGElement>) =>\n _handleHover(\n x,\n y,\n verticaLineHeight,\n xAxisCalloutData,\n circleId,\n xAxisCalloutAccessibilityData,\n event,\n )\n }\n onMouseMove={(event: React.MouseEvent<SVGElement>) =>\n _handleHover(\n x,\n y,\n verticaLineHeight,\n xAxisCalloutData,\n circleId,\n xAxisCalloutAccessibilityData,\n event,\n )\n }\n onMouseOut={_handleMouseOut}\n onFocus={event =>\n _handleFocus(event, seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData)\n }\n onBlur={_handleMouseOut}\n {..._getClickHandler(_points[i].data[j].onDataPointClick)}\n opacity={isLegendSelected && !currentPointHidden ? 1 : 0.1}\n fill={_getPointFill(seriesColor, circleId, j, false)}\n stroke={seriesColor}\n role=\"img\"\n aria-label={_getAriaLabel(i, j)}\n tabIndex={isLegendSelected ? 0 : undefined}\n />\n ,\n {text && (\n <text\n key={`${circleId}-label`}\n x={_xAxisScale(x) + _xBandwidth}\n y={_yAxisScale(y) + Math.max(circleRadius + 12, 16)}\n className={classes.markerLabel}\n >\n {text}\n </text>\n )}\n </>,\n );\n }\n }\n\n if (_isScatterPolarRef.current) {\n pointsForSeries.push(\n ...renderScatterPolarCategoryLabels({\n xAxisScale: _xAxisScale.current,\n yAxisScale: _yAxisScale.current,\n className: classes.markerLabel || '',\n lineOptions: (_points?.[i] as Partial<LineChartPoints>)?.lineOptions,\n }),\n );\n }\n\n series.push(\n <g\n key={`series_${i}`}\n role=\"region\"\n aria-label={`${legendVal}, series ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`}\n >\n {pointsForSeries}\n </g>,\n );\n }\n // Removing un wanted tooltip div from DOM, when prop not provided.\n if (!props.showXAxisLablesTooltip) {\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n // Used to display tooltip at x axis labels.\n if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {\n const xAxisElement = d3Select(xElement).call(_xAxisScale);\n try {\n document.getElementById(_tooltipId) && document.getElementById(_tooltipId)!.remove();\n // eslint-disable-next-line no-empty\n } catch (e) {}\n const tooltipProps = {\n tooltipCls: classes.tooltip!,\n id: _tooltipId,\n axis: xAxisElement,\n };\n xAxisElement && tooltipOfAxislabels(tooltipProps);\n }\n return series;\n }\n\n function _handleFocus(\n event: React.FocusEvent<SVGCircleElement, Element>,\n seriesId: string,\n x: number | Date | string,\n xAxisCalloutData: string | undefined,\n circleId: string,\n xAxisCalloutAccessibilityData?: AccessibilityProps,\n ) {\n let cx = 0;\n let cy = 0;\n\n const targetRect = (event.target as SVGCircleElement).getBoundingClientRect();\n cx = targetRect.left + targetRect.width / 2;\n cy = targetRect.top + targetRect.height / 2;\n updatePosition(cx, cy);\n _uniqueCallOutID = circleId;\n const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;\n const xVal = x instanceof Date ? x.getTime() : x;\n const found = find(_calloutPoints, (element: { x: string | number }) => element.x === xVal);\n // if no points need to be called out then don't show vertical line and callout card\n\n if (found) {\n d3Select(`#${_verticalLine}`)\n .attr('transform', () => `translate(${_xAxisScale(x) + _xBandwidth}, 0)`)\n .attr('visibility', 'visibility');\n _refArray.forEach((obj: RefArrayData) => {\n if (obj.index === seriesId) {\n setPopoverOpen(true);\n xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);\n setYValueHover(found.values);\n setStackCalloutProps(found!);\n setActivePoint(circleId);\n }\n });\n } else {\n setActivePoint(circleId);\n }\n }\n\n function _handleHover(\n x: number | Date | string,\n y: number | Date,\n lineHeight: number,\n xAxisCalloutData: string | undefined,\n circleId: string,\n xAxisCalloutAccessibilityData: AccessibilityProps | undefined,\n mouseEvent: React.MouseEvent<SVGElement>,\n ) {\n mouseEvent?.persist();\n const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;\n const xVal = x instanceof Date ? x.getTime() : x;\n const found = find(_calloutPoints, (element: { x: string | number }) => element.x === xVal);\n // if no points need to be called out then don't show vertical line and callout card\n\n if (found) {\n d3Select(`#${_verticalLine}`)\n .attr('transform', () => `translate(${_xAxisScale(x) + _xBandwidth}, ${_yAxisScale(y)})`)\n .attr('visibility', 'visibility')\n .attr('y2', `${lineHeight - _yAxisScale(y)}`);\n\n if (_uniqueCallOutID !== circleId) {\n _uniqueCallOutID = circleId;\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);\n setYValueHover(found.values);\n setStackCalloutProps(found!);\n setActivePoint(circleId);\n }\n } else {\n setActivePoint(circleId);\n }\n }\n\n /**\n * Screen readers announce an element as clickable if the onClick attribute is set.\n * This function sets the attribute only when a click event handler is provided.*/\n\n function _getClickHandler(func?: () => void): { onClick?: () => void } {\n if (func) {\n return {\n onClick: func,\n };\n }\n\n return {};\n }\n\n function _handleMouseOut() {\n d3Select(`#${_verticalLine}`).attr('visibility', 'hidden');\n }\n\n function _handleChartMouseLeave() {\n _uniqueCallOutID = null;\n setActivePoint('');\n if (isPopoverOpen) {\n setPopoverOpen(false);\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): boolean {\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(): boolean {\n return _getHighlightedLegend().length === 0;\n }\n\n function _getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];\n }\n\n function _getAriaLabel(seriesIndex: number, pointIndex: number): string {\n const series = _points[seriesIndex];\n const point = series.data[pointIndex];\n const formattedDate = point.x instanceof Date ? formatDate(point.x, props.useUTC) : point.x;\n const xValue = point.xAxisCalloutData || formattedDate;\n const legend = series.legend;\n const yValue = point.yAxisCalloutData || point.y;\n return point.callOutAccessibilityData?.ariaLabel || `${xValue}. ${legend}, ${yValue}.`;\n }\n\n function _isChartEmpty(): boolean {\n return !(\n props.data &&\n props.data.scatterChartData &&\n props.data.scatterChartData.length > 0 &&\n props.data.scatterChartData.filter((item: ScatterChartPoints) => item.data.length).length > 0\n );\n }\n\n const _getMinMaxofXAxis = React.useCallback(\n (points: ScatterChartPoints[], yAxisType: YAxisType | undefined) =>\n _getNumericMinMaxOfY(points as ScatterChartPoints[], yAxisType),\n [],\n );\n\n const { legendProps, tickValues, tickFormat } = props;\n _points = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);\n\n let points = _points as ScatterChartPoints[];\n if (legendProps && !!legendProps.canSelectMultipleLegends) {\n points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;\n _calloutPoints = calloutData(points);\n }\n\n let legendBars = null;\n // reduce computation cost by only creating legendBars\n // if when hideLegend is false.\n // NOTE: they are rendered only when hideLegend is false in CartesianChart.\n if (!props.hideLegend && !_isTextMode.current) {\n legendBars = _createLegends(_points!); // ToDo: Memoize legends to improve performance.\n }\n const calloutProps = {\n YValueHover,\n hoverXValue,\n descriptionMessage:\n props.getCalloutDescriptionMessage && stackCalloutProps\n ? props.getCalloutDescriptionMessage(stackCalloutProps)\n : undefined,\n 'data-is-focusable': true,\n xAxisCalloutAccessibilityData,\n ...props.calloutProps,\n clickPosition,\n isPopoverOpen,\n isCalloutForStack: true,\n culture: props.culture ?? 'en-us',\n isCartesian: true,\n };\n const tickParams = {\n tickValues,\n tickFormat,\n };\n\n const xAxisLabels: string[] = _points\n .map((point: ScatterChartDataWithIndex) => point.data.map((dp: ScatterChartDataPoint) => dp.x as string))\n .flat();\n\n _xAxisLabels = [...new Set(xAxisLabels)];\n\n return !_isChartEmpty() ? (\n <CartesianChart\n {...props}\n chartTitle={props.data.chartTitle}\n points={points}\n chartType={ChartTypes.ScatterChart}\n calloutProps={calloutProps}\n tickParams={tickParams}\n legendBars={legendBars}\n getmargins={_getMargins}\n getGraphData={_initializeScatterChartData}\n xAxisType={_xAxisType}\n getMinMaxOfYAxis={_getMinMaxofXAxis}\n getDomainNRangeValues={_getDomainNRangeValues}\n createYAxis={createNumericYAxis}\n createStringYAxis={createStringYAxis}\n onChartMouseLeave={_handleChartMouseLeave}\n enableFirstRenderOptimization={_firstRenderOptimization}\n datasetForXAxisDomain={_xAxisLabels}\n componentRef={cartesianChartRef}\n {...(_isScatterPolarRef.current ? { yMaxValue: 1, yMinValue: -1 } : {})}\n /* eslint-disable react/jsx-no-bind */\n // eslint-disable-next-line react/no-children-prop\n children={(props: ChildProps) => {\n _xAxisScale = props.xScale!;\n _yAxisScale = props.yScalePrimary!;\n return (\n <>\n <g>\n <line\n x1={0}\n y1={0}\n x2={0}\n y2={props.containerHeight}\n stroke={'#323130'}\n id={_verticalLine}\n visibility={'hidden'}\n strokeDasharray={'5,5'}\n />\n <g>{renderSeries}</g>\n </g>\n </>\n );\n }}\n />\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nScatterChart.displayName = 'ScatterChart';\n"],"names":["React","useScatterChartStyles","select","d3Select","Legends","max","d3Max","min","d3Min","useId","areArraysEqual","createNumericYAxis","createStringYAxis","domainRangeOfDateForScatterChart","domainRangeOfNumericForScatterChart","domainRangeOfXStringAxis","find","findNumericMinMaxOfY","useRtl","isTextMode","isScatterPolarSeries","CartesianChart","tokens","calloutData","ChartTypes","XAxisTypes","tooltipOfAxislabels","getTypeOfAxis","getNextColor","getColorFromToken","formatDate","toImage","renderScatterPolarCategoryLabels","ScatterChart","forwardRef","props","forwardedRef","_circleId","_seriesId","_verticalLine","_tooltipId","_firstRenderOptimization","_emptyChartId","_points","_injectIndexPropertyInScatterChartData","data","scatterChartData","_calloutPoints","_xAxisScale","_yAxisScale","_uniqueCallOutID","_refArray","margins","renderSeries","_xAxisLabels","xAxisCalloutAccessibilityData","_xBandwidth","cartesianChartRef","useRef","classes","_legendsRef","_isRTL","hoverXValue","setHoverXValue","useState","activeLegend","setActiveLegend","YValueHover","setYValueHover","selectedLegendPoints","setSelectedLegendPoints","isSelectedLegend","setIsSelectedLegend","activePoint","setActivePoint","stackCalloutProps","setStackCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","selectedLegends","setSelectedLegends","legendProps","prevSelectedLegendsRef","undefined","_isTextMode","_isScatterPolarRef","useEffect","current","useImperativeHandle","componentRef","chartContainer","opts","toSVG","_xAxisType","length","StringAxis","pointsRef","calloutPointsRef","height","width","map","item","index","color","updatePosition","newX","newY","threshold","distance","Math","sqrt","pow","_getNumericMinMaxOfY","points","yAxisType","startValue","endValue","yPadding","_getDomainNRangeValues","chartType","isRTL","xAxisType","barWidth","tickValues","shiftX","domainNRangeValue","NumericAxis","DateAxis","_getMargins","_margins","_initializeScatterChartData","xScale","yScale","containerHeight","containerWidth","xElement","_createPlot","_onHoverCardHide","_createLegends","isLegendMultiSelectEnabled","canSelectMultipleLegends","mapLegendToPoints","forEach","point","legend","push","legendDataItems","Object","entries","legendTitle","representativePoint","title","onMouseOutAction","hoverAction","_handleChartMouseLeave","legendShape","shape","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","onLegendHoverCardLeave","onChange","_onLegendSelectionChange","legendRef","legendsSelected","event","currentLegend","slice","_getPointFill","seriesColor","pointId","pointIndex","isLastPoint","colorNeutralBackground1","_getRangeForScatterMarkerSize","xMin","xMax","xPadding","extraXPixels","yMin","domain","extraYPixels","series","yMax","bandwidth","isDate","getX","minVal","maxVal","getTime","maxMarkerSize","markerSize","i","pointsForSeries","legendVal","verticaLineHeight","bottom","j","seriesId","circleId","xAxisCalloutData","pointMarkerSize","extraMaxPixels","minPixel","maxPixel","circleRadius","isLegendSelected","_legendHighlighted","_noLegendHighlighted","currentPointHidden","hideNonActiveDots","text","circle","id","key","r","cx","cy","data-is-focusable","onMouseOver","_handleHover","onMouseMove","onMouseOut","_handleMouseOut","onFocus","_handleFocus","onBlur","_getClickHandler","onDataPointClick","opacity","fill","stroke","role","aria-label","_getAriaLabel","tabIndex","className","markerLabel","xAxisScale","yAxisScale","lineOptions","g","showXAxisLablesTooltip","document","getElementById","remove","e","wrapXAxisLables","xAxisElement","call","tooltipProps","tooltipCls","tooltip","axis","targetRect","target","getBoundingClientRect","left","top","formattedData","Date","useUTC","xVal","found","element","attr","obj","values","lineHeight","mouseEvent","persist","clientX","clientY","func","onClick","_getHighlightedLegend","includes","seriesIndex","formattedDate","xValue","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_isChartEmpty","filter","_getMinMaxofXAxis","useCallback","tickFormat","legendBars","hideLegend","calloutProps","descriptionMessage","getCalloutDescriptionMessage","isCalloutForStack","culture","isCartesian","tickParams","xAxisLabels","dp","flat","Set","chartTitle","getmargins","getGraphData","getMinMaxOfYAxis","getDomainNRangeValues","createYAxis","onChartMouseLeave","enableFirstRenderOptimization","datasetForXAxisDomain","yMaxValue","yMinValue","children","yScalePrimary","line","x1","y1","x2","y2","visibility","strokeDasharray","div","style","displayName"],"mappings":";;;;+BA8DaiC;;;;;;;iEA9DU,QAAQ;6CAEO,iCAAiC;6BAEpC,eAAe;uBAClB,mBAAmB;yBACR,WAAW;gCAChC,4BAA4B;wBAgB3C,wBAAwB;wBAaxB,cAAc;4BACE,wBAAwB;kCAYvB,qCAAqC;mCAEZ,qCAAqC;AAW/E,qBAAMA,WAAAA,GAA2DjC,OAAMkC,UAAU,CAGtF,CAACC,OAAOC;QAoC+DD,oBAanEA;IAhDJ,MAAME,gBAAoB5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aAAA,CAAA,OAAA,QAAA,EAAA,MAAA,WAAA,GACE,OAAA,aAAA,CAACzE,KAAAA,MAAAA,WAAAA,GACC,OAAA,aAAA,CAAC0E,QAAAA;gBACCC,IAAI;gBACJC,IAAI;gBACJC,IAAI;gBACJC,IAAIlS,MAAMsG,eAAe;gBACzBoG,QAAQ;gBACRlB,IAAIpL;gBACJ+R,YAAY;gBACZC,iBAAiB;8BAEnB,OAAA,aAAA,CAAChF,KAAAA,MAAGlM;QAIZ;uBAGF,OAAA,aAAA,CAACmR,OAAAA;QAAI7G,IAAIjL;QAAeoM,MAAM;QAAS2F,OAAO;YAAE9F,SAAS;QAAI;QAAGI,cAAY;;AAEhF,GAAG;AACH9M,aAAayS,WAAW,GAAG"}
@@ -18,24 +18,12 @@ _export(exports, {
18
18
  });
19
19
  const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
20
20
  const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
21
- function renderScatterPolarCategoryLabels({ allSeriesData, xAxisScale, yAxisScale, className, lineOptions, minPixelGap = 40 }) {
21
+ function renderScatterPolarCategoryLabels({ xAxisScale, yAxisScale, className, lineOptions, minPixelGap = 40 }) {
22
22
  const maybeLineOptions = extractMaybeLineOptions(lineOptions);
23
- // 1. Aggregate all data points from all series
24
- const allLabels = [];
25
- allSeriesData.forEach((series)=>{
26
- series.data.forEach((pt)=>{
27
- if (pt.text) {
28
- allLabels.push({
29
- x: pt.x,
30
- y: pt.y,
31
- text: pt.text
32
- });
33
- }
34
- });
35
- });
36
- // 2. Deduplicate by text (angle label)
37
- const uniqueTexts = Array.from(new Set(allLabels.map((l)=>l.text)));
38
- // 3. Place labels at equal angles
23
+ var _maybeLineOptions_axisLabel;
24
+ // Always use axisLabel from lineOptions to display the labels
25
+ const uniqueTexts = (_maybeLineOptions_axisLabel = maybeLineOptions === null || maybeLineOptions === void 0 ? void 0 : maybeLineOptions.axisLabel) !== null && _maybeLineOptions_axisLabel !== void 0 ? _maybeLineOptions_axisLabel : [];
26
+ // Place labels at equal angles
39
27
  const renderedLabels = [];
40
28
  const placedPositions = [];
41
29
  const labelRadius = 0.7; // You can adjust this value for more/less offset
@@ -73,6 +61,7 @@ function extractMaybeLineOptions(lineOptions) {
73
61
  return lineOptions ? {
74
62
  originXOffset: lineOptions.originXOffset,
75
63
  direction: lineOptions.direction === 'clockwise' || lineOptions.direction === 'counterclockwise' ? lineOptions.direction : undefined,
76
- rotation: lineOptions.rotation
64
+ rotation: lineOptions.rotation,
65
+ axisLabel: Array.isArray(lineOptions.axisLabel) ? lineOptions.axisLabel : undefined
77
66
  } : undefined;
78
67
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utilities/scatterpolar-utils.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ScaleLinear } from 'd3-scale';\nimport { JSXElement } from '@fluentui/react-utilities';\n\n/**\n * Helper to render categorical labels for scatterpolar charts with improved overlap logic across all series\n * Now places labels at equal angles for all unique texts, regardless of data positions.\n */\nexport function renderScatterPolarCategoryLabels({\n allSeriesData,\n xAxisScale,\n yAxisScale,\n className,\n lineOptions,\n minPixelGap = 40,\n}: {\n allSeriesData: { data: { x: number; y: number; text?: string }[] }[];\n xAxisScale: ScaleLinear<number, number>;\n yAxisScale: ScaleLinear<number, number>;\n className: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n lineOptions?: any;\n minPixelGap?: number;\n}): JSXElement[] {\n const maybeLineOptions = extractMaybeLineOptions(lineOptions);\n\n // 1. Aggregate all data points from all series\n const allLabels: { x: number; y: number; text: string }[] = [];\n allSeriesData.forEach(series => {\n series.data.forEach(pt => {\n if (pt.text) {\n allLabels.push({ x: pt.x, y: pt.y, text: pt.text });\n }\n });\n });\n\n // 2. Deduplicate by text (angle label)\n const uniqueTexts = Array.from(new Set(allLabels.map(l => l.text)));\n\n // 3. Place labels at equal angles\n const renderedLabels: JSXElement[] = [];\n const placedPositions: { x: number; y: number }[] = [];\n const labelRadius = 0.7; // You can adjust this value for more/less offset\n const numLabels = uniqueTexts.length;\n\n // Respect schema or prop rotation and direction (default ccw, 0°)\n const dirMultiplier = maybeLineOptions?.direction === 'clockwise' ? -1 : 1;\n const rotationRad = ((maybeLineOptions?.rotation ?? 0) * Math.PI) / 180;\n\n uniqueTexts.forEach((text, i) => {\n const angle = rotationRad + dirMultiplier * ((2 * Math.PI) / numLabels) * i;\n const originXOffset = maybeLineOptions?.originXOffset || 0;\n const x = xAxisScale(labelRadius * Math.cos(angle) - originXOffset / 2);\n const y = yAxisScale(labelRadius * Math.sin(angle));\n\n // Check distance from all previously placed labels\n const isFarEnough = placedPositions.every(pos => Math.sqrt((x - pos.x) ** 2 + (y - pos.y) ** 2) >= minPixelGap);\n\n if (renderedLabels.length === 0 || isFarEnough) {\n renderedLabels.push(\n <text\n key={`scatterpolar-label-${text}`}\n x={x}\n y={y}\n className={className}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n opacity={1}\n >\n {text}\n </text>,\n );\n placedPositions.push({ x, y });\n }\n });\n\n return renderedLabels;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function extractMaybeLineOptions(lineOptions: any):\n | {\n originXOffset?: number;\n direction?: 'clockwise' | 'counterclockwise';\n rotation?: number;\n }\n | undefined {\n return lineOptions\n ? {\n originXOffset: lineOptions.originXOffset,\n direction:\n lineOptions.direction === 'clockwise' || lineOptions.direction === 'counterclockwise'\n ? lineOptions.direction\n : undefined,\n rotation: lineOptions.rotation,\n }\n : undefined;\n}\n"],"names":["React","renderScatterPolarCategoryLabels","allSeriesData","xAxisScale","yAxisScale","className","lineOptions","minPixelGap","maybeLineOptions","extractMaybeLineOptions","allLabels","forEach","series","data","pt","text","push","x","y","uniqueTexts","Array","from","Set","map","l","renderedLabels","placedPositions","labelRadius","numLabels","length","dirMultiplier","direction","rotationRad","rotation","Math","PI","i","angle","originXOffset","cos","sin","isFarEnough","every","pos","sqrt","key","textAnchor","alignmentBaseline","opacity","undefined"],"mappings":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CAAQ,GAAKQ;QAC1E,MAAME,gBAAgB9B,sBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAkB8B,aAAAA,AAAa,KAAI;QACzD,MAAMrB,IAAId,WAAWwB,cAAcO,KAAKK,GAAG,CAACF,SAASC,gBAAgB;QACrE,MAAMpB,IAAId,WAAWuB,cAAcO,KAAKM,GAAG,CAACH;QAE5C,mDAAmD;QACnD,MAAMI,cAAcf,gBAAgBgB,KAAK,CAACC,CAAAA,MAAOT,KAAKU,IAAI,CAAE3B,CAAAA,IAAI0B,KAAI1B,KAAM,IAAKC,CAAAA,IAAIyB,KAAIzB,KAAM,MAAMX;QAEnG,IAAIkB,eAAeI,MAAM,KAAK,KAAKY,aAAa;YAC9ChB,eAAeT,IAAI,CAAA,WAAA,GACjB,OAAA,aAAA,CAACD,QAAAA;gBACC8B,KAAK,CAAC,mBAAmB,EAAE9B,MAAM;gBACjCE,GAAGA;gBACHC,GAAGA;gBACHb,WAAWA;gBACXyC,YAAW;gBACXC,mBAAkB;gBAClBC,SAAS;eAERjC;YAGLW,gBAAgBV,IAAI,CAAC;gBAAEC;gBAAGC;YAAE;QAC9B;IACF;IAEA,OAAOO;AACT;AAGO,iCAAiCnB,WAAgB;IAOtD,OAAOA,cACH;QACEgC,eAAehC,YAAYgC,aAAa;QACxCP,WACEzB,YAAYyB,SAAS,KAAK,eAAezB,YAAYyB,SAAS,KAAK,qBAC/DzB,YAAYyB,SAAS,GACrBkB;QACNhB,UAAU3B,YAAY2B,QAAQ;IAChC,IACAgB;AACN"}
1
+ {"version":3,"sources":["../src/utilities/scatterpolar-utils.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ScaleLinear } from 'd3-scale';\nimport { JSXElement } from '@fluentui/react-utilities';\n\n/**\n * Helper to render categorical labels for scatterpolar charts with improved overlap logic across all series\n * Now places labels at equal angles for all unique texts, regardless of data positions.\n */\nexport function renderScatterPolarCategoryLabels({\n xAxisScale,\n yAxisScale,\n className,\n lineOptions,\n minPixelGap = 40,\n}: {\n xAxisScale: ScaleLinear<number, number>;\n yAxisScale: ScaleLinear<number, number>;\n className: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n lineOptions?: any;\n minPixelGap?: number;\n}): JSXElement[] {\n const maybeLineOptions = extractMaybeLineOptions(lineOptions);\n\n // Always use axisLabel from lineOptions to display the labels\n const uniqueTexts: string[] = maybeLineOptions?.axisLabel ?? [];\n\n // Place labels at equal angles\n const renderedLabels: JSXElement[] = [];\n const placedPositions: { x: number; y: number }[] = [];\n const labelRadius = 0.7; // You can adjust this value for more/less offset\n const numLabels = uniqueTexts.length;\n\n // Respect schema or prop rotation and direction (default ccw, 0°)\n const dirMultiplier = maybeLineOptions?.direction === 'clockwise' ? -1 : 1;\n const rotationRad = ((maybeLineOptions?.rotation ?? 0) * Math.PI) / 180;\n\n uniqueTexts.forEach((text, i) => {\n const angle = rotationRad + dirMultiplier * ((2 * Math.PI) / numLabels) * i;\n const originXOffset = maybeLineOptions?.originXOffset || 0;\n const x = xAxisScale(labelRadius * Math.cos(angle) - originXOffset / 2);\n const y = yAxisScale(labelRadius * Math.sin(angle));\n\n // Check distance from all previously placed labels\n const isFarEnough = placedPositions.every(pos => Math.sqrt((x - pos.x) ** 2 + (y - pos.y) ** 2) >= minPixelGap);\n\n if (renderedLabels.length === 0 || isFarEnough) {\n renderedLabels.push(\n <text\n key={`scatterpolar-label-${text}`}\n x={x}\n y={y}\n className={className}\n textAnchor=\"middle\"\n alignmentBaseline=\"middle\"\n opacity={1}\n >\n {text}\n </text>,\n );\n placedPositions.push({ x, y });\n }\n });\n\n return renderedLabels;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function extractMaybeLineOptions(lineOptions: any):\n | {\n originXOffset?: number;\n direction?: 'clockwise' | 'counterclockwise';\n rotation?: number;\n axisLabel?: string[];\n }\n | undefined {\n return lineOptions\n ? {\n originXOffset: lineOptions.originXOffset,\n direction:\n lineOptions.direction === 'clockwise' || lineOptions.direction === 'counterclockwise'\n ? lineOptions.direction\n : undefined,\n rotation: lineOptions.rotation,\n axisLabel: Array.isArray(lineOptions.axisLabel) ? lineOptions.axisLabel : undefined,\n }\n : undefined;\n}\n"],"names":["React","renderScatterPolarCategoryLabels","xAxisScale","yAxisScale","className","lineOptions","minPixelGap","maybeLineOptions","extractMaybeLineOptions","uniqueTexts","axisLabel","renderedLabels","placedPositions","labelRadius","numLabels","length","dirMultiplier","direction","rotationRad","rotation","Math","PI","forEach","text","i","angle","originXOffset","x","cos","y","sin","isFarEnough","every","pos","sqrt","push","key","textAnchor","alignmentBaseline","opacity","undefined","Array","isArray"],"mappings":";;;;;;;;;;;2BAoEgBQ;eAAAA;;IA5DAP,gCAAAA;;;;;iEARO,QAAQ;AAQxB,0CAA0C,EAC/CC,UAAU,EACVC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,cAAc,EAAE,EAQjB;IACC,MAAMC,mBAAmBC,wBAAwBH;QAGnBE;IAD9B,8DAA8D;IAC9D,MAAME,cAAwBF,CAAAA,8BAAAA,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAkBG,SAAAA,AAAS,MAAA,QAA3BH,gCAAAA,KAAAA,IAAAA,8BAA+B,EAAE;IAE/D,+BAA+B;IAC/B,MAAMI,iBAA+B,EAAE;IACvC,MAAMC,kBAA8C,EAAE;IACtD,MAAMC,cAAc,KAAK,iDAAiD;IAC1E,MAAMC,YAAYL,YAAYM,MAAM;IAEpC,kEAAkE;IAClE,MAAMC,gBAAgBT,CAAAA,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAkBU,SAAAA,AAAS,MAAK,cAAc,CAAC,IAAI;QACnDV;IAAtB,MAAMW,cAAgBX,CAAAA,CAAAA,6BAAAA,qBAAAA,QAAAA,qBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,iBAAkBY,QAAAA,AAAQ,MAAA,QAA1BZ,+BAAAA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CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-charts",
3
- "version": "0.0.0-nightly-20250827-0407.1",
3
+ "version": "0.0.0-nightly-20250828-0408.1",
4
4
  "description": "React web chart controls for Microsoft fluentui v9 system.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -22,21 +22,21 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@fluentui/eslint-plugin": "*",
25
- "@fluentui/react-conformance": "0.0.0-nightly-20250827-0407.1",
26
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20250827-0407.1",
25
+ "@fluentui/react-conformance": "0.0.0-nightly-20250828-0408.1",
26
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20250828-0408.1",
27
27
  "@fluentui/scripts-api-extractor": "*"
28
28
  },
29
29
  "dependencies": {
30
30
  "@fluentui/chart-utilities": "^1.1.28",
31
- "@fluentui/react-button": "0.0.0-nightly-20250827-0407.1",
32
- "@fluentui/react-jsx-runtime": "0.0.0-nightly-20250827-0407.1",
33
- "@fluentui/react-overflow": "0.0.0-nightly-20250827-0407.1",
34
- "@fluentui/react-popover": "0.0.0-nightly-20250827-0407.1",
35
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20250827-0407.1",
36
- "@fluentui/react-tabster": "0.0.0-nightly-20250827-0407.1",
37
- "@fluentui/react-theme": "0.0.0-nightly-20250827-0407.1",
38
- "@fluentui/react-tooltip": "0.0.0-nightly-20250827-0407.1",
39
- "@fluentui/react-utilities": "0.0.0-nightly-20250827-0407.1",
31
+ "@fluentui/react-button": "0.0.0-nightly-20250828-0408.1",
32
+ "@fluentui/react-jsx-runtime": "0.0.0-nightly-20250828-0408.1",
33
+ "@fluentui/react-overflow": "0.0.0-nightly-20250828-0408.1",
34
+ "@fluentui/react-popover": "0.0.0-nightly-20250828-0408.1",
35
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20250828-0408.1",
36
+ "@fluentui/react-tabster": "0.0.0-nightly-20250828-0408.1",
37
+ "@fluentui/react-theme": "0.0.0-nightly-20250828-0408.1",
38
+ "@fluentui/react-tooltip": "0.0.0-nightly-20250828-0408.1",
39
+ "@fluentui/react-utilities": "0.0.0-nightly-20250828-0408.1",
40
40
  "@griffel/react": "^1.5.22",
41
41
  "@swc/helpers": "^0.5.1",
42
42
  "@types/d3-array": "^3.0.0",