@fluentui/react-charts 9.3.3 → 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 (89) hide show
  1. package/CHANGELOG.md +27 -7
  2. package/dist/index.d.ts +4 -0
  3. package/lib/components/AreaChart/AreaChart.js +188 -36
  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/useCartesianChartStyles.styles.js +3 -2
  14. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  15. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  17. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +3 -2
  18. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  19. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  20. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  21. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -63
  22. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  23. package/lib/components/DonutChart/useDonutChartStyles.styles.js +3 -2
  24. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  25. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  26. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  27. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +3 -2
  28. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  29. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  30. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  31. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +3 -2
  32. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  33. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  34. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  35. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +3 -2
  36. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  37. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  38. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  39. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +3 -2
  40. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  41. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  42. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  43. package/lib/types/DataPoint.js.map +1 -1
  44. package/lib/utilities/utilities.js +63 -18
  45. package/lib/utilities/utilities.js.map +1 -1
  46. package/lib-commonjs/components/AreaChart/AreaChart.js +188 -36
  47. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  48. package/lib-commonjs/components/ChartTable/ChartTable.js +13 -12
  49. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  50. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +3 -3
  51. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  52. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +2 -2
  53. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  54. package/lib-commonjs/components/CommonComponents/CartesianChart.js +5 -6
  55. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  56. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -1
  57. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  58. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +2 -1
  59. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  60. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +7 -1
  61. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  62. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  63. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  64. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +106 -63
  65. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  66. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +7 -1
  67. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  68. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +2 -1
  69. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  70. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +7 -1
  71. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  72. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +2 -1
  73. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  74. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +7 -1
  75. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  76. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -1
  77. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  78. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -1
  79. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  80. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +2 -1
  81. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  82. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +7 -1
  83. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  84. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -1
  85. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  86. package/lib-commonjs/types/DataPoint.js.map +1 -1
  87. package/lib-commonjs/utilities/utilities.js +63 -18
  88. package/lib-commonjs/utilities/utilities.js.map +1 -1
  89. 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;
@@ -277,7 +279,7 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
277
279
  };
278
280
  }
279
281
  function _createDataSet(points) {
280
- if (props.enablePerfOptimization && _enableComputationOptimization) {
282
+ if (props.enablePerfOptimization && _enableComputationOptimization && !_hasDuplicateXValues) {
281
283
  const allChartPoints = [];
282
284
  const dataSet = [];
283
285
  const colors = [];
@@ -332,35 +334,50 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
332
334
  const colors = [];
333
335
  const opacity = [];
334
336
  const calloutPoints = (0, _index1.calloutData)(points);
337
+ let data = {};
338
+ const keys = [];
339
+ let index = 0;
335
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
+ });
336
349
  colors.push(singleChartPoint.color);
337
350
  opacity.push(singleChartPoint.opacity || 1);
338
351
  allChartPoints.push(...singleChartPoint.data);
339
352
  });
340
- let tempArr = allChartPoints;
341
- while(tempArr.length){
342
- const valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
343
- const filteredChartPoints = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck);
344
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
345
- const singleDataset = {};
346
- filteredChartPoints.forEach((singleDataPoint, index)=>{
347
- singleDataset.xVal = singleDataPoint.x;
348
- singleDataset[`chart${index}`] = singleDataPoint.y;
349
- });
350
- dataSet.push(singleDataset);
351
- // removing compared objects from array
352
- const val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
353
- tempArr = tempArr.filter((point)=>(point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val);
354
- }
355
- // get keys from dataset, used to create stacked data
356
- const keysLength = dataSet && Object.keys(dataSet[0]).length;
357
- const keys = [];
358
- for(let i = 0; i < keysLength - 1; i++){
359
- const keyVal = `chart${i}`;
360
- 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);
361
380
  }
362
- // Data used to draw graph
363
- const data = _getDataPoints(keys, dataSet);
364
381
  return {
365
382
  colors,
366
383
  opacity,
@@ -370,6 +387,56 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
370
387
  };
371
388
  }
372
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
+ }
373
440
  function _getCustomizedCallout() {
374
441
  return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
375
442
  }
@@ -467,9 +534,9 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
467
534
  let lineColor;
468
535
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
469
536
  _data.forEach((singleStackedData, index)=>{
470
- var _points_index_lineOptions, _points_index_lineOptions1, _points_index_lineOptions2, _points_index_lineOptions3, _points_index_lineOptions4;
471
- const yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
472
- 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);
473
540
  const area = (0, _d3shape.area)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
474
541
  .x((d)=>xScale(d.xVal)) // eslint-disable-next-line @typescript-eslint/no-explicit-any
475
542
  .y0((d)=>yScale(d.values[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -497,15 +564,15 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
497
564
  id: `${index}-line-${_uniqueIdForGraph}`,
498
565
  d: line(singleStackedData),
499
566
  fill: 'transparent',
500
- 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,
501
568
  stroke: _colors[index],
502
569
  opacity: _getLineOpacity(points[index].legend),
503
570
  onMouseMove: (event)=>_onRectMouseMove(event),
504
571
  onMouseOut: _onRectMouseOut,
505
572
  onMouseOver: (event)=>_onRectMouseMove(event),
506
- strokeDasharray: (_points_index_lineOptions2 = points[index].lineOptions) === null || _points_index_lineOptions2 === void 0 ? void 0 : _points_index_lineOptions2.strokeDasharray,
507
- strokeDashoffset: (_points_index_lineOptions3 = points[index].lineOptions) === null || _points_index_lineOptions3 === void 0 ? void 0 : _points_index_lineOptions3.strokeDashoffset,
508
- 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
509
576
  }), singleStackedData.length === 1 ? /*#__PURE__*/ _react.createElement("circle", {
510
577
  id: `${index}-graph-${_uniqueIdForGraph}`,
511
578
  cx: xScale(singleStackedData[0].xVal),
@@ -539,10 +606,11 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
539
606
  const circleRadius = pointOptions && pointOptions.r ? Number(pointOptions.r) : 8;
540
607
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
541
608
  _data.forEach((singleStackedData, index)=>{
609
+ var _points_index;
542
610
  if (points.length === index) {
543
611
  return;
544
612
  }
545
- 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;
546
614
  if (!props.optimizeLargeData || singleStackedData.length === 1) {
547
615
  // Render circles for all data points
548
616
  graph.push(/*#__PURE__*/ _react.createElement("g", {
@@ -566,13 +634,13 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
566
634
  fill: _updateCircleFillColor(xDataPoint, lineColor, circleId),
567
635
  onMouseOut: _onRectMouseOut,
568
636
  onMouseOver: (event)=>_onRectMouseMove(event),
569
- onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
637
+ ..._getOnClickHandler(points, index, pointIndex),
570
638
  onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
571
639
  onBlur: _handleBlur,
572
640
  ...(0, _index1.getSecureProps)(pointOptions),
573
641
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend),
574
642
  role: "img",
575
- "aria-label": _getAriaLabel(index, pointIndex)
643
+ "aria-label": !_hasDuplicateXValues && !_hasMissingXValues && _getAriaLabel(index, pointIndex) || undefined
576
644
  });
577
645
  })));
578
646
  } else {
@@ -594,7 +662,7 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
594
662
  onMouseOut: _onRectMouseOut,
595
663
  onMouseOver: (event)=>_onRectMouseMove(event),
596
664
  onFocus: (event)=>_handleFocus(event, index, pointIndex, circleId),
597
- onClick: ()=>_onDataPointClick(points[index].data[pointIndex].onDataPointClick),
665
+ ..._getOnClickHandler(points, index, pointIndex),
598
666
  ...(0, _index1.getSecureProps)(pointOptions),
599
667
  r: _getCircleRadius(xDataPoint, circleRadius, circleId, legend)
600
668
  }));
@@ -641,6 +709,14 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
641
709
  }
642
710
  return graph;
643
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
+ }
644
720
  function _getCircleRadius(xDataPoint, circleRadius, circleId, legend) {
645
721
  // Show the circle if no legends are selected or if the point's legend is in the selected legends
646
722
  if (!_noLegendHighlighted() && !_legendHighlighted(legend)) {
@@ -673,6 +749,36 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
673
749
  ] : [];
674
750
  }
675
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
+ }
676
782
  return lineChartData ? lineChartData.map((item, index)=>{
677
783
  let color;
678
784
  // isInverted property is applicable to v8 themes only
@@ -745,6 +851,52 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
745
851
  const { chartTitle, lineChartData } = props.data;
746
852
  return (chartTitle ? `${chartTitle}. ` : '') + `Area chart with ${(lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0} data series. `;
747
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
+ }
748
900
  function _shouldFillToZeroY() {
749
901
  return props.mode === 'tozeroy' || _containsSecondaryYAxis;
750
902
  }
@@ -770,7 +922,7 @@ const AreaChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
770
922
  xAxisCalloutAccessibilityData,
771
923
  ...props.calloutProps,
772
924
  clickPosition,
773
- isPopoverOpen,
925
+ isPopoverOpen: isPopoverOpen && !_hasDuplicateXValues && !_hasMissingXValues,
774
926
  isCartesian: true,
775
927
  customCallout: {
776
928
  customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,