@fluentui/react-charts 9.3.7 → 9.3.9

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 (259) hide show
  1. package/CHANGELOG.md +60 -2
  2. package/dist/index.d.ts +433 -7
  3. package/lib/PolarChart.js +1 -0
  4. package/lib/PolarChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  7. package/lib/components/AreaChart/AreaChart.js +1 -28
  8. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  10. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  11. package/lib/components/ChartTable/ChartTable.js +27 -8
  12. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  13. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  14. package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
  15. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  16. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  17. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  18. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  19. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  20. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  21. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +54 -4
  22. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  23. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  24. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  25. package/lib/components/CommonComponents/CartesianChart.js +81 -44
  26. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  27. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  28. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
  29. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  30. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
  31. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  32. package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
  33. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +643 -366
  35. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  36. package/lib/components/DonutChart/DonutChart.js +24 -9
  37. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  38. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  39. package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
  40. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  41. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
  42. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  43. package/lib/components/FunnelChart/FunnelChart.js +33 -8
  44. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  45. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  46. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
  47. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  48. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  49. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  50. package/lib/components/GanttChart/GanttChart.js +1 -1
  51. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  52. package/lib/components/GaugeChart/GaugeChart.js +13 -9
  53. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  54. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  55. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
  56. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  57. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  58. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  59. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +18 -18
  60. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  61. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  62. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  63. package/lib/components/HeatMapChart/HeatMapChart.js +5 -1
  64. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  65. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +60 -10
  66. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  67. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  68. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
  69. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  70. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  71. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  72. package/lib/components/Legends/Legends.js +3 -4
  73. package/lib/components/Legends/Legends.js.map +1 -1
  74. package/lib/components/Legends/OverflowMenu.js +9 -2
  75. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  76. package/lib/components/LineChart/LineChart.js +65 -64
  77. package/lib/components/LineChart/LineChart.js.map +1 -1
  78. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  79. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  80. package/lib/components/PolarChart/PolarChart.js +577 -0
  81. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  82. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  83. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  84. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  85. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  86. package/lib/components/PolarChart/index.js +2 -0
  87. package/lib/components/PolarChart/index.js.map +1 -0
  88. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  89. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  90. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  91. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  92. package/lib/components/SankeyChart/SankeyChart.js +15 -5
  93. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  94. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  95. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +24 -8
  96. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  97. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  98. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  99. package/lib/components/ScatterChart/ScatterChart.js +13 -25
  100. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  101. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  102. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  103. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  104. package/lib/components/VerticalBarChart/VerticalBarChart.js +13 -78
  105. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  106. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  107. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  108. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +48 -68
  109. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  110. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  111. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  112. package/lib/index.js +1 -0
  113. package/lib/index.js.map +1 -1
  114. package/lib/types/ChartAnnotation.js.map +1 -1
  115. package/lib/types/DataPoint.js +1 -1
  116. package/lib/types/DataPoint.js.map +1 -1
  117. package/lib/utilities/ChartTitle.js +45 -0
  118. package/lib/utilities/ChartTitle.js.map +1 -0
  119. package/lib/utilities/Common.styles.js +73 -2
  120. package/lib/utilities/Common.styles.js.map +1 -1
  121. package/lib/utilities/Common.styles.raw.js +70 -1
  122. package/lib/utilities/Common.styles.raw.js.map +1 -1
  123. package/lib/utilities/image-export-utils.js +4 -4
  124. package/lib/utilities/image-export-utils.js.map +1 -1
  125. package/lib/utilities/index.js +1 -0
  126. package/lib/utilities/index.js.map +1 -1
  127. package/lib/utilities/utilities.js +219 -77
  128. package/lib/utilities/utilities.js.map +1 -1
  129. package/lib-commonjs/PolarChart.js +6 -0
  130. package/lib-commonjs/PolarChart.js.map +1 -0
  131. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  132. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  133. package/lib-commonjs/components/AreaChart/AreaChart.js +0 -26
  134. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  135. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  136. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  137. package/lib-commonjs/components/ChartTable/ChartTable.js +27 -8
  138. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  139. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  140. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  141. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  142. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  143. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  144. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  145. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  146. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  147. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +65 -5
  148. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  149. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  150. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  151. package/lib-commonjs/components/CommonComponents/CartesianChart.js +80 -43
  152. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  153. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  154. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +3 -4
  155. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  156. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
  157. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  158. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  159. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  160. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +649 -368
  161. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  162. package/lib-commonjs/components/DonutChart/DonutChart.js +22 -7
  163. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  164. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  165. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  166. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  167. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  168. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  169. package/lib-commonjs/components/FunnelChart/FunnelChart.js +31 -6
  170. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  171. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  172. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  173. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  174. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  175. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  176. package/lib-commonjs/components/GanttChart/GanttChart.js +1 -1
  177. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  178. package/lib-commonjs/components/GaugeChart/GaugeChart.js +11 -7
  179. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  180. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  181. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
  182. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  183. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  184. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  185. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +16 -16
  186. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  187. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  188. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  189. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -1
  190. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  191. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +59 -9
  192. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  193. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  194. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
  195. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  196. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  197. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  198. package/lib-commonjs/components/Legends/Legends.js +3 -4
  199. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  200. package/lib-commonjs/components/Legends/OverflowMenu.js +9 -2
  201. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  202. package/lib-commonjs/components/LineChart/LineChart.js +64 -63
  203. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  204. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  205. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  206. package/lib-commonjs/components/PolarChart/PolarChart.js +587 -0
  207. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  208. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  209. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  210. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  211. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  212. package/lib-commonjs/components/PolarChart/index.js +7 -0
  213. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  214. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  215. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  216. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  217. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  218. package/lib-commonjs/components/SankeyChart/SankeyChart.js +15 -5
  219. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  220. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  221. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -6
  222. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  223. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  224. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  225. package/lib-commonjs/components/ScatterChart/ScatterChart.js +12 -24
  226. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  227. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  228. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  229. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  230. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +12 -77
  231. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  232. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  233. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  234. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +47 -67
  235. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  236. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  237. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  238. package/lib-commonjs/index.js +1 -0
  239. package/lib-commonjs/index.js.map +1 -1
  240. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  241. package/lib-commonjs/types/DataPoint.js +1 -1
  242. package/lib-commonjs/types/DataPoint.js.map +1 -1
  243. package/lib-commonjs/utilities/ChartTitle.js +53 -0
  244. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  245. package/lib-commonjs/utilities/Common.styles.js +69 -1
  246. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  247. package/lib-commonjs/utilities/Common.styles.raw.js +69 -1
  248. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  249. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  250. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  251. package/lib-commonjs/utilities/index.js +1 -0
  252. package/lib-commonjs/utilities/index.js.map +1 -1
  253. package/lib-commonjs/utilities/utilities.js +235 -78
  254. package/lib-commonjs/utilities/utilities.js.map +1 -1
  255. package/package.json +11 -17
  256. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  257. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  258. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  259. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -1,13 +1,13 @@
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';
8
+ import { useArrowNavigationGroup } from '@fluentui/react-tabster';
9
9
  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';
10
+ 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';
11
11
  import { formatDateToLocaleString, isInvalidValue } from '@fluentui/chart-utilities';
12
12
  import { useImageExport } from '../../utilities/hooks';
13
13
  const barGapMultiplier = 0.2;
@@ -23,8 +23,11 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
23
23
  };
24
24
  const _isRtl = useRtl();
25
25
  const _createLegendsForLine = (data)=>_getLineLegends(data);
26
- const _tooltipId = useId('VSBCTooltipId_');
27
26
  const _emptyChartId = useId('_VSBC_empty');
27
+ const _arrowNavigationAttributes = useArrowNavigationGroup({
28
+ axis: 'vertical',
29
+ circular: true
30
+ });
28
31
  let _points = [];
29
32
  let _dataset;
30
33
  let _xAxisLabels = [];
@@ -154,29 +157,27 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
154
157
  clientX = boundingRect.left + boundingRect.width / 2;
155
158
  clientY = boundingRect.top + boundingRect.height / 2;
156
159
  }
157
- if (_getHighlightedLegend().length === 1) {
158
- if (_noLegendHighlighted() || _isLegendHighlighted(lineData.legend)) {
159
- _updatePosition(clientX, clientY);
160
- setPopoverOpen(true);
161
- setXCalloutValue(`${lineData.xItem.xAxisPoint}`);
162
- setYCalloutValue(`${lineData.yAxisCalloutData || lineData.data || lineData.y}`);
163
- setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
164
- setColor(lineData.color);
165
- }
166
- } else {
167
- _onStackHoverFocus(lineData.xItem, event);
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
+ setCalloutLegend(lineData.legend);
166
+ setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
167
+ setColor(lineData.color);
168
168
  }
169
169
  }
170
- function _onStackHoverFocus(stack, mouseEvent) {
170
+ function _onStackHoverFocus(stack, event) {
171
171
  var _stack_lineData;
172
172
  let clientX = 0;
173
173
  let clientY = 0;
174
- if ('clientX' in mouseEvent) {
175
- clientX = mouseEvent.clientX;
176
- clientY = mouseEvent.clientY;
174
+ if ('clientX' in event) {
175
+ clientX = event.clientX;
176
+ clientY = event.clientY;
177
177
  } else {
178
- // Handle case where mouseEvent is an SVGGElement
179
- const boundingRect = mouseEvent.getBoundingClientRect();
178
+ // Handle React FocusEvent or SVGGElement
179
+ const element = 'target' in event ? event.target : event;
180
+ const boundingRect = element.getBoundingClientRect();
180
181
  clientX = boundingRect.left + boundingRect.width / 2;
181
182
  clientY = boundingRect.top + boundingRect.height / 2;
182
183
  }
@@ -327,19 +328,9 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
327
328
  const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
328
329
  return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint && !_isHavingLines ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout) : null;
329
330
  }
330
- function _toFocusWholeStack(_isHavingLines) {
331
+ function _toFocusWholeStack() {
331
332
  const { isCalloutForStack = false } = props;
332
- let shouldFocusStackOnly = false;
333
- if (_isHavingLines) {
334
- if (_getHighlightedLegend().length === 1) {
335
- shouldFocusStackOnly = false;
336
- } else {
337
- shouldFocusStackOnly = true;
338
- }
339
- } else {
340
- shouldFocusStackOnly = isCalloutForStack;
341
- }
342
- return shouldFocusStackOnly;
333
+ return isCalloutForStack;
343
334
  }
344
335
  function _getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues) {
345
336
  let domainNRangeValue;
@@ -445,8 +436,8 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
445
436
  const circleRef = {
446
437
  refElement: null
447
438
  };
448
- const noBarsAndLinesActive = circlePoint.xItem.chartData.filter((dataPoint)=>_noLegendHighlighted() || _isLegendHighlighted(dataPoint.legend)).length === 0;
449
439
  const yScaleBandwidthTranslate = !circlePoint.useSecondaryYScale && _yAxisType === YAxisType.StringAxis ? yScalePrimary.bandwidth() / 2 : 0;
440
+ const shouldHighlight = _isLegendHighlighted(circlePoint.legend) || _noLegendHighlighted() ? true : false;
450
441
  dots.push(/*#__PURE__*/ React.createElement("circle", {
451
442
  key: `${index}-${subIndex}-dot`,
452
443
  cx: xScale(circlePoint.xItem.xAxisPoint),
@@ -464,13 +455,11 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
464
455
  ref: (e)=>{
465
456
  circleRef.refElement = e;
466
457
  },
467
- ...noBarsAndLinesActive ? {
468
- tabIndex: !props.hideTooltip ? 0 : undefined,
469
- onFocus: (event)=>_lineFocus(event, circlePoint, circleRef),
470
- onBlur: _handleMouseOut,
471
- role: 'img',
472
- 'aria-label': _getAriaLabel(circlePoint.xItem, circlePoint)
473
- } : {}
458
+ tabIndex: !props.hideTooltip && shouldHighlight ? 0 : undefined,
459
+ onFocus: (event)=>_lineFocus(event, circlePoint, circleRef),
460
+ onBlur: _handleMouseOut,
461
+ role: "img",
462
+ "aria-label": _getAriaLabel(circlePoint.xItem, circlePoint, true)
474
463
  }));
475
464
  });
476
465
  });
@@ -737,8 +726,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
737
726
  const classes = useVerticalStackedBarChartStyles(props);
738
727
  function _createBar(xBarScale, yBarScale, containerHeight, xElement) {
739
728
  const { barCornerRadius = 0, barMinimumHeight = 0 } = props;
740
- const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
741
- const shouldFocusWholeStack = _toFocusWholeStack(_isHavingLines);
729
+ const shouldFocusWholeStack = _toFocusWholeStack();
742
730
  if (_xAxisType === XAxisTypes.StringAxis) {
743
731
  _barWidth = getBarWidth(props.barWidth, props.maxBarWidth, xBarScale.bandwidth());
744
732
  }
@@ -863,17 +851,28 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
863
851
  };
864
852
  let showLabel = false;
865
853
  let barLabel = 0;
854
+ let selectedBarTotalValue = 0;
855
+ let customBarLabel = undefined;
866
856
  if (!props.hideLabels && _yAxisType !== YAxisType.StringAxis) {
857
+ // Collect all bars with barLabel that match the legend filter
858
+ const barLabelsToDisplay = barsToDisplay.filter((point)=>point.barLabel && (_noLegendHighlighted() || _isLegendHighlighted(point.legend)));
859
+ // For stacked bars, we want to show the total of the stack, not individual bar labels
860
+ // Only use customBarLabel if there's exactly one bar with a label in the stack
861
+ if (barLabelsToDisplay.length === 1) {
862
+ customBarLabel = barLabelsToDisplay[0].barLabel;
863
+ }
867
864
  if (_noLegendHighlighted()) {
868
865
  showLabel = true;
869
- barLabel = barTotalValue;
866
+ barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : barTotalValue;
867
+ selectedBarTotalValue = barTotalValue;
870
868
  } else {
871
869
  barsToDisplay.forEach((point)=>{
872
870
  if (_isLegendHighlighted(point.legend)) {
873
871
  showLabel = true;
874
- barLabel += point.data;
872
+ selectedBarTotalValue += point.data;
875
873
  }
876
874
  });
875
+ barLabel = customBarLabel !== null && customBarLabel !== void 0 ? customBarLabel : selectedBarTotalValue;
877
876
  }
878
877
  }
879
878
  return /*#__PURE__*/ React.createElement("g", {
@@ -887,7 +886,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
887
886
  }, singleBar), !props.hideLabels && _barWidth >= 16 && showLabel && /*#__PURE__*/ React.createElement("text", {
888
887
  x: xPoint + _barWidth / 2,
889
888
  //if total bar value >=0, show label above top bar, otherwise below bottom bar
890
- y: barLabel >= Y_ORIGIN ? yPoint - 6 : yPoint + heightOfLastBar + 12,
889
+ y: selectedBarTotalValue >= Y_ORIGIN ? yPoint - 6 : yPoint + heightOfLastBar + 12,
891
890
  textAnchor: "middle",
892
891
  className: classes.barLabel,
893
892
  "aria-label": `Total: ${barLabel}`,
@@ -897,27 +896,8 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
897
896
  direction: 'ltr',
898
897
  unicodeBidi: 'isolate'
899
898
  }
900
- }, typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : formatScientificLimitWidth(barLabel)));
899
+ }, typeof barLabel === 'string' ? barLabel : typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barLabel) : formatScientificLimitWidth(barLabel)));
901
900
  });
902
- if (!props.showXAxisLablesTooltip) {
903
- try {
904
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
905
- // eslint-disable-next-line no-empty
906
- } catch (e) {}
907
- }
908
- if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
909
- const xAxisElement = d3Select(xElement).call(xBarScale);
910
- try {
911
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
912
- // eslint-disable-next-line no-empty
913
- } catch (e) {}
914
- const tooltipProps = {
915
- tooltipCls: classes.tooltip,
916
- id: _tooltipId,
917
- axis: xAxisElement
918
- };
919
- xAxisElement && tooltipOfAxislabels(tooltipProps);
920
- }
921
901
  return bars.filter((bar)=>!!bar);
922
902
  }
923
903
  function _getMinMaxOfYAxis(dataset, yAxisType, useSecondaryYScale) {
@@ -1019,7 +999,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
1019
999
  if (!_isChartEmpty()) {
1020
1000
  _adjustProps();
1021
1001
  const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
1022
- const shouldFocusWholeStack = _toFocusWholeStack(_isHavingLines);
1002
+ const shouldFocusWholeStack = _toFocusWholeStack();
1023
1003
  _dataset = _createDataSetLayer();
1024
1004
  const legendBars = _getLegendData(_points, _createLegendsForLine(props.data));
1025
1005
  const calloutProps = {
@@ -1033,7 +1013,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
1033
1013
  ...getAccessibleDataObject(callOutAccessibilityData),
1034
1014
  clickPosition: clickPosition,
1035
1015
  isPopoverOpen: isPopoverOpen,
1036
- isCalloutForStack: props.isCalloutForStack || _isHavingLines && (_noLegendHighlighted() || _getHighlightedLegend().length > 1),
1016
+ isCalloutForStack: shouldFocusWholeStack,
1037
1017
  isCartesian: true,
1038
1018
  customCallout: {
1039
1019
  customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,
@@ -1078,7 +1058,7 @@ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((_props, f
1078
1058
  ],
1079
1059
  getYDomainMargins: _getYDomainMargins,
1080
1060
  /* eslint-disable react/jsx-no-bind */ children: (props)=>{
1081
- return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("g", null, _bars), /*#__PURE__*/ React.createElement("g", null, _isHavingLines && _createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
1061
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("g", _arrowNavigationAttributes, _bars), /*#__PURE__*/ React.createElement("g", null, _isHavingLines && _createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
1082
1062
  }
1083
1063
  });
1084
1064
  }