@fluentui/react-charting 5.23.89 → 5.23.90

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.
@@ -725,25 +725,35 @@ var LineChartBase = /** @class */ (function (_super) {
725
725
  var _this_1 = this;
726
726
  var _a = this.props, legendProps = _a.legendProps, _b = _a.allowMultipleShapesForPoints, allowMultipleShapesForPoints = _b === void 0 ? false : _b;
727
727
  var isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
728
- var legendDataItems = data.map(function (point) {
729
- var color = point.color;
728
+ var mapLegendToPoints = {};
729
+ data.forEach(function (point) {
730
+ if (point.legend) {
731
+ if (!mapLegendToPoints[point.legend]) {
732
+ mapLegendToPoints[point.legend] = [];
733
+ }
734
+ mapLegendToPoints[point.legend].push(point);
735
+ }
736
+ });
737
+ var legendDataItems = Object.entries(mapLegendToPoints).map(function (_a) {
738
+ var legendTitle = _a[0], points = _a[1];
739
+ var representativePoint = points[0];
730
740
  // mapping data to the format Legends component needs
731
- var legend = __assign(__assign({ title: point.legend, color: color, action: function () {
741
+ var legend = __assign(__assign({ title: legendTitle, color: representativePoint.color, action: function () {
732
742
  if (isLegendMultiSelectEnabled) {
733
- _this_1._handleMultipleLineLegendSelectionAction(point);
743
+ points.forEach(function (p) { return _this_1._handleMultipleLineLegendSelectionAction(p); });
734
744
  }
735
745
  else {
736
- _this_1._handleSingleLegendSelectionAction(point);
746
+ points.forEach(function (p) { return _this_1._handleSingleLegendSelectionAction(p); });
737
747
  }
738
748
  }, onMouseOutAction: function () {
739
749
  _this_1.setState({ activeLegend: '' });
740
750
  }, hoverAction: function () {
741
751
  _this_1._handleChartMouseLeave();
742
- _this_1.setState({ activeLegend: point.legend });
743
- } }, (point.legendShape && {
744
- shape: point.legendShape,
752
+ _this_1.setState({ activeLegend: legendTitle });
753
+ } }, (representativePoint.legendShape && {
754
+ shape: representativePoint.legendShape,
745
755
  })), (allowMultipleShapesForPoints && {
746
- shape: Points[point.index % Object.keys(pointTypes).length],
756
+ shape: Points[representativePoint.index % Object.keys(pointTypes).length],
747
757
  }));
748
758
  return legend;
749
759
  });