@fluentui/react-charting 5.25.5 → 5.25.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 (344) hide show
  1. package/CHANGELOG.json +60 -1
  2. package/CHANGELOG.md +17 -2
  3. package/bundle-size/PolarChart.fixture.js +7 -0
  4. package/dist/react-charting.d.ts +388 -1
  5. package/dist/react-charting.js +1 -1
  6. package/dist/react-charting.min.js +1 -1
  7. package/etc/react-charting.api.md +85 -1
  8. package/lib/PolarChart.d.ts +1 -0
  9. package/lib/PolarChart.js +2 -0
  10. package/lib/PolarChart.js.map +1 -0
  11. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  12. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  13. package/lib/components/AreaChart/AreaChart.base.d.ts +0 -1
  14. package/lib/components/AreaChart/AreaChart.base.js +2 -31
  15. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  16. package/lib/components/ChartTable/ChartTable.base.js +12 -4
  17. package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
  18. package/lib/components/ChartTable/ChartTable.styles.js +3 -0
  19. package/lib/components/ChartTable/ChartTable.styles.js.map +1 -1
  20. package/lib/components/ChartTable/ChartTable.types.d.ts +11 -0
  21. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  22. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  23. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  24. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  25. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  26. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  27. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  28. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  29. package/lib/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  30. package/lib/components/CommonComponents/CartesianChart.base.js +82 -42
  31. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  32. package/lib/components/CommonComponents/CartesianChart.styles.js +31 -27
  33. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  34. package/lib/components/CommonComponents/CartesianChart.types.d.ts +16 -1
  35. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  36. package/lib/components/DeclarativeChart/DeclarativeChart.js +24 -28
  37. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  38. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  39. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +202 -217
  40. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  41. package/lib/components/DonutChart/DonutChart.base.d.ts +1 -0
  42. package/lib/components/DonutChart/DonutChart.base.js +16 -4
  43. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  44. package/lib/components/DonutChart/DonutChart.styles.js +3 -1
  45. package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
  46. package/lib/components/DonutChart/DonutChart.types.d.ts +13 -0
  47. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  48. package/lib/components/FunnelChart/FunnelChart.base.js +14 -8
  49. package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
  50. package/lib/components/FunnelChart/FunnelChart.styles.js +3 -0
  51. package/lib/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  52. package/lib/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  53. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  54. package/lib/components/GaugeChart/GaugeChart.base.js +2 -2
  55. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  56. package/lib/components/GaugeChart/GaugeChart.styles.js +16 -22
  57. package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  58. package/lib/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  59. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  60. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  61. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +2 -18
  62. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  63. package/lib/components/LineChart/LineChart.base.d.ts +0 -1
  64. package/lib/components/LineChart/LineChart.base.js +1 -25
  65. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  66. package/lib/components/PolarChart/PolarChart.base.d.ts +3 -0
  67. package/lib/components/PolarChart/PolarChart.base.js +426 -0
  68. package/lib/components/PolarChart/PolarChart.base.js.map +1 -0
  69. package/lib/components/PolarChart/PolarChart.d.ts +7 -0
  70. package/lib/components/PolarChart/PolarChart.js +9 -0
  71. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  72. package/lib/components/PolarChart/PolarChart.styles.d.ts +2 -0
  73. package/lib/components/PolarChart/PolarChart.styles.js +39 -0
  74. package/lib/components/PolarChart/PolarChart.styles.js.map +1 -0
  75. package/lib/components/PolarChart/PolarChart.types.d.ts +185 -0
  76. package/lib/components/PolarChart/PolarChart.types.js +2 -0
  77. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  78. package/lib/components/PolarChart/PolarChart.utils.d.ts +43 -0
  79. package/lib/components/PolarChart/PolarChart.utils.js +180 -0
  80. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  81. package/lib/components/PolarChart/index.d.ts +2 -0
  82. package/lib/components/PolarChart/index.js +3 -0
  83. package/lib/components/PolarChart/index.js.map +1 -0
  84. package/lib/components/SankeyChart/SankeyChart.base.js +9 -2
  85. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  86. package/lib/components/SankeyChart/SankeyChart.styles.js +3 -0
  87. package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  88. package/lib/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  89. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  90. package/lib/components/ScatterChart/ScatterChart.base.js +1 -28
  91. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  92. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  93. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +1 -73
  94. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  95. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  96. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -26
  97. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  98. package/lib/index.d.ts +2 -0
  99. package/lib/index.js +1 -0
  100. package/lib/index.js.map +1 -1
  101. package/lib/types/IDataPoint.d.ts +88 -0
  102. package/lib/types/IDataPoint.js.map +1 -1
  103. package/lib/utilities/ChartTitle.d.ts +55 -0
  104. package/lib/utilities/ChartTitle.js +45 -0
  105. package/lib/utilities/ChartTitle.js.map +1 -0
  106. package/lib/utilities/Common.styles.d.ts +51 -0
  107. package/lib/utilities/Common.styles.js +70 -1
  108. package/lib/utilities/Common.styles.js.map +1 -1
  109. package/lib/utilities/image-export-utils.js +4 -4
  110. package/lib/utilities/image-export-utils.js.map +1 -1
  111. package/lib/utilities/index.d.ts +1 -0
  112. package/lib/utilities/index.js +1 -0
  113. package/lib/utilities/index.js.map +1 -1
  114. package/lib/utilities/utilities.d.ts +28 -6
  115. package/lib/utilities/utilities.js +210 -104
  116. package/lib/utilities/utilities.js.map +1 -1
  117. package/lib-amd/PolarChart.d.ts +1 -0
  118. package/lib-amd/PolarChart.js +6 -0
  119. package/lib-amd/PolarChart.js.map +1 -0
  120. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  121. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  122. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +0 -1
  123. package/lib-amd/components/AreaChart/AreaChart.base.js +1 -29
  124. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  125. package/lib-amd/components/ChartTable/ChartTable.base.js +12 -5
  126. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  127. package/lib-amd/components/ChartTable/ChartTable.styles.js +3 -1
  128. package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -1
  129. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +11 -0
  130. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -1
  131. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  132. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  133. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  134. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  135. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  136. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  137. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  138. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  139. package/lib-amd/components/CommonComponents/CartesianChart.base.js +81 -41
  140. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  141. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +30 -26
  142. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  143. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +16 -1
  144. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  145. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +22 -28
  146. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  147. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  148. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -219
  149. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  150. package/lib-amd/components/DonutChart/DonutChart.base.d.ts +1 -0
  151. package/lib-amd/components/DonutChart/DonutChart.base.js +15 -3
  152. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  153. package/lib-amd/components/DonutChart/DonutChart.styles.js +2 -0
  154. package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
  155. package/lib-amd/components/DonutChart/DonutChart.types.d.ts +13 -0
  156. package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
  157. package/lib-amd/components/FunnelChart/FunnelChart.base.js +14 -9
  158. package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
  159. package/lib-amd/components/FunnelChart/FunnelChart.styles.js +3 -1
  160. package/lib-amd/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  161. package/lib-amd/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  162. package/lib-amd/components/FunnelChart/FunnelChart.types.js.map +1 -1
  163. package/lib-amd/components/GaugeChart/GaugeChart.base.js +1 -1
  164. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  165. package/lib-amd/components/GaugeChart/GaugeChart.styles.js +16 -23
  166. package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  167. package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  168. package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -1
  169. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  170. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +0 -16
  171. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  172. package/lib-amd/components/LineChart/LineChart.base.d.ts +0 -1
  173. package/lib-amd/components/LineChart/LineChart.base.js +0 -24
  174. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  175. package/lib-amd/components/PolarChart/PolarChart.base.d.ts +3 -0
  176. package/lib-amd/components/PolarChart/PolarChart.base.js +421 -0
  177. package/lib-amd/components/PolarChart/PolarChart.base.js.map +1 -0
  178. package/lib-amd/components/PolarChart/PolarChart.d.ts +7 -0
  179. package/lib-amd/components/PolarChart/PolarChart.js +11 -0
  180. package/lib-amd/components/PolarChart/PolarChart.js.map +1 -0
  181. package/lib-amd/components/PolarChart/PolarChart.styles.d.ts +2 -0
  182. package/lib-amd/components/PolarChart/PolarChart.styles.js +43 -0
  183. package/lib-amd/components/PolarChart/PolarChart.styles.js.map +1 -0
  184. package/lib-amd/components/PolarChart/PolarChart.types.d.ts +185 -0
  185. package/lib-amd/components/PolarChart/PolarChart.types.js +5 -0
  186. package/lib-amd/components/PolarChart/PolarChart.types.js.map +1 -0
  187. package/lib-amd/components/PolarChart/PolarChart.utils.d.ts +43 -0
  188. package/lib-amd/components/PolarChart/PolarChart.utils.js +183 -0
  189. package/lib-amd/components/PolarChart/PolarChart.utils.js.map +1 -0
  190. package/lib-amd/components/PolarChart/index.d.ts +2 -0
  191. package/lib-amd/components/PolarChart/index.js +7 -0
  192. package/lib-amd/components/PolarChart/index.js.map +1 -0
  193. package/lib-amd/components/SankeyChart/SankeyChart.base.js +9 -3
  194. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  195. package/lib-amd/components/SankeyChart/SankeyChart.styles.js +3 -1
  196. package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  197. package/lib-amd/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  198. package/lib-amd/components/SankeyChart/SankeyChart.types.js.map +1 -1
  199. package/lib-amd/components/ScatterChart/ScatterChart.base.js +0 -27
  200. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  201. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  202. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +1 -72
  203. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  204. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  205. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -25
  206. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  207. package/lib-amd/index.d.ts +2 -0
  208. package/lib-amd/index.js +3 -2
  209. package/lib-amd/index.js.map +1 -1
  210. package/lib-amd/types/IDataPoint.d.ts +88 -0
  211. package/lib-amd/types/IDataPoint.js.map +1 -1
  212. package/lib-amd/utilities/ChartTitle.d.ts +55 -0
  213. package/lib-amd/utilities/ChartTitle.js +46 -0
  214. package/lib-amd/utilities/ChartTitle.js.map +1 -0
  215. package/lib-amd/utilities/Common.styles.d.ts +51 -0
  216. package/lib-amd/utilities/Common.styles.js +74 -2
  217. package/lib-amd/utilities/Common.styles.js.map +1 -1
  218. package/lib-amd/utilities/image-export-utils.js +3 -3
  219. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  220. package/lib-amd/utilities/index.d.ts +1 -0
  221. package/lib-amd/utilities/index.js +2 -1
  222. package/lib-amd/utilities/index.js.map +1 -1
  223. package/lib-amd/utilities/utilities.d.ts +28 -6
  224. package/lib-amd/utilities/utilities.js +217 -107
  225. package/lib-amd/utilities/utilities.js.map +1 -1
  226. package/lib-commonjs/PolarChart.d.ts +1 -0
  227. package/lib-commonjs/PolarChart.js +5 -0
  228. package/lib-commonjs/PolarChart.js.map +1 -0
  229. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  230. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  231. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +0 -1
  232. package/lib-commonjs/components/AreaChart/AreaChart.base.js +0 -29
  233. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  234. package/lib-commonjs/components/ChartTable/ChartTable.base.js +12 -4
  235. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  236. package/lib-commonjs/components/ChartTable/ChartTable.styles.js +3 -0
  237. package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -1
  238. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +11 -0
  239. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  240. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  241. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  242. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  243. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  244. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  245. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  246. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  247. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  248. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +81 -41
  249. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  250. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +30 -26
  251. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  252. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +16 -1
  253. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  254. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +23 -27
  255. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  256. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  257. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +204 -219
  258. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  259. package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +1 -0
  260. package/lib-commonjs/components/DonutChart/DonutChart.base.js +15 -3
  261. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  262. package/lib-commonjs/components/DonutChart/DonutChart.styles.js +2 -0
  263. package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
  264. package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +13 -0
  265. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  266. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js +14 -8
  267. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
  268. package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js +3 -0
  269. package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  270. package/lib-commonjs/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  271. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  272. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +1 -1
  273. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  274. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +16 -22
  275. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  276. package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  277. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  278. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  279. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +0 -16
  280. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  281. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +0 -1
  282. package/lib-commonjs/components/LineChart/LineChart.base.js +0 -24
  283. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  284. package/lib-commonjs/components/PolarChart/PolarChart.base.d.ts +3 -0
  285. package/lib-commonjs/components/PolarChart/PolarChart.base.js +429 -0
  286. package/lib-commonjs/components/PolarChart/PolarChart.base.js.map +1 -0
  287. package/lib-commonjs/components/PolarChart/PolarChart.d.ts +7 -0
  288. package/lib-commonjs/components/PolarChart/PolarChart.js +12 -0
  289. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  290. package/lib-commonjs/components/PolarChart/PolarChart.styles.d.ts +2 -0
  291. package/lib-commonjs/components/PolarChart/PolarChart.styles.js +43 -0
  292. package/lib-commonjs/components/PolarChart/PolarChart.styles.js.map +1 -0
  293. package/lib-commonjs/components/PolarChart/PolarChart.types.d.ts +185 -0
  294. package/lib-commonjs/components/PolarChart/PolarChart.types.js +3 -0
  295. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  296. package/lib-commonjs/components/PolarChart/PolarChart.utils.d.ts +43 -0
  297. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +188 -0
  298. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  299. package/lib-commonjs/components/PolarChart/index.d.ts +2 -0
  300. package/lib-commonjs/components/PolarChart/index.js +6 -0
  301. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  302. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +9 -2
  303. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  304. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +3 -0
  305. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  306. package/lib-commonjs/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  307. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  308. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +0 -27
  309. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  310. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  311. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +0 -72
  312. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  313. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  314. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +0 -25
  315. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  316. package/lib-commonjs/index.d.ts +2 -0
  317. package/lib-commonjs/index.js +3 -1
  318. package/lib-commonjs/index.js.map +1 -1
  319. package/lib-commonjs/types/IDataPoint.d.ts +88 -0
  320. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  321. package/lib-commonjs/utilities/ChartTitle.d.ts +55 -0
  322. package/lib-commonjs/utilities/ChartTitle.js +49 -0
  323. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  324. package/lib-commonjs/utilities/Common.styles.d.ts +51 -0
  325. package/lib-commonjs/utilities/Common.styles.js +74 -2
  326. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  327. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  328. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  329. package/lib-commonjs/utilities/index.d.ts +1 -0
  330. package/lib-commonjs/utilities/index.js +1 -0
  331. package/lib-commonjs/utilities/index.js.map +1 -1
  332. package/lib-commonjs/utilities/utilities.d.ts +28 -6
  333. package/lib-commonjs/utilities/utilities.js +217 -107
  334. package/lib-commonjs/utilities/utilities.js.map +1 -1
  335. package/package.json +4 -12
  336. package/project.json +0 -1
  337. package/src/components/ChartTable/ChartTable.types.ts +13 -0
  338. package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +5 -0
  339. package/src/components/CommonComponents/CartesianChart.types.ts +17 -1
  340. package/src/components/DonutChart/DonutChart.types.ts +16 -0
  341. package/src/components/FunnelChart/FunnelChart.types.ts +16 -0
  342. package/src/components/GaugeChart/GaugeChart.types.ts +11 -0
  343. package/src/components/PolarChart/PolarChart.types.ts +232 -0
  344. package/src/components/SankeyChart/SankeyChart.types.ts +22 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.findCalloutPoints = exports.generateMonthlyTicks = exports.generateLinearTicks = exports.getRangeForScatterMarkerSize = exports.getScatterXDomainExtent = exports.isPlottable = exports.isValidDomainValue = exports.getDomainPaddingForMarkers = exports.getInvertedTextColor = exports.sortAxisCategories = exports.truncateString = exports.createMeasurementSpan = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.calculateLongestLabelWidth = exports.wrapContent = exports.DEFAULT_WRAP_WIDTH = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.DEFAULT_DATE_STRING = exports.MIN_DONUT_RADIUS = exports.MIN_DOMAIN_MARGIN = void 0;
4
+ exports.autoLayoutXAxisLabels = exports.findCalloutPoints = exports.generateDateTicks = exports.generateNumericTicks = exports.generateMonthlyTicks = exports.generateLinearTicks = exports.getRangeForScatterMarkerSize = exports.getScatterXDomainExtent = exports.isPlottable = exports.isValidDomainValue = exports.getDomainPaddingForMarkers = exports.getInvertedTextColor = exports.sortAxisCategories = exports.truncateString = exports.getTextSize = exports.measureTextWithDOM = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.calculateLongestLabelWidth = exports.wrapContent = exports.DEFAULT_WRAP_WIDTH = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.CARTESIAN_XAXIS_CLASSNAME = exports.DEFAULT_DATE_STRING = exports.MIN_DONUT_RADIUS = exports.MIN_DOMAIN_MARGIN = void 0;
5
5
  exports.defaultYAxisTickFormatter = defaultYAxisTickFormatter;
6
6
  exports.createNumericXAxis = createNumericXAxis;
7
7
  exports.getDateFormatLevel = getDateFormatLevel;
@@ -56,6 +56,8 @@ var colors_1 = require("./colors");
56
56
  exports.MIN_DOMAIN_MARGIN = 8;
57
57
  exports.MIN_DONUT_RADIUS = 1;
58
58
  exports.DEFAULT_DATE_STRING = '2000-01-01';
59
+ exports.CARTESIAN_XAXIS_CLASSNAME = 'fui-cart__xAxis';
60
+ var CARTESIAN_XAXIS_TEXT_SELECTOR = ".".concat(exports.CARTESIAN_XAXIS_CLASSNAME, " text");
59
61
  var ChartTypes;
60
62
  (function (ChartTypes) {
61
63
  ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
@@ -133,7 +135,7 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleTy
133
135
  var xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
134
136
  return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : (0, chart_utilities_1.formatToLocaleString)(xAxisValue, culture);
135
137
  };
136
- if (hideTickOverlap && typeof xAxisCount === 'undefined') {
138
+ if (hideTickOverlap) {
137
139
  var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(function (v, i) { return tickFormat(v, i); })) + 20;
138
140
  var _d = xAxisScale.range(), start = _d[0], end = _d[1];
139
141
  tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
@@ -151,7 +153,7 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleTy
151
153
  customTickValues = tickParams.tickValues;
152
154
  }
153
155
  else if (tickStep) {
154
- customTickValues = generateNumericTicks(scaleType, tickStep, tick0, xAxisScale.domain());
156
+ customTickValues = (0, exports.generateNumericTicks)(scaleType, tickStep, tick0, xAxisScale.domain());
155
157
  }
156
158
  if (customTickValues) {
157
159
  xAxis.tickValues(customTickValues);
@@ -159,8 +161,8 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleTy
159
161
  if (xAxisElement) {
160
162
  (0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
161
163
  }
162
- var tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
163
- return { xScale: xAxisScale, tickValues: tickValues };
164
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
165
+ return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
164
166
  }
165
167
  /**
166
168
  * This function returns a multilevel formatter for a given date range.
@@ -265,7 +267,7 @@ function isPowerOf10(num) {
265
267
  * @param {ITickParams} tickParams
266
268
  */
267
269
  function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
268
- var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, xAxisCount = xAxisParams.xAxisCount, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0, tickText = xAxisParams.tickText;
270
+ var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, xAxisCount = xAxisParams.xAxisCount, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0, tickText = xAxisParams.tickText;
269
271
  var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
270
272
  xAxisScale
271
273
  .domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
@@ -306,10 +308,11 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
306
308
  }
307
309
  return (0, chart_utilities_1.formatDateToLocaleString)(domainValue, culture, useUTC, false, formatOptions);
308
310
  };
309
- var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
310
- var _c = xAxisScale.range(), start = _c[0], end = _c[1];
311
- var maxPossibleTickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
312
- tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
311
+ if (hideTickOverlap) {
312
+ var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
313
+ var _c = xAxisScale.range(), start = _c[0], end = _c[1];
314
+ tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
315
+ }
313
316
  var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
314
317
  .tickSize(xAxistickSize)
315
318
  .tickPadding(tickPadding)
@@ -323,7 +326,7 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
323
326
  customTickValues = tickParams.tickValues;
324
327
  }
325
328
  else if (tickStep) {
326
- customTickValues = generateDateTicks(tickStep, tick0, xAxisScale.domain(), useUTC);
329
+ customTickValues = (0, exports.generateDateTicks)(tickStep, tick0, xAxisScale.domain(), useUTC);
327
330
  }
328
331
  if (customTickValues) {
329
332
  xAxis.tickValues(customTickValues);
@@ -331,8 +334,8 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
331
334
  if (xAxisElement) {
332
335
  (0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
333
336
  }
334
- var tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
335
- return { xScale: xAxisScale, tickValues: tickValues };
337
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
338
+ return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
336
339
  }
337
340
  /**
338
341
  * Create String X axis
@@ -394,7 +397,7 @@ function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
394
397
  if (xAxisParams.xAxisElement) {
395
398
  (0, d3_selection_1.select)(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
396
399
  }
397
- return { xScale: xAxisScale, tickValues: tickValues };
400
+ return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
398
401
  }
399
402
  /**
400
403
  * This method is used to calculate the rounded tick values for the y-axis
@@ -488,7 +491,7 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData)
488
491
  customTickValues = tickValues;
489
492
  }
490
493
  else if (tickStep) {
491
- customTickValues = generateNumericTicks(undefined, tickStep, tick0, yAxisScale.domain());
494
+ customTickValues = (0, exports.generateNumericTicks)(undefined, tickStep, tick0, yAxisScale.domain());
492
495
  }
493
496
  if (customTickValues) {
494
497
  yAxis.tickValues(customTickValues);
@@ -535,7 +538,7 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, use
535
538
  customTickValues = tickValues;
536
539
  }
537
540
  else if (tickStep) {
538
- customTickValues = generateNumericTicks(scaleType, tickStep, tick0, yAxisScale.domain());
541
+ customTickValues = (0, exports.generateNumericTicks)(scaleType, tickStep, tick0, yAxisScale.domain());
539
542
  }
540
543
  if (customTickValues) {
541
544
  yAxis.tickValues(customTickValues);
@@ -720,14 +723,15 @@ exports.DEFAULT_WRAP_WIDTH = 10;
720
723
  * @returns
721
724
  */
722
725
  function createWrapOfXLabels(wrapLabelProps) {
723
- var node = wrapLabelProps.node, xAxis = wrapLabelProps.xAxis, noOfCharsToTruncate = wrapLabelProps.noOfCharsToTruncate, showXAxisLablesTooltip = wrapLabelProps.showXAxisLablesTooltip, _a = wrapLabelProps.width, width = _a === void 0 ? exports.DEFAULT_WRAP_WIDTH : _a;
726
+ var _a, _b;
727
+ var node = wrapLabelProps.node, xAxis = wrapLabelProps.xAxis, noOfCharsToTruncate = wrapLabelProps.noOfCharsToTruncate, showXAxisLablesTooltip = wrapLabelProps.showXAxisLablesTooltip, _c = wrapLabelProps.width, width = _c === void 0 ? exports.DEFAULT_WRAP_WIDTH : _c, container = wrapLabelProps.container;
724
728
  if (node === null) {
725
729
  return;
726
730
  }
727
731
  var axisNode = (0, d3_selection_1.select)(node).call(xAxis);
728
732
  var removeVal = 0;
729
733
  var maxLines = 1;
730
- axisNode.selectAll('.tick text').each(function () {
734
+ axisNode.selectAll('.tick text').each(function (_, tickIndex) {
731
735
  var text = (0, d3_selection_1.select)(this);
732
736
  var totalWord = text.text();
733
737
  var truncatedWord = "".concat(text.text().slice(0, noOfCharsToTruncate), "...");
@@ -741,41 +745,27 @@ function createWrapOfXLabels(wrapLabelProps) {
741
745
  var dy = parseFloat(text.attr('dy'));
742
746
  var tspan = text
743
747
  .text(null)
748
+ .attr('data-full', totalWord)
744
749
  .append('tspan')
745
750
  .attr('x', 0)
746
751
  .attr('y', y)
747
- .attr('id', 'BaseSpan')
748
- .attr('dy', dy + 'em')
749
- .attr('data-', totalWord);
750
- if (showXAxisLablesTooltip && totalWordLength > noOfCharsToTruncate) {
751
- tspan = text
752
- .append('tspan')
753
- .attr('id', 'showDots')
754
- .attr('x', 0)
755
- .attr('y', y)
756
- .attr('dy', dy + 'em')
757
- .text(truncatedWord);
758
- }
759
- else if (showXAxisLablesTooltip && totalWordLength <= noOfCharsToTruncate) {
760
- tspan = text
761
- .append('tspan')
762
- .attr('id', 'LessLength')
763
- .attr('x', 0)
764
- .attr('y', y)
765
- .attr('dy', dy + 'em')
766
- .text(totalWord);
752
+ .attr('dy', dy + 'em');
753
+ if (showXAxisLablesTooltip) {
754
+ tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
767
755
  }
768
756
  else {
757
+ var maxWidth = Array.isArray(width) ? width[tickIndex] : width;
769
758
  while ((word = words.pop())) {
770
759
  line.push(word);
771
- tspan.text(line.join(' '));
772
- if (tspan.node().getComputedTextLength() > width && line.length > 1) {
760
+ var label = line.join(' ');
761
+ tspan.text(label);
762
+ var labelWidth = (0, exports.getTextSize)(label, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
763
+ if (labelWidth > maxWidth && line.length > 1) {
773
764
  line.pop();
774
765
  tspan.text(line.join(' '));
775
766
  line = [word];
776
767
  tspan = text
777
768
  .append('tspan')
778
- .attr('id', 'WordBreakId')
779
769
  .attr('x', 0)
780
770
  .attr('y', y)
781
771
  .attr('dy', ++lineNumber * lineHeight + dy + 'em')
@@ -787,10 +777,7 @@ function createWrapOfXLabels(wrapLabelProps) {
787
777
  });
788
778
  if (!showXAxisLablesTooltip) {
789
779
  var maxHeight = 12; // intial value to render corretly first time
790
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
791
- var outerHTMLElement = document.getElementById('WordBreakId');
792
- var BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
793
- var boxHeight = BoxCordinates && BoxCordinates.height;
780
+ var boxHeight = (_b = (_a = (container !== null && container !== void 0 ? container : document).querySelector(".".concat(exports.CARTESIAN_XAXIS_CLASSNAME, " tspan"))) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) !== null && _b !== void 0 ? _b : 0;
794
781
  if (boxHeight > maxHeight) {
795
782
  maxHeight = boxHeight;
796
783
  }
@@ -815,53 +802,35 @@ yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
815
802
  ? "...".concat(text.text().slice(0, noOfCharsToTruncate))
816
803
  : "".concat(text.text().slice(0, noOfCharsToTruncate), "...");
817
804
  var totalWordLength = text.text().length;
818
- var padding = 0; // ems
819
805
  var y = text.attr('y');
820
806
  var x = text.attr('x');
821
807
  var dy = parseFloat(text.attr('dy'));
822
- var dx = 0;
823
- text
808
+ var tspan = text
824
809
  .text(null)
810
+ .attr('data-full', totalWord)
825
811
  .append('tspan')
826
812
  .attr('x', x)
827
813
  .attr('y', y)
828
- .attr('id', 'BaseSpan')
829
- .attr('dy', dy + 'em')
830
- .attr('data-', totalWord);
831
- if (truncateLabel && totalWordLength > noOfCharsToTruncate) {
832
- text
833
- .append('tspan')
834
- .attr('id', 'showDots')
835
- .attr('x', x)
836
- .attr('y', y)
837
- .attr('dy', dy + 'em')
838
- .attr('dx', padding + dx + 'em')
839
- .text(truncatedWord);
840
- }
841
- else {
842
- text
843
- .append('tspan')
844
- .attr('id', 'LessLength')
845
- .attr('x', x)
846
- .attr('y', y)
847
- .attr('dx', padding + dx + 'em')
848
- .text(totalWord);
814
+ .attr('dy', dy + 'em');
815
+ if (truncateLabel) {
816
+ tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
849
817
  }
850
818
  });
851
819
  }
852
820
  var wrapContent = function (content, id, maxWidth) {
853
821
  var textElement = (0, d3_selection_1.select)("#".concat(id));
854
822
  textElement.text(content);
855
- if (!textElement.node()) {
823
+ var node = textElement.node();
824
+ if (!node || typeof node.getComputedTextLength !== 'function') {
856
825
  return false;
857
826
  }
858
827
  var isOverflowing = false;
859
- var textLength = textElement.node().getComputedTextLength();
828
+ var textLength = node.getComputedTextLength();
860
829
  while (textLength > maxWidth && content.length > 0) {
861
830
  content = content.slice(0, -1);
862
831
  textElement.text(content + '...');
863
832
  isOverflowing = true;
864
- textLength = textElement.node().getComputedTextLength();
833
+ textLength = node.getComputedTextLength();
865
834
  }
866
835
  return isOverflowing;
867
836
  };
@@ -900,38 +869,41 @@ exports.calculateLongestLabelWidth = calculateLongestLabelWidth;
900
869
  */
901
870
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
902
871
  function tooltipOfAxislabels(axistooltipProps) {
903
- var tooltipCls = axistooltipProps.tooltipCls, axis = axistooltipProps.axis, id = axistooltipProps.id;
872
+ var tooltipCls = axistooltipProps.tooltipCls, axis = axistooltipProps.axis, id = axistooltipProps.id, container = axistooltipProps.container;
904
873
  if (axis === null) {
905
874
  return null;
906
875
  }
907
- var div = (0, d3_selection_1.select)('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
908
- var aa = axis.selectAll('#BaseSpan')._groups[0];
909
- var baseSpanLength = aa && Object.keys(aa).length;
910
- var originalDataArray = [];
911
- for (var i = 0; i < baseSpanLength; i++) {
912
- var originalData = aa[i].dataset && Object.values(aa[i].dataset)[0];
913
- originalDataArray.push(originalData);
914
- }
915
- var tickObject = axis.selectAll('.tick')._groups[0];
916
- var tickObjectLength = tickObject && Object.keys(tickObject).length;
917
- var _loop_1 = function (i) {
918
- var d1 = tickObject[i];
919
- (0, d3_selection_1.select)(d1)
876
+ var div = (container ? (0, d3_selection_1.select)(container) : (0, d3_selection_1.select)('body'))
877
+ .append('div')
878
+ .attr('id', id)
879
+ .attr('class', tooltipCls)
880
+ .style('opacity', 0);
881
+ axis.selectAll('.tick text').each(function () {
882
+ var tickSelection = (0, d3_selection_1.select)(this);
883
+ var fullLabel = tickSelection.attr('data-full');
884
+ if (tickSelection.text() === fullLabel) {
885
+ return;
886
+ }
887
+ var tickEl = this;
888
+ tickSelection
920
889
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
921
890
  .on('mouseover', function (event, d) {
922
- div.style('opacity', 0.9);
891
+ var _a;
892
+ var containerBounds = container === null || container === void 0 ? void 0 : container.getBoundingClientRect();
893
+ var tickBounds = tickEl.getBoundingClientRect();
894
+ var tooltipBottom = containerBounds ? containerBounds.bottom - (tickBounds.top - 4) : tickBounds.top - 4;
895
+ var tooltipLeft = (tickBounds.left + tickBounds.right) / 2 - ((_a = containerBounds === null || containerBounds === void 0 ? void 0 : containerBounds.left) !== null && _a !== void 0 ? _a : 0);
923
896
  div
924
- .text(originalDataArray[i])
925
- .style('left', event.pageX + 'px')
926
- .style('top', event.pageY - 28 + 'px');
897
+ .text(fullLabel)
898
+ .style('bottom', "".concat(tooltipBottom, "px"))
899
+ .style('left', "".concat(tooltipLeft, "px"))
900
+ .style('transform', 'translateX(-50%)')
901
+ .style('opacity', 0.9);
927
902
  })
928
903
  .on('mouseout', function (d) {
929
904
  div.style('opacity', 0);
930
905
  });
931
- };
932
- for (var i = 0; i < tickObjectLength; i++) {
933
- _loop_1(i);
934
- }
906
+ });
935
907
  }
936
908
  /**
937
909
  * Find the axis type of line chart and area chart from given data
@@ -1423,8 +1395,8 @@ function areArraysEqual(arr1, arr2) {
1423
1395
  return true;
1424
1396
  }
1425
1397
  var cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
1426
- function resolveCSSVariables(chartContainer, styleRules) {
1427
- var containerStyles = getComputedStyle(chartContainer);
1398
+ function resolveCSSVariables(container, styleRules) {
1399
+ var containerStyles = getComputedStyle(container);
1428
1400
  return styleRules.replace(cssVarRegExp, function (match, group1) {
1429
1401
  return containerStyles.getPropertyValue(group1);
1430
1402
  });
@@ -1453,26 +1425,53 @@ var MEASUREMENT_SPAN_STYLE = {
1453
1425
  border: 'none',
1454
1426
  whiteSpace: 'pre',
1455
1427
  };
1456
- var MEASUREMENT_SPAN_ID = (0, react_1.getId)('measurement_span_');
1457
- var createMeasurementSpan = function (text, className, parentElement) {
1428
+ var MEASUREMENT_SPAN_ID = 'fui_measurement_span';
1429
+ var TEXT_STYLE_PROPERTIES = [
1430
+ 'font-size',
1431
+ 'font-family',
1432
+ 'font-weight',
1433
+ 'font-style',
1434
+ 'letter-spacing',
1435
+ 'text-transform',
1436
+ ];
1437
+ var measureTextWithDOM = function (text, cssSelector, container) {
1458
1438
  var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
1459
1439
  if (!measurementSpan) {
1460
1440
  measurementSpan = document.createElement('span');
1461
1441
  measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
1462
1442
  measurementSpan.setAttribute('aria-hidden', 'true');
1463
- if (parentElement) {
1464
- parentElement.appendChild(measurementSpan);
1465
- }
1466
- else {
1467
- document.body.appendChild(measurementSpan);
1468
- }
1443
+ (container !== null && container !== void 0 ? container : document.body).appendChild(measurementSpan);
1469
1444
  }
1470
- measurementSpan.setAttribute('class', className);
1471
1445
  Object.assign(measurementSpan.style, MEASUREMENT_SPAN_STYLE);
1446
+ var refEl = (container !== null && container !== void 0 ? container : document).querySelector(cssSelector);
1447
+ if (refEl) {
1448
+ copyStyle(TEXT_STYLE_PROPERTIES, refEl, measurementSpan);
1449
+ }
1472
1450
  measurementSpan.textContent = "".concat(text);
1473
- return measurementSpan;
1451
+ var rect = measurementSpan.getBoundingClientRect();
1452
+ return { node: measurementSpan, width: rect.width, height: rect.height };
1453
+ };
1454
+ exports.measureTextWithDOM = measureTextWithDOM;
1455
+ var CACHE_SIZE = 2000;
1456
+ var textSizeCache = new Map();
1457
+ var getTextSize = function (text, cssSelector, container) {
1458
+ var cacheKey = "".concat(text, "|").concat(cssSelector);
1459
+ var cachedResult = textSizeCache.get(cacheKey);
1460
+ if (cachedResult) {
1461
+ return cachedResult;
1462
+ }
1463
+ var _a = (0, exports.measureTextWithDOM)(text, cssSelector, container), width = _a.width, height = _a.height;
1464
+ // TODO: Improve cache eviction strategy if needed (e.g., LRU)
1465
+ if (textSizeCache.size >= CACHE_SIZE) {
1466
+ var firstKey = textSizeCache.keys().next().value;
1467
+ if (!(0, chart_utilities_1.isInvalidValue)(firstKey)) {
1468
+ textSizeCache.delete(firstKey);
1469
+ }
1470
+ }
1471
+ textSizeCache.set(cacheKey, { width: width, height: height });
1472
+ return { width: width, height: height };
1474
1473
  };
1475
- exports.createMeasurementSpan = createMeasurementSpan;
1474
+ exports.getTextSize = getTextSize;
1476
1475
  function getCurveFactory(curve, defaultFactory) {
1477
1476
  if (defaultFactory === void 0) { defaultFactory = d3_shape_1.curveLinear; }
1478
1477
  if (typeof curve === 'function') {
@@ -1744,6 +1743,7 @@ var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
1744
1743
  return (0, exports.generateLinearTicks)(refTick, tickStep, scaleDomain);
1745
1744
  }
1746
1745
  };
1746
+ exports.generateNumericTicks = generateNumericTicks;
1747
1747
  var generateDateTicks = function (tickStep, tick0, scaleDomain, useUTC) {
1748
1748
  var refTick = tick0 instanceof Date ? tick0 : new Date(exports.DEFAULT_DATE_STRING);
1749
1749
  if (typeof tickStep === 'number' && tickStep > 0) {
@@ -1757,6 +1757,7 @@ var generateDateTicks = function (tickStep, tick0, scaleDomain, useUTC) {
1757
1757
  }
1758
1758
  }
1759
1759
  };
1760
+ exports.generateDateTicks = generateDateTicks;
1760
1761
  var findCalloutPoints = function (calloutPointsByX, x) {
1761
1762
  if (x === null) {
1762
1763
  return undefined;
@@ -1771,4 +1772,113 @@ var findCalloutPoints = function (calloutPointsByX, x) {
1771
1772
  };
1772
1773
  };
1773
1774
  exports.findCalloutPoints = findCalloutPoints;
1775
+ var autoLayoutXAxisLabels = function (tickValues, tickLabels, scale, axisNode, containerWidth, container) {
1776
+ var _a;
1777
+ var requiresWrap = false;
1778
+ var requiresTruncate = false;
1779
+ var maxWidths = [];
1780
+ var _b = scale.range(), rangeStart = _b[0], rangeEnd = _b[1];
1781
+ var isRTL = rangeEnd - rangeStart < 0;
1782
+ var start = isRTL ? containerWidth : 0;
1783
+ var end = isRTL ? 0 : containerWidth;
1784
+ var getTickPosition = function (index) {
1785
+ var _a;
1786
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1787
+ return ((_a = scale(tickValues[index])) !== null && _a !== void 0 ? _a : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
1788
+ };
1789
+ var getLabelWidth = function (text) {
1790
+ return (0, exports.getTextSize)(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
1791
+ };
1792
+ for (var i = 0; i < tickValues.length; i++) {
1793
+ var position = getTickPosition(i);
1794
+ var leftSpace = Math.abs(i > 0 ? (position - getTickPosition(i - 1)) / 2 : position - start);
1795
+ var rightSpace = Math.abs(i + 1 < tickValues.length ? (getTickPosition(i + 1) - position) / 2 : end - position);
1796
+ var maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
1797
+ var label = tickLabels[i];
1798
+ var labelWidth = getLabelWidth(label);
1799
+ maxWidths.push(maxAvailableWidth);
1800
+ if (labelWidth > maxAvailableWidth) {
1801
+ var longestWordWidth = Math.max.apply(Math, label.split(/\s+/).map(function (word) { return getLabelWidth(word); }));
1802
+ if (longestWordWidth <= maxAvailableWidth) {
1803
+ requiresWrap = true;
1804
+ }
1805
+ else {
1806
+ requiresTruncate = true;
1807
+ }
1808
+ }
1809
+ }
1810
+ if (requiresTruncate) {
1811
+ return truncateAndStaggerXAxisLabels(tickValues, tickLabels, scale, axisNode, containerWidth, container);
1812
+ }
1813
+ if (requiresWrap) {
1814
+ return ((_a = createWrapOfXLabels({
1815
+ node: axisNode,
1816
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1817
+ xAxis: scale,
1818
+ noOfCharsToTruncate: 100,
1819
+ showXAxisLablesTooltip: false,
1820
+ width: maxWidths,
1821
+ container: container,
1822
+ })) !== null && _a !== void 0 ? _a : 0);
1823
+ }
1824
+ return 0;
1825
+ };
1826
+ exports.autoLayoutXAxisLabels = autoLayoutXAxisLabels;
1827
+ var truncateAndStaggerXAxisLabels = function (tickValues, tickLabels, scale, axisNode, containerWidth, container) {
1828
+ if (!axisNode) {
1829
+ return 0;
1830
+ }
1831
+ var maxHeight = 12;
1832
+ var _a = scale.range(), rangeStart = _a[0], rangeEnd = _a[1];
1833
+ var isRTL = rangeEnd - rangeStart < 0;
1834
+ var start = isRTL ? containerWidth : 0;
1835
+ var end = isRTL ? 0 : containerWidth;
1836
+ var getTickPosition = function (index) {
1837
+ var _a;
1838
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1839
+ return ((_a = scale(tickValues[index])) !== null && _a !== void 0 ? _a : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
1840
+ };
1841
+ var getLabelSize = function (text) {
1842
+ return (0, exports.getTextSize)(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container);
1843
+ };
1844
+ (0, d3_selection_1.select)(axisNode)
1845
+ .selectAll('.tick text')
1846
+ .each(function (_, i) {
1847
+ var position = getTickPosition(i);
1848
+ var leftSpace = Math.abs(i > 0 ? position - getTickPosition(i - 1) : position - start);
1849
+ var rightSpace = Math.abs(i + 1 < tickValues.length ? getTickPosition(i + 1) - position : end - position);
1850
+ var maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
1851
+ var label = tickLabels[i];
1852
+ var textNode = (0, d3_selection_1.select)(this).text(null).attr('data-full', label);
1853
+ var lineHeight = 1.1; // ems
1854
+ var y = textNode.attr('y');
1855
+ var dy = parseFloat(textNode.attr('dy'));
1856
+ textNode
1857
+ .append('tspan')
1858
+ .attr('x', 0)
1859
+ .attr('y', y)
1860
+ .attr('dy', (i % 2 === 1 ? lineHeight : 0) + dy + 'em')
1861
+ .text(truncateTextToFitWidth(label, maxAvailableWidth, function (s) { return getLabelSize(s).width; }));
1862
+ maxHeight = Math.max(maxHeight, getLabelSize(label).height);
1863
+ });
1864
+ return tickValues.length > 1 ? maxHeight : 0;
1865
+ };
1866
+ var truncateTextToFitWidth = function (text, maxWidth, measure) {
1867
+ if (measure(text) <= maxWidth) {
1868
+ return text;
1869
+ }
1870
+ var lo = 1;
1871
+ var hi = text.length;
1872
+ while (lo < hi) {
1873
+ var mid = Math.floor((lo + hi + 1) / 2);
1874
+ var candidate = text.slice(0, mid) + '...';
1875
+ if (measure(candidate) <= maxWidth) {
1876
+ lo = mid;
1877
+ }
1878
+ else {
1879
+ hi = mid - 1;
1880
+ }
1881
+ }
1882
+ return text.slice(0, lo) + '...';
1883
+ };
1774
1884
  //# sourceMappingURL=utilities.js.map