@fluentui/react-charting 5.25.4 → 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 (379) hide show
  1. package/CHANGELOG.json +107 -1
  2. package/CHANGELOG.md +30 -2
  3. package/bundle-size/PolarChart.fixture.js +7 -0
  4. package/dist/react-charting.d.ts +424 -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 +93 -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 +20 -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 +390 -267
  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/DonutChart/Pie/Pie.js +4 -2
  49. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  50. package/lib/components/FunnelChart/FunnelChart.base.js +14 -8
  51. package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
  52. package/lib/components/FunnelChart/FunnelChart.styles.js +3 -0
  53. package/lib/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  54. package/lib/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  55. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  56. package/lib/components/GaugeChart/GaugeChart.base.js +2 -2
  57. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  58. package/lib/components/GaugeChart/GaugeChart.styles.js +16 -22
  59. package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  60. package/lib/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  61. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  62. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  63. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +6 -18
  64. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  65. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  66. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +55 -5
  67. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  68. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
  69. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  70. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  71. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  72. package/lib/components/LineChart/LineChart.base.d.ts +0 -1
  73. package/lib/components/LineChart/LineChart.base.js +2 -26
  74. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  75. package/lib/components/PolarChart/PolarChart.base.d.ts +3 -0
  76. package/lib/components/PolarChart/PolarChart.base.js +426 -0
  77. package/lib/components/PolarChart/PolarChart.base.js.map +1 -0
  78. package/lib/components/PolarChart/PolarChart.d.ts +7 -0
  79. package/lib/components/PolarChart/PolarChart.js +9 -0
  80. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  81. package/lib/components/PolarChart/PolarChart.styles.d.ts +2 -0
  82. package/lib/components/PolarChart/PolarChart.styles.js +39 -0
  83. package/lib/components/PolarChart/PolarChart.styles.js.map +1 -0
  84. package/lib/components/PolarChart/PolarChart.types.d.ts +185 -0
  85. package/lib/components/PolarChart/PolarChart.types.js +2 -0
  86. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  87. package/lib/components/PolarChart/PolarChart.utils.d.ts +43 -0
  88. package/lib/components/PolarChart/PolarChart.utils.js +180 -0
  89. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  90. package/lib/components/PolarChart/index.d.ts +2 -0
  91. package/lib/components/PolarChart/index.js +3 -0
  92. package/lib/components/PolarChart/index.js.map +1 -0
  93. package/lib/components/SankeyChart/SankeyChart.base.js +10 -3
  94. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  95. package/lib/components/SankeyChart/SankeyChart.styles.js +3 -0
  96. package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  97. package/lib/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  98. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  99. package/lib/components/ScatterChart/ScatterChart.base.js +14 -32
  100. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  101. package/lib/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  102. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  103. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  104. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +12 -80
  105. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  106. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  107. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +19 -31
  108. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  109. package/lib/index.d.ts +2 -0
  110. package/lib/index.js +1 -0
  111. package/lib/index.js.map +1 -1
  112. package/lib/types/IDataPoint.d.ts +107 -0
  113. package/lib/types/IDataPoint.js.map +1 -1
  114. package/lib/utilities/ChartTitle.d.ts +55 -0
  115. package/lib/utilities/ChartTitle.js +45 -0
  116. package/lib/utilities/ChartTitle.js.map +1 -0
  117. package/lib/utilities/Common.styles.d.ts +51 -0
  118. package/lib/utilities/Common.styles.js +70 -1
  119. package/lib/utilities/Common.styles.js.map +1 -1
  120. package/lib/utilities/image-export-utils.js +4 -4
  121. package/lib/utilities/image-export-utils.js.map +1 -1
  122. package/lib/utilities/index.d.ts +1 -0
  123. package/lib/utilities/index.js +1 -0
  124. package/lib/utilities/index.js.map +1 -1
  125. package/lib/utilities/utilities.d.ts +32 -8
  126. package/lib/utilities/utilities.js +232 -111
  127. package/lib/utilities/utilities.js.map +1 -1
  128. package/lib-amd/PolarChart.d.ts +1 -0
  129. package/lib-amd/PolarChart.js +6 -0
  130. package/lib-amd/PolarChart.js.map +1 -0
  131. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  132. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  133. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +0 -1
  134. package/lib-amd/components/AreaChart/AreaChart.base.js +1 -29
  135. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  136. package/lib-amd/components/ChartTable/ChartTable.base.js +12 -5
  137. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  138. package/lib-amd/components/ChartTable/ChartTable.styles.js +3 -1
  139. package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -1
  140. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +11 -0
  141. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -1
  142. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  143. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  144. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  145. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  146. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  147. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  148. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  149. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  150. package/lib-amd/components/CommonComponents/CartesianChart.base.js +81 -41
  151. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  152. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +30 -26
  153. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  154. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +20 -1
  155. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  156. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +22 -28
  157. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  158. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  159. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +392 -269
  160. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  161. package/lib-amd/components/DonutChart/DonutChart.base.d.ts +1 -0
  162. package/lib-amd/components/DonutChart/DonutChart.base.js +15 -3
  163. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  164. package/lib-amd/components/DonutChart/DonutChart.styles.js +2 -0
  165. package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
  166. package/lib-amd/components/DonutChart/DonutChart.types.d.ts +13 -0
  167. package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
  168. package/lib-amd/components/DonutChart/Pie/Pie.js +4 -2
  169. package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
  170. package/lib-amd/components/FunnelChart/FunnelChart.base.js +14 -9
  171. package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
  172. package/lib-amd/components/FunnelChart/FunnelChart.styles.js +3 -1
  173. package/lib-amd/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  174. package/lib-amd/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  175. package/lib-amd/components/FunnelChart/FunnelChart.types.js.map +1 -1
  176. package/lib-amd/components/GaugeChart/GaugeChart.base.js +1 -1
  177. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  178. package/lib-amd/components/GaugeChart/GaugeChart.styles.js +16 -23
  179. package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  180. package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  181. package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -1
  182. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  183. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -16
  184. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  185. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  186. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
  187. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  188. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -2
  189. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  190. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  191. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  192. package/lib-amd/components/LineChart/LineChart.base.d.ts +0 -1
  193. package/lib-amd/components/LineChart/LineChart.base.js +1 -25
  194. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  195. package/lib-amd/components/PolarChart/PolarChart.base.d.ts +3 -0
  196. package/lib-amd/components/PolarChart/PolarChart.base.js +421 -0
  197. package/lib-amd/components/PolarChart/PolarChart.base.js.map +1 -0
  198. package/lib-amd/components/PolarChart/PolarChart.d.ts +7 -0
  199. package/lib-amd/components/PolarChart/PolarChart.js +11 -0
  200. package/lib-amd/components/PolarChart/PolarChart.js.map +1 -0
  201. package/lib-amd/components/PolarChart/PolarChart.styles.d.ts +2 -0
  202. package/lib-amd/components/PolarChart/PolarChart.styles.js +43 -0
  203. package/lib-amd/components/PolarChart/PolarChart.styles.js.map +1 -0
  204. package/lib-amd/components/PolarChart/PolarChart.types.d.ts +185 -0
  205. package/lib-amd/components/PolarChart/PolarChart.types.js +5 -0
  206. package/lib-amd/components/PolarChart/PolarChart.types.js.map +1 -0
  207. package/lib-amd/components/PolarChart/PolarChart.utils.d.ts +43 -0
  208. package/lib-amd/components/PolarChart/PolarChart.utils.js +183 -0
  209. package/lib-amd/components/PolarChart/PolarChart.utils.js.map +1 -0
  210. package/lib-amd/components/PolarChart/index.d.ts +2 -0
  211. package/lib-amd/components/PolarChart/index.js +7 -0
  212. package/lib-amd/components/PolarChart/index.js.map +1 -0
  213. package/lib-amd/components/SankeyChart/SankeyChart.base.js +10 -4
  214. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  215. package/lib-amd/components/SankeyChart/SankeyChart.styles.js +3 -1
  216. package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  217. package/lib-amd/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  218. package/lib-amd/components/SankeyChart/SankeyChart.types.js.map +1 -1
  219. package/lib-amd/components/ScatterChart/ScatterChart.base.js +13 -31
  220. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  221. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  222. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
  223. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  224. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +12 -79
  225. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  226. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  227. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +19 -30
  228. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  229. package/lib-amd/index.d.ts +2 -0
  230. package/lib-amd/index.js +3 -2
  231. package/lib-amd/index.js.map +1 -1
  232. package/lib-amd/types/IDataPoint.d.ts +107 -0
  233. package/lib-amd/types/IDataPoint.js.map +1 -1
  234. package/lib-amd/utilities/ChartTitle.d.ts +55 -0
  235. package/lib-amd/utilities/ChartTitle.js +46 -0
  236. package/lib-amd/utilities/ChartTitle.js.map +1 -0
  237. package/lib-amd/utilities/Common.styles.d.ts +51 -0
  238. package/lib-amd/utilities/Common.styles.js +74 -2
  239. package/lib-amd/utilities/Common.styles.js.map +1 -1
  240. package/lib-amd/utilities/image-export-utils.js +3 -3
  241. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  242. package/lib-amd/utilities/index.d.ts +1 -0
  243. package/lib-amd/utilities/index.js +2 -1
  244. package/lib-amd/utilities/index.js.map +1 -1
  245. package/lib-amd/utilities/utilities.d.ts +32 -8
  246. package/lib-amd/utilities/utilities.js +239 -114
  247. package/lib-amd/utilities/utilities.js.map +1 -1
  248. package/lib-commonjs/PolarChart.d.ts +1 -0
  249. package/lib-commonjs/PolarChart.js +5 -0
  250. package/lib-commonjs/PolarChart.js.map +1 -0
  251. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  252. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  253. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +0 -1
  254. package/lib-commonjs/components/AreaChart/AreaChart.base.js +0 -29
  255. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  256. package/lib-commonjs/components/ChartTable/ChartTable.base.js +12 -4
  257. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  258. package/lib-commonjs/components/ChartTable/ChartTable.styles.js +3 -0
  259. package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -1
  260. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +11 -0
  261. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  262. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  263. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  264. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  265. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  266. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  267. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  268. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  269. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  270. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +81 -41
  271. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  272. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +30 -26
  273. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  274. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +20 -1
  275. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  276. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +23 -27
  277. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  278. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  279. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +392 -269
  280. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  281. package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +1 -0
  282. package/lib-commonjs/components/DonutChart/DonutChart.base.js +15 -3
  283. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  284. package/lib-commonjs/components/DonutChart/DonutChart.styles.js +2 -0
  285. package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
  286. package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +13 -0
  287. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  288. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  289. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  290. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js +14 -8
  291. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
  292. package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js +3 -0
  293. package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  294. package/lib-commonjs/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  295. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  296. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +1 -1
  297. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  298. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +16 -22
  299. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  300. package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  301. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  302. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  303. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -16
  304. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  305. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  306. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
  307. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  308. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
  309. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  310. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  311. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  312. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +0 -1
  313. package/lib-commonjs/components/LineChart/LineChart.base.js +1 -25
  314. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  315. package/lib-commonjs/components/PolarChart/PolarChart.base.d.ts +3 -0
  316. package/lib-commonjs/components/PolarChart/PolarChart.base.js +429 -0
  317. package/lib-commonjs/components/PolarChart/PolarChart.base.js.map +1 -0
  318. package/lib-commonjs/components/PolarChart/PolarChart.d.ts +7 -0
  319. package/lib-commonjs/components/PolarChart/PolarChart.js +12 -0
  320. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  321. package/lib-commonjs/components/PolarChart/PolarChart.styles.d.ts +2 -0
  322. package/lib-commonjs/components/PolarChart/PolarChart.styles.js +43 -0
  323. package/lib-commonjs/components/PolarChart/PolarChart.styles.js.map +1 -0
  324. package/lib-commonjs/components/PolarChart/PolarChart.types.d.ts +185 -0
  325. package/lib-commonjs/components/PolarChart/PolarChart.types.js +3 -0
  326. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  327. package/lib-commonjs/components/PolarChart/PolarChart.utils.d.ts +43 -0
  328. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +188 -0
  329. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  330. package/lib-commonjs/components/PolarChart/index.d.ts +2 -0
  331. package/lib-commonjs/components/PolarChart/index.js +6 -0
  332. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  333. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +10 -3
  334. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  335. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +3 -0
  336. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  337. package/lib-commonjs/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  338. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  339. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +13 -31
  340. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  341. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  342. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  343. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  344. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +11 -79
  345. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  346. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  347. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -30
  348. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  349. package/lib-commonjs/index.d.ts +2 -0
  350. package/lib-commonjs/index.js +3 -1
  351. package/lib-commonjs/index.js.map +1 -1
  352. package/lib-commonjs/types/IDataPoint.d.ts +107 -0
  353. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  354. package/lib-commonjs/utilities/ChartTitle.d.ts +55 -0
  355. package/lib-commonjs/utilities/ChartTitle.js +49 -0
  356. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  357. package/lib-commonjs/utilities/Common.styles.d.ts +51 -0
  358. package/lib-commonjs/utilities/Common.styles.js +74 -2
  359. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  360. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  361. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  362. package/lib-commonjs/utilities/index.d.ts +1 -0
  363. package/lib-commonjs/utilities/index.js +1 -0
  364. package/lib-commonjs/utilities/index.js.map +1 -1
  365. package/lib-commonjs/utilities/utilities.d.ts +32 -8
  366. package/lib-commonjs/utilities/utilities.js +239 -114
  367. package/lib-commonjs/utilities/utilities.js.map +1 -1
  368. package/package.json +4 -12
  369. package/project.json +0 -1
  370. package/src/components/ChartTable/ChartTable.types.ts +13 -0
  371. package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +5 -0
  372. package/src/components/CommonComponents/CartesianChart.types.ts +22 -1
  373. package/src/components/DonutChart/DonutChart.types.ts +16 -0
  374. package/src/components/FunnelChart/FunnelChart.types.ts +16 -0
  375. package/src/components/GaugeChart/GaugeChart.types.ts +11 -0
  376. package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +11 -0
  377. package/src/components/PolarChart/PolarChart.types.ts +232 -0
  378. package/src/components/SankeyChart/SankeyChart.types.ts +22 -0
  379. package/src/components/ScatterChart/ScatterChart.types.ts +5 -0
@@ -8,13 +8,15 @@ import { format as d3Format } from 'd3-format';
8
8
  import { timeFormat as d3TimeFormat, timeFormatLocale as d3TimeFormatLocale, utcFormat as d3UtcFormat, } from 'd3-time-format';
9
9
  import { timeSecond as d3TimeSecond, timeMinute as d3TimeMinute, timeHour as d3TimeHour, timeDay as d3TimeDay, timeMonth as d3TimeMonth, timeWeek as d3TimeWeek, timeYear as d3TimeYear, utcSecond as d3UtcSecond, utcMinute as d3UtcMinute, utcHour as d3UtcHour, utcDay as d3UtcDay, utcMonth as d3UtcMonth, utcWeek as d3UtcWeek, utcYear as d3UtcYear, } from 'd3-time';
10
10
  import { formatPrefix as d3FormatPrefix } from 'd3-format';
11
- import { calculatePrecision, getId, precisionRound } from '@fluentui/react';
11
+ import { calculatePrecision, precisionRound } from '@fluentui/react';
12
12
  import { curveLinear as d3CurveLinear, curveNatural as d3CurveNatural, curveStep as d3CurveStep, curveStepAfter as d3CurveStepAfter, curveStepBefore as d3CurveStepBefore, } from 'd3-shape';
13
13
  import { formatDateToLocaleString, formatToLocaleString, getMultiLevelDateTimeFormatOptions, handleFloatingPointPrecisionError, isInvalidValue, isNumber, } from '@fluentui/chart-utilities';
14
14
  import { getColorContrast } from './colors';
15
15
  export var MIN_DOMAIN_MARGIN = 8;
16
16
  export var MIN_DONUT_RADIUS = 1;
17
17
  export var DEFAULT_DATE_STRING = '2000-01-01';
18
+ export var CARTESIAN_XAXIS_CLASSNAME = 'fui-cart__xAxis';
19
+ var CARTESIAN_XAXIS_TEXT_SELECTOR = ".".concat(CARTESIAN_XAXIS_CLASSNAME, " text");
18
20
  export var ChartTypes;
19
21
  (function (ChartTypes) {
20
22
  ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
@@ -73,8 +75,12 @@ export function defaultYAxisTickFormatter(value) {
73
75
  */
74
76
  export function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType) {
75
77
  var domainNRangeValues = xAxisParams.domainNRangeValues, _a = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _a === void 0 ? true : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, xAxisCount = xAxisParams.xAxisCount, xAxisElement = xAxisParams.xAxisElement, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0, tickText = xAxisParams.tickText;
78
+ var dStartValue = domainNRangeValues.dStartValue;
79
+ var dEndValue = domainNRangeValues.dEndValue;
80
+ var finalXmin = xAxisParams.xMinValue !== undefined ? Math.min(dStartValue, xAxisParams.xMinValue) : dStartValue;
81
+ var finalXmax = xAxisParams.xMaxValue !== undefined ? Math.max(dEndValue, xAxisParams.xMaxValue) : dEndValue;
76
82
  var xAxisScale = createNumericScale(scaleType)
77
- .domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
83
+ .domain([finalXmin, finalXmax])
78
84
  .range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
79
85
  showRoundOffXTickValues && xAxisScale.nice();
80
86
  var tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
@@ -88,7 +94,7 @@ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture,
88
94
  var xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
89
95
  return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : formatToLocaleString(xAxisValue, culture);
90
96
  };
91
- if (hideTickOverlap && typeof xAxisCount === 'undefined') {
97
+ if (hideTickOverlap) {
92
98
  var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(function (v, i) { return tickFormat(v, i); })) + 20;
93
99
  var _d = xAxisScale.range(), start = _d[0], end = _d[1];
94
100
  tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
@@ -114,8 +120,8 @@ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture,
114
120
  if (xAxisElement) {
115
121
  d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
116
122
  }
117
- var tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
118
- return { xScale: xAxisScale, tickValues: tickValues };
123
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
124
+ return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
119
125
  }
120
126
  /**
121
127
  * This function returns a multilevel formatter for a given date range.
@@ -220,7 +226,7 @@ function isPowerOf10(num) {
220
226
  * @param {ITickParams} tickParams
221
227
  */
222
228
  export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
223
- 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;
229
+ 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;
224
230
  var xAxisScale = useUTC ? d3ScaleUtc() : d3ScaleTime();
225
231
  xAxisScale
226
232
  .domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
@@ -261,10 +267,11 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
261
267
  }
262
268
  return formatDateToLocaleString(domainValue, culture, useUTC, false, formatOptions);
263
269
  };
264
- var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
265
- var _c = xAxisScale.range(), start = _c[0], end = _c[1];
266
- var maxPossibleTickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
267
- tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
270
+ if (hideTickOverlap) {
271
+ var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
272
+ var _c = xAxisScale.range(), start = _c[0], end = _c[1];
273
+ tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
274
+ }
268
275
  var xAxis = d3AxisBottom(xAxisScale)
269
276
  .tickSize(xAxistickSize)
270
277
  .tickPadding(tickPadding)
@@ -286,8 +293,8 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
286
293
  if (xAxisElement) {
287
294
  d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
288
295
  }
289
- var tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
290
- return { xScale: xAxisScale, tickValues: tickValues };
296
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
297
+ return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
291
298
  }
292
299
  /**
293
300
  * Create String X axis
@@ -349,7 +356,7 @@ export function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
349
356
  if (xAxisParams.xAxisElement) {
350
357
  d3Select(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
351
358
  }
352
- return { xScale: xAxisScale, tickValues: tickValues };
359
+ return { xScale: xAxisScale, tickValues: tickValues, tickLabels: tickValues.map(xAxis.tickFormat()) };
353
360
  }
354
361
  /**
355
362
  * This method is used to calculate the rounded tick values for the y-axis
@@ -673,14 +680,15 @@ export var DEFAULT_WRAP_WIDTH = 10;
673
680
  * @returns
674
681
  */
675
682
  export function createWrapOfXLabels(wrapLabelProps) {
676
- var node = wrapLabelProps.node, xAxis = wrapLabelProps.xAxis, noOfCharsToTruncate = wrapLabelProps.noOfCharsToTruncate, showXAxisLablesTooltip = wrapLabelProps.showXAxisLablesTooltip, _a = wrapLabelProps.width, width = _a === void 0 ? DEFAULT_WRAP_WIDTH : _a;
683
+ var _a, _b;
684
+ var node = wrapLabelProps.node, xAxis = wrapLabelProps.xAxis, noOfCharsToTruncate = wrapLabelProps.noOfCharsToTruncate, showXAxisLablesTooltip = wrapLabelProps.showXAxisLablesTooltip, _c = wrapLabelProps.width, width = _c === void 0 ? DEFAULT_WRAP_WIDTH : _c, container = wrapLabelProps.container;
677
685
  if (node === null) {
678
686
  return;
679
687
  }
680
688
  var axisNode = d3Select(node).call(xAxis);
681
689
  var removeVal = 0;
682
690
  var maxLines = 1;
683
- axisNode.selectAll('.tick text').each(function () {
691
+ axisNode.selectAll('.tick text').each(function (_, tickIndex) {
684
692
  var text = d3Select(this);
685
693
  var totalWord = text.text();
686
694
  var truncatedWord = "".concat(text.text().slice(0, noOfCharsToTruncate), "...");
@@ -694,41 +702,27 @@ export function createWrapOfXLabels(wrapLabelProps) {
694
702
  var dy = parseFloat(text.attr('dy'));
695
703
  var tspan = text
696
704
  .text(null)
705
+ .attr('data-full', totalWord)
697
706
  .append('tspan')
698
707
  .attr('x', 0)
699
708
  .attr('y', y)
700
- .attr('id', 'BaseSpan')
701
- .attr('dy', dy + 'em')
702
- .attr('data-', totalWord);
703
- if (showXAxisLablesTooltip && totalWordLength > noOfCharsToTruncate) {
704
- tspan = text
705
- .append('tspan')
706
- .attr('id', 'showDots')
707
- .attr('x', 0)
708
- .attr('y', y)
709
- .attr('dy', dy + 'em')
710
- .text(truncatedWord);
711
- }
712
- else if (showXAxisLablesTooltip && totalWordLength <= noOfCharsToTruncate) {
713
- tspan = text
714
- .append('tspan')
715
- .attr('id', 'LessLength')
716
- .attr('x', 0)
717
- .attr('y', y)
718
- .attr('dy', dy + 'em')
719
- .text(totalWord);
709
+ .attr('dy', dy + 'em');
710
+ if (showXAxisLablesTooltip) {
711
+ tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
720
712
  }
721
713
  else {
714
+ var maxWidth = Array.isArray(width) ? width[tickIndex] : width;
722
715
  while ((word = words.pop())) {
723
716
  line.push(word);
724
- tspan.text(line.join(' '));
725
- if (tspan.node().getComputedTextLength() > width && line.length > 1) {
717
+ var label = line.join(' ');
718
+ tspan.text(label);
719
+ var labelWidth = getTextSize(label, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
720
+ if (labelWidth > maxWidth && line.length > 1) {
726
721
  line.pop();
727
722
  tspan.text(line.join(' '));
728
723
  line = [word];
729
724
  tspan = text
730
725
  .append('tspan')
731
- .attr('id', 'WordBreakId')
732
726
  .attr('x', 0)
733
727
  .attr('y', y)
734
728
  .attr('dy', ++lineNumber * lineHeight + dy + 'em')
@@ -740,10 +734,7 @@ export function createWrapOfXLabels(wrapLabelProps) {
740
734
  });
741
735
  if (!showXAxisLablesTooltip) {
742
736
  var maxHeight = 12; // intial value to render corretly first time
743
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
744
- var outerHTMLElement = document.getElementById('WordBreakId');
745
- var BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
746
- var boxHeight = BoxCordinates && BoxCordinates.height;
737
+ var boxHeight = (_b = (_a = (container !== null && container !== void 0 ? container : document).querySelector(".".concat(CARTESIAN_XAXIS_CLASSNAME, " tspan"))) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) !== null && _b !== void 0 ? _b : 0;
747
738
  if (boxHeight > maxHeight) {
748
739
  maxHeight = boxHeight;
749
740
  }
@@ -768,53 +759,35 @@ yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
768
759
  ? "...".concat(text.text().slice(0, noOfCharsToTruncate))
769
760
  : "".concat(text.text().slice(0, noOfCharsToTruncate), "...");
770
761
  var totalWordLength = text.text().length;
771
- var padding = 0; // ems
772
762
  var y = text.attr('y');
773
763
  var x = text.attr('x');
774
764
  var dy = parseFloat(text.attr('dy'));
775
- var dx = 0;
776
- text
765
+ var tspan = text
777
766
  .text(null)
767
+ .attr('data-full', totalWord)
778
768
  .append('tspan')
779
769
  .attr('x', x)
780
770
  .attr('y', y)
781
- .attr('id', 'BaseSpan')
782
- .attr('dy', dy + 'em')
783
- .attr('data-', totalWord);
784
- if (truncateLabel && totalWordLength > noOfCharsToTruncate) {
785
- text
786
- .append('tspan')
787
- .attr('id', 'showDots')
788
- .attr('x', x)
789
- .attr('y', y)
790
- .attr('dy', dy + 'em')
791
- .attr('dx', padding + dx + 'em')
792
- .text(truncatedWord);
793
- }
794
- else {
795
- text
796
- .append('tspan')
797
- .attr('id', 'LessLength')
798
- .attr('x', x)
799
- .attr('y', y)
800
- .attr('dx', padding + dx + 'em')
801
- .text(totalWord);
771
+ .attr('dy', dy + 'em');
772
+ if (truncateLabel) {
773
+ tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
802
774
  }
803
775
  });
804
776
  }
805
777
  export var wrapContent = function (content, id, maxWidth) {
806
778
  var textElement = d3Select("#".concat(id));
807
779
  textElement.text(content);
808
- if (!textElement.node()) {
780
+ var node = textElement.node();
781
+ if (!node || typeof node.getComputedTextLength !== 'function') {
809
782
  return false;
810
783
  }
811
784
  var isOverflowing = false;
812
- var textLength = textElement.node().getComputedTextLength();
785
+ var textLength = node.getComputedTextLength();
813
786
  while (textLength > maxWidth && content.length > 0) {
814
787
  content = content.slice(0, -1);
815
788
  textElement.text(content + '...');
816
789
  isOverflowing = true;
817
- textLength = textElement.node().getComputedTextLength();
790
+ textLength = node.getComputedTextLength();
818
791
  }
819
792
  return isOverflowing;
820
793
  };
@@ -851,38 +824,41 @@ export var calculateLongestLabelWidth = function (labels, query) {
851
824
  */
852
825
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
853
826
  export function tooltipOfAxislabels(axistooltipProps) {
854
- var tooltipCls = axistooltipProps.tooltipCls, axis = axistooltipProps.axis, id = axistooltipProps.id;
827
+ var tooltipCls = axistooltipProps.tooltipCls, axis = axistooltipProps.axis, id = axistooltipProps.id, container = axistooltipProps.container;
855
828
  if (axis === null) {
856
829
  return null;
857
830
  }
858
- var div = d3Select('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
859
- var aa = axis.selectAll('#BaseSpan')._groups[0];
860
- var baseSpanLength = aa && Object.keys(aa).length;
861
- var originalDataArray = [];
862
- for (var i = 0; i < baseSpanLength; i++) {
863
- var originalData = aa[i].dataset && Object.values(aa[i].dataset)[0];
864
- originalDataArray.push(originalData);
865
- }
866
- var tickObject = axis.selectAll('.tick')._groups[0];
867
- var tickObjectLength = tickObject && Object.keys(tickObject).length;
868
- var _loop_1 = function (i) {
869
- var d1 = tickObject[i];
870
- d3Select(d1)
831
+ var div = (container ? d3Select(container) : d3Select('body'))
832
+ .append('div')
833
+ .attr('id', id)
834
+ .attr('class', tooltipCls)
835
+ .style('opacity', 0);
836
+ axis.selectAll('.tick text').each(function () {
837
+ var tickSelection = d3Select(this);
838
+ var fullLabel = tickSelection.attr('data-full');
839
+ if (tickSelection.text() === fullLabel) {
840
+ return;
841
+ }
842
+ var tickEl = this;
843
+ tickSelection
871
844
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
872
845
  .on('mouseover', function (event, d) {
873
- div.style('opacity', 0.9);
846
+ var _a;
847
+ var containerBounds = container === null || container === void 0 ? void 0 : container.getBoundingClientRect();
848
+ var tickBounds = tickEl.getBoundingClientRect();
849
+ var tooltipBottom = containerBounds ? containerBounds.bottom - (tickBounds.top - 4) : tickBounds.top - 4;
850
+ var tooltipLeft = (tickBounds.left + tickBounds.right) / 2 - ((_a = containerBounds === null || containerBounds === void 0 ? void 0 : containerBounds.left) !== null && _a !== void 0 ? _a : 0);
874
851
  div
875
- .text(originalDataArray[i])
876
- .style('left', event.pageX + 'px')
877
- .style('top', event.pageY - 28 + 'px');
852
+ .text(fullLabel)
853
+ .style('bottom', "".concat(tooltipBottom, "px"))
854
+ .style('left', "".concat(tooltipLeft, "px"))
855
+ .style('transform', 'translateX(-50%)')
856
+ .style('opacity', 0.9);
878
857
  })
879
858
  .on('mouseout', function (d) {
880
859
  div.style('opacity', 0);
881
860
  });
882
- };
883
- for (var i = 0; i < tickObjectLength; i++) {
884
- _loop_1(i);
885
- }
861
+ });
886
862
  }
887
863
  /**
888
864
  * Find the axis type of line chart and area chart from given data
@@ -910,11 +886,11 @@ export function getXAxisType(points) {
910
886
  * @param {boolean} isRTL
911
887
  * @returns {IDomainNRange}
912
888
  */
913
- export function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode) {
889
+ export function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode, xMinVal, xMaxVal) {
914
890
  var isScatterPolar = isScatterPolarSeries(points);
915
891
  var _a = getScatterXDomainExtent(points, scaleType), xMin = _a[0], xMax = _a[1];
916
892
  if (hasMarkersMode) {
917
- var xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType);
893
+ var xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType, xMinVal, xMaxVal);
918
894
  xMin = xMin - xPadding.start;
919
895
  xMax = xMax + xPadding.end;
920
896
  }
@@ -1369,8 +1345,8 @@ export function areArraysEqual(arr1, arr2) {
1369
1345
  return true;
1370
1346
  }
1371
1347
  var cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
1372
- export function resolveCSSVariables(chartContainer, styleRules) {
1373
- var containerStyles = getComputedStyle(chartContainer);
1348
+ export function resolveCSSVariables(container, styleRules) {
1349
+ var containerStyles = getComputedStyle(container);
1374
1350
  return styleRules.replace(cssVarRegExp, function (match, group1) {
1375
1351
  return containerStyles.getPropertyValue(group1);
1376
1352
  });
@@ -1399,24 +1375,50 @@ var MEASUREMENT_SPAN_STYLE = {
1399
1375
  border: 'none',
1400
1376
  whiteSpace: 'pre',
1401
1377
  };
1402
- var MEASUREMENT_SPAN_ID = getId('measurement_span_');
1403
- export var createMeasurementSpan = function (text, className, parentElement) {
1378
+ var MEASUREMENT_SPAN_ID = 'fui_measurement_span';
1379
+ var TEXT_STYLE_PROPERTIES = [
1380
+ 'font-size',
1381
+ 'font-family',
1382
+ 'font-weight',
1383
+ 'font-style',
1384
+ 'letter-spacing',
1385
+ 'text-transform',
1386
+ ];
1387
+ export var measureTextWithDOM = function (text, cssSelector, container) {
1404
1388
  var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
1405
1389
  if (!measurementSpan) {
1406
1390
  measurementSpan = document.createElement('span');
1407
1391
  measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
1408
1392
  measurementSpan.setAttribute('aria-hidden', 'true');
1409
- if (parentElement) {
1410
- parentElement.appendChild(measurementSpan);
1411
- }
1412
- else {
1413
- document.body.appendChild(measurementSpan);
1414
- }
1393
+ (container !== null && container !== void 0 ? container : document.body).appendChild(measurementSpan);
1415
1394
  }
1416
- measurementSpan.setAttribute('class', className);
1417
1395
  Object.assign(measurementSpan.style, MEASUREMENT_SPAN_STYLE);
1396
+ var refEl = (container !== null && container !== void 0 ? container : document).querySelector(cssSelector);
1397
+ if (refEl) {
1398
+ copyStyle(TEXT_STYLE_PROPERTIES, refEl, measurementSpan);
1399
+ }
1418
1400
  measurementSpan.textContent = "".concat(text);
1419
- return measurementSpan;
1401
+ var rect = measurementSpan.getBoundingClientRect();
1402
+ return { node: measurementSpan, width: rect.width, height: rect.height };
1403
+ };
1404
+ var CACHE_SIZE = 2000;
1405
+ var textSizeCache = new Map();
1406
+ export var getTextSize = function (text, cssSelector, container) {
1407
+ var cacheKey = "".concat(text, "|").concat(cssSelector);
1408
+ var cachedResult = textSizeCache.get(cacheKey);
1409
+ if (cachedResult) {
1410
+ return cachedResult;
1411
+ }
1412
+ var _a = measureTextWithDOM(text, cssSelector, container), width = _a.width, height = _a.height;
1413
+ // TODO: Improve cache eviction strategy if needed (e.g., LRU)
1414
+ if (textSizeCache.size >= CACHE_SIZE) {
1415
+ var firstKey = textSizeCache.keys().next().value;
1416
+ if (!isInvalidValue(firstKey)) {
1417
+ textSizeCache.delete(firstKey);
1418
+ }
1419
+ }
1420
+ textSizeCache.set(cacheKey, { width: width, height: height });
1421
+ return { width: width, height: height };
1420
1422
  };
1421
1423
  export function getCurveFactory(curve, defaultFactory) {
1422
1424
  if (defaultFactory === void 0) { defaultFactory = d3CurveLinear; }
@@ -1544,17 +1546,28 @@ var createNumericScale = function (scaleType) {
1544
1546
  return d3ScaleLinear();
1545
1547
  }
1546
1548
  };
1547
- export var getDomainPaddingForMarkers = function (minVal, maxVal, scaleType) {
1549
+ export var getDomainPaddingForMarkers = function (minVal, maxVal, scaleType, userMinVal, userMaxVal) {
1548
1550
  if (scaleType === 'log') {
1549
1551
  return {
1550
1552
  start: minVal * 0.5,
1551
1553
  end: maxVal,
1552
1554
  };
1553
1555
  }
1554
- var defaultPadding = (maxVal - minVal) * 0.1;
1556
+ /* if user explicitly sets userMinVal or userMaxVal, we will check that to avoid excessive padding on either
1557
+ side.If the difference between minVal and userMinVal is more than 10% of the data range, we set padding
1558
+ to 0 on that side. this is to avoid cases where userMinVal is significantly smaller than minVal or
1559
+ userMaxVal is significantly larger than maxVal, which would lead to excessive padding. In other cases,
1560
+ we apply the default 10% padding on both sides.
1561
+ */
1562
+ var rangePadding = (maxVal - minVal) * 0.1;
1563
+ // If explicit bounds are set and they're far from the data range, don't add extra padding
1564
+ var paddingAlreadySatisfiedAtMin = userMinVal !== undefined && rangePadding > Math.abs(minVal - Math.min(minVal, userMinVal));
1565
+ var paddingAlreadySatisfiedAtMax = userMaxVal !== undefined && rangePadding > Math.abs(maxVal - Math.max(maxVal, userMaxVal));
1566
+ var startPadding = paddingAlreadySatisfiedAtMin ? 0 : rangePadding;
1567
+ var endPadding = paddingAlreadySatisfiedAtMax ? 0 : rangePadding;
1555
1568
  return {
1556
- start: defaultPadding,
1557
- end: defaultPadding,
1569
+ start: startPadding,
1570
+ end: endPadding,
1558
1571
  };
1559
1572
  };
1560
1573
  /**
@@ -1649,7 +1662,7 @@ export var generateMonthlyTicks = function (tick0, tickStepInMonths, scaleDomain
1649
1662
  }
1650
1663
  return ticks;
1651
1664
  };
1652
- var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
1665
+ export var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
1653
1666
  var refTick = typeof tick0 === 'number' ? tick0 : 0;
1654
1667
  if (scaleType === 'log') {
1655
1668
  if (typeof tickStep === 'number' && tickStep > 0) {
@@ -1668,7 +1681,7 @@ var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
1668
1681
  return generateLinearTicks(refTick, tickStep, scaleDomain);
1669
1682
  }
1670
1683
  };
1671
- var generateDateTicks = function (tickStep, tick0, scaleDomain, useUTC) {
1684
+ export var generateDateTicks = function (tickStep, tick0, scaleDomain, useUTC) {
1672
1685
  var refTick = tick0 instanceof Date ? tick0 : new Date(DEFAULT_DATE_STRING);
1673
1686
  if (typeof tickStep === 'number' && tickStep > 0) {
1674
1687
  return generateLinearTicks(+refTick, tickStep, scaleDomain.map(function (d) { return +d; })).map(function (t) { return new Date(t); });
@@ -1694,4 +1707,112 @@ export var findCalloutPoints = function (calloutPointsByX, x) {
1694
1707
  values: calloutPointsByX[key],
1695
1708
  };
1696
1709
  };
1710
+ export var autoLayoutXAxisLabels = function (tickValues, tickLabels, scale, axisNode, containerWidth, container) {
1711
+ var _a;
1712
+ var requiresWrap = false;
1713
+ var requiresTruncate = false;
1714
+ var maxWidths = [];
1715
+ var _b = scale.range(), rangeStart = _b[0], rangeEnd = _b[1];
1716
+ var isRTL = rangeEnd - rangeStart < 0;
1717
+ var start = isRTL ? containerWidth : 0;
1718
+ var end = isRTL ? 0 : containerWidth;
1719
+ var getTickPosition = function (index) {
1720
+ var _a;
1721
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1722
+ return ((_a = scale(tickValues[index])) !== null && _a !== void 0 ? _a : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
1723
+ };
1724
+ var getLabelWidth = function (text) {
1725
+ return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
1726
+ };
1727
+ for (var i = 0; i < tickValues.length; i++) {
1728
+ var position = getTickPosition(i);
1729
+ var leftSpace = Math.abs(i > 0 ? (position - getTickPosition(i - 1)) / 2 : position - start);
1730
+ var rightSpace = Math.abs(i + 1 < tickValues.length ? (getTickPosition(i + 1) - position) / 2 : end - position);
1731
+ var maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
1732
+ var label = tickLabels[i];
1733
+ var labelWidth = getLabelWidth(label);
1734
+ maxWidths.push(maxAvailableWidth);
1735
+ if (labelWidth > maxAvailableWidth) {
1736
+ var longestWordWidth = Math.max.apply(Math, label.split(/\s+/).map(function (word) { return getLabelWidth(word); }));
1737
+ if (longestWordWidth <= maxAvailableWidth) {
1738
+ requiresWrap = true;
1739
+ }
1740
+ else {
1741
+ requiresTruncate = true;
1742
+ }
1743
+ }
1744
+ }
1745
+ if (requiresTruncate) {
1746
+ return truncateAndStaggerXAxisLabels(tickValues, tickLabels, scale, axisNode, containerWidth, container);
1747
+ }
1748
+ if (requiresWrap) {
1749
+ return ((_a = createWrapOfXLabels({
1750
+ node: axisNode,
1751
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1752
+ xAxis: scale,
1753
+ noOfCharsToTruncate: 100,
1754
+ showXAxisLablesTooltip: false,
1755
+ width: maxWidths,
1756
+ container: container,
1757
+ })) !== null && _a !== void 0 ? _a : 0);
1758
+ }
1759
+ return 0;
1760
+ };
1761
+ var truncateAndStaggerXAxisLabels = function (tickValues, tickLabels, scale, axisNode, containerWidth, container) {
1762
+ if (!axisNode) {
1763
+ return 0;
1764
+ }
1765
+ var maxHeight = 12;
1766
+ var _a = scale.range(), rangeStart = _a[0], rangeEnd = _a[1];
1767
+ var isRTL = rangeEnd - rangeStart < 0;
1768
+ var start = isRTL ? containerWidth : 0;
1769
+ var end = isRTL ? 0 : containerWidth;
1770
+ var getTickPosition = function (index) {
1771
+ var _a;
1772
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1773
+ return ((_a = scale(tickValues[index])) !== null && _a !== void 0 ? _a : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
1774
+ };
1775
+ var getLabelSize = function (text) {
1776
+ return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container);
1777
+ };
1778
+ d3Select(axisNode)
1779
+ .selectAll('.tick text')
1780
+ .each(function (_, i) {
1781
+ var position = getTickPosition(i);
1782
+ var leftSpace = Math.abs(i > 0 ? position - getTickPosition(i - 1) : position - start);
1783
+ var rightSpace = Math.abs(i + 1 < tickValues.length ? getTickPosition(i + 1) - position : end - position);
1784
+ var maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
1785
+ var label = tickLabels[i];
1786
+ var textNode = d3Select(this).text(null).attr('data-full', label);
1787
+ var lineHeight = 1.1; // ems
1788
+ var y = textNode.attr('y');
1789
+ var dy = parseFloat(textNode.attr('dy'));
1790
+ textNode
1791
+ .append('tspan')
1792
+ .attr('x', 0)
1793
+ .attr('y', y)
1794
+ .attr('dy', (i % 2 === 1 ? lineHeight : 0) + dy + 'em')
1795
+ .text(truncateTextToFitWidth(label, maxAvailableWidth, function (s) { return getLabelSize(s).width; }));
1796
+ maxHeight = Math.max(maxHeight, getLabelSize(label).height);
1797
+ });
1798
+ return tickValues.length > 1 ? maxHeight : 0;
1799
+ };
1800
+ var truncateTextToFitWidth = function (text, maxWidth, measure) {
1801
+ if (measure(text) <= maxWidth) {
1802
+ return text;
1803
+ }
1804
+ var lo = 1;
1805
+ var hi = text.length;
1806
+ while (lo < hi) {
1807
+ var mid = Math.floor((lo + hi + 1) / 2);
1808
+ var candidate = text.slice(0, mid) + '...';
1809
+ if (measure(candidate) <= maxWidth) {
1810
+ lo = mid;
1811
+ }
1812
+ else {
1813
+ hi = mid - 1;
1814
+ }
1815
+ }
1816
+ return text.slice(0, lo) + '...';
1817
+ };
1697
1818
  //# sourceMappingURL=utilities.js.map