@fluentui/react-charts 9.3.12 → 9.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/dist/index.d.ts +859 -0
  3. package/lib/VegaDeclarativeChart.js +1 -0
  4. package/lib/VegaDeclarativeChart.js.map +1 -0
  5. package/lib/components/LineChart/LineChart.js +47 -7
  6. package/lib/components/LineChart/LineChart.js.map +1 -1
  7. package/lib/components/ScatterChart/ScatterChart.js +12 -12
  8. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  9. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js +405 -0
  10. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +1 -0
  11. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +20 -0
  12. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +1 -0
  13. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +415 -0
  14. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +1 -0
  15. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +537 -0
  16. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +1 -0
  17. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +3279 -0
  18. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +1 -0
  19. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js +28 -0
  20. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js.map +1 -0
  21. package/lib/components/VegaDeclarativeChart/index.js +1 -0
  22. package/lib/components/VegaDeclarativeChart/index.js.map +1 -0
  23. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +5 -2
  24. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  25. package/lib/index.js +1 -0
  26. package/lib/index.js.map +1 -1
  27. package/lib/utilities/utilities.js +41 -0
  28. package/lib/utilities/utilities.js.map +1 -1
  29. package/lib-commonjs/VegaDeclarativeChart.js +6 -0
  30. package/lib-commonjs/VegaDeclarativeChart.js.map +1 -0
  31. package/lib-commonjs/components/LineChart/LineChart.js +46 -6
  32. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  33. package/lib-commonjs/components/ScatterChart/ScatterChart.js +11 -11
  34. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  35. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js +274 -0
  36. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +1 -0
  37. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +35 -0
  38. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +1 -0
  39. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +412 -0
  40. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +1 -0
  41. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +533 -0
  42. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +1 -0
  43. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +3214 -0
  44. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +1 -0
  45. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js +31 -0
  46. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js.map +1 -0
  47. package/lib-commonjs/components/VegaDeclarativeChart/index.js +6 -0
  48. package/lib-commonjs/components/VegaDeclarativeChart/index.js.map +1 -0
  49. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +4 -1
  50. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  51. package/lib-commonjs/index.js +1 -0
  52. package/lib-commonjs/index.js.map +1 -1
  53. package/lib-commonjs/utilities/utilities.js +33 -0
  54. package/lib-commonjs/utilities/utilities.js.map +1 -1
  55. package/package.json +3 -3
@@ -299,16 +299,16 @@ const ScatterChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
299
299
  const seriesId = `${_seriesId}_${i}_${j}`;
300
300
  const circleId = `${_circleId}_${i}_${j}`;
301
301
  const pointMarkerSize = _points[i].data[j].markerSize;
302
- const minPixel = 4;
303
- const maxPixel = 16;
304
- let circleRadius = activePoint === circleId ? 6 : 4;
305
- if (pointMarkerSize) {
306
- if (isContinuousXY && maxMarkerSize !== 0) {
307
- circleRadius = pointMarkerSize * extraMaxPixels / maxMarkerSize;
308
- } else if (!isContinuousXY && maxMarkerSize !== minMarkerSize) {
309
- circleRadius = minPixel + (pointMarkerSize - minMarkerSize) / (maxMarkerSize - minMarkerSize) * (maxPixel - minPixel);
310
- }
311
- }
302
+ const circleRadius = (0, _index1.calculateMarkerRadius)({
303
+ pointMarkerSize,
304
+ minMarkerSize,
305
+ maxMarkerSize,
306
+ extraMaxPixels,
307
+ isContinuousXY,
308
+ isActive: activePoint === circleId,
309
+ defaultRadius: 4,
310
+ activeRadius: 6
311
+ });
312
312
  const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
313
313
  const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
314
314
  const text = _points === null || _points === void 0 ? void 0 : (_points_i_data_j = _points[i].data[j]) === null || _points_i_data_j === void 0 ? void 0 : _points_i_data_j.text;
@@ -316,7 +316,7 @@ const ScatterChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
316
316
  pointsForSeries.push(/*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("circle", {
317
317
  id: circleId,
318
318
  key: circleId,
319
- r: Math.max(circleRadius, 4),
319
+ r: circleRadius,
320
320
  cx: xPoint + _xBandwidth,
321
321
  cy: yPoint,
322
322
  "data-is-focusable": isLegendSelected,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ScatterChart/ScatterChart.tsx"],"sourcesContent":["'use client';\n\nimport * 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 getDomainPaddingForMarkers,\n domainRangeOfXStringAxis,\n findNumericMinMaxOfY,\n IDomainNRange,\n YAxisType,\n isTextMode,\n isScatterPolarSeries,\n isPlottable,\n getRangeForScatterMarkerSize,\n domainRangeOfDateForAreaLineScatterVerticalBarCharts,\n domainRangeOfNumericForAreaLineScatterCharts,\n sortAxisCategories,\n findCalloutPoints,\n} from '../../utilities/index';\nimport {\n AccessibilityProps,\n CartesianChart,\n ChildProps,\n CustomizedCalloutData,\n Margins,\n RefArrayData,\n ScatterChartDataPoint,\n ScatterChartPoints,\n YValueHover,\n} from '../../index';\nimport { tokens } from '@fluentui/react-theme';\nimport {\n calloutData,\n ChartTypes,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n getColorFromToken,\n} from '../../utilities/index';\nimport { LineChartPoints } from '../../types/DataPoint';\nimport { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';\nimport { formatDateToLocaleString } from '@fluentui/chart-utilities';\nimport { useImageExport } from '../../utilities/hooks';\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 _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 _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, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);\n const classes = useScatterChartStyles(props);\n\n const [hoverXValue, setHoverXValue] = React.useState<string | number>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [yValueHover, setYValueHover] = React.useState<YValueHover[]>([]);\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 [dataPointCalloutProps, setDataPointCalloutProps] = 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 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 // Detect y axis type (numeric or string)\n const _yAxisType: YAxisType =\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 ? typeof props.data.scatterChartData[0].data[0].y === 'string'\n ? YAxisType.StringAxis\n : YAxisType.NumericAxis\n : YAxisType.NumericAxis;\n\n const pointsRef = React.useRef<ScatterChartDataWithIndex[] | []>([]);\n const calloutPointsRef = React.useRef<Record<string, YValueHover[]>>({});\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 const { startValue, endValue } = findNumericMinMaxOfY(points, yAxisType);\n const yPadding = getDomainPaddingForMarkers(startValue, endValue, props.yScaleType);\n\n return {\n startValue: startValue - yPadding.start,\n endValue: endValue + yPadding.end,\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 ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForAreaLineScatterCharts(\n points,\n margins,\n width,\n isRTL,\n props.xScaleType,\n true,\n props.xMinValue,\n props.xMaxValue,\n );\n } else if (xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = domainRangeOfDateForAreaLineScatterVerticalBarCharts(\n points,\n margins,\n width,\n isRTL,\n tickValues! as Date[],\n chartType,\n );\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 _getOrderedYAxisLabels() {\n const shouldOrderYAxisLabelsByCategoryOrder =\n _yAxisType === YAxisType.StringAxis && props.yAxisCategoryOrder !== 'default';\n if (!shouldOrderYAxisLabelsByCategoryOrder) {\n // Collect all unique string y values from all data points in all series, in reverse order\n const yLabelsSet = new Set<string>();\n for (let i = _points.length - 1; i >= 0; i--) {\n const point = _points[i];\n if (point.data && Array.isArray(point.data)) {\n for (const d of point.data) {\n if (typeof d.y === 'string') {\n yLabelsSet.add(d.y);\n }\n }\n }\n }\n return Array.from(yLabelsSet);\n }\n\n return sortAxisCategories(_mapCategoryToValues(), props.yAxisCategoryOrder);\n }\n\n function _mapCategoryToValues() {\n const categoryToValues: Record<string, number[]> = {};\n _points.forEach(point => {\n if (point.data && Array.isArray(point.data)) {\n point.data.forEach(d => {\n if (typeof d.y === 'string') {\n if (!categoryToValues[d.y]) {\n categoryToValues[d.y] = [];\n }\n if (typeof d.x === 'number') {\n categoryToValues[d.y].push(d.x);\n }\n }\n });\n }\n });\n return categoryToValues;\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 _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 if (_xAxisType === XAxisTypes.StringAxis) {\n _xBandwidth = _xAxisScale.bandwidth() / 2;\n }\n\n const minMarkerSize =\n d3Min(_points, (point: ScatterChartPoints) => {\n return d3Min(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.markerSize as number;\n });\n }) ?? 0;\n const maxMarkerSize =\n d3Max(_points, (point: ScatterChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.markerSize as number;\n });\n }) ?? 0;\n const isContinuousXY = _xAxisType !== XAxisTypes.StringAxis && _yAxisType !== YAxisType.StringAxis;\n const extraMaxPixels = isContinuousXY\n ? getRangeForScatterMarkerSize({\n data: _points,\n xScale: _xAxisScale,\n yScalePrimary: _yAxisScale,\n xScaleType: props.xScaleType,\n yScaleType: props.yScaleType,\n })\n : 0;\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 { x, y, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points?.[i]?.data[j];\n const xPoint = _xAxisScale?.(x);\n // Use string y axis scale if needed\n const yPoint =\n _yAxisType === YAxisType.StringAxis\n ? _yAxisScale?.(y) + (_yAxisScale?.bandwidth ? _yAxisScale.bandwidth() / 2 : 0)\n : _yAxisScale?.(y);\n if (!isPlottable(xPoint, yPoint)) {\n continue;\n }\n const seriesId = `${_seriesId}_${i}_${j}`;\n const circleId = `${_circleId}_${i}_${j}`;\n const pointMarkerSize = (_points[i].data[j] as ScatterChartDataPoint).markerSize;\n const minPixel = 4;\n const maxPixel = 16;\n let circleRadius = activePoint === circleId ? 6 : 4;\n\n if (pointMarkerSize) {\n if (isContinuousXY && maxMarkerSize !== 0) {\n circleRadius = (pointMarkerSize * extraMaxPixels) / maxMarkerSize;\n } else if (!isContinuousXY && maxMarkerSize !== minMarkerSize) {\n circleRadius =\n minPixel + ((pointMarkerSize - minMarkerSize) / (maxMarkerSize - minMarkerSize)) * (maxPixel - minPixel);\n }\n }\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={xPoint + _xBandwidth}\n cy={yPoint}\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={xPoint + _xBandwidth}\n y={yPoint + 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,\n yAxisScale: _yAxisScale,\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 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 ? formatDateToLocaleString(x, props.culture, props.useUTC as boolean) : x;\n const found = findCalloutPoints(calloutPointsRef.current, x) as CustomizedCalloutData | undefined;\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 setDataPointCalloutProps(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,\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 ? formatDateToLocaleString(x, props.culture, props.useUTC as boolean) : x;\n const found = findCalloutPoints(calloutPointsRef.current, x) as CustomizedCalloutData | undefined;\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 setDataPointCalloutProps(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 function _getCustomizedCallout() {\n return props.onRenderCalloutPerStack\n ? props.onRenderCalloutPerStack(stackCalloutProps)\n : props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps)\n : null;\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 =\n point.x instanceof Date ? formatDateToLocaleString(point.x, props.culture, props.useUTC as boolean) : 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 { 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 calloutPointsRef.current = 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: 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,\n isCartesian: true,\n customCallout: {\n customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout()! : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n },\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 // Compute unique y axis labels for string y axis\n const _yAxisLabels: string[] = _getOrderedYAxisLabels();\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 yAxisType={_yAxisType}\n // Pass stringDatasetForYAxisDomain only if y axis is string\n {...(_yAxisType === YAxisType.StringAxis ? { stringDatasetForYAxisDomain: _yAxisLabels } : {})}\n getMinMaxOfYAxis={_getNumericMinMaxOfY}\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","getDomainPaddingForMarkers","domainRangeOfXStringAxis","findNumericMinMaxOfY","YAxisType","isTextMode","isScatterPolarSeries","isPlottable","getRangeForScatterMarkerSize","domainRangeOfDateForAreaLineScatterVerticalBarCharts","domainRangeOfNumericForAreaLineScatterCharts","sortAxisCategories","findCalloutPoints","CartesianChart","tokens","calloutData","ChartTypes","XAxisTypes","getTypeOfAxis","getNextColor","getColorFromToken","renderScatterPolarCategoryLabels","formatDateToLocaleString","useImageExport","ScatterChart","forwardRef","props","forwardedRef","_circleId","_seriesId","_verticalLine","_firstRenderOptimization","_emptyChartId","_points","_injectIndexPropertyInScatterChartData","data","scatterChartData","_xAxisScale","_yAxisScale","_uniqueCallOutID","_refArray","margins","renderSeries","_xAxisLabels","xAxisCalloutAccessibilityData","_xBandwidth","cartesianChartRef","legendsRef","_legendsRef","componentRef","hideLegend","classes","hoverXValue","setHoverXValue","useState","activeLegend","setActiveLegend","yValueHover","setYValueHover","selectedLegendPoints","setSelectedLegendPoints","isSelectedLegend","setIsSelectedLegend","activePoint","setActivePoint","stackCalloutProps","setStackCalloutProps","dataPointCalloutProps","setDataPointCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","selectedLegends","setSelectedLegends","legendProps","prevSelectedLegendsRef","useRef","undefined","_isTextMode","_isScatterPolarRef","useEffect","current","_xAxisType","length","StringAxis","_yAxisType","NumericAxis","pointsRef","calloutPointsRef","height","width","map","item","index","color","updatePosition","newX","newY","threshold","distance","Math","sqrt","pow","_getNumericMinMaxOfY","points","yAxisType","startValue","endValue","yPadding","yScaleType","start","end","_getDomainNRangeValues","chartType","isRTL","xAxisType","barWidth","tickValues","domainNRangeValue","xScaleType","xMinValue","xMaxValue","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","_getOrderedYAxisLabels","shouldOrderYAxisLabelsByCategoryOrder","yAxisCategoryOrder","yLabelsSet","Set","i","Array","isArray","d","add","from","_mapCategoryToValues","categoryToValues","legendsSelected","event","currentLegend","slice","_getPointFill","seriesColor","pointId","pointIndex","isLastPoint","colorNeutralBackground1","series","bandwidth","minMarkerSize","markerSize","maxMarkerSize","isContinuousXY","extraMaxPixels","yScalePrimary","pointsForSeries","legendVal","verticaLineHeight","bottom","j","xAxisCalloutData","xPoint","yPoint","seriesId","circleId","pointMarkerSize","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","targetRect","target","getBoundingClientRect","left","top","formattedData","Date","culture","useUTC","found","attr","obj","values","lineHeight","mouseEvent","persist","clientX","clientY","func","onClick","_getCustomizedCallout","onRenderCalloutPerStack","onRenderCalloutPerDataPoint","_getHighlightedLegend","includes","seriesIndex","formattedDate","xValue","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_isChartEmpty","filter","tickFormat","legendBars","calloutProps","YValueHover","descriptionMessage","getCalloutDescriptionMessage","isCalloutForStack","isCartesian","customCallout","customizedCallout","customCalloutProps","calloutPropsPerDataPoint","tickParams","xAxisLabels","dp","flat","_yAxisLabels","chartTitle","getmargins","getGraphData","stringDatasetForYAxisDomain","getMinMaxOfYAxis","getDomainNRangeValues","createYAxis","onChartMouseLeave","enableFirstRenderOptimization","datasetForXAxisDomain","yMaxValue","yMinValue","children","line","x1","y1","x2","y2","visibility","strokeDasharray","div","style","displayName"],"mappings":"AAAA;;;;;+BA+DaoC;;;;;;;iEA7DU,QAAQ;6CAEO,iCAAiC;6BAEpC,eAAe;uBAClB,mBAAmB;yBACR,WAAW;gCAChC,4BAA4B;wBAmB3C,wBAAwB;wBAWxB,cAAc;4BACE,wBAAwB;mCAUE,qCAAqC;gCAC7C,4BAA4B;uBACtC,wBAAwB;AAWhD,qBAAMA,WAAAA,GAA2DpC,OAAMqC,UAAU,CAGtF,CAACC,OAAOC;QAgC+DD,oBAanEA;IA5CJ,MAAME,YAAoB/B,yBAAAA,EAAM;IAChC,MAAMgC,gBAAoBhC,qBAAAA,EAAM;IAChC,MAAMiC,oBAAwBjC,qBAAAA,EAAM;IACpC,MAAMkC,2BAA2B;IACjC,MAAMC,oBAAwBnC,qBAAAA,EAAM;IACpC,IAAIoC,UAAuCC,uCAAuCR,MAAMS,IAAI,CAACC,gBAAgB;IAC7G,8DAA8D;IAC9D,IAAIC,cAAmB;IACvB,8DAA8D;IAC9D,IAAIC,cAAmB;IACvB,IAAIC,mBAAk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AAG;YAAE8N,WAAW;YAAGC,WAAW,CAAC;QAAE,IAAI,CAAC,CAAC;QACtE,oCAAoC,GACpC,kDAAkD;QAClDC,UAAU,CAAC1R;YACTW,cAAcX,MAAMuG,MAAM;YAC1B3F,cAAcZ,MAAMwK,aAAa;YACjC,OAAA,WAAA,GACE,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,MAAA,WAAA,GACE,OAAA,aAAA,CAACkD,KAAAA,MAAAA,WAAAA,GACC,OAAA,aAAA,CAACiE,QAAAA;gBACCC,IAAI;gBACJC,IAAI;gBACJC,IAAI;gBACJC,IAAI/R,MAAMyG,eAAe;gBACzBuG,QAAQ;gBACRlB,IAAI1L;gBACJ4R,YAAY;gBACZC,iBAAiB;8BAEnB,OAAA,aAAA,CAACvE,KAAAA,MAAG1M;QAIZ;uBAGF,OAAA,aAAA,CAACkR,OAAAA;QAAIpG,IAAIxL;QAAe2M,MAAM;QAASkF,OAAO;YAAErF,SAAS;QAAI;QAAGI,cAAY;;AAEhF,GAAG;AACHpN,aAAasS,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/ScatterChart/ScatterChart.tsx"],"sourcesContent":["'use client';\n\nimport * 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 getDomainPaddingForMarkers,\n domainRangeOfXStringAxis,\n findNumericMinMaxOfY,\n IDomainNRange,\n YAxisType,\n isTextMode,\n isScatterPolarSeries,\n isPlottable,\n getRangeForScatterMarkerSize,\n calculateMarkerRadius,\n domainRangeOfDateForAreaLineScatterVerticalBarCharts,\n domainRangeOfNumericForAreaLineScatterCharts,\n sortAxisCategories,\n findCalloutPoints,\n} from '../../utilities/index';\nimport {\n AccessibilityProps,\n CartesianChart,\n ChildProps,\n CustomizedCalloutData,\n Margins,\n RefArrayData,\n ScatterChartDataPoint,\n ScatterChartPoints,\n YValueHover,\n} from '../../index';\nimport { tokens } from '@fluentui/react-theme';\nimport {\n calloutData,\n ChartTypes,\n XAxisTypes,\n getTypeOfAxis,\n getNextColor,\n getColorFromToken,\n} from '../../utilities/index';\nimport { LineChartPoints } from '../../types/DataPoint';\nimport { renderScatterPolarCategoryLabels } from '../../utilities/scatterpolar-utils';\nimport { formatDateToLocaleString } from '@fluentui/chart-utilities';\nimport { useImageExport } from '../../utilities/hooks';\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 _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 _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, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);\n const classes = useScatterChartStyles(props);\n\n const [hoverXValue, setHoverXValue] = React.useState<string | number>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [yValueHover, setYValueHover] = React.useState<YValueHover[]>([]);\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 [dataPointCalloutProps, setDataPointCalloutProps] = 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 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 // Detect y axis type (numeric or string)\n const _yAxisType: YAxisType =\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 ? typeof props.data.scatterChartData[0].data[0].y === 'string'\n ? YAxisType.StringAxis\n : YAxisType.NumericAxis\n : YAxisType.NumericAxis;\n\n const pointsRef = React.useRef<ScatterChartDataWithIndex[] | []>([]);\n const calloutPointsRef = React.useRef<Record<string, YValueHover[]>>({});\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 const { startValue, endValue } = findNumericMinMaxOfY(points, yAxisType);\n const yPadding = getDomainPaddingForMarkers(startValue, endValue, props.yScaleType);\n\n return {\n startValue: startValue - yPadding.start,\n endValue: endValue + yPadding.end,\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 ) {\n let domainNRangeValue: IDomainNRange;\n if (xAxisType === XAxisTypes.NumericAxis) {\n domainNRangeValue = domainRangeOfNumericForAreaLineScatterCharts(\n points,\n margins,\n width,\n isRTL,\n props.xScaleType,\n true,\n props.xMinValue,\n props.xMaxValue,\n );\n } else if (xAxisType === XAxisTypes.DateAxis) {\n domainNRangeValue = domainRangeOfDateForAreaLineScatterVerticalBarCharts(\n points,\n margins,\n width,\n isRTL,\n tickValues! as Date[],\n chartType,\n );\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 _getOrderedYAxisLabels() {\n const shouldOrderYAxisLabelsByCategoryOrder =\n _yAxisType === YAxisType.StringAxis && props.yAxisCategoryOrder !== 'default';\n if (!shouldOrderYAxisLabelsByCategoryOrder) {\n // Collect all unique string y values from all data points in all series, in reverse order\n const yLabelsSet = new Set<string>();\n for (let i = _points.length - 1; i >= 0; i--) {\n const point = _points[i];\n if (point.data && Array.isArray(point.data)) {\n for (const d of point.data) {\n if (typeof d.y === 'string') {\n yLabelsSet.add(d.y);\n }\n }\n }\n }\n return Array.from(yLabelsSet);\n }\n\n return sortAxisCategories(_mapCategoryToValues(), props.yAxisCategoryOrder);\n }\n\n function _mapCategoryToValues() {\n const categoryToValues: Record<string, number[]> = {};\n _points.forEach(point => {\n if (point.data && Array.isArray(point.data)) {\n point.data.forEach(d => {\n if (typeof d.y === 'string') {\n if (!categoryToValues[d.y]) {\n categoryToValues[d.y] = [];\n }\n if (typeof d.x === 'number') {\n categoryToValues[d.y].push(d.x);\n }\n }\n });\n }\n });\n return categoryToValues;\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 _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 if (_xAxisType === XAxisTypes.StringAxis) {\n _xBandwidth = _xAxisScale.bandwidth() / 2;\n }\n\n const minMarkerSize =\n d3Min(_points, (point: ScatterChartPoints) => {\n return d3Min(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.markerSize as number;\n });\n }) ?? 0;\n const maxMarkerSize =\n d3Max(_points, (point: ScatterChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.markerSize as number;\n });\n }) ?? 0;\n const isContinuousXY = _xAxisType !== XAxisTypes.StringAxis && _yAxisType !== YAxisType.StringAxis;\n const extraMaxPixels = isContinuousXY\n ? getRangeForScatterMarkerSize({\n data: _points,\n xScale: _xAxisScale,\n yScalePrimary: _yAxisScale,\n xScaleType: props.xScaleType,\n yScaleType: props.yScaleType,\n })\n : 0;\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 { x, y, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points?.[i]?.data[j];\n const xPoint = _xAxisScale?.(x);\n // Use string y axis scale if needed\n const yPoint =\n _yAxisType === YAxisType.StringAxis\n ? _yAxisScale?.(y) + (_yAxisScale?.bandwidth ? _yAxisScale.bandwidth() / 2 : 0)\n : _yAxisScale?.(y);\n if (!isPlottable(xPoint, yPoint)) {\n continue;\n }\n const seriesId = `${_seriesId}_${i}_${j}`;\n const circleId = `${_circleId}_${i}_${j}`;\n const pointMarkerSize = (_points[i].data[j] as ScatterChartDataPoint).markerSize;\n const circleRadius = calculateMarkerRadius({\n pointMarkerSize,\n minMarkerSize,\n maxMarkerSize,\n extraMaxPixels,\n isContinuousXY,\n isActive: activePoint === circleId,\n defaultRadius: 4,\n activeRadius: 6,\n });\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={circleRadius}\n cx={xPoint + _xBandwidth}\n cy={yPoint}\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={xPoint + _xBandwidth}\n y={yPoint + 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,\n yAxisScale: _yAxisScale,\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 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 ? formatDateToLocaleString(x, props.culture, props.useUTC as boolean) : x;\n const found = findCalloutPoints(calloutPointsRef.current, x) as CustomizedCalloutData | undefined;\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 setDataPointCalloutProps(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,\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 ? formatDateToLocaleString(x, props.culture, props.useUTC as boolean) : x;\n const found = findCalloutPoints(calloutPointsRef.current, x) as CustomizedCalloutData | undefined;\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 setDataPointCalloutProps(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 function _getCustomizedCallout() {\n return props.onRenderCalloutPerStack\n ? props.onRenderCalloutPerStack(stackCalloutProps)\n : props.onRenderCalloutPerDataPoint\n ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps)\n : null;\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 =\n point.x instanceof Date ? formatDateToLocaleString(point.x, props.culture, props.useUTC as boolean) : 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 { 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 calloutPointsRef.current = 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: 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,\n isCartesian: true,\n customCallout: {\n customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout()! : undefined,\n customCalloutProps: props.calloutPropsPerDataPoint\n ? props.calloutPropsPerDataPoint(dataPointCalloutProps!)\n : undefined,\n },\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 // Compute unique y axis labels for string y axis\n const _yAxisLabels: string[] = _getOrderedYAxisLabels();\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 yAxisType={_yAxisType}\n // Pass stringDatasetForYAxisDomain only if y axis is string\n {...(_yAxisType === YAxisType.StringAxis ? { stringDatasetForYAxisDomain: _yAxisLabels } : {})}\n getMinMaxOfYAxis={_getNumericMinMaxOfY}\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","getDomainPaddingForMarkers","domainRangeOfXStringAxis","findNumericMinMaxOfY","YAxisType","isTextMode","isScatterPolarSeries","isPlottable","getRangeForScatterMarkerSize","calculateMarkerRadius","domainRangeOfDateForAreaLineScatterVerticalBarCharts","domainRangeOfNumericForAreaLineScatterCharts","sortAxisCategories","findCalloutPoints","CartesianChart","tokens","calloutData","ChartTypes","XAxisTypes","getTypeOfAxis","getNextColor","getColorFromToken","renderScatterPolarCategoryLabels","formatDateToLocaleString","useImageExport","ScatterChart","forwardRef","props","forwardedRef","_circleId","_seriesId","_verticalLine","_firstRenderOptimization","_emptyChartId","_points","_injectIndexPropertyInScatterChartData","data","scatterChartData","_xAxisScale","_yAxisScale","_uniqueCallOutID","_refArray","margins","renderSeries","_xAxisLabels","xAxisCalloutAccessibilityData","_xBandwidth","cartesianChartRef","legendsRef","_legendsRef","componentRef","hideLegend","classes","hoverXValue","setHoverXValue","useState","activeLegend","setActiveLegend","yValueHover","setYValueHover","selectedLegendPoints","setSelectedLegendPoints","isSelectedLegend","setIsSelectedLegend","activePoint","setActivePoint","stackCalloutProps","setStackCalloutProps","dataPointCalloutProps","setDataPointCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","selectedLegends","setSelectedLegends","legendProps","prevSelectedLegendsRef","useRef","undefined","_isTextMode","_isScatterPolarRef","useEffect","current","_xAxisType","length","StringAxis","_yAxisType","NumericAxis","pointsRef","calloutPointsRef","height","width","map","item","index","color","updatePosition","newX","newY","threshold","distance","Math","sqrt","pow","_getNumericMinMaxOfY","points","yAxisType","startValue","endValue","yPadding","yScaleType","start","end","_getDomainNRangeValues","chartType","isRTL","xAxisType","barWidth","tickValues","domainNRangeValue","xScaleType","xMinValue","xMaxValue","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","_getOrderedYAxisLabels","shouldOrderYAxisLabelsByCategoryOrder","yAxisCategoryOrder","yLabelsSet","Set","i","Array","isArray","d","add","from","_mapCategoryToValues","categoryToValues","legendsSelected","event","currentLegend","slice","_getPointFill","seriesColor","pointId","pointIndex","isLastPoint","colorNeutralBackground1","series","bandwidth","minMarkerSize","markerSize","maxMarkerSize","isContinuousXY","extraMaxPixels","yScalePrimary","pointsForSeries","legendVal","verticaLineHeight","bottom","j","xAxisCalloutData","xPoint","yPoint","seriesId","circleId","pointMarkerSize","circleRadius","isActive","defaultRadius","activeRadius","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","targetRect","target","getBoundingClientRect","left","top","formattedData","Date","culture","useUTC","found","attr","obj","values","lineHeight","mouseEvent","persist","clientX","clientY","func","onClick","_getCustomizedCallout","onRenderCalloutPerStack","onRenderCalloutPerDataPoint","_getHighlightedLegend","includes","seriesIndex","formattedDate","xValue","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_isChartEmpty","filter","tickFormat","legendBars","calloutProps","YValueHover","descriptionMessage","getCalloutDescriptionMessage","isCalloutForStack","isCartesian","customCallout","customizedCallout","customCalloutProps","calloutPropsPerDataPoint","tickParams","xAxisLabels","dp","flat","_yAxisLabels","chartTitle","getmargins","getGraphData","stringDatasetForYAxisDomain","getMinMaxOfYAxis","getDomainNRangeValues","createYAxis","onChartMouseLeave","enableFirstRenderOptimization","datasetForXAxisDomain","yMaxValue","yMinValue","children","line","x1","y1","x2","y2","visibility","strokeDasharray","div","style","displayName"],"mappings":"AAAA;;;;;+BAgEaqC;;;;;;;iEA9DU,QAAQ;6CAEO,iCAAiC;6BAEpC,eAAe;uBAClB,mBAAmB;yBACR,WAAW;gCAChC,4BAA4B;wBAoB3C,wBAAwB;wBAWxB,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AG;YAAEqN,6BAA6BJ;QAAa,IAAI,CAAC,CAAC;QAC7FK,kBAAkBnM;QAClBoM,uBAAuB3L;QACvB4L,aAAajT,0BAAAA;QACbC,mBAAmBA,yBAAAA;QACnBiT,mBAAmBxJ;QACnByJ,+BAA+BlR;QAC/BmR,uBAAuBvQ;QACvBM,cAAcH;QACb,GAAIoC,mBAAmBE,OAAO,GAAG;YAAE+N,WAAW;YAAGC,WAAW,CAAC;QAAE,IAAI,CAAC,CAAC;QACtE,oCAAoC,GACpC,kDAAkD;QAClDC,UAAU,CAAC3R;YACTW,cAAcX,MAAMuG,MAAM;YAC1B3F,cAAcZ,MAAMwK,aAAa;YACjC,OAAA,WAAA,GACE,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,MAAA,WAAA,GACE,OAAA,aAAA,CAACmD,KAAAA,MAAAA,WAAAA,GACC,OAAA,aAAA,CAACiE,QAAAA;gBACCC,IAAI;gBACJC,IAAI;gBACJC,IAAI;gBACJC,IAAIhS,MAAMyG,eAAe;gBACzBwG,QAAQ;gBACRlB,IAAI3L;gBACJ6R,YAAY;gBACZC,iBAAiB;8BAEnB,OAAA,aAAA,CAACvE,KAAAA,MAAG3M;QAIZ;uBAGF,OAAA,aAAA,CAACmR,OAAAA;QAAIpG,IAAIzL;QAAe4M,MAAM;QAASkF,OAAO;YAAErF,SAAS;QAAI;QAAGI,cAAY;;AAEhF,GAAG;AACHrN,aAAauS,WAAW,GAAG"}
@@ -0,0 +1,274 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "VegaDeclarativeChart", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return VegaDeclarativeChart;
10
+ }
11
+ });
12
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
+ const _VegaLiteSchemaAdapter = require("./VegaLiteSchemaAdapter");
15
+ const _index = require("../Legends/index");
16
+ const _withResponsiveContainer = require("../ResponsiveContainer/withResponsiveContainer");
17
+ const _index1 = require("../LineChart/index");
18
+ const _index2 = require("../VerticalBarChart/index");
19
+ const _index3 = require("../VerticalStackedBarChart/index");
20
+ const _index4 = require("../GroupedVerticalBarChart/index");
21
+ const _index5 = require("../HorizontalBarChartWithAxis/index");
22
+ const _index6 = require("../AreaChart/index");
23
+ const _index7 = require("../ScatterChart/index");
24
+ const _index8 = require("../DonutChart/index");
25
+ const _index9 = require("../HeatMapChart/index");
26
+ const _index10 = require("../PolarChart/index");
27
+ const _VegaDeclarativeChartHooks = require("./VegaDeclarativeChartHooks");
28
+ /**
29
+ * Maximum allowed nesting depth for incoming JSON specs.
30
+ * Matches the Plotly adapter's MAX_DEPTH to prevent stack overflow / memory exhaustion.
31
+ */ const MAX_DEPTH = 15;
32
+ /**
33
+ * Validates that a JSON value does not exceed the maximum nesting depth.
34
+ * Throws if the depth limit is exceeded (same behavior as Plotly's sanitizeJson).
35
+ */ function validateJsonDepth(value, depth = 0) {
36
+ if (depth > MAX_DEPTH) {
37
+ throw new Error('VegaDeclarativeChart: Maximum JSON depth exceeded');
38
+ }
39
+ if (value !== null && typeof value === 'object') {
40
+ for (const key of Object.keys(value)){
41
+ validateJsonDepth(value[key], depth + 1);
42
+ }
43
+ }
44
+ }
45
+ /**
46
+ * Check if spec is a horizontal concatenation
47
+ */ function isHConcatSpec(spec) {
48
+ return !!spec.hconcat && Array.isArray(spec.hconcat) && spec.hconcat.length > 0;
49
+ }
50
+ /**
51
+ * Check if spec is a vertical concatenation
52
+ */ function isVConcatSpec(spec) {
53
+ return !!spec.vconcat && Array.isArray(spec.vconcat) && spec.vconcat.length > 0;
54
+ }
55
+ /**
56
+ * Get grid properties for concat specs
57
+ */ function getVegaConcatGridProperties(spec) {
58
+ if (isHConcatSpec(spec)) {
59
+ return {
60
+ templateRows: 'auto',
61
+ templateColumns: `repeat(${spec.hconcat.length}, 1fr)`,
62
+ isHorizontal: true,
63
+ specs: spec.hconcat
64
+ };
65
+ }
66
+ if (isVConcatSpec(spec)) {
67
+ return {
68
+ templateRows: `repeat(${spec.vconcat.length}, auto)`,
69
+ templateColumns: '1fr',
70
+ isHorizontal: false,
71
+ specs: spec.vconcat
72
+ };
73
+ }
74
+ return {
75
+ templateRows: '1fr',
76
+ templateColumns: '1fr',
77
+ isHorizontal: false,
78
+ specs: [
79
+ spec
80
+ ]
81
+ };
82
+ }
83
+ const ResponsiveLineChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index1.LineChart);
84
+ const ResponsiveVerticalBarChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index2.VerticalBarChart);
85
+ const ResponsiveVerticalStackedBarChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index3.VerticalStackedBarChart);
86
+ const ResponsiveGroupedVerticalBarChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index4.GroupedVerticalBarChart);
87
+ const ResponsiveHorizontalBarChartWithAxis = (0, _withResponsiveContainer.withResponsiveContainer)(_index5.HorizontalBarChartWithAxis);
88
+ const ResponsiveAreaChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index6.AreaChart);
89
+ const ResponsiveScatterChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index7.ScatterChart);
90
+ const ResponsiveDonutChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index8.DonutChart);
91
+ const ResponsiveHeatMapChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index9.HeatMapChart);
92
+ const ResponsivePolarChart = (0, _withResponsiveContainer.withResponsiveContainer)(_index10.PolarChart);
93
+ const vegaChartMap = {
94
+ line: {
95
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToLineChartProps,
96
+ renderer: ResponsiveLineChart
97
+ },
98
+ bar: {
99
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToVerticalBarChartProps,
100
+ renderer: ResponsiveVerticalBarChart
101
+ },
102
+ 'stacked-bar': {
103
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToVerticalStackedBarChartProps,
104
+ renderer: ResponsiveVerticalStackedBarChart
105
+ },
106
+ 'grouped-bar': {
107
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToGroupedVerticalBarChartProps,
108
+ renderer: ResponsiveGroupedVerticalBarChart
109
+ },
110
+ 'horizontal-bar': {
111
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToHorizontalBarChartProps,
112
+ renderer: ResponsiveHorizontalBarChartWithAxis
113
+ },
114
+ area: {
115
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToAreaChartProps,
116
+ renderer: ResponsiveAreaChart
117
+ },
118
+ scatter: {
119
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToScatterChartProps,
120
+ renderer: ResponsiveScatterChart
121
+ },
122
+ donut: {
123
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToDonutChartProps,
124
+ renderer: ResponsiveDonutChart
125
+ },
126
+ heatmap: {
127
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToHeatMapChartProps,
128
+ renderer: ResponsiveHeatMapChart
129
+ },
130
+ histogram: {
131
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToHistogramProps,
132
+ renderer: ResponsiveVerticalBarChart
133
+ },
134
+ polar: {
135
+ transformer: _VegaLiteSchemaAdapter.transformVegaLiteToPolarChartProps,
136
+ renderer: ResponsivePolarChart
137
+ }
138
+ };
139
+ /**
140
+ * Renders a single Vega-Lite chart spec
141
+ */ function renderSingleChart(spec, colorMap, isDarkTheme, interactiveCommonProps) {
142
+ const chartType = (0, _VegaLiteSchemaAdapter.getChartType)(spec);
143
+ const chartConfig = vegaChartMap[chartType.type];
144
+ if (!chartConfig) {
145
+ throw new Error(`VegaDeclarativeChart: Unsupported chart type '${chartType.type}'`);
146
+ }
147
+ const { transformer, renderer: ChartRenderer } = chartConfig;
148
+ const chartProps = transformer(spec, colorMap, isDarkTheme);
149
+ // For hconcat/vconcat sub-charts, hide per-chart legends (shared legend rendered separately)
150
+ if (spec._hideLegend) {
151
+ chartProps.hideLegend = true;
152
+ }
153
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
+ return /*#__PURE__*/ _react.createElement(ChartRenderer, {
155
+ ...chartProps,
156
+ ...interactiveCommonProps
157
+ });
158
+ }
159
+ const VegaDeclarativeChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
160
+ const { vegaLiteSpec, selectedLegends = [] } = props.chartSchema;
161
+ if (!vegaLiteSpec) {
162
+ throw new Error('VegaDeclarativeChart: vegaLiteSpec is required in chartSchema');
163
+ }
164
+ // Guard against excessively deep JSON specs that could cause stack overflow / memory exhaustion
165
+ validateJsonDepth(vegaLiteSpec);
166
+ const colorMap = (0, _VegaDeclarativeChartHooks.useColorMapping)();
167
+ const isDarkTheme = (0, _VegaDeclarativeChartHooks.useIsDarkTheme)();
168
+ const chartRef = _react.useRef(null);
169
+ const [activeLegends, setActiveLegends] = _react.useState(selectedLegends);
170
+ const onActiveLegendsChange = (keys)=>{
171
+ setActiveLegends(keys);
172
+ if (props.onSchemaChange) {
173
+ props.onSchemaChange({
174
+ vegaLiteSpec,
175
+ selectedLegends: keys
176
+ });
177
+ }
178
+ };
179
+ _react.useEffect(()=>{
180
+ var _props_chartSchema_selectedLegends;
181
+ setActiveLegends((_props_chartSchema_selectedLegends = props.chartSchema.selectedLegends) !== null && _props_chartSchema_selectedLegends !== void 0 ? _props_chartSchema_selectedLegends : []);
182
+ }, [
183
+ props.chartSchema.selectedLegends
184
+ ]);
185
+ const multiSelectLegendProps = {
186
+ canSelectMultipleLegends: true,
187
+ onChange: onActiveLegendsChange,
188
+ selectedLegends: activeLegends
189
+ };
190
+ const interactiveCommonProps = {
191
+ componentRef: chartRef,
192
+ legendProps: multiSelectLegendProps
193
+ };
194
+ try {
195
+ // Check if this is a concat spec (multiple charts side-by-side or stacked)
196
+ if (isHConcatSpec(vegaLiteSpec) || isVConcatSpec(vegaLiteSpec)) {
197
+ const gridProps = getVegaConcatGridProperties(vegaLiteSpec);
198
+ // Build shared legend from the first sub-chart's color encoding
199
+ const firstSubSpec = {
200
+ ...gridProps.specs[0],
201
+ data: gridProps.specs[0].data || vegaLiteSpec.data,
202
+ encoding: {
203
+ ...vegaLiteSpec.encoding || {},
204
+ ...gridProps.specs[0].encoding || {}
205
+ }
206
+ };
207
+ const sharedLegendProps = (0, _VegaLiteSchemaAdapter.getVegaLiteLegendsProps)(firstSubSpec, colorMap, isDarkTheme);
208
+ return /*#__PURE__*/ _react.createElement("div", {
209
+ ref: forwardedRef,
210
+ className: props.className,
211
+ style: props.style
212
+ }, /*#__PURE__*/ _react.createElement("div", {
213
+ style: {
214
+ display: 'grid',
215
+ gridTemplateRows: gridProps.templateRows,
216
+ gridTemplateColumns: gridProps.templateColumns,
217
+ gap: '16px'
218
+ }
219
+ }, gridProps.specs.map((subSpec, index)=>{
220
+ // Compute default height for sub-charts
221
+ const defaultSubHeight = typeof vegaLiteSpec.height === 'number' ? vegaLiteSpec.height : typeof subSpec.height === 'number' ? subSpec.height : 300;
222
+ const mergedSpec = {
223
+ ...subSpec,
224
+ data: subSpec.data || vegaLiteSpec.data,
225
+ encoding: {
226
+ ...vegaLiteSpec.encoding || {},
227
+ ...subSpec.encoding || {}
228
+ },
229
+ height: typeof subSpec.height === 'number' ? subSpec.height : defaultSubHeight,
230
+ // Hide legends on ALL sub-charts — shared legend is rendered below
231
+ _hideLegend: true
232
+ };
233
+ const cellRow = gridProps.isHorizontal ? 1 : index + 1;
234
+ const cellColumn = gridProps.isHorizontal ? index + 1 : 1;
235
+ return /*#__PURE__*/ _react.createElement("div", {
236
+ key: `chart_${index}`,
237
+ style: {
238
+ gridRowStart: cellRow,
239
+ gridRowEnd: cellRow + 1,
240
+ gridColumnStart: cellColumn,
241
+ gridColumnEnd: cellColumn + 1,
242
+ minWidth: 0
243
+ }
244
+ }, renderSingleChart(mergedSpec, colorMap, isDarkTheme, interactiveCommonProps));
245
+ })), sharedLegendProps.legends.length > 0 && /*#__PURE__*/ _react.createElement(_index.Legends, {
246
+ ...sharedLegendProps,
247
+ ...multiSelectLegendProps
248
+ }));
249
+ }
250
+ // Check if this is a layered spec (composite chart)
251
+ if (vegaLiteSpec.layer && vegaLiteSpec.layer.length > 1) {
252
+ // Check if it's a supported bar+line combo
253
+ const marks = vegaLiteSpec.layer.map((layer)=>(0, _VegaLiteSchemaAdapter.getMarkType)(layer.mark));
254
+ const hasBar = marks.includes('bar');
255
+ const hasLine = marks.includes('line') || marks.includes('point');
256
+ const isBarLineCombo = hasBar && hasLine;
257
+ // Only warn for unsupported layered specs
258
+ if (!isBarLineCombo) {
259
+ // Layered specifications with multiple chart types are not fully supported.
260
+ // Only the first layer will be rendered.
261
+ }
262
+ }
263
+ // Render single chart
264
+ const chartComponent = renderSingleChart(vegaLiteSpec, colorMap, isDarkTheme, interactiveCommonProps);
265
+ return /*#__PURE__*/ _react.createElement("div", {
266
+ ref: forwardedRef,
267
+ className: props.className,
268
+ style: props.style
269
+ }, chartComponent);
270
+ } catch (error) {
271
+ throw new Error(`Failed to transform Vega-Lite spec: ${error}`);
272
+ }
273
+ });
274
+ VegaDeclarativeChart.displayName = 'VegaDeclarativeChart';