@fluentui/react-charts 0.0.0-nightly-20250423-1342.1 → 0.0.0-nightly-20250424-0405.1

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 (483) hide show
  1. package/CHANGELOG.md +16 -16
  2. package/dist/index.d.ts +3305 -0
  3. package/lib/AreaChart.js +1 -0
  4. package/lib/AreaChart.js.map +1 -0
  5. package/lib/CartesianChart.js +1 -0
  6. package/lib/CartesianChart.js.map +1 -0
  7. package/lib/DeclarativeChart.js +1 -0
  8. package/lib/DeclarativeChart.js.map +1 -0
  9. package/lib/DonutChart.js +1 -0
  10. package/lib/DonutChart.js.map +1 -0
  11. package/lib/GaugeChart.js +1 -0
  12. package/lib/GaugeChart.js.map +1 -0
  13. package/lib/GroupedVerticalBarChart.js +1 -0
  14. package/lib/GroupedVerticalBarChart.js.map +1 -0
  15. package/lib/HeatMapChart.js +1 -0
  16. package/lib/HeatMapChart.js.map +1 -0
  17. package/lib/HorizontalBarChart.js +1 -0
  18. package/lib/HorizontalBarChart.js.map +1 -0
  19. package/lib/HorizontalBarChartWithAxis.js +1 -0
  20. package/lib/HorizontalBarChartWithAxis.js.map +1 -0
  21. package/lib/Legends.js +1 -0
  22. package/lib/Legends.js.map +1 -0
  23. package/lib/LineChart.js +1 -0
  24. package/lib/LineChart.js.map +1 -0
  25. package/lib/Popover.js +1 -0
  26. package/lib/Popover.js.map +1 -0
  27. package/lib/ResponsiveContainer.js +1 -0
  28. package/lib/ResponsiveContainer.js.map +1 -0
  29. package/lib/SankeyChart.js +1 -0
  30. package/lib/SankeyChart.js.map +1 -0
  31. package/lib/ScatterChart.js +1 -0
  32. package/lib/ScatterChart.js.map +1 -0
  33. package/lib/Sparkline.js +1 -0
  34. package/lib/Sparkline.js.map +1 -0
  35. package/lib/VerticalBarChart.js +1 -0
  36. package/lib/VerticalBarChart.js.map +1 -0
  37. package/lib/VerticalStackedBarChart.js +1 -0
  38. package/lib/VerticalStackedBarChart.js.map +1 -0
  39. package/lib/components/AreaChart/AreaChart.js +775 -0
  40. package/lib/components/AreaChart/AreaChart.js.map +1 -0
  41. package/lib/components/AreaChart/AreaChart.types.js +4 -0
  42. package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
  43. package/lib/components/AreaChart/index.js +3 -0
  44. package/lib/components/AreaChart/index.js.map +1 -0
  45. package/lib/components/AreaChart/useAreaChartStyles.styles.js +55 -0
  46. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  47. package/lib/components/CommonComponents/CartesianChart.js +478 -0
  48. package/lib/components/CommonComponents/CartesianChart.js.map +1 -0
  49. package/lib/components/CommonComponents/CartesianChart.types.js +1 -0
  50. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -0
  51. package/lib/components/CommonComponents/ChartPopover.js +187 -0
  52. package/lib/components/CommonComponents/ChartPopover.js.map +1 -0
  53. package/lib/components/CommonComponents/ChartPopover.types.js +1 -0
  54. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -0
  55. package/lib/components/CommonComponents/index.js +4 -0
  56. package/lib/components/CommonComponents/index.js.map +1 -0
  57. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +113 -0
  58. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
  59. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +167 -0
  60. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
  61. package/lib/components/DeclarativeChart/DeclarativeChart.js +197 -0
  62. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
  63. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +811 -0
  64. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
  65. package/lib/components/DeclarativeChart/imageExporter.js +221 -0
  66. package/lib/components/DeclarativeChart/imageExporter.js.map +1 -0
  67. package/lib/components/DeclarativeChart/index.js +1 -0
  68. package/lib/components/DeclarativeChart/index.js.map +1 -0
  69. package/lib/components/DonutChart/Arc/Arc.js +110 -0
  70. package/lib/components/DonutChart/Arc/Arc.js.map +1 -0
  71. package/lib/components/DonutChart/Arc/Arc.types.js +1 -0
  72. package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -0
  73. package/lib/components/DonutChart/Arc/index.js +2 -0
  74. package/lib/components/DonutChart/Arc/index.js.map +1 -0
  75. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +54 -0
  76. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
  77. package/lib/components/DonutChart/DonutChart.js +291 -0
  78. package/lib/components/DonutChart/DonutChart.js.map +1 -0
  79. package/lib/components/DonutChart/DonutChart.types.js +1 -0
  80. package/lib/components/DonutChart/DonutChart.types.js.map +1 -0
  81. package/lib/components/DonutChart/Pie/Pie.js +72 -0
  82. package/lib/components/DonutChart/Pie/Pie.js.map +1 -0
  83. package/lib/components/DonutChart/Pie/Pie.types.js +1 -0
  84. package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -0
  85. package/lib/components/DonutChart/Pie/index.js +2 -0
  86. package/lib/components/DonutChart/Pie/index.js.map +1 -0
  87. package/lib/components/DonutChart/Pie/usePieStyles.styles.js +40 -0
  88. package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
  89. package/lib/components/DonutChart/index.js +3 -0
  90. package/lib/components/DonutChart/index.js.map +1 -0
  91. package/lib/components/DonutChart/useDonutChartStyles.styles.js +58 -0
  92. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
  93. package/lib/components/GaugeChart/GaugeChart.js +592 -0
  94. package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
  95. package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
  96. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
  97. package/lib/components/GaugeChart/index.js +3 -0
  98. package/lib/components/GaugeChart/index.js.map +1 -0
  99. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +178 -0
  100. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
  101. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +501 -0
  102. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
  103. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
  104. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
  105. package/lib/components/GroupedVerticalBarChart/index.js +3 -0
  106. package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
  107. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +81 -0
  108. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
  109. package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
  110. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
  111. package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
  112. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  113. package/lib/components/HeatMapChart/index.js +3 -0
  114. package/lib/components/HeatMapChart/index.js.map +1 -0
  115. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +37 -0
  116. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  117. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +402 -0
  118. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
  119. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +6 -0
  120. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
  121. package/lib/components/HorizontalBarChart/index.js +3 -0
  122. package/lib/components/HorizontalBarChart/index.js.map +1 -0
  123. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +156 -0
  124. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
  125. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
  126. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  127. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
  128. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  129. package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
  130. package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  131. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +67 -0
  132. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  133. package/lib/components/Legends/Legends.js +303 -0
  134. package/lib/components/Legends/Legends.js.map +1 -0
  135. package/lib/components/Legends/Legends.types.js +1 -0
  136. package/lib/components/Legends/Legends.types.js.map +1 -0
  137. package/lib/components/Legends/OverflowMenu.js +25 -0
  138. package/lib/components/Legends/OverflowMenu.js.map +1 -0
  139. package/lib/components/Legends/index.js +3 -0
  140. package/lib/components/Legends/index.js.map +1 -0
  141. package/lib/components/Legends/shape.js +35 -0
  142. package/lib/components/Legends/shape.js.map +1 -0
  143. package/lib/components/Legends/useLegendsStyles.styles.js +146 -0
  144. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -0
  145. package/lib/components/LineChart/LineChart.js +1034 -0
  146. package/lib/components/LineChart/LineChart.js.map +1 -0
  147. package/lib/components/LineChart/LineChart.types.js +3 -0
  148. package/lib/components/LineChart/LineChart.types.js.map +1 -0
  149. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +119 -0
  150. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
  151. package/lib/components/LineChart/eventAnnotation/LabelLink.js +57 -0
  152. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
  153. package/lib/components/LineChart/eventAnnotation/Textbox.js +40 -0
  154. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
  155. package/lib/components/LineChart/index.js +4 -0
  156. package/lib/components/LineChart/index.js.map +1 -0
  157. package/lib/components/LineChart/useLineChartStyles.styles.js +56 -0
  158. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -0
  159. package/lib/components/ResponsiveContainer/ResponsiveContainer.js +65 -0
  160. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
  161. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +1 -0
  162. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
  163. package/lib/components/ResponsiveContainer/index.js +1 -0
  164. package/lib/components/ResponsiveContainer/index.js.map +1 -0
  165. package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +23 -0
  166. package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
  167. package/lib/components/SankeyChart/SankeyChart.js +1023 -0
  168. package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
  169. package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
  170. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
  171. package/lib/components/SankeyChart/index.js +3 -0
  172. package/lib/components/SankeyChart/index.js.map +1 -0
  173. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
  174. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  175. package/lib/components/ScatterChart/ScatterChart.js +465 -0
  176. package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
  177. package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
  178. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
  179. package/lib/components/ScatterChart/index.js +3 -0
  180. package/lib/components/ScatterChart/index.js.map +1 -0
  181. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +56 -0
  182. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
  183. package/lib/components/Sparkline/Sparkline.js +119 -0
  184. package/lib/components/Sparkline/Sparkline.js.map +1 -0
  185. package/lib/components/Sparkline/Sparkline.types.js +4 -0
  186. package/lib/components/Sparkline/Sparkline.types.js.map +1 -0
  187. package/lib/components/Sparkline/index.js +3 -0
  188. package/lib/components/Sparkline/index.js.map +1 -0
  189. package/lib/components/Sparkline/useSparklineStyles.styles.js +49 -0
  190. package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
  191. package/lib/components/VerticalBarChart/VerticalBarChart.js +926 -0
  192. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
  193. package/lib/components/VerticalBarChart/VerticalBarChart.types.js +4 -0
  194. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
  195. package/lib/components/VerticalBarChart/index.js +3 -0
  196. package/lib/components/VerticalBarChart/index.js.map +1 -0
  197. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +66 -0
  198. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
  199. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
  200. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  201. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
  202. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  203. package/lib/components/VerticalStackedBarChart/index.js +3 -0
  204. package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
  205. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +65 -0
  206. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  207. package/lib/index.js +20 -0
  208. package/lib/index.js.map +1 -0
  209. package/lib/types/DataPoint.js +1 -0
  210. package/lib/types/DataPoint.js.map +1 -0
  211. package/lib/types/EventAnnotation.js +1 -0
  212. package/lib/types/EventAnnotation.js.map +1 -0
  213. package/lib/types/LegendDataItem.js +1 -0
  214. package/lib/types/LegendDataItem.js.map +1 -0
  215. package/lib/types/index.js +2 -0
  216. package/lib/types/index.js.map +1 -0
  217. package/lib/utilities/FocusableTooltipText.js +65 -0
  218. package/lib/utilities/FocusableTooltipText.js.map +1 -0
  219. package/lib/utilities/KeyCodes.js +8 -0
  220. package/lib/utilities/KeyCodes.js.map +1 -0
  221. package/lib/utilities/SVGTooltipText.js +183 -0
  222. package/lib/utilities/SVGTooltipText.js.map +1 -0
  223. package/lib/utilities/async-utils.js +380 -0
  224. package/lib/utilities/async-utils.js.map +1 -0
  225. package/lib/utilities/colors.js +269 -0
  226. package/lib/utilities/colors.js.map +1 -0
  227. package/lib/utilities/getWindow.js +25 -0
  228. package/lib/utilities/getWindow.js.map +1 -0
  229. package/lib/utilities/index.js +3 -0
  230. package/lib/utilities/index.js.map +1 -0
  231. package/lib/utilities/locale-util.js +15 -0
  232. package/lib/utilities/locale-util.js.map +1 -0
  233. package/lib/utilities/overflow-utils.js +27 -0
  234. package/lib/utilities/overflow-utils.js.map +1 -0
  235. package/lib/utilities/string.js +32 -0
  236. package/lib/utilities/string.js.map +1 -0
  237. package/lib/utilities/test-data.js +329 -0
  238. package/lib/utilities/test-data.js.map +1 -0
  239. package/lib/utilities/utilities.js +1405 -0
  240. package/lib/utilities/utilities.js.map +1 -0
  241. package/lib/utilities/vbc-utils.js +27 -0
  242. package/lib/utilities/vbc-utils.js.map +1 -0
  243. package/lib-commonjs/AreaChart.js +6 -0
  244. package/lib-commonjs/AreaChart.js.map +1 -0
  245. package/lib-commonjs/CartesianChart.js +6 -0
  246. package/lib-commonjs/CartesianChart.js.map +1 -0
  247. package/lib-commonjs/DeclarativeChart.js +6 -0
  248. package/lib-commonjs/DeclarativeChart.js.map +1 -0
  249. package/lib-commonjs/DonutChart.js +6 -0
  250. package/lib-commonjs/DonutChart.js.map +1 -0
  251. package/lib-commonjs/GaugeChart.js +6 -0
  252. package/lib-commonjs/GaugeChart.js.map +1 -0
  253. package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
  254. package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
  255. package/lib-commonjs/HeatMapChart.js +6 -0
  256. package/lib-commonjs/HeatMapChart.js.map +1 -0
  257. package/lib-commonjs/HorizontalBarChart.js +6 -0
  258. package/lib-commonjs/HorizontalBarChart.js.map +1 -0
  259. package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
  260. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
  261. package/lib-commonjs/Legends.js +6 -0
  262. package/lib-commonjs/Legends.js.map +1 -0
  263. package/lib-commonjs/LineChart.js +6 -0
  264. package/lib-commonjs/LineChart.js.map +1 -0
  265. package/lib-commonjs/Popover.js +6 -0
  266. package/lib-commonjs/Popover.js.map +1 -0
  267. package/lib-commonjs/ResponsiveContainer.js +6 -0
  268. package/lib-commonjs/ResponsiveContainer.js.map +1 -0
  269. package/lib-commonjs/SankeyChart.js +6 -0
  270. package/lib-commonjs/SankeyChart.js.map +1 -0
  271. package/lib-commonjs/ScatterChart.js +6 -0
  272. package/lib-commonjs/ScatterChart.js.map +1 -0
  273. package/lib-commonjs/Sparkline.js +6 -0
  274. package/lib-commonjs/Sparkline.js.map +1 -0
  275. package/lib-commonjs/VerticalBarChart.js +6 -0
  276. package/lib-commonjs/VerticalBarChart.js.map +1 -0
  277. package/lib-commonjs/VerticalStackedBarChart.js +6 -0
  278. package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
  279. package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
  280. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
  281. package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
  282. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
  283. package/lib-commonjs/components/AreaChart/index.js +8 -0
  284. package/lib-commonjs/components/AreaChart/index.js.map +1 -0
  285. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +95 -0
  286. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  287. package/lib-commonjs/components/CommonComponents/CartesianChart.js +484 -0
  288. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -0
  289. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +6 -0
  290. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -0
  291. package/lib-commonjs/components/CommonComponents/ChartPopover.js +197 -0
  292. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -0
  293. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +4 -0
  294. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -0
  295. package/lib-commonjs/components/CommonComponents/index.js +9 -0
  296. package/lib-commonjs/components/CommonComponents/index.js.map +1 -0
  297. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +166 -0
  298. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
  299. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +236 -0
  300. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
  301. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +205 -0
  302. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
  303. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +859 -0
  304. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
  305. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +231 -0
  306. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -0
  307. package/lib-commonjs/components/DeclarativeChart/index.js +6 -0
  308. package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -0
  309. package/lib-commonjs/components/DonutChart/Arc/Arc.js +117 -0
  310. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -0
  311. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +4 -0
  312. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -0
  313. package/lib-commonjs/components/DonutChart/Arc/index.js +7 -0
  314. package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -0
  315. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +83 -0
  316. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
  317. package/lib-commonjs/components/DonutChart/DonutChart.js +298 -0
  318. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -0
  319. package/lib-commonjs/components/DonutChart/DonutChart.types.js +6 -0
  320. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -0
  321. package/lib-commonjs/components/DonutChart/Pie/Pie.js +79 -0
  322. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -0
  323. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +4 -0
  324. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -0
  325. package/lib-commonjs/components/DonutChart/Pie/index.js +7 -0
  326. package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -0
  327. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +54 -0
  328. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
  329. package/lib-commonjs/components/DonutChart/index.js +8 -0
  330. package/lib-commonjs/components/DonutChart/index.js.map +1 -0
  331. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +82 -0
  332. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
  333. package/lib-commonjs/components/GaugeChart/GaugeChart.js +621 -0
  334. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
  335. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
  336. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
  337. package/lib-commonjs/components/GaugeChart/index.js +8 -0
  338. package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
  339. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +258 -0
  340. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
  341. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +507 -0
  342. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
  343. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
  344. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
  345. package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
  346. package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
  347. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +130 -0
  348. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
  349. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
  350. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
  351. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
  352. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  353. package/lib-commonjs/components/HeatMapChart/index.js +8 -0
  354. package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
  355. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +59 -0
  356. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  357. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +408 -0
  358. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
  359. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +17 -0
  360. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
  361. package/lib-commonjs/components/HorizontalBarChart/index.js +8 -0
  362. package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -0
  363. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +237 -0
  364. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
  365. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
  366. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  367. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
  368. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  369. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
  370. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  371. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +107 -0
  372. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  373. package/lib-commonjs/components/Legends/Legends.js +313 -0
  374. package/lib-commonjs/components/Legends/Legends.js.map +1 -0
  375. package/lib-commonjs/components/Legends/Legends.types.js +6 -0
  376. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -0
  377. package/lib-commonjs/components/Legends/OverflowMenu.js +36 -0
  378. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -0
  379. package/lib-commonjs/components/Legends/index.js +8 -0
  380. package/lib-commonjs/components/Legends/index.js.map +1 -0
  381. package/lib-commonjs/components/Legends/shape.js +46 -0
  382. package/lib-commonjs/components/Legends/shape.js.map +1 -0
  383. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +304 -0
  384. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -0
  385. package/lib-commonjs/components/LineChart/LineChart.js +1040 -0
  386. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -0
  387. package/lib-commonjs/components/LineChart/LineChart.types.js +6 -0
  388. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -0
  389. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +129 -0
  390. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
  391. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +68 -0
  392. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
  393. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +51 -0
  394. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
  395. package/lib-commonjs/components/LineChart/index.js +9 -0
  396. package/lib-commonjs/components/LineChart/index.js.map +1 -0
  397. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +87 -0
  398. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -0
  399. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +76 -0
  400. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
  401. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +6 -0
  402. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
  403. package/lib-commonjs/components/ResponsiveContainer/index.js +6 -0
  404. package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -0
  405. package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +47 -0
  406. package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
  407. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1039 -0
  408. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
  409. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
  410. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
  411. package/lib-commonjs/components/SankeyChart/index.js +8 -0
  412. package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
  413. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
  414. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  415. package/lib-commonjs/components/ScatterChart/ScatterChart.js +471 -0
  416. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
  417. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
  418. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
  419. package/lib-commonjs/components/ScatterChart/index.js +8 -0
  420. package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
  421. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +87 -0
  422. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
  423. package/lib-commonjs/components/Sparkline/Sparkline.js +125 -0
  424. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -0
  425. package/lib-commonjs/components/Sparkline/Sparkline.types.js +7 -0
  426. package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -0
  427. package/lib-commonjs/components/Sparkline/index.js +8 -0
  428. package/lib-commonjs/components/Sparkline/index.js.map +1 -0
  429. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +77 -0
  430. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
  431. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +928 -0
  432. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
  433. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +7 -0
  434. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
  435. package/lib-commonjs/components/VerticalBarChart/index.js +8 -0
  436. package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -0
  437. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +110 -0
  438. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
  439. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
  440. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  441. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
  442. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  443. package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
  444. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
  445. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +113 -0
  446. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  447. package/lib-commonjs/index.js +25 -0
  448. package/lib-commonjs/index.js.map +1 -0
  449. package/lib-commonjs/types/DataPoint.js +4 -0
  450. package/lib-commonjs/types/DataPoint.js.map +1 -0
  451. package/lib-commonjs/types/EventAnnotation.js +6 -0
  452. package/lib-commonjs/types/EventAnnotation.js.map +1 -0
  453. package/lib-commonjs/types/LegendDataItem.js +4 -0
  454. package/lib-commonjs/types/LegendDataItem.js.map +1 -0
  455. package/lib-commonjs/types/index.js +7 -0
  456. package/lib-commonjs/types/index.js.map +1 -0
  457. package/lib-commonjs/utilities/FocusableTooltipText.js +75 -0
  458. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -0
  459. package/lib-commonjs/utilities/KeyCodes.js +18 -0
  460. package/lib-commonjs/utilities/KeyCodes.js.map +1 -0
  461. package/lib-commonjs/utilities/SVGTooltipText.js +193 -0
  462. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
  463. package/lib-commonjs/utilities/async-utils.js +382 -0
  464. package/lib-commonjs/utilities/async-utils.js.map +1 -0
  465. package/lib-commonjs/utilities/colors.js +293 -0
  466. package/lib-commonjs/utilities/colors.js.map +1 -0
  467. package/lib-commonjs/utilities/getWindow.js +28 -0
  468. package/lib-commonjs/utilities/getWindow.js.map +1 -0
  469. package/lib-commonjs/utilities/index.js +8 -0
  470. package/lib-commonjs/utilities/index.js.map +1 -0
  471. package/lib-commonjs/utilities/locale-util.js +25 -0
  472. package/lib-commonjs/utilities/locale-util.js.map +1 -0
  473. package/lib-commonjs/utilities/overflow-utils.js +36 -0
  474. package/lib-commonjs/utilities/overflow-utils.js.map +1 -0
  475. package/lib-commonjs/utilities/string.js +29 -0
  476. package/lib-commonjs/utilities/string.js.map +1 -0
  477. package/lib-commonjs/utilities/test-data.js +383 -0
  478. package/lib-commonjs/utilities/test-data.js.map +1 -0
  479. package/lib-commonjs/utilities/utilities.js +1371 -0
  480. package/lib-commonjs/utilities/utilities.js.map +1 -0
  481. package/lib-commonjs/utilities/vbc-utils.js +45 -0
  482. package/lib-commonjs/utilities/vbc-utils.js.map +1 -0
  483. package/package.json +13 -13
@@ -0,0 +1,915 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "VerticalStackedBarChart", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return VerticalStackedBarChart;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _d3array = require("d3-array");
14
+ const _d3selection = require("d3-selection");
15
+ const _useVerticalStackedBarChartStylesstyles = require("./useVerticalStackedBarChartStyles.styles");
16
+ const _d3scale = require("d3-scale");
17
+ const _reactutilities = require("@fluentui/react-utilities");
18
+ const _reacttheme = require("@fluentui/react-theme");
19
+ const _index = require("../../index");
20
+ const _index1 = require("../../utilities/index");
21
+ const barGapMultiplier = 0.2;
22
+ const barGapMin = 1;
23
+ const MIN_DOMAIN_MARGIN = 8;
24
+ var CircleVisbility;
25
+ (function(CircleVisbility) {
26
+ CircleVisbility["show"] = "visibility";
27
+ CircleVisbility["hide"] = "hidden";
28
+ })(CircleVisbility || (CircleVisbility = {}));
29
+ const VerticalStackedBarChart = (props)=>{
30
+ var _props_legendProps;
31
+ const _isRtl = (0, _index1.useRtl)();
32
+ const _createLegendsForLine = (data)=>_getLineLegends(data);
33
+ const _tooltipId = (0, _reactutilities.useId)('VSBCTooltipId_');
34
+ const _emptyChartId = (0, _reactutilities.useId)('_VSBC_empty');
35
+ let _points = [];
36
+ let _dataset;
37
+ let _xAxisLabels = [];
38
+ let _bars;
39
+ let _xAxisType = props.data && props.data.length > 0 ? (0, _index1.getTypeOfAxis)(props.data[0].xAxisPoint, true) : _index1.XAxisTypes.StringAxis;
40
+ let _barWidth = 0;
41
+ let _colors;
42
+ let _margins;
43
+ let _lineObject;
44
+ let _yMax;
45
+ let _calloutAnchorPoint;
46
+ let _domainMargin = MIN_DOMAIN_MARGIN;
47
+ let _xAxisInnerPadding = 0;
48
+ let _xAxisOuterPadding = 0;
49
+ const cartesianChartRef = _react.useRef(null);
50
+ const [selectedLegends, setSelectedLegends] = _react.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
51
+ const [activeLegend, setActiveLegend] = _react.useState(undefined);
52
+ const [dataForHoverCard, setDataForHoverCard] = _react.useState(0);
53
+ const [color, setColor] = _react.useState('');
54
+ const [hoverXValue, setHoverXValue] = _react.useState('');
55
+ const [YValueHover, setYValueHover] = _react.useState([]);
56
+ const [xCalloutValue, setXCalloutValue] = _react.useState('');
57
+ const [yCalloutValue, setYCalloutValue] = _react.useState('');
58
+ const [activeXAxisDataPoint, setActiveXAxisDataPoint] = _react.useState('');
59
+ const [calloutLegend, setCalloutLegend] = _react.useState('');
60
+ const [stackCalloutProps, setStackCalloutProps] = _react.useState();
61
+ const [dataPointCalloutProps, setDataPointCalloutProps] = _react.useState();
62
+ const [callOutAccessibilityData, setCallOutAccessibilityData] = _react.useState();
63
+ const [clickPosition, setClickPosition] = _react.useState({
64
+ x: 0,
65
+ y: 0
66
+ });
67
+ const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
68
+ const prevPropsRef = _react.useRef(null);
69
+ _react.useEffect(()=>{
70
+ if (prevPropsRef.current) {
71
+ var _prevProps_legendProps, _props_legendProps;
72
+ const prevProps = prevPropsRef.current;
73
+ if (!(0, _index1.areArraysEqual)((_prevProps_legendProps = prevProps.legendProps) === null || _prevProps_legendProps === void 0 ? void 0 : _prevProps_legendProps.selectedLegends, (_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends)) {
74
+ var _props_legendProps1;
75
+ setSelectedLegends(((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.selectedLegends) || []);
76
+ }
77
+ if (prevProps.height !== props.height || prevProps.width !== props.width || prevProps.data !== props.data) {
78
+ _adjustProps();
79
+ _dataset = _createDataSetLayer();
80
+ }
81
+ }
82
+ prevPropsRef.current = props;
83
+ }, [
84
+ props
85
+ ]);
86
+ _react.useImperativeHandle(props.componentRef, ()=>{
87
+ var _cartesianChartRef_current;
88
+ var _cartesianChartRef_current_chartContainer;
89
+ return {
90
+ 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
91
+ };
92
+ }, []);
93
+ function _getLegendData(data, lineLegends) {
94
+ if (props.hideLegend) {
95
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null);
96
+ }
97
+ const defaultPalette = [
98
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color6),
99
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color1),
100
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color5),
101
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color7),
102
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color10)
103
+ ];
104
+ const actions = [];
105
+ const { allowHoverOnLegend = true } = props;
106
+ data.forEach((singleChartData)=>{
107
+ singleChartData.chartData.forEach((point)=>{
108
+ const color = point.color ? point.color : defaultPalette[Math.floor(Math.random() * 4 + 1)];
109
+ const checkSimilarLegends = actions.filter((leg)=>leg.title === point.legend && leg.color === color);
110
+ if (checkSimilarLegends.length > 0) {
111
+ return;
112
+ }
113
+ const legend = {
114
+ title: point.legend,
115
+ color,
116
+ hoverAction: allowHoverOnLegend ? ()=>{
117
+ _handleChartMouseLeave();
118
+ _onLegendHover(point.legend);
119
+ } : undefined,
120
+ onMouseOutAction: allowHoverOnLegend ? ()=>_onLegendLeave() : undefined
121
+ };
122
+ actions.push(legend);
123
+ });
124
+ });
125
+ const legendsOfLine = [];
126
+ if (lineLegends && lineLegends.length > 0) {
127
+ lineLegends.forEach((point)=>{
128
+ const legend = {
129
+ title: point.title,
130
+ color: point.color,
131
+ isLineLegendInBarChart: true,
132
+ hoverAction: allowHoverOnLegend ? ()=>{
133
+ _handleChartMouseLeave();
134
+ _onLegendHover(point.title);
135
+ } : undefined,
136
+ onMouseOutAction: allowHoverOnLegend ? ()=>_onLegendLeave() : undefined
137
+ };
138
+ legendsOfLine.push(legend);
139
+ });
140
+ }
141
+ const totalLegends = legendsOfLine.concat(actions);
142
+ return /*#__PURE__*/ _react.createElement(_index.Legends, {
143
+ legends: totalLegends,
144
+ enabledWrapLines: props.enabledLegendsWrapLines,
145
+ overflowText: props.legendsOverflowText,
146
+ ...props.legendProps,
147
+ onChange: _onLegendSelectionChange
148
+ });
149
+ }
150
+ function _getHighlightedLegend() {
151
+ return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [
152
+ activeLegend
153
+ ] : [];
154
+ }
155
+ function _lineHoverOut() {
156
+ setPopoverOpen(false);
157
+ setXCalloutValue('');
158
+ setYCalloutValue('');
159
+ setActiveXAxisDataPoint('');
160
+ setColor('');
161
+ }
162
+ function _lineHoverFocus(lineData) {
163
+ setPopoverOpen(true);
164
+ setXCalloutValue(`${lineData.xItem.xAxisPoint}`);
165
+ setYCalloutValue(`${lineData.yAxisCalloutData || lineData.data || lineData.y}`);
166
+ setActiveXAxisDataPoint(lineData.xItem.xAxisPoint);
167
+ setColor(lineData.color);
168
+ }
169
+ function _onStackHoverFocus(stack, mouseEvent) {
170
+ var _stack_lineData;
171
+ let clientX = 0;
172
+ let clientY = 0;
173
+ if ('clientX' in mouseEvent) {
174
+ clientX = mouseEvent.clientX;
175
+ clientY = mouseEvent.clientY;
176
+ } else {
177
+ // Handle case where mouseEvent is an SVGGElement
178
+ const boundingRect = mouseEvent.getBoundingClientRect();
179
+ clientX = boundingRect.left + boundingRect.width / 2;
180
+ clientY = boundingRect.top + boundingRect.height / 2;
181
+ }
182
+ if (!_noLegendHighlighted()) {
183
+ var _stack_lineData1;
184
+ stack = {
185
+ ...stack,
186
+ chartData: stack.chartData.filter((dataPoint)=>_isLegendHighlighted(dataPoint.legend)),
187
+ lineData: (_stack_lineData1 = stack.lineData) === null || _stack_lineData1 === void 0 ? void 0 : _stack_lineData1.filter((dataPoint)=>_isLegendHighlighted(dataPoint.legend))
188
+ };
189
+ }
190
+ const lineData = stack.lineData;
191
+ const isLinesPresent = lineData !== undefined && lineData.length > 0;
192
+ if (isLinesPresent) {
193
+ lineData.forEach((item)=>{
194
+ item.data = item.data || item.y;
195
+ item.shouldDrawBorderBottom = true;
196
+ });
197
+ }
198
+ _updatePosition(clientX, clientY);
199
+ var _stack_lineData_length;
200
+ setPopoverOpen(stack.chartData.length > 0 || ((_stack_lineData_length = (_stack_lineData = stack.lineData) === null || _stack_lineData === void 0 ? void 0 : _stack_lineData.length) !== null && _stack_lineData_length !== void 0 ? _stack_lineData_length : 0) > 0);
201
+ setYValueHover(isLinesPresent ? [
202
+ ...lineData.sort((a, b)=>a.data < b.data ? 1 : -1),
203
+ ...stack.chartData.slice().reverse()
204
+ ] : stack.chartData.slice().reverse());
205
+ setHoverXValue(stack.xAxisPoint instanceof Date ? (0, _index1.formatDate)(stack.xAxisPoint, props.useUTC) : stack.xAxisPoint);
206
+ setStackCalloutProps(stack);
207
+ setActiveXAxisDataPoint(stack.xAxisPoint);
208
+ setCallOutAccessibilityData(stack.stackCallOutAccessibilityData);
209
+ }
210
+ function _handleChartMouseLeave() {
211
+ _calloutAnchorPoint = null;
212
+ setPopoverOpen(false);
213
+ setActiveXAxisDataPoint('');
214
+ }
215
+ const _onClick = (data, mouseEvent)=>{
216
+ var _props_onBarClick;
217
+ (_props_onBarClick = props.onBarClick) === null || _props_onBarClick === void 0 ? void 0 : _props_onBarClick.call(props, mouseEvent, data);
218
+ props.href ? window.location.href = props.href : '';
219
+ };
220
+ function _adjustProps() {
221
+ _points = props.data || [];
222
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth);
223
+ const defaultColors = [
224
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color6),
225
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color1),
226
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color5),
227
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color7),
228
+ (0, _index1.getColorFromToken)(_index1.DataVizPalette.color10)
229
+ ];
230
+ _colors = defaultColors;
231
+ _xAxisType = (0, _index1.getTypeOfAxis)(props.data[0].xAxisPoint, true);
232
+ _lineObject = _getFormattedLineData(props.data);
233
+ _xAxisInnerPadding = (0, _index1.getScalePadding)(props.xAxisInnerPadding, props.xAxisPadding, 2 / 3);
234
+ _xAxisOuterPadding = (0, _index1.getScalePadding)(props.xAxisOuterPadding, props.xAxisPadding, 0);
235
+ }
236
+ function _createDataSetLayer() {
237
+ const tempArr = [];
238
+ const dataset = _points.map((singlePointData)=>{
239
+ let total = 0;
240
+ singlePointData.chartData.forEach((point)=>{
241
+ total = total + point.data;
242
+ });
243
+ tempArr.push(singlePointData.xAxisPoint);
244
+ return {
245
+ x: singlePointData.xAxisPoint,
246
+ y: total
247
+ };
248
+ });
249
+ _xAxisLabels = tempArr;
250
+ return dataset;
251
+ }
252
+ function _onLegendHover(legendTitle) {
253
+ setActiveLegend(legendTitle);
254
+ }
255
+ function _onLegendLeave() {
256
+ setActiveLegend(undefined);
257
+ }
258
+ function _onLegendSelectionChange(_selectedLegends, event, currentLegend) {
259
+ var _props_legendProps, _props_legendProps1;
260
+ if ((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.canSelectMultipleLegends) {
261
+ setSelectedLegends(_selectedLegends);
262
+ } else {
263
+ setSelectedLegends(_selectedLegends.slice(-1));
264
+ }
265
+ if ((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.onChange) {
266
+ props.legendProps.onChange(_selectedLegends, event, currentLegend);
267
+ }
268
+ }
269
+ function _getMargins(margins) {
270
+ _margins = margins;
271
+ }
272
+ function _getGraphData(xScale, yScale, containerHeight, containerWidth, xElement) {
273
+ const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
274
+ return _bars = _createBar(xBarScale, yBarScale, containerHeight, xElement);
275
+ }
276
+ function _getAxisData(yAxisData) {
277
+ if (yAxisData && yAxisData.yAxisDomainValues.length) {
278
+ const { yAxisDomainValues: domainValue } = yAxisData;
279
+ _yMax = Math.max(domainValue[domainValue.length - 1], props.yMaxValue || 0);
280
+ }
281
+ }
282
+ /**
283
+ * This function checks if the given legend is highlighted or not.
284
+ * A legend can be highlighted in 2 ways:
285
+ * 1. selection: if the user clicks on it
286
+ * 2. hovering: if there is no selected legend and the user hovers over it
287
+ */ function _isLegendHighlighted(legendTitle) {
288
+ return _getHighlightedLegend().includes(legendTitle);
289
+ }
290
+ /**
291
+ * This function checks if none of the legends is selected or hovered.
292
+ */ function _noLegendHighlighted() {
293
+ return _getHighlightedLegend().length === 0;
294
+ }
295
+ function _getAriaLabel(singleChartData, point) {
296
+ var _point_callOutAccessibilityData;
297
+ if (!point) {
298
+ var _singleChartData_lineData, _singleChartData_stackCallOutAccessibilityData;
299
+ /** if shouldFocusWholeStack is true */ const xValue = singleChartData.xAxisCalloutData || (singleChartData.xAxisPoint instanceof Date ? (0, _index1.formatDate)(singleChartData.xAxisPoint) : singleChartData.xAxisPoint);
300
+ const pointValues = singleChartData.chartData.map((pt)=>{
301
+ const legend = pt.legend;
302
+ const yValue = pt.yAxisCalloutData || pt.data;
303
+ return `${legend}, ${yValue}.`;
304
+ }).join(' ');
305
+ const lineValues = (_singleChartData_lineData = singleChartData.lineData) === null || _singleChartData_lineData === void 0 ? void 0 : _singleChartData_lineData.map((ln)=>{
306
+ const legend = ln.legend;
307
+ const yValue = ln.yAxisCalloutData || ln.data || ln.y;
308
+ return `${legend}, ${yValue}.`;
309
+ }).join(' ');
310
+ return ((_singleChartData_stackCallOutAccessibilityData = singleChartData.stackCallOutAccessibilityData) === null || _singleChartData_stackCallOutAccessibilityData === void 0 ? void 0 : _singleChartData_stackCallOutAccessibilityData.ariaLabel) || `${xValue}. ${pointValues}` + (lineValues ? ` ${lineValues}` : '');
311
+ }
312
+ /** if shouldFocusWholeStack is false */ const xValue = singleChartData.xAxisCalloutData || point.xAxisCalloutData || (singleChartData.xAxisPoint instanceof Date ? (0, _index1.formatDate)(singleChartData.xAxisPoint) : singleChartData.xAxisPoint);
313
+ const legend = point.legend;
314
+ const yValue = point.yAxisCalloutData || point.data;
315
+ return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
316
+ }
317
+ function _getCustomizedCallout() {
318
+ const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
319
+ return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint && !_isHavingLines ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout) : null;
320
+ }
321
+ function _toFocusWholeStack(_isHavingLines) {
322
+ const { isCalloutForStack = false } = props;
323
+ let shouldFocusStackOnly = false;
324
+ if (_isHavingLines) {
325
+ if (_getHighlightedLegend().length === 1) {
326
+ shouldFocusStackOnly = false;
327
+ } else {
328
+ shouldFocusStackOnly = true;
329
+ }
330
+ } else {
331
+ shouldFocusStackOnly = isCalloutForStack;
332
+ }
333
+ return shouldFocusStackOnly;
334
+ }
335
+ function _getFormattedLineData(data) {
336
+ const linesData = [];
337
+ const formattedLineData = {};
338
+ data.forEach((item, index)=>{
339
+ if (item.lineData) {
340
+ item.lineData.forEach((line)=>{
341
+ linesData.push({
342
+ ...line,
343
+ index,
344
+ xItem: item
345
+ });
346
+ });
347
+ }
348
+ });
349
+ linesData.forEach((item)=>{
350
+ if (formattedLineData[item.legend]) {
351
+ formattedLineData[item.legend].push(item);
352
+ } else {
353
+ formattedLineData[item.legend] = [
354
+ item
355
+ ];
356
+ }
357
+ });
358
+ return formattedLineData;
359
+ }
360
+ function _getLineLegends(data) {
361
+ const lineObject = _lineObject;
362
+ const lineLegends = [];
363
+ Object.keys(lineObject).forEach((item)=>{
364
+ lineLegends.push({
365
+ title: item,
366
+ color: lineObject[item][0].color
367
+ });
368
+ });
369
+ return lineLegends;
370
+ }
371
+ function _createLines(xScale, yScale, containerHeight, containerWidth, secondaryYScale) {
372
+ var _props_lineOptions;
373
+ const lineObject = _getFormattedLineData(props.data);
374
+ const lines = [];
375
+ const borderForLines = [];
376
+ const dots = [];
377
+ //const { theme } = props;
378
+ const lineBorderWidth = ((_props_lineOptions = props.lineOptions) === null || _props_lineOptions === void 0 ? void 0 : _props_lineOptions.lineBorderWidth) ? Number.parseFloat(props.lineOptions.lineBorderWidth.toString()) : 0;
379
+ const xScaleBandwidthTranslate = _xAxisType !== _index1.XAxisTypes.StringAxis ? 0 : xScale.bandwidth() / 2;
380
+ Object.keys(lineObject).forEach((item, index)=>{
381
+ const shouldHighlight = _isLegendHighlighted(item) || _noLegendHighlighted();
382
+ for(let i = 1; i < lineObject[item].length; i++){
383
+ var _lineObject_item__lineOptions, _lineObject_item__lineOptions1, _lineObject_item__lineOptions2;
384
+ const x1 = xScale(lineObject[item][i - 1].xItem.xAxisPoint);
385
+ const useSecondaryYScale = lineObject[item][i - 1].useSecondaryYScale && lineObject[item][i].useSecondaryYScale && secondaryYScale;
386
+ const y1 = useSecondaryYScale ? secondaryYScale(lineObject[item][i - 1].y) : yScale(lineObject[item][i - 1].y);
387
+ const x2 = xScale(lineObject[item][i].xItem.xAxisPoint);
388
+ const y2 = useSecondaryYScale ? secondaryYScale(lineObject[item][i].y) : yScale(lineObject[item][i].y);
389
+ if (lineBorderWidth > 0) {
390
+ borderForLines.push(/*#__PURE__*/ _react.createElement("line", {
391
+ key: `${index}-${i}-BorderLine`,
392
+ x1: x1,
393
+ y1: y1,
394
+ x2: x2,
395
+ y2: y2,
396
+ opacity: shouldHighlight ? 1 : 0.1,
397
+ strokeWidth: 3 + lineBorderWidth * 2,
398
+ fill: "transparent",
399
+ strokeLinecap: "round",
400
+ stroke: _reacttheme.tokens.colorNeutralBackground1,
401
+ transform: `translate(${xScaleBandwidthTranslate}, 0)`
402
+ }));
403
+ }
404
+ var _lineObject_item__lineOptions_strokeWidth, _lineObject_item__lineOptions_strokeLinecap;
405
+ lines.push(/*#__PURE__*/ _react.createElement("line", {
406
+ key: `${index}-${i}-line`,
407
+ x1: x1,
408
+ y1: y1,
409
+ x2: x2,
410
+ y2: y2,
411
+ opacity: shouldHighlight ? 1 : 0.1,
412
+ strokeWidth: (_lineObject_item__lineOptions_strokeWidth = (_lineObject_item__lineOptions = lineObject[item][0].lineOptions) === null || _lineObject_item__lineOptions === void 0 ? void 0 : _lineObject_item__lineOptions.strokeWidth) !== null && _lineObject_item__lineOptions_strokeWidth !== void 0 ? _lineObject_item__lineOptions_strokeWidth : 3,
413
+ strokeLinecap: (_lineObject_item__lineOptions_strokeLinecap = (_lineObject_item__lineOptions1 = lineObject[item][0].lineOptions) === null || _lineObject_item__lineOptions1 === void 0 ? void 0 : _lineObject_item__lineOptions1.strokeLinecap) !== null && _lineObject_item__lineOptions_strokeLinecap !== void 0 ? _lineObject_item__lineOptions_strokeLinecap : 'round',
414
+ strokeDasharray: (_lineObject_item__lineOptions2 = lineObject[item][0].lineOptions) === null || _lineObject_item__lineOptions2 === void 0 ? void 0 : _lineObject_item__lineOptions2.strokeDasharray,
415
+ stroke: lineObject[item][i].color,
416
+ transform: `translate(${xScaleBandwidthTranslate}, 0)`,
417
+ ..._isLegendHighlighted(item) && {
418
+ onMouseOver: _lineHover.bind(lineObject[item][i - 1]),
419
+ onMouseLeave: _lineHoverOut
420
+ }
421
+ }));
422
+ }
423
+ });
424
+ Object.keys(lineObject).forEach((item, index)=>{
425
+ lineObject[item].forEach((circlePoint, subIndex)=>{
426
+ const circleRef = {
427
+ refElement: null
428
+ };
429
+ dots.push(/*#__PURE__*/ _react.createElement("circle", {
430
+ key: `${index}-${subIndex}-dot`,
431
+ cx: xScale(circlePoint.xItem.xAxisPoint),
432
+ cy: circlePoint.useSecondaryYScale && secondaryYScale ? secondaryYScale(circlePoint.y) : yScale(circlePoint.y),
433
+ onMouseOver: _isLegendHighlighted(item) ? (event)=>_lineHover(circlePoint, event) : (event)=>_onStackHover(circlePoint.xItem, event),
434
+ ..._isLegendHighlighted(item) && {
435
+ onMouseLeave: _lineHoverOut
436
+ },
437
+ r: _getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).radius,
438
+ stroke: circlePoint.color,
439
+ fill: _reacttheme.tokens.colorNeutralBackground1,
440
+ strokeWidth: 3,
441
+ visibility: _getCircleVisibilityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).visibility,
442
+ transform: `translate(${xScaleBandwidthTranslate}, 0)`,
443
+ "data-is-focusable": _isLegendHighlighted(item),
444
+ ref: (e)=>circleRef.refElement = e,
445
+ onFocus: _lineFocus.bind(circlePoint, circleRef),
446
+ onBlur: _lineHoverOut,
447
+ tabIndex: circlePoint.legend !== '' ? 0 : undefined
448
+ }));
449
+ });
450
+ });
451
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, borderForLines, lines, dots);
452
+ }
453
+ function _getCircleVisibilityAndRadius(xAxisPoint, legend) {
454
+ if (!_noLegendHighlighted()) {
455
+ if (xAxisPoint === activeXAxisDataPoint && _isLegendHighlighted(legend)) {
456
+ return {
457
+ visibility: "visibility",
458
+ radius: 8
459
+ };
460
+ } else if (_isLegendHighlighted(legend)) {
461
+ return {
462
+ visibility: "visibility",
463
+ radius: 0.3
464
+ };
465
+ } else {
466
+ return {
467
+ visibility: "hidden",
468
+ radius: 0
469
+ };
470
+ }
471
+ } else {
472
+ return {
473
+ visibility: activeXAxisDataPoint === xAxisPoint ? "visibility" : "hidden",
474
+ radius: 8
475
+ };
476
+ }
477
+ }
478
+ function _renderCallout(props) {
479
+ var _props_culture;
480
+ return props ? /*#__PURE__*/ _react.createElement(_index.ChartPopover, {
481
+ culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
482
+ XValue: props.xAxisCalloutData,
483
+ xCalloutValue: xCalloutValue,
484
+ yCalloutValue: yCalloutValue,
485
+ clickPosition: clickPosition,
486
+ isPopoverOpen: isPopoverOpen,
487
+ legend: props.legend,
488
+ YValue: props.yAxisCalloutData,
489
+ color: props.color
490
+ }) : null;
491
+ }
492
+ function _onRectHover(xAxisPoint, point, color, mouseEvent) {
493
+ mouseEvent.persist();
494
+ _onRectFocusHover(xAxisPoint, point, color, mouseEvent);
495
+ }
496
+ function _onRectFocusHover(xAxisPoint, point, color, mouseEvent) {
497
+ let clientX = 0;
498
+ let clientY = 0;
499
+ if ('clientX' in mouseEvent) {
500
+ clientX = mouseEvent.clientX;
501
+ clientY = mouseEvent.clientY;
502
+ } else {
503
+ // Handle case where mouseEvent is an SVGGElement
504
+ const boundingRect = mouseEvent.getBoundingClientRect();
505
+ clientX = boundingRect.left + boundingRect.width / 2;
506
+ clientY = boundingRect.top + boundingRect.height / 2;
507
+ }
508
+ if ((_calloutAnchorPoint === null || _calloutAnchorPoint === void 0 ? void 0 : _calloutAnchorPoint.chartDataPoint) !== point || (_calloutAnchorPoint === null || _calloutAnchorPoint === void 0 ? void 0 : _calloutAnchorPoint.xAxisDataPoint) !== xAxisPoint) {
509
+ _calloutAnchorPoint = {
510
+ chartDataPoint: point,
511
+ xAxisDataPoint: `${xAxisPoint}`
512
+ };
513
+ _updatePosition(clientX, clientY);
514
+ setPopoverOpen(_noLegendHighlighted() || _isLegendHighlighted(point.legend));
515
+ setCalloutLegend(point.legend);
516
+ setDataForHoverCard(point.data);
517
+ setColor(color);
518
+ setXCalloutValue(point.xAxisCalloutData ? point.xAxisCalloutData : `${xAxisPoint}`);
519
+ setYCalloutValue(point.yAxisCalloutData);
520
+ setDataPointCalloutProps(point);
521
+ setCallOutAccessibilityData(point.callOutAccessibilityData);
522
+ }
523
+ }
524
+ function _lineHover(lineData, mouseEvent) {
525
+ mouseEvent.persist();
526
+ _lineHoverFocus(lineData);
527
+ }
528
+ function _lineFocus(lineData, ref) {
529
+ if (ref.refElement) {
530
+ _lineHoverFocus(lineData);
531
+ }
532
+ }
533
+ function _onStackHover(stack, mouseEvent) {
534
+ mouseEvent.persist();
535
+ _onStackHoverFocus(stack, mouseEvent);
536
+ }
537
+ function _onRectFocus(point, xAxisPoint, color, ref) {
538
+ if (ref.refElement) {
539
+ _onRectFocusHover(xAxisPoint, point, color, ref.refElement);
540
+ }
541
+ }
542
+ function _onStackFocus(stack, groupRef) {
543
+ if (groupRef.refElement) {
544
+ _onStackHoverFocus(stack, groupRef.refElement);
545
+ }
546
+ }
547
+ function _handleMouseOut() {
548
+ setPopoverOpen(false);
549
+ }
550
+ function _getBarGapAndScale(bars, yBarScale, defaultTotalHeight) {
551
+ const { barGapMax = 0 } = props;
552
+ // When displaying gaps between the bars, the height of each bar is
553
+ // adjusted so that the total of all bars is not changed by the gaps
554
+ const totalData = bars.reduce((iter, value)=>iter + Math.abs(value.data), 0);
555
+ const totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : yBarScale(totalData);
556
+ let sumOfPercent = 0;
557
+ bars.forEach((point)=>{
558
+ let value = Math.abs(point.data) / totalData * 100;
559
+ if (value < 1 && value !== 0) {
560
+ value = 1;
561
+ }
562
+ sumOfPercent += value;
563
+ });
564
+ const scalingRatio = sumOfPercent !== 0 ? sumOfPercent / 100 : 1;
565
+ const gaps = barGapMax && bars.length - 1;
566
+ const gapHeight = gaps && Math.max(barGapMin, Math.min(barGapMax, totalHeight * barGapMultiplier / gaps));
567
+ const heightValueScale = (totalHeight - gapHeight * gaps) / (totalData * scalingRatio);
568
+ return {
569
+ gapHeight,
570
+ heightValueScale,
571
+ adjustedTotalHeight: sumOfPercent
572
+ };
573
+ }
574
+ function _getScales(containerHeight, containerWidth) {
575
+ const yMax = _yMax;
576
+ const yBarScale = (0, _d3scale.scaleLinear)().domain([
577
+ 0,
578
+ yMax
579
+ ]).range([
580
+ 0,
581
+ containerHeight - _margins.bottom - _margins.top
582
+ ]);
583
+ if (_xAxisType === _index1.XAxisTypes.NumericAxis) {
584
+ const xMax = (0, _d3array.max)(_dataset, (point)=>point.x);
585
+ const xMin = (0, _d3array.min)(_dataset, (point)=>point.x);
586
+ const xBarScale = (0, _d3scale.scaleLinear)().domain(_isRtl ? [
587
+ xMax,
588
+ xMin
589
+ ] : [
590
+ xMin,
591
+ xMax
592
+ ]).nice().range([
593
+ _margins.left + _domainMargin,
594
+ containerWidth - _margins.right - _domainMargin
595
+ ]);
596
+ return {
597
+ xBarScale,
598
+ yBarScale
599
+ };
600
+ }
601
+ if (_xAxisType === _index1.XAxisTypes.DateAxis) {
602
+ const sDate = (0, _d3array.min)(_dataset, (point)=>{
603
+ return point.x;
604
+ });
605
+ const lDate = (0, _d3array.max)(_dataset, (point)=>{
606
+ return point.x;
607
+ });
608
+ const xBarScale = props.useUTC ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
609
+ xBarScale.domain(_isRtl ? [
610
+ lDate,
611
+ sDate
612
+ ] : [
613
+ sDate,
614
+ lDate
615
+ ]).range([
616
+ _margins.left + _domainMargin,
617
+ containerWidth - _margins.right - _domainMargin
618
+ ]);
619
+ return {
620
+ xBarScale,
621
+ yBarScale
622
+ };
623
+ }
624
+ const xBarScale = (0, _d3scale.scaleBand)().domain(_xAxisLabels).range(_isRtl ? [
625
+ containerWidth - _margins.right - _domainMargin,
626
+ _margins.left + _domainMargin
627
+ ] : [
628
+ _margins.left + _domainMargin,
629
+ containerWidth - _margins.right - _domainMargin
630
+ ]).paddingInner(_xAxisInnerPadding).paddingOuter(_xAxisOuterPadding);
631
+ return {
632
+ xBarScale,
633
+ yBarScale
634
+ };
635
+ }
636
+ const _isChartEmpty = ()=>{
637
+ return !(props.data && props.data.length > 0 && props.data.some((item)=>item.chartData.length > 0 || item.lineData && item.lineData.length > 0));
638
+ };
639
+ function _updatePosition(newX, newY) {
640
+ const threshold = 1; // Set a threshold for movement
641
+ const { x, y } = clickPosition;
642
+ // Calculate the distance moved
643
+ const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
644
+ // Update the position only if the distance moved is greater than the threshold
645
+ if (distance > threshold) {
646
+ setClickPosition({
647
+ x: newX,
648
+ y: newY
649
+ });
650
+ setPopoverOpen(true);
651
+ }
652
+ }
653
+ function _getDomainMargins(containerWidth) {
654
+ _domainMargin = MIN_DOMAIN_MARGIN;
655
+ /** Total width available to render the bars */ const totalWidth = containerWidth - (_margins.left + MIN_DOMAIN_MARGIN) - (_margins.right + MIN_DOMAIN_MARGIN);
656
+ /** Rate at which the space between the bars changes wrt the bar width */ const barGapRate = _xAxisInnerPadding / (1 - _xAxisInnerPadding);
657
+ if (_xAxisType === _index1.XAxisTypes.StringAxis) {
658
+ if ((0, _index1.isScalePaddingDefined)(props.xAxisOuterPadding, props.xAxisPadding)) {
659
+ // Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
660
+ // to adjust the space before the first bar and after the last bar.
661
+ _domainMargin = 0;
662
+ } else if (props.barWidth !== 'auto') {
663
+ // Update the bar width so that when CartesianChart rerenders,
664
+ // the following calculations don't use the previous bar width.
665
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth);
666
+ /** Total width required to render the bars. Directly proportional to bar width */ const reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * _barWidth;
667
+ if (totalWidth >= reqWidth) {
668
+ // Center align the chart by setting equal left and right margins for domain
669
+ _domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
670
+ }
671
+ } else if (props.mode === 'plotly' && _xAxisLabels.length > 1) {
672
+ // Calculate the remaining width after rendering bars at their maximum allowable width
673
+ const bandwidth = totalWidth / (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate);
674
+ const barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth, bandwidth);
675
+ let reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * barWidth;
676
+ const margin1 = (totalWidth - reqWidth) / 2;
677
+ // Calculate the remaining width after accounting for the space required to render x-axis labels
678
+ const step = (0, _index1.calculateLongestLabelWidth)(_xAxisLabels) + 20;
679
+ reqWidth = (_xAxisLabels.length - _xAxisInnerPadding) * step;
680
+ const margin2 = (totalWidth - reqWidth) / 2;
681
+ _domainMargin = MIN_DOMAIN_MARGIN + Math.max(0, Math.min(margin1, margin2));
682
+ }
683
+ } else {
684
+ var _props_data;
685
+ const data = ((_props_data = props.data) === null || _props_data === void 0 ? void 0 : _props_data.map((point)=>point.xAxisPoint)) || [];
686
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth, (0, _index1.calculateAppropriateBarWidth)(data, totalWidth));
687
+ _domainMargin = MIN_DOMAIN_MARGIN + _barWidth / 2;
688
+ }
689
+ return {
690
+ ..._margins,
691
+ left: _margins.left + _domainMargin,
692
+ right: _margins.right + _domainMargin
693
+ };
694
+ }
695
+ function _getChartTitle() {
696
+ const { chartTitle, data } = props;
697
+ const numLines = Object.keys(_lineObject).length;
698
+ return (chartTitle ? `${chartTitle}. ` : '') + `Vertical bar chart with ${(data === null || data === void 0 ? void 0 : data.length) || 0} stacked bars` + (numLines > 0 ? ` and ${numLines} lines` : '') + '. ';
699
+ }
700
+ const classes = (0, _useVerticalStackedBarChartStylesstyles.useVerticalStackedBarChartStyles)(props);
701
+ function _createBar(xBarScale, yBarScale, containerHeight, xElement) {
702
+ const { barCornerRadius = 0, barMinimumHeight = 0 } = props;
703
+ const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
704
+ const shouldFocusWholeStack = _toFocusWholeStack(_isHavingLines);
705
+ if (_xAxisType === _index1.XAxisTypes.StringAxis) {
706
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth, xBarScale.bandwidth());
707
+ }
708
+ const bars = _points.map((singleChartData, indexNumber)=>{
709
+ let yPoint = containerHeight - _margins.bottom;
710
+ const xPoint = xBarScale(_xAxisType === _index1.XAxisTypes.NumericAxis ? singleChartData.xAxisPoint : _xAxisType === _index1.XAxisTypes.DateAxis ? singleChartData.xAxisPoint : singleChartData.xAxisPoint);
711
+ const xScaleBandwidthTranslate = _xAxisType !== _index1.XAxisTypes.StringAxis ? -_barWidth / 2 : (xBarScale.bandwidth() - _barWidth) / 2;
712
+ let barTotalValue = 0;
713
+ const barsToDisplay = singleChartData.chartData.filter((point)=>point.data > 0);
714
+ if (!barsToDisplay.length) {
715
+ return undefined;
716
+ }
717
+ const { gapHeight, heightValueScale, adjustedTotalHeight } = _getBarGapAndScale(barsToDisplay, yBarScale);
718
+ if (heightValueScale < 0) {
719
+ return undefined;
720
+ }
721
+ const singleBar = barsToDisplay.map((point, index)=>{
722
+ const startColor = point.color ? point.color : _colors[index];
723
+ const ref = {};
724
+ const shouldHighlight = _isLegendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
725
+ const rectFocusProps = !shouldFocusWholeStack && {
726
+ 'data-is-focusable': !props.hideTooltip && shouldHighlight,
727
+ 'aria-label': _getAriaLabel(singleChartData, point),
728
+ onMouseOver: (event)=>_onRectHover(singleChartData.xAxisPoint, point, startColor, event),
729
+ onMouseMove: (event)=>_onRectHover(singleChartData.xAxisPoint, point, startColor, event),
730
+ onMouseLeave: _handleMouseOut,
731
+ onFocus: ()=>_onRectFocus(point, singleChartData.xAxisPoint, startColor, ref),
732
+ onBlur: _handleMouseOut,
733
+ onClick: (event)=>_onClick(point, event),
734
+ role: 'img'
735
+ };
736
+ let barHeight = heightValueScale * point.data;
737
+ if (barHeight < Math.max(heightValueScale * adjustedTotalHeight / 100.0, barMinimumHeight)) {
738
+ barHeight = Math.max(heightValueScale * adjustedTotalHeight / 100.0, barMinimumHeight);
739
+ }
740
+ yPoint = yPoint - barHeight - (index ? gapHeight : 0);
741
+ barTotalValue += point.data;
742
+ if (barCornerRadius && barHeight > barCornerRadius && index === barsToDisplay.length - 1) {
743
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, {
744
+ key: index + indexNumber + `${shouldFocusWholeStack}`
745
+ }, /*#__PURE__*/ _react.createElement("path", {
746
+ className: classes.opacityChangeOnHover,
747
+ d: `
748
+ M ${xPoint} ${yPoint + barCornerRadius}
749
+ a ${barCornerRadius} ${barCornerRadius} 0 0 1 ${barCornerRadius} ${-barCornerRadius}
750
+ h ${_barWidth - 2 * barCornerRadius}
751
+ a ${barCornerRadius} ${barCornerRadius} 0 0 1 ${barCornerRadius} ${barCornerRadius}
752
+ v ${barHeight - barCornerRadius}
753
+ h ${-_barWidth}
754
+ z
755
+ `,
756
+ fill: startColor,
757
+ rx: props.roundCorners ? 3 : 0,
758
+ ref: (e)=>ref.refElement = e,
759
+ transform: `translate(${xScaleBandwidthTranslate}, 0)`,
760
+ cursor: props.href ? 'pointer' : 'default',
761
+ ...rectFocusProps
762
+ }));
763
+ }
764
+ if (barHeight < 0) {
765
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, {
766
+ key: index + indexNumber
767
+ }, " ");
768
+ }
769
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, {
770
+ key: index + indexNumber
771
+ }, /*#__PURE__*/ _react.createElement("rect", {
772
+ className: classes.opacityChangeOnHover,
773
+ x: xPoint,
774
+ y: yPoint,
775
+ width: _barWidth,
776
+ height: barHeight,
777
+ fill: startColor,
778
+ opacity: shouldHighlight ? 1 : 0.1,
779
+ cursor: props.href ? 'pointer' : 'default',
780
+ rx: props.roundCorners ? 3 : 0,
781
+ ref: (e)=>ref.refElement = e,
782
+ ...rectFocusProps,
783
+ transform: `translate(${xScaleBandwidthTranslate}, 0)`
784
+ }));
785
+ });
786
+ const groupRef = {};
787
+ const stackFocusProps = shouldFocusWholeStack && {
788
+ 'data-is-focusable': !props.hideTooltip,
789
+ 'aria-label': _getAriaLabel(singleChartData),
790
+ onMouseOver: (event)=>_onStackHover(singleChartData, event),
791
+ onMouseMove: (event)=>_onStackHover(singleChartData, event),
792
+ onMouseLeave: _handleMouseOut,
793
+ onFocus: ()=>_onStackFocus(singleChartData, groupRef),
794
+ onBlur: _handleMouseOut,
795
+ onClick: (event)=>_onClick(singleChartData, event),
796
+ role: 'img'
797
+ };
798
+ let showLabel = false;
799
+ let barLabel = 0;
800
+ if (!props.hideLabels) {
801
+ if (_noLegendHighlighted()) {
802
+ showLabel = true;
803
+ barLabel = barTotalValue;
804
+ } else {
805
+ barsToDisplay.forEach((point)=>{
806
+ if (_isLegendHighlighted(point.legend)) {
807
+ showLabel = true;
808
+ barLabel += point.data;
809
+ }
810
+ });
811
+ }
812
+ }
813
+ return /*#__PURE__*/ _react.createElement("g", {
814
+ key: indexNumber + `${shouldFocusWholeStack}`
815
+ }, /*#__PURE__*/ _react.createElement("g", {
816
+ id: `${indexNumber}-singleBar`,
817
+ ref: (e)=>groupRef.refElement = e,
818
+ ...stackFocusProps,
819
+ tabIndex: !props.hideTooltip ? 0 : undefined
820
+ }, singleBar), !props.hideLabels && _barWidth >= 16 && showLabel && /*#__PURE__*/ _react.createElement("text", {
821
+ x: xPoint + _barWidth / 2,
822
+ y: yPoint - 6,
823
+ textAnchor: "middle",
824
+ className: classes.barLabel,
825
+ "aria-label": `Total: ${barLabel}`,
826
+ role: "img",
827
+ transform: `translate(${xScaleBandwidthTranslate}, 0)`
828
+ }, (0, _index1.formatValueWithSIPrefix)(barLabel)));
829
+ });
830
+ if (!props.showXAxisLablesTooltip) {
831
+ try {
832
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
833
+ // eslint-disable-next-line no-empty
834
+ } catch (e) {}
835
+ }
836
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
837
+ const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
838
+ try {
839
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
840
+ // eslint-disable-next-line no-empty
841
+ } catch (e) {}
842
+ const tooltipProps = {
843
+ tooltipCls: classes.tooltip,
844
+ id: _tooltipId,
845
+ xAxis: xAxisElement
846
+ };
847
+ xAxisElement && (0, _index1.tooltipOfXAxislabels)(tooltipProps);
848
+ }
849
+ return bars.filter((bar)=>!!bar);
850
+ }
851
+ if (!_isChartEmpty()) {
852
+ _adjustProps();
853
+ const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
854
+ const shouldFocusWholeStack = _toFocusWholeStack(_isHavingLines);
855
+ _dataset = _createDataSetLayer();
856
+ const legendBars = _getLegendData(_points, _createLegendsForLine(props.data));
857
+ const calloutProps = {
858
+ color: color,
859
+ legend: calloutLegend,
860
+ XValue: xCalloutValue,
861
+ YValue: yCalloutValue ? yCalloutValue : dataForHoverCard,
862
+ YValueHover: YValueHover,
863
+ hoverXValue: hoverXValue,
864
+ ...props.calloutProps,
865
+ ...(0, _index1.getAccessibleDataObject)(callOutAccessibilityData),
866
+ clickPosition: clickPosition,
867
+ isPopoverOpen: isPopoverOpen,
868
+ isCalloutForStack: props.isCalloutForStack || _isHavingLines && (_noLegendHighlighted() || _getHighlightedLegend().length > 1),
869
+ isCartesian: true,
870
+ customCallout: {
871
+ customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,
872
+ customCalloutProps: props.calloutPropsPerDataPoint ? props.calloutPropsPerDataPoint(dataPointCalloutProps) : undefined
873
+ }
874
+ };
875
+ const tickParams = {
876
+ tickValues: props.tickValues,
877
+ tickFormat: props.tickFormat
878
+ };
879
+ return /*#__PURE__*/ _react.createElement(_index.CartesianChart, {
880
+ ...props,
881
+ chartTitle: _getChartTitle(),
882
+ points: _dataset,
883
+ chartType: _index1.ChartTypes.VerticalStackedBarChart,
884
+ xAxisType: _xAxisType,
885
+ calloutProps: calloutProps,
886
+ tickParams: tickParams,
887
+ legendBars: legendBars,
888
+ datasetForXAxisDomain: _xAxisLabels,
889
+ isCalloutForStack: shouldFocusWholeStack,
890
+ barwidth: _barWidth,
891
+ getmargins: _getMargins,
892
+ getGraphData: _getGraphData,
893
+ getAxisData: _getAxisData,
894
+ onChartMouseLeave: _handleChartMouseLeave,
895
+ getDomainMargins: _getDomainMargins,
896
+ ..._xAxisType === _index1.XAxisTypes.StringAxis && {
897
+ xAxisInnerPadding: _xAxisInnerPadding,
898
+ xAxisOuterPadding: _xAxisOuterPadding
899
+ },
900
+ componentRef: cartesianChartRef,
901
+ /* eslint-disable react/jsx-no-bind */ children: (props)=>{
902
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("g", null, _bars), /*#__PURE__*/ _react.createElement("g", null, _isHavingLines && _createLines(props.xScale, props.yScale, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
903
+ }
904
+ });
905
+ }
906
+ return /*#__PURE__*/ _react.createElement("div", {
907
+ id: _emptyChartId,
908
+ role: 'alert',
909
+ style: {
910
+ opacity: '0'
911
+ },
912
+ "aria-label": 'Graph has no data to display'
913
+ });
914
+ };
915
+ VerticalStackedBarChart.displayName = 'VerticalStackedBarChart';