@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
@@ -0,0 +1,185 @@
1
+ import * as React from 'react';
2
+ import { IAreaPolarSeries, AxisCategoryOrder, AxisProps, AxisScaleType, IChart, ILinePolarSeries, IMargins, IScatterPolarSeries } from '../../types/IDataPoint';
3
+ import { ILegendsProps } from '../Legends/Legends.types';
4
+ import { ICalloutProps, IStyle, IStyleFunctionOrObject, ITheme } from '@fluentui/react';
5
+ /**
6
+ * Configuration options for a polar axis.
7
+ * {@docCategory PolarChart}
8
+ */
9
+ export type PolarAxisProps = AxisProps & {
10
+ /**
11
+ * Values at which ticks should be placed on the axis.
12
+ */
13
+ tickValues?: number[] | Date[] | string[];
14
+ /**
15
+ * Format string for the axis ticks.
16
+ * For numbers, see: https://d3js.org/d3-format.
17
+ * And for dates see: https://d3js.org/d3-time-format.
18
+ */
19
+ tickFormat?: string;
20
+ /**
21
+ * Number of ticks to display on the axis.
22
+ */
23
+ tickCount?: number;
24
+ /**
25
+ * Defines the order of categories on the axis.
26
+ * @default 'default'
27
+ */
28
+ categoryOrder?: AxisCategoryOrder;
29
+ /**
30
+ * Scale type for the axis.
31
+ * @default 'default'
32
+ */
33
+ scaleType?: AxisScaleType;
34
+ /**
35
+ * Start value of the axis range.
36
+ */
37
+ rangeStart?: number | Date;
38
+ /**
39
+ * End value of the axis range.
40
+ */
41
+ rangeEnd?: number | Date;
42
+ };
43
+ /**
44
+ * Polar Chart properties
45
+ * {@docCategory PolarChart}
46
+ */
47
+ export interface IPolarChartProps {
48
+ /**
49
+ * Data series to be rendered in the polar chart.
50
+ */
51
+ data: (IAreaPolarSeries | ILinePolarSeries | IScatterPolarSeries)[];
52
+ /**
53
+ * Width of the polar chart.
54
+ * @default 200
55
+ */
56
+ width?: number;
57
+ /**
58
+ * Height of the polar chart.
59
+ * @default 200
60
+ */
61
+ height?: number;
62
+ /**
63
+ * Margins around the chart area.
64
+ */
65
+ margins?: IMargins;
66
+ /**
67
+ * If true, hides the legend.
68
+ * @default false
69
+ */
70
+ hideLegend?: boolean;
71
+ /**
72
+ * If true, hides the tooltip.
73
+ * @default false
74
+ */
75
+ hideTooltip?: boolean;
76
+ legendProps?: Partial<ILegendsProps>;
77
+ /**
78
+ * Title of the chart.
79
+ */
80
+ chartTitle?: string;
81
+ /**
82
+ * Fraction of the radius to cut out from the center of the chart.
83
+ * Accepts values in the range [0, 1].
84
+ */
85
+ hole?: number;
86
+ /**
87
+ * Shape of the polar chart.
88
+ * @default 'circle'
89
+ */
90
+ shape?: 'circle' | 'polygon';
91
+ /**
92
+ * Direction in which the chart is drawn.
93
+ * @default 'counterclockwise'
94
+ */
95
+ direction?: 'clockwise' | 'counterclockwise';
96
+ /**
97
+ * Configuration options for the radial axis.
98
+ */
99
+ radialAxis?: PolarAxisProps;
100
+ /**
101
+ * Configuration options for the angular axis.
102
+ */
103
+ angularAxis?: PolarAxisProps & {
104
+ /**
105
+ * Format unit for angular values.
106
+ * @default 'degrees'
107
+ */
108
+ unit?: 'radians' | 'degrees';
109
+ };
110
+ /**
111
+ * Optional callback to access the Chart interface. Use this instead of ref for accessing
112
+ * the public methods and properties of the component.
113
+ */
114
+ componentRef?: React.Ref<IChart>;
115
+ /**
116
+ * Locale identifier string used to format numbers and dates according to the specified culture.
117
+ * Example: 'en-US', 'fr-FR'.
118
+ */
119
+ culture?: string;
120
+ /**
121
+ * Options for localizing date values.
122
+ */
123
+ dateLocalizeOptions?: Intl.DateTimeFormatOptions;
124
+ /**
125
+ * If true, date values are treated as UTC dates.
126
+ * @default false
127
+ */
128
+ useUTC?: boolean;
129
+ /**
130
+ * Theme (provided through customization)
131
+ */
132
+ theme?: ITheme;
133
+ /**
134
+ * Call to provide customized styling that will layer on top of the variant rules
135
+ */
136
+ styles?: IStyleFunctionOrObject<IPolarChartStyleProps, IPolarChartStyles>;
137
+ /**
138
+ * Props for the callout in the chart
139
+ */
140
+ calloutProps?: Partial<ICalloutProps>;
141
+ }
142
+ /**
143
+ * Polar Chart style properties
144
+ * {@docCategory PolarChart}
145
+ */
146
+ export interface IPolarChartStyleProps {
147
+ /**
148
+ * Theme (provided through customization)
149
+ */
150
+ theme: ITheme;
151
+ }
152
+ /**
153
+ * Polar Chart styles
154
+ * {@docCategory PolarChart}
155
+ */
156
+ export interface IPolarChartStyles {
157
+ /**
158
+ * Style for the root element.
159
+ */
160
+ root?: IStyle;
161
+ /**
162
+ * Style for the chart wrapper element.
163
+ */
164
+ chartWrapper?: IStyle;
165
+ /**
166
+ * Style for the chart element.
167
+ */
168
+ chart?: IStyle;
169
+ /**
170
+ * Style for the inner grid lines.
171
+ */
172
+ gridLineInner?: IStyle;
173
+ /**
174
+ * Style for the outer grid lines.
175
+ */
176
+ gridLineOuter?: IStyle;
177
+ /**
178
+ * Style for the tick labels.
179
+ */
180
+ tickLabel?: IStyle;
181
+ /**
182
+ * Style for the legend container.
183
+ */
184
+ legendContainer?: IStyle;
185
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=PolarChart.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolarChart.types.js","sourceRoot":"../src/","sources":["components/PolarChart/PolarChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport {\n IAreaPolarSeries,\n AxisCategoryOrder,\n AxisProps,\n AxisScaleType,\n IChart,\n ILinePolarSeries,\n IMargins,\n IScatterPolarSeries,\n} from '../../types/IDataPoint';\nimport { ILegendsProps } from '../Legends/Legends.types';\nimport { ICalloutProps, IStyle, IStyleFunctionOrObject, ITheme } from '@fluentui/react';\n\n/**\n * Configuration options for a polar axis.\n * {@docCategory PolarChart}\n */\nexport type PolarAxisProps = AxisProps & {\n /**\n * Values at which ticks should be placed on the axis.\n */\n tickValues?: number[] | Date[] | string[];\n\n /**\n * Format string for the axis ticks.\n * For numbers, see: https://d3js.org/d3-format.\n * And for dates see: https://d3js.org/d3-time-format.\n */\n tickFormat?: string;\n\n /**\n * Number of ticks to display on the axis.\n */\n tickCount?: number;\n\n /**\n * Defines the order of categories on the axis.\n * @default 'default'\n */\n categoryOrder?: AxisCategoryOrder;\n\n /**\n * Scale type for the axis.\n * @default 'default'\n */\n scaleType?: AxisScaleType;\n\n /**\n * Start value of the axis range.\n */\n rangeStart?: number | Date;\n\n /**\n * End value of the axis range.\n */\n rangeEnd?: number | Date;\n};\n\n/**\n * Polar Chart properties\n * {@docCategory PolarChart}\n */\nexport interface IPolarChartProps {\n /**\n * Data series to be rendered in the polar chart.\n */\n data: (IAreaPolarSeries | ILinePolarSeries | IScatterPolarSeries)[];\n\n /**\n * Width of the polar chart.\n * @default 200\n */\n width?: number;\n\n /**\n * Height of the polar chart.\n * @default 200\n */\n height?: number;\n\n /**\n * Margins around the chart area.\n */\n margins?: IMargins;\n\n /**\n * If true, hides the legend.\n * @default false\n */\n hideLegend?: boolean;\n\n /**\n * If true, hides the tooltip.\n * @default false\n */\n hideTooltip?: boolean;\n\n /*\n * Properties for customizing the legend.\n */\n legendProps?: Partial<ILegendsProps>;\n\n /**\n * Title of the chart.\n */\n chartTitle?: string;\n\n /**\n * Fraction of the radius to cut out from the center of the chart.\n * Accepts values in the range [0, 1].\n */\n hole?: number;\n\n /**\n * Shape of the polar chart.\n * @default 'circle'\n */\n shape?: 'circle' | 'polygon';\n\n /**\n * Direction in which the chart is drawn.\n * @default 'counterclockwise'\n */\n direction?: 'clockwise' | 'counterclockwise';\n\n /**\n * Configuration options for the radial axis.\n */\n radialAxis?: PolarAxisProps;\n\n /**\n * Configuration options for the angular axis.\n */\n angularAxis?: PolarAxisProps & {\n /**\n * Format unit for angular values.\n * @default 'degrees'\n */\n unit?: 'radians' | 'degrees';\n };\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.Ref<IChart>;\n\n /**\n * Locale identifier string used to format numbers and dates according to the specified culture.\n * Example: 'en-US', 'fr-FR'.\n */\n culture?: string;\n\n /**\n * Options for localizing date values.\n */\n dateLocalizeOptions?: Intl.DateTimeFormatOptions;\n\n /**\n * If true, date values are treated as UTC dates.\n * @default false\n */\n useUTC?: boolean;\n\n /**\n * Theme (provided through customization)\n */\n theme?: ITheme;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules\n */\n styles?: IStyleFunctionOrObject<IPolarChartStyleProps, IPolarChartStyles>;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\n}\n\n/**\n * Polar Chart style properties\n * {@docCategory PolarChart}\n */\nexport interface IPolarChartStyleProps {\n /**\n * Theme (provided through customization)\n */\n theme: ITheme;\n}\n\n/**\n * Polar Chart styles\n * {@docCategory PolarChart}\n */\nexport interface IPolarChartStyles {\n /**\n * Style for the root element.\n */\n root?: IStyle;\n\n /**\n * Style for the chart wrapper element.\n */\n chartWrapper?: IStyle;\n\n /**\n * Style for the chart element.\n */\n chart?: IStyle;\n\n /**\n * Style for the inner grid lines.\n */\n gridLineInner?: IStyle;\n\n /**\n * Style for the outer grid lines.\n */\n gridLineOuter?: IStyle;\n\n /**\n * Style for the tick labels.\n */\n tickLabel?: IStyle;\n\n /**\n * Style for the legend container.\n */\n legendContainer?: IStyle;\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import { ScaleBand, ScaleContinuousNumeric, ScaleTime } from 'd3-scale';
2
+ import { AxisScaleType } from '../../types/IDataPoint';
3
+ import { IPolarChartProps } from './PolarChart.types';
4
+ export declare const EPSILON = 0.000001;
5
+ export declare const createRadialScale: (scaleType: string, domain: (string | number | Date)[], range: number[], opts?: {
6
+ useUTC?: boolean;
7
+ tickCount?: number;
8
+ tickValues?: (string | number | Date)[];
9
+ tickText?: string[];
10
+ tickFormat?: string;
11
+ culture?: string;
12
+ tickStep?: number | string;
13
+ tick0?: number | Date;
14
+ dateLocalizeOptions?: Intl.DateTimeFormatOptions;
15
+ }) => {
16
+ scale: ScaleBand<string> | ScaleContinuousNumeric<number, number, undefined> | ScaleTime<number, number>;
17
+ tickValues: (string | number | Date)[];
18
+ tickLabels: string[];
19
+ };
20
+ export declare const getScaleType: (values: (string | number | Date)[], opts?: {
21
+ scaleType?: AxisScaleType;
22
+ supportsLog?: boolean;
23
+ }) => string;
24
+ export declare const getContinuousScaleDomain: (scaleType: string, values: (number | Date)[], opts?: {
25
+ rangeStart?: number | Date;
26
+ rangeEnd?: number | Date;
27
+ }) => (number | Date)[];
28
+ export declare const createAngularScale: (scaleType: string, domain: (string | number | Date)[], opts?: {
29
+ tickCount?: number;
30
+ tickValues?: (string | number | Date)[];
31
+ tickText?: string[];
32
+ tickFormat?: string;
33
+ culture?: string;
34
+ tickStep?: number | string;
35
+ tick0?: number | Date;
36
+ direction?: IPolarChartProps["direction"];
37
+ unit?: NonNullable<IPolarChartProps["angularAxis"]>["unit"];
38
+ }) => {
39
+ scale: (v: string | number) => number;
40
+ tickValues: (string | number)[];
41
+ tickLabels: string[];
42
+ };
43
+ export declare const formatAngle: (value: string | number, unit: NonNullable<IPolarChartProps["angularAxis"]>["unit"]) => string;
@@ -0,0 +1,180 @@
1
+ import { scaleBand as d3ScaleBand, scaleLinear as d3ScaleLinear, scaleLog as d3ScaleLog, scaleTime as d3ScaleTime, scaleUtc as d3ScaleUtc, } from 'd3-scale';
2
+ import { extent as d3Extent, range as d3Range } from 'd3-array';
3
+ import { format as d3Format } from 'd3-format';
4
+ import { generateDateTicks, generateNumericTicks, getDateFormatLevel, isValidDomainValue, } from '../../utilities/utilities';
5
+ import { isInvalidValue, formatToLocaleString, getMultiLevelDateTimeFormatOptions, formatDateToLocaleString, } from '@fluentui/chart-utilities';
6
+ import { timeFormat as d3TimeFormat, utcFormat as d3UtcFormat } from 'd3-time-format';
7
+ import { precisionRound } from '@fluentui/react';
8
+ export var EPSILON = 1e-6;
9
+ export var createRadialScale = function (scaleType, domain, range, opts) {
10
+ var _a, _b;
11
+ if (opts === void 0) { opts = {}; }
12
+ if (scaleType === 'category') {
13
+ var scale_1 = d3ScaleBand()
14
+ .domain(domain)
15
+ .range(range)
16
+ .paddingInner(1);
17
+ var tickValues_1 = Array.isArray(opts.tickValues) ? opts.tickValues : domain;
18
+ var tickFormat_1 = function (domainValue, index) {
19
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {
20
+ return opts.tickText[index];
21
+ }
22
+ return domainValue;
23
+ };
24
+ return { scale: scale_1, tickValues: tickValues_1, tickLabels: tickValues_1.map(tickFormat_1) };
25
+ }
26
+ var scale;
27
+ if (scaleType === 'date') {
28
+ scale = opts.useUTC ? d3ScaleUtc() : d3ScaleTime();
29
+ }
30
+ else {
31
+ scale = scaleType === 'log' ? d3ScaleLog() : d3ScaleLinear();
32
+ }
33
+ scale.domain(domain);
34
+ scale.range(range);
35
+ scale.nice();
36
+ var tickCount = (_a = opts.tickCount) !== null && _a !== void 0 ? _a : 4;
37
+ var tickFormat;
38
+ var customTickValues = Array.isArray(opts.tickValues) ? opts.tickValues : undefined;
39
+ if (scaleType === 'date') {
40
+ var lowestFormatLevel_1 = 100;
41
+ var highestFormatLevel_1 = -1;
42
+ scale.ticks().forEach(function (domainValue) {
43
+ var formatLevel = getDateFormatLevel(domainValue, opts.useUTC);
44
+ if (formatLevel > highestFormatLevel_1) {
45
+ highestFormatLevel_1 = formatLevel;
46
+ }
47
+ if (formatLevel < lowestFormatLevel_1) {
48
+ lowestFormatLevel_1 = formatLevel;
49
+ }
50
+ });
51
+ var formatOptions_1 = (_b = opts.dateLocalizeOptions) !== null && _b !== void 0 ? _b : getMultiLevelDateTimeFormatOptions(lowestFormatLevel_1, highestFormatLevel_1);
52
+ tickFormat = function (domainValue, index) {
53
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {
54
+ return opts.tickText[index];
55
+ }
56
+ if (isInvalidValue(opts.culture) && typeof opts.tickFormat === 'string') {
57
+ if (opts.useUTC) {
58
+ return d3UtcFormat(opts.tickFormat)(domainValue);
59
+ }
60
+ else {
61
+ return d3TimeFormat(opts.tickFormat)(domainValue);
62
+ }
63
+ }
64
+ return formatDateToLocaleString(domainValue, opts.culture, opts.useUTC, false, formatOptions_1);
65
+ };
66
+ if (opts.tickStep) {
67
+ customTickValues = generateDateTicks(opts.tickStep, opts.tick0, scale.domain(), opts.useUTC);
68
+ }
69
+ }
70
+ else {
71
+ var defaultTickFormat_1 = scale.tickFormat(tickCount);
72
+ tickFormat = function (domainValue, index) {
73
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {
74
+ return opts.tickText[index];
75
+ }
76
+ if (typeof opts.tickFormat === 'string') {
77
+ return d3Format(opts.tickFormat)(domainValue);
78
+ }
79
+ var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
80
+ return defaultTickFormat_1(value) === '' ? '' : formatToLocaleString(value, opts.culture);
81
+ };
82
+ if (opts.tickStep) {
83
+ customTickValues = generateNumericTicks(scaleType, opts.tickStep, opts.tick0, scale.domain());
84
+ }
85
+ }
86
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : scale.ticks(tickCount);
87
+ return { scale: scale, tickValues: tickValues, tickLabels: tickValues.map(tickFormat) };
88
+ };
89
+ export var getScaleType = function (values, opts) {
90
+ if (opts === void 0) { opts = {}; }
91
+ var scaleType = 'category';
92
+ if (typeof values[0] === 'number') {
93
+ if (opts.supportsLog && opts.scaleType === 'log') {
94
+ scaleType = 'log';
95
+ }
96
+ else {
97
+ scaleType = 'linear';
98
+ }
99
+ }
100
+ else if (values[0] instanceof Date) {
101
+ scaleType = 'date';
102
+ }
103
+ return scaleType;
104
+ };
105
+ export var getContinuousScaleDomain = function (scaleType, values, opts) {
106
+ var _a;
107
+ if (opts === void 0) { opts = {}; }
108
+ var _b = d3Extent(values.filter(function (v) { return isValidDomainValue(v, scaleType); })), min = _b[0], max = _b[1];
109
+ if (scaleType === 'linear') {
110
+ _a = d3Extent([min, max, 0]), min = _a[0], max = _a[1];
111
+ }
112
+ if (!isInvalidValue(opts.rangeStart)) {
113
+ min = opts.rangeStart;
114
+ }
115
+ if (!isInvalidValue(opts.rangeEnd)) {
116
+ max = opts.rangeEnd;
117
+ }
118
+ if (isInvalidValue(min) || isInvalidValue(max)) {
119
+ return [];
120
+ }
121
+ return [min, max];
122
+ };
123
+ var degToRad = function (deg) { return (deg * Math.PI) / 180; };
124
+ var radToDeg = function (rad) { return (rad * 180) / Math.PI; };
125
+ var normalizeAngle = function (deg, direction) {
126
+ return (((direction === 'clockwise' ? deg : 450 - deg) % 360) + 360) % 360;
127
+ };
128
+ export var createAngularScale = function (scaleType, domain, opts) {
129
+ var _a, _b;
130
+ if (opts === void 0) { opts = {}; }
131
+ if (scaleType === 'category') {
132
+ var categoryIndexMap_1 = {};
133
+ domain.forEach(function (d, i) {
134
+ categoryIndexMap_1[d] = i;
135
+ });
136
+ var period_1 = 360 / domain.length;
137
+ var tickValues_2 = Array.isArray(opts.tickValues) ? opts.tickValues : domain;
138
+ var tickFormat_2 = function (domainValue, index) {
139
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {
140
+ return opts.tickText[index];
141
+ }
142
+ return domainValue;
143
+ };
144
+ return {
145
+ scale: function (v) { return degToRad(normalizeAngle(categoryIndexMap_1[v] * period_1, opts.direction)); },
146
+ tickValues: tickValues_2,
147
+ tickLabels: tickValues_2.map(tickFormat_2),
148
+ };
149
+ }
150
+ var customTickValues = Array.isArray(opts.tickValues) ? opts.tickValues : undefined;
151
+ var tickFormat = function (domainValue, index) {
152
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {
153
+ return opts.tickText[index];
154
+ }
155
+ if (typeof opts.tickFormat === 'string') {
156
+ return d3Format(opts.tickFormat)(domainValue);
157
+ }
158
+ return formatAngle(domainValue, opts.unit);
159
+ };
160
+ if (opts.tickStep) {
161
+ customTickValues = (_a = generateNumericTicks(scaleType, opts.tickStep, opts.tick0, [
162
+ 0,
163
+ (opts.unit === 'radians' ? 2 * Math.PI : 360) - EPSILON,
164
+ ])) === null || _a === void 0 ? void 0 : _a.map(function (v) { return (opts.unit === 'radians' ? radToDeg(v) : v); });
165
+ }
166
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : d3Range(0, 360, 360 / ((_b = opts.tickCount) !== null && _b !== void 0 ? _b : 8));
167
+ return {
168
+ scale: function (v) { return degToRad(normalizeAngle(v, opts.direction)); },
169
+ tickValues: tickValues,
170
+ tickLabels: tickValues.map(tickFormat),
171
+ };
172
+ };
173
+ export var formatAngle = function (value, unit) {
174
+ return typeof value === 'string'
175
+ ? value
176
+ : unit === 'radians'
177
+ ? "".concat(precisionRound(value / 180, 6), "\u03C0")
178
+ : "".concat(precisionRound(value, 6), "\u00B0");
179
+ };
180
+ //# sourceMappingURL=PolarChart.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolarChart.utils.js","sourceRoot":"../src/","sources":["components/PolarChart/PolarChart.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,IAAI,WAAW,EACxB,WAAW,IAAI,aAAa,EAC5B,QAAQ,IAAI,UAAU,EACtB,SAAS,IAAI,WAAW,EACxB,QAAQ,IAAI,UAAU,GAKvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,kCAAkC,EAClC,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,SAAS,IAAI,WAAW,E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,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAA3C,CAA2C,CAAC,CAAC;IAC5D,CAAC;IACD,IAAM,UAAU,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,MAAA,IAAI,CAAC,SAAS,mCAAI,CAAC,CAAC,CAAC,CAAC;IAEpF,OAAO;QACL,KAAK,EAAE,UAAC,CAAS,IAAK,OAAA,QAAQ,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAA3C,CAA2C;QACjE,UAAU,YAAA;QACV,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;KACvC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,WAAW,GAAG,UACzB,KAAsB,EACtB,IAA0D;IAE1D,OAAA,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,IAAI,KAAK,SAAS;YACpB,CAAC,CAAC,UAAG,cAAc,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC,WAAG;YACtC,CAAC,CAAC,UAAG,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,WAAG;AAJlC,CAIkC,CAAC","sourcesContent":["import {\n scaleBand as d3ScaleBand,\n scaleLinear as d3ScaleLinear,\n scaleLog as d3ScaleLog,\n scaleTime as d3ScaleTime,\n scaleUtc as d3ScaleUtc,\n NumberValue,\n ScaleBand,\n ScaleContinuousNumeric,\n ScaleTime,\n} from 'd3-scale';\nimport { extent as d3Extent, range as d3Range } from 'd3-array';\nimport { format as d3Format } from 'd3-format';\nimport { AxisScaleType } from '../../types/IDataPoint';\nimport {\n generateDateTicks,\n generateNumericTicks,\n getDateFormatLevel,\n isValidDomainValue,\n} from '../../utilities/utilities';\nimport {\n isInvalidValue,\n formatToLocaleString,\n getMultiLevelDateTimeFormatOptions,\n formatDateToLocaleString,\n} from '@fluentui/chart-utilities';\nimport { timeFormat as d3TimeFormat, utcFormat as d3UtcFormat } from 'd3-time-format';\nimport { IPolarChartProps } from './PolarChart.types';\nimport { precisionRound } from '@fluentui/react';\n\nexport const EPSILON = 1e-6;\n\nexport const createRadialScale = (\n scaleType: string,\n domain: (string | number | Date)[],\n range: number[],\n opts: {\n useUTC?: boolean;\n tickCount?: number;\n tickValues?: (string | number | Date)[];\n tickText?: string[];\n tickFormat?: string;\n culture?: string;\n tickStep?: number | string;\n tick0?: number | Date;\n dateLocalizeOptions?: Intl.DateTimeFormatOptions;\n } = {},\n): {\n scale: ScaleBand<string> | ScaleContinuousNumeric<number, number, undefined> | ScaleTime<number, number>;\n tickValues: (string | number | Date)[];\n tickLabels: string[];\n} => {\n if (scaleType === 'category') {\n const scale = d3ScaleBand()\n .domain(domain as string[])\n .range(range)\n .paddingInner(1);\n const tickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as string[]) : (domain as string[]);\n const tickFormat = (domainValue: string, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n return domainValue;\n };\n return { scale, tickValues, tickLabels: tickValues.map(tickFormat) };\n }\n\n let scale: ScaleContinuousNumeric<number, number, undefined> | ScaleTime<number, number>;\n if (scaleType === 'date') {\n scale = opts.useUTC ? d3ScaleUtc() : d3ScaleTime();\n } else {\n scale = scaleType === 'log' ? d3ScaleLog() : d3ScaleLinear();\n }\n\n scale.domain(domain as (number | Date)[]);\n scale.range(range);\n scale.nice();\n\n const tickCount = opts.tickCount ?? 4;\n let tickFormat;\n let customTickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as (number | Date)[]) : undefined;\n if (scaleType === 'date') {\n let lowestFormatLevel = 100;\n let highestFormatLevel = -1;\n\n (scale as ScaleTime<number, number>).ticks().forEach((domainValue: Date) => {\n const formatLevel = getDateFormatLevel(domainValue, opts.useUTC);\n if (formatLevel > highestFormatLevel) {\n highestFormatLevel = formatLevel;\n }\n if (formatLevel < lowestFormatLevel) {\n lowestFormatLevel = formatLevel;\n }\n });\n const formatOptions =\n opts.dateLocalizeOptions ?? getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);\n tickFormat = (domainValue: Date, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n if (isInvalidValue(opts.culture) && typeof opts.tickFormat === 'string') {\n if (opts.useUTC) {\n return d3UtcFormat(opts.tickFormat)(domainValue);\n } else {\n return d3TimeFormat(opts.tickFormat)(domainValue);\n }\n }\n return formatDateToLocaleString(domainValue, opts.culture, opts.useUTC, false, formatOptions);\n };\n if (opts.tickStep) {\n customTickValues = generateDateTicks(opts.tickStep, opts.tick0, scale.domain() as Date[], opts.useUTC);\n }\n } else {\n const defaultTickFormat = (scale as ScaleContinuousNumeric<number, number>).tickFormat(tickCount);\n tickFormat = (domainValue: NumberValue, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n if (typeof opts.tickFormat === 'string') {\n return d3Format(opts.tickFormat)(domainValue);\n }\n const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();\n return defaultTickFormat(value) === '' ? '' : (formatToLocaleString(value, opts.culture) as string);\n };\n if (opts.tickStep) {\n customTickValues = generateNumericTicks(\n scaleType as AxisScaleType,\n opts.tickStep,\n opts.tick0,\n scale.domain() as number[],\n );\n }\n }\n const tickValues = customTickValues ?? scale.ticks(tickCount);\n\n return { scale, tickValues, tickLabels: tickValues.map(tickFormat) };\n};\n\nexport const getScaleType = (\n values: (string | number | Date)[],\n opts: {\n scaleType?: AxisScaleType;\n supportsLog?: boolean;\n } = {},\n): string => {\n let scaleType = 'category';\n if (typeof values[0] === 'number') {\n if (opts.supportsLog && opts.scaleType === 'log') {\n scaleType = 'log';\n } else {\n scaleType = 'linear';\n }\n } else if (values[0] instanceof Date) {\n scaleType = 'date';\n }\n return scaleType;\n};\n\nexport const getContinuousScaleDomain = (\n scaleType: string,\n values: (number | Date)[],\n opts: {\n rangeStart?: number | Date;\n rangeEnd?: number | Date;\n } = {},\n): (number | Date)[] => {\n let [min, max] = d3Extent(values.filter(v => isValidDomainValue(v, scaleType as AxisScaleType)) as (number | Date)[]);\n if (scaleType === 'linear') {\n [min, max] = d3Extent([min, max, 0] as number[]);\n }\n if (!isInvalidValue(opts.rangeStart)) {\n min = opts.rangeStart;\n }\n if (!isInvalidValue(opts.rangeEnd)) {\n max = opts.rangeEnd;\n }\n\n if (isInvalidValue(min) || isInvalidValue(max)) {\n return [];\n }\n return [min!, max!];\n};\n\nconst degToRad = (deg: number) => (deg * Math.PI) / 180;\n\nconst radToDeg = (rad: number) => (rad * 180) / Math.PI;\n\nconst normalizeAngle = (deg: number, direction: IPolarChartProps['direction']) =>\n (((direction === 'clockwise' ? deg : 450 - deg) % 360) + 360) % 360;\n\nexport const createAngularScale = (\n scaleType: string,\n domain: (string | number | Date)[],\n opts: {\n tickCount?: number;\n tickValues?: (string | number | Date)[];\n tickText?: string[];\n tickFormat?: string;\n culture?: string;\n tickStep?: number | string;\n tick0?: number | Date;\n direction?: IPolarChartProps['direction'];\n unit?: NonNullable<IPolarChartProps['angularAxis']>['unit'];\n } = {},\n): { scale: (v: string | number) => number; tickValues: (string | number)[]; tickLabels: string[] } => {\n if (scaleType === 'category') {\n const categoryIndexMap: Record<string, number> = {};\n (domain as string[]).forEach((d, i) => {\n categoryIndexMap[d] = i;\n });\n const period = 360 / domain.length;\n const tickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as string[]) : (domain as string[]);\n const tickFormat = (domainValue: string, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n return domainValue;\n };\n return {\n scale: (v: string) => degToRad(normalizeAngle(categoryIndexMap[v] * period, opts.direction)),\n tickValues,\n tickLabels: tickValues.map(tickFormat),\n };\n }\n\n let customTickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as number[]) : undefined;\n const tickFormat = (domainValue: number, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n if (typeof opts.tickFormat === 'string') {\n return d3Format(opts.tickFormat)(domainValue);\n }\n return formatAngle(domainValue, opts.unit);\n };\n if (opts.tickStep) {\n customTickValues = generateNumericTicks(scaleType as AxisScaleType, opts.tickStep, opts.tick0, [\n 0,\n (opts.unit === 'radians' ? 2 * Math.PI : 360) - EPSILON,\n ])?.map(v => (opts.unit === 'radians' ? radToDeg(v) : v));\n }\n const tickValues = customTickValues ?? d3Range(0, 360, 360 / (opts.tickCount ?? 8));\n\n return {\n scale: (v: number) => degToRad(normalizeAngle(v, opts.direction)),\n tickValues,\n tickLabels: tickValues.map(tickFormat),\n };\n};\n\nexport const formatAngle = (\n value: string | number,\n unit: NonNullable<IPolarChartProps['angularAxis']>['unit'],\n): string =>\n typeof value === 'string'\n ? value\n : unit === 'radians'\n ? `${precisionRound(value / 180, 6)}π`\n : `${precisionRound(value, 6)}°`;\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './PolarChart';
2
+ export * from './PolarChart.types';
@@ -0,0 +1,3 @@
1
+ export * from './PolarChart';
2
+ export * from './PolarChart.types';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PolarChart/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './PolarChart';\nexport * from './PolarChart.types';\n"]}
@@ -8,6 +8,7 @@ import { select, selectAll } from 'd3-selection';
8
8
  import { area as d3Area, curveBumpX as d3CurveBasis } from 'd3-shape';
9
9
  import * as React from 'react';
10
10
  import { ChartHoverCard } from '../../utilities/ChartHoverCard/ChartHoverCard';
11
+ import { ChartTitle, CHART_TITLE_PADDING } from '../../utilities/index';
11
12
  import { exportChartsAsImage } from '../../utilities/image-export-utils';
12
13
  var getClassNames = classNamesFunction();
13
14
  var PADDING_PERCENTAGE = 0.3;
@@ -403,6 +404,7 @@ function nodeTextColor(state, singleNode) {
403
404
  var SankeyChartBase = /** @class */ (function (_super) {
404
405
  __extends(SankeyChartBase, _super);
405
406
  function SankeyChartBase(props) {
407
+ var _a, _b, _c;
406
408
  var _this = _super.call(this, props) || this;
407
409
  _this._isRtl = getRTL();
408
410
  _this._numColumns = 0;
@@ -470,7 +472,11 @@ var SankeyChartBase = /** @class */ (function (_super) {
470
472
  _this._chartId = getId('sankeyChart');
471
473
  _this._emptyChartId = getId('_SankeyChart_empty');
472
474
  _this._labelTooltipId = getId('tooltip');
473
- _this._margins = { top: 36, right: 48, bottom: 32, left: 48 };
475
+ var titleHeight = ((_a = props.data) === null || _a === void 0 ? void 0 : _a.chartTitle)
476
+ ? Math.max((typeof ((_c = (_b = props.titleStyles) === null || _b === void 0 ? void 0 : _b.titleFont) === null || _c === void 0 ? void 0 : _c.size) === 'number' ? props.titleStyles.titleFont.size : 13) +
477
+ CHART_TITLE_PADDING, 36)
478
+ : 36;
479
+ _this._margins = { top: titleHeight, right: 48, bottom: 32, left: 48 };
474
480
  // We memo-ize creation so that we only create a new object when any of the fields change.
475
481
  _this._computeClassNamesProps = memoizeFunction(function (theme, pathColor, className, containerWidth, containerHeight, enableReflow) { return ({
476
482
  theme: theme,
@@ -602,6 +608,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
602
608
  }, onMouseLeave: this._onCloseCallout },
603
609
  React.createElement(FocusZone, { direction: FocusZoneDirection.vertical, className: classNames_1.chartWrapper },
604
610
  React.createElement("svg", { width: width, height: height, id: this._chartId, className: classNames_1.chart },
611
+ !this.props.hideLegend && this.props.data.chartTitle && (React.createElement(ChartTitle, { title: this.props.data.chartTitle, x: width / 2, maxWidth: width - 20, className: classNames_1.chartTitle, titleStyles: this.props.titleStyles, tooltipClassName: classNames_1.svgTooltip })),
605
612
  nodeLinkDomOrderArray_1.map(function (item) {
606
613
  if (item.type === 'node') {
607
614
  return (React.createElement("g", { key: nodes_1[item.index].nodeId, className: classNames_1.nodes }, nodeData_1[item.index]));
@@ -896,7 +903,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
896
903
  //Fixing tooltip position by attaching it to the element rather than page
897
904
  div.style('opacity', 0.9).style('color', this.props.theme.palette.neutralPrimary);
898
905
  div
899
- .html(text)
906
+ .text(text)
900
907
  .style('left', evt.pageX + 'px')
901
908
  .style('top', evt.pageY - 28 + 'px');
902
909
  }