@fluentui/react-charts 9.3.4 → 9.3.6

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 (309) hide show
  1. package/CHANGELOG.md +41 -2
  2. package/dist/index.d.ts +225 -46
  3. package/lib/AnnotationOnlyChart.js +1 -0
  4. package/lib/AnnotationOnlyChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +208 -0
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  7. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +1 -0
  8. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  9. package/lib/components/AnnotationOnlyChart/index.js +2 -0
  10. package/lib/components/AnnotationOnlyChart/index.js.map +1 -0
  11. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +31 -0
  12. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
  13. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +23 -0
  14. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
  15. package/lib/components/AreaChart/useAreaChartStyles.styles.js +11 -6
  16. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  17. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
  18. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  19. package/lib/components/ChartTable/ChartTable.js +3 -1
  20. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  21. package/lib/components/ChartTable/useChartTableStyles.styles.js +59 -39
  22. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  23. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +5 -5
  24. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  25. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +617 -0
  26. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  27. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +1 -0
  28. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  29. package/lib/components/CommonComponents/Annotations/index.js +2 -0
  30. package/lib/components/CommonComponents/Annotations/index.js.map +1 -0
  31. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +173 -0
  32. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
  33. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +126 -0
  34. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
  35. package/lib/components/CommonComponents/CartesianChart.js +182 -153
  36. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  37. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  38. package/lib/components/CommonComponents/index.js +2 -0
  39. package/lib/components/CommonComponents/index.js.map +1 -1
  40. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +29 -13
  41. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  42. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +14 -1
  43. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  44. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +2 -6
  45. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  46. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +3 -2
  47. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  48. package/lib/components/DeclarativeChart/DeclarativeChart.js +42 -25
  49. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  50. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  51. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +635 -38
  52. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  53. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +23 -8
  54. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  55. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +2 -2
  56. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  57. package/lib/components/DonutChart/DonutChart.js +12 -7
  58. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  59. package/lib/components/DonutChart/useDonutChartStyles.styles.js +2 -2
  60. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  61. package/lib/components/FunnelChart/FunnelChart.js +5 -5
  62. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  63. package/lib/components/GanttChart/GanttChart.js +3 -3
  64. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  65. package/lib/components/GanttChart/GanttChart.types.js.map +1 -1
  66. package/lib/components/GanttChart/useGanttChartStyles.styles.js +3 -1
  67. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  68. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
  69. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  70. package/lib/components/GaugeChart/GaugeChart.js +3 -1
  71. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  72. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  73. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  74. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +11 -6
  75. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  76. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
  77. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  78. package/lib/components/HeatMapChart/HeatMapChart.js +6 -6
  79. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  80. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  81. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
  82. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  83. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
  84. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  85. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +3 -1
  86. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  87. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +25 -12
  88. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  89. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +4 -4
  90. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  91. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
  92. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  93. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  94. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
  95. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  96. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
  97. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  98. package/lib/components/Legends/Legends.js +3 -1
  99. package/lib/components/Legends/Legends.js.map +1 -1
  100. package/lib/components/Legends/Legends.types.js.map +1 -1
  101. package/lib/components/Legends/useLegendsStyles.styles.js +97 -37
  102. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
  103. package/lib/components/Legends/useLegendsStyles.styles.raw.js +10 -11
  104. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  105. package/lib/components/LineChart/LineChart.js +6 -5
  106. package/lib/components/LineChart/LineChart.js.map +1 -1
  107. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  108. package/lib/components/LineChart/useLineChartStyles.styles.js +15 -10
  109. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  110. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
  111. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  112. package/lib/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
  113. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  114. package/lib/components/SankeyChart/SankeyChart.js +1 -1
  115. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  116. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +13 -10
  117. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  118. package/lib/components/ScatterChart/ScatterChart.js +1 -1
  119. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  120. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  121. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +13 -8
  122. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  123. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
  124. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  125. package/lib/components/VerticalBarChart/VerticalBarChart.js +4 -2
  126. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  127. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +13 -8
  128. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  129. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
  130. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  131. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +13 -5
  132. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  133. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  134. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +11 -6
  135. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  136. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
  137. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  138. package/lib/index.js +1 -0
  139. package/lib/index.js.map +1 -1
  140. package/lib/types/ChartAnnotation.js +1 -0
  141. package/lib/types/ChartAnnotation.js.map +1 -0
  142. package/lib/types/index.js +1 -0
  143. package/lib/types/index.js.map +1 -1
  144. package/lib/utilities/Common.styles.js +1 -2
  145. package/lib/utilities/Common.styles.js.map +1 -1
  146. package/lib/utilities/Common.styles.raw.js +1 -2
  147. package/lib/utilities/Common.styles.raw.js.map +1 -1
  148. package/lib/utilities/FocusableTooltipText.js +1 -1
  149. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  150. package/lib/utilities/SVGTooltipText.js +8 -8
  151. package/lib/utilities/SVGTooltipText.js.map +1 -1
  152. package/lib/utilities/image-export-utils.js +108 -0
  153. package/lib/utilities/image-export-utils.js.map +1 -1
  154. package/lib/utilities/utilities.js +16 -13
  155. package/lib/utilities/utilities.js.map +1 -1
  156. package/lib-commonjs/AnnotationOnlyChart.js +6 -0
  157. package/lib-commonjs/AnnotationOnlyChart.js.map +1 -0
  158. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +219 -0
  159. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  160. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +6 -0
  161. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  162. package/lib-commonjs/components/AnnotationOnlyChart/index.js +7 -0
  163. package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +1 -0
  164. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +56 -0
  165. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +1 -0
  166. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +33 -0
  167. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +1 -0
  168. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +14 -15
  169. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  170. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -1
  171. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  172. package/lib-commonjs/components/ChartTable/ChartTable.js +3 -1
  173. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  174. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +74 -102
  175. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  176. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +4 -4
  177. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  178. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +628 -0
  179. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  180. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +4 -0
  181. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  182. package/lib-commonjs/components/CommonComponents/Annotations/index.js +7 -0
  183. package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +1 -0
  184. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +265 -0
  185. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -0
  186. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +161 -0
  187. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -0
  188. package/lib-commonjs/components/CommonComponents/CartesianChart.js +182 -152
  189. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  190. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  191. package/lib-commonjs/components/CommonComponents/index.js +2 -0
  192. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  193. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +32 -21
  194. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  195. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +14 -1
  196. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  197. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +0 -14
  198. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  199. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +2 -1
  200. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  201. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +41 -24
  202. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  203. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  204. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +638 -38
  205. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  206. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +25 -16
  207. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  208. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +1 -1
  209. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  210. package/lib-commonjs/components/DonutChart/DonutChart.js +12 -7
  211. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  212. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +2 -2
  213. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  214. package/lib-commonjs/components/FunnelChart/FunnelChart.js +5 -5
  215. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  216. package/lib-commonjs/components/GanttChart/GanttChart.js +3 -3
  217. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  218. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -1
  219. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +3 -1
  220. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  221. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +3 -1
  222. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  223. package/lib-commonjs/components/GaugeChart/GaugeChart.js +3 -1
  224. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  225. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  226. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  227. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +14 -15
  228. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  229. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +3 -1
  230. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  231. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +6 -6
  232. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  233. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  234. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +3 -1
  235. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  236. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +3 -1
  237. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  238. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +3 -1
  239. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  240. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +47 -34
  241. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  242. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +3 -3
  243. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  244. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
  245. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  246. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  247. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +3 -1
  248. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  249. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +3 -1
  250. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  251. package/lib-commonjs/components/Legends/Legends.js +3 -1
  252. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  253. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  254. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +144 -86
  255. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
  256. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +9 -10
  257. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  258. package/lib-commonjs/components/LineChart/LineChart.js +6 -5
  259. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  260. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  261. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +18 -19
  262. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  263. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +3 -1
  264. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  265. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
  266. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  267. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -1
  268. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  269. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +16 -19
  270. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  271. package/lib-commonjs/components/ScatterChart/ScatterChart.js +1 -1
  272. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  273. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  274. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +16 -17
  275. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  276. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -1
  277. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  278. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +4 -2
  279. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  280. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +16 -17
  281. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  282. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +3 -1
  283. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  284. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +13 -5
  285. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  286. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  287. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +14 -15
  288. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  289. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +3 -1
  290. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  291. package/lib-commonjs/index.js +1 -0
  292. package/lib-commonjs/index.js.map +1 -1
  293. package/lib-commonjs/types/ChartAnnotation.js +6 -0
  294. package/lib-commonjs/types/ChartAnnotation.js.map +1 -0
  295. package/lib-commonjs/types/index.js +1 -0
  296. package/lib-commonjs/types/index.js.map +1 -1
  297. package/lib-commonjs/utilities/Common.styles.js +1 -2
  298. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  299. package/lib-commonjs/utilities/Common.styles.raw.js +1 -2
  300. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  301. package/lib-commonjs/utilities/FocusableTooltipText.js +1 -1
  302. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  303. package/lib-commonjs/utilities/SVGTooltipText.js +8 -8
  304. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  305. package/lib-commonjs/utilities/image-export-utils.js +108 -0
  306. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  307. package/lib-commonjs/utilities/utilities.js +16 -13
  308. package/lib-commonjs/utilities/utilities.js.map +1 -1
  309. package/package.json +11 -11
@@ -16,22 +16,26 @@ const _d3selection = require("d3-selection");
16
16
  const _index = require("../../utilities/index");
17
17
  const _reactutilities = require("@fluentui/react-utilities");
18
18
  const _SVGTooltipText = require("../../utilities/SVGTooltipText");
19
+ const _ChartAnnotationLayer = require("./Annotations/ChartAnnotationLayer");
19
20
  const _ChartPopover = require("./ChartPopover");
20
21
  const _reacttabster = require("@fluentui/react-tabster");
21
- const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
22
- var _props_margins, _props_margins1, _props_margins2, _props_margins3, _props_margins4, _props_margins5;
23
- const chartContainer = _react.useRef();
22
+ const HORIZONTAL_MARGIN_FOR_YAXIS_TITLE = 24;
23
+ const VERTICAL_MARGIN_FOR_XAXIS_TITLE = 20;
24
+ const AXIS_TITLE_PADDING = 8;
25
+ const DEFAULT_MARGIN_WITH_TICKS = 40;
26
+ const DEFAULT_MARGIN_NO_TICKS = 20;
27
+ const CartesianChart = /*#__PURE__*/ _react.forwardRef(({ hideTickOverlap = true, ...props }, forwardedRef)=>{
28
+ const chartContainer = _react.useRef(null);
24
29
  let legendContainer;
25
30
  const minLegendContainerHeight = 40;
26
- const xAxisElement = _react.useRef();
27
- const yAxisElement = _react.useRef();
28
- const yAxisElementSecondary = _react.useRef();
31
+ const xAxisElement = _react.useRef(null);
32
+ const yAxisElement = _react.useRef(null);
33
+ const yAxisElementSecondary = _react.useRef(null);
29
34
  let margins;
30
35
  const idForGraph = 'chart_';
31
36
  let _reqID;
32
37
  const _useRtl = (0, _index.useRtl)();
33
38
  let _tickValues;
34
- const titleMargin = 8;
35
39
  const _isFirstRender = _react.useRef(true);
36
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
41
  let _xScale;
@@ -47,60 +51,12 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
47
51
  * These value need to be removed from actual svg height/graph height.
48
52
  * Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.
49
53
  */ let _removalValueForTextTuncate = 0;
54
+ const _yAxisTickText = _react.useRef([]);
50
55
  const [containerWidth, setContainerWidth] = _react.useState(0);
51
56
  const [containerHeight, setContainerHeight] = _react.useState(0);
52
57
  const [startFromX, setStartFromX] = _react.useState(0);
53
- const [prevProps, setPrevProps] = _react.useState(null);
54
- const chartTypesWithStringYAxis = [
55
- _index.ChartTypes.HorizontalBarChartWithAxis,
56
- _index.ChartTypes.HeatMapChart,
57
- _index.ChartTypes.VerticalStackedBarChart,
58
- _index.ChartTypes.GanttChart,
59
- _index.ChartTypes.ScatterChart
60
- ];
61
- var _props_margins_top, _props_margins_bottom, _props_margins_left, _props_margins_right, _props_margins_right1, _props_margins_left1;
62
- /**
63
- * In RTL mode, Only graph will be rendered left/right. We need to provide left and right margins manually.
64
- * So that, in RTL, left margins becomes right margins and viceversa.
65
- * As graph needs to be drawn perfecty, these values consider as default values.
66
- * Same margins using for all other cartesian charts. Can be accessible through 'getMargins' call back method.
67
- */ // eslint-disable-next-line prefer-const
68
- margins = {
69
- top: (_props_margins_top = (_props_margins = props.margins) === null || _props_margins === void 0 ? void 0 : _props_margins.top) !== null && _props_margins_top !== void 0 ? _props_margins_top : 20,
70
- bottom: (_props_margins_bottom = (_props_margins1 = props.margins) === null || _props_margins1 === void 0 ? void 0 : _props_margins1.bottom) !== null && _props_margins_bottom !== void 0 ? _props_margins_bottom : 35,
71
- right: _useRtl ? (_props_margins_left = (_props_margins2 = props.margins) === null || _props_margins2 === void 0 ? void 0 : _props_margins2.left) !== null && _props_margins_left !== void 0 ? _props_margins_left : 40 : ((_props_margins_right = (_props_margins3 = props.margins) === null || _props_margins3 === void 0 ? void 0 : _props_margins3.right) !== null && _props_margins_right !== void 0 ? _props_margins_right : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20,
72
- left: _useRtl ? ((_props_margins_right1 = (_props_margins4 = props.margins) === null || _props_margins4 === void 0 ? void 0 : _props_margins4.right) !== null && _props_margins_right1 !== void 0 ? _props_margins_right1 : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20 : (_props_margins_left1 = (_props_margins5 = props.margins) === null || _props_margins5 === void 0 ? void 0 : _props_margins5.left) !== null && _props_margins_left1 !== void 0 ? _props_margins_left1 : 40
73
- };
74
- const TITLE_MARGIN_HORIZONTAL = 24;
75
- const TITLE_MARGIN_VERTICAL = 20;
76
- if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
77
- var _props_margins6;
78
- var _props_margins_bottom1;
79
- margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 : margins.bottom + TITLE_MARGIN_VERTICAL;
80
- }
81
- if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
82
- var _props_margins7, _props_margins8, _props_margins9, _props_margins10;
83
- var _props_margins_right2, _props_margins_left2;
84
- margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN_HORIZONTAL : margins.right + TITLE_MARGIN_HORIZONTAL : (_props_margins_left2 = (_props_margins8 = props.margins) === null || _props_margins8 === void 0 ? void 0 : _props_margins8.left) !== null && _props_margins_left2 !== void 0 ? _props_margins_left2 : margins.left + TITLE_MARGIN_HORIZONTAL;
85
- var _props_margins_left3, _props_margins_right3;
86
- margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 : margins.left + TITLE_MARGIN_HORIZONTAL : ((_props_margins_right3 = (_props_margins10 = props.margins) === null || _props_margins10 === void 0 ? void 0 : _props_margins10.right) !== null && _props_margins_right3 !== void 0 ? _props_margins_right3 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN_HORIZONTAL : margins.right + TITLE_MARGIN_HORIZONTAL;
87
- }
88
- if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {
89
- var _props_margins11;
90
- var _props_margins_top1;
91
- margins.top = (_props_margins_top1 = (_props_margins11 = props.margins) === null || _props_margins11 === void 0 ? void 0 : _props_margins11.top) !== null && _props_margins_top1 !== void 0 ? _props_margins_top1 : margins.top + TITLE_MARGIN_VERTICAL;
92
- }
93
- if (props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')) {
94
- if (_useRtl) {
95
- var _props_margins12;
96
- var _props_margins_right4;
97
- margins.left = (_props_margins_right4 = (_props_margins12 = props.margins) === null || _props_margins12 === void 0 ? void 0 : _props_margins12.right) !== null && _props_margins_right4 !== void 0 ? _props_margins_right4 : margins.right + TITLE_MARGIN_HORIZONTAL;
98
- } else {
99
- var _props_margins13;
100
- var _props_margins_right5;
101
- margins.right = (_props_margins_right5 = (_props_margins13 = props.margins) === null || _props_margins13 === void 0 ? void 0 : _props_margins13.right) !== null && _props_margins_right5 !== void 0 ? _props_margins_right5 : margins.right + TITLE_MARGIN_HORIZONTAL;
102
- }
103
- }
58
+ const prevWidthRef = _react.useRef(undefined);
59
+ const prevHeightRef = _react.useRef(undefined);
104
60
  const classes = (0, _useCartesianChartStylesstyles.useCartesianChartStyles)(props);
105
61
  const focusAttributes = (0, _reacttabster.useFocusableGroup)();
106
62
  const arrowAttributes = (0, _reacttabster.useArrowNavigationGroup)({
@@ -109,10 +65,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
109
65
  // ComponentdidMount and Componentwillunmount logic
110
66
  _react.useEffect(()=>{
111
67
  _fitParentContainer();
112
- if (props !== null) {
113
- setPrevProps(props);
114
- }
115
- if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === _index.YAxisType.StringAxis) {
68
+ if (props.showYAxisLables) {
116
69
  const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
117
70
  if (startFromX !== maxYAxisLabelLength) {
118
71
  setStartFromX(maxYAxisLabelLength);
@@ -130,12 +83,14 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
130
83
  ]);
131
84
  // ComponentDidUpdate logic
132
85
  _react.useEffect(()=>{
133
- if (prevProps) {
134
- if (prevProps.height !== props.height || prevProps.width !== props.width) {
135
- _fitParentContainer();
136
- }
86
+ // Check if height or width changed
87
+ if (prevWidthRef.current !== undefined && prevHeightRef.current !== undefined && (prevWidthRef.current !== props.width || prevHeightRef.current !== props.height)) {
88
+ _fitParentContainer();
137
89
  }
138
- if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === _index.YAxisType.StringAxis) {
90
+ // Update refs with current values
91
+ prevWidthRef.current = props.width;
92
+ prevHeightRef.current = props.height;
93
+ if (props.showYAxisLables) {
139
94
  const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
140
95
  if (startFromX !== maxYAxisLabelLength) {
141
96
  setStartFromX(maxYAxisLabelLength);
@@ -144,8 +99,11 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
144
99
  setStartFromX(0);
145
100
  }
146
101
  }, [
147
- props,
148
- prevProps
102
+ props.width,
103
+ props.height,
104
+ props.chartType,
105
+ props.showYAxisLables,
106
+ props.yAxisType
149
107
  ]);
150
108
  _react.useImperativeHandle(props.componentRef, ()=>{
151
109
  var _chartContainer_current;
@@ -170,32 +128,26 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
170
128
  }
171
129
  return str;
172
130
  };
173
- return (0, _index.calculateLongestLabelWidth)(props.stringDatasetForYAxisDomain.map((label)=>formatTickLabel(label)), `.${className} text`);
131
+ return (0, _index.calculateLongestLabelWidth)(_yAxisTickText.current.map((label)=>formatTickLabel(label)), `.${className} text`);
174
132
  }
175
133
  const { calloutProps, points, chartType, svgProps, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter } = props;
176
134
  if (props.parentRef) {
177
135
  _fitParentContainer();
178
136
  }
179
- const margin = {
180
- ...margins
181
- };
182
- // Note: This check is unnecessary since startFromX is only set for charts with string y-axis.
183
- if (chartTypesWithStringYAxis.includes(props.chartType)) {
184
- if (!_useRtl) {
185
- margin.left += startFromX;
186
- } else {
187
- margin.right += startFromX;
188
- }
189
- }
137
+ margins = _calcMargins();
190
138
  // Callback for margins to the chart
191
- props.getmargins && props.getmargins(margin);
139
+ props.getmargins && props.getmargins(margins);
192
140
  let callout = null;
141
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
+ let yScalePrimary;
143
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
+ let yScaleSecondary;
193
145
  let children = null;
194
146
  if (props.enableFirstRenderOptimization && chartContainer.current || !props.enableFirstRenderOptimization) {
195
147
  _isFirstRender.current = false;
196
148
  var _props_showRoundOffXTickValues;
197
149
  const XAxisParams = {
198
- domainNRangeValues: props.getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues, startFromX),
150
+ domainNRangeValues: props.getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues),
199
151
  // FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.
200
152
  // Since the x-axis in HBWA is numeric, it typically doesn't require transformation.
201
153
  // However, if transformation props are enabled, the updated _removalValueForTextTuncate
@@ -213,7 +165,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
213
165
  xAxisInnerPadding: props.xAxisInnerPadding,
214
166
  xAxisOuterPadding: props.xAxisOuterPadding,
215
167
  containerWidth: containerWidth,
216
- hideTickOverlap: props.rotateXAxisLables ? false : props.hideTickOverlap,
168
+ hideTickOverlap: props.rotateXAxisLables ? false : hideTickOverlap,
217
169
  calcMaxLabelWidth: _calcMaxLabelWidthWithTransform,
218
170
  ...props.xAxis
219
171
  };
@@ -265,15 +217,12 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
265
217
  * 1. To create x and y axis
266
218
  * 2. To draw the graph.
267
219
  * For area/line chart using same scales. For other charts, creating their own scales to draw the graph.
268
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
269
- let yScalePrimary;
270
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
271
- let yScaleSecondary;
272
- const axisData = {
273
- yAxisDomainValues: []
220
+ */ const axisData = {
221
+ yAxisDomainValues: [],
222
+ yAxisTickText: []
274
223
  };
275
224
  if (props.yAxisType && props.yAxisType === _index.YAxisType.StringAxis) {
276
- yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth, props.chartType);
225
+ yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, axisData, props.barwidth, props.chartType);
277
226
  } else {
278
227
  // TODO: Since the scale domain values are now computed independently for both the primary and
279
228
  // secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately
@@ -300,42 +249,41 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
300
249
  }
301
250
  yScalePrimary = props.createYAxis(YAxisParams, _useRtl, axisData, isIntegralDataset, chartType, false, props.roundedTicks, props.yScaleType, _useRtl);
302
251
  }
303
- if (chartTypesWithStringYAxis.includes(props.chartType) && props.yAxisType === _index.YAxisType.StringAxis) {
304
- // Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
305
- // of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
306
- // in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)
307
- if (!props.showYAxisLablesTooltip) {
308
- try {
309
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
310
- //eslint-disable-next-line no-empty
311
- } catch (e) {}
312
- }
313
- // Used to display tooltip at y axis labels.
314
- if (props.showYAxisLablesTooltip) {
315
- // To create y axis tick values by if specified truncating the rest of the text
316
- // and showing elipsis or showing the whole string,
317
- yScalePrimary && // Note: This function should be invoked within the showYAxisLablesTooltip check,
318
- // as its sole purpose is to truncate labels that exceed the noOfCharsToTruncate limit.
319
- (0, _index.createYAxisLabels)(yAxisElement.current, yScalePrimary, props.noOfCharsToTruncate || 4, props.showYAxisLablesTooltip || false, _useRtl);
320
- const _yAxisElement = (0, _d3selection.select)(yAxisElement.current).call(yScalePrimary);
321
- try {
322
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
323
- //eslint-disable-next-line no-empty
324
- } catch (e) {}
325
- const ytooltipProps = {
326
- tooltipCls: classes.tooltip,
327
- id: _tooltipId,
328
- axis: _yAxisElement
329
- };
330
- _yAxisElement && (0, _index.tooltipOfAxislabels)(ytooltipProps);
331
- }
252
+ _yAxisTickText.current = axisData.yAxisTickText;
253
+ props.getAxisData && props.getAxisData(axisData);
254
+ // Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
255
+ // of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
256
+ // in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)
257
+ if (!props.showYAxisLablesTooltip) {
258
+ try {
259
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
260
+ //eslint-disable-next-line no-empty
261
+ } catch (e) {}
262
+ }
263
+ // Used to display tooltip at y axis labels.
264
+ if (props.showYAxisLablesTooltip) {
265
+ // To create y axis tick values by if specified truncating the rest of the text
266
+ // and showing elipsis or showing the whole string,
267
+ yScalePrimary && // Note: This function should be invoked within the showYAxisLablesTooltip check,
268
+ // as its sole purpose is to truncate labels that exceed the noOfCharsToTruncate limit.
269
+ (0, _index.createYAxisLabels)(yAxisElement.current, yScalePrimary, props.noOfCharsToTruncate || 4, props.showYAxisLablesTooltip || false, _useRtl);
270
+ const _yAxisElement = (0, _d3selection.select)(yAxisElement.current).call(yScalePrimary);
271
+ try {
272
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
273
+ //eslint-disable-next-line no-empty
274
+ } catch (e) {}
275
+ const ytooltipProps = {
276
+ tooltipCls: classes.tooltip,
277
+ id: _tooltipId,
278
+ axis: _yAxisElement
279
+ };
280
+ _yAxisElement && (0, _index.tooltipOfAxislabels)(ytooltipProps);
332
281
  }
333
282
  // Call back to the chart.
334
283
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
335
284
  const _getData = (xScale, yScalePrimary, yScaleSecondary)=>{
336
285
  props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight - _removalValueForTextTuncate, containerWidth, xAxisElement.current, yAxisElement.current, yScaleSecondary);
337
286
  };
338
- props.getAxisData && props.getAxisData(axisData);
339
287
  // Callback function for chart, returns axis
340
288
  _getData(xScale, yScalePrimary, yScaleSecondary);
341
289
  children = props.children({
@@ -353,8 +301,30 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
353
301
  width: containerWidth,
354
302
  height: containerHeight
355
303
  };
356
- const xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left - margins.right - startFromX;
357
- const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top - _removalValueForTextTuncate - titleMargin;
304
+ const plotWidth = Math.max(0, svgDimensions.width - margins.left - margins.right);
305
+ const plotHeight = Math.max(0, svgDimensions.height - margins.top - margins.bottom - _removalValueForTextTuncate);
306
+ const plotRect = {
307
+ x: margins.left,
308
+ y: margins.top,
309
+ width: plotWidth,
310
+ height: plotHeight
311
+ };
312
+ var _props_annotations;
313
+ const annotations = (_props_annotations = props.annotations) !== null && _props_annotations !== void 0 ? _props_annotations : [];
314
+ const hasAnnotations = annotations.length > 0;
315
+ const annotationContext = hasAnnotations ? {
316
+ plotRect,
317
+ svgRect: svgDimensions,
318
+ isRtl: _useRtl,
319
+ xScale: _xScale,
320
+ yScalePrimary,
321
+ yScaleSecondary
322
+ } : undefined;
323
+ const xAxisTitleMaxWidth = svgDimensions.width - margins.left - margins.right - AXIS_TITLE_PADDING * 2;
324
+ const yAxisTitleMaxHeight = svgDimensions.height - margins.bottom - margins.top - _removalValueForTextTuncate - AXIS_TITLE_PADDING * 2;
325
+ const yAxisTitleCenterY = margins.top + AXIS_TITLE_PADDING + yAxisTitleMaxHeight / 2;
326
+ const yAxisTitleCenterX = _useRtl ? svgDimensions.width - AXIS_TITLE_PADDING : HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING;
327
+ const secondaryYAxisTitleCenterX = _useRtl ? HORIZONTAL_MARGIN_FOR_YAXIS_TITLE - AXIS_TITLE_PADDING : svgDimensions.width - AXIS_TITLE_PADDING;
358
328
  const commonSvgToolTipProps = {
359
329
  wrapContent: _index.wrapContent,
360
330
  showBackground: true,
@@ -474,6 +444,64 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
474
444
  _removalValueForTextTuncate = rotatedHeight + margins.bottom;
475
445
  }
476
446
  }
447
+ function _calcMargins() {
448
+ let _margins = _getDefaultMargins();
449
+ _margins = _applyTitleMargins(_margins);
450
+ _margins = _applyAnnotationMargins(_margins);
451
+ if (_useRtl) {
452
+ _margins = _swapRtlMargins(_margins);
453
+ }
454
+ return {
455
+ ..._margins,
456
+ ...props.margins
457
+ };
458
+ }
459
+ function _getDefaultMargins() {
460
+ return {
461
+ top: DEFAULT_MARGIN_NO_TICKS,
462
+ // Smaller than the default because it is based on the line height rather than
463
+ // the length of the tick labels.
464
+ bottom: DEFAULT_MARGIN_WITH_TICKS - 5,
465
+ // For the actual margin, add the tick size, tick padding, and some extra space to
466
+ // the width of the longest yaxis tick label (startFromX).
467
+ left: Math.max(DEFAULT_MARGIN_WITH_TICKS, startFromX + 20),
468
+ right: props.secondaryYScaleOptions ? DEFAULT_MARGIN_WITH_TICKS : DEFAULT_MARGIN_NO_TICKS
469
+ };
470
+ }
471
+ function _applyTitleMargins(_margins) {
472
+ const updated = {
473
+ ..._margins
474
+ };
475
+ if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
476
+ updated.bottom += VERTICAL_MARGIN_FOR_XAXIS_TITLE;
477
+ }
478
+ if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
479
+ updated.left += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;
480
+ }
481
+ if (props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '') {
482
+ updated.right += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;
483
+ }
484
+ return updated;
485
+ }
486
+ function _applyAnnotationMargins(_margins) {
487
+ const updated = {
488
+ ..._margins
489
+ };
490
+ if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {
491
+ updated.top += VERTICAL_MARGIN_FOR_XAXIS_TITLE;
492
+ }
493
+ if (props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')) {
494
+ updated.right += HORIZONTAL_MARGIN_FOR_YAXIS_TITLE;
495
+ }
496
+ return updated;
497
+ }
498
+ function _swapRtlMargins(_margins) {
499
+ return {
500
+ ..._margins,
501
+ left: _margins.right,
502
+ right: _margins.left
503
+ };
504
+ }
477
505
  /**
478
506
  * We have use the {@link defaultTabbableElement } to fix
479
507
  * the Focus not landing on chart while tabbing, instead goes to legend.
@@ -496,7 +524,9 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
496
524
  id: idForGraph,
497
525
  className: classes.root,
498
526
  role: 'presentation',
499
- ref: (rootElem)=>chartContainer.current = rootElem,
527
+ ref: (rootElem)=>{
528
+ chartContainer.current = rootElem;
529
+ },
500
530
  onMouseLeave: _onChartLeave
501
531
  }, /*#__PURE__*/ _react.createElement("div", {
502
532
  className: classes.chartWrapper,
@@ -523,82 +553,82 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
523
553
  ...commonSvgToolTipProps,
524
554
  content: props.xAxisTitle,
525
555
  textProps: {
526
- x: margins.left + startFromX + xAxisTitleMaximumAllowedWidth / 2,
527
- y: svgDimensions.height - titleMargin,
556
+ x: margins.left + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,
557
+ y: svgDimensions.height - AXIS_TITLE_PADDING,
528
558
  className: classes.axisTitle,
529
559
  textAnchor: 'middle'
530
560
  },
531
- maxWidth: xAxisTitleMaximumAllowedWidth
561
+ maxWidth: xAxisTitleMaxWidth
532
562
  }), props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
533
563
  ...commonSvgToolTipProps,
534
564
  content: props.xAxisAnnotation,
535
565
  textProps: {
536
- x: margins.left + startFromX + xAxisTitleMaximumAllowedWidth / 2,
537
- y: titleMargin + 3,
566
+ x: margins.left + AXIS_TITLE_PADDING + xAxisTitleMaxWidth / 2,
567
+ y: VERTICAL_MARGIN_FOR_XAXIS_TITLE - AXIS_TITLE_PADDING,
538
568
  className: classes.axisAnnotation,
539
569
  textAnchor: 'middle',
540
570
  'aria-hidden': true
541
571
  },
542
- maxWidth: xAxisTitleMaximumAllowedWidth
572
+ maxWidth: xAxisTitleMaxWidth
543
573
  }), /*#__PURE__*/ _react.createElement("g", {
544
574
  ref: (e)=>{
545
575
  yAxisElement.current = e;
546
576
  },
547
577
  id: `yAxisGElement${idForGraph}`,
548
- transform: `translate(${_useRtl ? svgDimensions.width - margins.right - startFromX : margins.left + startFromX}, 0)`,
578
+ transform: `translate(${_useRtl ? svgDimensions.width - margins.right : margins.left}, 0)`,
549
579
  className: classes.yAxis
550
580
  }), props.secondaryYScaleOptions && /*#__PURE__*/ _react.createElement("g", null, /*#__PURE__*/ _react.createElement("g", {
551
581
  ref: (e)=>{
552
582
  yAxisElementSecondary.current = e;
553
583
  },
554
584
  id: `yAxisGElementSecondary${idForGraph}`,
555
- transform: `translate(${_useRtl ? margins.left + startFromX : svgDimensions.width - margins.right - startFromX}, 0)`,
585
+ transform: `translate(${_useRtl ? margins.left : svgDimensions.width - margins.right}, 0)`,
556
586
  className: classes.yAxis
557
587
  }), props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
558
588
  ...commonSvgToolTipProps,
559
589
  content: props.secondaryYAxistitle,
560
590
  textProps: {
561
- x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
562
- y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
591
+ x: secondaryYAxisTitleCenterX,
592
+ y: yAxisTitleCenterY,
563
593
  textAnchor: 'middle',
564
- transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
565
- ${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
594
+ transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,
566
595
  className: classes.axisTitle
567
596
  },
568
- maxWidth: yAxisTitleMaximumAllowedHeight
597
+ maxWidth: yAxisTitleMaxHeight
569
598
  })), children, props.yAxisTitle !== undefined && props.yAxisTitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
570
599
  ...commonSvgToolTipProps,
571
600
  content: props.yAxisTitle,
572
601
  textProps: {
573
- x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
574
- y: _useRtl ? svgDimensions.width - margins.right / 2 + titleMargin : margins.left / 2 - titleMargin,
602
+ x: yAxisTitleCenterX,
603
+ y: yAxisTitleCenterY,
575
604
  textAnchor: 'middle',
576
- transform: `translate(0,
577
- ${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
605
+ transform: `rotate(-90, ${yAxisTitleCenterX}, ${yAxisTitleCenterY})`,
578
606
  className: classes.axisTitle
579
607
  },
580
- maxWidth: yAxisTitleMaximumAllowedHeight
608
+ maxWidth: yAxisTitleMaxHeight
581
609
  }), props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
582
610
  ...commonSvgToolTipProps,
583
611
  content: props.yAxisAnnotation,
584
612
  textProps: {
585
- x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
586
- y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
613
+ x: secondaryYAxisTitleCenterX,
614
+ y: yAxisTitleCenterY,
587
615
  textAnchor: 'middle',
588
- transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
589
- ${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
616
+ transform: `rotate(-90, ${secondaryYAxisTitleCenterX}, ${yAxisTitleCenterY})`,
590
617
  className: classes.axisAnnotation,
591
618
  'aria-hidden': true
592
619
  },
593
- maxWidth: yAxisTitleMaximumAllowedHeight
594
- }))), !props.hideLegend && /*#__PURE__*/ _react.createElement("div", {
595
- ref: (e)=>legendContainer = e,
620
+ maxWidth: yAxisTitleMaxHeight
621
+ })), hasAnnotations && annotationContext && /*#__PURE__*/ _react.createElement(_ChartAnnotationLayer.ChartAnnotationLayer, {
622
+ annotations: annotations,
623
+ context: annotationContext,
624
+ className: classes.annotationLayer
625
+ })), !props.hideLegend && /*#__PURE__*/ _react.createElement("div", {
626
+ ref: (e)=>{
627
+ legendContainer = e;
628
+ },
596
629
  className: classes.legendContainer
597
630
  }, props.legendBars), callout && /*#__PURE__*/ _react.createElement(_react.Suspense, {
598
631
  fallback: /*#__PURE__*/ _react.createElement("div", null, "Loading...")
599
632
  }, callout));
600
633
  });
601
634
  CartesianChart.displayName = 'CartesianChart';
602
- CartesianChart.defaultProps = {
603
- hideTickOverlap: true
604
- };