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