@fluentui/react-charts 1.2.0 → 9.0.0

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 (364) hide show
  1. package/CHANGELOG.md +177 -15
  2. package/LICENSE +11 -17
  3. package/README.md +174 -23
  4. package/dist/index.d.ts +2143 -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/HorizontalBarChart.js +1 -0
  12. package/lib/HorizontalBarChart.js.map +1 -0
  13. package/lib/Legends.js +1 -0
  14. package/lib/Legends.js.map +1 -0
  15. package/lib/LineChart.js +1 -0
  16. package/lib/LineChart.js.map +1 -0
  17. package/lib/Popover.js +1 -0
  18. package/lib/Popover.js.map +1 -0
  19. package/lib/ResponsiveContainer.js +1 -0
  20. package/lib/ResponsiveContainer.js.map +1 -0
  21. package/lib/Sparkline.js +1 -0
  22. package/lib/Sparkline.js.map +1 -0
  23. package/lib/VerticalBarChart.js +1 -0
  24. package/lib/VerticalBarChart.js.map +1 -0
  25. package/lib/components/CommonComponents/CartesianChart.js +462 -0
  26. package/lib/components/CommonComponents/CartesianChart.js.map +1 -0
  27. package/lib/components/CommonComponents/CartesianChart.types.js +1 -0
  28. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -0
  29. package/lib/components/CommonComponents/ChartPopover.js +187 -0
  30. package/lib/components/CommonComponents/ChartPopover.js.map +1 -0
  31. package/lib/components/CommonComponents/ChartPopover.types.js +1 -0
  32. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -0
  33. package/lib/components/CommonComponents/index.js +4 -0
  34. package/lib/components/CommonComponents/index.js.map +1 -0
  35. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +229 -0
  36. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
  37. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +178 -0
  38. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
  39. package/lib/components/DeclarativeChart/DeclarativeChart.js +150 -0
  40. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
  41. package/lib/components/DeclarativeChart/PlotlySchema.js +7 -0
  42. package/lib/components/DeclarativeChart/PlotlySchema.js.map +1 -0
  43. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +400 -0
  44. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
  45. package/lib/components/DeclarativeChart/imageExporter.js +221 -0
  46. package/lib/components/DeclarativeChart/imageExporter.js.map +1 -0
  47. package/lib/components/DeclarativeChart/index.js +1 -0
  48. package/lib/components/DeclarativeChart/index.js.map +1 -0
  49. package/lib/components/DonutChart/Arc/Arc.js +110 -0
  50. package/lib/components/DonutChart/Arc/Arc.js.map +1 -0
  51. package/lib/components/DonutChart/Arc/Arc.types.js +1 -0
  52. package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -0
  53. package/lib/components/DonutChart/Arc/index.js +2 -0
  54. package/lib/components/DonutChart/Arc/index.js.map +1 -0
  55. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +54 -0
  56. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
  57. package/lib/components/DonutChart/DonutChart.js +291 -0
  58. package/lib/components/DonutChart/DonutChart.js.map +1 -0
  59. package/lib/components/DonutChart/DonutChart.types.js +1 -0
  60. package/lib/components/DonutChart/DonutChart.types.js.map +1 -0
  61. package/lib/components/DonutChart/Pie/Pie.js +72 -0
  62. package/lib/components/DonutChart/Pie/Pie.js.map +1 -0
  63. package/lib/components/DonutChart/Pie/Pie.types.js +1 -0
  64. package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -0
  65. package/lib/components/DonutChart/Pie/index.js +2 -0
  66. package/lib/components/DonutChart/Pie/index.js.map +1 -0
  67. package/lib/components/DonutChart/Pie/usePieStyles.styles.js +44 -0
  68. package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
  69. package/lib/components/DonutChart/index.js +3 -0
  70. package/lib/components/DonutChart/index.js.map +1 -0
  71. package/lib/components/DonutChart/useDonutChartStyles.styles.js +58 -0
  72. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
  73. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +402 -0
  74. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
  75. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +6 -0
  76. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
  77. package/lib/components/HorizontalBarChart/index.js +3 -0
  78. package/lib/components/HorizontalBarChart/index.js.map +1 -0
  79. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +163 -0
  80. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
  81. package/lib/components/Legends/Legends.js +302 -0
  82. package/lib/components/Legends/Legends.js.map +1 -0
  83. package/lib/components/Legends/Legends.types.js +1 -0
  84. package/lib/components/Legends/Legends.types.js.map +1 -0
  85. package/lib/components/Legends/OverflowMenu.js +25 -0
  86. package/lib/components/Legends/OverflowMenu.js.map +1 -0
  87. package/lib/components/Legends/index.js +3 -0
  88. package/lib/components/Legends/index.js.map +1 -0
  89. package/lib/components/Legends/shape.js +35 -0
  90. package/lib/components/Legends/shape.js.map +1 -0
  91. package/lib/components/Legends/useLegendsStyles.styles.js +147 -0
  92. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -0
  93. package/lib/components/LineChart/LineChart.js +1026 -0
  94. package/lib/components/LineChart/LineChart.js.map +1 -0
  95. package/lib/components/LineChart/LineChart.types.js +3 -0
  96. package/lib/components/LineChart/LineChart.types.js.map +1 -0
  97. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +119 -0
  98. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
  99. package/lib/components/LineChart/eventAnnotation/LabelLink.js +57 -0
  100. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
  101. package/lib/components/LineChart/eventAnnotation/Textbox.js +40 -0
  102. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
  103. package/lib/components/LineChart/index.js +4 -0
  104. package/lib/components/LineChart/index.js.map +1 -0
  105. package/lib/components/LineChart/useLineChartStyles.styles.js +65 -0
  106. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -0
  107. package/lib/components/ResponsiveContainer/ResponsiveContainer.js +65 -0
  108. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
  109. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +1 -0
  110. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
  111. package/lib/components/ResponsiveContainer/index.js +1 -0
  112. package/lib/components/ResponsiveContainer/index.js.map +1 -0
  113. package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +23 -0
  114. package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
  115. package/lib/components/Sparkline/Sparkline.js +119 -0
  116. package/lib/components/Sparkline/Sparkline.js.map +1 -0
  117. package/lib/components/Sparkline/Sparkline.types.js +4 -0
  118. package/lib/components/Sparkline/Sparkline.types.js.map +1 -0
  119. package/lib/components/Sparkline/index.js +3 -0
  120. package/lib/components/Sparkline/index.js.map +1 -0
  121. package/lib/components/Sparkline/useSparklineStyles.styles.js +49 -0
  122. package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
  123. package/lib/components/VerticalBarChart/VerticalBarChart.js +849 -0
  124. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
  125. package/lib/components/VerticalBarChart/VerticalBarChart.types.js +4 -0
  126. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
  127. package/lib/components/VerticalBarChart/index.js +3 -0
  128. package/lib/components/VerticalBarChart/index.js.map +1 -0
  129. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +74 -0
  130. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
  131. package/lib/index.js +12 -8
  132. package/lib/index.js.map +1 -1
  133. package/lib/types/DataPoint.js +3 -0
  134. package/lib/types/DataPoint.js.map +1 -0
  135. package/lib/types/EventAnnotation.js +1 -0
  136. package/lib/types/EventAnnotation.js.map +1 -0
  137. package/lib/types/LegendDataItem.js +1 -0
  138. package/lib/types/LegendDataItem.js.map +1 -0
  139. package/lib/types/index.js +2 -2
  140. package/lib/types/index.js.map +1 -1
  141. package/lib/utilities/FocusableTooltipText.js +65 -0
  142. package/lib/utilities/FocusableTooltipText.js.map +1 -0
  143. package/lib/utilities/KeyCodes.js +8 -0
  144. package/lib/utilities/KeyCodes.js.map +1 -0
  145. package/lib/utilities/SVGTooltipText.js +138 -0
  146. package/lib/utilities/SVGTooltipText.js.map +1 -0
  147. package/lib/utilities/async-utils.js +380 -0
  148. package/lib/utilities/async-utils.js.map +1 -0
  149. package/lib/utilities/colors.js +249 -0
  150. package/lib/utilities/colors.js.map +1 -0
  151. package/lib/utilities/getWindow.js +25 -0
  152. package/lib/utilities/getWindow.js.map +1 -0
  153. package/lib/utilities/index.js +3 -0
  154. package/lib/utilities/index.js.map +1 -0
  155. package/lib/utilities/locale-util.js +15 -0
  156. package/lib/utilities/locale-util.js.map +1 -0
  157. package/lib/utilities/overflow-utils.js +27 -0
  158. package/lib/utilities/overflow-utils.js.map +1 -0
  159. package/lib/utilities/test-data.js +276 -0
  160. package/lib/utilities/test-data.js.map +1 -0
  161. package/lib/utilities/utilities.js +1215 -0
  162. package/lib/utilities/utilities.js.map +1 -0
  163. package/lib/utilities/vbc-utils.js +27 -0
  164. package/lib/utilities/vbc-utils.js.map +1 -0
  165. package/lib-commonjs/CartesianChart.js +6 -0
  166. package/lib-commonjs/CartesianChart.js.map +1 -0
  167. package/lib-commonjs/DeclarativeChart.js +6 -0
  168. package/lib-commonjs/DeclarativeChart.js.map +1 -0
  169. package/lib-commonjs/DonutChart.js +6 -0
  170. package/lib-commonjs/DonutChart.js.map +1 -0
  171. package/lib-commonjs/HorizontalBarChart.js +6 -0
  172. package/lib-commonjs/HorizontalBarChart.js.map +1 -0
  173. package/lib-commonjs/Legends.js +6 -0
  174. package/lib-commonjs/Legends.js.map +1 -0
  175. package/lib-commonjs/LineChart.js +6 -0
  176. package/lib-commonjs/LineChart.js.map +1 -0
  177. package/lib-commonjs/Popover.js +6 -0
  178. package/lib-commonjs/Popover.js.map +1 -0
  179. package/lib-commonjs/ResponsiveContainer.js +6 -0
  180. package/lib-commonjs/ResponsiveContainer.js.map +1 -0
  181. package/lib-commonjs/Sparkline.js +6 -0
  182. package/lib-commonjs/Sparkline.js.map +1 -0
  183. package/lib-commonjs/VerticalBarChart.js +6 -0
  184. package/lib-commonjs/VerticalBarChart.js.map +1 -0
  185. package/lib-commonjs/components/CommonComponents/CartesianChart.js +469 -0
  186. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -0
  187. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +6 -0
  188. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -0
  189. package/lib-commonjs/components/CommonComponents/ChartPopover.js +197 -0
  190. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -0
  191. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +4 -0
  192. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -0
  193. package/lib-commonjs/components/CommonComponents/index.js +9 -0
  194. package/lib-commonjs/components/CommonComponents/index.js.map +1 -0
  195. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +356 -0
  196. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
  197. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +261 -0
  198. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
  199. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +158 -0
  200. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
  201. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +10 -0
  202. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +1 -0
  203. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +445 -0
  204. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
  205. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +231 -0
  206. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -0
  207. package/lib-commonjs/components/DeclarativeChart/index.js +6 -0
  208. package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -0
  209. package/lib-commonjs/components/DonutChart/Arc/Arc.js +117 -0
  210. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -0
  211. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +4 -0
  212. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -0
  213. package/lib-commonjs/components/DonutChart/Arc/index.js +7 -0
  214. package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -0
  215. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +83 -0
  216. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
  217. package/lib-commonjs/components/DonutChart/DonutChart.js +298 -0
  218. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -0
  219. package/lib-commonjs/components/DonutChart/DonutChart.types.js +6 -0
  220. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -0
  221. package/lib-commonjs/components/DonutChart/Pie/Pie.js +79 -0
  222. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -0
  223. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +4 -0
  224. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -0
  225. package/lib-commonjs/components/DonutChart/Pie/index.js +7 -0
  226. package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -0
  227. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +61 -0
  228. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
  229. package/lib-commonjs/components/DonutChart/index.js +8 -0
  230. package/lib-commonjs/components/DonutChart/index.js.map +1 -0
  231. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +82 -0
  232. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
  233. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +408 -0
  234. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
  235. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +17 -0
  236. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
  237. package/lib-commonjs/components/HorizontalBarChart/index.js +8 -0
  238. package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -0
  239. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +251 -0
  240. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
  241. package/lib-commonjs/components/Legends/Legends.js +313 -0
  242. package/lib-commonjs/components/Legends/Legends.js.map +1 -0
  243. package/lib-commonjs/components/Legends/Legends.types.js +6 -0
  244. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -0
  245. package/lib-commonjs/components/Legends/OverflowMenu.js +36 -0
  246. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -0
  247. package/lib-commonjs/components/Legends/index.js +8 -0
  248. package/lib-commonjs/components/Legends/index.js.map +1 -0
  249. package/lib-commonjs/components/Legends/shape.js +46 -0
  250. package/lib-commonjs/components/Legends/shape.js.map +1 -0
  251. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +304 -0
  252. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -0
  253. package/lib-commonjs/components/LineChart/LineChart.js +1032 -0
  254. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -0
  255. package/lib-commonjs/components/LineChart/LineChart.types.js +6 -0
  256. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -0
  257. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +129 -0
  258. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
  259. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +68 -0
  260. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
  261. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +51 -0
  262. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
  263. package/lib-commonjs/components/LineChart/index.js +9 -0
  264. package/lib-commonjs/components/LineChart/index.js.map +1 -0
  265. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +96 -0
  266. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -0
  267. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +76 -0
  268. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
  269. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +6 -0
  270. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
  271. package/lib-commonjs/components/ResponsiveContainer/index.js +6 -0
  272. package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -0
  273. package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +47 -0
  274. package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
  275. package/lib-commonjs/components/Sparkline/Sparkline.js +125 -0
  276. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -0
  277. package/lib-commonjs/components/Sparkline/Sparkline.types.js +7 -0
  278. package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -0
  279. package/lib-commonjs/components/Sparkline/index.js +8 -0
  280. package/lib-commonjs/components/Sparkline/index.js.map +1 -0
  281. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +77 -0
  282. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
  283. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +851 -0
  284. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
  285. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +7 -0
  286. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
  287. package/lib-commonjs/components/VerticalBarChart/index.js +8 -0
  288. package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -0
  289. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +117 -0
  290. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
  291. package/lib-commonjs/index.js +17 -0
  292. package/lib-commonjs/index.js.map +1 -0
  293. package/lib-commonjs/types/DataPoint.js +6 -0
  294. package/lib-commonjs/types/DataPoint.js.map +1 -0
  295. package/lib-commonjs/types/EventAnnotation.js +6 -0
  296. package/lib-commonjs/types/EventAnnotation.js.map +1 -0
  297. package/lib-commonjs/types/LegendDataItem.js +4 -0
  298. package/lib-commonjs/types/LegendDataItem.js.map +1 -0
  299. package/lib-commonjs/types/index.js +7 -0
  300. package/lib-commonjs/types/index.js.map +1 -0
  301. package/lib-commonjs/utilities/FocusableTooltipText.js +75 -0
  302. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -0
  303. package/lib-commonjs/utilities/KeyCodes.js +18 -0
  304. package/lib-commonjs/utilities/KeyCodes.js.map +1 -0
  305. package/lib-commonjs/utilities/SVGTooltipText.js +148 -0
  306. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
  307. package/lib-commonjs/utilities/async-utils.js +382 -0
  308. package/lib-commonjs/utilities/async-utils.js.map +1 -0
  309. package/lib-commonjs/utilities/colors.js +270 -0
  310. package/lib-commonjs/utilities/colors.js.map +1 -0
  311. package/lib-commonjs/utilities/getWindow.js +28 -0
  312. package/lib-commonjs/utilities/getWindow.js.map +1 -0
  313. package/lib-commonjs/utilities/index.js +8 -0
  314. package/lib-commonjs/utilities/index.js.map +1 -0
  315. package/lib-commonjs/utilities/locale-util.js +25 -0
  316. package/lib-commonjs/utilities/locale-util.js.map +1 -0
  317. package/lib-commonjs/utilities/overflow-utils.js +36 -0
  318. package/lib-commonjs/utilities/overflow-utils.js.map +1 -0
  319. package/lib-commonjs/utilities/test-data.js +324 -0
  320. package/lib-commonjs/utilities/test-data.js.map +1 -0
  321. package/lib-commonjs/utilities/utilities.js +1184 -0
  322. package/lib-commonjs/utilities/utilities.js.map +1 -0
  323. package/lib-commonjs/utilities/vbc-utils.js +45 -0
  324. package/lib-commonjs/utilities/vbc-utils.js.map +1 -0
  325. package/package.json +80 -72
  326. package/CHANGELOG.json +0 -65
  327. package/lib/chart/chart-legend.d.ts +0 -6
  328. package/lib/chart/chart-legend.js +0 -445
  329. package/lib/chart/chart-legend.js.map +0 -1
  330. package/lib/chart/chart-render.d.ts +0 -3
  331. package/lib/chart/chart-render.js +0 -50
  332. package/lib/chart/chart-render.js.map +0 -1
  333. package/lib/chart/chart.d.ts +0 -3
  334. package/lib/chart/chart.js +0 -10
  335. package/lib/chart/chart.js.map +0 -1
  336. package/lib/chart/index.d.ts +0 -1
  337. package/lib/chart/index.js +0 -2
  338. package/lib/chart/index.js.map +0 -1
  339. package/lib/index.d.ts +0 -7
  340. package/lib/lib/builder.d.ts +0 -89
  341. package/lib/lib/builder.js +0 -379
  342. package/lib/lib/builder.js.map +0 -1
  343. package/lib/lib/datasets.d.ts +0 -123
  344. package/lib/lib/datasets.js +0 -285
  345. package/lib/lib/datasets.js.map +0 -1
  346. package/lib/lib/patterns.d.ts +0 -43
  347. package/lib/lib/patterns.js +0 -433
  348. package/lib/lib/patterns.js.map +0 -1
  349. package/lib/lib/plugins.d.ts +0 -11
  350. package/lib/lib/plugins.js +0 -403
  351. package/lib/lib/plugins.js.map +0 -1
  352. package/lib/lib/settings.d.ts +0 -12
  353. package/lib/lib/settings.js +0 -368
  354. package/lib/lib/settings.js.map +0 -1
  355. package/lib/lib/storybook.d.ts +0 -11
  356. package/lib/lib/storybook.js +0 -13
  357. package/lib/lib/storybook.js.map +0 -1
  358. package/lib/lib/utils.d.ts +0 -34
  359. package/lib/lib/utils.js +0 -253
  360. package/lib/lib/utils.js.map +0 -1
  361. package/lib/types/index.d.ts +0 -1
  362. package/lib/types/types.d.ts +0 -101
  363. package/lib/types/types.js +0 -41
  364. package/lib/types/types.js.map +0 -1
@@ -0,0 +1,1032 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "LineChart", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return LineChart;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _useLineChartStylesstyles = require("./useLineChartStyles.styles");
14
+ const _d3selection = require("d3-selection");
15
+ const _d3array = require("d3-array");
16
+ const _index = require("../Legends/index");
17
+ const _d3shape = require("d3-shape");
18
+ const _reactutilities = require("@fluentui/react-utilities");
19
+ const _index1 = require("../../utilities/index");
20
+ const _index2 = require("../../index");
21
+ const _EventAnnotation = require("./eventAnnotation/EventAnnotation");
22
+ const _reacttheme = require("@fluentui/react-theme");
23
+ var PointSize;
24
+ (function(PointSize) {
25
+ PointSize[PointSize["hoverSize"] = 11] = "hoverSize";
26
+ PointSize[PointSize["invisibleSize"] = 1] = "invisibleSize";
27
+ })(PointSize || (PointSize = {}));
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ const bisect = (0, _d3array.bisector)((d)=>d.x).left;
30
+ const DEFAULT_LINE_STROKE_SIZE = 4;
31
+ // The given shape of a icon must be 2.5 times bigger than line width (known as stroke width)
32
+ const PATH_MULTIPLY_SIZE = 2.5;
33
+ /**
34
+ *
35
+ * @param x units from origin
36
+ * @param y units from origin
37
+ * @param w is the legnth of the each side of a shape
38
+ * @param index index to get the shape path
39
+ */ const _getPointPath = (x, y, w, index)=>{
40
+ const allPointPaths = [
41
+ // circle path
42
+ `M${x - w / 2} ${y}
43
+ A${w / 2} ${w / 2} 0 1 0 ${x + w / 2} ${y}
44
+ M${x - w / 2} ${y}
45
+ A ${w / 2} ${w / 2} 0 1 1 ${x + w / 2} ${y}
46
+ `,
47
+ //square
48
+ `M${x - w / 2} ${y - w / 2}
49
+ L${x + w / 2} ${y - w / 2}
50
+ L${x + w / 2} ${y + w / 2}
51
+ L${x - w / 2} ${y + w / 2}
52
+ Z`,
53
+ //triangle
54
+ `M${x - w / 2} ${y - 0.2886 * w}
55
+ H ${x + w / 2}
56
+ L${x} ${y + 0.5774 * w} Z`,
57
+ //diamond
58
+ `M${x} ${y - w / 2}
59
+ L${x + w / 2} ${y}
60
+ L${x} ${y + w / 2}
61
+ L${x - w / 2} ${y}
62
+ Z`,
63
+ //pyramid
64
+ `M${x} ${y - 0.5774 * w}
65
+ L${x + w / 2} ${y + 0.2886 * w}
66
+ L${x - w / 2} ${y + 0.2886 * w} Z`,
67
+ //hexagon
68
+ `M${x - 0.5 * w} ${y - 0.866 * w}
69
+ L${x + 0.5 * w} ${y - 0.866 * w}
70
+ L${x + w} ${y}
71
+ L${x + 0.5 * w} ${y + 0.866 * w}
72
+ L${x - 0.5 * w} ${y + 0.866 * w}
73
+ L${x - w} ${y}
74
+ Z`,
75
+ //pentagon
76
+ `M${x} ${y - 0.851 * w}
77
+ L${x + 0.6884 * w} ${y - 0.2633 * w}
78
+ L${x + 0.5001 * w} ${y + 0.6884 * w}
79
+ L${x - 0.5001 * w} ${y + 0.6884 * w}
80
+ L${x - 0.6884 * w} ${y - 0.2633 * w}
81
+ Z`,
82
+ //octagon
83
+ `M${x - 0.5001 * w} ${y - 1.207 * w}
84
+ L${x + 0.5001 * w} ${y - 1.207 * w}
85
+ L${x + 1.207 * w} ${y - 0.5001 * w}
86
+ L${x + 1.207 * w} ${y + 0.5001 * w}
87
+ L${x + 0.5001 * w} ${y + 1.207 * w}
88
+ L${x - 0.5001 * w} ${y + 1.207 * w}
89
+ L${x - 1.207 * w} ${y + 0.5001 * w}
90
+ L${x - 1.207 * w} ${y - 0.5001 * w}
91
+ Z`
92
+ ];
93
+ return allPointPaths[index];
94
+ };
95
+ const LineChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
96
+ let _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
97
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ let _calloutPoints = (0, _index1.calloutData)(_points) || [];
99
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
+ let _xAxisScale = '';
101
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
+ let _yAxisScale = '';
103
+ let _circleId = (0, _reactutilities.useId)('circle');
104
+ let _lineId = (0, _reactutilities.useId)('lineID');
105
+ let _borderId = (0, _reactutilities.useId)('borderID');
106
+ let _verticalLine = (0, _reactutilities.useId)('verticalLine');
107
+ let _colorFillBarPatternId = (0, _reactutilities.useId)('colorFillBarPattern');
108
+ let _uniqueCallOutID = '';
109
+ let _refArray = [];
110
+ let margins;
111
+ let eventLabelHeight = 36;
112
+ let lines;
113
+ let _renderedColorFillBars;
114
+ const _colorFillBars = _react.useRef([]);
115
+ let _tooltipId = (0, _reactutilities.useId)('LineChartTooltipId_');
116
+ let _rectId = (0, _reactutilities.useId)('containerRectLD');
117
+ let _staticHighlightCircle = (0, _reactutilities.useId)('staticHighlightCircle');
118
+ let _firstRenderOptimization = true;
119
+ let _emptyChartId = (0, _reactutilities.useId)('_LineChart_empty');
120
+ const _colorFillBarId = (0, _reactutilities.useId)('_colorFillBarId');
121
+ const _isRTL = (0, _index1.useRtl)();
122
+ let xAxisCalloutAccessibilityData = {};
123
+ const cartesianChartRef = _react.useRef(null);
124
+ props.eventAnnotationProps && props.eventAnnotationProps.labelHeight && (eventLabelHeight = props.eventAnnotationProps.labelHeight);
125
+ const [hoverXValue, setHoverXValue] = _react.useState('');
126
+ const [activeLegend, setActiveLegend] = _react.useState('');
127
+ const [YValueHover, setYValueHover] = _react.useState([]);
128
+ const [selectedLegend, setSelectedLegend] = _react.useState('');
129
+ const [selectedLegendPoints, setSelectedLegendPoints] = _react.useState([]);
130
+ const [selectedColorBarLegend, setSelectedColorBarLegend] = _react.useState([]);
131
+ const [isSelectedLegend, setIsSelectedLegend] = _react.useState(false);
132
+ const [activePoint, setActivePoint] = _react.useState('');
133
+ const [nearestCircleToHighlight, setNearestCircleToHighlight] = _react.useState(null);
134
+ const [dataPointCalloutProps, setDataPointCalloutProps] = _react.useState();
135
+ const [stackCalloutProps, setStackCalloutProps] = _react.useState();
136
+ const [clickPosition, setClickPosition] = _react.useState({
137
+ x: 0,
138
+ y: 0
139
+ });
140
+ const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
141
+ const pointsRef = _react.useRef([]);
142
+ const calloutPointsRef = _react.useRef([]);
143
+ _react.useEffect(()=>{
144
+ /** note that height and width are not used to resize or set as dimesions of the chart,
145
+ * fitParentContainer is responisble for setting the height and width or resizing of the svg/chart
146
+ */ if (_points !== _injectIndexPropertyInLineChartData(props.data.lineChartData) || props.data !== _points) {
147
+ pointsRef.current = _injectIndexPropertyInLineChartData(props.data.lineChartData);
148
+ calloutPointsRef.current = (0, _index1.calloutData)(pointsRef.current);
149
+ }
150
+ }, [
151
+ props.height,
152
+ props.width,
153
+ props.data
154
+ ]);
155
+ _react.useImperativeHandle(props.componentRef, ()=>{
156
+ var _cartesianChartRef_current;
157
+ var _cartesianChartRef_current_chartContainer;
158
+ return {
159
+ 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
160
+ };
161
+ }, []);
162
+ function _injectIndexPropertyInLineChartData(lineChartData) {
163
+ const { allowMultipleShapesForPoints = false } = props;
164
+ return lineChartData ? lineChartData.map((item, index)=>{
165
+ let color;
166
+ if (typeof item.color === 'undefined') {
167
+ color = (0, _index1.getNextColor)(index, 0);
168
+ } else {
169
+ color = (0, _index1.getColorFromToken)(item.color);
170
+ }
171
+ return {
172
+ ...item,
173
+ index: allowMultipleShapesForPoints ? index : -1,
174
+ color
175
+ };
176
+ }) : [];
177
+ }
178
+ function updatePosition(newX, newY) {
179
+ const threshold = 1; // Set a threshold for movement
180
+ const { x, y } = clickPosition;
181
+ // Calculate the distance moved
182
+ const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));
183
+ // Update the position only if the distance moved is greater than the threshold
184
+ if (distance > threshold) {
185
+ setClickPosition({
186
+ x: newX,
187
+ y: newY
188
+ });
189
+ setPopoverOpen(true);
190
+ }
191
+ }
192
+ function _getCustomizedCallout() {
193
+ return props.onRenderCalloutPerStack ? props.onRenderCalloutPerStack(stackCalloutProps) : props.onRenderCalloutPerDataPoint ? props.onRenderCalloutPerDataPoint(dataPointCalloutProps) : null;
194
+ }
195
+ function _getMargins(_margins) {
196
+ margins = _margins;
197
+ }
198
+ function _initializeLineChartData(xScale, yScale, containerHeight, containerWidth, xElement) {
199
+ _xAxisScale = xScale;
200
+ _yAxisScale = yScale;
201
+ _renderedColorFillBars = props.colorFillBars ? _createColorFillBars(containerHeight) : [];
202
+ lines = _createLines(xElement, containerHeight);
203
+ }
204
+ function _handleSingleLegendSelectionAction(lineChartItem) {
205
+ if (selectedLegend === lineChartItem.legend) {
206
+ setSelectedLegend('');
207
+ _handleLegendClick(lineChartItem, null);
208
+ } else {
209
+ setSelectedLegend(lineChartItem.legend);
210
+ _handleLegendClick(lineChartItem, lineChartItem.legend);
211
+ }
212
+ }
213
+ function _onHoverCardHide() {
214
+ setSelectedLegendPoints([]);
215
+ setSelectedColorBarLegend([]);
216
+ setIsSelectedLegend(false);
217
+ }
218
+ function _handleLegendClick(lineChartItem, selectedLegend) {
219
+ if (lineChartItem.onLegendClick) {
220
+ lineChartItem.onLegendClick(selectedLegend);
221
+ }
222
+ }
223
+ function _createLegends(data) {
224
+ const { legendProps, allowMultipleShapesForPoints = false } = props;
225
+ const isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
226
+ const legendDataItems = data.map((point)=>{
227
+ const color = point.color;
228
+ // mapping data to the format Legends component needs
229
+ const legend = {
230
+ title: point.legend,
231
+ color,
232
+ action: ()=>{
233
+ if (isLegendMultiSelectEnabled) {
234
+ _handleMultipleLineLegendSelectionAction(point);
235
+ } else {
236
+ _handleSingleLegendSelectionAction(point);
237
+ }
238
+ },
239
+ onMouseOutAction: ()=>{
240
+ setActiveLegend('');
241
+ },
242
+ hoverAction: ()=>{
243
+ _handleChartMouseLeave();
244
+ setActiveLegend(point.legend);
245
+ },
246
+ ...point.legendShape && {
247
+ shape: point.legendShape
248
+ },
249
+ ...allowMultipleShapesForPoints && {
250
+ shape: _index1.Points[point.index % Object.keys(_index1.pointTypes).length]
251
+ }
252
+ };
253
+ return legend;
254
+ });
255
+ const colorFillBarsLegendDataItems = props.colorFillBars ? props.colorFillBars.map((colorFillBar, index)=>{
256
+ const title = colorFillBar.legend;
257
+ const color = (0, _index1.getColorFromToken)(colorFillBar.color);
258
+ const legend = {
259
+ title,
260
+ color,
261
+ action: ()=>{
262
+ if (isLegendMultiSelectEnabled) {
263
+ _handleMultipleColorFillBarLegendSelectionAction(colorFillBar);
264
+ } else {
265
+ _handleSingleLegendSelectionAction(colorFillBar);
266
+ }
267
+ },
268
+ onMouseOutAction: ()=>{
269
+ setActiveLegend('');
270
+ },
271
+ hoverAction: ()=>{
272
+ _handleChartMouseLeave();
273
+ setActiveLegend(title);
274
+ },
275
+ opacity: _getColorFillBarOpacity(colorFillBar),
276
+ stripePattern: colorFillBar.applyPattern
277
+ };
278
+ return legend;
279
+ }) : [];
280
+ return /*#__PURE__*/ _react.createElement(_index.Legends, {
281
+ legends: [
282
+ ...legendDataItems,
283
+ ...colorFillBarsLegendDataItems
284
+ ],
285
+ enabledWrapLines: props.enabledLegendsWrapLines,
286
+ overflowText: props.legendsOverflowText,
287
+ ...isLegendMultiSelectEnabled && {
288
+ onLegendHoverCardLeave: _onHoverCardHide
289
+ },
290
+ ...props.legendProps
291
+ });
292
+ }
293
+ function _getBoxWidthOfShape(pointId, pointIndex, isLastPoint) {
294
+ const { allowMultipleShapesForPoints = false, strokeWidth = DEFAULT_LINE_STROKE_SIZE } = props;
295
+ if (allowMultipleShapesForPoints) {
296
+ if (activePoint === pointId) {
297
+ return 11;
298
+ } else if (pointIndex === 1 || isLastPoint) {
299
+ return strokeWidth * PATH_MULTIPLY_SIZE;
300
+ } else {
301
+ return 1;
302
+ }
303
+ } else {
304
+ if (activePoint === pointId) {
305
+ return 11;
306
+ } else {
307
+ return 1;
308
+ }
309
+ }
310
+ }
311
+ function _getPath(xPos, yPos, pointId, pointIndex, isLastPoint, pointOftheLine) {
312
+ const { allowMultipleShapesForPoints = false } = props;
313
+ let w = _getBoxWidthOfShape(pointId, pointIndex, isLastPoint);
314
+ const index = allowMultipleShapesForPoints ? pointOftheLine % Object.keys(_index1.pointTypes).length : 0;
315
+ const widthRatio = _index1.pointTypes[index].widthRatio;
316
+ w = widthRatio > 1 ? w / widthRatio : w;
317
+ return _getPointPath(xPos, yPos, w, index);
318
+ }
319
+ function _getPointFill(lineColor, pointId, pointIndex, isLastPoint) {
320
+ const { allowMultipleShapesForPoints = false } = props;
321
+ if (allowMultipleShapesForPoints) {
322
+ if (pointIndex === 1 || isLastPoint) {
323
+ if (activePoint === pointId) {
324
+ return _reacttheme.tokens.colorNeutralBackground1;
325
+ } else {
326
+ return lineColor;
327
+ }
328
+ } else {
329
+ if (activePoint === pointId) {
330
+ return _reacttheme.tokens.colorNeutralBackground1;
331
+ } else {
332
+ return lineColor;
333
+ }
334
+ }
335
+ } else {
336
+ if (activePoint === pointId) {
337
+ return _reacttheme.tokens.colorNeutralBackground1;
338
+ } else {
339
+ return lineColor;
340
+ }
341
+ }
342
+ }
343
+ function _createLines(xElement, containerHeight) {
344
+ const lines = [];
345
+ if (isSelectedLegend) {
346
+ _points = selectedLegendPoints;
347
+ } else {
348
+ _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
349
+ }
350
+ for(let i = _points.length - 1; i >= 0; i--){
351
+ var _points_i_gaps;
352
+ const linesForLine = [];
353
+ const bordersForLine = [];
354
+ const pointsForLine = [];
355
+ const legendVal = _points[i].legend;
356
+ const lineColor = _points[i].color;
357
+ const verticaLineHeight = containerHeight - margins.bottom + 6;
358
+ if (_points[i].data.length === 1) {
359
+ // eslint-disable-next-line @typescript-eslint/no-shadow
360
+ const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[0];
361
+ const circleId = `${_circleId}_${i}`;
362
+ const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
363
+ pointsForLine.push(/*#__PURE__*/ _react.createElement("circle", {
364
+ id: circleId,
365
+ key: circleId,
366
+ r: activePoint === circleId ? 5.5 : 3.5,
367
+ cx: _xAxisScale(x1),
368
+ cy: _yAxisScale(y1),
369
+ fill: activePoint === circleId ? _reacttheme.tokens.colorNeutralBackground1 : lineColor,
370
+ opacity: isLegendSelected ? 1 : 0.1,
371
+ tabIndex: _points[i].legend !== '' ? 0 : undefined,
372
+ onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
373
+ onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
374
+ onMouseOut: _handleMouseOut,
375
+ strokeWidth: activePoint === circleId ? DEFAULT_LINE_STROKE_SIZE : 0,
376
+ stroke: activePoint === circleId ? lineColor : '',
377
+ role: "img",
378
+ "aria-label": _getAriaLabel(i, 0),
379
+ "data-is-focusable": isLegendSelected,
380
+ ref: (e)=>{
381
+ _refCallback(e, circleId);
382
+ },
383
+ onFocus: ()=>_handleFocus(circleId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
384
+ onBlur: _handleMouseOut,
385
+ ..._getClickHandler(_points[i].data[0].onDataPointClick)
386
+ }));
387
+ }
388
+ let gapIndex = 0;
389
+ var _points_i_gaps_sort;
390
+ const gaps = (_points_i_gaps_sort = (_points_i_gaps = _points[i].gaps) === null || _points_i_gaps === void 0 ? void 0 : _points_i_gaps.sort((a, b)=>a.startIndex - b.startIndex)) !== null && _points_i_gaps_sort !== void 0 ? _points_i_gaps_sort : [];
391
+ // Use path rendering technique for larger datasets to optimize performance.
392
+ if (props.optimizeLargeData && _points[i].data.length > 1) {
393
+ var _points_i_lineOptions;
394
+ const line = (0, _d3shape.line)() // eslint-disable-next-line @typescript-eslint/no-explicit-any
395
+ .x((d)=>_xAxisScale(d[0])) // eslint-disable-next-line @typescript-eslint/no-explicit-any
396
+ .y((d)=>_yAxisScale(d[1])).curve(_d3shape.curveLinear);
397
+ const lineId = `${_lineId}_${i}`;
398
+ const borderId = `${_borderId}_${i}`;
399
+ const strokeWidth = ((_points_i_lineOptions = _points[i].lineOptions) === null || _points_i_lineOptions === void 0 ? void 0 : _points_i_lineOptions.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
400
+ const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
401
+ const lineData = [];
402
+ for(let k = 0; k < _points[i].data.length; k++){
403
+ lineData.push([
404
+ _points[i].data[k].x instanceof Date ? _points[i].data[k].x.getTime() : _points[i].data[k].x,
405
+ _points[i].data[k].y
406
+ ]);
407
+ }
408
+ if (isLegendSelected) {
409
+ var _points_i_lineOptions1, _points_i_lineOptions2;
410
+ const lineBorderWidth = ((_points_i_lineOptions1 = _points[i].lineOptions) === null || _points_i_lineOptions1 === void 0 ? void 0 : _points_i_lineOptions1.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
411
+ if (lineBorderWidth > 0) {
412
+ var _points_i_lineOptions3, _points_i_lineOptions4;
413
+ var _points_i_lineOptions_strokeLinecap;
414
+ bordersForLine.push(/*#__PURE__*/ _react.createElement("path", {
415
+ id: borderId,
416
+ key: borderId,
417
+ d: line(lineData),
418
+ fill: "transparent",
419
+ strokeLinecap: (_points_i_lineOptions_strokeLinecap = (_points_i_lineOptions3 = _points[i].lineOptions) === null || _points_i_lineOptions3 === void 0 ? void 0 : _points_i_lineOptions3.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap !== void 0 ? _points_i_lineOptions_strokeLinecap : 'round',
420
+ strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
421
+ stroke: ((_points_i_lineOptions4 = _points[i].lineOptions) === null || _points_i_lineOptions4 === void 0 ? void 0 : _points_i_lineOptions4.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
422
+ opacity: 1
423
+ }));
424
+ }
425
+ var _points_i_lineOptions_strokeLinecap1;
426
+ linesForLine.push(/*#__PURE__*/ _react.createElement("path", {
427
+ id: lineId,
428
+ key: lineId,
429
+ d: line(lineData),
430
+ fill: "transparent",
431
+ "data-is-focusable": true,
432
+ stroke: lineColor,
433
+ strokeWidth: strokeWidth,
434
+ strokeLinecap: (_points_i_lineOptions_strokeLinecap1 = (_points_i_lineOptions2 = _points[i].lineOptions) === null || _points_i_lineOptions2 === void 0 ? void 0 : _points_i_lineOptions2.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap1 !== void 0 ? _points_i_lineOptions_strokeLinecap1 : 'round',
435
+ onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
436
+ onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
437
+ onMouseOut: _handleMouseOut,
438
+ ..._getClickHandler(_points[i].onLineClick),
439
+ opacity: 1,
440
+ tabIndex: _points[i].legend !== '' ? 0 : undefined
441
+ }));
442
+ } else {
443
+ var _points_i_lineOptions5;
444
+ var _points_i_lineOptions_strokeLinecap2;
445
+ linesForLine.push(/*#__PURE__*/ _react.createElement("path", {
446
+ id: lineId,
447
+ key: lineId,
448
+ d: line(lineData),
449
+ fill: "transparent",
450
+ "data-is-focusable": false,
451
+ stroke: lineColor,
452
+ strokeWidth: strokeWidth,
453
+ strokeLinecap: (_points_i_lineOptions_strokeLinecap2 = (_points_i_lineOptions5 = _points[i].lineOptions) === null || _points_i_lineOptions5 === void 0 ? void 0 : _points_i_lineOptions5.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap2 !== void 0 ? _points_i_lineOptions_strokeLinecap2 : 'round',
454
+ opacity: 0.1
455
+ }));
456
+ }
457
+ pointsForLine.push(/*#__PURE__*/ _react.createElement("circle", {
458
+ id: `${_staticHighlightCircle}_${i}`,
459
+ key: `${_staticHighlightCircle}_${i}`,
460
+ r: 5.5,
461
+ cx: 0,
462
+ cy: 0,
463
+ fill: _reacttheme.tokens.colorNeutralBackground1,
464
+ strokeWidth: DEFAULT_LINE_STROKE_SIZE,
465
+ stroke: lineColor,
466
+ visibility: 'hidden',
467
+ onMouseMove: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
468
+ onMouseOver: (event)=>_onMouseOverLargeDataset.bind(i, verticaLineHeight, event),
469
+ onMouseOut: _handleMouseOut
470
+ }));
471
+ } else if (!props.optimizeLargeData) {
472
+ for(let j = 1; j < _points[i].data.length; j++){
473
+ var _points_i_lineOptions6;
474
+ const gapResult = _checkInGap(j, gaps, gapIndex);
475
+ const isInGap = gapResult.isInGap;
476
+ gapIndex = gapResult.gapIndex;
477
+ const lineId = `${_lineId}_${i}_${j}`;
478
+ const borderId = `${_borderId}_${i}_${j}`;
479
+ const circleId = `${_circleId}_${i}_${j}`;
480
+ const { x: x1, y: y1, xAxisCalloutData, xAxisCalloutAccessibilityData } = _points[i].data[j - 1];
481
+ const { x: x2, y: y2 } = _points[i].data[j];
482
+ let path = _getPath(_xAxisScale(x1), _yAxisScale(y1), circleId, j, false, _points[i].index);
483
+ const strokeWidth = ((_points_i_lineOptions6 = _points[i].lineOptions) === null || _points_i_lineOptions6 === void 0 ? void 0 : _points_i_lineOptions6.strokeWidth) || props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
484
+ const isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
485
+ const currentPointHidden = _points[i].hideNonActiveDots && activePoint !== circleId;
486
+ pointsForLine.push(/*#__PURE__*/ _react.createElement("path", {
487
+ id: circleId,
488
+ key: circleId,
489
+ d: path,
490
+ "data-is-focusable": isLegendSelected,
491
+ onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
492
+ onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
493
+ onMouseOut: _handleMouseOut,
494
+ onFocus: ()=>_handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData),
495
+ onBlur: _handleMouseOut,
496
+ ..._getClickHandler(_points[i].data[j - 1].onDataPointClick),
497
+ opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01,
498
+ fill: _getPointFill(lineColor, circleId, j, false),
499
+ stroke: lineColor,
500
+ strokeWidth: strokeWidth,
501
+ role: "img",
502
+ "aria-label": _getAriaLabel(i, j - 1),
503
+ tabIndex: _points[i].legend !== '' ? 0 : undefined
504
+ }));
505
+ if (j + 1 === _points[i].data.length) {
506
+ // If this is last point of the line segment.
507
+ const lastCircleId = `${circleId}${j}L`;
508
+ const hiddenHoverCircleId = `${circleId}${j}D`;
509
+ const lastPointHidden = _points[i].hideNonActiveDots && activePoint !== lastCircleId;
510
+ path = _getPath(_xAxisScale(x2), _yAxisScale(y2), lastCircleId, j, true, _points[i].index);
511
+ const { xAxisCalloutData: lastCirlceXCallout, xAxisCalloutAccessibilityData: lastCirlceXCalloutAccessibilityData } = _points[i].data[j];
512
+ pointsForLine.push(/*#__PURE__*/ _react.createElement(_react.Fragment, {
513
+ key: `${lastCircleId}_container`
514
+ }, /*#__PURE__*/ _react.createElement("path", {
515
+ id: lastCircleId,
516
+ key: lastCircleId,
517
+ d: path,
518
+ "data-is-focusable": isLegendSelected,
519
+ onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
520
+ onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
521
+ onMouseOut: _handleMouseOut,
522
+ onFocus: ()=>_handleFocus(lineId, x2, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData),
523
+ onBlur: _handleMouseOut,
524
+ ..._getClickHandler(_points[i].data[j].onDataPointClick),
525
+ opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01,
526
+ fill: _getPointFill(lineColor, lastCircleId, j, true),
527
+ stroke: lineColor,
528
+ strokeWidth: strokeWidth,
529
+ role: "img",
530
+ "aria-label": _getAriaLabel(i, j),
531
+ tabIndex: _points[i].legend !== '' ? 0 : undefined
532
+ }), /*#__PURE__*/ _react.createElement("circle", {
533
+ id: hiddenHoverCircleId,
534
+ key: hiddenHoverCircleId,
535
+ r: 8,
536
+ cx: _xAxisScale(x2),
537
+ cy: _yAxisScale(y2),
538
+ opacity: 0,
539
+ width: 0,
540
+ onMouseOver: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
541
+ onMouseMove: (event)=>_handleHover(x2, y2, verticaLineHeight, lastCirlceXCallout, lastCircleId, lastCirlceXCalloutAccessibilityData, event),
542
+ onMouseOut: _handleMouseOut,
543
+ strokeWidth: 0,
544
+ focusable: false,
545
+ onBlur: _handleMouseOut
546
+ })));
547
+ /* eslint-enable react/jsx-no-bind */ }
548
+ if (isLegendSelected) {
549
+ // don't draw line if it is in a gap
550
+ if (!isInGap) {
551
+ var _points_i_lineOptions7, _points_i_lineOptions8, _points_i_lineOptions9, _points_i_lineOptions10;
552
+ const lineBorderWidth = ((_points_i_lineOptions7 = _points[i].lineOptions) === null || _points_i_lineOptions7 === void 0 ? void 0 : _points_i_lineOptions7.lineBorderWidth) ? Number.parseFloat(_points[i].lineOptions.lineBorderWidth.toString()) : 0;
553
+ if (lineBorderWidth > 0) {
554
+ var _points_i_lineOptions11, _points_i_lineOptions12;
555
+ var _points_i_lineOptions_strokeLinecap3;
556
+ bordersForLine.push(/*#__PURE__*/ _react.createElement("line", {
557
+ id: borderId,
558
+ key: borderId,
559
+ x1: _xAxisScale(x1),
560
+ y1: _yAxisScale(y1),
561
+ x2: _xAxisScale(x2),
562
+ y2: _yAxisScale(y2),
563
+ strokeLinecap: (_points_i_lineOptions_strokeLinecap3 = (_points_i_lineOptions11 = _points[i].lineOptions) === null || _points_i_lineOptions11 === void 0 ? void 0 : _points_i_lineOptions11.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap3 !== void 0 ? _points_i_lineOptions_strokeLinecap3 : 'round',
564
+ strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth,
565
+ stroke: ((_points_i_lineOptions12 = _points[i].lineOptions) === null || _points_i_lineOptions12 === void 0 ? void 0 : _points_i_lineOptions12.lineBorderColor) || _reacttheme.tokens.colorNeutralBackground1,
566
+ opacity: 1
567
+ }));
568
+ }
569
+ var _points_i_lineOptions_strokeLinecap4;
570
+ linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
571
+ id: lineId,
572
+ key: lineId,
573
+ x1: _xAxisScale(x1),
574
+ y1: _yAxisScale(y1),
575
+ x2: _xAxisScale(x2),
576
+ y2: _yAxisScale(y2),
577
+ strokeWidth: strokeWidth,
578
+ ref: (e)=>{
579
+ _refCallback(e, lineId);
580
+ },
581
+ onMouseOver: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
582
+ onMouseMove: (event)=>_handleHover(x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event),
583
+ onMouseOut: _handleMouseOut,
584
+ stroke: lineColor,
585
+ strokeLinecap: (_points_i_lineOptions_strokeLinecap4 = (_points_i_lineOptions8 = _points[i].lineOptions) === null || _points_i_lineOptions8 === void 0 ? void 0 : _points_i_lineOptions8.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap4 !== void 0 ? _points_i_lineOptions_strokeLinecap4 : 'round',
586
+ strokeDasharray: (_points_i_lineOptions9 = _points[i].lineOptions) === null || _points_i_lineOptions9 === void 0 ? void 0 : _points_i_lineOptions9.strokeDasharray,
587
+ strokeDashoffset: (_points_i_lineOptions10 = _points[i].lineOptions) === null || _points_i_lineOptions10 === void 0 ? void 0 : _points_i_lineOptions10.strokeDashoffset,
588
+ opacity: 1,
589
+ ..._getClickHandler(_points[i].onLineClick)
590
+ }));
591
+ }
592
+ } else {
593
+ if (!isInGap) {
594
+ var _points_i_lineOptions13, _points_i_lineOptions14, _points_i_lineOptions15;
595
+ var _points_i_lineOptions_strokeLinecap5;
596
+ linesForLine.push(/*#__PURE__*/ _react.createElement("line", {
597
+ id: lineId,
598
+ key: lineId,
599
+ x1: _xAxisScale(x1),
600
+ y1: _yAxisScale(y1),
601
+ x2: _xAxisScale(x2),
602
+ y2: _yAxisScale(y2),
603
+ strokeWidth: strokeWidth,
604
+ stroke: lineColor,
605
+ strokeLinecap: (_points_i_lineOptions_strokeLinecap5 = (_points_i_lineOptions13 = _points[i].lineOptions) === null || _points_i_lineOptions13 === void 0 ? void 0 : _points_i_lineOptions13.strokeLinecap) !== null && _points_i_lineOptions_strokeLinecap5 !== void 0 ? _points_i_lineOptions_strokeLinecap5 : 'round',
606
+ strokeDasharray: (_points_i_lineOptions14 = _points[i].lineOptions) === null || _points_i_lineOptions14 === void 0 ? void 0 : _points_i_lineOptions14.strokeDasharray,
607
+ strokeDashoffset: (_points_i_lineOptions15 = _points[i].lineOptions) === null || _points_i_lineOptions15 === void 0 ? void 0 : _points_i_lineOptions15.strokeDashoffset,
608
+ opacity: 0.1
609
+ }));
610
+ }
611
+ }
612
+ }
613
+ }
614
+ lines.push(/*#__PURE__*/ _react.createElement("g", {
615
+ key: `line_${i}`,
616
+ role: "region",
617
+ "aria-label": `${legendVal}, line ${i + 1} of ${_points.length} with ${_points[i].data.length} data points.`
618
+ }, bordersForLine, linesForLine, pointsForLine));
619
+ }
620
+ const classes = (0, _useLineChartStylesstyles.useLineChartStyles)(props);
621
+ // Removing un wanted tooltip div from DOM, when prop not provided.
622
+ if (!props.showXAxisLablesTooltip) {
623
+ try {
624
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
625
+ // eslint-disable-next-line no-empty
626
+ } catch (e) {}
627
+ }
628
+ // Used to display tooltip at x axis labels.
629
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
630
+ const xAxisElement = (0, _d3selection.select)(xElement).call(_xAxisScale);
631
+ try {
632
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
633
+ // eslint-disable-next-line no-empty
634
+ } catch (e) {}
635
+ const tooltipProps = {
636
+ tooltipCls: classes.tooltip,
637
+ id: _tooltipId,
638
+ xAxis: xAxisElement
639
+ };
640
+ xAxisElement && (0, _index1.tooltipOfXAxislabels)(tooltipProps);
641
+ }
642
+ return lines;
643
+ }
644
+ function _createColorFillBars(containerHeight) {
645
+ const colorFillBars = [];
646
+ if (isSelectedLegend) {
647
+ _colorFillBars.current = selectedColorBarLegend;
648
+ } else {
649
+ _colorFillBars.current = props.colorFillBars;
650
+ }
651
+ const yMinMaxValues = (0, _index1.getMinMaxOfYAxis)(_points, _index1.ChartTypes.LineChart);
652
+ const FILL_Y_PADDING = 3;
653
+ for(let i = 0; i < _colorFillBars.current.length; i++){
654
+ const colorFillBar = _colorFillBars.current[i];
655
+ const colorFillBarId = `${_colorFillBarId}-${i}`;
656
+ const color = (0, _index1.getColorFromToken)(colorFillBar.color);
657
+ if (colorFillBar.applyPattern) {
658
+ // Using a pattern element because CSS was unable to render diagonal stripes for rect elements
659
+ colorFillBars.push(_getStripePattern(color, i));
660
+ }
661
+ for(let j = 0; j < colorFillBar.data.length; j++){
662
+ const startX = colorFillBar.data[j].startX;
663
+ const endX = colorFillBar.data[j].endX;
664
+ const opacity = _legendHighlighted(colorFillBar.legend) || _noLegendHighlighted() || isSelectedLegend ? _getColorFillBarOpacity(colorFillBar) : 0.1;
665
+ colorFillBars.push(/*#__PURE__*/ _react.createElement("rect", {
666
+ fill: colorFillBar.applyPattern ? `url(#${_colorFillBarPatternId}_${i})` : color,
667
+ fillOpacity: opacity,
668
+ x: _isRTL ? _xAxisScale(endX) : _xAxisScale(startX),
669
+ y: _yAxisScale(yMinMaxValues.endValue) - FILL_Y_PADDING,
670
+ width: Math.abs(_xAxisScale(endX) - _xAxisScale(startX)),
671
+ height: _yAxisScale(props.yMinValue || 0) - _yAxisScale(yMinMaxValues.endValue) + FILL_Y_PADDING,
672
+ key: `${colorFillBarId}${j}`
673
+ }));
674
+ }
675
+ }
676
+ return colorFillBars;
677
+ }
678
+ function _getStripePattern(color, id) {
679
+ // This describes a tile pattern that resembles diagonal stripes
680
+ // For more information: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d
681
+ const stripePath = 'M-4,4 l8,-8 M0,16 l16,-16 M12,20 l8,-8';
682
+ return /*#__PURE__*/ _react.createElement("pattern", {
683
+ id: `${_colorFillBarPatternId}_${id}`,
684
+ width: 16,
685
+ height: 16,
686
+ key: `${_colorFillBarPatternId}_${id}`,
687
+ patternUnits: 'userSpaceOnUse'
688
+ }, /*#__PURE__*/ _react.createElement("path", {
689
+ d: stripePath,
690
+ stroke: color,
691
+ strokeWidth: 1.25
692
+ }));
693
+ }
694
+ function _checkInGap(pointIndex, gaps, currentGapIndex) {
695
+ let gapIndex = currentGapIndex;
696
+ let isInGap = false;
697
+ while(gapIndex < gaps.length && pointIndex > gaps[gapIndex].endIndex){
698
+ gapIndex++;
699
+ }
700
+ if (gapIndex < gaps.length && pointIndex > gaps[gapIndex].startIndex && pointIndex <= gaps[gapIndex].endIndex) {
701
+ isInGap = true;
702
+ }
703
+ return {
704
+ isInGap,
705
+ gapIndex
706
+ };
707
+ }
708
+ function _refCallback(element, legendTitle) {
709
+ _refArray.push({
710
+ index: legendTitle,
711
+ refElement: element
712
+ });
713
+ }
714
+ const _onMouseOverLargeDataset = (linenumber, lineHeight, mouseEvent)=>{
715
+ mouseEvent.persist();
716
+ const { data } = props;
717
+ const { lineChartData } = data;
718
+ // This will get the value of the X when mouse is on the chart
719
+ const xOffset = _xAxisScale.invert((0, _d3selection.pointer)(mouseEvent)[0], document.getElementById(_rectId));
720
+ const i = bisect(lineChartData[linenumber].data, xOffset);
721
+ const d0 = lineChartData[linenumber].data[i - 1];
722
+ const d1 = lineChartData[linenumber].data[i];
723
+ let axisType = null;
724
+ let xPointToHighlight = 0;
725
+ let index = null;
726
+ if (d0 === undefined && d1 !== undefined) {
727
+ xPointToHighlight = d1.x;
728
+ index = i;
729
+ } else if (d0 !== undefined && d1 === undefined) {
730
+ xPointToHighlight = d0.x;
731
+ index = i - 1;
732
+ } else {
733
+ axisType = (0, _index1.getTypeOfAxis)(lineChartData[linenumber].data[0].x, true);
734
+ let x0;
735
+ let point0;
736
+ let point1;
737
+ switch(axisType){
738
+ case _index1.XAxisTypes.DateAxis:
739
+ x0 = new Date(xOffset).getTime();
740
+ point0 = d0.x.getTime();
741
+ point1 = d1.x.getTime();
742
+ xPointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;
743
+ index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;
744
+ break;
745
+ case _index1.XAxisTypes.NumericAxis:
746
+ x0 = xOffset;
747
+ point0 = d0.x;
748
+ point1 = d1.x;
749
+ xPointToHighlight = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? d1.x : d0.x;
750
+ index = Math.abs(x0 - point0) > Math.abs(x0 - point1) ? i : i - 1;
751
+ break;
752
+ default:
753
+ break;
754
+ }
755
+ }
756
+ const { xAxisCalloutData } = lineChartData[linenumber].data[index];
757
+ const formattedDate = xPointToHighlight instanceof Date ? (0, _index1.formatDate)(xPointToHighlight, props.useUTC) : xPointToHighlight;
758
+ const modifiedXVal = xPointToHighlight instanceof Date ? xPointToHighlight.getTime() : xPointToHighlight;
759
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
760
+ const found = (0, _index1.find)(_calloutPoints, (element)=>{
761
+ return element.x === modifiedXVal;
762
+ });
763
+ const pointToHighlight = lineChartData[linenumber].data[index];
764
+ const pointToHighlightUpdated = nearestCircleToHighlight === null || nearestCircleToHighlight !== null && pointToHighlight !== null && (nearestCircleToHighlight.x !== pointToHighlight.x || nearestCircleToHighlight.y !== pointToHighlight.y);
765
+ // if no points need to be called out then don't show vertical line and callout card
766
+ if (found && pointToHighlightUpdated) {
767
+ _uniqueCallOutID = `#${_staticHighlightCircle}_${linenumber}`;
768
+ (0, _d3selection.select)(`#${_staticHighlightCircle}_${linenumber}`).attr('cx', `${_xAxisScale(pointToHighlight.x)}`).attr('cy', `${_yAxisScale(pointToHighlight.y)}`).attr('visibility', 'visibility');
769
+ (0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(pointToHighlight.x)}, ${_yAxisScale(pointToHighlight.y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - _yAxisScale(pointToHighlight.y)}`);
770
+ setNearestCircleToHighlight(pointToHighlight);
771
+ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
772
+ setStackCalloutProps(found);
773
+ setYValueHover(found.values);
774
+ setDataPointCalloutProps(found);
775
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue(formattedDate);
776
+ setActivePoint('');
777
+ }
778
+ if (!found) {
779
+ setPopoverOpen(false);
780
+ setNearestCircleToHighlight(pointToHighlight);
781
+ setActivePoint('');
782
+ }
783
+ };
784
+ function _handleFocus(lineId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
785
+ _uniqueCallOutID = circleId;
786
+ const formattedData = x instanceof Date ? (0, _index1.formatDate)(x, props.useUTC) : x;
787
+ const xVal = x instanceof Date ? x.getTime() : x;
788
+ const found = (0, _index1.find)(_calloutPoints, (element)=>element.x === xVal);
789
+ // if no points need to be called out then don't show vertical line and callout card
790
+ if (found) {
791
+ (0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, 0)`).attr('visibility', 'visibility');
792
+ _refArray.forEach((obj)=>{
793
+ if (obj.index === lineId) {
794
+ setPopoverOpen(true);
795
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
796
+ setYValueHover(found.values);
797
+ setStackCalloutProps(found);
798
+ setDataPointCalloutProps(found);
799
+ setActivePoint(circleId);
800
+ }
801
+ });
802
+ } else {
803
+ setActivePoint(circleId);
804
+ }
805
+ }
806
+ function _handleHover(x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
807
+ mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
808
+ const formattedData = x instanceof Date ? (0, _index1.formatDate)(x, props.useUTC) : x;
809
+ const xVal = x instanceof Date ? x.getTime() : x;
810
+ const found = (0, _index1.find)(_calloutPoints, (element)=>element.x === xVal);
811
+ // if no points need to be called out then don't show vertical line and callout card
812
+ if (found) {
813
+ (0, _d3selection.select)(`#${_verticalLine}`).attr('transform', ()=>`translate(${_xAxisScale(x)}, ${_yAxisScale(y)})`).attr('visibility', 'visibility').attr('y2', `${lineHeight - _yAxisScale(y)}`);
814
+ if (_uniqueCallOutID !== circleId) {
815
+ _uniqueCallOutID = circleId;
816
+ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
817
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
818
+ setYValueHover(found.values);
819
+ setStackCalloutProps(found);
820
+ setDataPointCalloutProps(found);
821
+ setActivePoint(circleId);
822
+ setNearestCircleToHighlight(null);
823
+ }
824
+ } else {
825
+ setActivePoint(circleId);
826
+ setNearestCircleToHighlight(null);
827
+ }
828
+ }
829
+ /**
830
+ * Screen readers announce an element as clickable if the onClick attribute is set.
831
+ * This function sets the attribute only when a click event handler is provided.*/ function _getClickHandler(func) {
832
+ if (func) {
833
+ return {
834
+ onClick: func
835
+ };
836
+ }
837
+ return {};
838
+ }
839
+ function _handleMouseOut() {
840
+ (0, _d3selection.select)(`#${_verticalLine}`).attr('visibility', 'hidden');
841
+ }
842
+ function _handleChartMouseLeave() {
843
+ _uniqueCallOutID = null;
844
+ setActivePoint('');
845
+ if (isPopoverOpen) {
846
+ setPopoverOpen(false);
847
+ }
848
+ }
849
+ function _handleMultipleLineLegendSelectionAction(selectedLine) {
850
+ const selectedLineIndex = selectedLegendPoints.reduce((acc, line, index)=>{
851
+ if (acc > -1 || line.legend !== selectedLine.legend) {
852
+ return acc;
853
+ } else {
854
+ return index;
855
+ }
856
+ }, -1);
857
+ let selectedLines;
858
+ if (selectedLineIndex === -1) {
859
+ selectedLines = [
860
+ ...selectedLegendPoints,
861
+ selectedLine
862
+ ];
863
+ } else {
864
+ selectedLines = selectedLegendPoints.slice(0, selectedLineIndex).concat(selectedLegendPoints.slice(selectedLineIndex + 1));
865
+ }
866
+ const areAllLineLegendsSelected = props.data && selectedLines.length === props.data.lineChartData.length;
867
+ if (areAllLineLegendsSelected && (props.colorFillBars && props.colorFillBars.length === selectedColorBarLegend.length || !props.colorFillBars)) {
868
+ // Clear all legends if all legends including color fill bar legends are selected
869
+ // Or clear all legends if all legends are selected and there are no color fill bars
870
+ _clearMultipleLegendSelections();
871
+ } else if (!selectedLines.length && !selectedColorBarLegend.length) {
872
+ // Clear all legends if no legends including color fill bar legends are selected
873
+ _clearMultipleLegendSelections();
874
+ } else {
875
+ // Otherwise, set state when one or more legends are selected, including color fill bar legends
876
+ setSelectedLegendPoints(selectedLines);
877
+ setIsSelectedLegend(true);
878
+ }
879
+ const selectedLegendTitlesToPass = selectedLines.map((line)=>line.legend);
880
+ _handleLegendClick(selectedLine, selectedLegendTitlesToPass);
881
+ }
882
+ function _handleMultipleColorFillBarLegendSelectionAction(selectedColorFillBar) {
883
+ const selectedColorFillBarIndex = selectedColorBarLegend.reduce((acc, colorFillBar, index)=>{
884
+ if (acc > -1 || colorFillBar.legend !== selectedColorFillBar.legend) {
885
+ return acc;
886
+ } else {
887
+ return index;
888
+ }
889
+ }, -1);
890
+ let selectedColorFillBars;
891
+ if (selectedColorFillBarIndex === -1) {
892
+ selectedColorFillBars = [
893
+ ...selectedColorBarLegend,
894
+ selectedColorFillBar
895
+ ];
896
+ } else {
897
+ selectedColorFillBars = selectedColorBarLegend.slice(0, selectedColorFillBarIndex).concat(selectedColorBarLegend.slice(selectedColorFillBarIndex + 1));
898
+ }
899
+ const areAllColorFillBarLegendsSelected = selectedColorFillBars.length === (props.colorFillBars && props.colorFillBars.length);
900
+ if (areAllColorFillBarLegendsSelected && (props.data && props.data.lineChartData.length === selectedLegendPoints.length || !props.data)) {
901
+ // Clear all legends if all legends, including line legends, are selected
902
+ // Or clear all legends if all legends are selected and there is no line data
903
+ _clearMultipleLegendSelections();
904
+ } else if (!selectedColorFillBars.length && !selectedLegendPoints.length) {
905
+ // Clear all legends if no legends are selected, including line legends
906
+ _clearMultipleLegendSelections();
907
+ } else {
908
+ // set state when one or more legends are selected, including line legends
909
+ setSelectedColorBarLegend(selectedColorFillBars);
910
+ setIsSelectedLegend(true);
911
+ }
912
+ const selectedLegendTitlesToPass = selectedColorFillBars.map((colorFillBar)=>colorFillBar.legend);
913
+ _handleLegendClick(selectedColorFillBar, selectedLegendTitlesToPass);
914
+ }
915
+ function _clearMultipleLegendSelections() {
916
+ setSelectedColorBarLegend([]);
917
+ setSelectedLegendPoints([]);
918
+ setIsSelectedLegend(false);
919
+ }
920
+ /**
921
+ * This function checks if the given legend is highlighted or not.
922
+ * A legend can be highlighted in 2 ways:
923
+ * 1. selection: if the user clicks on it
924
+ * 2. hovering: if there is no selected legend and the user hovers over it*/ function _legendHighlighted(legend) {
925
+ return selectedLegend === legend || selectedLegend === '' && activeLegend === legend;
926
+ }
927
+ /**
928
+ * This function checks if none of the legends is selected or hovered.*/ function _noLegendHighlighted() {
929
+ return selectedLegend === '' && activeLegend === '';
930
+ }
931
+ function _getColorFillBarOpacity(colorFillBar) {
932
+ return colorFillBar.applyPattern ? 1 : 0.4;
933
+ }
934
+ function _getAriaLabel(lineIndex, pointIndex) {
935
+ var _point_callOutAccessibilityData;
936
+ const line = _points[lineIndex];
937
+ const point = line.data[pointIndex];
938
+ const formattedDate = point.x instanceof Date ? (0, _index1.formatDate)(point.x, props.useUTC) : point.x;
939
+ const xValue = point.xAxisCalloutData || formattedDate;
940
+ const legend = line.legend;
941
+ const yValue = point.yAxisCalloutData || point.y;
942
+ return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ${legend}, ${yValue}.`;
943
+ }
944
+ function _isChartEmpty() {
945
+ return !(props.data && props.data.lineChartData && props.data.lineChartData.length > 0 && props.data.lineChartData.filter((item)=>item.data.length).length > 0);
946
+ }
947
+ const { legendProps, tickValues, tickFormat, eventAnnotationProps } = props;
948
+ _points = _injectIndexPropertyInLineChartData(props.data.lineChartData);
949
+ const isXAxisDateType = (0, _index1.getXAxisType)(_points);
950
+ let points = _points;
951
+ if (legendProps && !!legendProps.canSelectMultipleLegends) {
952
+ points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points;
953
+ _calloutPoints = (0, _index1.calloutData)(points);
954
+ }
955
+ let legendBars = null;
956
+ // reduce computation cost by only creating legendBars
957
+ // if when hideLegend is false.
958
+ // NOTE: they are rendered only when hideLegend is false in CartesianChart.
959
+ if (!props.hideLegend) {
960
+ legendBars = _createLegends(_points); // ToDo: Memoize legends to improve performance.
961
+ }
962
+ var _props_culture;
963
+ const calloutProps = {
964
+ YValueHover: YValueHover,
965
+ hoverXValue: hoverXValue,
966
+ descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps ? props.getCalloutDescriptionMessage(stackCalloutProps) : undefined,
967
+ 'data-is-focusable': true,
968
+ xAxisCalloutAccessibilityData: xAxisCalloutAccessibilityData,
969
+ ...props.calloutProps,
970
+ clickPosition: clickPosition,
971
+ isPopoverOpen: isPopoverOpen,
972
+ isCalloutForStack: true,
973
+ culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
974
+ isCartesian: true,
975
+ customCallout: {
976
+ customizedCallout: _getCustomizedCallout() !== null ? _getCustomizedCallout() : undefined,
977
+ customCalloutProps: props.calloutPropsPerDataPoint ? props.calloutPropsPerDataPoint(dataPointCalloutProps) : undefined
978
+ }
979
+ };
980
+ const tickParams = {
981
+ tickValues,
982
+ tickFormat
983
+ };
984
+ return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement(_index2.CartesianChart, {
985
+ ...props,
986
+ chartTitle: props.data.chartTitle,
987
+ points: points,
988
+ chartType: _index1.ChartTypes.LineChart,
989
+ calloutProps: calloutProps,
990
+ tickParams: tickParams,
991
+ legendBars: legendBars,
992
+ getmargins: _getMargins,
993
+ getGraphData: _initializeLineChartData,
994
+ xAxisType: isXAxisDateType ? _index1.XAxisTypes.DateAxis : _index1.XAxisTypes.NumericAxis,
995
+ onChartMouseLeave: _handleChartMouseLeave,
996
+ enableFirstRenderOptimization: props.enablePerfOptimization && _firstRenderOptimization,
997
+ componentRef: cartesianChartRef,
998
+ /* eslint-disable react/jsx-no-bind */ // eslint-disable-next-line react/no-children-prop
999
+ children: (props)=>{
1000
+ _xAxisScale = props.xScale;
1001
+ _yAxisScale = props.yScale;
1002
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement("g", null, /*#__PURE__*/ _react.createElement("line", {
1003
+ x1: 0,
1004
+ y1: 0,
1005
+ x2: 0,
1006
+ y2: props.containerHeight,
1007
+ stroke: '#323130',
1008
+ id: _verticalLine,
1009
+ visibility: 'hidden',
1010
+ strokeDasharray: '5,5'
1011
+ }), props.optimizeLargeData ? /*#__PURE__*/ _react.createElement("rect", {
1012
+ id: _rectId,
1013
+ width: props.containerWidth,
1014
+ height: props.containerHeight,
1015
+ fill: 'transparent'
1016
+ }) : /*#__PURE__*/ _react.createElement(_react.Fragment, null), /*#__PURE__*/ _react.createElement("g", null, _renderedColorFillBars, lines), eventAnnotationProps && /*#__PURE__*/ _react.createElement(_EventAnnotation.EventsAnnotation, {
1017
+ ...eventAnnotationProps,
1018
+ scale: props.xScale,
1019
+ chartYTop: margins.top + eventLabelHeight,
1020
+ chartYBottom: props.containerHeight - 35
1021
+ })));
1022
+ }
1023
+ }) : /*#__PURE__*/ _react.createElement("div", {
1024
+ id: _emptyChartId,
1025
+ role: 'alert',
1026
+ style: {
1027
+ opacity: '0'
1028
+ },
1029
+ "aria-label": 'Graph has no data to display'
1030
+ });
1031
+ });
1032
+ LineChart.displayName = 'LineChart';