@fluentui/react-charts 9.0.0 → 9.0.2

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 (79) hide show
  1. package/CHANGELOG.md +33 -2
  2. package/dist/index.d.ts +463 -36
  3. package/lib/GaugeChart.js +1 -0
  4. package/lib/GaugeChart.js.map +1 -0
  5. package/lib/GroupedVerticalBarChart.js +1 -0
  6. package/lib/GroupedVerticalBarChart.js.map +1 -0
  7. package/lib/ScatterChart.js +1 -0
  8. package/lib/ScatterChart.js.map +1 -0
  9. package/lib/components/GaugeChart/GaugeChart.js +589 -0
  10. package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
  11. package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
  12. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
  13. package/lib/components/GaugeChart/index.js +3 -0
  14. package/lib/components/GaugeChart/index.js.map +1 -0
  15. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +174 -0
  16. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
  17. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +492 -0
  18. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
  19. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
  20. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
  21. package/lib/components/GroupedVerticalBarChart/index.js +3 -0
  22. package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
  23. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +90 -0
  24. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
  25. package/lib/components/Legends/Legends.types.js.map +1 -1
  26. package/lib/components/LineChart/LineChart.js.map +1 -1
  27. package/lib/components/ScatterChart/ScatterChart.js +478 -0
  28. package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
  29. package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
  30. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
  31. package/lib/components/ScatterChart/index.js +3 -0
  32. package/lib/components/ScatterChart/index.js.map +1 -0
  33. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +65 -0
  34. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
  35. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  36. package/lib/index.js +3 -0
  37. package/lib/index.js.map +1 -1
  38. package/lib/types/DataPoint.js.map +1 -1
  39. package/lib/utilities/utilities.js +123 -5
  40. package/lib/utilities/utilities.js.map +1 -1
  41. package/lib-commonjs/GaugeChart.js +6 -0
  42. package/lib-commonjs/GaugeChart.js.map +1 -0
  43. package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
  44. package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
  45. package/lib-commonjs/ScatterChart.js +6 -0
  46. package/lib-commonjs/ScatterChart.js.map +1 -0
  47. package/lib-commonjs/components/GaugeChart/GaugeChart.js +618 -0
  48. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
  49. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
  50. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
  51. package/lib-commonjs/components/GaugeChart/index.js +8 -0
  52. package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
  53. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +252 -0
  54. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
  55. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +498 -0
  56. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
  57. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
  58. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
  59. package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
  60. package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
  61. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +139 -0
  62. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
  63. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  64. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  65. package/lib-commonjs/components/ScatterChart/ScatterChart.js +484 -0
  66. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
  67. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
  68. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
  69. package/lib-commonjs/components/ScatterChart/index.js +8 -0
  70. package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
  71. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +96 -0
  72. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
  73. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  74. package/lib-commonjs/index.js +3 -0
  75. package/lib-commonjs/index.js.map +1 -1
  76. package/lib-commonjs/types/DataPoint.js.map +1 -1
  77. package/lib-commonjs/utilities/utilities.js +115 -5
  78. package/lib-commonjs/utilities/utilities.js.map +1 -1
  79. package/package.json +9 -9
@@ -0,0 +1,478 @@
1
+ import * as React from 'react';
2
+ import { useScatterChartStyles_unstable } from './useScatterChartStyles.styles';
3
+ import { select as d3Select } from 'd3-selection';
4
+ import { Legends } from '../Legends/index';
5
+ import { max as d3Max, min as d3Min } from 'd3-array';
6
+ import { useId } from '@fluentui/react-utilities';
7
+ import { find } from '../../utilities/index';
8
+ import { CartesianChart } from '../../index';
9
+ import { tokens } from '@fluentui/react-theme';
10
+ import { calloutData, ChartTypes, XAxisTypes, tooltipOfXAxislabels, getTypeOfAxis, getNextColor, getColorFromToken, formatDate } from '../../utilities/index';
11
+ // Create a ScatterChart variant which uses these default styles and this styled subcomponent.
12
+ /**
13
+ * ScatterChart component
14
+ * {@docCategory ScatterChart}
15
+ */ export const ScatterChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
16
+ const _circleId = useId('circle');
17
+ const _seriesId = useId('seriesID');
18
+ const _verticalLine = useId('verticalLine');
19
+ const _tooltipId = useId('ScatterChartTooltipId_');
20
+ const _firstRenderOptimization = true;
21
+ const _emptyChartId = useId('_ScatterChart_empty');
22
+ let _points = _injectIndexPropertyInScatterChartData(props.data.lineChartData);
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ let _calloutPoints = calloutData(_points) || [];
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ let _xAxisScale = '';
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ let _yAxisScale = '';
29
+ let _uniqueCallOutID = '';
30
+ let _refArray = [];
31
+ let margins;
32
+ let renderSeries;
33
+ let _xAxisLabels = [];
34
+ let xAxisCalloutAccessibilityData = {};
35
+ let _xBandwidth = 0;
36
+ const [hoverXValue, setHoverXValue] = React.useState('');
37
+ const [activeLegend, setActiveLegend] = React.useState('');
38
+ const [YValueHover, setYValueHover] = React.useState([]);
39
+ const [selectedLegend, setSelectedLegend] = React.useState('');
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ const [selectedLegendPoints, setSelectedLegendPoints] = React.useState([]);
42
+ const [isSelectedLegend, setIsSelectedLegend] = React.useState(false);
43
+ const [activePoint, setActivePoint] = React.useState('');
44
+ const [stackCalloutProps, setStackCalloutProps] = React.useState();
45
+ const [clickPosition, setClickPosition] = React.useState({
46
+ x: 0,
47
+ y: 0
48
+ });
49
+ const [isPopoverOpen, setPopoverOpen] = React.useState(false);
50
+ const _xAxisType = props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData[0].data && props.data.lineChartData[0].data.length > 0 ? getTypeOfAxis(props.data.lineChartData[0].data[0].x, true) : XAxisTypes.StringAxis;
51
+ const pointsRef = React.useRef([]);
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ const calloutPointsRef = React.useRef([]);
54
+ React.useEffect(()=>{
55
+ /** note that height and width are not used to resize or set as dimesions of the chart,
56
+ * fitParentContainer is responisble for setting the height and width or resizing of the svg/chart
57
+ */ if (_points !== _injectIndexPropertyInScatterChartData(props.data.lineChartData) || props.data !== _points) {
58
+ pointsRef.current = _injectIndexPropertyInScatterChartData(props.data.lineChartData);
59
+ calloutPointsRef.current = calloutData(pointsRef.current);
60
+ }
61
+ }, [
62
+ props.height,
63
+ props.width,
64
+ props.data,
65
+ _points
66
+ ]);
67
+ function _injectIndexPropertyInScatterChartData(scatterChartData) {
68
+ return scatterChartData ? scatterChartData.map((item, index)=>{
69
+ let color;
70
+ if (typeof item.color === 'undefined') {
71
+ color = getNextColor(index, 0);
72
+ } else {
73
+ color = getColorFromToken(item.color);
74
+ }
75
+ return {
76
+ ...item,
77
+ index: -1,
78
+ color
79
+ };
80
+ }) : [];
81
+ }
82
+ function updatePosition(newX, newY) {
83
+ const threshold = 1; // Set a threshold for movement
84
+ const { x, y } = clickPosition;
85
+ // Calculate the distance moved
86
+ const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
87
+ // Update the position only if the distance moved is greater than the threshold
88
+ if (distance > threshold) {
89
+ setClickPosition({
90
+ x: newX,
91
+ y: newY
92
+ });
93
+ setPopoverOpen(true);
94
+ }
95
+ }
96
+ function _getMargins(_margins) {
97
+ margins = _margins;
98
+ }
99
+ function _initializeScatterChartData(xScale, yScale, containerHeight, containerWidth, xElement) {
100
+ _xAxisScale = xScale;
101
+ _yAxisScale = yScale;
102
+ renderSeries = _createPlot(xElement, containerHeight);
103
+ }
104
+ function _handleSingleLegendSelectionAction(scatterChartItem) {
105
+ if (selectedLegend === scatterChartItem.legend) {
106
+ setSelectedLegend('');
107
+ _handleLegendClick(scatterChartItem, null);
108
+ } else {
109
+ setSelectedLegend(scatterChartItem.legend);
110
+ _handleLegendClick(scatterChartItem, scatterChartItem.legend);
111
+ }
112
+ }
113
+ function _onHoverCardHide() {
114
+ setSelectedLegendPoints([]);
115
+ setIsSelectedLegend(false);
116
+ }
117
+ function _handleLegendClick(scatterChartItem, selectedLegend) {
118
+ if (scatterChartItem.onLegendClick) {
119
+ scatterChartItem.onLegendClick(selectedLegend);
120
+ }
121
+ }
122
+ function _createLegends(data) {
123
+ const { legendProps } = props;
124
+ const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
125
+ const legendDataItems = data.map((point)=>{
126
+ const color = point.color;
127
+ // mapping data to the format Legends component needs
128
+ const legend = {
129
+ title: point.legend,
130
+ color,
131
+ action: ()=>{
132
+ if (isLegendMultiSelectEnabled) {
133
+ _handleMultipleSeriesLegendSelectionAction(point);
134
+ } else {
135
+ _handleSingleLegendSelectionAction(point);
136
+ }
137
+ },
138
+ onMouseOutAction: ()=>{
139
+ setActiveLegend('');
140
+ },
141
+ hoverAction: ()=>{
142
+ _handleChartMouseLeave();
143
+ setActiveLegend(point.legend);
144
+ },
145
+ ...point.legendShape && {
146
+ shape: point.legendShape
147
+ }
148
+ };
149
+ return legend;
150
+ });
151
+ return /*#__PURE__*/ React.createElement(Legends, {
152
+ legends: [
153
+ ...legendDataItems
154
+ ],
155
+ enabledWrapLines: props.enabledLegendsWrapLines,
156
+ overflowText: props.legendsOverflowText,
157
+ ...isLegendMultiSelectEnabled && {
158
+ onLegendHoverCardLeave: _onHoverCardHide
159
+ },
160
+ ...props.legendProps
161
+ });
162
+ }
163
+ function _getPointFill(seriesColor, pointId, pointIndex, isLastPoint) {
164
+ if (activePoint === pointId) {
165
+ return tokens.colorNeutralBackground1;
166
+ } else {
167
+ return seriesColor;
168
+ }
169
+ }
170
+ function _createPlot(xElement, containerHeight) {
171
+ const series = [];
172
+ if (isSelectedLegend) {
173
+ _points = selectedLegendPoints;
174
+ } else {
175
+ _points = _injectIndexPropertyInScatterChartData(props.data.lineChartData);
176
+ }
177
+ const yMax = d3Max(points, (point)=>{
178
+ return d3Max(point.data, (item)=>item.y);
179
+ });
180
+ const yMin = d3Min(points, (point)=>{
181
+ return d3Min(point.data, (item)=>item.y);
182
+ });
183
+ const yPadding = (yMax - yMin) * 0.1;
184
+ const yPaddingRange = Math.abs(_yAxisScale(yMin + yPadding) - _yAxisScale(yMin));
185
+ let maxMarkerRange = 40;
186
+ let xPaddingRange = 0;
187
+ if (_xAxisType === XAxisTypes.StringAxis) {
188
+ _xBandwidth = _xAxisScale.bandwidth() / 2;
189
+ xPaddingRange = _xBandwidth;
190
+ } else if (_xAxisType === XAxisTypes.DateAxis) {
191
+ const xMin = d3Min(points, (point)=>{
192
+ return d3Min(point.data, (item)=>item.x);
193
+ });
194
+ const xMax = d3Max(points, (point)=>{
195
+ return d3Max(point.data, (item)=>{
196
+ return item.x;
197
+ });
198
+ });
199
+ const xPadding = (xMax.getTime() - xMin.getTime()) * 0.1;
200
+ xPaddingRange = Math.abs(_xAxisScale(new Date(xMin.getTime() + xPadding)) - _xAxisScale(xMin));
201
+ } else {
202
+ const xMin = d3Min(points, (point)=>{
203
+ return d3Min(point.data, (item)=>item.x);
204
+ });
205
+ const xMax = d3Max(points, (point)=>{
206
+ return d3Max(point.data, (item)=>{
207
+ return item.x;
208
+ });
209
+ });
210
+ const xPadding = (xMax - xMin) * 0.1;
211
+ xPaddingRange = Math.abs(_xAxisScale(xMin + xPadding) - _xAxisScale(xMin));
212
+ }
213
+ maxMarkerRange = Math.min(maxMarkerRange, Math.min(xPaddingRange, yPaddingRange));
214
+ const maxMarkerSize = d3Max(_points, (point)=>{
215
+ return d3Max(point.data, (item)=>{
216
+ return item.markerSize;
217
+ });
218
+ });
219
+ for(let i = _points.length - 1; i >= 0; i--){
220
+ const pointsForSeries = [];
221
+ const legendVal = _points[i].legend;
222
+ const seriesColor = _points[i].color;
223
+ const verticaLineHeight = containerHeight - margins.bottom + 6;
224
+ for(let j = 0; j < _points[i].data.length; j++){
225
+ const seriesId = `${_seriesId}_${i}_${j}`;
226
+ const circleId = `${_circleId}_${i}_${j}`;
227
+ const { x, y, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j];
228
+ let circleRadius = 3.5;
229
+ const pointMarkerSize = _points[i].data[j].markerSize;
230
+ if (pointMarkerSize !== undefined) {
231
+ circleRadius = Math.min(pointMarkerSize * maxMarkerRange / maxMarkerSize, pointMarkerSize);
232
+ }
233
+ const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
234
+ const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
235
+ pointsForSeries.push(/*#__PURE__*/ React.createElement("circle", {
236
+ id: circleId,
237
+ key: circleId,
238
+ r: circleRadius,
239
+ cx: _xAxisScale(x) + _xBandwidth,
240
+ cy: _yAxisScale(y),
241
+ "data-is-focusable": isLegendSelected,
242
+ onMouseOver: (event)=>_handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
243
+ onMouseMove: (event)=>_handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
244
+ onMouseOut: _handleMouseOut,
245
+ onFocus: ()=>_handleFocus(seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
246
+ onBlur: _handleMouseOut,
247
+ ..._getClickHandler(_points[i].data[j].onDataPointClick),
248
+ opacity: isLegendSelected && !currentPointHidden ? 1 : 0.1,
249
+ fill: _getPointFill(seriesColor, circleId, j, false),
250
+ stroke: seriesColor,
251
+ role: "img",
252
+ "aria-label": _getAriaLabel(i, j),
253
+ tabIndex: _points[i].legend !== '' ? 0 : undefined
254
+ }));
255
+ }
256
+ series.push(/*#__PURE__*/ React.createElement("g", {
257
+ key: `series_${i}`,
258
+ role: "region",
259
+ "aria-label": `${legendVal}, series ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`
260
+ }, pointsForSeries));
261
+ }
262
+ const classes = useScatterChartStyles_unstable(props);
263
+ // Removing un wanted tooltip div from DOM, when prop not provided.
264
+ if (!props.showXAxisLablesTooltip) {
265
+ try {
266
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
267
+ // eslint-disable-next-line no-empty
268
+ } catch (e) {}
269
+ }
270
+ // Used to display tooltip at x axis labels.
271
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
272
+ const xAxisElement = d3Select(xElement).call(_xAxisScale);
273
+ try {
274
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
275
+ // eslint-disable-next-line no-empty
276
+ } catch (e) {}
277
+ const tooltipProps = {
278
+ tooltipCls: classes.tooltip,
279
+ id: _tooltipId,
280
+ xAxis: xAxisElement
281
+ };
282
+ xAxisElement && tooltipOfXAxislabels(tooltipProps);
283
+ }
284
+ return series;
285
+ }
286
+ function _handleFocus(seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
287
+ _uniqueCallOutID = circleId;
288
+ const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;
289
+ const xVal = x instanceof Date ? x.getTime() : x;
290
+ const found = find(_calloutPoints, (element)=>element.x === xVal);
291
+ // if no points need to be called out then don't show vertical line and callout card
292
+ if (found) {
293
+ d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x) + _xBandwidth}, 0)`).attr('visibility', 'visibility');
294
+ _refArray.forEach((obj)=>{
295
+ if (obj.index === seriesId) {
296
+ setPopoverOpen(true);
297
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
298
+ setYValueHover(found.values);
299
+ setStackCalloutProps(found);
300
+ setActivePoint(circleId);
301
+ }
302
+ });
303
+ } else {
304
+ setActivePoint(circleId);
305
+ }
306
+ }
307
+ function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
308
+ mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
309
+ const formattedData = x instanceof Date ? formatDate(x, props.useUTC) : x;
310
+ const xVal = x instanceof Date ? x.getTime() : x;
311
+ const found = find(_calloutPoints, (element)=>element.x === xVal);
312
+ // if no points need to be called out then don't show vertical line and callout card
313
+ if (found) {
314
+ d3Select(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x) + _xBandwidth}, ${_yAxisScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - _yAxisScale(y)}`);
315
+ if (_uniqueCallOutID !== circleId) {
316
+ _uniqueCallOutID = circleId;
317
+ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
318
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
319
+ setYValueHover(found.values);
320
+ setStackCalloutProps(found);
321
+ setActivePoint(circleId);
322
+ }
323
+ } else {
324
+ setActivePoint(circleId);
325
+ }
326
+ }
327
+ /**
328
+ * Screen readers announce an element as clickable if the onClick attribute is set.
329
+ * This function sets the attribute only when a click event handler is provided.*/ function _getClickHandler(func) {
330
+ if (func) {
331
+ return {
332
+ onClick: func
333
+ };
334
+ }
335
+ return {};
336
+ }
337
+ function _handleMouseOut() {
338
+ d3Select(`#${_verticalLine}`).attr('visibility', 'hidden');
339
+ }
340
+ function _handleChartMouseLeave() {
341
+ _uniqueCallOutID = null;
342
+ setActivePoint('');
343
+ if (isPopoverOpen) {
344
+ setPopoverOpen(false);
345
+ }
346
+ }
347
+ function _handleMultipleSeriesLegendSelectionAction(selectedSeries) {
348
+ const selectedSeriesIndex = selectedLegendPoints.reduce((acc, series, index)=>{
349
+ if (acc > -1 || series.legend !== selectedSeries.legend) {
350
+ return acc;
351
+ } else {
352
+ return index;
353
+ }
354
+ }, -1);
355
+ let selectedSerieses;
356
+ if (selectedSeriesIndex === -1) {
357
+ selectedSerieses = [
358
+ ...selectedLegendPoints,
359
+ selectedSeries
360
+ ];
361
+ } else {
362
+ selectedSerieses = selectedLegendPoints.slice(0, selectedSeriesIndex).concat(selectedLegendPoints.slice(selectedSeriesIndex + 1));
363
+ }
364
+ const areAllSeriesLegendsSelected = props.data && selectedSerieses.length === props.data.lineChartData.length;
365
+ if (areAllSeriesLegendsSelected || !selectedSerieses.length) {
366
+ // Clear all legends if no legends including color fill bar legends are selected
367
+ _clearMultipleLegendSelections();
368
+ } else {
369
+ // Otherwise, set state when one or more legends are selected, including color fill bar legends
370
+ setSelectedLegendPoints(selectedSerieses);
371
+ setIsSelectedLegend(true);
372
+ }
373
+ const selectedLegendTitlesToPass = selectedSerieses.map((series)=>series.legend);
374
+ _handleLegendClick(selectedSeries, selectedLegendTitlesToPass);
375
+ }
376
+ function _clearMultipleLegendSelections() {
377
+ setSelectedLegendPoints([]);
378
+ setIsSelectedLegend(false);
379
+ }
380
+ /**
381
+ * This function checks if the given legend is highlighted or not.
382
+ * A legend can be highlighted in 2 ways:
383
+ * 1. selection: if the user clicks on it
384
+ * 2. hovering: if there is no selected legend and the user hovers over it*/ function _legendHighlighted(legend) {
385
+ return selectedLegend === legend || selectedLegend === '' && activeLegend === legend;
386
+ }
387
+ /**
388
+ * This function checks if none of the legends is selected or hovered.*/ function _noLegendHighlighted() {
389
+ return selectedLegend === '' && activeLegend === '';
390
+ }
391
+ function _getAriaLabel(seriesIndex, pointIndex) {
392
+ var _point_callOutAccessibilityData;
393
+ const series = _points[seriesIndex];
394
+ const point = series.data[pointIndex];
395
+ const formattedDate = point.x instanceof Date ? formatDate(point.x, props.useUTC) : point.x;
396
+ const xValue = point.xAxisCalloutData || formattedDate;
397
+ const legend = series.legend;
398
+ const yValue = point.yAxisCalloutData || point.y;
399
+ return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
400
+ }
401
+ function _isChartEmpty() {
402
+ return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
403
+ }
404
+ const { legendProps, tickValues, tickFormat } = props;
405
+ _points = _injectIndexPropertyInScatterChartData(props.data.lineChartData);
406
+ let points = _points;
407
+ if (legendProps && !!legendProps.canSelectMultipleLegends) {
408
+ points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
409
+ _calloutPoints = calloutData(points);
410
+ }
411
+ let legendBars = null;
412
+ // reduce computation cost by only creating legendBars
413
+ // if when hideLegend is false.
414
+ // NOTE: they are rendered only when hideLegend is false in CartesianChart.
415
+ if (!props.hideLegend) {
416
+ legendBars = _createLegends(_points); // ToDo: Memoize legends to improve performance.
417
+ }
418
+ var _props_culture;
419
+ const calloutProps = {
420
+ YValueHover,
421
+ hoverXValue,
422
+ descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
423
+ 'data-is-focusable': true,
424
+ xAxisCalloutAccessibilityData,
425
+ ...props.calloutProps,
426
+ clickPosition,
427
+ isPopoverOpen,
428
+ isCalloutForStack: true,
429
+ culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
430
+ isCartesian: true
431
+ };
432
+ const tickParams = {
433
+ tickValues,
434
+ tickFormat
435
+ };
436
+ const xAxisLabels = _points.map((point)=>point.data.map((dp)=>dp.x)).flat();
437
+ _xAxisLabels = [
438
+ ...new Set(xAxisLabels)
439
+ ];
440
+ return !_isChartEmpty() ? /*#__PURE__*/ React.createElement(CartesianChart, {
441
+ ...props,
442
+ chartTitle: props.data.chartTitle,
443
+ points: points,
444
+ chartType: ChartTypes.ScatterChart,
445
+ calloutProps: calloutProps,
446
+ tickParams: tickParams,
447
+ legendBars: legendBars,
448
+ getmargins: _getMargins,
449
+ getGraphData: _initializeScatterChartData,
450
+ xAxisType: _xAxisType,
451
+ onChartMouseLeave: _handleChartMouseLeave,
452
+ enableFirstRenderOptimization: _firstRenderOptimization,
453
+ datasetForXAxisDomain: _xAxisLabels,
454
+ /* eslint-disable react/jsx-no-bind */ // eslint-disable-next-line react/no-children-prop
455
+ children: (props)=>{
456
+ _xAxisScale = props.xScale;
457
+ _yAxisScale = props.yScale;
458
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("g", null, /*#__PURE__*/ React.createElement("line", {
459
+ x1: 0,
460
+ y1: 0,
461
+ x2: 0,
462
+ y2: props.containerHeight,
463
+ stroke: '#323130',
464
+ id: _verticalLine,
465
+ visibility: 'hidden',
466
+ strokeDasharray: '5,5'
467
+ }), /*#__PURE__*/ React.createElement("g", null, renderSeries)));
468
+ }
469
+ }) : /*#__PURE__*/ React.createElement("div", {
470
+ id: _emptyChartId,
471
+ role: 'alert',
472
+ style: {
473
+ opacity: '0'
474
+ },
475
+ "aria-label": 'Graph has no data to display'
476
+ });
477
+ });
478
+ ScatterChart.displayName = 'ScatterChart';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ScatterChart.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ScatterChartProps } from './ScatterChart.types';\nimport { useScatterChartStyles_unstable } 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 { find } from '../../utilities/index';\nimport {\n AccessibilityProps,\n CartesianChart,\n ChildProps,\n LineChartPoints,\n CustomizedCalloutData,\n Margins,\n RefArrayData,\n ColorFillBarsProps,\n ScatterChartDataPoint,\n} from '../../index';\nimport { tokens } from '@fluentui/react-theme';\nimport {\n calloutData,\n ChartTypes,\n XAxisTypes,\n tooltipOfXAxislabels,\n getTypeOfAxis,\n getNextColor,\n getColorFromToken,\n formatDate,\n} from '../../utilities/index';\n\ntype NumericAxis = D3Axis<number | { valueOf(): number }>;\n\ntype ScatterChartDataWithIndex = LineChartPoints & { 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.lineChartData);\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: JSX.Element[];\n let _xAxisLabels: string[] = [];\n let xAxisCalloutAccessibilityData: AccessibilityProps = {};\n let _xBandwidth = 0;\n\n const [hoverXValue, setHoverXValue] = React.useState<string | number>('');\n const [activeLegend, setActiveLegend] = React.useState<string>('');\n const [YValueHover, setYValueHover] = React.useState<[]>([]);\n const [selectedLegend, setSelectedLegend] = React.useState<string>('');\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\n const _xAxisType: XAxisTypes =\n props.data.lineChartData! &&\n props.data.lineChartData!.length > 0 &&\n props.data.lineChartData![0].data &&\n props.data.lineChartData![0].data.length > 0\n ? (getTypeOfAxis(props.data.lineChartData![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.lineChartData) || props.data !== _points) {\n pointsRef.current = _injectIndexPropertyInScatterChartData(props.data.lineChartData);\n calloutPointsRef.current = calloutData(pointsRef.current);\n }\n }, [props.height, props.width, props.data, _points]);\n\n function _injectIndexPropertyInScatterChartData(\n scatterChartData?: LineChartPoints[],\n ): ScatterChartDataWithIndex[] | [] {\n return scatterChartData\n ? scatterChartData.map((item: LineChartPoints, 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 _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 renderSeries = _createPlot(xElement!, containerHeight!);\n }\n\n function _handleSingleLegendSelectionAction(scatterChartItem: ScatterChartDataWithIndex | ColorFillBarsProps) {\n if (selectedLegend === scatterChartItem.legend) {\n setSelectedLegend('');\n _handleLegendClick(scatterChartItem, null);\n } else {\n setSelectedLegend(scatterChartItem.legend);\n _handleLegendClick(scatterChartItem, scatterChartItem.legend);\n }\n }\n\n function _onHoverCardHide() {\n setSelectedLegendPoints([]);\n setIsSelectedLegend(false);\n }\n\n function _handleLegendClick(\n scatterChartItem: ScatterChartDataWithIndex | ColorFillBarsProps,\n selectedLegend: string | null | string[],\n ): void {\n if (scatterChartItem.onLegendClick) {\n scatterChartItem.onLegendClick(selectedLegend);\n }\n }\n\n function _createLegends(data: ScatterChartDataWithIndex[]): JSX.Element {\n const { legendProps } = props;\n const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);\n const legendDataItems = data.map((point: ScatterChartDataWithIndex) => {\n const color: string = point.color!;\n // mapping data to the format Legends component needs\n const legend: Legend = {\n title: point.legend!,\n color,\n action: () => {\n if (isLegendMultiSelectEnabled) {\n _handleMultipleSeriesLegendSelectionAction(point);\n } else {\n _handleSingleLegendSelectionAction(point);\n }\n },\n onMouseOutAction: () => {\n setActiveLegend('');\n },\n hoverAction: () => {\n _handleChartMouseLeave();\n setActiveLegend(point.legend);\n },\n ...(point.legendShape && {\n shape: point.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 />\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): JSX.Element[] {\n const series: JSX.Element[] = [];\n if (isSelectedLegend) {\n _points = selectedLegendPoints;\n } else {\n _points = _injectIndexPropertyInScatterChartData(props.data.lineChartData);\n }\n\n const yMax = d3Max(points, (point: LineChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.y)!;\n })!;\n const yMin = d3Min(points, (point: LineChartPoints) => {\n return d3Min(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.y)!;\n })!;\n const yPadding = (yMax - yMin) * 0.1;\n const yPaddingRange = Math.abs(_yAxisScale(yMin + yPadding) - _yAxisScale(yMin));\n\n let maxMarkerRange = 40;\n let xPaddingRange = 0;\n if (_xAxisType === XAxisTypes.StringAxis) {\n _xBandwidth = _xAxisScale.bandwidth() / 2;\n xPaddingRange = _xBandwidth;\n } else if (_xAxisType === XAxisTypes.DateAxis) {\n const xMin = d3Min(points, (point: LineChartPoints) => {\n return d3Min(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.x as Date)!;\n })!;\n\n const xMax = d3Max(points, (point: LineChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.x as Date;\n });\n })!;\n\n const xPadding = (xMax.getTime() - xMin.getTime()) * 0.1;\n xPaddingRange = Math.abs(_xAxisScale(new Date(xMin.getTime() + xPadding)) - _xAxisScale(xMin));\n } else {\n const xMin = d3Min(points, (point: LineChartPoints) => {\n return d3Min(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => item.x as number)!;\n })!;\n\n const xMax = d3Max(points, (point: LineChartPoints) => {\n return d3Max(point.data as ScatterChartDataPoint[], (item: ScatterChartDataPoint) => {\n return item.x as number;\n });\n })!;\n\n const xPadding = (xMax - xMin) * 0.1;\n xPaddingRange = Math.abs(_xAxisScale(xMin + xPadding) - _xAxisScale(xMin));\n }\n maxMarkerRange = Math.min(maxMarkerRange, Math.min(xPaddingRange, yPaddingRange));\n\n const maxMarkerSize = d3Max(_points, (point: LineChartPoints) => {\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: JSX.Element[] = [];\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 let circleRadius = 3.5;\n const pointMarkerSize = (_points[i].data[j] as ScatterChartDataPoint).markerSize;\n if ((pointMarkerSize as number) !== undefined) {\n circleRadius = Math.min((pointMarkerSize! * maxMarkerRange) / maxMarkerSize, pointMarkerSize!);\n }\n\n const isLegendSelected: boolean = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;\n\n const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;\n pointsForSeries.push(\n <circle\n id={circleId}\n key={circleId}\n r={circleRadius}\n cx={_xAxisScale(x) + _xBandwidth}\n cy={_yAxisScale(y)}\n data-is-focusable={isLegendSelected}\n onMouseOver={(event: React.MouseEvent<SVGElement>) =>\n _handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event)\n }\n onMouseMove={(event: React.MouseEvent<SVGElement>) =>\n _handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event)\n }\n onMouseOut={_handleMouseOut}\n onFocus={() => _handleFocus(seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData)}\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={_points[i].legend !== '' ? 0 : undefined}\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 const classes = useScatterChartStyles_unstable(props);\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 xAxis: xAxisElement,\n };\n xAxisElement && tooltipOfXAxislabels(tooltipProps);\n }\n return series;\n }\n\n function _handleFocus(\n seriesId: string,\n x: number | Date | string,\n\n xAxisCalloutData: string | undefined,\n circleId: string,\n xAxisCalloutAccessibilityData?: AccessibilityProps,\n ) {\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 function _handleMultipleSeriesLegendSelectionAction(selectedSeries: ScatterChartDataWithIndex) {\n const selectedSeriesIndex = selectedLegendPoints.reduce((acc, series, index) => {\n if (acc > -1 || series.legend !== selectedSeries.legend) {\n return acc;\n } else {\n return index;\n }\n }, -1);\n\n let selectedSerieses: ScatterChartDataWithIndex[];\n if (selectedSeriesIndex === -1) {\n selectedSerieses = [...selectedLegendPoints, selectedSeries];\n } else {\n selectedSerieses = selectedLegendPoints\n .slice(0, selectedSeriesIndex)\n .concat(selectedLegendPoints.slice(selectedSeriesIndex + 1));\n }\n\n const areAllSeriesLegendsSelected = props.data && selectedSerieses.length === props.data.lineChartData!.length;\n\n if (areAllSeriesLegendsSelected || !selectedSerieses.length) {\n // Clear all legends if no legends including color fill bar legends are selected\n _clearMultipleLegendSelections();\n } else {\n // Otherwise, set state when one or more legends are selected, including color fill bar legends\n setSelectedLegendPoints(selectedSerieses);\n setIsSelectedLegend(true);\n }\n\n const selectedLegendTitlesToPass = selectedSerieses.map((series: ScatterChartDataWithIndex) => series.legend);\n _handleLegendClick(selectedSeries, selectedLegendTitlesToPass);\n }\n\n function _clearMultipleLegendSelections() {\n setSelectedLegendPoints([]);\n setIsSelectedLegend(false);\n }\n\n /**\n * This function checks if the given legend is highlighted or not.\n * A legend can be highlighted in 2 ways:\n * 1. selection: if the user clicks on it\n * 2. hovering: if there is no selected legend and the user hovers over it*/\n\n function _legendHighlighted(legend: string) {\n return selectedLegend === legend || (selectedLegend === '' && activeLegend === legend);\n }\n\n /**\n * This function checks if none of the legends is selected or hovered.*/\n\n function _noLegendHighlighted() {\n return selectedLegend === '' && 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.lineChartData &&\n props.data.lineChartData.length > 0 &&\n props.data.lineChartData.filter((item: LineChartPoints) => item.data.length).length > 0\n );\n }\n\n const { legendProps, tickValues, tickFormat } = props;\n _points = _injectIndexPropertyInScatterChartData(props.data.lineChartData);\n\n let points = _points;\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) {\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 onChartMouseLeave={_handleChartMouseLeave}\n enableFirstRenderOptimization={_firstRenderOptimization}\n datasetForXAxisDomain={_xAxisLabels}\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.yScale!;\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_unstable","select","d3Select","Legends","max","d3Max","min","d3Min","useId","find","CartesianChart","tokens","calloutData","ChartTypes","XAxisTypes","tooltipOfXAxislabels","getTypeOfAxis","getNextColor","getColorFromToken","formatDate","ScatterChart","forwardRef","props","forwardedRef","_circleId","_seriesId","_verticalLine","_tooltipId","_firstRenderOptimization","_emptyChartId","_points","_injectIndexPropertyInScatterChartData","data","lineChartData","_calloutPoints","_xAxisScale","_yAxisScale","_uniqueCallOutID","_refArray","margins","renderSeries","_xAxisLabels","xAxisCalloutAccessibilityData","_xBandwidth","hoverXValue","setHoverXValue","useState","activeLegend","setActiveLegend","YValueHover","setYValueHover","selectedLegend","setSelectedLegend","selectedLegendPoints","setSelectedLegendPoints","isSelectedLegend","setIsSelectedLegend","activePoint","setActivePoint","stackCalloutProps","setStackCalloutProps","clickPosition","setClickPosition","x","y","isPopoverOpen","setPopoverOpen","_xAxisType","length","StringAxis","pointsRef","useRef","calloutPointsRef","useEffect","current","height","width","scatterChartData","map","item","index","color","updatePosition","newX","newY","threshold","distance","Math","sqrt","pow","_getMargins","_margins","_initializeScatterChartData","xScale","yScale","containerHeight","containerWidth","xElement","_createPlot","_handleSingleLegendSelectionAction","scatterChartItem","legend","_handleLegendClick","_onHoverCardHide","onLegendClick","_createLegends","legendProps","isLegendMultiSelectEnabled","canSelectMultipleLegends","legendDataItems","point","title","action","_handleMultipleSeriesLegendSelectionAction","onMouseOutAction","hoverAction","_handleChartMouseLeave","legendShape","shape","legends","enabledWrapLines","enabledLegendsWrapLines","overflowText","legendsOverflowText","onLegendHoverCardLeave","_getPointFill","seriesColor","pointId","pointIndex","isLastPoint","colorNeutralBackground1","series","yMax","points","yMin","yPadding","yPaddingRange","abs","maxMarkerRange","xPaddingRange","bandwidth","DateAxis","xMin","xMax","xPadding","getTime","Date","maxMarkerSize","markerSize","i","pointsForSeries","legendVal","verticaLineHeight","bottom","j","seriesId","circleId","xAxisCalloutData","circleRadius","pointMarkerSize","undefined","isLegendSelected","_legendHighlighted","_noLegendHighlighted","currentPointHidden","hideNonActiveDots","push","circle","id","key","r","cx","cy","data-is-focusable","onMouseOver","event","_handleHover","onMouseMove","onMouseOut","_handleMouseOut","onFocus","_handleFocus","onBlur","_getClickHandler","onDataPointClick","opacity","fill","stroke","role","aria-label","_getAriaLabel","tabIndex","g","classes","showXAxisLablesTooltip","document","getElementById","remove","e","wrapXAxisLables","xAxisElement","call","tooltipProps","tooltipCls","tooltip","xAxis","formattedData","useUTC","xVal","found","element","attr","forEach","obj","values","lineHeight","mouseEvent","persist","clientX","clientY","func","onClick","selectedSeries","selectedSeriesIndex","reduce","acc","selectedSerieses","slice","concat","areAllSeriesLegendsSelected","_clearMultipleLegendSelections","selectedLegendTitlesToPass","seriesIndex","formattedDate","xValue","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_isChartEmpty","filter","tickValues","tickFormat","legendBars","hideLegend","calloutProps","descriptionMessage","getCalloutDescriptionMessage","isCalloutForStack","culture","isCartesian","tickParams","xAxisLabels","dp","flat","Set","chartTitle","chartType","getmargins","getGraphData","xAxisType","onChartMouseLeave","enableFirstRenderOptimization","datasetForXAxisDomain","children","line","x1","y1","x2","y2","visibility","strokeDasharray","div","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,cAAcb,MAAMuE,MAAM;YAC1BzD,cAAcd,MAAMwE,MAAM;YAC1B,qBACE,wDACE,oBAACkG,yBACC,oBAACyE;gBACCC,IAAI;gBACJC,IAAI;gBACJC,IAAI;gBACJC,IAAIvP,MAAMyE,eAAe;gBACzB4F,QAAQ;gBACRnB,IAAI9I;gBACJoP,YAAY;gBACZC,iBAAiB;8BAEnB,oBAAC/E,WAAGxJ;QAIZ;uBAGF,oBAACwO;QAAIxG,IAAI3I;QAAe+J,MAAM;QAASqF,OAAO;YAAExF,SAAS;QAAI;QAAGI,cAAY;;AAEhF,GAAG;AACHzK,aAAa8P,WAAW,GAAG"}
@@ -0,0 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */ /**
2
+ * Scatter Chart style properties
3
+ * {@docCategory ScatterChart}
4
+ */ export { };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ScatterChart.types.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport { RenderFunction } from '../../utilities/index';\nimport {\n ChartProps,\n LineChartPoints,\n Margins,\n Basestate,\n RefArrayData,\n CustomizedCalloutData,\n} from '../../types/index';\nimport {\n CartesianChartProps,\n CartesianChartStyleProps,\n CartesianChartStyles,\n ChildProps,\n} from '../CommonComponents/index';\n\nexport type { ChildProps, LineChartPoints, Margins, Basestate, RefArrayData };\n\n/**\n * Line Chart properties\n * {@docCategory LineChart}\n */\nexport interface ScatterChartProps extends CartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data: ChartProps;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: ScatterChartStyles;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: RenderFunction<CustomizedCalloutData>;\n\n /**\n * Callback for getting callout description message\n */\n getCalloutDescriptionMessage?: (calloutDataProps: CustomizedCalloutData) => string | undefined;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n}\n\n/**\n * Scatter Chart styles\n * {@docCategory ScatterChart}\n */\nexport interface ScatterChartStyles extends CartesianChartStyles {}\n\n/**\n * Scatter Chart style properties\n * {@docCategory ScatterChart}\n */\nexport interface ScatterChartStyleProps extends CartesianChartStyleProps {}\n"],"names":[],"rangeMappings":";;;","mappings":"AAAA,uDAAuD,GAwDvD;;;CAGC,GACD,WAA2E"}
@@ -0,0 +1,3 @@
1
+ export * from './ScatterChart';
2
+ export * from './ScatterChart.types';
3
+ export * from '../../types/index';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './ScatterChart';\nexport * from './ScatterChart.types';\nexport * from '../../types/index';\n"],"names":[],"rangeMappings":";;","mappings":"AAAA,cAAc,iBAAiB;AAC/B,cAAc,uBAAuB;AACrC,cAAc,oBAAoB"}