@fluentui/react-charting 5.23.31 → 5.23.32

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 (144) hide show
  1. package/CHANGELOG.json +40 -1
  2. package/CHANGELOG.md +15 -2
  3. package/dist/react-charting.d.ts +8 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +2 -0
  7. package/lib/components/AreaChart/AreaChart.base.d.ts +1 -1
  8. package/lib/components/AreaChart/AreaChart.base.js +7 -1
  9. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  10. package/lib/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  11. package/lib/components/CommonComponents/CartesianChart.base.js +17 -10
  12. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  13. package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -21
  14. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  15. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +4 -0
  16. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +81 -21
  17. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  18. package/lib/components/DeclarativeChart/imageExporter.js +1 -1
  19. package/lib/components/DeclarativeChart/imageExporter.js.map +1 -1
  20. package/lib/components/DonutChart/DonutChart.base.d.ts +1 -0
  21. package/lib/components/DonutChart/DonutChart.base.js +11 -2
  22. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  23. package/lib/components/GaugeChart/GaugeChart.base.d.ts +1 -0
  24. package/lib/components/GaugeChart/GaugeChart.base.js +8 -0
  25. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  26. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +4 -1
  27. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +35 -24
  28. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  29. package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +3 -0
  30. package/lib/components/HeatMapChart/HeatMapChart.base.js +13 -2
  31. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  32. package/lib/components/HeatMapChart/HeatMapChart.types.d.ts +4 -0
  33. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  34. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
  35. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +8 -0
  36. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  37. package/lib/components/LineChart/LineChart.base.js +11 -2
  38. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  39. package/lib/components/SankeyChart/SankeyChart.base.js +1 -15
  40. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  41. package/lib/components/SankeyChart/SankeyChart.types.d.ts +5 -0
  42. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  43. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +1 -0
  44. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +8 -0
  45. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  46. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +4 -2
  47. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +53 -42
  48. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  49. package/lib/utilities/utilities.d.ts +1 -0
  50. package/lib/utilities/utilities.js +17 -0
  51. package/lib/utilities/utilities.js.map +1 -1
  52. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +1 -1
  53. package/lib-amd/components/AreaChart/AreaChart.base.js +7 -1
  54. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  55. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  56. package/lib-amd/components/CommonComponents/CartesianChart.base.js +17 -10
  57. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  58. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +47 -20
  59. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  60. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +4 -0
  61. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +85 -21
  62. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  63. package/lib-amd/components/DeclarativeChart/imageExporter.js +1 -1
  64. package/lib-amd/components/DeclarativeChart/imageExporter.js.map +1 -1
  65. package/lib-amd/components/DonutChart/DonutChart.base.d.ts +1 -0
  66. package/lib-amd/components/DonutChart/DonutChart.base.js +10 -1
  67. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  68. package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +1 -0
  69. package/lib-amd/components/GaugeChart/GaugeChart.base.js +8 -0
  70. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  71. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +4 -1
  72. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +34 -23
  73. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  74. package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +3 -0
  75. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +13 -2
  76. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  77. package/lib-amd/components/HeatMapChart/HeatMapChart.types.d.ts +4 -0
  78. package/lib-amd/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  79. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
  80. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +8 -0
  81. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  82. package/lib-amd/components/LineChart/LineChart.base.js +10 -1
  83. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  84. package/lib-amd/components/SankeyChart/SankeyChart.base.js +1 -15
  85. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  86. package/lib-amd/components/SankeyChart/SankeyChart.types.d.ts +5 -0
  87. package/lib-amd/components/SankeyChart/SankeyChart.types.js.map +1 -1
  88. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +1 -0
  89. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +8 -0
  90. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  91. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +4 -2
  92. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +52 -41
  93. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  94. package/lib-amd/utilities/utilities.d.ts +1 -0
  95. package/lib-amd/utilities/utilities.js +19 -1
  96. package/lib-amd/utilities/utilities.js.map +1 -1
  97. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +1 -1
  98. package/lib-commonjs/components/AreaChart/AreaChart.base.js +7 -1
  99. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  100. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +2 -0
  101. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +17 -10
  102. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  103. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +47 -20
  104. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  105. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +4 -0
  106. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +85 -21
  107. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  108. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +1 -1
  109. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -1
  110. package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +1 -0
  111. package/lib-commonjs/components/DonutChart/DonutChart.base.js +10 -1
  112. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  113. package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +1 -0
  114. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +8 -0
  115. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  116. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +4 -1
  117. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +34 -23
  118. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  119. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +3 -0
  120. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +13 -2
  121. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  122. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.d.ts +4 -0
  123. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  124. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
  125. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +8 -0
  126. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  127. package/lib-commonjs/components/LineChart/LineChart.base.js +10 -1
  128. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  129. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +1 -15
  130. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  131. package/lib-commonjs/components/SankeyChart/SankeyChart.types.d.ts +5 -0
  132. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  133. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +1 -0
  134. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +8 -0
  135. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  136. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +4 -2
  137. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +52 -41
  138. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  139. package/lib-commonjs/utilities/utilities.d.ts +1 -0
  140. package/lib-commonjs/utilities/utilities.js +19 -1
  141. package/lib-commonjs/utilities/utilities.js.map +1 -1
  142. package/package.json +1 -1
  143. package/src/components/HeatMapChart/HeatMapChart.types.ts +5 -0
  144. package/src/components/SankeyChart/SankeyChart.types.ts +6 -0
@@ -18,7 +18,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
18
18
  var VerticalStackedBarChartBase = /** @class */ (function (_super) {
19
19
  tslib_1.__extends(VerticalStackedBarChartBase, _super);
20
20
  function VerticalStackedBarChartBase(props) {
21
- var _a, _b;
21
+ var _a;
22
22
  var _this = _super.call(this, props) || this;
23
23
  _this._isRtl = (0, Utilities_1.getRTL)();
24
24
  /**
@@ -33,7 +33,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
33
33
  var _a = _this.props.isCalloutForStack, isCalloutForStack = _a === void 0 ? false : _a;
34
34
  var shouldFocusStackOnly = false;
35
35
  if (_isHavingLines) {
36
- if (_this.state.selectedLegend !== '') {
36
+ if (_this._getHighlightedLegend().length === 1) {
37
37
  shouldFocusStackOnly = false;
38
38
  }
39
39
  else {
@@ -106,7 +106,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
106
106
  : 0;
107
107
  var xScaleBandwidthTranslate = _this._xAxisType !== index_3.XAxisTypes.StringAxis ? 0 : xScale.bandwidth() / 2;
108
108
  Object.keys(lineObject).forEach(function (item, index) {
109
- var shouldHighlight = _this._legendHighlighted(item) || _this._noLegendHighlighted(); // item is legend name
109
+ var shouldHighlight = _this._isLegendHighlighted(item) || _this._noLegendHighlighted(); // item is legend name
110
110
  for (var i = 1; i < lineObject[item].length; i++) {
111
111
  var x1 = xScale(lineObject[item][i - 1].xItem.xAxisPoint);
112
112
  var useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && secondaryYScale;
@@ -116,7 +116,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
116
116
  if (lineBorderWidth > 0) {
117
117
  borderForLines.push(React.createElement("line", { key: "".concat(index, "-").concat(i, "-BorderLine"), x1: x1, y1: y1, x2: x2, y2: y2, opacity: shouldHighlight ? 1 : 0.1, strokeWidth: 3 + lineBorderWidth * 2, fill: "transparent", strokeLinecap: "round", stroke: theme.semanticColors.bodyBackground, transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)") }));
118
118
  }
119
- lines.push(React.createElement("line", tslib_1.__assign({ key: "".concat(index, "-").concat(i, "-line"), x1: x1, y1: y1, x2: x2, y2: y2, opacity: shouldHighlight ? 1 : 0.1, strokeWidth: 3, strokeLinecap: "round", stroke: lineObject[item][i].color, transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)") }, (_this.state.selectedLegend === item && {
119
+ lines.push(React.createElement("line", tslib_1.__assign({ key: "".concat(index, "-").concat(i, "-line"), x1: x1, y1: y1, x2: x2, y2: y2, opacity: shouldHighlight ? 1 : 0.1, strokeWidth: 3, strokeLinecap: "round", stroke: lineObject[item][i].color, transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)") }, (_this._isLegendHighlighted(item) && {
120
120
  onMouseOver: _this._lineHover.bind(_this, lineObject[item][i - 1]),
121
121
  onMouseLeave: _this._lineHoverOut,
122
122
  }))));
@@ -126,11 +126,11 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
126
126
  lineObject[item].forEach(function (circlePoint, subIndex) {
127
127
  // Create an object to store line point ref so that the object can be passed by reference to the focus handler
128
128
  var circleRef = { refElement: null };
129
- dots.push(React.createElement("circle", tslib_1.__assign({ key: "".concat(index, "-").concat(subIndex, "-dot"), cx: xScale(circlePoint.xItem.xAxisPoint), cy: circlePoint.useSecondaryYScale && secondaryYScale ? secondaryYScale(circlePoint.y) : yScale(circlePoint.y), onMouseOver: _this.state.selectedLegend === item
129
+ dots.push(React.createElement("circle", tslib_1.__assign({ key: "".concat(index, "-").concat(subIndex, "-dot"), cx: xScale(circlePoint.xItem.xAxisPoint), cy: circlePoint.useSecondaryYScale && secondaryYScale ? secondaryYScale(circlePoint.y) : yScale(circlePoint.y), onMouseOver: _this._isLegendHighlighted(item)
130
130
  ? _this._lineHover.bind(_this, circlePoint)
131
- : _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this.state.selectedLegend === item && {
131
+ : _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this._isLegendHighlighted(item) && {
132
132
  onMouseLeave: _this._lineHoverOut,
133
- }), { r: _this._getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).radius, stroke: circlePoint.color, fill: _this.props.theme.semanticColors.bodyBackground, strokeWidth: 3, visibility: _this._getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).visibility, transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)"), "data-is-focusable": _this._legendHighlighted(item), ref: function (e) { return (circleRef.refElement = e); }, onFocus: _this._lineFocus.bind(_this, circlePoint, circleRef), onBlur: _this._lineHoverOut })));
133
+ }), { r: _this._getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).radius, stroke: circlePoint.color, fill: _this.props.theme.semanticColors.bodyBackground, strokeWidth: 3, visibility: _this._getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).visibility, transform: "translate(".concat(xScaleBandwidthTranslate, ", 0)"), "data-is-focusable": _this._isLegendHighlighted(item), ref: function (e) { return (circleRef.refElement = e); }, onFocus: _this._lineFocus.bind(_this, circlePoint, circleRef), onBlur: _this._lineHoverOut })));
134
134
  });
135
135
  });
136
136
  return (React.createElement(React.Fragment, null,
@@ -139,12 +139,12 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
139
139
  dots));
140
140
  };
141
141
  _this._getCircleVisibilityAndRadius = function (xAxisPoint, legend) {
142
- var _a = _this.state, selectedLegend = _a.selectedLegend, activeXAxisDataPoint = _a.activeXAxisDataPoint;
143
- if (selectedLegend !== '') {
144
- if (xAxisPoint === activeXAxisDataPoint && selectedLegend === legend) {
142
+ var activeXAxisDataPoint = _this.state.activeXAxisDataPoint;
143
+ if (!_this._noLegendHighlighted()) {
144
+ if (xAxisPoint === activeXAxisDataPoint && _this._isLegendHighlighted(legend)) {
145
145
  return { visibility: CircleVisbility.show, radius: 8 };
146
146
  }
147
- else if (selectedLegend === legend) {
147
+ else if (_this._isLegendHighlighted(legend)) {
148
148
  return { visibility: CircleVisbility.show, radius: 0.3 };
149
149
  }
150
150
  else {
@@ -247,7 +247,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
247
247
  singleChartData.chartData[index].color = startColor;
248
248
  }
249
249
  var ref = {};
250
- var shouldHighlight = _this._legendHighlighted(point.legend) || _this._noLegendHighlighted() ? true : false;
250
+ var shouldHighlight = _this._isLegendHighlighted(point.legend) || _this._noLegendHighlighted() ? true : false;
251
251
  _this._classNames = getClassNames(_this.props.styles, {
252
252
  theme: _this.props.theme,
253
253
  shouldHighlight: shouldHighlight,
@@ -311,7 +311,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
311
311
  }
312
312
  else {
313
313
  barsToDisplay.forEach(function (point) {
314
- if (_this._legendHighlighted(point.legend)) {
314
+ if (_this._isLegendHighlighted(point.legend)) {
315
315
  showLabel = true;
316
316
  barLabel += point.data;
317
317
  }
@@ -406,15 +406,14 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
406
406
  * 1. selection: if the user clicks on it
407
407
  * 2. hovering: if there is no selected legend and the user hovers over it
408
408
  */
409
- _this._legendHighlighted = function (legendTitle) {
410
- return (_this.state.selectedLegend === legendTitle ||
411
- (_this.state.selectedLegend === '' && _this.state.activeLegend === legendTitle));
409
+ _this._isLegendHighlighted = function (legendTitle) {
410
+ return _this._getHighlightedLegend().includes(legendTitle);
412
411
  };
413
412
  /**
414
413
  * This function checks if none of the legends is selected or hovered.
415
414
  */
416
415
  _this._noLegendHighlighted = function () {
417
- return _this.state.selectedLegend === '' && _this.state.activeLegend === '';
416
+ return _this._getHighlightedLegend().length === 0;
418
417
  };
419
418
  _this._getAriaLabel = function (singleChartData, point) {
420
419
  var _a, _b, _c;
@@ -492,8 +491,8 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
492
491
  (0, Utilities_1.initializeComponentRef)(_this);
493
492
  _this.state = {
494
493
  isCalloutVisible: false,
495
- selectedLegend: (_b = (_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegend) !== null && _b !== void 0 ? _b : '',
496
- activeLegend: '',
494
+ selectedLegends: ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends) || [],
495
+ activeLegend: undefined,
497
496
  refSelected: null,
498
497
  dataForHoverCard: 0,
499
498
  color: '',
@@ -522,6 +521,12 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
522
521
  return _this;
523
522
  }
524
523
  VerticalStackedBarChartBase.prototype.componentDidUpdate = function (prevProps) {
524
+ var _a, _b, _c;
525
+ if (!(0, index_3.areArraysEqual)((_a = prevProps.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends, (_b = this.props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends)) {
526
+ this.setState({
527
+ selectedLegends: ((_c = this.props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || [],
528
+ });
529
+ }
525
530
  if (prevProps.height !== this.props.height ||
526
531
  prevProps.width !== this.props.width ||
527
532
  prevProps.data !== this.props.data) {
@@ -600,18 +605,6 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
600
605
  VerticalStackedBarChartBase.prototype._renderCallout = function (props) {
601
606
  return props ? (React.createElement(index_2.ChartHoverCard, { XValue: props.xAxisCalloutData, Legend: props.legend, YValue: props.yAxisCalloutData, color: props.color, culture: this.props.culture })) : null;
602
607
  };
603
- VerticalStackedBarChartBase.prototype._onLegendClick = function (legendTitle) {
604
- if (this.state.selectedLegend === legendTitle) {
605
- this.setState({
606
- selectedLegend: '',
607
- });
608
- }
609
- else {
610
- this.setState({
611
- selectedLegend: legendTitle,
612
- });
613
- }
614
- };
615
608
  VerticalStackedBarChartBase.prototype._onLegendHover = function (legendTitle) {
616
609
  this.setState({
617
610
  activeLegend: legendTitle,
@@ -619,7 +612,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
619
612
  };
620
613
  VerticalStackedBarChartBase.prototype._onLegendLeave = function () {
621
614
  this.setState({
622
- activeLegend: '',
615
+ activeLegend: undefined,
623
616
  });
624
617
  };
625
618
  VerticalStackedBarChartBase.prototype._getLegendData = function (data, palette, lineLegends) {
@@ -645,9 +638,6 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
645
638
  var legend = {
646
639
  title: point.legend,
647
640
  color: color,
648
- action: function () {
649
- _this._onLegendClick(point.legend);
650
- },
651
641
  hoverAction: allowHoverOnLegend
652
642
  ? function () {
653
643
  _this._handleChartMouseLeave();
@@ -666,9 +656,6 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
666
656
  title: point.title,
667
657
  color: point.color,
668
658
  isLineLegendInBarChart: true,
669
- action: function () {
670
- _this._onLegendClick(point.title);
671
- },
672
659
  hoverAction: allowHoverOnLegend
673
660
  ? function () {
674
661
  _this._handleChartMouseLeave();
@@ -681,7 +668,26 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
681
668
  });
682
669
  }
683
670
  var totalLegends = legendsOfLine.concat(actions);
684
- return (React.createElement(index_1.Legends, tslib_1.__assign({ legends: totalLegends, overflowProps: this.props.legendsOverflowProps, enabledWrapLines: this.props.enabledLegendsWrapLines, focusZonePropsInHoverCard: this.props.focusZonePropsForLegendsInHoverCard, overflowText: this.props.legendsOverflowText }, this.props.legendProps)));
671
+ return (React.createElement(index_1.Legends, tslib_1.__assign({ legends: totalLegends, overflowProps: this.props.legendsOverflowProps, enabledWrapLines: this.props.enabledLegendsWrapLines, focusZonePropsInHoverCard: this.props.focusZonePropsForLegendsInHoverCard, overflowText: this.props.legendsOverflowText }, this.props.legendProps, { onChange: this._onLegendSelectionChange.bind(this) })));
672
+ };
673
+ VerticalStackedBarChartBase.prototype._onLegendSelectionChange = function (selectedLegends, event, currentLegend) {
674
+ var _a, _b;
675
+ if ((_a = this.props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
676
+ this.setState({ selectedLegends: selectedLegends });
677
+ }
678
+ else {
679
+ this.setState({ selectedLegends: selectedLegends.slice(-1) });
680
+ }
681
+ if ((_b = this.props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
682
+ this.props.legendProps.onChange(selectedLegends, event, currentLegend);
683
+ }
684
+ };
685
+ VerticalStackedBarChartBase.prototype._getHighlightedLegend = function () {
686
+ return this.state.selectedLegends.length > 0
687
+ ? this.state.selectedLegends
688
+ : this.state.activeLegend
689
+ ? [this.state.activeLegend]
690
+ : [];
685
691
  };
686
692
  VerticalStackedBarChartBase.prototype._onRectHover = function (xAxisPoint, point, color, mouseEvent) {
687
693
  mouseEvent.persist();
@@ -700,7 +706,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
700
706
  * Show the callout if highlighted bar is focused/hovered
701
707
  * and Hide it if unhighlighted bar is focused/hovered
702
708
  */
703
- isCalloutVisible: this.state.selectedLegend === '' || this.state.selectedLegend === point.legend,
709
+ isCalloutVisible: this._noLegendHighlighted() || this._isLegendHighlighted(point.legend),
704
710
  calloutLegend: point.legend,
705
711
  dataForHoverCard: point.data,
706
712
  color: color,
@@ -716,6 +722,11 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
716
722
  this._onStackHoverFocus(stack, mouseEvent);
717
723
  };
718
724
  VerticalStackedBarChartBase.prototype._onStackHoverFocus = function (stack, refSelected) {
725
+ var _this = this;
726
+ var _a, _b, _c;
727
+ if (!this._noLegendHighlighted()) {
728
+ stack = tslib_1.__assign(tslib_1.__assign({}, stack), { chartData: stack.chartData.filter(function (dataPoint) { return _this._isLegendHighlighted(dataPoint.legend); }), lineData: (_a = stack.lineData) === null || _a === void 0 ? void 0 : _a.filter(function (dataPoint) { return _this._isLegendHighlighted(dataPoint.legend); }) });
729
+ }
719
730
  var lineData = stack.lineData;
720
731
  var isLinesPresent = lineData !== undefined && lineData.length > 0;
721
732
  if (isLinesPresent) {
@@ -726,7 +737,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-selection", "d3-
726
737
  }
727
738
  this.setState({
728
739
  refSelected: refSelected,
729
- isCalloutVisible: true,
740
+ isCalloutVisible: stack.chartData.length > 0 || ((_c = (_b = stack.lineData) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0,
730
741
  YValueHover: isLinesPresent
731
742
  ? tslib_1.__spreadArray(tslib_1.__spreadArray([], lineData.sort(function (a, b) { return (a.data < b.data ? 1 : -1); }), true), stack.chartData.slice().reverse(), true) : stack.chartData.slice().reverse(),
732
743
  hoverXValue: stack.xAxisPoint instanceof Date ? (0, index_3.formatDate)(stack.xAxisPoint, this.props.useUTC) : stack.xAxisPoint,