@fluentui/react-charting 5.23.80 → 5.23.82

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 (62) hide show
  1. package/CHANGELOG.json +61 -1
  2. package/CHANGELOG.md +25 -2
  3. package/dist/react-charting.js +1 -1
  4. package/dist/react-charting.min.js +1 -1
  5. package/lib/components/AreaChart/AreaChart.base.d.ts +6 -0
  6. package/lib/components/AreaChart/AreaChart.base.js +192 -34
  7. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  8. package/lib/components/CommonComponents/CartesianChart.styles.js +15 -15
  9. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  10. package/lib/components/DeclarativeChart/DeclarativeChart.js +3 -0
  11. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +39 -20
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/DonutChart/Pie/Pie.styles.js +3 -3
  15. package/lib/components/DonutChart/Pie/Pie.styles.js.map +1 -1
  16. package/lib/components/GaugeChart/GaugeChart.styles.js +7 -7
  17. package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  18. package/lib/components/PieChart/Arc/Arc.styles.js +2 -2
  19. package/lib/components/PieChart/Arc/Arc.styles.js.map +1 -1
  20. package/lib/components/SankeyChart/SankeyChart.styles.js +7 -7
  21. package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  22. package/lib/utilities/ChartHoverCard/ChartHoverCard.styles.js +5 -5
  23. package/lib/utilities/ChartHoverCard/ChartHoverCard.styles.js.map +1 -1
  24. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +6 -0
  25. package/lib-amd/components/AreaChart/AreaChart.base.js +192 -34
  26. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  27. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +14 -14
  28. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  29. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +3 -0
  30. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  31. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +39 -20
  32. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  33. package/lib-amd/components/DonutChart/Pie/Pie.styles.js +2 -2
  34. package/lib-amd/components/DonutChart/Pie/Pie.styles.js.map +1 -1
  35. package/lib-amd/components/GaugeChart/GaugeChart.styles.js +6 -6
  36. package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  37. package/lib-amd/components/PieChart/Arc/Arc.styles.js +1 -1
  38. package/lib-amd/components/PieChart/Arc/Arc.styles.js.map +1 -1
  39. package/lib-amd/components/SankeyChart/SankeyChart.styles.js +6 -6
  40. package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  41. package/lib-amd/utilities/ChartHoverCard/ChartHoverCard.styles.js +4 -4
  42. package/lib-amd/utilities/ChartHoverCard/ChartHoverCard.styles.js.map +1 -1
  43. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +6 -0
  44. package/lib-commonjs/components/AreaChart/AreaChart.base.js +192 -34
  45. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  46. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +14 -14
  47. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  48. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +3 -0
  49. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  50. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +39 -20
  51. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  52. package/lib-commonjs/components/DonutChart/Pie/Pie.styles.js +2 -2
  53. package/lib-commonjs/components/DonutChart/Pie/Pie.styles.js.map +1 -1
  54. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +6 -6
  55. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  56. package/lib-commonjs/components/PieChart/Arc/Arc.styles.js +1 -1
  57. package/lib-commonjs/components/PieChart/Arc/Arc.styles.js.map +1 -1
  58. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +6 -6
  59. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  60. package/lib-commonjs/utilities/ChartHoverCard/ChartHoverCard.styles.js +4 -4
  61. package/lib-commonjs/utilities/ChartHoverCard/ChartHoverCard.styles.js.map +1 -1
  62. package/package.json +4 -4
@@ -61,6 +61,8 @@ export declare class AreaChartBase extends React.Component<IAreaChartProps, IAre
61
61
  private _cartesianChartRef;
62
62
  private _legendsRef;
63
63
  private _containsSecondaryYAxis;
64
+ private _hasDuplicateXValues;
65
+ private _hasMissingXValues;
64
66
  constructor(props: IAreaChartProps);
65
67
  componentDidUpdate(prevProps: IAreaChartProps): void;
66
68
  render(): JSX.Element;
@@ -76,6 +78,7 @@ export declare class AreaChartBase extends React.Component<IAreaChartProps, IAre
76
78
  private _handleChartMouseLeave;
77
79
  private _getDataPoints;
78
80
  private _createDataSet;
81
+ private _createDatasetForXCoordinateWithMultipleYValues;
79
82
  private _getCustomizedCallout;
80
83
  private _getGraphData;
81
84
  private _onLegendHover;
@@ -87,6 +90,7 @@ export declare class AreaChartBase extends React.Component<IAreaChartProps, IAre
87
90
  private _getLineOpacity;
88
91
  private _updateCircleFillColor;
89
92
  private _drawGraph;
93
+ private _getOnClickHandler;
90
94
  private _getCircleRadius;
91
95
  private _closeCallout;
92
96
  /**
@@ -108,6 +112,8 @@ export declare class AreaChartBase extends React.Component<IAreaChartProps, IAre
108
112
  private _getAriaLabel;
109
113
  private _isChartEmpty;
110
114
  private _getChartTitle;
115
+ private _xCoordinateContainsMultipleY;
116
+ private _containsMissingXValues;
111
117
  private _shouldFillToZeroY;
112
118
  }
113
119
  export {};
@@ -26,6 +26,8 @@ var AreaChartBase = /** @class */ (function (_super) {
26
26
  var _a;
27
27
  var _this = _super.call(this, props) || this;
28
28
  _this._containsSecondaryYAxis = false;
29
+ _this._hasDuplicateXValues = false;
30
+ _this._hasMissingXValues = false;
29
31
  _this.toImage = function (opts) {
30
32
  var _a, _b;
31
33
  return toImage((_a = _this._cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = _this._legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, getRTL(), opts);
@@ -216,7 +218,7 @@ var AreaChartBase = /** @class */ (function (_super) {
216
218
  };
217
219
  };
218
220
  _this._createDataSet = function (points) {
219
- if (_this.props.enablePerfOptimization && _this._enableComputationOptimization) {
221
+ if (_this.props.enablePerfOptimization && _this._enableComputationOptimization && !_this._hasDuplicateXValues) {
220
222
  var allChartPoints_1 = [];
221
223
  var dataSet_1 = [];
222
224
  var colors_1 = [];
@@ -273,40 +275,58 @@ var AreaChartBase = /** @class */ (function (_super) {
273
275
  var colors_2 = [];
274
276
  var opacity_2 = [];
275
277
  var calloutPoints = calloutData(points);
278
+ var data = {};
279
+ var keys = [];
280
+ var index_1 = 0;
276
281
  points &&
277
282
  points.length &&
278
283
  points.forEach(function (singleChartPoint) {
284
+ // if legend is not populated, then assign a legend
285
+ if (_this._hasDuplicateXValues && !singleChartPoint.legend) {
286
+ singleChartPoint.legend = "chart".concat(index_1);
287
+ ++index_1;
288
+ }
289
+ singleChartPoint.data.forEach(function (point) {
290
+ point.legend = singleChartPoint.legend;
291
+ });
279
292
  colors_2.push(singleChartPoint.color);
280
293
  opacity_2.push(singleChartPoint.opacity || 1);
281
294
  allChartPoints_2.push.apply(allChartPoints_2, singleChartPoint.data);
282
295
  });
283
- var tempArr = allChartPoints_2;
284
- var _loop_1 = function () {
285
- var valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
286
- var filteredChartPoints = tempArr.filter(function (point) { return (point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck; });
287
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
288
- var singleDataset = {};
289
- filteredChartPoints.forEach(function (singleDataPoint, index) {
290
- singleDataset.xVal = singleDataPoint.x;
291
- singleDataset["chart".concat(index)] = singleDataPoint.y;
292
- });
293
- dataSet.push(singleDataset);
294
- // removing compared objects from array
295
- var val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
296
- tempArr = tempArr.filter(function (point) { return (point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val; });
297
- };
298
- while (tempArr.length) {
299
- _loop_1();
296
+ if (!_this._hasDuplicateXValues) {
297
+ var tempArr = allChartPoints_2;
298
+ var _loop_1 = function () {
299
+ var valToCheck = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
300
+ var filteredChartPoints = tempArr.filter(function (point) {
301
+ return (point.x instanceof Date ? point.x.toLocaleString() : point.x) === valToCheck;
302
+ });
303
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
304
+ var singleDataset = {};
305
+ filteredChartPoints.forEach(function (singleDataPoint, id) {
306
+ singleDataset.xVal = singleDataPoint.x;
307
+ singleDataset["chart".concat(id)] = singleDataPoint.y;
308
+ });
309
+ dataSet.push(singleDataset);
310
+ // removing compared objects from array
311
+ var val = tempArr[0].x instanceof Date ? tempArr[0].x.toLocaleString() : tempArr[0].x;
312
+ tempArr = tempArr.filter(function (point) { return (point.x instanceof Date ? point.x.toLocaleString() : point.x) !== val; });
313
+ };
314
+ while (tempArr.length) {
315
+ _loop_1();
316
+ }
317
+ // get keys from dataset, used to create stacked data
318
+ var keysLength = dataSet && Object.keys(dataSet[0]).length;
319
+ for (var i = 0; i < keysLength - 1; i++) {
320
+ var keyVal = "chart".concat(i);
321
+ keys.push(keyVal);
322
+ }
323
+ // Data used to draw graph
324
+ data = _this._getDataPoints(keys, dataSet);
300
325
  }
301
- // get keys from dataset, used to create stacked data
302
- var keysLength = dataSet && Object.keys(dataSet[0]).length;
303
- var keys = [];
304
- for (var i = 0; i < keysLength - 1; i++) {
305
- var keyVal = "chart".concat(i);
306
- keys.push(keyVal);
326
+ else {
327
+ var datasetForDuplicateValues = _this._createDatasetForXCoordinateWithMultipleYValues(allChartPoints_2);
328
+ data = _this._getDataPoints(datasetForDuplicateValues.keys, datasetForDuplicateValues.filteredDataSet);
307
329
  }
308
- // Data used to draw graph
309
- var data = _this._getDataPoints(keys, dataSet);
310
330
  return {
311
331
  colors: colors_2,
312
332
  opacity: opacity_2,
@@ -316,6 +336,54 @@ var AreaChartBase = /** @class */ (function (_super) {
316
336
  };
317
337
  }
318
338
  };
339
+ _this._createDatasetForXCoordinateWithMultipleYValues = function (allChartPoints) {
340
+ var dataSet = [];
341
+ // Group data points by x-axis value
342
+ var groupedData = {};
343
+ allChartPoints.forEach(function (dataPoint) {
344
+ var xValue = dataPoint.x instanceof Date ? dataPoint.x.toLocaleString() : dataPoint.x;
345
+ if (!groupedData[xValue]) {
346
+ groupedData[xValue] = [];
347
+ }
348
+ groupedData[xValue].push(dataPoint);
349
+ });
350
+ // Aggregate data points for each x-axis value
351
+ Object.keys(groupedData).forEach(function (xValue) {
352
+ var dataPoints = groupedData[xValue];
353
+ dataPoints.forEach(function (dataPoint, id) {
354
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
355
+ var singleDataset = { xVal: dataPoints[0].x };
356
+ var key = dataPoint.legend ? dataPoint.legend : "chart".concat(id);
357
+ singleDataset[key] = dataPoint.y;
358
+ dataSet.push(singleDataset);
359
+ });
360
+ });
361
+ // get all unique keys from each array within the dataSet
362
+ var allLegends = [];
363
+ dataSet.forEach(function (item) {
364
+ Object.keys(item).forEach(function (key) {
365
+ if (key !== 'xVal' && !allLegends.includes(key)) {
366
+ allLegends.push(key);
367
+ }
368
+ });
369
+ });
370
+ dataSet.forEach(function (item) {
371
+ allLegends.forEach(function (legend) {
372
+ if (!item[legend]) {
373
+ item[legend] = 0; // Fill with 0 if the legend is missing
374
+ }
375
+ });
376
+ });
377
+ // exclude all items within dataset having all legend values 0
378
+ var filteredDataSet = dataSet.filter(function (item) {
379
+ return allLegends.some(function (legend) { return item[legend] !== 0; });
380
+ });
381
+ var keys = Array.from(new Set(filteredDataSet.flatMap(function (item) { return Object.keys(item).filter(function (key) { return key !== 'xVal'; }); })));
382
+ return {
383
+ keys: keys,
384
+ filteredDataSet: filteredDataSet,
385
+ };
386
+ };
319
387
  _this._getCustomizedCallout = function () {
320
388
  return _this.props.onRenderCalloutPerStack
321
389
  ? _this.props.onRenderCalloutPerStack(_this.state.stackCalloutProps)
@@ -403,9 +471,9 @@ var AreaChartBase = /** @class */ (function (_super) {
403
471
  var lineColor;
404
472
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
405
473
  _this._data.forEach(function (singleStackedData, index) {
406
- var _a, _b, _c, _d, _e, _f;
407
- var yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
408
- var curveFactory = getCurveFactory((_a = points[index].lineOptions) === null || _a === void 0 ? void 0 : _a.curve, d3CurveBasis);
474
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
475
+ var yScale = ((_a = points[index]) === null || _a === void 0 ? void 0 : _a.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
476
+ var curveFactory = getCurveFactory((_c = (_b = points[index]) === null || _b === void 0 ? void 0 : _b.lineOptions) === null || _c === void 0 ? void 0 : _c.curve, d3CurveBasis);
409
477
  var area = d3Area()
410
478
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
411
479
  .x(function (d) { return xScale(d.xVal); })
@@ -426,7 +494,7 @@ var AreaChartBase = /** @class */ (function (_super) {
426
494
  React.createElement("linearGradient", { id: "gradient_".concat(index), x1: "0%", x2: "0%", y1: "0%", y2: "100%" },
427
495
  React.createElement("stop", { offset: "0", stopColor: _this._colors[index] }),
428
496
  React.createElement("stop", { offset: "100%", stopColor: "transparent" })))),
429
- React.createElement("path", { id: "".concat(index, "-line-").concat(_this._uniqueIdForGraph), d: line(singleStackedData), fill: 'transparent', strokeWidth: (_c = (_b = points[index].lineOptions) === null || _b === void 0 ? void 0 : _b.strokeWidth) !== null && _c !== void 0 ? _c : 3, stroke: _this._colors[index], opacity: _this._getLineOpacity(points[index].legend), onMouseMove: _this._onRectMouseMove, onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove, strokeDasharray: (_d = points[index].lineOptions) === null || _d === void 0 ? void 0 : _d.strokeDasharray, strokeDashoffset: (_e = points[index].lineOptions) === null || _e === void 0 ? void 0 : _e.strokeDashoffset, strokeLinecap: (_f = points[index].lineOptions) === null || _f === void 0 ? void 0 : _f.strokeLinecap }),
497
+ React.createElement("path", { id: "".concat(index, "-line-").concat(_this._uniqueIdForGraph), d: line(singleStackedData), fill: 'transparent', strokeWidth: (_f = (_e = (_d = points[index]) === null || _d === void 0 ? void 0 : _d.lineOptions) === null || _e === void 0 ? void 0 : _e.strokeWidth) !== null && _f !== void 0 ? _f : 3, stroke: _this._colors[index], opacity: _this._getLineOpacity(points[index].legend), onMouseMove: _this._onRectMouseMove, onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove, strokeDasharray: (_h = (_g = points[index]) === null || _g === void 0 ? void 0 : _g.lineOptions) === null || _h === void 0 ? void 0 : _h.strokeDasharray, strokeDashoffset: (_k = (_j = points[index]) === null || _j === void 0 ? void 0 : _j.lineOptions) === null || _k === void 0 ? void 0 : _k.strokeDashoffset, strokeLinecap: (_m = (_l = points[index]) === null || _l === void 0 ? void 0 : _l.lineOptions) === null || _m === void 0 ? void 0 : _m.strokeLinecap }),
430
498
  singleStackedData.length === 1 ? (React.createElement("circle", { id: "".concat(index, "-graph-").concat(_this._uniqueIdForGraph), cx: xScale(singleStackedData[0].xVal), cy: yScale(singleStackedData[0].values[1]), r: 6, stroke: _this._colors[index], strokeWidth: 3, fill: _this._colors[index], opacity: layerOpacity, fillOpacity: _this._getOpacity(points[index].legend), onMouseMove: _this._onRectMouseMove, onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove })) : (React.createElement("path", __assign({ id: "".concat(index, "-graph-").concat(_this._uniqueIdForGraph), d: area(singleStackedData), fill: _this.props.enableGradient ? "url(#gradient_".concat(index, ")") : _this._colors[index], opacity: layerOpacity, fillOpacity: _this._getOpacity(points[index].legend), onMouseMove: _this._onRectMouseMove, onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove }, (_this.props.optimizeLargeData && {
431
499
  'data-is-focusable': _this._legendHighlighted(points[index].legend) || _this._noLegendHighlighted(),
432
500
  role: 'img',
@@ -436,10 +504,11 @@ var AreaChartBase = /** @class */ (function (_super) {
436
504
  var circleRadius = pointOptions && pointOptions.r ? Number(pointOptions.r) : 8;
437
505
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
438
506
  _this._data.forEach(function (singleStackedData, index) {
507
+ var _a;
439
508
  if (points.length === index) {
440
509
  return;
441
510
  }
442
- var yScale = points[index].useSecondaryYScale && yScaleSecondary ? yScaleSecondary : yScalePrimary;
511
+ var yScale = ((_a = points[index]) === null || _a === void 0 ? void 0 : _a.useSecondaryYScale) && yScaleSecondary ? yScaleSecondary : yScalePrimary;
443
512
  if (!_this.props.optimizeLargeData || singleStackedData.length === 1) {
444
513
  // Render circles for all data points
445
514
  graph.push(React.createElement("g", { key: "".concat(index, "-dots-").concat(_this._uniqueIdForGraph), clipPath: "url(#clip)", role: "region", "aria-label": "".concat(points[index].legend, ", series ").concat(index + 1, " of ").concat(points.length, " with ").concat(points[index].data.length, " data points.") }, singleStackedData.map(function (singlePoint, pointIndex) {
@@ -447,7 +516,8 @@ var AreaChartBase = /** @class */ (function (_super) {
447
516
  var xDataPoint = singlePoint.xVal instanceof Date ? singlePoint.xVal.getTime() : singlePoint.xVal;
448
517
  lineColor = points[index].color;
449
518
  var legend = points[index].legend;
450
- return (React.createElement("circle", __assign({ key: circleId, id: circleId, "data-is-focusable": _this._legendHighlighted(points[index].legend) || _this._noLegendHighlighted(), cx: xScale(singlePoint.xVal), cy: yScale(singlePoint.values[1]), stroke: lineColor, strokeWidth: 3, fill: _this._updateCircleFillColor(xDataPoint, lineColor, circleId), onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove, onClick: _this._onDataPointClick.bind(_this, points[index].data[pointIndex].onDataPointClick), onFocus: function () { return _this._handleFocus(index, pointIndex, circleId); }, onBlur: _this._handleBlur }, getSecureProps(pointOptions), { r: _this._getCircleRadius(xDataPoint, circleRadius, circleId, legend), role: "img", "aria-label": _this._getAriaLabel(index, pointIndex) })));
519
+ return (React.createElement("circle", __assign({ key: circleId, id: circleId, "data-is-focusable": _this._legendHighlighted(points[index].legend) || _this._noLegendHighlighted(), cx: xScale(singlePoint.xVal), cy: yScale(singlePoint.values[1]), stroke: lineColor, strokeWidth: 3, fill: _this._updateCircleFillColor(xDataPoint, lineColor, circleId), onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove }, _this._getOnClickHandler(points, index, pointIndex), { onFocus: function () { return _this._handleFocus(index, pointIndex, circleId); }, onBlur: _this._handleBlur }, getSecureProps(pointOptions), { r: _this._getCircleRadius(xDataPoint, circleRadius, circleId, legend), role: "img", "aria-label": (!_this._hasDuplicateXValues && !_this._hasMissingXValues && _this._getAriaLabel(index, pointIndex)) ||
520
+ undefined })));
451
521
  })));
452
522
  }
453
523
  else {
@@ -458,7 +528,7 @@ var AreaChartBase = /** @class */ (function (_super) {
458
528
  var circleId = "".concat(_this._circleId, "_").concat(index * _this._data[0].length + pointIndex);
459
529
  lineColor = points[index].color;
460
530
  var legend = points[index].legend;
461
- graph.push(React.createElement("circle", __assign({ key: circleId, id: circleId, cx: xScale(singlePoint.xVal), cy: yScale(singlePoint.values[1]), stroke: lineColor, strokeWidth: 3, fill: _this._updateCircleFillColor(xDataPoint, lineColor, circleId), onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove, onClick: _this._onDataPointClick.bind(_this, points[index].data[pointIndex].onDataPointClick) }, getSecureProps(pointOptions), { r: _this._getCircleRadius(xDataPoint, circleRadius, circleId, legend) })));
531
+ graph.push(React.createElement("circle", __assign({ key: circleId, id: circleId, cx: xScale(singlePoint.xVal), cy: yScale(singlePoint.values[1]), stroke: lineColor, strokeWidth: 3, fill: _this._updateCircleFillColor(xDataPoint, lineColor, circleId), onMouseOut: _this._onRectMouseOut, onMouseOver: _this._onRectMouseMove }, _this._getOnClickHandler(points, index, pointIndex), getSecureProps(pointOptions), { r: _this._getCircleRadius(xDataPoint, circleRadius, circleId, legend) })));
462
532
  }
463
533
  });
464
534
  }
@@ -492,6 +562,12 @@ var AreaChartBase = /** @class */ (function (_super) {
492
562
  }
493
563
  return graph;
494
564
  };
565
+ _this._getOnClickHandler = function (points, index, pointIndex) {
566
+ return (!_this._hasDuplicateXValues &&
567
+ !_this._hasMissingXValues && {
568
+ onClick: _this._onDataPointClick.bind(_this, points[index].data[pointIndex].onDataPointClick),
569
+ });
570
+ };
495
571
  _this._getCircleRadius = function (xDataPoint, circleRadius, circleId, legend) {
496
572
  var _a = _this.state, isCircleClicked = _a.isCircleClicked, nearestCircleToHighlight = _a.nearestCircleToHighlight, activePoint = _a.activePoint;
497
573
  // Show the circle if no legends are selected or if the point's legend is in the selected legends
@@ -529,6 +605,38 @@ var AreaChartBase = /** @class */ (function (_super) {
529
605
  return _this._getHighlightedLegend().length === 0;
530
606
  };
531
607
  _this._addDefaultColors = function (lineChartData) {
608
+ if (_this._hasMissingXValues) {
609
+ // get union of all x values
610
+ var allXValues_1 = new Set();
611
+ lineChartData &&
612
+ lineChartData.forEach(function (line) {
613
+ line.data.forEach(function (point) {
614
+ var xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
615
+ allXValues_1.add(xValue);
616
+ });
617
+ });
618
+ lineChartData &&
619
+ lineChartData.forEach(function (line) {
620
+ allXValues_1.forEach(function (xValue) {
621
+ var point = line.data.find(function (item) {
622
+ return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
623
+ });
624
+ if (!point) {
625
+ line.data.push({
626
+ x: typeof xValue === 'string' ? new Date(xValue) : xValue,
627
+ y: 0,
628
+ legend: line.legend,
629
+ });
630
+ }
631
+ });
632
+ // sort the data points by x value
633
+ line.data.sort(function (a, b) {
634
+ var xA = a.x instanceof Date ? a.x.getTime() : a.x;
635
+ var xB = b.x instanceof Date ? b.x.getTime() : b.x;
636
+ return xA < xB ? -1 : xA > xB ? 1 : 0;
637
+ });
638
+ });
639
+ }
532
640
  return lineChartData
533
641
  ? lineChartData.map(function (item, index) {
534
642
  var _a, _b;
@@ -603,6 +711,7 @@ var AreaChartBase = /** @class */ (function (_super) {
603
711
  warnDeprecations(COMPONENT_NAME, props, {
604
712
  showYAxisGridLines: 'Dont use this property. Lines are drawn by default',
605
713
  });
714
+ _this._hasMissingXValues = _this._containsMissingXValues();
606
715
  _this._uniqueIdForGraph = getId('areaChart_');
607
716
  _this._verticalLineId = getId('verticalLine_');
608
717
  _this._circleId = getId('circle');
@@ -635,6 +744,7 @@ var AreaChartBase = /** @class */ (function (_super) {
635
744
  if (!this._isChartEmpty()) {
636
745
  var lineChartData = this.props.data.lineChartData;
637
746
  var points = this._addDefaultColors(lineChartData);
747
+ this._hasDuplicateXValues = this._xCoordinateContainsMultipleY();
638
748
  this._containsSecondaryYAxis =
639
749
  !!this.props.secondaryYScaleOptions && points.some(function (point) { return point.useSecondaryYScale; });
640
750
  var _a = this._createSet(points), colors = _a.colors, opacity = _a.opacity, data = _a.data, calloutPoints = _a.calloutPoints;
@@ -648,7 +758,7 @@ var AreaChartBase = /** @class */ (function (_super) {
648
758
  tickValues: this.props.tickValues,
649
759
  tickFormat: this.props.tickFormat,
650
760
  };
651
- var calloutProps = __assign({ target: this.state.refSelected, isCalloutVisible: this.state.isCalloutVisible, directionalHint: DirectionalHint.topAutoEdge, YValueHover: this.state.YValueHover, hoverXValue: this.state.hoverXValue, id: "toolTip".concat(this._uniqueCallOutID), gapSpace: 15, isBeakVisible: false, onDismiss: this._closeCallout, 'data-is-focusable': true, xAxisCalloutAccessibilityData: this.state.xAxisCalloutAccessibilityData }, this.props.calloutProps);
761
+ var calloutProps = __assign({ target: this.state.refSelected, isCalloutVisible: this.state.isCalloutVisible && !this._hasDuplicateXValues && !this._hasMissingXValues, directionalHint: DirectionalHint.topAutoEdge, YValueHover: this.state.YValueHover, hoverXValue: this.state.hoverXValue, id: "toolTip".concat(this._uniqueCallOutID), gapSpace: 15, isBeakVisible: false, onDismiss: this._closeCallout, 'data-is-focusable': true, xAxisCalloutAccessibilityData: this.state.xAxisCalloutAccessibilityData }, this.props.calloutProps);
652
762
  return (React.createElement(CartesianChart, __assign({}, this.props, { chartTitle: this._getChartTitle(), points: points, chartType: ChartTypes.AreaChart, calloutProps: calloutProps, legendBars: legends, createYAxis: createNumericYAxis, isCalloutForStack: true, xAxisType: isXAxisDateType ? XAxisTypes.DateAxis : XAxisTypes.NumericAxis, tickParams: tickParams, maxOfYVal: data.maxOfYVal, getGraphData: this._getGraphData, getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: createStringYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: findNumericMinMaxOfY, customizedCallout: this._getCustomizedCallout(), onChartMouseLeave: this._handleChartMouseLeave, enableFirstRenderOptimization: this.props.enablePerfOptimization && this._firstRenderOptimization, ref: this._cartesianChartRef,
653
763
  /* eslint-disable react/jsx-no-bind */
654
764
  // eslint-disable-next-line react/no-children-prop
@@ -722,6 +832,54 @@ var AreaChartBase = /** @class */ (function (_super) {
722
832
  // which means chart is not empty
723
833
  );
724
834
  };
835
+ AreaChartBase.prototype._xCoordinateContainsMultipleY = function () {
836
+ var lineChartData = this.props.data.lineChartData;
837
+ if (!lineChartData) {
838
+ return false;
839
+ }
840
+ for (var _i = 0, lineChartData_1 = lineChartData; _i < lineChartData_1.length; _i++) {
841
+ var item = lineChartData_1[_i];
842
+ var xValueMap = {};
843
+ for (var _a = 0, _b = item.data; _a < _b.length; _a++) {
844
+ var point = _b[_a];
845
+ var xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
846
+ if (!xValueMap[xValue]) {
847
+ xValueMap[xValue] = [];
848
+ }
849
+ xValueMap[xValue].push(point.y);
850
+ if (xValueMap[xValue].length > 1) {
851
+ return true;
852
+ }
853
+ }
854
+ }
855
+ return false;
856
+ };
857
+ AreaChartBase.prototype._containsMissingXValues = function () {
858
+ var lineChartData = this.props.data.lineChartData;
859
+ if (!lineChartData) {
860
+ return false;
861
+ }
862
+ var allXValues = new Set();
863
+ lineChartData.forEach(function (line) {
864
+ line.data.forEach(function (point) {
865
+ var xValue = point.x instanceof Date ? point.x.toLocaleString() : point.x;
866
+ allXValues.add(xValue);
867
+ });
868
+ });
869
+ // for all x values, check if the x value is present in all series
870
+ var hasMissingValues = false;
871
+ lineChartData.forEach(function (line) {
872
+ allXValues.forEach(function (xValue) {
873
+ var point = line.data.find(function (item) {
874
+ return item.x instanceof Date ? item.x.toLocaleString() === xValue : item.x === xValue;
875
+ });
876
+ if (!point) {
877
+ hasMissingValues = true;
878
+ }
879
+ });
880
+ });
881
+ return hasMissingValues;
882
+ };
725
883
  AreaChartBase.prototype._shouldFillToZeroY = function () {
726
884
  return this.props.mode === 'tozeroy' || this._containsSecondaryYAxis;
727
885
  };