@fluentui/react-charts 9.3.2 → 9.3.4

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 (145) hide show
  1. package/CHANGELOG.md +47 -2
  2. package/dist/index.d.ts +151 -1
  3. package/lib/components/AreaChart/AreaChart.js +208 -60
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/ChartTable/ChartTable.js +14 -12
  6. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  7. package/lib/components/ChartTable/useChartTableStyles.styles.js +3 -3
  8. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  9. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
  10. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.js +5 -6
  12. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  13. package/lib/components/CommonComponents/ChartPopover.js +2 -1
  14. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  15. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +3 -2
  17. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  18. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  19. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  20. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +3 -2
  21. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  22. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  23. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  24. package/lib/components/DeclarativeChart/DeclarativeChart.js +16 -7
  25. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  26. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +63 -18
  27. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  28. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +471 -207
  29. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  30. package/lib/components/DonutChart/Arc/Arc.js +8 -7
  31. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  32. package/lib/components/DonutChart/DonutChart.js +16 -32
  33. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  34. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  35. package/lib/components/DonutChart/Pie/Pie.js +4 -4
  36. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  37. package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -2
  38. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  39. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  40. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  41. package/lib/components/FunnelChart/FunnelChart.js +23 -45
  42. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  43. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +3 -2
  44. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  45. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  46. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  47. package/lib/components/GaugeChart/GaugeChart.js +21 -46
  48. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  49. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +3 -2
  50. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  51. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  52. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  53. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +332 -114
  54. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  55. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  56. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +3 -2
  57. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  58. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  59. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  60. package/lib/components/Legends/Legends.js +1 -1
  61. package/lib/components/Legends/Legends.js.map +1 -1
  62. package/lib/components/LineChart/LineChart.js +145 -97
  63. package/lib/components/LineChart/LineChart.js.map +1 -1
  64. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -2
  65. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  66. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  67. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  68. package/lib/components/ScatterChart/ScatterChart.js +7 -11
  69. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  70. package/lib/types/DataPoint.js +1 -3
  71. package/lib/types/DataPoint.js.map +1 -1
  72. package/lib/utilities/utilities.js +77 -26
  73. package/lib/utilities/utilities.js.map +1 -1
  74. package/lib-commonjs/components/AreaChart/AreaChart.js +207 -59
  75. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  76. package/lib-commonjs/components/ChartTable/ChartTable.js +13 -12
  77. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  78. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +3 -3
  79. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  80. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
  81. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  82. package/lib-commonjs/components/CommonComponents/CartesianChart.js +5 -6
  83. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  84. package/lib-commonjs/components/CommonComponents/ChartPopover.js +2 -1
  85. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  86. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  87. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -1
  88. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  89. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  90. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  91. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +7 -1
  92. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  93. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  94. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  95. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +16 -7
  96. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  97. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +65 -18
  98. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  99. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +470 -206
  100. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  101. package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -7
  102. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  103. package/lib-commonjs/components/DonutChart/DonutChart.js +16 -32
  104. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  105. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  106. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -4
  107. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  108. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +7 -1
  109. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  110. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  111. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  112. package/lib-commonjs/components/FunnelChart/FunnelChart.js +23 -45
  113. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  114. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +7 -1
  115. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  116. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  117. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  118. package/lib-commonjs/components/GaugeChart/GaugeChart.js +21 -46
  119. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  120. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +7 -1
  121. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  122. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  123. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  124. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +329 -112
  125. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  126. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  127. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -1
  128. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  129. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  130. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  131. package/lib-commonjs/components/Legends/Legends.js +1 -1
  132. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  133. package/lib-commonjs/components/LineChart/LineChart.js +144 -96
  134. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  135. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +7 -1
  136. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  137. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  138. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  139. package/lib-commonjs/components/ScatterChart/ScatterChart.js +6 -10
  140. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  141. package/lib-commonjs/types/DataPoint.js +1 -3
  142. package/lib-commonjs/types/DataPoint.js.map +1 -1
  143. package/lib-commonjs/utilities/utilities.js +80 -26
  144. package/lib-commonjs/utilities/utilities.js.map +1 -1
  145. package/package.json +13 -13
@@ -42,6 +42,8 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
42
42
  const _firstRenderOptimization = true;
43
43
  const _emptyChartId = (0, _reactutilities.useId)('_AreaChart_empty');
44
44
  let _containsSecondaryYAxis = false;
45
+ let _hasMissingXValues = _containsMissingXValues();
46
+ let _hasDuplicateXValues = _xCoordinateContainsMultipleY();
45
47
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
48
  let _calloutPoints;
47
49
  let _createSet;
@@ -170,11 +172,7 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
170
172
  // eslint-disable-next-line @typescript-eslint/no-shadow
171
173
  const { xAxisCalloutData, xAxisCalloutAccessibilityData } = lineChartData[0].data[index];
172
174
  const formattedDate = pointToHighlight instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(pointToHighlight, props.culture, props.useUTC) : pointToHighlight;
173
- const modifiedXVal = pointToHighlight instanceof Date ? pointToHighlight.getTime() : pointToHighlight;
174
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
175
- const found = (0, _index1.find)(_calloutPoints, (element)=>{
176
- return element.x === modifiedXVal;
177
- });
175
+ const found = (0, _index1.findCalloutPoints)(_calloutPoints, pointToHighlight);
178
176
  // eslint-disable-next-line @typescript-eslint/no-shadow
179
177
  const _nearestCircleToHighlight = axisType === _index1.XAxisTypes.DateAxis ? pointToHighlight.getTime() : pointToHighlight;
180
178
  // if no points need to be called out then don't show vertical line and callout card
@@ -281,7 +279,7 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
281
279
  };
282
280
  }
283
281
  function _createDataSet(points) {
284
- if (props.enablePerfOptimization && _enableComputationOptimization) {
282
+ if (props.enablePerfOptimization && _enableComputationOptimization && !_hasDuplicateXValues) {
285
283
  const allChartPoints = [];
286
284
  const dataSet = [];
287
285
  const colors = [];
@@ -336,35 +334,50 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
336
334
  const colors = [];
337
335
  const opacity = [];
338
336
  const calloutPoints = (0, _index1.calloutData)(points);
337
+ let data = {};
338
+ const keys = [];
339
+ let index = 0;
339
340
  points && points.length && points.forEach((singleChartPoint)=>{
341
+ // if legend is not populated, then assign a legend
342
+ if (_hasDuplicateXValues && !singleChartPoint.legend) {
343
+ singleChartPoint.legend = `chart${index}`;
344
+ ++index;
345
+ }
346
+ singleChartPoint.data.forEach((point)=>{
347
+ point.legend = singleChartPoint.legend;
348
+ });
340
349
  colors.push(singleChartPoint.color);
341
350
  opacity.push(singleChartPoint.opacity || 1);
342
351
  allChartPoints.push(...singleChartPoint.data);
343
352
  });
344
- let tempArr = allChartPoints;
345
- while(tempArr.length){
346
- const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
347
- const filteredChartPoints = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck);
348
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
349
- const singleDataset = {};
350
- filteredChartPoints.forEach((singleDataPoint, index)=>{
351
- singleDataset.xVal = singleDataPoint.x;
352
- singleDataset[`chart${index}`] = singleDataPoint.y;
353
- });
354
- dataSet.push(singleDataset);
355
- // removing compared objects from array
356
- const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
357
- tempArr = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val);
358
- }
359
- // get keys from dataset, used to create stacked data
360
- const keysLength = dataSet && Object.keys(dataSet[0]).length;
361
- const keys = [];
362
- for(let i = 0; i < keysLength - 1; i++){
363
- const keyVal = `chart${i}`;
364
- keys.push(keyVal);
353
+ if (!_hasDuplicateXValues) {
354
+ let tempArr = allChartPoints;
355
+ while(tempArr.length){
356
+ const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
357
+ const filteredChartPoints = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck);
358
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
359
+ const singleDataset = {};
360
+ filteredChartPoints.forEach((singleDataPoint, id)=>{
361
+ singleDataset.xVal = singleDataPoint.x;
362
+ singleDataset[`chart${id}`] = singleDataPoint.y;
363
+ });
364
+ dataSet.push(singleDataset);
365
+ // removing compared objects from array
366
+ const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
367
+ tempArr = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val);
368
+ }
369
+ // get keys from dataset, used to create stacked data
370
+ const keysLength = dataSet && Object.keys(dataSet[0]).length;
371
+ for(let i = 0; i < keysLength - 1; i++){
372
+ const keyVal = `chart${i}`;
373
+ keys.push(keyVal);
374
+ }
375
+ // Data used to draw graph
376
+ data = _getDataPoints(keys, dataSet);
377
+ } else {
378
+ const datasetForDuplicateValues = _createDatasetForXCoordinateWithMultipleYValues(allChartPoints);
379
+ data = _getDataPoints(datasetForDuplicateValues.keys, datasetForDuplicateValues.filteredDataSet);
365
380
  }
366
- // Data used to draw graph
367
- const data = _getDataPoints(keys, dataSet);
368
381
  return {
369
382
  colors,
370
383
  opacity,
@@ -374,6 +387,56 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
374
387
  };
375
388
  }
376
389
  }
390
+ function _createDatasetForXCoordinateWithMultipleYValues(allChartPoints) {
391
+ const dataSet = [];
392
+ // Group data points by x-axis value
393
+ const groupedData = {};
394
+ allChartPoints.forEach((dataPoint)=>{
395
+ const xValue = dataPoint.x instanceof Date ? dataPoint.x.toLocaleString() : dataPoint.x;
396
+ if (!groupedData[xValue]) {
397
+ groupedData[xValue] = [];
398
+ }
399
+ groupedData[xValue].push(dataPoint);
400
+ });
401
+ // Aggregate data points for each x-axis value
402
+ Object.keys(groupedData).forEach((xValue)=>{
403
+ const dataPoints = groupedData[xValue];
404
+ dataPoints.forEach((dataPoint, id)=>{
405
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
406
+ const singleDataset = {
407
+ xVal: dataPoints[0].x
408
+ };
409
+ const key = dataPoint.legend ? dataPoint.legend : `chart${id}`;
410
+ singleDataset[key] = dataPoint.y;
411
+ dataSet.push(singleDataset);
412
+ });
413
+ });
414
+ // get all unique keys from each array within the dataSet
415
+ const allLegends = [];
416
+ dataSet.forEach((item)=>{
417
+ Object.keys(item).forEach((key)=>{
418
+ if (key !== 'xVal' && !allLegends.includes(key)) {
419
+ allLegends.push(key);
420
+ }
421
+ });
422
+ });
423
+ dataSet.forEach((item)=>{
424
+ allLegends.forEach((legend)=>{
425
+ if (!item[legend]) {
426
+ item[legend] = 0; // Fill with 0 if the legend is missing
427
+ }
428
+ });
429
+ });
430
+ // exclude all items within dataset having all legend values 0
431
+ const filteredDataSet = dataSet.filter((item)=>{
432
+ return allLegends.some((legend)=>item[legend] !== 0);
433
+ });
434
+ const keys = Array.from(new Set(filteredDataSet.flatMap((item)=>Object.keys(item).filter((key)=>key !== 'xVal'))));
435
+ return {
436
+ keys,
437
+ filteredDataSet
438
+ };
439
+ }
377
440
  function _getCustomizedCallout() {
378
441
  return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
379
442
  }
@@ -471,9 +534,9 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
471
534
  let lineColor;
472
535
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
473
536
  _data.forEach((singleStackedData, index)=>{
474
- var _points_index_lineOptions, _points_index_lineOptions1, _points_index_lineOptions2, _points_index_lineOptions3, _points_index_lineOptions4;
475
- const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
476
- const curveFactory = (0, _index1.getCurveFactory)((_points_index_lineOptions = points[index].lineOptions) === null || _points_index_lineOptions === void 0 ? void 0 : _points_index_lineOptions.curve, _d3shape.curveMonotoneX);
537
+ 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;
538
+ const yScale = ((_points_index = points[index]) === null || _points_index === void 0 ? void 0 : _points_index.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
539
+ const curveFactory = (0, _index1.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, _d3shape.curveMonotoneX);
477
540
  const area = (0, _d3shape.area)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
478
541
  .x((d)=>xScale(d.xVal)) // eslint-disable-next-line @typescript-eslint/no-explicit-any
479
542
  .y0((d)=>yScale(d.values[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -501,15 +564,15 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
501
564
  id: `${index}-line-${_uniqueIdForGraph}`,
502
565
  d: line(singleStackedData),
503
566
  fill: 'transparent',
504
- 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,
567
+ 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,
505
568
  stroke: _colors[index],
506
569
  opacity: _getLineOpacity(points[index].legend),
507
570
  onMouseMove: (event)=>_onRectMouseMove(event),
508
571
  onMouseOut: _onRectMouseOut,
509
572
  onMouseOver: (event)=>_onRectMouseMove(event),
510
- strokeDasharray: (_points_index_lineOptions2 = points[index].lineOptions) === null || _points_index_lineOptions2 === void 0 ? void 0 : _points_index_lineOptions2.strokeDasharray,
511
- strokeDashoffset: (_points_index_lineOptions3 = points[index].lineOptions) === null || _points_index_lineOptions3 === void 0 ? void 0 : _points_index_lineOptions3.strokeDashoffset,
512
- strokeLinecap: (_points_index_lineOptions4 = points[index].lineOptions) === null || _points_index_lineOptions4 === void 0 ? void 0 : _points_index_lineOptions4.strokeLinecap
573
+ 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,
574
+ 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,
575
+ 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
513
576
  }), singleStackedData.length === 1 ? /*#__PURE__*/ _react.createElement("circle", {
514
577
  id: `${index}-graph-${_uniqueIdForGraph}`,
515
578
  cx: xScale(singleStackedData[0].xVal),
@@ -543,10 +606,11 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
543
606
  const circleRadius = pointOptions && pointOptions.r ? Number(pointOptions.r) : 8;
544
607
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
545
608
  _data.forEach((singleStackedData, index)=>{
609
+ var _points_index;
546
610
  if (points.length === index) {
547
611
  return;
548
612
  }
549
- const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
613
+ const yScale = ((_points_index = points[index]) === null || _points_index === void 0 ? void 0 : _points_index.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
550
614
  if (!props.optimizeLargeData || singleStackedData.length === 1) {
551
615
  // Render circles for all data points
552
616
  graph.push(/*#__PURE__*/ _react.createElement("g", {
@@ -570,13 +634,13 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
570
634
  fill: _updateCircleFillColor(xDataPoint, lineColor, circleId),
571
635
  onMouseOut: _onRectMouseOut,
572
636
  onMouseOver: (event)=>_onRectMouseMove(event),
573
- onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
637
+ ..._getOnClickHandler(points, index, pointIndex),
574
638
  onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
575
639
  onBlur: _handleBlur,
576
640
  ...(0, _index1.getSecureProps)(pointOptions),
577
641
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend),
578
642
  role: "img",
579
- "aria-label": _getAriaLabel(index, pointIndex)
643
+ "aria-label": !_hasDuplicateXValues && !_hasMissingXValues && _getAriaLabel(index, pointIndex) || undefined
580
644
  });
581
645
  })));
582
646
  } else {
@@ -598,7 +662,7 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
598
662
  onMouseOut: _onRectMouseOut,
599
663
  onMouseOver: (event)=>_onRectMouseMove(event),
600
664
  onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
601
- onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
665
+ ..._getOnClickHandler(points, index, pointIndex),
602
666
  ...(0, _index1.getSecureProps)(pointOptions),
603
667
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend)
604
668
  }));
@@ -645,6 +709,14 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
645
709
  }
646
710
  return graph;
647
711
  }
712
+ function _getOnClickHandler(points, index, pointIndex) {
713
+ if (!_hasDuplicateXValues && !_hasMissingXValues) {
714
+ return {
715
+ onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick)
716
+ };
717
+ }
718
+ return {};
719
+ }
648
720
  function _getCircleRadius(xDataPoint, circleRadius, circleId, legend) {
649
721
  // Show the circle if no legends are selected or if the point's legend is in the selected legends
650
722
  if (!_noLegendHighlighted() && !_legendHighlighted(legend)) {
@@ -677,6 +749,36 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
677
749
  ] : [];
678
750
  }
679
751
  function _addDefaultColors(lineChartData) {
752
+ if (_hasMissingXValues) {
753
+ // get union of all x values
754
+ const allXValues = new Set();
755
+ lineChartData && lineChartData.forEach((line)=>{
756
+ line.data.forEach((point)=>{
757
+ const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
758
+ allXValues.add(xValue);
759
+ });
760
+ });
761
+ lineChartData && lineChartData.forEach((line)=>{
762
+ allXValues.forEach((xValue)=>{
763
+ const point = line.data.find((item)=>{
764
+ return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
765
+ });
766
+ if (!point) {
767
+ line.data.push({
768
+ x: typeof xValue === 'string' ? new Date(xValue) : xValue,
769
+ y: 0,
770
+ legend: line.legend
771
+ });
772
+ }
773
+ });
774
+ // sort the data points by x value
775
+ line.data.sort((a, b)=>{
776
+ const xA = a.x instanceof Date ? a.x.getTime() : a.x;
777
+ const xB = b.x instanceof Date ? b.x.getTime() : b.x;
778
+ return xA < xB ? -1 : xA > xB ? 1 : 0;
779
+ });
780
+ });
781
+ }
680
782
  return lineChartData ? lineChartData.map((item, index)=>{
681
783
  let color;
682
784
  // isInverted property is applicable to v8 themes only
@@ -700,24 +802,24 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
700
802
  _updatePosition(cx, cy);
701
803
  const { x, y, xAxisCalloutData } = props.data.lineChartData[lineIndex].data[pointIndex];
702
804
  const formattedDate = x instanceof Date ? (0, _chartutilities.formatDateToLocaleString)(x, props.culture, props.useUTC) : x;
703
- const modifiedXVal = x instanceof Date ? x.getTime() : x;
704
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
705
- const found = _calloutPoints.find((e)=>e.x === modifiedXVal);
706
- // Show details in the callout for the focused point only
707
- found.values = found.values.filter((e)=>e.y === y);
708
- const filteredValues = _getFilteredLegendValues(found.values);
709
- setPopoverOpen(true);
710
- setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);
711
- setYValueHover(filteredValues);
712
- setStackCalloutProps({
713
- ...found,
714
- values: filteredValues
715
- });
716
- setDataPointCalloutProps({
717
- ...found,
718
- values: filteredValues
719
- });
720
- setActivePoint(circleId);
805
+ const found = (0, _index1.findCalloutPoints)(_calloutPoints, x);
806
+ if (found) {
807
+ // Show details in the callout for the focused point only
808
+ found.values = found.values.filter((e)=>e.y === y);
809
+ const filteredValues = _getFilteredLegendValues(found.values);
810
+ setPopoverOpen(true);
811
+ setHoverXValue(xAxisCalloutData ? xAxisCalloutData : formattedDate);
812
+ setYValueHover(filteredValues);
813
+ setStackCalloutProps({
814
+ ...found,
815
+ values: filteredValues
816
+ });
817
+ setDataPointCalloutProps({
818
+ ...found,
819
+ values: filteredValues
820
+ });
821
+ setActivePoint(circleId);
822
+ }
721
823
  }
722
824
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
723
825
  function _getFilteredLegendValues(values) {
@@ -749,6 +851,52 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
749
851
  const { chartTitle, lineChartData } = props.data;
750
852
  return (chartTitle ? `${chartTitle}. ` : '') + `Area chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} data series. `;
751
853
  }
854
+ function _xCoordinateContainsMultipleY() {
855
+ const { lineChartData } = props.data;
856
+ if (!lineChartData) {
857
+ return false;
858
+ }
859
+ for (const item of lineChartData){
860
+ const xValueMap = {};
861
+ for (const point of item.data){
862
+ const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
863
+ if (!xValueMap[xValue]) {
864
+ xValueMap[xValue] = [];
865
+ }
866
+ xValueMap[xValue].push(point.y);
867
+ if (xValueMap[xValue].length > 1) {
868
+ return true;
869
+ }
870
+ }
871
+ }
872
+ return false;
873
+ }
874
+ function _containsMissingXValues() {
875
+ const { lineChartData } = props.data;
876
+ if (!lineChartData) {
877
+ return false;
878
+ }
879
+ const allXValues = new Set();
880
+ lineChartData.forEach((line)=>{
881
+ line.data.forEach((point)=>{
882
+ const xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
883
+ allXValues.add(xValue);
884
+ });
885
+ });
886
+ // for all x values, check if the x value is present in all series
887
+ let hasMissingValues = false;
888
+ lineChartData.forEach((line)=>{
889
+ allXValues.forEach((xValue)=>{
890
+ const point = line.data.find((item)=>{
891
+ return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
892
+ });
893
+ if (!point) {
894
+ hasMissingValues = true;
895
+ }
896
+ });
897
+ });
898
+ return hasMissingValues;
899
+ }
752
900
  function _shouldFillToZeroY() {
753
901
  return props.mode === 'tozeroy' || _containsSecondaryYAxis;
754
902
  }
@@ -774,7 +922,7 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
774
922
  xAxisCalloutAccessibilityData,
775
923
  ...props.calloutProps,
776
924
  clickPosition,
777
- isPopoverOpen,
925
+ isPopoverOpen: isPopoverOpen && !_hasDuplicateXValues && !_hasMissingXValues,
778
926
  isCartesian: true,
779
927
  customCallout: {
780
928
  customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,