@fluentui/react-charting 5.23.31 → 5.23.33
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.
- package/CHANGELOG.json +73 -1
- package/CHANGELOG.md +27 -2
- package/dist/react-charting.d.ts +8 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +2 -0
- package/lib/components/AreaChart/AreaChart.base.d.ts +5 -2
- package/lib/components/AreaChart/AreaChart.base.js +60 -33
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.d.ts +2 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +17 -10
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +49 -21
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +4 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +81 -21
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/imageExporter.js +1 -1
- package/lib/components/DeclarativeChart/imageExporter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.d.ts +1 -0
- package/lib/components/DonutChart/DonutChart.base.js +11 -2
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.base.d.ts +1 -0
- package/lib/components/GaugeChart/GaugeChart.base.js +8 -0
- package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +4 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +35 -24
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +3 -0
- package/lib/components/HeatMapChart/HeatMapChart.base.js +13 -2
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.types.d.ts +4 -0
- package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +8 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.js +11 -2
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.base.js +1 -15
- package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.d.ts +5 -0
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +4 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +61 -48
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +4 -2
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +53 -42
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/utilities/utilities.d.ts +1 -0
- package/lib/utilities/utilities.js +17 -0
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.d.ts +5 -2
- package/lib-amd/components/AreaChart/AreaChart.base.js +59 -32
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +2 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +17 -10
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +48 -20
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +4 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +85 -21
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/imageExporter.js +1 -1
- package/lib-amd/components/DeclarativeChart/imageExporter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.d.ts +1 -0
- package/lib-amd/components/DonutChart/DonutChart.base.js +10 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +1 -0
- package/lib-amd/components/GaugeChart/GaugeChart.base.js +8 -0
- package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +4 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +34 -23
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +3 -0
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +13 -2
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.d.ts +4 -0
- package/lib-amd/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +8 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.js +10 -1
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.base.js +1 -15
- package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.types.d.ts +5 -0
- package/lib-amd/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +4 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +60 -47
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +4 -2
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +52 -41
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +1 -0
- package/lib-amd/utilities/utilities.js +19 -1
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +5 -2
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +59 -32
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +2 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +17 -10
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -20
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +4 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +85 -21
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +1 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +10 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +8 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +4 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +34 -23
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +3 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +13 -2
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.d.ts +4 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +8 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js +10 -1
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +1 -15
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.d.ts +5 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +4 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +60 -47
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +4 -2
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +52 -41
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +1 -0
- package/lib-commonjs/utilities/utilities.js +19 -1
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +3 -3
- package/src/components/HeatMapChart/HeatMapChart.types.ts +5 -0
- package/src/components/SankeyChart/SankeyChart.types.ts +6 -0
|
@@ -28,7 +28,7 @@ var CircleVisbility;
|
|
|
28
28
|
var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
29
29
|
tslib_1.__extends(VerticalStackedBarChartBase, _super);
|
|
30
30
|
function VerticalStackedBarChartBase(props) {
|
|
31
|
-
var _a
|
|
31
|
+
var _a;
|
|
32
32
|
var _this = _super.call(this, props) || this;
|
|
33
33
|
_this._isRtl = (0, Utilities_1.getRTL)();
|
|
34
34
|
/**
|
|
@@ -43,7 +43,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
43
43
|
var _a = _this.props.isCalloutForStack, isCalloutForStack = _a === void 0 ? false : _a;
|
|
44
44
|
var shouldFocusStackOnly = false;
|
|
45
45
|
if (_isHavingLines) {
|
|
46
|
-
if (_this.
|
|
46
|
+
if (_this._getHighlightedLegend().length === 1) {
|
|
47
47
|
shouldFocusStackOnly = false;
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
@@ -116,7 +116,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
116
116
|
: 0;
|
|
117
117
|
var xScaleBandwidthTranslate = _this._xAxisType !== index_3.XAxisTypes.StringAxis ? 0 : xScale.bandwidth() / 2;
|
|
118
118
|
Object.keys(lineObject).forEach(function (item, index) {
|
|
119
|
-
var shouldHighlight = _this.
|
|
119
|
+
var shouldHighlight = _this._isLegendHighlighted(item) || _this._noLegendHighlighted(); // item is legend name
|
|
120
120
|
for (var i = 1; i < lineObject[item].length; i++) {
|
|
121
121
|
var x1 = xScale(lineObject[item][i - 1].xItem.xAxisPoint);
|
|
122
122
|
var useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && secondaryYScale;
|
|
@@ -126,7 +126,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
126
126
|
if (lineBorderWidth > 0) {
|
|
127
127
|
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)") }));
|
|
128
128
|
}
|
|
129
|
-
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.
|
|
129
|
+
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) && {
|
|
130
130
|
onMouseOver: _this._lineHover.bind(_this, lineObject[item][i - 1]),
|
|
131
131
|
onMouseLeave: _this._lineHoverOut,
|
|
132
132
|
}))));
|
|
@@ -136,11 +136,11 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
136
136
|
lineObject[item].forEach(function (circlePoint, subIndex) {
|
|
137
137
|
// Create an object to store line point ref so that the object can be passed by reference to the focus handler
|
|
138
138
|
var circleRef = { refElement: null };
|
|
139
|
-
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.
|
|
139
|
+
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)
|
|
140
140
|
? _this._lineHover.bind(_this, circlePoint)
|
|
141
|
-
: _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this.
|
|
141
|
+
: _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this._isLegendHighlighted(item) && {
|
|
142
142
|
onMouseLeave: _this._lineHoverOut,
|
|
143
|
-
}), { 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.
|
|
143
|
+
}), { 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 })));
|
|
144
144
|
});
|
|
145
145
|
});
|
|
146
146
|
return (React.createElement(React.Fragment, null,
|
|
@@ -149,12 +149,12 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
149
149
|
dots));
|
|
150
150
|
};
|
|
151
151
|
_this._getCircleVisibilityAndRadius = function (xAxisPoint, legend) {
|
|
152
|
-
var
|
|
153
|
-
if (
|
|
154
|
-
if (xAxisPoint === activeXAxisDataPoint &&
|
|
152
|
+
var activeXAxisDataPoint = _this.state.activeXAxisDataPoint;
|
|
153
|
+
if (!_this._noLegendHighlighted()) {
|
|
154
|
+
if (xAxisPoint === activeXAxisDataPoint && _this._isLegendHighlighted(legend)) {
|
|
155
155
|
return { visibility: CircleVisbility.show, radius: 8 };
|
|
156
156
|
}
|
|
157
|
-
else if (
|
|
157
|
+
else if (_this._isLegendHighlighted(legend)) {
|
|
158
158
|
return { visibility: CircleVisbility.show, radius: 0.3 };
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
@@ -257,7 +257,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
257
257
|
singleChartData.chartData[index].color = startColor;
|
|
258
258
|
}
|
|
259
259
|
var ref = {};
|
|
260
|
-
var shouldHighlight = _this.
|
|
260
|
+
var shouldHighlight = _this._isLegendHighlighted(point.legend) || _this._noLegendHighlighted() ? true : false;
|
|
261
261
|
_this._classNames = getClassNames(_this.props.styles, {
|
|
262
262
|
theme: _this.props.theme,
|
|
263
263
|
shouldHighlight: shouldHighlight,
|
|
@@ -321,7 +321,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
321
321
|
}
|
|
322
322
|
else {
|
|
323
323
|
barsToDisplay.forEach(function (point) {
|
|
324
|
-
if (_this.
|
|
324
|
+
if (_this._isLegendHighlighted(point.legend)) {
|
|
325
325
|
showLabel = true;
|
|
326
326
|
barLabel += point.data;
|
|
327
327
|
}
|
|
@@ -416,15 +416,14 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
416
416
|
* 1. selection: if the user clicks on it
|
|
417
417
|
* 2. hovering: if there is no selected legend and the user hovers over it
|
|
418
418
|
*/
|
|
419
|
-
_this.
|
|
420
|
-
return
|
|
421
|
-
(_this.state.selectedLegend === '' && _this.state.activeLegend === legendTitle));
|
|
419
|
+
_this._isLegendHighlighted = function (legendTitle) {
|
|
420
|
+
return _this._getHighlightedLegend().includes(legendTitle);
|
|
422
421
|
};
|
|
423
422
|
/**
|
|
424
423
|
* This function checks if none of the legends is selected or hovered.
|
|
425
424
|
*/
|
|
426
425
|
_this._noLegendHighlighted = function () {
|
|
427
|
-
return _this.
|
|
426
|
+
return _this._getHighlightedLegend().length === 0;
|
|
428
427
|
};
|
|
429
428
|
_this._getAriaLabel = function (singleChartData, point) {
|
|
430
429
|
var _a, _b, _c;
|
|
@@ -502,8 +501,8 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
502
501
|
(0, Utilities_1.initializeComponentRef)(_this);
|
|
503
502
|
_this.state = {
|
|
504
503
|
isCalloutVisible: false,
|
|
505
|
-
|
|
506
|
-
activeLegend:
|
|
504
|
+
selectedLegends: ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends) || [],
|
|
505
|
+
activeLegend: undefined,
|
|
507
506
|
refSelected: null,
|
|
508
507
|
dataForHoverCard: 0,
|
|
509
508
|
color: '',
|
|
@@ -532,6 +531,12 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
532
531
|
return _this;
|
|
533
532
|
}
|
|
534
533
|
VerticalStackedBarChartBase.prototype.componentDidUpdate = function (prevProps) {
|
|
534
|
+
var _a, _b, _c;
|
|
535
|
+
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)) {
|
|
536
|
+
this.setState({
|
|
537
|
+
selectedLegends: ((_c = this.props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || [],
|
|
538
|
+
});
|
|
539
|
+
}
|
|
535
540
|
if (prevProps.height !== this.props.height ||
|
|
536
541
|
prevProps.width !== this.props.width ||
|
|
537
542
|
prevProps.data !== this.props.data) {
|
|
@@ -610,18 +615,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
610
615
|
VerticalStackedBarChartBase.prototype._renderCallout = function (props) {
|
|
611
616
|
return props ? (React.createElement(index_2.ChartHoverCard, { XValue: props.xAxisCalloutData, Legend: props.legend, YValue: props.yAxisCalloutData, color: props.color, culture: this.props.culture })) : null;
|
|
612
617
|
};
|
|
613
|
-
VerticalStackedBarChartBase.prototype._onLegendClick = function (legendTitle) {
|
|
614
|
-
if (this.state.selectedLegend === legendTitle) {
|
|
615
|
-
this.setState({
|
|
616
|
-
selectedLegend: '',
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
this.setState({
|
|
621
|
-
selectedLegend: legendTitle,
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
};
|
|
625
618
|
VerticalStackedBarChartBase.prototype._onLegendHover = function (legendTitle) {
|
|
626
619
|
this.setState({
|
|
627
620
|
activeLegend: legendTitle,
|
|
@@ -629,7 +622,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
629
622
|
};
|
|
630
623
|
VerticalStackedBarChartBase.prototype._onLegendLeave = function () {
|
|
631
624
|
this.setState({
|
|
632
|
-
activeLegend:
|
|
625
|
+
activeLegend: undefined,
|
|
633
626
|
});
|
|
634
627
|
};
|
|
635
628
|
VerticalStackedBarChartBase.prototype._getLegendData = function (data, palette, lineLegends) {
|
|
@@ -655,9 +648,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
655
648
|
var legend = {
|
|
656
649
|
title: point.legend,
|
|
657
650
|
color: color,
|
|
658
|
-
action: function () {
|
|
659
|
-
_this._onLegendClick(point.legend);
|
|
660
|
-
},
|
|
661
651
|
hoverAction: allowHoverOnLegend
|
|
662
652
|
? function () {
|
|
663
653
|
_this._handleChartMouseLeave();
|
|
@@ -676,9 +666,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
676
666
|
title: point.title,
|
|
677
667
|
color: point.color,
|
|
678
668
|
isLineLegendInBarChart: true,
|
|
679
|
-
action: function () {
|
|
680
|
-
_this._onLegendClick(point.title);
|
|
681
|
-
},
|
|
682
669
|
hoverAction: allowHoverOnLegend
|
|
683
670
|
? function () {
|
|
684
671
|
_this._handleChartMouseLeave();
|
|
@@ -691,7 +678,26 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
691
678
|
});
|
|
692
679
|
}
|
|
693
680
|
var totalLegends = legendsOfLine.concat(actions);
|
|
694
|
-
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)));
|
|
681
|
+
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) })));
|
|
682
|
+
};
|
|
683
|
+
VerticalStackedBarChartBase.prototype._onLegendSelectionChange = function (selectedLegends, event, currentLegend) {
|
|
684
|
+
var _a, _b;
|
|
685
|
+
if ((_a = this.props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
|
|
686
|
+
this.setState({ selectedLegends: selectedLegends });
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
this.setState({ selectedLegends: selectedLegends.slice(-1) });
|
|
690
|
+
}
|
|
691
|
+
if ((_b = this.props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
|
|
692
|
+
this.props.legendProps.onChange(selectedLegends, event, currentLegend);
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
VerticalStackedBarChartBase.prototype._getHighlightedLegend = function () {
|
|
696
|
+
return this.state.selectedLegends.length > 0
|
|
697
|
+
? this.state.selectedLegends
|
|
698
|
+
: this.state.activeLegend
|
|
699
|
+
? [this.state.activeLegend]
|
|
700
|
+
: [];
|
|
695
701
|
};
|
|
696
702
|
VerticalStackedBarChartBase.prototype._onRectHover = function (xAxisPoint, point, color, mouseEvent) {
|
|
697
703
|
mouseEvent.persist();
|
|
@@ -710,7 +716,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
710
716
|
* Show the callout if highlighted bar is focused/hovered
|
|
711
717
|
* and Hide it if unhighlighted bar is focused/hovered
|
|
712
718
|
*/
|
|
713
|
-
isCalloutVisible: this.
|
|
719
|
+
isCalloutVisible: this._noLegendHighlighted() || this._isLegendHighlighted(point.legend),
|
|
714
720
|
calloutLegend: point.legend,
|
|
715
721
|
dataForHoverCard: point.data,
|
|
716
722
|
color: color,
|
|
@@ -726,6 +732,11 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
726
732
|
this._onStackHoverFocus(stack, mouseEvent);
|
|
727
733
|
};
|
|
728
734
|
VerticalStackedBarChartBase.prototype._onStackHoverFocus = function (stack, refSelected) {
|
|
735
|
+
var _this = this;
|
|
736
|
+
var _a, _b, _c;
|
|
737
|
+
if (!this._noLegendHighlighted()) {
|
|
738
|
+
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); }) });
|
|
739
|
+
}
|
|
729
740
|
var lineData = stack.lineData;
|
|
730
741
|
var isLinesPresent = lineData !== undefined && lineData.length > 0;
|
|
731
742
|
if (isLinesPresent) {
|
|
@@ -736,7 +747,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
736
747
|
}
|
|
737
748
|
this.setState({
|
|
738
749
|
refSelected: refSelected,
|
|
739
|
-
isCalloutVisible:
|
|
750
|
+
isCalloutVisible: stack.chartData.length > 0 || ((_c = (_b = stack.lineData) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0,
|
|
740
751
|
YValueHover: isLinesPresent
|
|
741
752
|
? 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(),
|
|
742
753
|
hoverXValue: stack.xAxisPoint instanceof Date ? (0, index_3.formatDate)(stack.xAxisPoint, this.props.useUTC) : stack.xAxisPoint,
|