@fluentui/react-charts 0.0.0-nightly-20251027-0407.1 → 0.0.0-nightly-20251029-0406.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,28 +1,28 @@
1
1
  # Change Log - @fluentui/react-charts
2
2
 
3
- This log was last generated on Mon, 27 Oct 2025 04:22:14 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 29 Oct 2025 04:20:46 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20251027-0407.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v0.0.0-nightly-20251027-0407.1)
7
+ ## [0.0.0-nightly-20251029-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v0.0.0-nightly-20251029-0406.1)
8
8
 
9
- Mon, 27 Oct 2025 04:22:14 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.3..@fluentui/react-charts_v0.0.0-nightly-20251027-0407.1)
9
+ Wed, 29 Oct 2025 04:20:46 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-charts_v9.3.3..@fluentui/react-charts_v0.0.0-nightly-20251029-0406.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-button to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
16
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
17
- - Bump @fluentui/react-overflow to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
18
- - Bump @fluentui/react-popover to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
19
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
20
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
21
- - Bump @fluentui/react-theme to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
22
- - Bump @fluentui/react-tooltip to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
23
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
24
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
25
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20251027-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/1b321bf9638c3ba864219ae9eca77b2a3bc41f9a) by beachball)
15
+ - Bump @fluentui/react-button to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
16
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
17
+ - Bump @fluentui/react-overflow to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
18
+ - Bump @fluentui/react-popover to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
19
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
20
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
21
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
22
+ - Bump @fluentui/react-tooltip to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
23
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
24
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
25
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20251029-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/2ff23b66360318fb9382112f8ef435d77c4d4967) by beachball)
26
26
 
27
27
  ## [9.3.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-charts_v9.3.3)
28
28
 
@@ -33,6 +33,8 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
33
33
  const _firstRenderOptimization = true;
34
34
  const _emptyChartId = useId('_AreaChart_empty');
35
35
  let _containsSecondaryYAxis = false;
36
+ let _hasMissingXValues = _containsMissingXValues();
37
+ let _hasDuplicateXValues = _xCoordinateContainsMultipleY();
36
38
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
39
  let _calloutPoints;
38
40
  let _createSet;
@@ -268,7 +270,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
268
270
  };
269
271
  }
270
272
  function _createDataSet(points) {
271
- if (props.enablePerfOptimization && _enableComputationOptimization) {
273
+ if (props.enablePerfOptimization && _enableComputationOptimization && !_hasDuplicateXValues) {
272
274
  const allChartPoints = [];
273
275
  const dataSet = [];
274
276
  const colors = [];
@@ -323,35 +325,50 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
323
325
  const colors = [];
324
326
  const opacity = [];
325
327
  const calloutPoints = calloutData(points);
328
+ let data = {};
329
+ const keys = [];
330
+ let index = 0;
326
331
  points && points.length && points.forEach((singleChartPoint)=>{
332
+ // if legend is not populated, then assign a legend
333
+ if (_hasDuplicateXValues && !singleChartPoint.legend) {
334
+ singleChartPoint.legend = `chart${index}`;
335
+ ++index;
336
+ }
337
+ singleChartPoint.data.forEach((point)=>{
338
+ point.legend = singleChartPoint.legend;
339
+ });
327
340
  colors.push(singleChartPoint.color);
328
341
  opacity.push(singleChartPoint.opacity || 1);
329
342
  allChartPoints.push(...singleChartPoint.data);
330
343
  });
331
- let tempArr = allChartPoints;
332
- while(tempArr.length){
333
- const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
334
- const filteredChartPoints = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck);
335
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
336
- const singleDataset = {};
337
- filteredChartPoints.forEach((singleDataPoint, index)=>{
338
- singleDataset.xVal = singleDataPoint.x;
339
- singleDataset[`chart${index}`] = singleDataPoint.y;
340
- });
341
- dataSet.push(singleDataset);
342
- // removing compared objects from array
343
- const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
344
- tempArr = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val);
345
- }
346
- // get keys from dataset, used to create stacked data
347
- const keysLength = dataSet && Object.keys(dataSet[0]).length;
348
- const keys = [];
349
- for(let i = 0; i < keysLength - 1; i++){
350
- const keyVal = `chart${i}`;
351
- keys.push(keyVal);
344
+ if (!_hasDuplicateXValues) {
345
+ let tempArr = allChartPoints;
346
+ while(tempArr.length){
347
+ const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
348
+ const filteredChartPoints = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck);
349
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
350
+ const singleDataset = {};
351
+ filteredChartPoints.forEach((singleDataPoint, id)=>{
352
+ singleDataset.xVal = singleDataPoint.x;
353
+ singleDataset[`chart${id}`] = singleDataPoint.y;
354
+ });
355
+ dataSet.push(singleDataset);
356
+ // removing compared objects from array
357
+ const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
358
+ tempArr = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val);
359
+ }
360
+ // get keys from dataset, used to create stacked data
361
+ const keysLength = dataSet && Object.keys(dataSet[0]).length;
362
+ for(let i = 0; i < keysLength - 1; i++){
363
+ const keyVal = `chart${i}`;
364
+ keys.push(keyVal);
365
+ }
366
+ // Data used to draw graph
367
+ data = _getDataPoints(keys, dataSet);
368
+ } else {
369
+ const datasetForDuplicateValues = _createDatasetForXCoordinateWithMultipleYValues(allChartPoints);
370
+ data = _getDataPoints(datasetForDuplicateValues.keys, datasetForDuplicateValues.filteredDataSet);
352
371
  }
353
- // Data used to draw graph
354
- const data = _getDataPoints(keys, dataSet);
355
372
  return {
356
373
  colors,
357
374
  opacity,
@@ -361,6 +378,56 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
361
378
  };
362
379
  }
363
380
  }
381
+ function _createDatasetForXCoordinateWithMultipleYValues(allChartPoints) {
382
+ const dataSet = [];
383
+ // Group data points by x-axis value
384
+ const groupedData = {};
385
+ allChartPoints.forEach((dataPoint)=>{
386
+ const xValue = dataPoint.x instanceof Date ? dataPoint.x.toLocaleString() : dataPoint.x;
387
+ if (!groupedData[xValue]) {
388
+ groupedData[xValue] = [];
389
+ }
390
+ groupedData[xValue].push(dataPoint);
391
+ });
392
+ // Aggregate data points for each x-axis value
393
+ Object.keys(groupedData).forEach((xValue)=>{
394
+ const dataPoints = groupedData[xValue];
395
+ dataPoints.forEach((dataPoint, id)=>{
396
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
397
+ const singleDataset = {
398
+ xVal: dataPoints[0].x
399
+ };
400
+ const key = dataPoint.legend ? dataPoint.legend : `chart${id}`;
401
+ singleDataset[key] = dataPoint.y;
402
+ dataSet.push(singleDataset);
403
+ });
404
+ });
405
+ // get all unique keys from each array within the dataSet
406
+ const allLegends = [];
407
+ dataSet.forEach((item)=>{
408
+ Object.keys(item).forEach((key)=>{
409
+ if (key !== 'xVal' && !allLegends.includes(key)) {
410
+ allLegends.push(key);
411
+ }
412
+ });
413
+ });
414
+ dataSet.forEach((item)=>{
415
+ allLegends.forEach((legend)=>{
416
+ if (!item[legend]) {
417
+ item[legend] = 0; // Fill with 0 if the legend is missing
418
+ }
419
+ });
420
+ });
421
+ // exclude all items within dataset having all legend values 0
422
+ const filteredDataSet = dataSet.filter((item)=>{
423
+ return allLegends.some((legend)=>item[legend] !== 0);
424
+ });
425
+ const keys = Array.from(new Set(filteredDataSet.flatMap((item)=>Object.keys(item).filter((key)=>key !== 'xVal'))));
426
+ return {
427
+ keys,
428
+ filteredDataSet
429
+ };
430
+ }
364
431
  function _getCustomizedCallout() {
365
432
  return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
366
433
  }
@@ -462,9 +529,9 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
462
529
  let lineColor;
463
530
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
464
531
  _data.forEach((singleStackedData, index)=>{
465
- var _points_index_lineOptions, _points_index_lineOptions1, _points_index_lineOptions2, _points_index_lineOptions3, _points_index_lineOptions4;
466
- const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
467
- const curveFactory = getCurveFactory((_points_index_lineOptions = points[index].lineOptions) === null || _points_index_lineOptions === void 0 ? void 0 : _points_index_lineOptions.curve, d3CurveBasis);
532
+ var _points_index, _points_index_lineOptions, _points_index1, _points_index_lineOptions1, _points_index2, _points_index_lineOptions2, _points_index3, _points_index_lineOptions3, _points_index4, _points_index_lineOptions4, _points_index5;
533
+ const yScale = ((_points_index = points[index]) === null || _points_index === void 0 ? void 0 : _points_index.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
534
+ const curveFactory = getCurveFactory((_points_index1 = points[index]) === null || _points_index1 === void 0 ? void 0 : (_points_index_lineOptions = _points_index1.lineOptions) === null || _points_index_lineOptions === void 0 ? void 0 : _points_index_lineOptions.curve, d3CurveBasis);
468
535
  const area = d3Area()// eslint-disable-next-line @typescript-eslint/no-explicit-any
469
536
  .x((d)=>xScale(d.xVal))// eslint-disable-next-line @typescript-eslint/no-explicit-any
470
537
  .y0((d)=>yScale(d.values[0]))// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -492,15 +559,15 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
492
559
  id: `${index}-line-${_uniqueIdForGraph}`,
493
560
  d: line(singleStackedData),
494
561
  fill: 'transparent',
495
- strokeWidth: (_points_index_lineOptions_strokeWidth = (_points_index_lineOptions1 = points[index].lineOptions) === null || _points_index_lineOptions1 === void 0 ? void 0 : _points_index_lineOptions1.strokeWidth) !== null && _points_index_lineOptions_strokeWidth !== void 0 ? _points_index_lineOptions_strokeWidth : 3,
562
+ strokeWidth: (_points_index_lineOptions_strokeWidth = (_points_index2 = points[index]) === null || _points_index2 === void 0 ? void 0 : (_points_index_lineOptions1 = _points_index2.lineOptions) === null || _points_index_lineOptions1 === void 0 ? void 0 : _points_index_lineOptions1.strokeWidth) !== null && _points_index_lineOptions_strokeWidth !== void 0 ? _points_index_lineOptions_strokeWidth : 3,
496
563
  stroke: _colors[index],
497
564
  opacity: _getLineOpacity(points[index].legend),
498
565
  onMouseMove: (event)=>_onRectMouseMove(event),
499
566
  onMouseOut: _onRectMouseOut,
500
567
  onMouseOver: (event)=>_onRectMouseMove(event),
501
- strokeDasharray: (_points_index_lineOptions2 = points[index].lineOptions) === null || _points_index_lineOptions2 === void 0 ? void 0 : _points_index_lineOptions2.strokeDasharray,
502
- strokeDashoffset: (_points_index_lineOptions3 = points[index].lineOptions) === null || _points_index_lineOptions3 === void 0 ? void 0 : _points_index_lineOptions3.strokeDashoffset,
503
- strokeLinecap: (_points_index_lineOptions4 = points[index].lineOptions) === null || _points_index_lineOptions4 === void 0 ? void 0 : _points_index_lineOptions4.strokeLinecap
568
+ strokeDasharray: (_points_index3 = points[index]) === null || _points_index3 === void 0 ? void 0 : (_points_index_lineOptions2 = _points_index3.lineOptions) === null || _points_index_lineOptions2 === void 0 ? void 0 : _points_index_lineOptions2.strokeDasharray,
569
+ strokeDashoffset: (_points_index4 = points[index]) === null || _points_index4 === void 0 ? void 0 : (_points_index_lineOptions3 = _points_index4.lineOptions) === null || _points_index_lineOptions3 === void 0 ? void 0 : _points_index_lineOptions3.strokeDashoffset,
570
+ strokeLinecap: (_points_index5 = points[index]) === null || _points_index5 === void 0 ? void 0 : (_points_index_lineOptions4 = _points_index5.lineOptions) === null || _points_index_lineOptions4 === void 0 ? void 0 : _points_index_lineOptions4.strokeLinecap
504
571
  }), singleStackedData.length === 1 ? /*#__PURE__*/ React.createElement("circle", {
505
572
  id: `${index}-graph-${_uniqueIdForGraph}`,
506
573
  cx: xScale(singleStackedData[0].xVal),
@@ -534,10 +601,11 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
534
601
  const circleRadius = pointOptions && pointOptions.r ? Number(pointOptions.r) : 8;
535
602
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
536
603
  _data.forEach((singleStackedData, index)=>{
604
+ var _points_index;
537
605
  if (points.length === index) {
538
606
  return;
539
607
  }
540
- const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
608
+ const yScale = ((_points_index = points[index]) === null || _points_index === void 0 ? void 0 : _points_index.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
541
609
  if (!props.optimizeLargeData || singleStackedData.length === 1) {
542
610
  // Render circles for all data points
543
611
  graph.push(/*#__PURE__*/ React.createElement("g", {
@@ -561,13 +629,13 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
561
629
  fill: _updateCircleFillColor(xDataPoint, lineColor, circleId),
562
630
  onMouseOut: _onRectMouseOut,
563
631
  onMouseOver: (event)=>_onRectMouseMove(event),
564
- onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
632
+ ..._getOnClickHandler(points, index, pointIndex),
565
633
  onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
566
634
  onBlur: _handleBlur,
567
635
  ...getSecureProps(pointOptions),
568
636
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend),
569
637
  role: "img",
570
- "aria-label": _getAriaLabel(index, pointIndex)
638
+ "aria-label": !_hasDuplicateXValues && !_hasMissingXValues && _getAriaLabel(index, pointIndex) || undefined
571
639
  });
572
640
  })));
573
641
  } else {
@@ -589,7 +657,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
589
657
  onMouseOut: _onRectMouseOut,
590
658
  onMouseOver: (event)=>_onRectMouseMove(event),
591
659
  onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
592
- onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
660
+ ..._getOnClickHandler(points, index, pointIndex),
593
661
  ...getSecureProps(pointOptions),
594
662
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend)
595
663
  }));
@@ -636,6 +704,14 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
636
704
  }
637
705
  return graph;
638
706
  }
707
+ function _getOnClickHandler(points, index, pointIndex) {
708
+ if (!_hasDuplicateXValues && !_hasMissingXValues) {
709
+ return {
710
+ onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick)
711
+ };
712
+ }
713
+ return {};
714
+ }
639
715
  function _getCircleRadius(xDataPoint, circleRadius, circleId, legend) {
640
716
  // Show the circle if no legends are selected or if the point's legend is in the selected legends
641
717
  if (!_noLegendHighlighted() && !_legendHighlighted(legend)) {
@@ -668,6 +744,36 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
668
744
  ] : [];
669
745
  }
670
746
  function _addDefaultColors(lineChartData) {
747
+ if (_hasMissingXValues) {
748
+ // get union of all x values
749
+ const allXValues = new Set();
750
+ lineChartData && lineChartData.forEach((line)=>{
751
+ line.data.forEach((point)=>{
752
+ const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
753
+ allXValues.add(xValue);
754
+ });
755
+ });
756
+ lineChartData && lineChartData.forEach((line)=>{
757
+ allXValues.forEach((xValue)=>{
758
+ const point = line.data.find((item)=>{
759
+ return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
760
+ });
761
+ if (!point) {
762
+ line.data.push({
763
+ x: typeof xValue === 'string' ? new Date(xValue) : xValue,
764
+ y: 0,
765
+ legend: line.legend
766
+ });
767
+ }
768
+ });
769
+ // sort the data points by x value
770
+ line.data.sort((a, b)=>{
771
+ const xA = a.x instanceof Date ? a.x.getTime() : a.x;
772
+ const xB = b.x instanceof Date ? b.x.getTime() : b.x;
773
+ return xA < xB ? -1 : xA > xB ? 1 : 0;
774
+ });
775
+ });
776
+ }
671
777
  return lineChartData ? lineChartData.map((item, index)=>{
672
778
  let color;
673
779
  // isInverted property is applicable to v8 themes only
@@ -740,6 +846,52 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
740
846
  const { chartTitle, lineChartData } = props.data;
741
847
  return (chartTitle ? `${chartTitle}. ` : '') + `Area chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} data series. `;
742
848
  }
849
+ function _xCoordinateContainsMultipleY() {
850
+ const { lineChartData } = props.data;
851
+ if (!lineChartData) {
852
+ return false;
853
+ }
854
+ for (const item of lineChartData){
855
+ const xValueMap = {};
856
+ for (const point of item.data){
857
+ const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
858
+ if (!xValueMap[xValue]) {
859
+ xValueMap[xValue] = [];
860
+ }
861
+ xValueMap[xValue].push(point.y);
862
+ if (xValueMap[xValue].length > 1) {
863
+ return true;
864
+ }
865
+ }
866
+ }
867
+ return false;
868
+ }
869
+ function _containsMissingXValues() {
870
+ const { lineChartData } = props.data;
871
+ if (!lineChartData) {
872
+ return false;
873
+ }
874
+ const allXValues = new Set();
875
+ lineChartData.forEach((line)=>{
876
+ line.data.forEach((point)=>{
877
+ const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
878
+ allXValues.add(xValue);
879
+ });
880
+ });
881
+ // for all x values, check if the x value is present in all series
882
+ let hasMissingValues = false;
883
+ lineChartData.forEach((line)=>{
884
+ allXValues.forEach((xValue)=>{
885
+ const point = line.data.find((item)=>{
886
+ return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
887
+ });
888
+ if (!point) {
889
+ hasMissingValues = true;
890
+ }
891
+ });
892
+ });
893
+ return hasMissingValues;
894
+ }
743
895
  function _shouldFillToZeroY() {
744
896
  return props.mode === 'tozeroy' || _containsSecondaryYAxis;
745
897
  }
@@ -765,7 +917,7 @@ export const AreaChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
765
917
  xAxisCalloutAccessibilityData,
766
918
  ...props.calloutProps,
767
919
  clickPosition,
768
- isPopoverOpen,
920
+ isPopoverOpen: isPopoverOpen && !_hasDuplicateXValues && !_hasMissingXValues,
769
921
  isCartesian: true,
770
922
  customCallout: {
771
923
  customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,