@fluentui/react-charts 9.2.0 → 9.2.2

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 (103) hide show
  1. package/CHANGELOG.md +38 -3
  2. package/dist/index.d.ts +84 -5
  3. package/lib/ChartTable.js +1 -0
  4. package/lib/ChartTable.js.map +1 -0
  5. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  6. package/lib/components/ChartTable/ChartTable.js +57 -0
  7. package/lib/components/ChartTable/ChartTable.js.map +1 -0
  8. package/lib/components/ChartTable/ChartTable.types.js +1 -0
  9. package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
  10. package/lib/components/ChartTable/index.js +3 -0
  11. package/lib/components/ChartTable/index.js.map +1 -0
  12. package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
  13. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  14. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
  15. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  16. package/lib/components/CommonComponents/CartesianChart.js +110 -81
  17. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  18. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  19. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  20. package/lib/components/DeclarativeChart/DeclarativeChart.js +20 -10
  21. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  22. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +95 -0
  23. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  24. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -87
  25. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  26. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  27. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  28. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  29. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  30. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  31. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +161 -141
  32. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  33. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  34. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  35. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  36. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  37. package/lib/components/Legends/Legends.js.map +1 -1
  38. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  39. package/lib/components/LineChart/LineChart.js.map +1 -1
  40. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  41. package/lib/components/VerticalBarChart/VerticalBarChart.js +12 -11
  42. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  43. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +57 -51
  44. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  45. package/lib/index.js +1 -0
  46. package/lib/index.js.map +1 -1
  47. package/lib/types/DataPoint.js.map +1 -1
  48. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  49. package/lib/utilities/utilities.js +26 -37
  50. package/lib/utilities/utilities.js.map +1 -1
  51. package/lib/utilities/vbc-utils.js +24 -0
  52. package/lib/utilities/vbc-utils.js.map +1 -1
  53. package/lib-commonjs/ChartTable.js +6 -0
  54. package/lib-commonjs/ChartTable.js.map +1 -0
  55. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  56. package/lib-commonjs/components/ChartTable/ChartTable.js +68 -0
  57. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
  58. package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
  59. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
  60. package/lib-commonjs/components/ChartTable/index.js +8 -0
  61. package/lib-commonjs/components/ChartTable/index.js.map +1 -0
  62. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
  63. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  64. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
  65. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  66. package/lib-commonjs/components/CommonComponents/CartesianChart.js +109 -80
  67. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  68. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  69. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  70. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +19 -9
  71. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  72. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +120 -0
  73. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  74. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -87
  75. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  76. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  77. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  78. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  79. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  80. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  81. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +159 -139
  82. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  83. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  84. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  85. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  86. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  87. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  88. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  89. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  90. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  91. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +11 -10
  92. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  93. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +56 -50
  94. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  95. package/lib-commonjs/index.js +1 -0
  96. package/lib-commonjs/index.js.map +1 -1
  97. package/lib-commonjs/types/DataPoint.js.map +1 -1
  98. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  99. package/lib-commonjs/utilities/utilities.js +29 -37
  100. package/lib-commonjs/utilities/utilities.js.map +1 -1
  101. package/lib-commonjs/utilities/vbc-utils.js +27 -0
  102. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  103. package/package.json +9 -9
@@ -6,16 +6,11 @@ import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3S
6
6
  import { useId } from '@fluentui/react-utilities';
7
7
  import { tokens } from '@fluentui/react-theme';
8
8
  import { CartesianChart, ChartPopover, Legends } from '../../index';
9
- import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, formatDate, areArraysEqual, calculateLongestLabelWidth, useRtl, DataVizPalette, getColorFromToken, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis } from '../../utilities/index';
9
+ import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, formatDate, areArraysEqual, calculateLongestLabelWidth, useRtl, DataVizPalette, getColorFromToken, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, calcTotalWidth, calcBandwidth, calcRequiredWidth } from '../../utilities/index';
10
10
  import { toImage } from '../../utilities/image-export-utils';
11
11
  const barGapMultiplier = 0.2;
12
12
  const barGapMin = 1;
13
13
  const MIN_DOMAIN_MARGIN = 8;
14
- var CircleVisbility = /*#__PURE__*/ function(CircleVisbility) {
15
- CircleVisbility["show"] = "visibility";
16
- CircleVisbility["hide"] = "hidden";
17
- return CircleVisbility;
18
- }(CircleVisbility || {});
19
14
  export const VerticalStackedBarChart = (props)=>{
20
15
  var _props_legendProps;
21
16
  const _isRtl = useRtl();
@@ -150,19 +145,29 @@ export const VerticalStackedBarChart = (props)=>{
150
145
  activeLegend
151
146
  ] : [];
152
147
  }
153
- function _lineHoverOut() {
154
- setPopoverOpen(false);
155
- setXCalloutValue('');
156
- setYCalloutValue('');
157
- setActiveXAxisDataPoint('');
158
- setColor('');
159
- }
160
- function _lineHoverFocus(lineData) {
161
- setPopoverOpen(true);
162
- setXCalloutValue(`${lineData.xItem.xAxisPoint}`);
163
- setYCalloutValue(`${lineData.yAxisCalloutData || lineData.data || lineData.y}`);
164
- setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
165
- setColor(lineData.color);
148
+ function _lineHoverFocus(lineData, event) {
149
+ let clientX = 0;
150
+ let clientY = 0;
151
+ if ('clientX' in event) {
152
+ clientX = event.clientX;
153
+ clientY = event.clientY;
154
+ } else {
155
+ const boundingRect = event.target.getBoundingClientRect();
156
+ clientX = boundingRect.left + boundingRect.width / 2;
157
+ clientY = boundingRect.top + boundingRect.height / 2;
158
+ }
159
+ if (_getHighlightedLegend().length === 1) {
160
+ if (_noLegendHighlighted() || _isLegendHighlighted(lineData.legend)) {
161
+ _updatePosition(clientX, clientY);
162
+ setPopoverOpen(true);
163
+ setXCalloutValue(`${lineData.xItem.xAxisPoint}`);
164
+ setYCalloutValue(`${lineData.yAxisCalloutData || lineData.data || lineData.y}`);
165
+ setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
166
+ setColor(lineData.color);
167
+ }
168
+ } else {
169
+ _onStackHoverFocus(lineData.xItem, event);
170
+ }
166
171
  }
167
172
  function _onStackHoverFocus(stack, mouseEvent) {
168
173
  var _stack_lineData;
@@ -291,7 +296,7 @@ export const VerticalStackedBarChart = (props)=>{
291
296
  */ function _noLegendHighlighted() {
292
297
  return _getHighlightedLegend().length === 0;
293
298
  }
294
- function _getAriaLabel(singleChartData, point) {
299
+ function _getAriaLabel(singleChartData, point, isLinePoint) {
295
300
  var _point_callOutAccessibilityData;
296
301
  if (!point) {
297
302
  var _singleChartData_lineData, _singleChartData_stackCallOutAccessibilityData;
@@ -299,19 +304,19 @@ export const VerticalStackedBarChart = (props)=>{
299
304
  const pointValues = singleChartData.chartData.map((pt)=>{
300
305
  const legend = pt.legend;
301
306
  const yValue = pt.yAxisCalloutData || pt.data;
302
- return `${legend}, ${yValue}.`;
303
- }).join(' ');
307
+ return _noLegendHighlighted() || _isLegendHighlighted(legend) ? `${legend}, ${yValue}.` : '';
308
+ }).filter((str)=>str !== '').join(' ');
304
309
  const lineValues = (_singleChartData_lineData = singleChartData.lineData) === null || _singleChartData_lineData === void 0 ? void 0 : _singleChartData_lineData.map((ln)=>{
305
310
  const legend = ln.legend;
306
311
  const yValue = ln.yAxisCalloutData || ln.data || ln.y;
307
- return `${legend}, ${yValue}.`;
308
- }).join(' ');
312
+ return _noLegendHighlighted() || _isLegendHighlighted(legend) ? `${legend}, ${yValue}.` : '';
313
+ }).filter((str)=>str !== '').join(' ');
309
314
  return ((_singleChartData_stackCallOutAccessibilityData = singleChartData.stackCallOutAccessibilityData) === null || _singleChartData_stackCallOutAccessibilityData === void 0 ? void 0 : _singleChartData_stackCallOutAccessibilityData.ariaLabel) || `${xValue}. ${pointValues}` + (lineValues ? ` ${lineValues}` : '');
310
315
  }
311
- /** if shouldFocusWholeStack is false */ const xValue = singleChartData.xAxisCalloutData || point.xAxisCalloutData || (singleChartData.xAxisPoint instanceof Date ? formatDate(singleChartData.xAxisPoint) : singleChartData.xAxisPoint);
316
+ /** if shouldFocusWholeStack is false */ const xValue = singleChartData.xAxisCalloutData || !isLinePoint && point.xAxisCalloutData || (singleChartData.xAxisPoint instanceof Date ? formatDate(singleChartData.xAxisPoint) : singleChartData.xAxisPoint);
312
317
  const legend = point.legend;
313
- const yValue = point.yAxisCalloutData || point.data;
314
- return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
318
+ const yValue = point.yAxisCalloutData || (isLinePoint ? point.data || point.y : point.data);
319
+ return !isLinePoint && ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
315
320
  }
316
321
  function _getCustomizedCallout() {
317
322
  const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
@@ -424,10 +429,8 @@ export const VerticalStackedBarChart = (props)=>{
424
429
  strokeDasharray: (_lineObject_item__lineOptions2 = lineObject[item][0].lineOptions) === null || _lineObject_item__lineOptions2 === void 0 ? void 0 : _lineObject_item__lineOptions2.strokeDasharray,
425
430
  stroke: lineObject[item][i].color,
426
431
  transform: `translate(${xScaleBandwidthTranslate}, 0)`,
427
- ..._isLegendHighlighted(item) && {
428
- onMouseOver: _lineHover.bind(lineObject[item][i - 1]),
429
- onMouseLeave: _lineHoverOut
430
- }
432
+ onMouseOver: (event)=>_lineHover(lineObject[item][i - 1], event),
433
+ onMouseLeave: _handleMouseOut
431
434
  }));
432
435
  }
433
436
  });
@@ -441,15 +444,15 @@ export const VerticalStackedBarChart = (props)=>{
441
444
  key: `${index}-${subIndex}-dot`,
442
445
  cx: xScale(circlePoint.xItem.xAxisPoint),
443
446
  cy: circlePoint.useSecondaryYScale && yScaleSecondary ? yScaleSecondary(circlePoint.y) : yScalePrimary(circlePoint.y),
444
- onMouseOver: _isLegendHighlighted(item) ? (event)=>_lineHover(circlePoint, event) : (event)=>_onStackHover(circlePoint.xItem, event),
445
- ..._isLegendHighlighted(item) && {
446
- onMouseLeave: _lineHoverOut
447
- },
448
- r: _getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).radius,
447
+ onMouseOver: (event)=>_lineHover(circlePoint, event),
448
+ onMouseLeave: _handleMouseOut,
449
+ r: _getCircleOpacityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).radius,
449
450
  stroke: circlePoint.color,
450
451
  fill: tokens.colorNeutralBackground1,
451
452
  strokeWidth: 3,
452
- visibility: _getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).visibility,
453
+ // Elements with visibility: hidden cannot receive focus, so use opacity: 0 instead to hide them.
454
+ // For more information, see https://fuzzbomb.github.io/accessibility-demos/visually-hidden-focus-test.html
455
+ opacity: _getCircleOpacityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).opacity,
453
456
  transform: `translate(${xScaleBandwidthTranslate}, 0)`,
454
457
  ref: (e)=>circleRef.refElement = e,
455
458
  ...noBarsAndLinesActive ? {
@@ -464,27 +467,27 @@ export const VerticalStackedBarChart = (props)=>{
464
467
  });
465
468
  return /*#__PURE__*/ React.createElement(React.Fragment, null, borderForLines, lines, dots);
466
469
  }
467
- function _getCircleVisibilityAndRadius(xAxisPoint, legend) {
470
+ function _getCircleOpacityAndRadius(xAxisPoint, legend) {
468
471
  if (!_noLegendHighlighted()) {
469
472
  if (xAxisPoint === activeXAxisDataPoint && _isLegendHighlighted(legend)) {
470
473
  return {
471
- visibility: "visibility",
474
+ opacity: 1,
472
475
  radius: 8
473
476
  };
474
477
  } else if (_isLegendHighlighted(legend)) {
475
478
  return {
476
- visibility: "visibility",
479
+ opacity: 1,
477
480
  radius: 0.3
478
481
  };
479
482
  } else {
480
483
  return {
481
- visibility: "hidden",
484
+ opacity: 0,
482
485
  radius: 0
483
486
  };
484
487
  }
485
488
  } else {
486
489
  return {
487
- visibility: activeXAxisDataPoint === xAxisPoint ? "visibility" : "hidden",
490
+ opacity: activeXAxisDataPoint === xAxisPoint ? 1 : 0,
488
491
  radius: 8
489
492
  };
490
493
  }
@@ -537,11 +540,11 @@ export const VerticalStackedBarChart = (props)=>{
537
540
  }
538
541
  function _lineHover(lineData, mouseEvent) {
539
542
  mouseEvent.persist();
540
- _lineHoverFocus(lineData);
543
+ _lineHoverFocus(lineData, mouseEvent);
541
544
  }
542
545
  function _lineFocus(event, lineData, ref) {
543
546
  if (ref.refElement) {
544
- _lineHoverFocus(lineData);
547
+ _lineHoverFocus(lineData, event);
545
548
  }
546
549
  }
547
550
  function _onStackHover(stack, mouseEvent) {
@@ -669,8 +672,7 @@ export const VerticalStackedBarChart = (props)=>{
669
672
  }
670
673
  function _getDomainMargins(containerWidth) {
671
674
  _domainMargin = MIN_DOMAIN_MARGIN;
672
- /** Total width available to render the bars */ const totalWidth = containerWidth - (_margins.left + MIN_DOMAIN_MARGIN) - (_margins.right + MIN_DOMAIN_MARGIN);
673
- /** Rate at which the space between the bars changes wrt the bar width */ const barGapRate = _xAxisInnerPadding / (1 - _xAxisInnerPadding);
675
+ const totalWidth = calcTotalWidth(containerWidth, _margins, MIN_DOMAIN_MARGIN);
674
676
  if (_xAxisType === XAxisTypes.StringAxis) {
675
677
  if (isScalePaddingDefined(props.xAxisOuterPadding, props.xAxisPadding)) {
676
678
  // Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
@@ -680,16 +682,16 @@ export const VerticalStackedBarChart = (props)=>{
680
682
  // Update the bar width so that when CartesianChart rerenders,
681
683
  // the following calculations don't use the previous bar width.
682
684
  _barWidth = getBarWidth(props.barWidth, props.maxBarWidth);
683
- /** Total width required to render the bars. Directly proportional to bar width */ const reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * _barWidth;
685
+ /** Total width required to render the bars. Directly proportional to bar width */ const reqWidth = calcRequiredWidth(_barWidth, _xAxisLabels.length, _xAxisInnerPadding);
684
686
  if (totalWidth >= reqWidth) {
685
687
  // Center align the chart by setting equal left and right margins for domain
686
688
  _domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
687
689
  }
688
690
  } else if (props.mode === 'plotly' && _xAxisLabels.length > 1) {
689
691
  // Calculate the remaining width after rendering bars at their maximum allowable width
690
- const bandwidth = totalWidth / (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate);
692
+ const bandwidth = calcBandwidth(totalWidth, _xAxisLabels.length, _xAxisInnerPadding);
691
693
  const barWidth = getBarWidth(props.barWidth, props.maxBarWidth, bandwidth);
692
- let reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * barWidth;
694
+ let reqWidth = calcRequiredWidth(barWidth, _xAxisLabels.length, _xAxisInnerPadding);
693
695
  const margin1 = (totalWidth - reqWidth) / 2;
694
696
  let margin2 = Number.POSITIVE_INFINITY;
695
697
  if (!props.hideTickOverlap) {
@@ -746,7 +748,7 @@ export const VerticalStackedBarChart = (props)=>{
746
748
  const startColor = point.color ? point.color : _colors[index];
747
749
  const ref = {};
748
750
  const shouldHighlight = _isLegendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
749
- const rectFocusProps = !shouldFocusWholeStack && {
751
+ const rectFocusProps = !shouldFocusWholeStack && shouldHighlight && {
750
752
  'aria-label': _getAriaLabel(singleChartData, point),
751
753
  onMouseOver: (event)=>_onRectHover(singleChartData.xAxisPoint, point, startColor, event),
752
754
  onMouseMove: (event)=>_onRectHover(singleChartData.xAxisPoint, point, startColor, event),
@@ -818,7 +820,11 @@ export const VerticalStackedBarChart = (props)=>{
818
820
  }));
819
821
  });
820
822
  const groupRef = {};
821
- const stackFocusProps = shouldFocusWholeStack && {
823
+ const someBarsActive = singleChartData.chartData.filter((dataPoint)=>_noLegendHighlighted() || _isLegendHighlighted(dataPoint.legend)).length > 0;
824
+ // FIXME: Making the entire stack focusable when stack callout is enabled adds unnecessary complexity
825
+ // and can reduce usability in certain scenarios. Instead, each individual element within the stack
826
+ // should be focusable on its own, with its own aria-label. This behavior is also seen in Highcharts.
827
+ const stackFocusProps = shouldFocusWholeStack && someBarsActive && {
822
828
  'aria-label': _getAriaLabel(singleChartData),
823
829
  onMouseOver: (event)=>_onStackHover(singleChartData, event),
824
830
  onMouseMove: (event)=>_onStackHover(singleChartData, event),