@fluentui/react-charting 5.23.30 → 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.
- package/CHANGELOG.json +55 -1
- package/CHANGELOG.md +24 -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 +1 -1
- package/lib/components/AreaChart/AreaChart.base.js +7 -1
- 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 +48 -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 +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +16 -3
- 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 +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js +7 -1
- 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 +47 -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 +1 -0
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +16 -3
- 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 +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +7 -1
- 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 +47 -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 +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +16 -3
- 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 +1 -1
- package/src/components/HeatMapChart/HeatMapChart.types.ts +5 -0
- package/src/components/SankeyChart/SankeyChart.types.ts +6 -0
|
@@ -8,7 +8,7 @@ import { DirectionalHint } from '@fluentui/react/lib/Callout';
|
|
|
8
8
|
import { Legends } from '../Legends/index';
|
|
9
9
|
import { CartesianChart, ChartHoverCard, } from '../../index';
|
|
10
10
|
import { FocusZoneDirection } from '@fluentui/react-focus';
|
|
11
|
-
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, formatDate, getNextGradient, } from '../../utilities/index';
|
|
11
|
+
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, formatDate, getNextGradient, areArraysEqual, } from '../../utilities/index';
|
|
12
12
|
var getClassNames = classNamesFunction();
|
|
13
13
|
var COMPONENT_NAME = 'VERTICAL STACKED BAR CHART';
|
|
14
14
|
// When displaying gaps between bars, the max height of the gap is given in the
|
|
@@ -25,7 +25,7 @@ var CircleVisbility;
|
|
|
25
25
|
var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
26
26
|
__extends(VerticalStackedBarChartBase, _super);
|
|
27
27
|
function VerticalStackedBarChartBase(props) {
|
|
28
|
-
var _a
|
|
28
|
+
var _a;
|
|
29
29
|
var _this = _super.call(this, props) || this;
|
|
30
30
|
_this._isRtl = getRTL();
|
|
31
31
|
/**
|
|
@@ -40,7 +40,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
40
40
|
var _a = _this.props.isCalloutForStack, isCalloutForStack = _a === void 0 ? false : _a;
|
|
41
41
|
var shouldFocusStackOnly = false;
|
|
42
42
|
if (_isHavingLines) {
|
|
43
|
-
if (_this.
|
|
43
|
+
if (_this._getHighlightedLegend().length === 1) {
|
|
44
44
|
shouldFocusStackOnly = false;
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
@@ -113,7 +113,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
113
113
|
: 0;
|
|
114
114
|
var xScaleBandwidthTranslate = _this._xAxisType !== XAxisTypes.StringAxis ? 0 : xScale.bandwidth() / 2;
|
|
115
115
|
Object.keys(lineObject).forEach(function (item, index) {
|
|
116
|
-
var shouldHighlight = _this.
|
|
116
|
+
var shouldHighlight = _this._isLegendHighlighted(item) || _this._noLegendHighlighted(); // item is legend name
|
|
117
117
|
for (var i = 1; i < lineObject[item].length; i++) {
|
|
118
118
|
var x1 = xScale(lineObject[item][i - 1].xItem.xAxisPoint);
|
|
119
119
|
var useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && secondaryYScale;
|
|
@@ -123,7 +123,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
123
123
|
if (lineBorderWidth > 0) {
|
|
124
124
|
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)") }));
|
|
125
125
|
}
|
|
126
|
-
lines.push(React.createElement("line", __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.
|
|
126
|
+
lines.push(React.createElement("line", __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) && {
|
|
127
127
|
onMouseOver: _this._lineHover.bind(_this, lineObject[item][i - 1]),
|
|
128
128
|
onMouseLeave: _this._lineHoverOut,
|
|
129
129
|
}))));
|
|
@@ -133,11 +133,11 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
133
133
|
lineObject[item].forEach(function (circlePoint, subIndex) {
|
|
134
134
|
// Create an object to store line point ref so that the object can be passed by reference to the focus handler
|
|
135
135
|
var circleRef = { refElement: null };
|
|
136
|
-
dots.push(React.createElement("circle", __assign({ key: "".concat(index, "-").concat(subIndex, "-dot"), cx: xScale(circlePoint.xItem.xAxisPoint), cy: circlePoint.useSecondaryYScale && secondaryYScale ? secondaryYScale(circlePoint.y) : yScale(circlePoint.y), onMouseOver: _this.
|
|
136
|
+
dots.push(React.createElement("circle", __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)
|
|
137
137
|
? _this._lineHover.bind(_this, circlePoint)
|
|
138
|
-
: _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this.
|
|
138
|
+
: _this._onStackHover.bind(_this, circlePoint.xItem) }, (_this._isLegendHighlighted(item) && {
|
|
139
139
|
onMouseLeave: _this._lineHoverOut,
|
|
140
|
-
}), { 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.
|
|
140
|
+
}), { 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 })));
|
|
141
141
|
});
|
|
142
142
|
});
|
|
143
143
|
return (React.createElement(React.Fragment, null,
|
|
@@ -146,12 +146,12 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
146
146
|
dots));
|
|
147
147
|
};
|
|
148
148
|
_this._getCircleVisibilityAndRadius = function (xAxisPoint, legend) {
|
|
149
|
-
var
|
|
150
|
-
if (
|
|
151
|
-
if (xAxisPoint === activeXAxisDataPoint &&
|
|
149
|
+
var activeXAxisDataPoint = _this.state.activeXAxisDataPoint;
|
|
150
|
+
if (!_this._noLegendHighlighted()) {
|
|
151
|
+
if (xAxisPoint === activeXAxisDataPoint && _this._isLegendHighlighted(legend)) {
|
|
152
152
|
return { visibility: CircleVisbility.show, radius: 8 };
|
|
153
153
|
}
|
|
154
|
-
else if (
|
|
154
|
+
else if (_this._isLegendHighlighted(legend)) {
|
|
155
155
|
return { visibility: CircleVisbility.show, radius: 0.3 };
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
@@ -254,7 +254,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
254
254
|
singleChartData.chartData[index].color = startColor;
|
|
255
255
|
}
|
|
256
256
|
var ref = {};
|
|
257
|
-
var shouldHighlight = _this.
|
|
257
|
+
var shouldHighlight = _this._isLegendHighlighted(point.legend) || _this._noLegendHighlighted() ? true : false;
|
|
258
258
|
_this._classNames = getClassNames(_this.props.styles, {
|
|
259
259
|
theme: _this.props.theme,
|
|
260
260
|
shouldHighlight: shouldHighlight,
|
|
@@ -318,7 +318,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
318
318
|
}
|
|
319
319
|
else {
|
|
320
320
|
barsToDisplay.forEach(function (point) {
|
|
321
|
-
if (_this.
|
|
321
|
+
if (_this._isLegendHighlighted(point.legend)) {
|
|
322
322
|
showLabel = true;
|
|
323
323
|
barLabel += point.data;
|
|
324
324
|
}
|
|
@@ -413,15 +413,14 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
413
413
|
* 1. selection: if the user clicks on it
|
|
414
414
|
* 2. hovering: if there is no selected legend and the user hovers over it
|
|
415
415
|
*/
|
|
416
|
-
_this.
|
|
417
|
-
return
|
|
418
|
-
(_this.state.selectedLegend === '' && _this.state.activeLegend === legendTitle));
|
|
416
|
+
_this._isLegendHighlighted = function (legendTitle) {
|
|
417
|
+
return _this._getHighlightedLegend().includes(legendTitle);
|
|
419
418
|
};
|
|
420
419
|
/**
|
|
421
420
|
* This function checks if none of the legends is selected or hovered.
|
|
422
421
|
*/
|
|
423
422
|
_this._noLegendHighlighted = function () {
|
|
424
|
-
return _this.
|
|
423
|
+
return _this._getHighlightedLegend().length === 0;
|
|
425
424
|
};
|
|
426
425
|
_this._getAriaLabel = function (singleChartData, point) {
|
|
427
426
|
var _a, _b, _c;
|
|
@@ -499,8 +498,8 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
499
498
|
initializeComponentRef(_this);
|
|
500
499
|
_this.state = {
|
|
501
500
|
isCalloutVisible: false,
|
|
502
|
-
|
|
503
|
-
activeLegend:
|
|
501
|
+
selectedLegends: ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends) || [],
|
|
502
|
+
activeLegend: undefined,
|
|
504
503
|
refSelected: null,
|
|
505
504
|
dataForHoverCard: 0,
|
|
506
505
|
color: '',
|
|
@@ -529,6 +528,12 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
529
528
|
return _this;
|
|
530
529
|
}
|
|
531
530
|
VerticalStackedBarChartBase.prototype.componentDidUpdate = function (prevProps) {
|
|
531
|
+
var _a, _b, _c;
|
|
532
|
+
if (!areArraysEqual((_a = prevProps.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends, (_b = this.props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends)) {
|
|
533
|
+
this.setState({
|
|
534
|
+
selectedLegends: ((_c = this.props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || [],
|
|
535
|
+
});
|
|
536
|
+
}
|
|
532
537
|
if (prevProps.height !== this.props.height ||
|
|
533
538
|
prevProps.width !== this.props.width ||
|
|
534
539
|
prevProps.data !== this.props.data) {
|
|
@@ -607,18 +612,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
607
612
|
VerticalStackedBarChartBase.prototype._renderCallout = function (props) {
|
|
608
613
|
return props ? (React.createElement(ChartHoverCard, { XValue: props.xAxisCalloutData, Legend: props.legend, YValue: props.yAxisCalloutData, color: props.color, culture: this.props.culture })) : null;
|
|
609
614
|
};
|
|
610
|
-
VerticalStackedBarChartBase.prototype._onLegendClick = function (legendTitle) {
|
|
611
|
-
if (this.state.selectedLegend === legendTitle) {
|
|
612
|
-
this.setState({
|
|
613
|
-
selectedLegend: '',
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
this.setState({
|
|
618
|
-
selectedLegend: legendTitle,
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
};
|
|
622
615
|
VerticalStackedBarChartBase.prototype._onLegendHover = function (legendTitle) {
|
|
623
616
|
this.setState({
|
|
624
617
|
activeLegend: legendTitle,
|
|
@@ -626,7 +619,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
626
619
|
};
|
|
627
620
|
VerticalStackedBarChartBase.prototype._onLegendLeave = function () {
|
|
628
621
|
this.setState({
|
|
629
|
-
activeLegend:
|
|
622
|
+
activeLegend: undefined,
|
|
630
623
|
});
|
|
631
624
|
};
|
|
632
625
|
VerticalStackedBarChartBase.prototype._getLegendData = function (data, palette, lineLegends) {
|
|
@@ -652,9 +645,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
652
645
|
var legend = {
|
|
653
646
|
title: point.legend,
|
|
654
647
|
color: color,
|
|
655
|
-
action: function () {
|
|
656
|
-
_this._onLegendClick(point.legend);
|
|
657
|
-
},
|
|
658
648
|
hoverAction: allowHoverOnLegend
|
|
659
649
|
? function () {
|
|
660
650
|
_this._handleChartMouseLeave();
|
|
@@ -673,9 +663,6 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
673
663
|
title: point.title,
|
|
674
664
|
color: point.color,
|
|
675
665
|
isLineLegendInBarChart: true,
|
|
676
|
-
action: function () {
|
|
677
|
-
_this._onLegendClick(point.title);
|
|
678
|
-
},
|
|
679
666
|
hoverAction: allowHoverOnLegend
|
|
680
667
|
? function () {
|
|
681
668
|
_this._handleChartMouseLeave();
|
|
@@ -688,7 +675,26 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
688
675
|
});
|
|
689
676
|
}
|
|
690
677
|
var totalLegends = legendsOfLine.concat(actions);
|
|
691
|
-
return (React.createElement(Legends, __assign({ legends: totalLegends, overflowProps: this.props.legendsOverflowProps, enabledWrapLines: this.props.enabledLegendsWrapLines, focusZonePropsInHoverCard: this.props.focusZonePropsForLegendsInHoverCard, overflowText: this.props.legendsOverflowText }, this.props.legendProps)));
|
|
678
|
+
return (React.createElement(Legends, __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) })));
|
|
679
|
+
};
|
|
680
|
+
VerticalStackedBarChartBase.prototype._onLegendSelectionChange = function (selectedLegends, event, currentLegend) {
|
|
681
|
+
var _a, _b;
|
|
682
|
+
if ((_a = this.props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
|
|
683
|
+
this.setState({ selectedLegends: selectedLegends });
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
this.setState({ selectedLegends: selectedLegends.slice(-1) });
|
|
687
|
+
}
|
|
688
|
+
if ((_b = this.props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
|
|
689
|
+
this.props.legendProps.onChange(selectedLegends, event, currentLegend);
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
VerticalStackedBarChartBase.prototype._getHighlightedLegend = function () {
|
|
693
|
+
return this.state.selectedLegends.length > 0
|
|
694
|
+
? this.state.selectedLegends
|
|
695
|
+
: this.state.activeLegend
|
|
696
|
+
? [this.state.activeLegend]
|
|
697
|
+
: [];
|
|
692
698
|
};
|
|
693
699
|
VerticalStackedBarChartBase.prototype._onRectHover = function (xAxisPoint, point, color, mouseEvent) {
|
|
694
700
|
mouseEvent.persist();
|
|
@@ -707,7 +713,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
707
713
|
* Show the callout if highlighted bar is focused/hovered
|
|
708
714
|
* and Hide it if unhighlighted bar is focused/hovered
|
|
709
715
|
*/
|
|
710
|
-
isCalloutVisible: this.
|
|
716
|
+
isCalloutVisible: this._noLegendHighlighted() || this._isLegendHighlighted(point.legend),
|
|
711
717
|
calloutLegend: point.legend,
|
|
712
718
|
dataForHoverCard: point.data,
|
|
713
719
|
color: color,
|
|
@@ -723,6 +729,11 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
723
729
|
this._onStackHoverFocus(stack, mouseEvent);
|
|
724
730
|
};
|
|
725
731
|
VerticalStackedBarChartBase.prototype._onStackHoverFocus = function (stack, refSelected) {
|
|
732
|
+
var _this = this;
|
|
733
|
+
var _a, _b, _c;
|
|
734
|
+
if (!this._noLegendHighlighted()) {
|
|
735
|
+
stack = __assign(__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); }) });
|
|
736
|
+
}
|
|
726
737
|
var lineData = stack.lineData;
|
|
727
738
|
var isLinesPresent = lineData !== undefined && lineData.length > 0;
|
|
728
739
|
if (isLinesPresent) {
|
|
@@ -733,7 +744,7 @@ var VerticalStackedBarChartBase = /** @class */ (function (_super) {
|
|
|
733
744
|
}
|
|
734
745
|
this.setState({
|
|
735
746
|
refSelected: refSelected,
|
|
736
|
-
isCalloutVisible:
|
|
747
|
+
isCalloutVisible: stack.chartData.length > 0 || ((_c = (_b = stack.lineData) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0,
|
|
737
748
|
YValueHover: isLinesPresent
|
|
738
749
|
? __spreadArray(__spreadArray([], lineData.sort(function (a, b) { return (a.data < b.data ? 1 : -1); }), true), stack.chartData.slice().reverse(), true) : stack.chartData.slice().reverse(),
|
|
739
750
|
hoverXValue: stack.xAxisPoint instanceof Date ? formatDate(stack.xAxisPoint, this.props.useUTC) : stack.xAxisPoint,
|