@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.
@@ -716,25 +716,35 @@ define(["require", "exports", "tslib", "react", "d3-selection", "d3-array", "../
716
716
  var _this_1 = this;
717
717
  var _a = this.props, legendProps = _a.legendProps, _b = _a.allowMultipleShapesForPoints, allowMultipleShapesForPoints = _b === void 0 ? false : _b;
718
718
  var isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
719
- var legendDataItems = data.map(function (point) {
720
- var color = point.color;
719
+ var mapLegendToPoints = {};
720
+ data.forEach(function (point) {
721
+ if (point.legend) {
722
+ if (!mapLegendToPoints[point.legend]) {
723
+ mapLegendToPoints[point.legend] = [];
724
+ }
725
+ mapLegendToPoints[point.legend].push(point);
726
+ }
727
+ });
728
+ var legendDataItems = Object.entries(mapLegendToPoints).map(function (_a) {
729
+ var legendTitle = _a[0], points = _a[1];
730
+ var representativePoint = points[0];
721
731
  // mapping data to the format Legends component needs
722
- var legend = tslib_1.__assign(tslib_1.__assign({ title: point.legend, color: color, action: function () {
732
+ var legend = tslib_1.__assign(tslib_1.__assign({ title: legendTitle, color: representativePoint.color, action: function () {
723
733
  if (isLegendMultiSelectEnabled) {
724
- _this_1._handleMultipleLineLegendSelectionAction(point);
734
+ points.forEach(function (p) { return _this_1._handleMultipleLineLegendSelectionAction(p); });
725
735
  }
726
736
  else {
727
- _this_1._handleSingleLegendSelectionAction(point);
737
+ points.forEach(function (p) { return _this_1._handleSingleLegendSelectionAction(p); });
728
738
  }
729
739
  }, onMouseOutAction: function () {
730
740
  _this_1.setState({ activeLegend: '' });
731
741
  }, hoverAction: function () {
732
742
  _this_1._handleChartMouseLeave();
733
- _this_1.setState({ activeLegend: point.legend });
734
- } }, (point.legendShape && {
735
- shape: point.legendShape,
743
+ _this_1.setState({ activeLegend: legendTitle });
744
+ } }, (representativePoint.legendShape && {
745
+ shape: representativePoint.legendShape,
736
746
  })), (allowMultipleShapesForPoints && {
737
- shape: index_3.Points[point.index % Object.keys(index_3.pointTypes).length],
747
+ shape: index_3.Points[representativePoint.index % Object.keys(index_3.pointTypes).length],
738
748
  }));
739
749
  return legend;
740
750
  });