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