@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
|
@@ -8,7 +8,7 @@ import { classNamesFunction, getId, getRTL, initializeComponentRef } from '@flue
|
|
|
8
8
|
import { DirectionalHint } from '@fluentui/react/lib/Callout';
|
|
9
9
|
import { CartesianChart, ChartHoverCard, Legends, } from '../../index';
|
|
10
10
|
import { FocusZoneDirection } from '@fluentui/react-focus';
|
|
11
|
-
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVerticalNumericMinMaxOfY, createNumericYAxis, domainRageOfVerticalNumeric, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfXStringAxis, createStringYAxis, formatDate, getNextGradient, } from '../../utilities/index';
|
|
11
|
+
import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVerticalNumericMinMaxOfY, createNumericYAxis, domainRageOfVerticalNumeric, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfXStringAxis, createStringYAxis, formatDate, getNextGradient, areArraysEqual, } from '../../utilities/index';
|
|
12
12
|
var CircleVisbility;
|
|
13
13
|
(function (CircleVisbility) {
|
|
14
14
|
CircleVisbility["show"] = "visibility";
|
|
@@ -19,7 +19,7 @@ var MIN_DOMAIN_MARGIN = 8;
|
|
|
19
19
|
var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
20
20
|
__extends(VerticalBarChartBase, _super);
|
|
21
21
|
function VerticalBarChartBase(props) {
|
|
22
|
-
var _a
|
|
22
|
+
var _a;
|
|
23
23
|
var _this = _super.call(this, props) || this;
|
|
24
24
|
_this._isRtl = getRTL();
|
|
25
25
|
_this._getDomainNRangeValues = function (points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
@@ -92,12 +92,12 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
92
92
|
dots));
|
|
93
93
|
};
|
|
94
94
|
_this._getCircleVisibilityAndRadius = function (xAxisPoint, legend) {
|
|
95
|
-
var
|
|
96
|
-
if (
|
|
97
|
-
if (xAxisPoint === activeXdataPoint &&
|
|
95
|
+
var activeXdataPoint = _this.state.activeXdataPoint;
|
|
96
|
+
if (!_this._noLegendHighlighted()) {
|
|
97
|
+
if (xAxisPoint === activeXdataPoint && _this._legendHighlighted(legend)) {
|
|
98
98
|
return { visibility: CircleVisbility.show, radius: 8 };
|
|
99
99
|
}
|
|
100
|
-
else if (
|
|
100
|
+
else if (_this._legendHighlighted(legend)) {
|
|
101
101
|
// Don't hide the circle to keep it focusable. For more information,
|
|
102
102
|
// see https://fuzzbomb.github.io/accessibility-demos/visually-hidden-focus-test.html
|
|
103
103
|
return { visibility: CircleVisbility.show, radius: 0.3 };
|
|
@@ -170,7 +170,9 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
170
170
|
: _this._createColors()(selectedPoint[0].y)
|
|
171
171
|
: _this._createColors()(1);
|
|
172
172
|
// there might be no y value of the line for the hovered bar. so we need to check this condition
|
|
173
|
-
if (_this._isHavingLine &&
|
|
173
|
+
if (_this._isHavingLine &&
|
|
174
|
+
((_a = selectedPoint[0].lineData) === null || _a === void 0 ? void 0 : _a.y) !== undefined &&
|
|
175
|
+
(_this._legendHighlighted(lineLegendText) || _this._noLegendHighlighted())) {
|
|
174
176
|
// callout data for the line
|
|
175
177
|
YValueHover.push({
|
|
176
178
|
legend: lineLegendText,
|
|
@@ -180,18 +182,20 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
180
182
|
yAxisCalloutData: (_d = selectedPoint[0].lineData) === null || _d === void 0 ? void 0 : _d.yAxisCalloutData,
|
|
181
183
|
});
|
|
182
184
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
?
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
185
|
+
if (_this._legendHighlighted(selectedPoint[0].legend) || _this._noLegendHighlighted()) {
|
|
186
|
+
// callout data for the bar
|
|
187
|
+
YValueHover.push({
|
|
188
|
+
legend: selectedPoint[0].legend,
|
|
189
|
+
y: selectedPoint[0].y,
|
|
190
|
+
color: enableGradient
|
|
191
|
+
? useSingleColor
|
|
192
|
+
? getNextGradient(0, 0)[0]
|
|
193
|
+
: ((_e = selectedPoint[0].gradient) === null || _e === void 0 ? void 0 : _e[0]) || getNextGradient(pointIndex, 0)[0]
|
|
194
|
+
: calloutColor,
|
|
195
|
+
data: selectedPoint[0].yAxisCalloutData,
|
|
196
|
+
yAxisCalloutData: selectedPoint[0].yAxisCalloutData,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
195
199
|
var hoverXValue = point.x instanceof Date ? formatDate(point.x, _this.props.useUTC) : point.x.toString();
|
|
196
200
|
return {
|
|
197
201
|
YValueHover: YValueHover,
|
|
@@ -217,7 +221,7 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
217
221
|
_this.setState({
|
|
218
222
|
refSelected: obj.refElement,
|
|
219
223
|
/** Show the callout if highlighted bar is focused and Hide it if unhighlighted bar is focused */
|
|
220
|
-
isCalloutVisible: _this.
|
|
224
|
+
isCalloutVisible: _this._noLegendHighlighted() || _this._legendHighlighted(point.legend),
|
|
221
225
|
calloutLegend: point.legend,
|
|
222
226
|
dataForHoverCard: point.y,
|
|
223
227
|
color: point.color || color,
|
|
@@ -322,9 +326,6 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
322
326
|
var legend = {
|
|
323
327
|
title: legendTitle,
|
|
324
328
|
color: color,
|
|
325
|
-
action: function () {
|
|
326
|
-
_this._onLegendClick(legendTitle);
|
|
327
|
-
},
|
|
328
329
|
hoverAction: function () {
|
|
329
330
|
_this._handleChartMouseLeave();
|
|
330
331
|
_this._onLegendHover(legendTitle);
|
|
@@ -339,9 +340,6 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
339
340
|
var lineLegend = {
|
|
340
341
|
title: lineLegendText,
|
|
341
342
|
color: lineLegendColor,
|
|
342
|
-
action: function () {
|
|
343
|
-
_this._onLegendClick(lineLegendText);
|
|
344
|
-
},
|
|
345
343
|
hoverAction: function () {
|
|
346
344
|
_this._handleChartMouseLeave();
|
|
347
345
|
_this._onLegendHover(lineLegendText);
|
|
@@ -353,7 +351,7 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
353
351
|
};
|
|
354
352
|
actions.unshift(lineLegend);
|
|
355
353
|
}
|
|
356
|
-
var legends = (React.createElement(Legends, __assign({ legends: actions, enabledWrapLines: _this.props.enabledLegendsWrapLines, overflowProps: _this.props.legendsOverflowProps, focusZonePropsInHoverCard: _this.props.focusZonePropsForLegendsInHoverCard, overflowText: _this.props.legendsOverflowText }, _this.props.legendProps)));
|
|
354
|
+
var legends = (React.createElement(Legends, __assign({ legends: actions, enabledWrapLines: _this.props.enabledLegendsWrapLines, overflowProps: _this.props.legendsOverflowProps, focusZonePropsInHoverCard: _this.props.focusZonePropsForLegendsInHoverCard, overflowText: _this.props.legendsOverflowText }, _this.props.legendProps, { onChange: _this._onLegendSelectionChange.bind(_this) })));
|
|
357
355
|
return legends;
|
|
358
356
|
};
|
|
359
357
|
_this._getAxisData = function (yAxisData) {
|
|
@@ -370,14 +368,13 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
370
368
|
* 2. hovering: if there is no selected legend and the user hovers over it
|
|
371
369
|
*/
|
|
372
370
|
_this._legendHighlighted = function (legendTitle) {
|
|
373
|
-
return
|
|
374
|
-
(_this.state.selectedLegend === '' && _this.state.activeLegend === legendTitle));
|
|
371
|
+
return _this._getHighlightedLegend().includes(legendTitle);
|
|
375
372
|
};
|
|
376
373
|
/**
|
|
377
374
|
* This function checks if none of the legends is selected or hovered.
|
|
378
375
|
*/
|
|
379
376
|
_this._noLegendHighlighted = function () {
|
|
380
|
-
return _this.
|
|
377
|
+
return _this._getHighlightedLegend().length === 0;
|
|
381
378
|
};
|
|
382
379
|
_this._getAriaLabel = function (point) {
|
|
383
380
|
var _a, _b, _c;
|
|
@@ -441,8 +438,8 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
441
438
|
dataForHoverCard: 0,
|
|
442
439
|
isCalloutVisible: false,
|
|
443
440
|
refSelected: null,
|
|
444
|
-
|
|
445
|
-
activeLegend:
|
|
441
|
+
selectedLegends: ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends) || [],
|
|
442
|
+
activeLegend: undefined,
|
|
446
443
|
xCalloutValue: '',
|
|
447
444
|
yCalloutValue: '',
|
|
448
445
|
activeXdataPoint: null,
|
|
@@ -463,6 +460,14 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
463
460
|
_this._cartesianChartRef = React.createRef();
|
|
464
461
|
return _this;
|
|
465
462
|
}
|
|
463
|
+
VerticalBarChartBase.prototype.componentDidUpdate = function (prevProps) {
|
|
464
|
+
var _a, _b, _c;
|
|
465
|
+
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)) {
|
|
466
|
+
this.setState({
|
|
467
|
+
selectedLegends: ((_c = this.props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || [],
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
};
|
|
466
471
|
VerticalBarChartBase.prototype.render = function () {
|
|
467
472
|
var _this = this;
|
|
468
473
|
this._adjustProps();
|
|
@@ -482,7 +487,8 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
482
487
|
tickValues: this.props.tickValues,
|
|
483
488
|
tickFormat: this.props.tickFormat,
|
|
484
489
|
};
|
|
485
|
-
return !this._isChartEmpty() ? (React.createElement(CartesianChart, __assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._points, supportNegativeData: this.props.supportNegativeData, chartType: ChartTypes.VerticalBarChart, xAxisType: this._xAxisType, createYAxis: createNumericYAxis, calloutProps: calloutProps, tickParams: tickParams }, (this._isHavingLine &&
|
|
490
|
+
return !this._isChartEmpty() ? (React.createElement(CartesianChart, __assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._points, supportNegativeData: this.props.supportNegativeData, chartType: ChartTypes.VerticalBarChart, xAxisType: this._xAxisType, createYAxis: createNumericYAxis, calloutProps: calloutProps, tickParams: tickParams }, (this._isHavingLine &&
|
|
491
|
+
(this._noLegendHighlighted() || this._getHighlightedLegend().length > 1) && { isCalloutForStack: true }), { legendBars: legendBars, datasetForXAxisDomain: this._xAxisLabels, barwidth: this._barWidth, focusZoneDirection: FocusZoneDirection.horizontal, customizedCallout: this._getCustomizedCallout(), createStringYAxis: createStringYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: findVerticalNumericMinMaxOfY, getGraphData: this._getGraphData, getDomainNRangeValues: this._getDomainNRangeValues, getAxisData: this._getAxisData, onChartMouseLeave: this._handleChartMouseLeave, getDomainMargins: this._getDomainMargins }, (this._xAxisType === XAxisTypes.StringAxis && {
|
|
486
492
|
xAxisInnerPadding: this._xAxisInnerPadding,
|
|
487
493
|
xAxisOuterPadding: this._xAxisOuterPadding,
|
|
488
494
|
}), { ref: this._cartesianChartRef,
|
|
@@ -535,7 +541,7 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
535
541
|
this.setState({
|
|
536
542
|
refSelected: mouseEvent,
|
|
537
543
|
/** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */
|
|
538
|
-
isCalloutVisible: this.
|
|
544
|
+
isCalloutVisible: this._noLegendHighlighted() || this._legendHighlighted(point.legend),
|
|
539
545
|
dataForHoverCard: point.y,
|
|
540
546
|
calloutLegend: point.legend,
|
|
541
547
|
color: point.color || color,
|
|
@@ -545,7 +551,7 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
545
551
|
yCalloutValue: point.yAxisCalloutData,
|
|
546
552
|
dataPointCalloutProps: point,
|
|
547
553
|
// Hovering over a bar should highlight corresponding line points only when no legend is selected
|
|
548
|
-
activeXdataPoint: this._noLegendHighlighted() ? point.x : null,
|
|
554
|
+
activeXdataPoint: this._noLegendHighlighted() || this._legendHighlighted(point.legend) ? point.x : null,
|
|
549
555
|
YValueHover: YValueHover,
|
|
550
556
|
hoverXValue: hoverXValue,
|
|
551
557
|
callOutAccessibilityData: point.callOutAccessibilityData,
|
|
@@ -797,18 +803,6 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
797
803
|
}
|
|
798
804
|
return bars;
|
|
799
805
|
};
|
|
800
|
-
VerticalBarChartBase.prototype._onLegendClick = function (legendTitle) {
|
|
801
|
-
if (this.state.selectedLegend === legendTitle) {
|
|
802
|
-
this.setState({
|
|
803
|
-
selectedLegend: '',
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
else {
|
|
807
|
-
this.setState({
|
|
808
|
-
selectedLegend: legendTitle,
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
806
|
VerticalBarChartBase.prototype._onLegendHover = function (legendTitle) {
|
|
813
807
|
this.setState({
|
|
814
808
|
activeLegend: legendTitle,
|
|
@@ -816,9 +810,28 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
|
|
|
816
810
|
};
|
|
817
811
|
VerticalBarChartBase.prototype._onLegendLeave = function () {
|
|
818
812
|
this.setState({
|
|
819
|
-
activeLegend:
|
|
813
|
+
activeLegend: undefined,
|
|
820
814
|
});
|
|
821
815
|
};
|
|
816
|
+
VerticalBarChartBase.prototype._onLegendSelectionChange = function (selectedLegends, event, currentLegend) {
|
|
817
|
+
var _a, _b;
|
|
818
|
+
if ((_a = this.props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
|
|
819
|
+
this.setState({ selectedLegends: selectedLegends });
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
this.setState({ selectedLegends: selectedLegends.slice(-1) });
|
|
823
|
+
}
|
|
824
|
+
if ((_b = this.props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
|
|
825
|
+
this.props.legendProps.onChange(selectedLegends, event, currentLegend);
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
VerticalBarChartBase.prototype._getHighlightedLegend = function () {
|
|
829
|
+
return this.state.selectedLegends.length > 0
|
|
830
|
+
? this.state.selectedLegends
|
|
831
|
+
: this.state.activeLegend
|
|
832
|
+
? [this.state.activeLegend]
|
|
833
|
+
: [];
|
|
834
|
+
};
|
|
822
835
|
VerticalBarChartBase.prototype._renderBarLabel = function (xPoint, yPoint, barValue, legend, isNegativeBar) {
|
|
823
836
|
if (this.props.hideLabels ||
|
|
824
837
|
this._barWidth < 16 ||
|