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