@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,928 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "VerticalBarChart", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return VerticalBarChart;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _useVerticalBarChartStylesstyles = require("./useVerticalBarChartStyles.styles");
14
+ const _d3array = require("d3-array");
15
+ const _d3shape = require("d3-shape");
16
+ const _d3selection = require("d3-selection");
17
+ const _d3scale = require("d3-scale");
18
+ const _reactutilities = require("@fluentui/react-utilities");
19
+ const _reacttheme = require("@fluentui/react-theme");
20
+ const _index = require("../../index");
21
+ const _index1 = require("../../utilities/index");
22
+ var CircleVisbility;
23
+ (function(CircleVisbility) {
24
+ CircleVisbility["show"] = "visibility";
25
+ CircleVisbility["hide"] = "hidden";
26
+ })(CircleVisbility || (CircleVisbility = {}));
27
+ const MIN_DOMAIN_MARGIN = 8;
28
+ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
29
+ var _props_legendProps;
30
+ let _points = [];
31
+ let _barWidth = 0;
32
+ let _colors;
33
+ const _refArray = [];
34
+ let margins;
35
+ const _useRtl = (0, _index1.useRtl)();
36
+ let _bars;
37
+ let _xAxisLabels;
38
+ let _yMax;
39
+ let _yMin;
40
+ let _isHavingLine = _checkForLine();
41
+ const _tooltipId = (0, _reactutilities.useId)('VCTooltipID_');
42
+ const _xAxisType = props.data && props.data.length > 0 ? (0, _index1.getTypeOfAxis)(props.data[0].x, true) : _index1.XAxisTypes.StringAxis;
43
+ let _calloutAnchorPoint;
44
+ let _domainMargin;
45
+ const _emptyChartId = (0, _reactutilities.useId)('_VBC_empty');
46
+ const _vbcLineId = (0, _reactutilities.useId)('_VBC_line_');
47
+ const _vbcPointId = (0, _reactutilities.useId)('_VBC_point_');
48
+ const _vbcBarId = (0, _reactutilities.useId)('_VBC_bar_');
49
+ let _xAxisInnerPadding = 0;
50
+ let _xAxisOuterPadding = 0;
51
+ const cartesianChartRef = _react.useRef(null);
52
+ const [color, setColor] = _react.useState('');
53
+ const [dataForHoverCard, setDataForHoverCard] = _react.useState(0);
54
+ const [activeLegend, setActiveLegend] = _react.useState(undefined);
55
+ const [xCalloutValue, setXCalloutValue] = _react.useState('');
56
+ const [yCalloutValue, setYCalloutValue] = _react.useState('');
57
+ const [activeXdataPoint, setActiveXDatapoint] = _react.useState(null);
58
+ const [hoveredYValues, setYValueHover] = _react.useState();
59
+ const [hoverXValue, setHoverXValue] = _react.useState('');
60
+ const [calloutLegend, setCalloutLegend] = _react.useState('');
61
+ const [callOutAccessibilityData, setCalloutAccessibilityData] = _react.useState();
62
+ const [dataPointCalloutProps, setDataPointCalloutProps] = _react.useState();
63
+ const [clickPosition, setClickPosition] = _react.useState({
64
+ x: 0,
65
+ y: 0
66
+ });
67
+ const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
68
+ const [selectedLegends, setSelectedLegends] = _react.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
69
+ const prevPropsRef = _react.useRef(null);
70
+ _react.useImperativeHandle(props.componentRef, ()=>{
71
+ var _cartesianChartRef_current;
72
+ var _cartesianChartRef_current_chartContainer;
73
+ return {
74
+ 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
75
+ };
76
+ }, []);
77
+ _react.useEffect(()=>{
78
+ if (prevPropsRef.current) {
79
+ var _prevProps_legendProps, _props_legendProps;
80
+ const prevProps = prevPropsRef.current;
81
+ 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)) {
82
+ var _props_legendProps1;
83
+ setSelectedLegends(((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.selectedLegends) || []);
84
+ }
85
+ if (prevProps.height !== props.height || prevProps.width !== props.width) {
86
+ _adjustProps();
87
+ }
88
+ }
89
+ prevPropsRef.current = props;
90
+ }, [
91
+ props,
92
+ prevPropsRef,
93
+ _adjustProps
94
+ ]);
95
+ function _createLine(xScale, yScale, containerHeight = 0, containerWidth = 0, yScaleSecondary) {
96
+ var _props_lineOptions;
97
+ const isStringAxis = _xAxisType === _index1.XAxisTypes.StringAxis;
98
+ const colorScale = _createColors();
99
+ const { data, lineLegendColor = _reacttheme.tokens.colorPaletteYellowBackground1, lineLegendText } = props;
100
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
+ const lineData = [];
102
+ const line = [];
103
+ data && data.forEach((item, index)=>{
104
+ if (item.lineData && item.lineData.y) {
105
+ var _item_lineData_useSecondaryYScale;
106
+ lineData.push({
107
+ x: item.x,
108
+ y: item.lineData.y,
109
+ useSecondaryYScale: (_item_lineData_useSecondaryYScale = item.lineData.useSecondaryYScale) !== null && _item_lineData_useSecondaryYScale !== void 0 ? _item_lineData_useSecondaryYScale : false,
110
+ point: item,
111
+ index
112
+ });
113
+ }
114
+ });
115
+ const linePath = (0, _d3shape.line)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
+ .x((d)=>isStringAxis ? xScale(d.x) + 0.5 * xScale.bandwidth() : xScale(d.x)) // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
+ .y((d)=>d.useSecondaryYScale && yScaleSecondary ? yScaleSecondary(d.y) : yScale(d.y));
118
+ const shouldHighlight = _legendHighlighted(lineLegendText) || _noLegendHighlighted() ? true : false;
119
+ const lineBorderWidth = ((_props_lineOptions = props.lineOptions) === null || _props_lineOptions === void 0 ? void 0 : _props_lineOptions.lineBorderWidth) ? Number.parseFloat(props.lineOptions.lineBorderWidth.toString()) : 0;
120
+ if (lineBorderWidth > 0) {
121
+ line.push(/*#__PURE__*/ _react.createElement("path", {
122
+ key: _vbcLineId,
123
+ id: _vbcLineId,
124
+ opacity: shouldHighlight ? 1 : 0.1,
125
+ d: linePath(lineData),
126
+ fill: "transparent",
127
+ strokeLinecap: "square",
128
+ strokeWidth: 3 + lineBorderWidth * 2,
129
+ stroke: _reacttheme.tokens.colorNeutralBackground1
130
+ }));
131
+ }
132
+ line.push(/*#__PURE__*/ _react.createElement("path", {
133
+ key: _vbcLineId,
134
+ id: _vbcLineId,
135
+ opacity: shouldHighlight ? 1 : 0.1,
136
+ d: linePath(lineData),
137
+ fill: "transparent",
138
+ strokeLinecap: "square",
139
+ strokeWidth: 3,
140
+ stroke: lineLegendColor
141
+ }));
142
+ const dots = lineData.map((item, index)=>{
143
+ var _item_point_lineData;
144
+ // Create an object to store line point ref so that the object can be passed by reference to the focus handler
145
+ const circleRef = {
146
+ refElement: null
147
+ };
148
+ return /*#__PURE__*/ _react.createElement("circle", {
149
+ key: index,
150
+ id: `${_vbcPointId}-${index}`,
151
+ cx: isStringAxis ? xScale(item.x) + 0.5 * xScale.bandwidth() : xScale(item.x),
152
+ cy: item.useSecondaryYScale && yScaleSecondary ? yScaleSecondary(item.y) : yScale(item.y),
153
+ onMouseOver: (event)=>_legendHighlighted(lineLegendText) ? _lineHover(item.point, event) : _onBarHover(item.point, colorScale(item.y), event),
154
+ onMouseOut: _onBarLeave,
155
+ r: _getCircleVisibilityAndRadius(item.x, lineLegendText).radius,
156
+ stroke: lineLegendColor,
157
+ fill: _reacttheme.tokens.colorNeutralBackground1,
158
+ strokeWidth: 3,
159
+ visibility: _getCircleVisibilityAndRadius(item.x, lineLegendText).visibility,
160
+ onClick: (_item_point_lineData = item.point.lineData) === null || _item_point_lineData === void 0 ? void 0 : _item_point_lineData.onClick,
161
+ // When no legend is highlighted: Line points are automatically displayed along with the bars
162
+ // at the same x-axis point in the stack callout. So to prevent an increase in focusable elements
163
+ // and avoid conveying duplicate info, make these line points non-focusable.
164
+ "data-is-focusable": _legendHighlighted(lineLegendText),
165
+ ref: (e)=>circleRef.refElement = e,
166
+ onFocus: _lineFocus.bind(item.point, circleRef),
167
+ onBlur: _handleChartMouseLeave
168
+ });
169
+ });
170
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, line, dots);
171
+ }
172
+ function _getCircleVisibilityAndRadius(xAxisPoint, legend) {
173
+ if (!_noLegendHighlighted()) {
174
+ if (xAxisPoint === activeXdataPoint && _legendHighlighted(legend)) {
175
+ return {
176
+ visibility: "visibility",
177
+ radius: 8
178
+ };
179
+ } else if (_legendHighlighted(legend)) {
180
+ // Don't hide the circle to keep it focusable. For more information,
181
+ // see https://fuzzbomb.github.io/accessibility-demos/visually-hidden-focus-test.html
182
+ return {
183
+ visibility: "visibility",
184
+ radius: 0.3
185
+ };
186
+ } else {
187
+ return {
188
+ visibility: "hidden",
189
+ radius: 0
190
+ };
191
+ }
192
+ } else {
193
+ return {
194
+ visibility: activeXdataPoint === xAxisPoint ? "visibility" : "hidden",
195
+ radius: 8
196
+ };
197
+ }
198
+ }
199
+ function _checkForLine() {
200
+ const { data } = props;
201
+ return data.some((item)=>{
202
+ var _item_lineData;
203
+ return (item === null || item === void 0 ? void 0 : (_item_lineData = item.lineData) === null || _item_lineData === void 0 ? void 0 : _item_lineData.y) !== undefined;
204
+ });
205
+ }
206
+ function _adjustProps() {
207
+ _points = props.data || [];
208
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth);
209
+ const defaultColors = [
210
+ _reacttheme.tokens.colorPaletteBlueForeground2,
211
+ _reacttheme.tokens.colorPaletteCornflowerForeground2,
212
+ _reacttheme.tokens.colorPaletteDarkGreenForeground2,
213
+ _reacttheme.tokens.colorPaletteNavyForeground2,
214
+ _reacttheme.tokens.colorPaletteDarkOrangeForeground2
215
+ ];
216
+ _colors = props.colors || defaultColors;
217
+ _isHavingLine = _checkForLine();
218
+ _xAxisInnerPadding = (0, _index1.getScalePadding)(props.xAxisInnerPadding, props.xAxisPadding, 2 / 3);
219
+ _xAxisOuterPadding = (0, _index1.getScalePadding)(props.xAxisOuterPadding, props.xAxisPadding, 0);
220
+ }
221
+ function _getMargins(_margins) {
222
+ margins = _margins;
223
+ }
224
+ function _renderContentForBothLineAndBars(point) {
225
+ // eslint-disable-next-line @typescript-eslint/no-shadow
226
+ const { YValueHover, hoverXValue } = _getCalloutContentForLineAndBar(point);
227
+ const content = YValueHover.map((item, index)=>{
228
+ var _props_culture;
229
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_index.ChartPopover, {
230
+ culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
231
+ clickPosition: clickPosition,
232
+ isPopoverOpen: isPopoverOpen,
233
+ legend: item.legend,
234
+ ...index === 0 && {
235
+ XValue: `${hoverXValue || item.data}`
236
+ },
237
+ YValue: item.data || item.y,
238
+ color: item.color,
239
+ isCalloutForStack: false
240
+ }));
241
+ });
242
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, content);
243
+ }
244
+ function _renderContentForOnlyBars(_props) {
245
+ var _props_culture;
246
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(_index.ChartPopover, {
247
+ XValue: _props.xAxisCalloutData || _props.x,
248
+ xCalloutValue: xCalloutValue,
249
+ yCalloutValue: yCalloutValue,
250
+ culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
251
+ clickPosition: clickPosition,
252
+ isPopoverOpen: isPopoverOpen,
253
+ legend: _props.legend,
254
+ YValue: _props.yAxisCalloutData || _props.y,
255
+ color: !props.useSingleColor && _props.color ? _props.color : _createColors()(_props.y),
256
+ isCalloutForStack: false
257
+ }));
258
+ }
259
+ // eslint-disable-next-line @typescript-eslint/no-shadow
260
+ function _renderCallout(props) {
261
+ return props ? _isHavingLine ? _renderContentForBothLineAndBars(props) : _renderContentForOnlyBars(props) : null;
262
+ }
263
+ function _getCustomizedCallout() {
264
+ return props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps, _renderCallout) : null;
265
+ }
266
+ function _getGraphData(xScale, yScale, containerHeight, containerWidth, xElement) {
267
+ return _bars = _xAxisType === _index1.XAxisTypes.NumericAxis ? _createNumericBars(containerHeight, containerWidth, xElement) : _xAxisType === _index1.XAxisTypes.DateAxis ? _createDateBars(containerHeight, containerWidth, xElement) : _createStringBars(containerHeight, containerWidth, xElement);
268
+ }
269
+ function _createColors() {
270
+ const increment = _colors.length <= 1 ? 1 : 1 / (_colors.length - 1);
271
+ const { useSingleColor = false } = props;
272
+ if (useSingleColor) {
273
+ return (_p)=>{
274
+ const { colors } = props;
275
+ return colors && colors.length > 0 ? colors[0] : _reacttheme.tokens.colorPaletteBlueBackground2;
276
+ };
277
+ }
278
+ const domainValues = [];
279
+ for(let i = 0; i < _colors.length; i++){
280
+ domainValues.push(increment * i * _yMax);
281
+ }
282
+ const colorScale = (0, _d3scale.scaleLinear)().domain(domainValues).range(_colors);
283
+ return colorScale;
284
+ }
285
+ function _refCallback(element, legendTitle) {
286
+ _refArray.push({
287
+ index: legendTitle,
288
+ refElement: element
289
+ });
290
+ }
291
+ function _getCalloutContentForLineAndBar(point) {
292
+ var _selectedPoint__lineData;
293
+ // eslint-disable-next-line @typescript-eslint/no-shadow
294
+ const YValueHover = [];
295
+ const { useSingleColor = false } = props;
296
+ const { data, lineLegendText, lineLegendColor = _reacttheme.tokens.colorPaletteYellowBackground1 } = props;
297
+ const selectedPoint = data.filter((xDataPoint)=>xDataPoint.x === point.x);
298
+ // Check if the line legend is highlighted or no legend is highlighted
299
+ if (_isHavingLine && ((_selectedPoint__lineData = selectedPoint[0].lineData) === null || _selectedPoint__lineData === void 0 ? void 0 : _selectedPoint__lineData.y) !== undefined && (_legendHighlighted(lineLegendText) || _noLegendHighlighted())) {
300
+ var _selectedPoint__lineData1, _selectedPoint__lineData2, _selectedPoint__lineData3;
301
+ // Add callout data for the line
302
+ YValueHover.push({
303
+ legend: lineLegendText,
304
+ color: lineLegendColor,
305
+ y: (_selectedPoint__lineData1 = selectedPoint[0].lineData) === null || _selectedPoint__lineData1 === void 0 ? void 0 : _selectedPoint__lineData1.y,
306
+ data: (_selectedPoint__lineData2 = selectedPoint[0].lineData) === null || _selectedPoint__lineData2 === void 0 ? void 0 : _selectedPoint__lineData2.yAxisCalloutData,
307
+ yAxisCalloutData: (_selectedPoint__lineData3 = selectedPoint[0].lineData) === null || _selectedPoint__lineData3 === void 0 ? void 0 : _selectedPoint__lineData3.yAxisCalloutData
308
+ });
309
+ }
310
+ // Check if the bar legend is highlighted or no legend is highlighted
311
+ if (selectedPoint[0].legend && (selectedLegends.includes(selectedPoint[0].legend) || _noLegendHighlighted())) {
312
+ // Add callout data for the bar
313
+ YValueHover.push({
314
+ legend: selectedPoint[0].legend,
315
+ y: selectedPoint[0].y,
316
+ color: !useSingleColor ? selectedPoint[0].color ? selectedPoint[0].color : _createColors()(selectedPoint[0].y) : _createColors()(1),
317
+ data: selectedPoint[0].yAxisCalloutData,
318
+ yAxisCalloutData: selectedPoint[0].yAxisCalloutData
319
+ });
320
+ }
321
+ // eslint-disable-next-line @typescript-eslint/no-shadow
322
+ const hoverXValue = point.x instanceof Date ? point.x.toLocaleString() : point.x.toString();
323
+ return {
324
+ YValueHover,
325
+ hoverXValue: point.xAxisCalloutData || hoverXValue
326
+ };
327
+ }
328
+ function _onBarHover(point, color, mouseEvent) {
329
+ mouseEvent.persist();
330
+ // eslint-disable-next-line @typescript-eslint/no-shadow
331
+ const { YValueHover, hoverXValue } = _getCalloutContentForLineAndBar(point);
332
+ if (_calloutAnchorPoint !== point) {
333
+ _calloutAnchorPoint = point;
334
+ /** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
335
+ setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(point.legend));
336
+ setDataForHoverCard(point.y);
337
+ setCalloutLegend(point.legend);
338
+ setColor(point.color || color);
339
+ // To display callout value, if no callout value given, taking given point.x value as a string.
340
+ setXCalloutValue(point.xAxisCalloutData || (point.x instanceof Date ? point.x.toLocaleDateString() : point.x.toString()));
341
+ setDataPointCalloutProps(point);
342
+ // Hovering over a bar should highlight corresponding line points only when no legend is selected
343
+ setActiveXDatapoint(_noLegendHighlighted() ? point.x : null);
344
+ setYValueHover(YValueHover);
345
+ setHoverXValue(hoverXValue);
346
+ setCalloutAccessibilityData(point.callOutAccessibilityData);
347
+ }
348
+ }
349
+ function _onBarLeave() {
350
+ /**/ }
351
+ function _handleChartMouseLeave() {
352
+ _calloutAnchorPoint = null;
353
+ setPopoverOpen(false);
354
+ setActiveXDatapoint(null);
355
+ setYValueHover([]);
356
+ setHoverXValue('');
357
+ }
358
+ // eslint-disable-next-line @typescript-eslint/no-shadow
359
+ function _onBarFocus(point, refArrayIndexNumber, color) {
360
+ // eslint-disable-next-line @typescript-eslint/no-shadow
361
+ const { YValueHover, hoverXValue } = _getCalloutContentForLineAndBar(point);
362
+ _refArray.forEach((obj, index)=>{
363
+ if (obj.index === point.legend && refArrayIndexNumber === index) {
364
+ /** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */ setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(point.legend));
365
+ setDataForHoverCard(point.y);
366
+ setCalloutLegend(point.legend);
367
+ setColor(point.color || color);
368
+ // To display callout value, if no callout value given, taking given point.x value as a string.
369
+ setXCalloutValue(point.xAxisCalloutData || (point.x instanceof Date ? point.x.toLocaleDateString() : point.x.toString()));
370
+ setYCalloutValue(point.yAxisCalloutData);
371
+ setDataPointCalloutProps(point);
372
+ // Hovering over a bar should highlight corresponding line points only when no legend is selected
373
+ setActiveXDatapoint(point.x);
374
+ setYValueHover(YValueHover);
375
+ setHoverXValue(hoverXValue);
376
+ setCalloutAccessibilityData(point.callOutAccessibilityData);
377
+ }
378
+ });
379
+ }
380
+ function _lineHover(point, mouseEvent) {
381
+ mouseEvent.persist();
382
+ _lineHoverFocus(point, mouseEvent);
383
+ }
384
+ function _lineFocus(point, ref) {
385
+ if (ref.refElement) {
386
+ _lineHoverFocus(point, ref.refElement);
387
+ }
388
+ }
389
+ function _lineHoverFocus(point, _refSelected) {
390
+ const { lineLegendText = '', lineLegendColor = _reacttheme.tokens.colorPaletteYellowBackground1 } = props;
391
+ setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(lineLegendText));
392
+ setCalloutLegend(lineLegendText);
393
+ setDataForHoverCard(point.lineData.y);
394
+ setColor(lineLegendColor);
395
+ setXCalloutValue(point.xAxisCalloutData || (point.x instanceof Date ? point.x.toLocaleDateString() : point.x.toString()));
396
+ setYCalloutValue(point.lineData.yAxisCalloutData);
397
+ setDataPointCalloutProps(point);
398
+ setActiveXDatapoint(point.x);
399
+ }
400
+ function _getScales(containerHeight, containerWidth) {
401
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
402
+ let xBarScale;
403
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
404
+ const yBarScale = (0, _d3scale.scaleLinear)().domain([
405
+ _yMin,
406
+ _yMax
407
+ ]).range([
408
+ 0,
409
+ containerHeight - margins.bottom - margins.top
410
+ ]);
411
+ if (_xAxisType === _index1.XAxisTypes.NumericAxis) {
412
+ const xMax = (0, _d3array.max)(_points, (point)=>point.x);
413
+ const xMin = (0, _d3array.min)(_points, (point)=>point.x);
414
+ xBarScale = (0, _d3scale.scaleLinear)().domain(_useRtl ? [
415
+ xMax,
416
+ xMin
417
+ ] : [
418
+ xMin,
419
+ xMax
420
+ ]).nice().range([
421
+ margins.left + _domainMargin,
422
+ containerWidth - margins.right - _domainMargin
423
+ ]);
424
+ } else if (_xAxisType === _index1.XAxisTypes.DateAxis) {
425
+ const sDate = (0, _d3array.min)(_points, (point)=>point.x);
426
+ const lDate = (0, _d3array.max)(_points, (point)=>point.x);
427
+ xBarScale = (0, _d3scale.scaleUtc)().domain([
428
+ sDate,
429
+ lDate
430
+ ]).range(_useRtl ? [
431
+ containerWidth - margins.right - _domainMargin,
432
+ margins.left + _domainMargin
433
+ ] : [
434
+ margins.left + _domainMargin,
435
+ containerWidth - margins.right - _domainMargin
436
+ ]);
437
+ } else {
438
+ xBarScale = (0, _d3scale.scaleBand)().domain(_xAxisLabels).range(_useRtl ? [
439
+ containerWidth - margins.right - _domainMargin,
440
+ margins.left + _domainMargin
441
+ ] : [
442
+ margins.left + _domainMargin,
443
+ containerWidth - margins.right - _domainMargin
444
+ ]).paddingInner(_xAxisInnerPadding).paddingOuter(_xAxisOuterPadding);
445
+ }
446
+ return {
447
+ xBarScale,
448
+ yBarScale
449
+ };
450
+ }
451
+ const classes = (0, _useVerticalBarChartStylesstyles.useVerticalBarChartStyles)(props);
452
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
453
+ function _calculateMinBarHeight(yMin, yMax, yReferencePoint, yBarScale) {
454
+ const maxHeightFromBaseline = yMax < 0 ? Math.abs(yMin - yReferencePoint) : Math.max(Math.abs(yMax - yReferencePoint), Math.abs(yMin - yReferencePoint));
455
+ return Math.ceil(yBarScale(maxHeightFromBaseline) / 100.0);
456
+ }
457
+ function _createNumericBars(containerHeight, containerWidth, xElement) {
458
+ const { useSingleColor = false } = props;
459
+ const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
460
+ const colorScale = _createColors();
461
+ const yReferencePoint = _yMax < 0 ? _yMax : 0;
462
+ const bars = _points.map((point, index)=>{
463
+ const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
464
+ let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
465
+ const isHeightNegative = barHeight < 0;
466
+ barHeight = Math.abs(barHeight);
467
+ // Calculate threshold for minimum visible bar height
468
+ const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
469
+ let adjustedBarHeight = barHeight;
470
+ if (barHeight === 0) {
471
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, {
472
+ key: point.x
473
+ }, " ");
474
+ } else if (barHeight <= minBarHeight) {
475
+ adjustedBarHeight = minBarHeight;
476
+ }
477
+ const xPoint = xBarScale(point.x) - _barWidth / 2;
478
+ const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
479
+ const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
480
+ return /*#__PURE__*/ _react.createElement("g", {
481
+ key: `${point.x}_${index}`
482
+ }, /*#__PURE__*/ _react.createElement("rect", {
483
+ id: `${_vbcBarId}-${index}`,
484
+ x: xPoint,
485
+ y: !isHeightNegative ? yPoint : baselineHeight,
486
+ width: _barWidth,
487
+ "data-is-focusable": !props.hideTooltip && shouldHighlight,
488
+ height: adjustedBarHeight,
489
+ ref: (e)=>{
490
+ _refCallback(e, point.legend);
491
+ },
492
+ onClick: point.onClick,
493
+ onMouseOver: (event)=>_onBarHover(point, colorScale(point.y), event),
494
+ "aria-label": _getAriaLabel(point),
495
+ role: "img",
496
+ onMouseLeave: _onBarLeave,
497
+ onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
498
+ onBlur: _onBarLeave,
499
+ fill: point.color && !useSingleColor ? point.color : colorScale(point.y),
500
+ tabIndex: point.legend !== '' ? 0 : undefined,
501
+ opacity: shouldHighlight ? 1 : 0.1,
502
+ rx: props.roundCorners ? 3 : 0
503
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
504
+ });
505
+ // Removing un wanted tooltip div from DOM, when prop not provided.
506
+ if (!props.showXAxisLablesTooltip) {
507
+ try {
508
+ // eslint-disable-next-line no-restricted-globals
509
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
510
+ // eslint-disable-next-line no-empty
511
+ } catch (e) {}
512
+ }
513
+ // Used to display tooltip at x axis labels.
514
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
515
+ const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
516
+ try {
517
+ // eslint-disable-next-line no-restricted-globals
518
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
519
+ // eslint-disable-next-line no-empty
520
+ } catch (e) {}
521
+ const tooltipProps = {
522
+ tooltipCls: classes.tooltip,
523
+ id: _tooltipId,
524
+ xAxis: xAxisElement
525
+ };
526
+ xAxisElement && (0, _index1.tooltipOfXAxislabels)(tooltipProps);
527
+ }
528
+ return bars;
529
+ }
530
+ function _createStringBars(containerHeight, containerWidth, xElement) {
531
+ const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
532
+ const colorScale = _createColors();
533
+ const yReferencePoint = _yMax < 0 ? _yMax : 0;
534
+ const bars = _points.map((point, index)=>{
535
+ const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
536
+ let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
537
+ const isHeightNegative = barHeight < 0;
538
+ barHeight = Math.abs(barHeight);
539
+ // Calculate threshold for minimum visible bar height
540
+ const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
541
+ let adjustedBarHeight = barHeight;
542
+ if (barHeight === 0) {
543
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, {
544
+ key: point.x
545
+ }, " ");
546
+ } else if (barHeight <= minBarHeight) {
547
+ adjustedBarHeight = minBarHeight;
548
+ }
549
+ const xPoint = xBarScale(point.x);
550
+ const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
551
+ const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
552
+ // Setting the bar width here is safe because there are no dependencies earlier in the code
553
+ // that rely on the width of bars in vertical bar charts with string x-axis.
554
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth, xBarScale.bandwidth());
555
+ return /*#__PURE__*/ _react.createElement("g", {
556
+ key: point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`,
557
+ transform: `translate(${0.5 * (xBarScale.bandwidth() - _barWidth)}, 0)`
558
+ }, /*#__PURE__*/ _react.createElement("rect", {
559
+ id: `${_vbcBarId}-${index}`,
560
+ x: xPoint,
561
+ y: !isHeightNegative ? yPoint : baselineHeight,
562
+ width: _barWidth,
563
+ height: adjustedBarHeight,
564
+ "aria-label": _getAriaLabel(point),
565
+ role: "img",
566
+ ref: (e)=>{
567
+ _refCallback(e, point.legend);
568
+ },
569
+ onClick: point.onClick,
570
+ onMouseOver: (event)=>_onBarHover(point, colorScale(point.y), event),
571
+ onMouseLeave: _onBarLeave,
572
+ onBlur: _onBarLeave,
573
+ "data-is-focusable": !props.hideTooltip && shouldHighlight,
574
+ onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
575
+ fill: point.color ? point.color : colorScale(point.y),
576
+ tabIndex: point.legend !== '' ? 0 : undefined,
577
+ rx: props.roundCorners ? 3 : 0,
578
+ opacity: shouldHighlight ? 1 : 0.1
579
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
580
+ });
581
+ // Removing un wanted tooltip div from DOM, when prop not provided.
582
+ if (!props.showXAxisLablesTooltip) {
583
+ try {
584
+ // eslint-disable-next-line no-restricted-globals
585
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
586
+ // eslint-disable-next-line no-empty
587
+ } catch (e) {}
588
+ }
589
+ // Used to display tooltip at x axis labels.
590
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
591
+ const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
592
+ try {
593
+ // eslint-disable-next-line no-restricted-globals
594
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
595
+ // eslint-disable-next-line no-empty
596
+ } catch (e) {}
597
+ const tooltipProps = {
598
+ tooltipCls: classes.tooltip,
599
+ id: _tooltipId,
600
+ xAxis: xAxisElement,
601
+ showTooltip: props.showXAxisLablesTooltip
602
+ };
603
+ xAxisElement && (0, _index1.tooltipOfXAxislabels)(tooltipProps);
604
+ }
605
+ return bars;
606
+ }
607
+ function _createDateBars(containerHeight, containerWidth, xElement) {
608
+ const { useSingleColor = false } = props;
609
+ const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
610
+ const colorScale = _createColors();
611
+ const yReferencePoint = _yMax < 0 ? _yMax : 0;
612
+ const bars = _points.map((point, index)=>{
613
+ const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
614
+ let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
615
+ const isHeightNegative = barHeight < 0;
616
+ barHeight = Math.abs(barHeight);
617
+ // Calculate threshold for minimum visible bar height
618
+ const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
619
+ let adjustedBarHeight = barHeight;
620
+ if (barHeight === 0) {
621
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, {
622
+ key: point.x
623
+ }, " ");
624
+ } else if (barHeight <= minBarHeight) {
625
+ adjustedBarHeight = minBarHeight;
626
+ }
627
+ const xPoint = xBarScale(point.x) - _barWidth / 2;
628
+ const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
629
+ const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
630
+ return /*#__PURE__*/ _react.createElement("g", {
631
+ key: point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`
632
+ }, /*#__PURE__*/ _react.createElement("rect", {
633
+ id: `${_vbcBarId}-${index}`,
634
+ x: xPoint,
635
+ className: classes.opacityChangeOnHover,
636
+ y: !isHeightNegative ? yPoint : baselineHeight,
637
+ width: _barWidth,
638
+ "data-is-focusable": !props.hideTooltip && shouldHighlight,
639
+ height: adjustedBarHeight,
640
+ ref: (e)=>{
641
+ _refCallback(e, point.legend);
642
+ },
643
+ onClick: point.onClick,
644
+ onMouseOver: (event)=>_onBarHover(point, colorScale(point.y), event),
645
+ "aria-label": _getAriaLabel(point),
646
+ role: "img",
647
+ onMouseLeave: _onBarLeave,
648
+ onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
649
+ onBlur: _onBarLeave,
650
+ fill: point.color && !useSingleColor ? point.color : colorScale(point.y),
651
+ tabIndex: point.legend !== '' ? 0 : undefined,
652
+ rx: props.roundCorners ? 3 : 0,
653
+ opacity: shouldHighlight ? 1 : 0.1
654
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
655
+ });
656
+ // Removing un wanted tooltip div from DOM, when prop not provided.
657
+ if (!props.showXAxisLablesTooltip) {
658
+ try {
659
+ // eslint-disable-next-line no-restricted-globals
660
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
661
+ // eslint-disable-next-line no-empty
662
+ } catch (e) {}
663
+ }
664
+ // Used to display tooltip at x axis labels.
665
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
666
+ const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
667
+ try {
668
+ // eslint-disable-next-line no-restricted-globals
669
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
670
+ // eslint-disable-next-line no-empty
671
+ } catch (e) {}
672
+ const tooltipProps = {
673
+ tooltipCls: classes.tooltip,
674
+ id: _tooltipId,
675
+ xAxis: xAxisElement
676
+ };
677
+ xAxisElement && (0, _index1.tooltipOfXAxislabels)(tooltipProps);
678
+ }
679
+ return bars;
680
+ }
681
+ function _onLegendHover(legendTitle) {
682
+ setActiveLegend(legendTitle);
683
+ }
684
+ function _onLegendLeave() {
685
+ setActiveLegend(undefined);
686
+ }
687
+ function _getLegendData(data) {
688
+ const { useSingleColor } = props;
689
+ const { lineLegendText, lineLegendColor = _reacttheme.tokens.colorPaletteYellowForeground1 } = props;
690
+ const actions = [];
691
+ const mapLegendToColor = {};
692
+ data.forEach((point, _index)=>{
693
+ // eslint-disable-next-line @typescript-eslint/no-shadow
694
+ const color = !useSingleColor ? point.color : _createColors()(1);
695
+ mapLegendToColor[point.legend] = color;
696
+ });
697
+ Object.entries(mapLegendToColor).forEach(([legendTitle, color])=>{
698
+ // mapping data to the format Legends component needs
699
+ const legend = {
700
+ title: legendTitle,
701
+ color,
702
+ hoverAction: ()=>{
703
+ _handleChartMouseLeave();
704
+ _onLegendHover(legendTitle);
705
+ },
706
+ onMouseOutAction: ()=>{
707
+ _onLegendLeave();
708
+ }
709
+ };
710
+ actions.push(legend);
711
+ });
712
+ if (_isHavingLine && lineLegendText && lineLegendColor) {
713
+ const lineLegend = {
714
+ title: lineLegendText,
715
+ color: lineLegendColor,
716
+ hoverAction: ()=>{
717
+ _handleChartMouseLeave();
718
+ _onLegendHover(lineLegendText);
719
+ },
720
+ onMouseOutAction: ()=>{
721
+ _onLegendLeave();
722
+ },
723
+ isLineLegendInBarChart: true
724
+ };
725
+ actions.unshift(lineLegend);
726
+ }
727
+ const legends = /*#__PURE__*/ _react.createElement(_index.Legends, {
728
+ legends: actions,
729
+ enabledWrapLines: props.enabledLegendsWrapLines,
730
+ overflowText: props.legendsOverflowText,
731
+ ...props.legendProps,
732
+ selectedLegends: selectedLegends,
733
+ onChange: _onLegendSelectionChange
734
+ });
735
+ return legends;
736
+ }
737
+ function _onLegendSelectionChange(legendsSelected, event, currentLegend) {
738
+ var _props_legendProps, _props_legendProps1;
739
+ if ((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.canSelectMultipleLegends) {
740
+ setSelectedLegends(legendsSelected);
741
+ } else {
742
+ setSelectedLegends(legendsSelected.slice(-1));
743
+ }
744
+ if ((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.onChange) {
745
+ props.legendProps.onChange(legendsSelected, event, currentLegend);
746
+ }
747
+ }
748
+ function _getAxisData(yAxisData) {
749
+ if (yAxisData && yAxisData.yAxisDomainValues.length) {
750
+ const { yAxisDomainValues: domainValue } = yAxisData;
751
+ _yMax = Math.max(domainValue[domainValue.length - 1], props.yMaxValue || 0);
752
+ _yMin = Math.min(domainValue[0], props.yMinValue || 0);
753
+ }
754
+ }
755
+ /**
756
+ * This function checks if the given legend is highlighted or not.
757
+ * A legend can be highlighted in 2 ways:
758
+ * 1. selection: if the user clicks on it
759
+ * 2. hovering: if there is no selected legend and the user hovers over it
760
+ */ function _legendHighlighted(legendTitle) {
761
+ return _getHighlightedLegend().includes(legendTitle);
762
+ }
763
+ /**
764
+ * This function checks if none of the legends is selected or hovered.
765
+ */ function _noLegendHighlighted() {
766
+ return _getHighlightedLegend().length === 0;
767
+ }
768
+ function _getHighlightedLegend() {
769
+ return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [
770
+ activeLegend
771
+ ] : [];
772
+ }
773
+ function _getAriaLabel(point) {
774
+ var _point_lineData, _point_lineData1, _point_callOutAccessibilityData;
775
+ const xValue = point.xAxisCalloutData ? point.xAxisCalloutData : point.x instanceof Date ? point.x.toLocaleString() : point.x;
776
+ const legend = point.legend;
777
+ const yValue = point.yAxisCalloutData || point.y;
778
+ const lineLegend = props.lineLegendText || 'Line';
779
+ const lineYValue = ((_point_lineData = point.lineData) === null || _point_lineData === void 0 ? void 0 : _point_lineData.yAxisCalloutData) || ((_point_lineData1 = point.lineData) === null || _point_lineData1 === void 0 ? void 0 : _point_lineData1.y);
780
+ return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ` + (legend ? `${legend}, ` : '') + `${yValue}.` + (typeof lineYValue !== 'undefined' ? ` ${lineLegend}, ${lineYValue}.` : '');
781
+ }
782
+ function _renderBarLabel(xPoint, yPoint, barValue, legend, isNegativeBar) {
783
+ if (props.hideLabels || _barWidth < 16 || !(_legendHighlighted(legend) || _noLegendHighlighted())) {
784
+ return null;
785
+ }
786
+ return /*#__PURE__*/ _react.createElement("text", {
787
+ x: xPoint + _barWidth / 2,
788
+ y: isNegativeBar ? yPoint + 12 : yPoint - 6,
789
+ textAnchor: "middle",
790
+ className: classes.barLabel,
791
+ "aria-hidden": true
792
+ }, (0, _index1.formatValueWithSIPrefix)(barValue));
793
+ }
794
+ function _getDomainMargins(containerWidth) {
795
+ _domainMargin = MIN_DOMAIN_MARGIN;
796
+ /** Total width available to render the bars */ const totalWidth = containerWidth - (margins.left + MIN_DOMAIN_MARGIN) - (margins.right + MIN_DOMAIN_MARGIN);
797
+ /** Rate at which the space between the bars changes wrt the bar width */ const barGapRate = _xAxisInnerPadding / (1 - _xAxisInnerPadding);
798
+ if (_xAxisType === _index1.XAxisTypes.StringAxis) {
799
+ if ((0, _index1.isScalePaddingDefined)(props.xAxisOuterPadding, props.xAxisPadding)) {
800
+ // Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
801
+ // to adjust the space before the first bar and after the last bar.
802
+ _domainMargin = 0;
803
+ } else if (props.barWidth !== 'auto') {
804
+ // Update the bar width so that when CartesianChart rerenders,
805
+ // the following calculations don't use the previous bar width.
806
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth);
807
+ /** Total width required to render the bars. Directly proportional to bar width */ const reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * _barWidth;
808
+ if (totalWidth >= reqWidth) {
809
+ // Center align the chart by setting equal left and right margins for domain
810
+ _domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
811
+ }
812
+ } else if (props.mode === 'plotly' && _xAxisLabels.length > 1) {
813
+ // Calculate the remaining width after rendering bars at their maximum allowable width
814
+ const bandwidth = totalWidth / (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate);
815
+ const barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth, bandwidth);
816
+ let reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * barWidth;
817
+ const margin1 = (totalWidth - reqWidth) / 2;
818
+ // Calculate the remaining width after accounting for the space required to render x-axis labels
819
+ const step = (0, _index1.calculateLongestLabelWidth)(_xAxisLabels) + 20;
820
+ reqWidth = (_xAxisLabels.length - _xAxisInnerPadding) * step;
821
+ const margin2 = (totalWidth - reqWidth) / 2;
822
+ _domainMargin = MIN_DOMAIN_MARGIN + Math.max(0, Math.min(margin1, margin2));
823
+ }
824
+ } else {
825
+ var _props_data;
826
+ const uniqueX = {};
827
+ (_props_data = props.data) === null || _props_data === void 0 ? void 0 : _props_data.forEach((point)=>{
828
+ if (point.x instanceof Date) {
829
+ uniqueX[point.x.getTime()] = point.x;
830
+ } else {
831
+ uniqueX[point.x] = point.x;
832
+ }
833
+ });
834
+ const data = Object.values(uniqueX);
835
+ _barWidth = (0, _index1.getBarWidth)(props.barWidth, props.maxBarWidth, (0, _index1.calculateAppropriateBarWidth)(data, totalWidth));
836
+ _domainMargin = MIN_DOMAIN_MARGIN + _barWidth / 2;
837
+ }
838
+ return {
839
+ ...margins,
840
+ left: margins.left + _domainMargin,
841
+ right: margins.right + _domainMargin
842
+ };
843
+ }
844
+ function _isChartEmpty() {
845
+ return _points.length === 0 || _points.every((point)=>point.y === 0) && !_isHavingLine;
846
+ }
847
+ function updatePosition(newX, newY) {
848
+ const threshold = 1; // Set a threshold for movement
849
+ const { x, y } = clickPosition;
850
+ // Calculate the distance moved
851
+ const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
852
+ // Update the position only if the distance moved is greater than the threshold
853
+ if (distance > threshold) {
854
+ setClickPosition({
855
+ x: newX,
856
+ y: newY
857
+ });
858
+ setPopoverOpen(true);
859
+ }
860
+ }
861
+ _adjustProps();
862
+ _xAxisLabels = _points.map((point)=>point.x);
863
+ _yMax = Math.max((0, _d3array.max)(_points, (point)=>point.y), props.yMaxValue || 0);
864
+ _yMin = Math.min((0, _d3array.min)(_points, (point)=>point.y), props.yMinValue || 0);
865
+ const legendBars = _getLegendData(_points);
866
+ var _props_culture;
867
+ const calloutProps = {
868
+ ..._isHavingLine && {
869
+ YValueHover: hoveredYValues,
870
+ hoverXValue: hoverXValue
871
+ },
872
+ color: color,
873
+ legend: calloutLegend,
874
+ XValue: xCalloutValue,
875
+ YValue: yCalloutValue ? yCalloutValue : dataForHoverCard,
876
+ ...props.calloutProps,
877
+ ...(0, _index1.getAccessibleDataObject)(callOutAccessibilityData),
878
+ clickPosition: clickPosition,
879
+ isPopoverOpen: isPopoverOpen,
880
+ isCalloutForStack: _isHavingLine && (_noLegendHighlighted() || _getHighlightedLegend().length > 1),
881
+ culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
882
+ isCartesian: true,
883
+ customCallout: {
884
+ customizedCallout: _getCustomizedCallout() != null ? _getCustomizedCallout() : undefined,
885
+ customCalloutProps: props.calloutPropsPerDataPoint ? props.calloutPropsPerDataPoint(dataPointCalloutProps) : undefined
886
+ }
887
+ };
888
+ const tickParams = {
889
+ tickValues: props.tickValues,
890
+ tickFormat: props.tickFormat
891
+ };
892
+ return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement(_index.CartesianChart, {
893
+ ...props,
894
+ points: _points,
895
+ chartType: _index1.ChartTypes.VerticalBarChart,
896
+ xAxisType: _xAxisType,
897
+ calloutProps: calloutProps,
898
+ tickParams: tickParams,
899
+ ..._isHavingLine && _noLegendHighlighted() && {
900
+ isCalloutForStack: true
901
+ },
902
+ legendBars: legendBars,
903
+ datasetForXAxisDomain: _xAxisLabels,
904
+ barwidth: _barWidth,
905
+ getmargins: _getMargins,
906
+ getGraphData: _getGraphData,
907
+ getAxisData: _getAxisData,
908
+ onChartMouseLeave: _handleChartMouseLeave,
909
+ getDomainMargins: _getDomainMargins,
910
+ ..._xAxisType === _index1.XAxisTypes.StringAxis && {
911
+ xAxisInnerPadding: _xAxisInnerPadding,
912
+ xAxisOuterPadding: _xAxisOuterPadding
913
+ },
914
+ componentRef: cartesianChartRef,
915
+ /* eslint-disable react/jsx-no-bind */ // eslint-disable-next-line react/no-children-prop
916
+ children: (props)=>{
917
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("g", null, _bars), _isHavingLine && /*#__PURE__*/ _react.createElement("g", null, _createLine(props.xScale, props.yScale, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
918
+ }
919
+ }) : /*#__PURE__*/ _react.createElement("div", {
920
+ id: _emptyChartId,
921
+ role: 'alert',
922
+ style: {
923
+ opacity: '0'
924
+ },
925
+ "aria-label": 'Graph has no data to display'
926
+ });
927
+ });
928
+ VerticalBarChart.displayName = 'VerticalBarChart';