@fluentui/react-charts 9.3.6 → 9.3.8
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.md +46 -2
- package/dist/index.d.ts +70 -17
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
- package/lib/components/AreaChart/AreaChart.js +3 -43
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +8 -11
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +52 -32
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.js +1 -2
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +9 -7
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -5
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -25
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -209
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +9 -15
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js +4 -2
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +8 -13
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js +4 -17
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +8 -13
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +24 -36
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +3 -16
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/Legends/Legends.js +3 -4
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +68 -75
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.js +4 -10
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +41 -49
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/Sparkline/Sparkline.js +11 -7
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +15 -92
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +28 -49
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/types/ChartAnnotation.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/Common.styles.js +0 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +0 -1
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/getWindow.js +0 -1
- package/lib/utilities/getWindow.js.map +1 -1
- package/lib/utilities/hooks.js +34 -0
- package/lib/utilities/hooks.js.map +1 -0
- package/lib/utilities/image-export-utils.js +118 -78
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.js +243 -102
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js +2 -41
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +9 -11
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +51 -31
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -6
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -4
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -25
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -208
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +7 -13
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +7 -12
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js +3 -16
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +7 -12
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -34
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -15
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -23
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js +3 -4
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +67 -74
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +4 -10
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +38 -46
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +14 -91
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -47
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.js +0 -1
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/getWindow.js +0 -1
- package/lib-commonjs/utilities/getWindow.js.map +1 -1
- package/lib-commonjs/utilities/hooks.js +45 -0
- package/lib-commonjs/utilities/hooks.js.map +1 -0
- package/lib-commonjs/utilities/image-export-utils.js +119 -79
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +253 -101
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +9 -9
- package/lib/components/DeclarativeChart/imageExporter.js +0 -223
- package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
|
@@ -12,15 +12,14 @@ Object.defineProperty(exports, "VerticalStackedBarChart", {
|
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
14
|
const _d3array = require("d3-array");
|
|
15
|
-
const _d3selection = require("d3-selection");
|
|
16
15
|
const _useVerticalStackedBarChartStylesstyles = require("./useVerticalStackedBarChartStyles.styles");
|
|
17
16
|
const _d3scale = require("d3-scale");
|
|
18
17
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
19
18
|
const _reacttheme = require("@fluentui/react-theme");
|
|
20
19
|
const _index = require("../../index");
|
|
21
20
|
const _index1 = require("../../utilities/index");
|
|
22
|
-
const _imageexportutils = require("../../utilities/image-export-utils");
|
|
23
21
|
const _chartutilities = require("@fluentui/chart-utilities");
|
|
22
|
+
const _hooks = require("../../utilities/hooks");
|
|
24
23
|
const barGapMultiplier = 0.2;
|
|
25
24
|
const barGapMin = 1;
|
|
26
25
|
const MIN_DOMAIN_MARGIN = 8;
|
|
@@ -34,7 +33,6 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
34
33
|
};
|
|
35
34
|
const _isRtl = (0, _index1.useRtl)();
|
|
36
35
|
const _createLegendsForLine = (data)=>_getLineLegends(data);
|
|
37
|
-
const _tooltipId = (0, _reactutilities.useId)('VSBCTooltipId_');
|
|
38
36
|
const _emptyChartId = (0, _reactutilities.useId)('_VSBC_empty');
|
|
39
37
|
let _points = [];
|
|
40
38
|
let _dataset;
|
|
@@ -51,9 +49,8 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
51
49
|
let _domainMargin = MIN_DOMAIN_MARGIN;
|
|
52
50
|
let _xAxisInnerPadding = 0;
|
|
53
51
|
let _xAxisOuterPadding = 0;
|
|
54
|
-
const cartesianChartRef =
|
|
52
|
+
const { cartesianChartRef, legendsRef: _legendsRef } = (0, _hooks.useImageExport)(props.componentRef, props.hideLegend);
|
|
55
53
|
const Y_ORIGIN = 0;
|
|
56
|
-
const _legendsRef = _react.useRef(null);
|
|
57
54
|
let _yAxisType;
|
|
58
55
|
let _yAxisLabels = [];
|
|
59
56
|
const [selectedLegends, setSelectedLegends] = _react.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
|
|
@@ -92,17 +89,6 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
92
89
|
}, [
|
|
93
90
|
props
|
|
94
91
|
]);
|
|
95
|
-
_react.useImperativeHandle(props.componentRef, ()=>{
|
|
96
|
-
var _cartesianChartRef_current;
|
|
97
|
-
var _cartesianChartRef_current_chartContainer;
|
|
98
|
-
return {
|
|
99
|
-
chartContainer: (_cartesianChartRef_current_chartContainer = (_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer) !== null && _cartesianChartRef_current_chartContainer !== void 0 ? _cartesianChartRef_current_chartContainer : null,
|
|
100
|
-
toImage: (opts)=>{
|
|
101
|
-
var _cartesianChartRef_current, _legendsRef_current;
|
|
102
|
-
return (0, _imageexportutils.toImage)((_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer, (_legendsRef_current = _legendsRef.current) === null || _legendsRef_current === void 0 ? void 0 : _legendsRef_current.toSVG, _isRtl, opts);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}, []);
|
|
106
92
|
function _getLegendData(data, lineLegends) {
|
|
107
93
|
if (props.hideLegend) {
|
|
108
94
|
return /*#__PURE__*/ _react.createElement(_react.Fragment, null);
|
|
@@ -151,7 +137,7 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
151
137
|
legendsOfLine.push(legend);
|
|
152
138
|
});
|
|
153
139
|
}
|
|
154
|
-
const totalLegends =
|
|
140
|
+
const totalLegends = actions.concat(legendsOfLine);
|
|
155
141
|
return /*#__PURE__*/ _react.createElement(_index.Legends, {
|
|
156
142
|
legends: totalLegends,
|
|
157
143
|
enabledWrapLines: props.enabledLegendsWrapLines,
|
|
@@ -190,16 +176,17 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
190
176
|
_onStackHoverFocus(lineData.xItem, event);
|
|
191
177
|
}
|
|
192
178
|
}
|
|
193
|
-
function _onStackHoverFocus(stack,
|
|
179
|
+
function _onStackHoverFocus(stack, event) {
|
|
194
180
|
var _stack_lineData;
|
|
195
181
|
let clientX = 0;
|
|
196
182
|
let clientY = 0;
|
|
197
|
-
if ('clientX' in
|
|
198
|
-
clientX =
|
|
199
|
-
clientY =
|
|
183
|
+
if ('clientX' in event) {
|
|
184
|
+
clientX = event.clientX;
|
|
185
|
+
clientY = event.clientY;
|
|
200
186
|
} else {
|
|
201
|
-
// Handle
|
|
202
|
-
const
|
|
187
|
+
// Handle React FocusEvent or SVGGElement
|
|
188
|
+
const element = 'target' in event ? event.target : event;
|
|
189
|
+
const boundingRect = element.getBoundingClientRect();
|
|
203
190
|
clientX = boundingRect.left + boundingRect.width / 2;
|
|
204
191
|
clientY = boundingRect.top + boundingRect.height / 2;
|
|
205
192
|
}
|
|
@@ -242,6 +229,7 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
242
229
|
props.href ? window.location.href = props.href : '';
|
|
243
230
|
};
|
|
244
231
|
function _adjustProps() {
|
|
232
|
+
var _points_;
|
|
245
233
|
_points = props.data || [];
|
|
246
234
|
_barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth);
|
|
247
235
|
const defaultColors = [
|
|
@@ -252,7 +240,8 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
252
240
|
(0, _index1.getColorFromToken)(_index1.DataVizPalette.color10)
|
|
253
241
|
];
|
|
254
242
|
_colors = defaultColors;
|
|
255
|
-
|
|
243
|
+
const firstXValue = (_points_ = _points[0]) === null || _points_ === void 0 ? void 0 : _points_.xAxisPoint;
|
|
244
|
+
_xAxisType = (0, _chartutilities.isInvalidValue)(firstXValue) ? _index1.XAxisTypes.StringAxis : (0, _index1.getTypeOfAxis)(firstXValue, true);
|
|
256
245
|
_lineObject = _getFormattedLineData(props.data);
|
|
257
246
|
_xAxisInnerPadding = (0, _index1.getScalePadding)(props.xAxisInnerPadding, props.xAxisPadding, _xAxisType === _index1.XAxisTypes.StringAxis ? 2 / 3 : 1 / 2);
|
|
258
247
|
_xAxisOuterPadding = (0, _index1.getScalePadding)(props.xAxisOuterPadding, props.xAxisPadding, 0);
|
|
@@ -884,17 +873,26 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
884
873
|
};
|
|
885
874
|
let showLabel = false;
|
|
886
875
|
let barLabel = 0;
|
|
876
|
+
let selectedBarTotalValue = 0;
|
|
877
|
+
let customBarLabel = undefined;
|
|
887
878
|
if (!props.hideLabels && _yAxisType !== _index1.YAxisType.StringAxis) {
|
|
879
|
+
// Collect all bars with barLabel that match the legend filter
|
|
880
|
+
const barLabelsToDisplay = barsToDisplay.filter((point)=>point.barLabel && (_noLegendHighlighted() || _isLegendHighlighted(point.legend)));
|
|
881
|
+
if (barLabelsToDisplay.length > 0) {
|
|
882
|
+
customBarLabel = barLabelsToDisplay[barLabelsToDisplay.length - 1].barLabel;
|
|
883
|
+
}
|
|
888
884
|
if (_noLegendHighlighted()) {
|
|
889
885
|
showLabel = true;
|
|
890
|
-
barLabel = barTotalValue;
|
|
886
|
+
barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : barTotalValue;
|
|
887
|
+
selectedBarTotalValue = barTotalValue;
|
|
891
888
|
} else {
|
|
892
889
|
barsToDisplay.forEach((point)=>{
|
|
893
890
|
if (_isLegendHighlighted(point.legend)) {
|
|
894
891
|
showLabel = true;
|
|
895
|
-
|
|
892
|
+
selectedBarTotalValue += point.data;
|
|
896
893
|
}
|
|
897
894
|
});
|
|
895
|
+
barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : selectedBarTotalValue;
|
|
898
896
|
}
|
|
899
897
|
}
|
|
900
898
|
return /*#__PURE__*/ _react.createElement("g", {
|
|
@@ -908,7 +906,7 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
908
906
|
}, singleBar), !props.hideLabels && _barWidth >= 16 && showLabel && /*#__PURE__*/ _react.createElement("text", {
|
|
909
907
|
x: xPoint + _barWidth / 2,
|
|
910
908
|
//if total bar value >=0, show label above top bar, otherwise below bottom bar
|
|
911
|
-
y:
|
|
909
|
+
y: selectedBarTotalValue >= Y_ORIGIN ? yPoint - 6 : yPoint + heightOfLastBar + 12,
|
|
912
910
|
textAnchor: "middle",
|
|
913
911
|
className: classes.barLabel,
|
|
914
912
|
"aria-label": `Total: ${barLabel}`,
|
|
@@ -918,27 +916,8 @@ const VerticalStackedBarChart = /*#__PURE__*/ _react.forwardRef((_props, forward
|
|
|
918
916
|
direction: 'ltr',
|
|
919
917
|
unicodeBidi: 'isolate'
|
|
920
918
|
}
|
|
921
|
-
}, typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : (0, _index1.formatScientificLimitWidth)(barLabel)));
|
|
919
|
+
}, typeof barLabel === 'string' ? barLabel : typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : (0, _index1.formatScientificLimitWidth)(barLabel)));
|
|
922
920
|
});
|
|
923
|
-
if (!props.showXAxisLablesTooltip) {
|
|
924
|
-
try {
|
|
925
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
926
|
-
// eslint-disable-next-line no-empty
|
|
927
|
-
} catch (e) {}
|
|
928
|
-
}
|
|
929
|
-
if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
|
|
930
|
-
const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
|
|
931
|
-
try {
|
|
932
|
-
document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
|
|
933
|
-
// eslint-disable-next-line no-empty
|
|
934
|
-
} catch (e) {}
|
|
935
|
-
const tooltipProps = {
|
|
936
|
-
tooltipCls: classes.tooltip,
|
|
937
|
-
id: _tooltipId,
|
|
938
|
-
axis: xAxisElement
|
|
939
|
-
};
|
|
940
|
-
xAxisElement && (0, _index1.tooltipOfAxislabels)(tooltipProps);
|
|
941
|
-
}
|
|
942
921
|
return bars.filter((bar)=>!!bar);
|
|
943
922
|
}
|
|
944
923
|
function _getMinMaxOfYAxis(dataset, yAxisType, useSecondaryYScale) {
|