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