@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.
@@ -310,16 +310,7 @@ import { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-u
310
310
  }
311
311
  if (_isScatterPolarRef.current) {
312
312
  var _points_i;
313
- // Render category labels for all series at once to avoid overlap
314
- const allSeriesData = _points.map((s)=>({
315
- data: s.data.filter((pt)=>typeof pt.x === 'number' && typeof pt.y === 'number').map((pt)=>({
316
- x: pt.x,
317
- y: pt.y,
318
- text: pt.text
319
- }))
320
- }));
321
313
  pointsForSeries.push(...renderScatterPolarCategoryLabels({
322
- allSeriesData,
323
314
  xAxisScale: _xAxisScale.current,
324
315
  yAxisScale: _yAxisScale.current,
325
316
  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":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,qBAAqB,QAAQ,iCAAiC;AAEvE,SAASC,UAAUC,QAAQ,QAAQ,eAAe;AAClD,SAAiBC,OAAO,QAAQ,mBAAmB;AACnD,SAASC,OAAOC,KAAK,EAAEC,OAAOC,KAAK,QAAQ,WAAW;AACtD,SAASC,KAAK,QAAQ,4BAA4B;AAElD,SACEC,cAAc,EACdC,kBAAkB,EAClBC,iBAAiB,EACjBC,gCAAgC,EAChCC,mCAAmC,EACnCC,wBAAwB,EACxBC,IAAI,EACJC,oBAAoB,EAGpBC,MAAM,E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O,IAAI;IAEP/P,eAAe;WAAI,IAAIgQ,IAAIH;KAAa;IAExC,OAAO,CAACb,gCACN,oBAACjR;QACE,GAAGc,KAAK;QACToR,YAAYpR,MAAMU,IAAI,CAAC0Q,UAAU;QACjClM,QAAQA;QACRM,WAAWnG,WAAWS,YAAY;QAClC2Q,cAAcA;QACdM,YAAYA;QACZR,YAAYA;QACZc,YAAYpL;QACZqL,cAAcnL;QACdT,WAAW5B;QACXyN,kBAAkBnB;QAClBoB,uBAAuBjM;QACvBkM,aAAajT;QACbC,mBAAmBA;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,qBACE,wDACE,oBAACxE,yBACC,oBAACyE;gBACCC,IAAI;gBACJC,IAAI;gBACJC,IAAI;gBACJC,IAAIrS,MAAMsG,eAAe;gBACzBoG,QAAQ;gBACRlB,IAAIpL;gBACJkS,YAAY;gBACZC,iBAAiB;8BAEnB,oBAAC/E,WAAGtM;QAIZ;uBAGF,oBAACsR;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":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,qBAAqB,QAAQ,iCAAiC;AAEvE,SAASC,UAAUC,QAAQ,QAAQ,eAAe;AAClD,SAAiBC,OAAO,QAAQ,mBAAm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AAQA;QACRM,WAAWnG,WAAWS,YAAY;QAClCwQ,cAAcA;QACdM,YAAYA;QACZR,YAAYA;QACZc,YAAYjL;QACZkL,cAAchL;QACdT,WAAW5B;QACXsN,kBAAkBnB;QAClBoB,uBAAuB9L;QACvB+L,aAAa9S;QACbC,mBAAmBA;QACnB8S,mBAAmB5J;QACnB6J,+BAA+BlR;QAC/BmR,uBAAuBtQ;QACvBuC,cAAcpC;QACb,GAAIgC,mBAAmBE,OAAO,GAAG;YAAEkO,WAAW;YAAGC,WAAW,CAAC;QAAE,IAAI,CAAC,CAAC;QACtE,oCAAoC,GACpC,kDAAkD;QAClDC,UAAU,CAAC5R;YACTa,cAAcb,MAAMoG,MAAM;YAC1BtF,cAAcd,MAAM6R,aAAa;YACjC,qBACE,wDACE,oBAACzE,yBACC,oBAAC0E;gBACCC,IAAI;gBACJC,IAAI;gBACJC,IAAI;gBACJC,IAAIlS,MAAMsG,eAAe;gBACzBoG,QAAQ;gBACRlB,IAAIpL;gBACJ+R,YAAY;gBACZC,iBAAiB;8BAEnB,oBAAChF,WAAGlM;QAIZ;uBAGF,oBAACmR;QAAI7G,IAAIjL;QAAeoM,MAAM;QAAS2F,OAAO;YAAE9F,SAAS;QAAI;QAAGI,cAAY;;AAEhF,GAAG;AACH9M,aAAayS,WAAW,GAAG"}
@@ -2,24 +2,12 @@ import * as React from 'react';
2
2
  /**
3
3
  * Helper to render categorical labels for scatterpolar charts with improved overlap logic across all series
4
4
  * Now places labels at equal angles for all unique texts, regardless of data positions.
5
- */ export function renderScatterPolarCategoryLabels({ allSeriesData, xAxisScale, yAxisScale, className, lineOptions, minPixelGap = 40 }) {
5
+ */ export function renderScatterPolarCategoryLabels({ xAxisScale, yAxisScale, className, lineOptions, minPixelGap = 40 }) {
6
6
  const maybeLineOptions = extractMaybeLineOptions(lineOptions);
7
- // 1. Aggregate all data points from all series
8
- const allLabels = [];
9
- allSeriesData.forEach((series)=>{
10
- series.data.forEach((pt)=>{
11
- if (pt.text) {
12
- allLabels.push({
13
- x: pt.x,
14
- y: pt.y,
15
- text: pt.text
16
- });
17
- }
18
- });
19
- });
20
- // 2. Deduplicate by text (angle label)
21
- const uniqueTexts = Array.from(new Set(allLabels.map((l)=>l.text)));
22
- // 3. Place labels at equal angles
7
+ var _maybeLineOptions_axisLabel;
8
+ // Always use axisLabel from lineOptions to display the labels
9
+ const uniqueTexts = (_maybeLineOptions_axisLabel = maybeLineOptions === null || maybeLineOptions === void 0 ? void 0 : maybeLineOptions.axisLabel) !== null && _maybeLineOptions_axisLabel !== void 0 ? _maybeLineOptions_axisLabel : [];
10
+ // Place labels at equal angles
23
11
  const renderedLabels = [];
24
12
  const placedPositions = [];
25
13
  const labelRadius = 0.7; // You can adjust this value for more/less offset
@@ -58,6 +46,7 @@ export function extractMaybeLineOptions(lineOptions) {
58
46
  return lineOptions ? {
59
47
  originXOffset: lineOptions.originXOffset,
60
48
  direction: lineOptions.direction === 'clockwise' || lineOptions.direction === 'counterclockwise' ? lineOptions.direction : undefined,
61
- rotation: lineOptions.rotation
49
+ rotation: lineOptions.rotation,
50
+ axisLabel: Array.isArray(lineOptions.axisLabel) ? lineOptions.axisLabel : undefined
62
51
  } : undefined;
63
52
  }
@@ -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":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;;CAGC,GACD,OAAO,SAASC,iCAAiC,EAC/CC,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,cAAc,EAAE,EASjB;IACC,MAAMC,mBAAmBC,wBAAwBH;IAEjD,+CAA+C;IAC/C,MAAMI,YAAsD,EAAE;IAC9DR,cAAcS,OAAO,CAACC,CAAAA;QACpBA,OAAOC,IAAI,CAACF,OAAO,CAACG,CAAAA;YAClB,IAAIA,GAAGC,IAAI,EAAE;gBACXL,UAAUM,IAAI,CAAC;oBAAEC,GAAGH,GAAGG,CAAC;oBAAEC,GAAGJ,GAAGI,CAAC;oBAAEH,MAAMD,GAAGC,IAAI;gBAAC;YACnD;QACF;IACF;IAEA,uCAAuC;IACvC,MAAMI,cAAcC,MAAMC,IAAI,CAAC,IAAIC,IAAIZ,UAAUa,GAAG,CAACC,CAAAA,IAAKA,EAAET,IAAI;IAEhE,kCAAkC;IAClC,MAAMU,iBAA+B,EAAE;IACvC,MAAMC,kBAA8C,EAAE;IACtD,MAAMC,cAAc,KAAK,iDAAiD;IAC1E,MAAMC,YAAYT,YAAYU,MAAM;IAEpC,kEAAkE;IAClE,MAAMC,gBAAgBtB,CAAAA,6BAAAA,uCAAAA,iBAAkBuB,SAAS,MAAK,cAAc,CAAC,IAAI;QACnDvB;IAAtB,MAAMwB,cAAc,AAAExB,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atterpolar-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":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;;CAGC,GACD,OAAO,SAASC,iCAAiC,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,6BAAAA,uCAAAA,iBAAkBG,SAAS,cAA3BH,yCAAAA,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,6BAAAA,uCAAAA,iBAAkBU,SAAS,MAAK,cAAc,CAAC,IAAI;QACnDV;IAAtB,MAAMW,cAAc,AAAEX,CAAAA,CA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,GAAG8B;IAC5E,IACAA;AACN"}
@@ -247,7 +247,7 @@ const DeclarativeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>
247
247
  const mode = (_plotlyInputWithValidData_data_index_mode = (_plotlyInputWithValidData_data_index = plotlyInputWithValidData.data[index]) === null || _plotlyInputWithValidData_data_index === void 0 ? void 0 : _plotlyInputWithValidData_data_index.mode) !== null && _plotlyInputWithValidData_data_index_mode !== void 0 ? _plotlyInputWithValidData_data_index_mode : '';
248
248
  if (mode.includes('line')) {
249
249
  validTracesFilteredIndex[index].type = 'line';
250
- } else if (mode.includes('markers')) {
250
+ } else if (mode.includes('markers') || mode === 'text') {
251
251
  validTracesFilteredIndex[index].type = 'scatter';
252
252
  } else {
253
253
  validTracesFilteredIndex[index].type = 'line';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DeclarativeChart/DeclarativeChart.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as React from 'react';\nimport type { Data, PlotData, PlotlySchema, OutputChartType, TraceInfo } from '@fluentui/chart-utilities';\nimport {\n decodeBase64Fields,\n isArrayOrTypedArray,\n isMonthArray,\n mapFluentChart,\n sanitizeJson,\n} from '@fluentui/chart-utilities';\nimport type { GridProperties } from './PlotlySchemaAdapter';\nimport { tokens } from '@fluentui/react-theme';\nimport { ThemeContext_unstable as V9ThemeContext } from '@fluentui/react-shared-contexts';\nimport { Theme, webLightTheme } from '@fluentui/tokens';\nimport * as d3Color from 'd3-color';\n\nimport {\n correctYearMonth,\n getGridProperties,\n isNonPlotType,\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToVSBCProps,\n transformPlotlyJsonToAreaChartProps,\n transformPlotlyJsonToLineChartProps,\n transformPlotlyJsonToHorizontalBarWithAxisProps,\n transformPlotlyJsonToHeatmapProps,\n transformPlotlyJsonToSankeyProps,\n transformPlotlyJsonToGaugeProps,\n transformPlotlyJsonToGVBCProps,\n transformPlotlyJsonToVBCProps,\n transformPlotlyJsonToChartTableProps,\n transformPlotlyJsonToScatterChartProps,\n projectPolarToCartesian,\n getAllupLegendsProps,\n NON_PLOT_KEY_PREFIX,\n SINGLE_REPEAT,\n} from './PlotlySchemaAdapter';\nimport type { ColorwayType } from './PlotlyColorAdapter';\nimport { DonutChart } from '../DonutChart/index';\nimport { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';\nimport { LineChart } from '../LineChart/index';\nimport { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';\nimport { AreaChart } from '../AreaChart/index';\nimport { HeatMapChart } from '../HeatMapChart/index';\nimport { SankeyChart } from '../SankeyChart/SankeyChart';\nimport { GaugeChart } from '../GaugeChart/index';\nimport { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\nimport { Chart, ImageExportOptions } from '../../types/index';\nimport { ScatterChart } from '../ScatterChart/index';\n\nimport { withResponsiveContainer } from '../ResponsiveContainer/withResponsiveContainer';\nimport { ChartTable } from '../ChartTable/index';\nimport { LegendsProps, Legends } from '../Legends/index';\nimport { JSXElement } from '@fluentui/react-utilities/src/index';\n\nconst ResponsiveDonutChart = withResponsiveContainer(DonutChart);\nconst ResponsiveVerticalStackedBarChart = withResponsiveContainer(VerticalStackedBarChart);\nconst ResponsiveLineChart = withResponsiveContainer(LineChart);\nconst ResponsiveHorizontalBarChartWithAxis = withResponsiveContainer(HorizontalBarChartWithAxis);\nconst ResponsiveAreaChart = withResponsiveContainer(AreaChart);\nconst ResponsiveHeatMapChart = withResponsiveContainer(HeatMapChart);\nconst ResponsiveSankeyChart = withResponsiveContainer(SankeyChart);\nconst ResponsiveGaugeChart = withResponsiveContainer(GaugeChart);\nconst ResponsiveGroupedVerticalBarChart = withResponsiveContainer(GroupedVerticalBarChart);\nconst ResponsiveVerticalBarChart = withResponsiveContainer(VerticalBarChart);\nconst ResponsiveScatterChart = withResponsiveContainer(ScatterChart);\nconst ResponsiveChartTable = withResponsiveContainer(ChartTable);\n\n// Default x-axis key for grouping traces. Also applicable for PieData and SankeyData where x-axis is not defined.\nconst DEFAULT_XAXIS = 'x';\nconst FALLBACK_TYPE = 'fallback';\n\n/**\n * DeclarativeChart schema.\n * {@docCategory DeclarativeChart}\n */\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n plotlySchema: any;\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n\n /**\n * Optional callback to access the IDeclarativeChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDeclarativeChart>;\n\n /**\n * Optional prop to specify the colorway type of the chart.\n * - 'default': Use Fluent UI color palette aligning with plotly colorway.\n * - 'builtin': Use Fluent UI colorway.\n * - 'others': Reserved for future colorways.\n * @default 'default'\n */\n colorwayType?: ColorwayType;\n}\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface IDeclarativeChart {\n exportAsImage: (opts?: ImageExportOptions) => Promise<string>;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\nfunction renderChart<TProps>(\n Renderer: React.ComponentType<TProps>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transformer: (...args: any[]) => TProps,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transformerArgs: any[],\n commonProps: Partial<TProps>,\n cellRow: number,\n cellColumn: number,\n): JSXElement {\n const chartProps = transformer(...transformerArgs);\n return (\n <div\n key={`${cellRow}_${cellColumn}`}\n style={{\n gridRowStart: cellRow,\n gridRowEnd: cellRow + 1,\n gridColumnStart: cellColumn,\n gridColumnEnd: cellColumn + 1,\n }}\n >\n <Renderer {...chartProps} {...commonProps} />\n </div>\n );\n}\n\ntype PreTransformHooks = {\n preTransformCondition?: (plotlySchema: PlotlySchema) => boolean;\n preTransformOperation?: (plotlySchema: PlotlySchema) => PlotlySchema;\n};\n\nconst LineAreaPreTransformOp = (plotlyInput: PlotlySchema) => {\n const xValues = (plotlyInput.data[0] as PlotData).x;\n const isXMonth = isMonthArray(xValues);\n let renderData = plotlyInput.data;\n if (isXMonth) {\n renderData = plotlyInput.data.map((dataPoint: PlotData) => ({\n ...dataPoint,\n x: correctYearMonth(dataPoint.x),\n }));\n }\n return { data: renderData, layout: plotlyInput.layout };\n};\n\ntype ChartTypeMap = {\n donut: {\n transformer: typeof transformPlotlyJsonToDonutProps;\n renderer: typeof ResponsiveDonutChart;\n } & PreTransformHooks;\n sankey: {\n transformer: typeof transformPlotlyJsonToSankeyProps;\n renderer: typeof ResponsiveSankeyChart;\n } & PreTransformHooks;\n table: {\n transformer: typeof transformPlotlyJsonToChartTableProps;\n renderer: typeof ResponsiveChartTable;\n } & PreTransformHooks;\n horizontalbar: {\n transformer: typeof transformPlotlyJsonToHorizontalBarWithAxisProps;\n renderer: typeof ResponsiveHorizontalBarChartWithAxis;\n } & PreTransformHooks;\n groupedverticalbar: {\n transformer: typeof transformPlotlyJsonToGVBCProps;\n renderer: typeof ResponsiveGroupedVerticalBarChart;\n } & PreTransformHooks;\n verticalstackedbar: {\n transformer: typeof transformPlotlyJsonToVSBCProps;\n renderer: typeof ResponsiveVerticalStackedBarChart;\n } & PreTransformHooks;\n heatmap: {\n transformer: typeof transformPlotlyJsonToHeatmapProps;\n renderer: typeof ResponsiveHeatMapChart;\n } & PreTransformHooks;\n gauge: {\n transformer: typeof transformPlotlyJsonToGaugeProps;\n renderer: typeof ResponsiveGaugeChart;\n } & PreTransformHooks;\n verticalbar: {\n transformer: typeof transformPlotlyJsonToVBCProps;\n renderer: typeof ResponsiveVerticalBarChart;\n } & PreTransformHooks;\n area: {\n transformer: typeof transformPlotlyJsonToAreaChartProps;\n renderer: typeof ResponsiveAreaChart;\n } & PreTransformHooks;\n line: {\n transformer: typeof transformPlotlyJsonToLineChartProps;\n renderer: typeof ResponsiveLineChart;\n } & PreTransformHooks;\n scatter: {\n transformer: typeof transformPlotlyJsonToScatterChartProps;\n renderer: typeof ResponsiveScatterChart;\n } & PreTransformHooks;\n fallback: {\n transformer: typeof transformPlotlyJsonToVSBCProps;\n renderer: typeof ResponsiveVerticalStackedBarChart;\n } & PreTransformHooks;\n};\n\nconst chartMap: ChartTypeMap = {\n // PieData category charts\n donut: {\n transformer: transformPlotlyJsonToDonutProps,\n renderer: ResponsiveDonutChart,\n },\n // SankeyData category charts\n sankey: {\n transformer: transformPlotlyJsonToSankeyProps,\n renderer: ResponsiveSankeyChart,\n },\n // TableData category charts\n table: {\n transformer: transformPlotlyJsonToChartTableProps,\n renderer: ResponsiveChartTable,\n },\n // PlotData category charts\n horizontalbar: {\n transformer: transformPlotlyJsonToHorizontalBarWithAxisProps,\n renderer: ResponsiveHorizontalBarChartWithAxis,\n },\n groupedverticalbar: {\n transformer: transformPlotlyJsonToGVBCProps,\n renderer: ResponsiveGroupedVerticalBarChart,\n },\n verticalstackedbar: {\n transformer: transformPlotlyJsonToVSBCProps,\n renderer: ResponsiveVerticalStackedBarChart,\n },\n heatmap: {\n transformer: transformPlotlyJsonToHeatmapProps,\n renderer: ResponsiveHeatMapChart,\n },\n gauge: {\n transformer: transformPlotlyJsonToGaugeProps,\n renderer: ResponsiveGaugeChart,\n },\n verticalbar: {\n transformer: transformPlotlyJsonToVBCProps,\n renderer: ResponsiveVerticalBarChart,\n },\n area: {\n transformer: transformPlotlyJsonToAreaChartProps,\n renderer: ResponsiveAreaChart,\n preTransformOperation: LineAreaPreTransformOp,\n },\n line: {\n transformer: transformPlotlyJsonToLineChartProps,\n renderer: ResponsiveLineChart,\n preTransformOperation: LineAreaPreTransformOp,\n },\n scatter: {\n transformer: transformPlotlyJsonToScatterChartProps,\n renderer: ResponsiveScatterChart,\n preTransformOperation: LineAreaPreTransformOp,\n },\n fallback: {\n transformer: transformPlotlyJsonToVSBCProps,\n renderer: ResponsiveVerticalStackedBarChart,\n },\n};\n\nconst useIsDarkTheme = (): boolean => {\n const parentV9Theme = React.useContext(V9ThemeContext) as Theme;\n const v9Theme: Theme = parentV9Theme ? parentV9Theme : webLightTheme;\n\n // Get background and foreground colors\n const backgroundColor = d3Color.hsl(v9Theme.colorNeutralBackground1);\n const foregroundColor = d3Color.hsl(v9Theme.colorNeutralForeground1);\n\n const isDarkTheme = backgroundColor.l < foregroundColor.l;\n\n return isDarkTheme;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n const chart: OutputChartType = mapFluentChart(plotlySchema);\n if (!chart.isValid) {\n throw new Error(`Invalid chart schema: ${chart.errorMessage}`);\n }\n let plotlyInput = plotlySchema as PlotlySchema;\n try {\n plotlyInput = decodeBase64Fields(plotlyInput);\n } catch (error) {\n throw new Error(`Failed to decode plotly schema: ${error}`);\n }\n const plotlyInputWithValidData: PlotlySchema = {\n ...plotlyInput,\n data: chart.validTracesInfo!.map(trace => plotlyInput.data[trace.index]),\n };\n\n const validTracesFilteredIndex: TraceInfo[] = chart.validTracesInfo!.map((trace, index) => ({\n index,\n type: trace.type,\n }));\n\n let { selectedLegends } = plotlySchema;\n const colorMap = useColorMapping();\n const isDarkTheme = useIsDarkTheme();\n const chartRef = React.useRef<Chart>(null);\n const isMultiPlot = React.useRef(false);\n\n if (!isArrayOrTypedArray(selectedLegends)) {\n selectedLegends = [];\n }\n\n const [activeLegends, setActiveLegends] = React.useState<string[]>(selectedLegends);\n const onActiveLegendsChange = (keys: string[]) => {\n setActiveLegends(keys);\n if (props.onSchemaChange) {\n props.onSchemaChange({ plotlySchema: { plotlyInput, selectedLegends: keys } });\n }\n };\n\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { selectedLegends } = plotlySchema;\n setActiveLegends(selectedLegends ?? []);\n }, [props.chartSchema]);\n\n const multiSelectLegendProps = {\n canSelectMultipleLegends: true,\n onChange: onActiveLegendsChange,\n selectedLegends: activeLegends,\n };\n\n const commonProps = {\n legendProps: multiSelectLegendProps,\n componentRef: chartRef,\n };\n\n function createLegends(legendProps: LegendsProps): JSXElement {\n // eslint-disable-next-line react/jsx-no-bind\n return <Legends {...legendProps} selectedLegends={activeLegends} onChange={onActiveLegendsChange} />;\n }\n\n // TODO\n const exportAsImage = React.useCallback((opts?: ImageExportOptions): Promise<string> => {\n return new Promise((resolve, reject) => {\n if (isMultiPlot.current) {\n return reject(Error('Exporting multi plot charts as image is not supported'));\n }\n if (!chartRef.current || typeof chartRef.current.toImage !== 'function') {\n return reject(Error('Chart cannot be exported as image'));\n }\n\n chartRef.current\n .toImage({\n background: tokens.colorNeutralBackground1,\n scale: 5,\n ...opts,\n })\n .then(resolve)\n .catch(reject);\n });\n }, []);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n exportAsImage,\n }),\n [exportAsImage],\n );\n\n if (chart.type === 'scatterpolar') {\n const cartesianProjection = projectPolarToCartesian(plotlyInputWithValidData);\n plotlyInputWithValidData.data = cartesianProjection.data;\n plotlyInputWithValidData.layout = cartesianProjection.layout;\n validTracesFilteredIndex.forEach((trace, index) => {\n if (trace.type === 'scatterpolar') {\n const mode = (plotlyInputWithValidData.data[index] as PlotData)?.mode ?? '';\n if (mode.includes('line')) {\n validTracesFilteredIndex[index].type = 'line';\n } else if (mode.includes('markers')) {\n validTracesFilteredIndex[index].type = 'scatter';\n } else {\n validTracesFilteredIndex[index].type = 'line';\n }\n }\n });\n }\n const groupedTraces: Record<string, number[]> = {};\n let nonCartesianTraceCount = 0;\n plotlyInputWithValidData.data.forEach((trace: Data, index: number) => {\n let traceKey = '';\n if (isNonPlotType(chart.validTracesInfo![index].type)) {\n traceKey = `${NON_PLOT_KEY_PREFIX}${nonCartesianTraceCount + 1}`;\n nonCartesianTraceCount++;\n } else {\n traceKey = (trace as PlotData).xaxis ?? DEFAULT_XAXIS;\n }\n if (!groupedTraces[traceKey]) {\n groupedTraces[traceKey] = [];\n }\n groupedTraces[traceKey].push(index);\n });\n\n isMultiPlot.current = Object.keys(groupedTraces).length > 1;\n const gridProperties: GridProperties = getGridProperties(\n plotlyInputWithValidData,\n isMultiPlot.current,\n chart.validTracesInfo!,\n );\n\n // Render only one plot if the grid properties cannot determine positioning of multiple plots.\n if (\n isMultiPlot.current &&\n gridProperties.templateRows === SINGLE_REPEAT &&\n gridProperties.templateColumns === SINGLE_REPEAT\n ) {\n Object.keys(groupedTraces).forEach((key, index) => {\n if (index > 0) {\n delete groupedTraces[key];\n }\n });\n isMultiPlot.current = false;\n }\n\n const allupLegendsProps = getAllupLegendsProps(\n plotlyInputWithValidData,\n colorMap,\n props.colorwayType,\n chart.validTracesInfo!,\n isDarkTheme,\n );\n\n type ChartType = keyof ChartTypeMap;\n // map through the grouped traces and render the appropriate chart\n return (\n <>\n <div\n style={{\n display: 'grid',\n gridTemplateRows: gridProperties.templateRows,\n gridTemplateColumns: gridProperties.templateColumns,\n }}\n >\n {Object.entries(groupedTraces).map(([xAxisKey, index]) => {\n const plotlyInputForGroup: PlotlySchema = {\n ...plotlyInputWithValidData,\n data: index.map(idx => plotlyInputWithValidData.data[idx]),\n };\n\n const filteredTracesInfo = validTracesFilteredIndex.filter(trace => index.includes(trace.index));\n let chartType =\n validTracesFilteredIndex.some(trace => trace.type === FALLBACK_TYPE) || chart.type === FALLBACK_TYPE\n ? FALLBACK_TYPE\n : filteredTracesInfo[0].type;\n\n if (\n validTracesFilteredIndex.some(trace => trace.type === 'line') &&\n validTracesFilteredIndex.some(trace => trace.type === 'scatter')\n ) {\n chartType = 'line';\n }\n\n const chartEntry = chartMap[chartType as ChartType];\n if (chartEntry) {\n const { transformer, renderer, preTransformCondition, preTransformOperation } = chartEntry;\n if (preTransformCondition === undefined || preTransformCondition(plotlyInputForGroup)) {\n const transformedInput = preTransformOperation\n ? preTransformOperation(plotlyInputForGroup)\n : plotlyInputForGroup;\n const cellProperties = gridProperties.layout[xAxisKey];\n\n return renderChart<ReturnType<typeof transformer>>(\n renderer,\n transformer,\n [transformedInput, isMultiPlot.current, colorMap, props.colorwayType, isDarkTheme],\n {\n ...commonProps,\n xAxisAnnotation: cellProperties?.xAnnotation,\n yAxisAnnotation: cellProperties?.yAnnotation,\n },\n cellProperties?.row ?? 1,\n cellProperties?.column ?? 1,\n );\n }\n return <></>;\n } else {\n throw new Error(`Unsupported chart type :${plotlyInputForGroup.data[0]?.type}`);\n }\n })}\n </div>\n {isMultiPlot.current && createLegends(allupLegendsProps)}\n </>\n );\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\nDeclarativeChart.defaultProps = {\n colorwayType: 'default',\n};\n"],"names":["React","decodeBase64Fields","isArrayOrTypedArray","isMonthArray","mapFluentChart","sanitizeJson","tokens","ThemeContext_unstable","V9ThemeContext","webLightTheme","d3Color","correctYearMonth","getGridProperties","isNonPlotType","transformPlotlyJsonToDonutProps","transformPlotlyJsonToVSBCProps","transformPlotlyJsonToAreaChartProps","transformPlotlyJsonToLineChartProps","transformPlotlyJsonToHorizontalBarWithAxisProps","transformPlotlyJsonToHeatmapProps","transformPlotlyJsonToSankeyProps","transformPlotlyJsonToGaugeProps","transformPlotlyJsonToGVBCProps","transformPlotlyJsonToVBCProps","transformPlotlyJsonToChartTableProps","transformPlotlyJsonToScatterChartProps","projectPolarToCartesian","getAllupLegendsProps","NON_PLOT_KEY_PREFIX","SINGLE_REPEAT","DonutChart","VerticalStackedBarChart","LineChart","HorizontalBarChartWithAxis","AreaChart","HeatMapChart","SankeyChart","GaugeChart","GroupedVerticalBarChart","VerticalBarChart","ScatterChart","withResponsiveContainer","ChartTable","Legends","ResponsiveDonutChart","ResponsiveVerticalStackedBarChart","ResponsiveLineChart","ResponsiveHorizontalBarChartWithAxis","ResponsiveAreaChart","ResponsiveHeatMapChart","ResponsiveSankeyChart","ResponsiveGaugeChart","ResponsiveGroupedVerticalBarChart","ResponsiveVerticalBarChart","ResponsiveScatterChart","ResponsiveChartTable","DEFAULT_XAXIS","FALLBACK_TYPE","useColorMapping","colorMap","useRef","Map","renderChart","Renderer","transformer","transformerArgs","commonProps","cellRow","cellColumn","chartProps","div","key","style","gridRowStart","gridRowEnd","gridColumnStart","gridColumnEnd","LineAreaPreTransformOp","plotlyInput","xValues","data","x","isXMonth","renderData","map","dataPoint","layout","chartMap","donut","renderer","sankey","table","horizontalbar","groupedverticalbar","verticalstackedbar","heatmap","gauge","verticalbar","area","preTransformOperation","line","scatter","fallback","useIsDarkTheme","parentV9Theme","useContext","v9Theme","backgroundColor","hsl","colorNeutralBackground1","foregroundColor","colorNeutralForeground1","isDarkTheme","l","DeclarativeChart","forwardRef","props","forwardedRef","plotlySchema","chartSchema","chart","isValid","Error","errorMessage","error","plotlyInputWithValidData","validTracesInfo","trace","index","validTracesFilteredIndex","type","selectedLegends","chartRef","isMultiPlot","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","legendProps","componentRef","createLegends","exportAsImage","useCallback","opts","Promise","resolve","reject","current","toImage","background","scale","then","catch","useImperativeHandle","cartesianProjection","forEach","mode","includes","groupedTraces","nonCartesianTraceCount","traceKey","xaxis","push","Object","length","gridProperties","templateRows","templateColumns","allupLegendsProps","colorwayType","display","gridTemplateRows","gridTemplateColumns","entries","xAxisKey","plotlyInputForGroup","idx","filteredTracesInfo","filter","chartType","some","chartEntry","preTransformCondition","undefined","transformedInput","cellProperties","xAxisAnnotation","xAnnotation","yAxisAnnotation","yAnnotation","row","column","displayName","defaultProps"],"mappings":"AAAA,uDAAuD,GACvD,YAAYA;;;;;;;eAiT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AG9C,WAAW;oBACd8H,eAAe,EAAED,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBE,WAAW;oBAC5CC,eAAe,EAAEH,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBI,WAAW;gBAC9C,GACAJ,CAAAA,sBAAAA,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBK,GAAAA,AAAG,MAAA,QAAnBL,wBAAAA,KAAAA,IAAAA,sBAAuB,GACvBA,CAAAA,yBAAAA,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBM,MAAAA,AAAM,MAAA,QAAtBN,2BAAAA,KAAAA,IAAAA,yBAA0B;YAE9B;YACA,OAAA,WAAA,GAAO,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA;QACT,OAAO;gBACsCV;YAA3C,MAAM,IAAI3D,MAAM,CAAC,wBAAwB,EAAA,CAAE2D,6BAAAA,oBAAoBrG,IAAI,CAAC,EAAA,AAAE,MAAA,QAA3BqG,+BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,2BAA6BnD,IAAI,EAAE;QAChF;IACF,KAEDG,YAAYoB,OAAO,IAAIP,cAAc4B;AAG5C,GAAG;AACH5D,iBAAiBoF,WAAW,GAAG;AAC/BpF,iBAAiBqF,YAAY,GAAG;IAC9BxB,cAAc;AAChB"}
1
+ {"version":3,"sources":["../src/components/DeclarativeChart/DeclarativeChart.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport * as React from 'react';\nimport type { Data, PlotData, PlotlySchema, OutputChartType, TraceInfo } from '@fluentui/chart-utilities';\nimport {\n decodeBase64Fields,\n isArrayOrTypedArray,\n isMonthArray,\n mapFluentChart,\n sanitizeJson,\n} from '@fluentui/chart-utilities';\nimport type { GridProperties } from './PlotlySchemaAdapter';\nimport { tokens } from '@fluentui/react-theme';\nimport { ThemeContext_unstable as V9ThemeContext } from '@fluentui/react-shared-contexts';\nimport { Theme, webLightTheme } from '@fluentui/tokens';\nimport * as d3Color from 'd3-color';\n\nimport {\n correctYearMonth,\n getGridProperties,\n isNonPlotType,\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToVSBCProps,\n transformPlotlyJsonToAreaChartProps,\n transformPlotlyJsonToLineChartProps,\n transformPlotlyJsonToHorizontalBarWithAxisProps,\n transformPlotlyJsonToHeatmapProps,\n transformPlotlyJsonToSankeyProps,\n transformPlotlyJsonToGaugeProps,\n transformPlotlyJsonToGVBCProps,\n transformPlotlyJsonToVBCProps,\n transformPlotlyJsonToChartTableProps,\n transformPlotlyJsonToScatterChartProps,\n projectPolarToCartesian,\n getAllupLegendsProps,\n NON_PLOT_KEY_PREFIX,\n SINGLE_REPEAT,\n} from './PlotlySchemaAdapter';\nimport type { ColorwayType } from './PlotlyColorAdapter';\nimport { DonutChart } from '../DonutChart/index';\nimport { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';\nimport { LineChart } from '../LineChart/index';\nimport { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';\nimport { AreaChart } from '../AreaChart/index';\nimport { HeatMapChart } from '../HeatMapChart/index';\nimport { SankeyChart } from '../SankeyChart/SankeyChart';\nimport { GaugeChart } from '../GaugeChart/index';\nimport { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\nimport { Chart, ImageExportOptions } from '../../types/index';\nimport { ScatterChart } from '../ScatterChart/index';\n\nimport { withResponsiveContainer } from '../ResponsiveContainer/withResponsiveContainer';\nimport { ChartTable } from '../ChartTable/index';\nimport { LegendsProps, Legends } from '../Legends/index';\nimport { JSXElement } from '@fluentui/react-utilities/src/index';\n\nconst ResponsiveDonutChart = withResponsiveContainer(DonutChart);\nconst ResponsiveVerticalStackedBarChart = withResponsiveContainer(VerticalStackedBarChart);\nconst ResponsiveLineChart = withResponsiveContainer(LineChart);\nconst ResponsiveHorizontalBarChartWithAxis = withResponsiveContainer(HorizontalBarChartWithAxis);\nconst ResponsiveAreaChart = withResponsiveContainer(AreaChart);\nconst ResponsiveHeatMapChart = withResponsiveContainer(HeatMapChart);\nconst ResponsiveSankeyChart = withResponsiveContainer(SankeyChart);\nconst ResponsiveGaugeChart = withResponsiveContainer(GaugeChart);\nconst ResponsiveGroupedVerticalBarChart = withResponsiveContainer(GroupedVerticalBarChart);\nconst ResponsiveVerticalBarChart = withResponsiveContainer(VerticalBarChart);\nconst ResponsiveScatterChart = withResponsiveContainer(ScatterChart);\nconst ResponsiveChartTable = withResponsiveContainer(ChartTable);\n\n// Default x-axis key for grouping traces. Also applicable for PieData and SankeyData where x-axis is not defined.\nconst DEFAULT_XAXIS = 'x';\nconst FALLBACK_TYPE = 'fallback';\n\n/**\n * DeclarativeChart schema.\n * {@docCategory DeclarativeChart}\n */\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n plotlySchema: any;\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n\n /**\n * Optional callback to access the IDeclarativeChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDeclarativeChart>;\n\n /**\n * Optional prop to specify the colorway type of the chart.\n * - 'default': Use Fluent UI color palette aligning with plotly colorway.\n * - 'builtin': Use Fluent UI colorway.\n * - 'others': Reserved for future colorways.\n * @default 'default'\n */\n colorwayType?: ColorwayType;\n}\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface IDeclarativeChart {\n exportAsImage: (opts?: ImageExportOptions) => Promise<string>;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\nfunction renderChart<TProps>(\n Renderer: React.ComponentType<TProps>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transformer: (...args: any[]) => TProps,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transformerArgs: any[],\n commonProps: Partial<TProps>,\n cellRow: number,\n cellColumn: number,\n): JSXElement {\n const chartProps = transformer(...transformerArgs);\n return (\n <div\n key={`${cellRow}_${cellColumn}`}\n style={{\n gridRowStart: cellRow,\n gridRowEnd: cellRow + 1,\n gridColumnStart: cellColumn,\n gridColumnEnd: cellColumn + 1,\n }}\n >\n <Renderer {...chartProps} {...commonProps} />\n </div>\n );\n}\n\ntype PreTransformHooks = {\n preTransformCondition?: (plotlySchema: PlotlySchema) => boolean;\n preTransformOperation?: (plotlySchema: PlotlySchema) => PlotlySchema;\n};\n\nconst LineAreaPreTransformOp = (plotlyInput: PlotlySchema) => {\n const xValues = (plotlyInput.data[0] as PlotData).x;\n const isXMonth = isMonthArray(xValues);\n let renderData = plotlyInput.data;\n if (isXMonth) {\n renderData = plotlyInput.data.map((dataPoint: PlotData) => ({\n ...dataPoint,\n x: correctYearMonth(dataPoint.x),\n }));\n }\n return { data: renderData, layout: plotlyInput.layout };\n};\n\ntype ChartTypeMap = {\n donut: {\n transformer: typeof transformPlotlyJsonToDonutProps;\n renderer: typeof ResponsiveDonutChart;\n } & PreTransformHooks;\n sankey: {\n transformer: typeof transformPlotlyJsonToSankeyProps;\n renderer: typeof ResponsiveSankeyChart;\n } & PreTransformHooks;\n table: {\n transformer: typeof transformPlotlyJsonToChartTableProps;\n renderer: typeof ResponsiveChartTable;\n } & PreTransformHooks;\n horizontalbar: {\n transformer: typeof transformPlotlyJsonToHorizontalBarWithAxisProps;\n renderer: typeof ResponsiveHorizontalBarChartWithAxis;\n } & PreTransformHooks;\n groupedverticalbar: {\n transformer: typeof transformPlotlyJsonToGVBCProps;\n renderer: typeof ResponsiveGroupedVerticalBarChart;\n } & PreTransformHooks;\n verticalstackedbar: {\n transformer: typeof transformPlotlyJsonToVSBCProps;\n renderer: typeof ResponsiveVerticalStackedBarChart;\n } & PreTransformHooks;\n heatmap: {\n transformer: typeof transformPlotlyJsonToHeatmapProps;\n renderer: typeof ResponsiveHeatMapChart;\n } & PreTransformHooks;\n gauge: {\n transformer: typeof transformPlotlyJsonToGaugeProps;\n renderer: typeof ResponsiveGaugeChart;\n } & PreTransformHooks;\n verticalbar: {\n transformer: typeof transformPlotlyJsonToVBCProps;\n renderer: typeof ResponsiveVerticalBarChart;\n } & PreTransformHooks;\n area: {\n transformer: typeof transformPlotlyJsonToAreaChartProps;\n renderer: typeof ResponsiveAreaChart;\n } & PreTransformHooks;\n line: {\n transformer: typeof transformPlotlyJsonToLineChartProps;\n renderer: typeof ResponsiveLineChart;\n } & PreTransformHooks;\n scatter: {\n transformer: typeof transformPlotlyJsonToScatterChartProps;\n renderer: typeof ResponsiveScatterChart;\n } & PreTransformHooks;\n fallback: {\n transformer: typeof transformPlotlyJsonToVSBCProps;\n renderer: typeof ResponsiveVerticalStackedBarChart;\n } & PreTransformHooks;\n};\n\nconst chartMap: ChartTypeMap = {\n // PieData category charts\n donut: {\n transformer: transformPlotlyJsonToDonutProps,\n renderer: ResponsiveDonutChart,\n },\n // SankeyData category charts\n sankey: {\n transformer: transformPlotlyJsonToSankeyProps,\n renderer: ResponsiveSankeyChart,\n },\n // TableData category charts\n table: {\n transformer: transformPlotlyJsonToChartTableProps,\n renderer: ResponsiveChartTable,\n },\n // PlotData category charts\n horizontalbar: {\n transformer: transformPlotlyJsonToHorizontalBarWithAxisProps,\n renderer: ResponsiveHorizontalBarChartWithAxis,\n },\n groupedverticalbar: {\n transformer: transformPlotlyJsonToGVBCProps,\n renderer: ResponsiveGroupedVerticalBarChart,\n },\n verticalstackedbar: {\n transformer: transformPlotlyJsonToVSBCProps,\n renderer: ResponsiveVerticalStackedBarChart,\n },\n heatmap: {\n transformer: transformPlotlyJsonToHeatmapProps,\n renderer: ResponsiveHeatMapChart,\n },\n gauge: {\n transformer: transformPlotlyJsonToGaugeProps,\n renderer: ResponsiveGaugeChart,\n },\n verticalbar: {\n transformer: transformPlotlyJsonToVBCProps,\n renderer: ResponsiveVerticalBarChart,\n },\n area: {\n transformer: transformPlotlyJsonToAreaChartProps,\n renderer: ResponsiveAreaChart,\n preTransformOperation: LineAreaPreTransformOp,\n },\n line: {\n transformer: transformPlotlyJsonToLineChartProps,\n renderer: ResponsiveLineChart,\n preTransformOperation: LineAreaPreTransformOp,\n },\n scatter: {\n transformer: transformPlotlyJsonToScatterChartProps,\n renderer: ResponsiveScatterChart,\n preTransformOperation: LineAreaPreTransformOp,\n },\n fallback: {\n transformer: transformPlotlyJsonToVSBCProps,\n renderer: ResponsiveVerticalStackedBarChart,\n },\n};\n\nconst useIsDarkTheme = (): boolean => {\n const parentV9Theme = React.useContext(V9ThemeContext) as Theme;\n const v9Theme: Theme = parentV9Theme ? parentV9Theme : webLightTheme;\n\n // Get background and foreground colors\n const backgroundColor = d3Color.hsl(v9Theme.colorNeutralBackground1);\n const foregroundColor = d3Color.hsl(v9Theme.colorNeutralForeground1);\n\n const isDarkTheme = backgroundColor.l < foregroundColor.l;\n\n return isDarkTheme;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n const chart: OutputChartType = mapFluentChart(plotlySchema);\n if (!chart.isValid) {\n throw new Error(`Invalid chart schema: ${chart.errorMessage}`);\n }\n let plotlyInput = plotlySchema as PlotlySchema;\n try {\n plotlyInput = decodeBase64Fields(plotlyInput);\n } catch (error) {\n throw new Error(`Failed to decode plotly schema: ${error}`);\n }\n const plotlyInputWithValidData: PlotlySchema = {\n ...plotlyInput,\n data: chart.validTracesInfo!.map(trace => plotlyInput.data[trace.index]),\n };\n\n const validTracesFilteredIndex: TraceInfo[] = chart.validTracesInfo!.map((trace, index) => ({\n index,\n type: trace.type,\n }));\n\n let { selectedLegends } = plotlySchema;\n const colorMap = useColorMapping();\n const isDarkTheme = useIsDarkTheme();\n const chartRef = React.useRef<Chart>(null);\n const isMultiPlot = React.useRef(false);\n\n if (!isArrayOrTypedArray(selectedLegends)) {\n selectedLegends = [];\n }\n\n const [activeLegends, setActiveLegends] = React.useState<string[]>(selectedLegends);\n const onActiveLegendsChange = (keys: string[]) => {\n setActiveLegends(keys);\n if (props.onSchemaChange) {\n props.onSchemaChange({ plotlySchema: { plotlyInput, selectedLegends: keys } });\n }\n };\n\n React.useEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { plotlySchema } = sanitizeJson(props.chartSchema);\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const { selectedLegends } = plotlySchema;\n setActiveLegends(selectedLegends ?? []);\n }, [props.chartSchema]);\n\n const multiSelectLegendProps = {\n canSelectMultipleLegends: true,\n onChange: onActiveLegendsChange,\n selectedLegends: activeLegends,\n };\n\n const commonProps = {\n legendProps: multiSelectLegendProps,\n componentRef: chartRef,\n };\n\n function createLegends(legendProps: LegendsProps): JSXElement {\n // eslint-disable-next-line react/jsx-no-bind\n return <Legends {...legendProps} selectedLegends={activeLegends} onChange={onActiveLegendsChange} />;\n }\n\n // TODO\n const exportAsImage = React.useCallback((opts?: ImageExportOptions): Promise<string> => {\n return new Promise((resolve, reject) => {\n if (isMultiPlot.current) {\n return reject(Error('Exporting multi plot charts as image is not supported'));\n }\n if (!chartRef.current || typeof chartRef.current.toImage !== 'function') {\n return reject(Error('Chart cannot be exported as image'));\n }\n\n chartRef.current\n .toImage({\n background: tokens.colorNeutralBackground1,\n scale: 5,\n ...opts,\n })\n .then(resolve)\n .catch(reject);\n });\n }, []);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n exportAsImage,\n }),\n [exportAsImage],\n );\n\n if (chart.type === 'scatterpolar') {\n const cartesianProjection = projectPolarToCartesian(plotlyInputWithValidData);\n plotlyInputWithValidData.data = cartesianProjection.data;\n plotlyInputWithValidData.layout = cartesianProjection.layout;\n validTracesFilteredIndex.forEach((trace, index) => {\n if (trace.type === 'scatterpolar') {\n const mode = (plotlyInputWithValidData.data[index] as PlotData)?.mode ?? '';\n if (mode.includes('line')) {\n validTracesFilteredIndex[index].type = 'line';\n } else if (mode.includes('markers') || mode === 'text') {\n validTracesFilteredIndex[index].type = 'scatter';\n } else {\n validTracesFilteredIndex[index].type = 'line';\n }\n }\n });\n }\n const groupedTraces: Record<string, number[]> = {};\n let nonCartesianTraceCount = 0;\n plotlyInputWithValidData.data.forEach((trace: Data, index: number) => {\n let traceKey = '';\n if (isNonPlotType(chart.validTracesInfo![index].type)) {\n traceKey = `${NON_PLOT_KEY_PREFIX}${nonCartesianTraceCount + 1}`;\n nonCartesianTraceCount++;\n } else {\n traceKey = (trace as PlotData).xaxis ?? DEFAULT_XAXIS;\n }\n if (!groupedTraces[traceKey]) {\n groupedTraces[traceKey] = [];\n }\n groupedTraces[traceKey].push(index);\n });\n\n isMultiPlot.current = Object.keys(groupedTraces).length > 1;\n const gridProperties: GridProperties = getGridProperties(\n plotlyInputWithValidData,\n isMultiPlot.current,\n chart.validTracesInfo!,\n );\n\n // Render only one plot if the grid properties cannot determine positioning of multiple plots.\n if (\n isMultiPlot.current &&\n gridProperties.templateRows === SINGLE_REPEAT &&\n gridProperties.templateColumns === SINGLE_REPEAT\n ) {\n Object.keys(groupedTraces).forEach((key, index) => {\n if (index > 0) {\n delete groupedTraces[key];\n }\n });\n isMultiPlot.current = false;\n }\n\n const allupLegendsProps = getAllupLegendsProps(\n plotlyInputWithValidData,\n colorMap,\n props.colorwayType,\n chart.validTracesInfo!,\n isDarkTheme,\n );\n\n type ChartType = keyof ChartTypeMap;\n // map through the grouped traces and render the appropriate chart\n return (\n <>\n <div\n style={{\n display: 'grid',\n gridTemplateRows: gridProperties.templateRows,\n gridTemplateColumns: gridProperties.templateColumns,\n }}\n >\n {Object.entries(groupedTraces).map(([xAxisKey, index]) => {\n const plotlyInputForGroup: PlotlySchema = {\n ...plotlyInputWithValidData,\n data: index.map(idx => plotlyInputWithValidData.data[idx]),\n };\n\n const filteredTracesInfo = validTracesFilteredIndex.filter(trace => index.includes(trace.index));\n let chartType =\n validTracesFilteredIndex.some(trace => trace.type === FALLBACK_TYPE) || chart.type === FALLBACK_TYPE\n ? FALLBACK_TYPE\n : filteredTracesInfo[0].type;\n\n if (\n validTracesFilteredIndex.some(trace => trace.type === 'line') &&\n validTracesFilteredIndex.some(trace => trace.type === 'scatter')\n ) {\n chartType = 'line';\n }\n\n const chartEntry = chartMap[chartType as ChartType];\n if (chartEntry) {\n const { transformer, renderer, preTransformCondition, preTransformOperation } = chartEntry;\n if (preTransformCondition === undefined || preTransformCondition(plotlyInputForGroup)) {\n const transformedInput = preTransformOperation\n ? preTransformOperation(plotlyInputForGroup)\n : plotlyInputForGroup;\n const cellProperties = gridProperties.layout[xAxisKey];\n\n return renderChart<ReturnType<typeof transformer>>(\n renderer,\n transformer,\n [transformedInput, isMultiPlot.current, colorMap, props.colorwayType, isDarkTheme],\n {\n ...commonProps,\n xAxisAnnotation: cellProperties?.xAnnotation,\n yAxisAnnotation: cellProperties?.yAnnotation,\n },\n cellProperties?.row ?? 1,\n cellProperties?.column ?? 1,\n );\n }\n return <></>;\n } else {\n throw new Error(`Unsupported chart type :${plotlyInputForGroup.data[0]?.type}`);\n }\n })}\n </div>\n {isMultiPlot.current && createLegends(allupLegendsProps)}\n </>\n );\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\nDeclarativeChart.defaultProps = {\n colorwayType: 'default',\n};\n"],"names":["React","decodeBase64Fields","isArrayOrTypedArray","isMonthArray","mapFluentChart","sanitizeJson","tokens","ThemeContext_unstable","V9ThemeContext","webLightTheme","d3Color","correctYearMonth","getGridProperties","isNonPlotType","transformPlotlyJsonToDonutProps","transformPlotlyJsonToVSBCProps","transformPlotlyJsonToAreaChartProps","transformPlotlyJsonToLineChartProps","transformPlotlyJsonToHorizontalBarWithAxisProps","transformPlotlyJsonToHeatmapProps","transformPlotlyJsonToSankeyProps","transformPlotlyJsonToGaugeProps","transformPlotlyJsonToGVBCProps","transformPlotlyJsonToVBCProps","transformPlotlyJsonToChartTableProps","transformPlotlyJsonToScatterChartProps","projectPolarToCartesian","getAllupLegendsProps","NON_PLOT_KEY_PREFIX","SINGLE_REPEAT","DonutChart","VerticalStackedBarChart","LineChart","HorizontalBarChartWithAxis","AreaChart","HeatMapChart","SankeyChart","GaugeChart","GroupedVerticalBarChart","VerticalBarChart","ScatterChart","withResponsiveContainer","ChartTable","Legends","ResponsiveDonutChart","ResponsiveVerticalStackedBarChart","ResponsiveLineChart","ResponsiveHorizontalBarChartWithAxis","ResponsiveAreaChart","ResponsiveHeatMapChart","ResponsiveSankeyChart","ResponsiveGaugeChart","ResponsiveGroupedVerticalBarChart","ResponsiveVerticalBarChart","ResponsiveScatterChart","ResponsiveChartTable","DEFAULT_XAXIS","FALLBACK_TYPE","useColorMapping","colorMap","useRef","Map","renderChart","Renderer","transformer","transformerArgs","commonProps","cellRow","cellColumn","chartProps","div","key","style","gridRowStart","gridRowEnd","gridColumnStart","gridColumnEnd","LineAreaPreTransformOp","plotlyInput","xValues","data","x","isXMonth","renderData","map","dataPoint","layout","chartMap","donut","renderer","sankey","table","horizontalbar","groupedverticalbar","verticalstackedbar","heatmap","gauge","verticalbar","area","preTransformOperation","line","scatter","fallback","useIsDarkTheme","parentV9Theme","useContext","v9Theme","backgroundColor","hsl","colorNeutralBackground1","foregroundColor","colorNeutralForeground1","isDarkTheme","l","DeclarativeChart","forwardRef","props","forwardedRef","plotlySchema","chartSchema","chart","isValid","Error","errorMessage","error","plotlyInputWithValidData","validTracesInfo","trace","index","validTracesFilteredIndex","type","selectedLegends","chartRef","isMultiPlot","activeLegends","setActiveLegends","useState","onActiveLegendsChange","keys","onSchemaChange","useEffect","multiSelectLegendProps","canSelectMultipleLegends","onChange","legendProps","componentRef","createLegends","exportAsImage","useCallback","opts","Promise","resolve","reject","current","toImage","background","scale","then","catch","useImperativeHandle","cartesianProjection","forEach","mode","includes","groupedTraces","nonCartesianTraceCount","traceKey","xaxis","push","Object","length","gridProperties","templateRows","templateColumns","allupLegendsProps","colorwayType","display","gridTemplateRows","gridTemplateColumns","entries","xAxisKey","plotlyInputForGroup","idx","filteredTracesInfo","filter","chartType","some","chartEntry","preTransformCondition","undefined","transformedInput","cellProperties","xAxisAnnotation","xAnnotation","yAxisAnnotation","yAnnotation","row","column","displayName","defaultProps"],"mappings":"AAAA,uDAAuD,GACvD,YAAYA;;;;;;;eAiTCkH;;;;iEAjTU,QAAQ;gCAQxB,4BAA4B;4BAEZ,wBAAwB;qCACS,kCAAkC;wBACrD,mBAAmB;mEAC/B,WAAW;qCAsB7B,wBAAwB;uBAEJ,sBAAsB;wBACT,mCAAmC;wBACjD,qBAAqB;wBACJ,sCAAsC;wBACvD,qBAAqB;wBAClB,wBAAwB;6BACzB,6BAA6B;wBAC9B,sBAAsB;wBACT,mCAAmC;wBAC1C,4BAA4B;wBAEhC,wBAAwB;yCAEb,iDAAiD;yBAC9D,sBAAsB;yBACX,mBAAmB;AAGzD,MAAMtE,2BAAuBH,gDAAAA,EAAwBX,iBAAAA;AACrD,MAAMe,wCAAoCJ,gDAAAA,EAAwBV,+BAAAA;AAClE,MAAMe,0BAAsBL,gDAAAA,EAAwBT,iBAAAA;AACpD,MAAMe,uCAAuCN,oDAAAA,EAAwBR,kCAAAA;AACrE,MAAMe,0BAAsBP,gDAAAA,EAAwBP,iBAAAA;AACpD,MAAMe,6BAAyBR,gDAAAA,EAAwBN,oBAAAA;AACvD,MAAMe,4BAAwBT,gDAAAA,EAAwBL,wBAAAA;AACtD,MAAMe,2BAAuBV,gDAAAA,EAAwBJ,kBAAAA;AACrD,MAAMe,wCAAoCX,gDAAAA,EAAwBH,+BAAAA;AAClE,MAAMe,iCAA6BZ,gDAAAA,EAAwBF,wBAAAA;AA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AAiBoF,WAAW,GAAG;AAC/BpF,iBAAiBqF,YAAY,GAAG;IAC9BxB,cAAc;AAChB"}
@@ -674,7 +674,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
674
674
  ...series.type === 'scatterpolar' ? {
675
675
  originXOffset: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.__polarOriginX,
676
676
  direction: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_polar = _input_layout1.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction,
677
- rotation: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout2.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation
677
+ rotation: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout2.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation,
678
+ axisLabel: series.__axisLabel ? series.__axisLabel : {}
678
679
  } : {}
679
680
  },
680
681
  useSecondaryYScale: usesSecondaryYScale(series, input.layout)
@@ -1196,7 +1197,7 @@ const projectPolarToCartesian = (input)=>{
1196
1197
  const projection = {
1197
1198
  ...input
1198
1199
  };
1199
- // 1. Find the global min and max radius across all series
1200
+ // Find the global min and max radius across all series
1200
1201
  let minRadius = 0;
1201
1202
  let maxRadius = 0;
1202
1203
  for(let sindex = 0; sindex < input.data.length; sindex++){
@@ -1210,18 +1211,26 @@ const projectPolarToCartesian = (input)=>{
1210
1211
  }
1211
1212
  }
1212
1213
  }
1213
- // 2. If there are negative radii, compute the shift
1214
+ // If there are negative radii, compute the shift
1214
1215
  const radiusShift = minRadius < 0 ? -minRadius : 0;
1215
- // 3. Project all points and create a perfect square domain
1216
+ // Collect all unique theta values from all scatterpolar series for equal spacing
1217
+ const allThetaValues = new Set();
1218
+ for(let sindex = 0; sindex < input.data.length; sindex++){
1219
+ const series = input.data[sindex];
1220
+ if (series.theta && (0, _chartutilities.isArrayOrTypedArray)(series.theta)) {
1221
+ series.theta.forEach((theta)=>allThetaValues.add(String(theta)));
1222
+ }
1223
+ }
1224
+ // Project all points and create a perfect square domain
1216
1225
  const allX = [];
1217
1226
  const allY = [];
1218
1227
  let originX = null;
1219
1228
  for(let sindex = 0; sindex < input.data.length; sindex++){
1220
1229
  var _input_layout_polar_angularaxis, _input_layout_polar, _input_layout2, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout3;
1221
1230
  const series = input.data[sindex];
1222
- // If scatterpolar, set text to theta values as strings
1223
- if (series.type === 'scatterpolar' && Array.isArray(series.theta)) {
1224
- series.text = series.theta.map((v)=>String(v));
1231
+ // If scatterpolar, set __axisLabel to all unique theta values for equal spacing
1232
+ if ((0, _chartutilities.isArrayOrTypedArray)(series.theta)) {
1233
+ series.__axisLabel = Array.from(allThetaValues);
1225
1234
  }
1226
1235
  series.x = [];
1227
1236
  series.y = [];
@@ -1247,7 +1256,7 @@ const projectPolarToCartesian = (input)=>{
1247
1256
  if ((0, _chartutilities.isInvalidValue)(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || (0, _chartutilities.isInvalidValue)(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
1248
1257
  continue;
1249
1258
  }
1250
- // 4. Map theta to angle in radians
1259
+ // Map theta to angle in radians
1251
1260
  let thetaRad;
1252
1261
  if (categorical) {
1253
1262
  const idx = uniqueTheta.indexOf(thetas[ptindex]);
@@ -1256,10 +1265,10 @@ const projectPolarToCartesian = (input)=>{
1256
1265
  } else {
1257
1266
  thetaRad = startAngleInRad + dirMultiplier * (thetas[ptindex] * Math.PI / 180);
1258
1267
  }
1259
- // 5. Shift only the polar origin (not the cartesian)
1268
+ // Shift only the polar origin (not the cartesian)
1260
1269
  const rawRadius = rVals[ptindex];
1261
1270
  const polarRadius = rawRadius + radiusShift; // Only for projection
1262
- // 6. Calculate cartesian coordinates (with shifted polar origin)
1271
+ // Calculate cartesian coordinates (with shifted polar origin)
1263
1272
  const x = polarRadius * Math.cos(thetaRad);
1264
1273
  const y = polarRadius * Math.sin(thetaRad);
1265
1274
  // Calculate the cartesian coordinates of the original polar origin (0,0)