@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.
Files changed (210) hide show
  1. package/CHANGELOG.md +46 -2
  2. package/dist/index.d.ts +70 -17
  3. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  4. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  6. package/lib/components/AreaChart/AreaChart.js +3 -43
  7. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  10. package/lib/components/ChartTable/ChartTable.js +8 -11
  11. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  12. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  13. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  15. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  16. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  17. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  18. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  19. package/lib/components/CommonComponents/CartesianChart.js +52 -32
  20. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  21. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  22. package/lib/components/CommonComponents/ChartPopover.js +1 -2
  23. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  24. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +9 -7
  25. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  26. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -5
  27. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  28. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  29. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  30. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  31. package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -25
  32. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -209
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  35. package/lib/components/DonutChart/DonutChart.js +9 -15
  36. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  37. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  38. package/lib/components/DonutChart/Pie/Pie.js +4 -2
  39. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  40. package/lib/components/FunnelChart/FunnelChart.js +8 -13
  41. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  42. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  43. package/lib/components/GanttChart/GanttChart.js +4 -17
  44. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  45. package/lib/components/GaugeChart/GaugeChart.js +8 -13
  46. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  47. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  48. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +24 -36
  49. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  50. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  51. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  52. package/lib/components/HeatMapChart/HeatMapChart.js +3 -16
  53. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  54. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
  55. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  56. package/lib/components/Legends/Legends.js +3 -4
  57. package/lib/components/Legends/Legends.js.map +1 -1
  58. package/lib/components/Legends/Legends.types.js.map +1 -1
  59. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  60. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  61. package/lib/components/LineChart/LineChart.js +68 -75
  62. package/lib/components/LineChart/LineChart.js.map +1 -1
  63. package/lib/components/LineChart/LineChart.types.js +1 -1
  64. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  65. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
  66. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  67. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  68. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  69. package/lib/components/SankeyChart/SankeyChart.js +4 -10
  70. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  71. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  72. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
  73. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  74. package/lib/components/ScatterChart/ScatterChart.js +41 -49
  75. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  76. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  77. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  78. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  79. package/lib/components/Sparkline/Sparkline.js +11 -7
  80. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  81. package/lib/components/VerticalBarChart/VerticalBarChart.js +15 -92
  82. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  83. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  84. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  85. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +28 -49
  86. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  87. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  88. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  89. package/lib/types/ChartAnnotation.js.map +1 -1
  90. package/lib/types/DataPoint.js.map +1 -1
  91. package/lib/utilities/Common.styles.js +0 -1
  92. package/lib/utilities/Common.styles.js.map +1 -1
  93. package/lib/utilities/Common.styles.raw.js +0 -1
  94. package/lib/utilities/Common.styles.raw.js.map +1 -1
  95. package/lib/utilities/FocusableTooltipText.js +1 -1
  96. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  97. package/lib/utilities/getWindow.js +0 -1
  98. package/lib/utilities/getWindow.js.map +1 -1
  99. package/lib/utilities/hooks.js +34 -0
  100. package/lib/utilities/hooks.js.map +1 -0
  101. package/lib/utilities/image-export-utils.js +118 -78
  102. package/lib/utilities/image-export-utils.js.map +1 -1
  103. package/lib/utilities/utilities.js +243 -102
  104. package/lib/utilities/utilities.js.map +1 -1
  105. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  106. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  107. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  108. package/lib-commonjs/components/AreaChart/AreaChart.js +2 -41
  109. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  110. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  111. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/ChartTable/ChartTable.js +9 -11
  113. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  114. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  115. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  116. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  117. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  118. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  119. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  120. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.js +51 -31
  122. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  123. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  124. package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
  125. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  126. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -6
  127. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  128. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -4
  129. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  130. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  131. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  132. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  133. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -25
  134. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  135. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -208
  136. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  137. package/lib-commonjs/components/DonutChart/DonutChart.js +7 -13
  138. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  139. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  140. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  141. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  142. package/lib-commonjs/components/FunnelChart/FunnelChart.js +7 -12
  143. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  144. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  145. package/lib-commonjs/components/GanttChart/GanttChart.js +3 -16
  146. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  147. package/lib-commonjs/components/GaugeChart/GaugeChart.js +7 -12
  148. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  149. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  150. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -34
  151. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  152. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  153. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  154. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -15
  155. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  156. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -23
  157. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  158. package/lib-commonjs/components/Legends/Legends.js +3 -4
  159. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  160. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  161. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  162. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  163. package/lib-commonjs/components/LineChart/LineChart.js +67 -74
  164. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  165. package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
  166. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  167. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
  168. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  169. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  170. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  171. package/lib-commonjs/components/SankeyChart/SankeyChart.js +4 -10
  172. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  173. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  174. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
  175. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  176. package/lib-commonjs/components/ScatterChart/ScatterChart.js +38 -46
  177. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  178. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  179. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  180. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  181. package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
  182. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  183. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +14 -91
  184. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  185. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  186. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  187. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -47
  188. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  189. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  190. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  191. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  192. package/lib-commonjs/types/DataPoint.js.map +1 -1
  193. package/lib-commonjs/utilities/Common.styles.js +0 -1
  194. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  195. package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
  196. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  197. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  198. package/lib-commonjs/utilities/getWindow.js +0 -1
  199. package/lib-commonjs/utilities/getWindow.js.map +1 -1
  200. package/lib-commonjs/utilities/hooks.js +45 -0
  201. package/lib-commonjs/utilities/hooks.js.map +1 -0
  202. package/lib-commonjs/utilities/image-export-utils.js +119 -79
  203. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  204. package/lib-commonjs/utilities/utilities.js +253 -101
  205. package/lib-commonjs/utilities/utilities.js.map +1 -1
  206. package/package.json +9 -9
  207. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  208. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  209. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  210. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -1,15 +1,14 @@
1
1
  'use client';
2
2
  import * as React from 'react';
3
3
  import { max as d3Max, min as d3Min } from 'd3-array';
4
- import { select as d3Select } from 'd3-selection';
5
4
  import { useVerticalStackedBarChartStyles } from './useVerticalStackedBarChartStyles.styles';
6
5
  import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc, scaleTime as d3ScaleTime } from 'd3-scale';
7
6
  import { useId } from '@fluentui/react-utilities';
8
7
  import { tokens } from '@fluentui/react-theme';
9
8
  import { CartesianChart, ChartPopover, Legends } from '../../index';
10
- import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, areArraysEqual, calculateLongestLabelWidth, useRtl, DataVizPalette, getColorFromToken, findVSBCNumericMinMaxOfY, YAxisType, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, calcTotalWidth, calcBandwidth, calcRequiredWidth, sortAxisCategories } from '../../utilities/index';
11
- import { toImage } from '../../utilities/image-export-utils';
12
- import { formatDateToLocaleString } from '@fluentui/chart-utilities';
9
+ import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, areArraysEqual, calculateLongestLabelWidth, useRtl, DataVizPalette, getColorFromToken, findVSBCNumericMinMaxOfY, YAxisType, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, calcTotalWidth, calcBandwidth, calcRequiredWidth, sortAxisCategories } from '../../utilities/index';
10
+ import { formatDateToLocaleString, isInvalidValue } from '@fluentui/chart-utilities';
11
+ import { useImageExport } from '../../utilities/hooks';
13
12
  const barGapMultiplier = 0.2;
14
13
  const barGapMin = 1;
15
14
  const MIN_DOMAIN_MARGIN = 8;
@@ -23,7 +22,6 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
23
22
  };
24
23
  const _isRtl = useRtl();
25
24
  const _createLegendsForLine = (data)=>_getLineLegends(data);
26
- const _tooltipId = useId('VSBCTooltipId_');
27
25
  const _emptyChartId = useId('_VSBC_empty');
28
26
  let _points = [];
29
27
  let _dataset;
@@ -40,9 +38,8 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
40
38
  let _domainMargin = MIN_DOMAIN_MARGIN;
41
39
  let _xAxisInnerPadding = 0;
42
40
  let _xAxisOuterPadding = 0;
43
- const cartesianChartRef = React.useRef(null);
41
+ const { cartesianChartRef, legendsRef: _legendsRef } = useImageExport(props.componentRef, props.hideLegend);
44
42
  const Y_ORIGIN = 0;
45
- const _legendsRef = React.useRef(null);
46
43
  let _yAxisType;
47
44
  let _yAxisLabels = [];
48
45
  const [selectedLegends, setSelectedLegends] = React.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
@@ -81,17 +78,6 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
81
78
  }, [
82
79
  props
83
80
  ]);
84
- React.useImperativeHandle(props.componentRef, ()=>{
85
- var _cartesianChartRef_current;
86
- var _cartesianChartRef_current_chartContainer;
87
- return {
88
- 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,
89
- toImage: (opts)=>{
90
- var _cartesianChartRef_current, _legendsRef_current;
91
- return 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);
92
- }
93
- };
94
- }, []);
95
81
  function _getLegendData(data, lineLegends) {
96
82
  if (props.hideLegend) {
97
83
  return /*#__PURE__*/ React.createElement(React.Fragment, null);
@@ -140,7 +126,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
140
126
  legendsOfLine.push(legend);
141
127
  });
142
128
  }
143
- const totalLegends = legendsOfLine.concat(actions);
129
+ const totalLegends = actions.concat(legendsOfLine);
144
130
  return /*#__PURE__*/ React.createElement(Legends, {
145
131
  legends: totalLegends,
146
132
  enabledWrapLines: props.enabledLegendsWrapLines,
@@ -179,16 +165,17 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
179
165
  _onStackHoverFocus(lineData.xItem, event);
180
166
  }
181
167
  }
182
- function _onStackHoverFocus(stack, mouseEvent) {
168
+ function _onStackHoverFocus(stack, event) {
183
169
  var _stack_lineData;
184
170
  let clientX = 0;
185
171
  let clientY = 0;
186
- if ('clientX' in mouseEvent) {
187
- clientX = mouseEvent.clientX;
188
- clientY = mouseEvent.clientY;
172
+ if ('clientX' in event) {
173
+ clientX = event.clientX;
174
+ clientY = event.clientY;
189
175
  } else {
190
- // Handle case where mouseEvent is an SVGGElement
191
- const boundingRect = mouseEvent.getBoundingClientRect();
176
+ // Handle React FocusEvent or SVGGElement
177
+ const element = 'target' in event ? event.target : event;
178
+ const boundingRect = element.getBoundingClientRect();
192
179
  clientX = boundingRect.left + boundingRect.width / 2;
193
180
  clientY = boundingRect.top + boundingRect.height / 2;
194
181
  }
@@ -231,6 +218,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
231
218
  props.href ? window.location.href = props.href : '';
232
219
  };
233
220
  function _adjustProps() {
221
+ var _points_;
234
222
  _points = props.data || [];
235
223
  _barWidth = getBarWidth(props.barWidth, props.maxBarWidth);
236
224
  const defaultColors = [
@@ -241,7 +229,8 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
241
229
  getColorFromToken(DataVizPalette.color10)
242
230
  ];
243
231
  _colors = defaultColors;
244
- _xAxisType = getTypeOfAxis(props.data[0].xAxisPoint, true);
232
+ const firstXValue = (_points_ = _points[0]) === null || _points_ === void 0 ? void 0 : _points_.xAxisPoint;
233
+ _xAxisType = isInvalidValue(firstXValue) ? XAxisTypes.StringAxis : getTypeOfAxis(firstXValue, true);
245
234
  _lineObject = _getFormattedLineData(props.data);
246
235
  _xAxisInnerPadding = getScalePadding(props.xAxisInnerPadding, props.xAxisPadding, _xAxisType === XAxisTypes.StringAxis ? 2 / 3 : 1 / 2);
247
236
  _xAxisOuterPadding = getScalePadding(props.xAxisOuterPadding, props.xAxisPadding, 0);
@@ -873,17 +862,26 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
873
862
  };
874
863
  let showLabel = false;
875
864
  let barLabel = 0;
865
+ let selectedBarTotalValue = 0;
866
+ let customBarLabel = undefined;
876
867
  if (!props.hideLabels && _yAxisType !== YAxisType.StringAxis) {
868
+ // Collect all bars with barLabel that match the legend filter
869
+ const barLabelsToDisplay = barsToDisplay.filter((point)=>point.barLabel && (_noLegendHighlighted() || _isLegendHighlighted(point.legend)));
870
+ if (barLabelsToDisplay.length > 0) {
871
+ customBarLabel = barLabelsToDisplay[barLabelsToDisplay.length - 1].barLabel;
872
+ }
877
873
  if (_noLegendHighlighted()) {
878
874
  showLabel = true;
879
- barLabel = barTotalValue;
875
+ barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : barTotalValue;
876
+ selectedBarTotalValue = barTotalValue;
880
877
  } else {
881
878
  barsToDisplay.forEach((point)=>{
882
879
  if (_isLegendHighlighted(point.legend)) {
883
880
  showLabel = true;
884
- barLabel += point.data;
881
+ selectedBarTotalValue += point.data;
885
882
  }
886
883
  });
884
+ barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : selectedBarTotalValue;
887
885
  }
888
886
  }
889
887
  return /*#__PURE__*/ React.createElement("g", {
@@ -897,7 +895,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
897
895
  }, singleBar), !props.hideLabels && _barWidth >= 16 && showLabel && /*#__PURE__*/ React.createElement("text", {
898
896
  x: xPoint + _barWidth / 2,
899
897
  //if total bar value >=0, show label above top bar, otherwise below bottom bar
900
- y: barLabel >= Y_ORIGIN ? yPoint - 6 : yPoint + heightOfLastBar + 12,
898
+ y: selectedBarTotalValue >= Y_ORIGIN ? yPoint - 6 : yPoint + heightOfLastBar + 12,
901
899
  textAnchor: "middle",
902
900
  className: classes.barLabel,
903
901
  "aria-label": `Total: ${barLabel}`,
@@ -907,27 +905,8 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
907
905
  direction: 'ltr',
908
906
  unicodeBidi: 'isolate'
909
907
  }
910
- }, typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : formatScientificLimitWidth(barLabel)));
908
+ }, typeof barLabel === 'string' ? barLabel : typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : formatScientificLimitWidth(barLabel)));
911
909
  });
912
- if (!props.showXAxisLablesTooltip) {
913
- try {
914
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
915
- // eslint-disable-next-line no-empty
916
- } catch (e) {}
917
- }
918
- if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
919
- const xAxisElement = d3Select(xElement).call(xBarScale);
920
- try {
921
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
922
- // eslint-disable-next-line no-empty
923
- } catch (e) {}
924
- const tooltipProps = {
925
- tooltipCls: classes.tooltip,
926
- id: _tooltipId,
927
- axis: xAxisElement
928
- };
929
- xAxisElement && tooltipOfAxislabels(tooltipProps);
930
- }
931
910
  return bars.filter((bar)=>!!bar);
932
911
  }
933
912
  function _getMinMaxOfYAxis(dataset, yAxisType, useSecondaryYScale) {