@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
@@ -38,6 +38,7 @@ export declare class DonutChartBase extends React.Component<IDonutChartProps, ID
38
38
  get chartContainer(): HTMLElement | null;
39
39
  toImage: (opts?: IImageExportOptions) => Promise<string>;
40
40
  private _closeCallout;
41
+ private _getTitleHeight;
41
42
  private _elevateToMinimums;
42
43
  private _setViewBox;
43
44
  private _createLegends;
@@ -121,9 +121,10 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
121
121
  };
122
122
  DonutChartBase.prototype.componentDidMount = function () {
123
123
  if (this._rootElem) {
124
+ var titleHeight = this._getTitleHeight();
124
125
  this.setState({
125
126
  _width: this._rootElem.offsetWidth,
126
- _height: this._rootElem.offsetHeight - LEGEND_CONTAINER_HEIGHT,
127
+ _height: this._rootElem.offsetHeight - LEGEND_CONTAINER_HEIGHT - titleHeight,
127
128
  });
128
129
  }
129
130
  };
@@ -147,6 +148,7 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
147
148
  var legendBars = this._createLegends(points.filter(function (d) { return d.data >= 0; }));
148
149
  var donutMarginHorizontal = this.props.hideLabels ? 0 : 80;
149
150
  var donutMarginVertical = this.props.hideLabels ? 0 : 40;
151
+ var titleHeight = this._getTitleHeight();
150
152
  var outerRadius = Math.min(this.state._width - donutMarginHorizontal, this.state._height - donutMarginVertical) / 2;
151
153
  var chartData = this._elevateToMinimums(points);
152
154
  var valueInsideDonut = this.props.innerRadius > index_3.MIN_DONUT_RADIUS
@@ -158,11 +160,13 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
158
160
  this.props.xAxisAnnotation && (React.createElement("text", { className: this._classNames.axisAnnotation, x: this.state._width / 2, y: this.state._height - 10, textAnchor: "middle" }, this.props.xAxisAnnotation)),
159
161
  React.createElement(react_focus_1.FocusZone, { direction: react_focus_1.FocusZoneDirection.horizontal, handleTabKey: react_focus_1.FocusZoneTabbableElements.all, className: this._classNames.chartWrapper },
160
162
  React.createElement("svg", { className: this._classNames.chart, "aria-label": data === null || data === void 0 ? void 0 : data.chartTitle, ref: function (node) { return _this._setViewBox(node); }, width: this.state._width, height: this.state._height },
161
- React.createElement(index_2.Pie, { width: this.state._width, height: this.state._height, outerRadius: outerRadius, innerRadius: this.props.innerRadius, data: chartData, enableGradient: this.props.enableGradient, roundCorners: this.props.roundCorners, onFocusCallback: this._focusCallback, hoverOnCallback: this._hoverCallback, hoverLeaveCallback: this._hoverLeave, uniqText: this._uniqText, onBlurCallback: this._onBlur, activeArc: this._getHighlightedLegend(), focusedArcId: this.state.focusedArcId || '', href: this.props.href, calloutId: this._calloutId, valueInsideDonut: this._toLocaleString(valueInsideDonut), theme: this.props.theme, showLabelsInPercent: this.props.showLabelsInPercent, hideLabels: this.props.hideLabels }))),
163
+ !hideLegend && (data === null || data === void 0 ? void 0 : data.chartTitle) && (React.createElement(index_3.ChartTitle, { title: data.chartTitle, x: this.state._width / 2, maxWidth: this.state._width - 20, className: this._classNames.chartTitle, titleStyles: this.props.titleStyles, tooltipClassName: this._classNames.svgTooltip })),
164
+ React.createElement("g", { transform: "translate(0, ".concat(titleHeight, ")") },
165
+ React.createElement(index_2.Pie, { width: this.state._width, height: this.state._height, outerRadius: outerRadius, innerRadius: this.props.innerRadius, data: chartData, enableGradient: this.props.enableGradient, roundCorners: this.props.roundCorners, onFocusCallback: this._focusCallback, hoverOnCallback: this._hoverCallback, hoverLeaveCallback: this._hoverLeave, uniqText: this._uniqText, onBlurCallback: this._onBlur, activeArc: this._getHighlightedLegend(), focusedArcId: this.state.focusedArcId || '', href: this.props.href, calloutId: this._calloutId, valueInsideDonut: this._toLocaleString(valueInsideDonut), theme: this.props.theme, showLabelsInPercent: this.props.showLabelsInPercent, hideLabels: this.props.hideLabels })))),
162
166
  React.createElement(Callout_1.Callout, tslib_1.__assign({ target: this._currentHoverElement, alignTargetEdge: true, isBeakVisible: false, directionalHint: Callout_1.DirectionalHint.topAutoEdge, gapSpace: 15, hidden: !(!this.props.hideTooltip && this.state.showHover), id: this._calloutId, onDismiss: this._closeCallout, preventDismissOnLostFocus: true,
163
167
  /** Keep the callout updated with details of focused/hovered arc */
164
168
  shouldUpdateWhenHidden: true }, this.props.calloutProps, (0, index_3.getAccessibleDataObject)(this.state.callOutAccessibilityData, 'text', false)), this.props.onRenderCalloutPerDataPoint ? (this.props.onRenderCalloutPerDataPoint(this.state.dataPointCalloutProps)) : (React.createElement(index_1.ChartHoverCard, { Legend: this.state.xCalloutValue ? this.state.xCalloutValue : this.state.legend, YValue: this.state.yCalloutValue ? this.state.yCalloutValue : this.state.value, color: this.state.color, culture: this.props.culture }))),
165
- !hideLegend && React.createElement("div", { className: this._classNames.legendContainer }, legendBars))) : (React.createElement("div", { id: this._emptyChartId, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
169
+ !hideLegend && (React.createElement("div", { className: this._classNames.legendContainer, style: { marginTop: titleHeight } }, legendBars)))) : (React.createElement("div", { id: this._emptyChartId, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
166
170
  };
167
171
  Object.defineProperty(DonutChartBase.prototype, "chartContainer", {
168
172
  get: function () {
@@ -171,6 +175,14 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
171
175
  enumerable: false,
172
176
  configurable: true
173
177
  });
178
+ DonutChartBase.prototype._getTitleHeight = function () {
179
+ var _a, _b;
180
+ var data = this.props.data;
181
+ return (data === null || data === void 0 ? void 0 : data.chartTitle)
182
+ ? Math.max((typeof ((_b = (_a = this.props.titleStyles) === null || _a === void 0 ? void 0 : _a.titleFont) === null || _b === void 0 ? void 0 : _b.size) === 'number' ? this.props.titleStyles.titleFont.size : 13) +
183
+ index_3.CHART_TITLE_PADDING, 36)
184
+ : 0;
185
+ };
174
186
  DonutChartBase.prototype._elevateToMinimums = function (data) {
175
187
  var sumOfData = 0;
176
188
  var minPercent = 0.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,qBAAC;KAAA,AA5aD,CAAoC,KAAK,CAAC,SAAS,GA4alD;IA5aY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, getId, getRTL, initializeComponentRef } from '@fluentui/react/lib/Utilities';\nimport { ScaleOrdinal } from 'd3-scale';\nimport { IProcessedStyleSet } from '@fluentui/react/lib/Styling';\nimport { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';\nimport { FocusZone, FocusZoneDirection, FocusZoneTabbableElements } from '@fluentui/react-focus';\nimport { IAccessibilityProps, ChartHoverCard, ILegend, Legends } from '../../index';\nimport { Pie } from './Pie/index';\nimport { IChartDataPoint, IDonutChartProps, IDonutChartStyleProps, IDonutChartStyles } from './index';\nimport {\n getAccessibleDataObject,\n getColorFromToken,\n getNextColor,\n getNextGradient,\n areArraysEqual,\n MIN_DONUT_RADIUS,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { IChart, IImageExportOptions } from '../../types/index';\nimport { exportChartsAsImage } from '../../utilities/image-export-utils';\nimport { ILegendContainer } from '../Legends/index';\nimport type { JSXElement } from '@fluentui/utilities';\n\nconst getClassNames = classNamesFunction<IDonutChartStyleProps, IDonutChartStyles>();\nconst LEGEND_CONTAINER_HEIGHT = 40;\n\nexport interface IDonutChartState {\n showHover?: boolean;\n value?: string | undefined;\n legend?: string | undefined;\n _width?: number | undefined;\n _height?: number | undefined;\n activeLegend?: string;\n color?: string | undefined;\n xCalloutValue?: string;\n yCalloutValue?: string;\n focusedArcId?: string;\n dataPointCalloutProps?: IChartDataPoint;\n callOutAccessibilityData?: IAccessibilityProps;\n selectedLegends: string[];\n}\n\nexport class DonutChartBase extends React.Component<IDonutChartProps, IDonutChartState> implements IChart {\n public static defaultProps: Partial<IDonutChartProps> = {\n innerRadius: 0,\n hideLabels: true,\n };\n public _colors: ScaleOrdinal<string, {}>;\n private _classNames: IProcessedStyleSet<IDonutChartStyles>;\n private _rootElem: HTMLElement | null;\n private _uniqText: string;\n /* eslint-disable @typescript-eslint/no-explicit-any */\n private _currentHoverElement: any;\n private _calloutId: string;\n private _calloutAnchorPoint: IChartDataPoint | null;\n private _emptyChartId: string | null;\n private _legendsRef: React.RefObject<ILegendContainer | null>;\n\n public static getDerivedStateFromProps(\n nextProps: Readonly<IDonutChartProps>,\n prevState: Readonly<IDonutChartState>,\n ): Partial<IDonutChartState> | null {\n let widthState: { _width: number } | undefined;\n if (nextProps.width && nextProps.width !== prevState._width) {\n widthState = { _width: nextProps.width };\n }\n\n let heightState: { _height: number } | undefined;\n if (nextProps.height && nextProps.height !== prevState._height) {\n heightState = { _height: nextProps.height - LEGEND_CONTAINER_HEIGHT };\n }\n\n return { ...widthState, ...heightState };\n }\n\n constructor(props: IDonutChartProps) {\n super(props);\n\n initializeComponentRef(this);\n\n this.state = {\n showHover: false,\n value: '',\n legend: '',\n _width: this.props.width || 200,\n _height: this.props.height || 200,\n activeLegend: undefined,\n color: '',\n xCalloutValue: '',\n yCalloutValue: '',\n focusedArcId: '',\n selectedLegends: props.legendProps?.selectedLegends || [],\n };\n this._hoverCallback = this._hoverCallback.bind(this);\n this._focusCallback = this._focusCallback.bind(this);\n this._hoverLeave = this._hoverLeave.bind(this);\n this._calloutId = getId('callout');\n this._uniqText = getId('_Pie_');\n this._emptyChartId = getId('_DonutChart_empty');\n this._legendsRef = React.createRef();\n }\n\n public componentDidMount(): void {\n if (this._rootElem) {\n this.setState({\n _width: this._rootElem.offsetWidth,\n _height: this._rootElem.offsetHeight - LEGEND_CONTAINER_HEIGHT,\n });\n }\n }\n\n public componentDidUpdate(prevProps: IDonutChartProps): void {\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, this.props.legendProps?.selectedLegends)) {\n this.setState({\n selectedLegends: this.props.legendProps?.selectedLegends || [],\n });\n }\n }\n\n public render(): JSXElement {\n const { data, hideLegend = false } = this.props;\n const points = this._addDefaultColors(data?.chartData);\n\n this._classNames = getClassNames(this.props.styles!, {\n theme: this.props.theme!,\n color: this.state.color!,\n className: this.props.className!,\n });\n\n const legendBars = this._createLegends(points.filter(d => d.data! >= 0));\n const donutMarginHorizontal = this.props.hideLabels ? 0 : 80;\n const donutMarginVertical = this.props.hideLabels ? 0 : 40;\n const outerRadius =\n Math.min(this.state._width! - donutMarginHorizontal, this.state._height! - donutMarginVertical) / 2;\n const chartData = this._elevateToMinimums(points);\n const valueInsideDonut =\n this.props.innerRadius! > MIN_DONUT_RADIUS\n ? this._valueInsideDonut(this.props.valueInsideDonut!, chartData!)\n : '';\n return !this._isChartEmpty() ? (\n <div\n className={this._classNames.root}\n ref={(rootElem: HTMLElement | null) => {\n this._rootElem = rootElem;\n }}\n onMouseLeave={this._handleChartMouseLeave}\n >\n {this.props.xAxisAnnotation && (\n <text\n className={this._classNames.axisAnnotation}\n x={this.state._width! / 2}\n y={this.state._height! - 10}\n textAnchor=\"middle\"\n >\n {this.props.xAxisAnnotation}\n </text>\n )}\n <FocusZone\n direction={FocusZoneDirection.horizontal}\n handleTabKey={FocusZoneTabbableElements.all}\n className={this._classNames.chartWrapper}\n >\n <svg\n className={this._classNames.chart}\n aria-label={data?.chartTitle}\n ref={(node: SVGElement | null) => this._setViewBox(node)}\n width={this.state._width}\n height={this.state._height}\n >\n <Pie\n width={this.state._width!}\n height={this.state._height!}\n outerRadius={outerRadius}\n innerRadius={this.props.innerRadius!}\n data={chartData!}\n enableGradient={this.props.enableGradient}\n roundCorners={this.props.roundCorners}\n onFocusCallback={this._focusCallback}\n hoverOnCallback={this._hoverCallback}\n hoverLeaveCallback={this._hoverLeave}\n uniqText={this._uniqText}\n onBlurCallback={this._onBlur}\n activeArc={this._getHighlightedLegend()}\n focusedArcId={this.state.focusedArcId || ''}\n href={this.props.href!}\n calloutId={this._calloutId}\n valueInsideDonut={this._toLocaleString(valueInsideDonut)}\n theme={this.props.theme!}\n showLabelsInPercent={this.props.showLabelsInPercent}\n hideLabels={this.props.hideLabels}\n />\n </svg>\n </FocusZone>\n <Callout\n target={this._currentHoverElement}\n alignTargetEdge={true}\n isBeakVisible={false}\n directionalHint={DirectionalHint.topAutoEdge}\n gapSpace={15}\n hidden={!(!this.props.hideTooltip && this.state.showHover)}\n id={this._calloutId}\n onDismiss={this._closeCallout}\n preventDismissOnLostFocus={true}\n /** Keep the callout updated with details of focused/hovered arc */\n shouldUpdateWhenHidden={true}\n {...this.props.calloutProps!}\n {...getAccessibleDataObject(this.state.callOutAccessibilityData, 'text', false)}\n >\n {this.props.onRenderCalloutPerDataPoint ? (\n this.props.onRenderCalloutPerDataPoint(this.state.dataPointCalloutProps!)\n ) : (\n <ChartHoverCard\n Legend={this.state.xCalloutValue ? this.state.xCalloutValue : this.state.legend}\n YValue={this.state.yCalloutValue ? this.state.yCalloutValue : this.state.value}\n color={this.state.color}\n culture={this.props.culture}\n />\n )}\n </Callout>\n {!hideLegend && <div className={this._classNames.legendContainer}>{legendBars}</div>}\n </div>\n ) : (\n <div\n id={this._emptyChartId!}\n role={'alert'}\n style={{ opacity: '0' }}\n aria-label={'Graph has no data to display'}\n />\n );\n }\n\n public get chartContainer(): HTMLElement | null {\n return this._rootElem;\n }\n\n public toImage = (opts?: IImageExportOptions): Promise<string> => {\n return exportChartsAsImage(\n [{ container: this._rootElem }],\n this.props.hideLegend ? undefined : this._legendsRef.current?.toSVG,\n getRTL(),\n opts,\n );\n };\n\n private _closeCallout = () => {\n this.setState({\n showHover: false,\n });\n };\n\n private _elevateToMinimums(data: IChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: IChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n private _setViewBox(node: SVGElement | null): void {\n if (node === null) {\n return;\n }\n\n const widthVal = node.parentElement ? node.parentElement.clientWidth : this.state._width;\n\n const heightVal =\n node.parentElement && node.parentElement?.offsetHeight > this.state._height!\n ? node.parentElement?.offsetHeight\n : this.state._height;\n const viewbox = `0 0 ${widthVal!} ${heightVal!}`;\n node.setAttribute('viewBox', viewbox);\n }\n\n private _createLegends(chartData: IChartDataPoint[]): JSXElement {\n if (this.props.order === 'sorted') {\n chartData.sort((a: IChartDataPoint, b: IChartDataPoint) => {\n return b.data! - a.data!;\n });\n }\n const legendDataItems = chartData.map((point: IChartDataPoint, index: number) => {\n const color: string = this.props.enableGradient\n ? point.gradient?.[0] || getNextGradient(index, 0, this.props.theme?.isInverted)[0]\n : point.color!;\n\n // mapping data to the format Legends component needs\n const legend: ILegend = {\n title: point.legend!,\n color,\n hoverAction: () => {\n this._handleChartMouseLeave();\n this.setState({ activeLegend: point.legend! });\n },\n onMouseOutAction: () => {\n this.setState({ activeLegend: undefined });\n },\n };\n return legend;\n });\n\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowProps={this.props.legendsOverflowProps}\n focusZonePropsInHoverCard={this.props.focusZonePropsForLegendsInHoverCard}\n overflowText={this.props.legendsOverflowText}\n {...this.props.legendProps}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={this._onLegendSelectionChange.bind(this)}\n ref={this._legendsRef}\n />\n );\n return legends;\n }\n\n private _onLegendSelectionChange(\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: ILegend,\n ): void {\n if (this.props.legendProps && this.props.legendProps?.canSelectMultipleLegends) {\n this.setState({ selectedLegends });\n } else {\n this.setState({ selectedLegends: selectedLegends.slice(-1) });\n }\n if (this.props.legendProps?.onChange) {\n this.props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n private _focusCallback = (data: IChartDataPoint, id: string, element: SVGPathElement): void => {\n this._currentHoverElement = element;\n this.setState({\n /** Show the callout if highlighted arc is focused and Hide it if unhighlighted arc is focused */\n showHover: this._noLegendsHighlighted() || this._isLegendHighlighted(data.legend),\n value: data.data!.toString(),\n legend: data.legend,\n color: data.color!,\n xCalloutValue: data.xAxisCalloutData!,\n yCalloutValue: data.yAxisCalloutData!,\n focusedArcId: id,\n dataPointCalloutProps: data,\n callOutAccessibilityData: data.callOutAccessibilityData!,\n });\n };\n\n private _hoverCallback = (data: IChartDataPoint, e: React.MouseEvent<SVGPathElement>): void => {\n if (this._calloutAnchorPoint !== data) {\n this._calloutAnchorPoint = data;\n this._currentHoverElement = e;\n let color: string = data.color!;\n\n if (this.props.enableGradient) {\n const pointIndex = Math.max(this.props.data?.chartData?.findIndex(item => item.legend === data.legend) || 0, 0);\n color = data.gradient?.[0] || getNextGradient(pointIndex, 0, this.props.theme?.isInverted)[0];\n }\n\n this.setState({\n /** Show the callout if highlighted arc is hovered and Hide it if unhighlighted arc is hovered */\n showHover: this._noLegendsHighlighted() || this._isLegendHighlighted(data.legend),\n value: data.data!.toString(),\n legend: data.legend,\n color,\n xCalloutValue: data.xAxisCalloutData!,\n yCalloutValue: data.yAxisCalloutData!,\n dataPointCalloutProps: data,\n callOutAccessibilityData: data.callOutAccessibilityData!,\n });\n }\n };\n private _onBlur = (): void => {\n this.setState({ focusedArcId: '' });\n };\n\n private _hoverLeave(): void {\n /**/\n }\n\n private _handleChartMouseLeave = () => {\n this._calloutAnchorPoint = null;\n this.setState({ showHover: false });\n };\n\n private _valueInsideDonut(valueInsideDonut: string | number | undefined, data: IChartDataPoint[]) {\n const highlightedLegends = this._getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegends.length === 1 || this.state.showHover)) {\n const pointValue = data.find(point => this._isLegendHighlighted(point.legend));\n return pointValue\n ? pointValue.yAxisCalloutData\n ? pointValue.yAxisCalloutData\n : pointValue.data!\n : valueInsideDonut;\n } else if (highlightedLegends.length > 0) {\n let totalValue = 0;\n data.forEach(point => {\n if (highlightedLegends.includes(point.legend!)) {\n totalValue += point.data!;\n }\n });\n return totalValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n private _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, this.props.culture, this.props.useUTC);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n */\n private _getHighlightedLegend() {\n return this.state.selectedLegends.length > 0\n ? this.state.selectedLegends\n : this.state.activeLegend\n ? [this.state.activeLegend]\n : [];\n }\n\n private _isLegendHighlighted = (legend: string | undefined): boolean => {\n return this._getHighlightedLegend().includes(legend!);\n };\n\n private _noLegendsHighlighted = (): boolean => {\n return this._getHighlightedLegend().length === 0;\n };\n\n private _isChartEmpty(): boolean {\n return !(\n this.props.data &&\n this.props.data.chartData &&\n this.props.data.chartData!.filter((d: IChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n private _addDefaultColors = (donutChartDataPoint?: IChartDataPoint[]): IChartDataPoint[] => {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let color: string;\n // isInverted property is applicable to v8 themes only\n if (typeof item.color === 'undefined') {\n color = getNextColor(index, 0, this.props.theme?.isInverted);\n } else {\n color = getColorFromToken(item.color, this.props.theme?.isInverted);\n }\n\n return { ...item, color };\n })\n : [];\n };\n}\n"]}
1
+ {"version":3,"file":"DonutChart.base.js","sourceRoot":"../src/","sources":["components/DonutChart/DonutChart.base.tsx"],"names":[],"mappings":";;;;IAyBA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAA4C,CAAC;IACrF,IAAM,uBAAuB,GAAG,EAAE,CAAC;IAkBnC;QAAoC,0CAAmD;QAiCrF,wBAAY,KAAuB;;YACjC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YAiLR,aAAO,GAAG,UAAC,IAA0B;;gBAC1C,OAAO,IAAA,wCAAmB,EACxB,CAAC,EAAE,SAAS,EAAE,KAAI,CAAC,SAAS,EAAE,CAAC,EAC/B,KAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,C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eAAe,CAAC,MAAM,GAAG,CAAC;gBAC1C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe;gBAC5B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY;oBACzB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;oBAC3B,CAAC,CAAC,EAAE,CAAC;QACT,CAAC;QAUO,sCAAa,GAArB;YACE,OAAO,CAAC,CACN,IAAI,CAAC,KAAK,CAAC,IAAI;gBACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS;gBACzB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAU,CAAC,MAAM,CAAC,UAAC,CAAkB,IAAK,OAAA,CAAC,CAAC,IAAK,GAAG,CAAC,EAAX,CAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAClF,CAAC;QACJ,CAAC;QAvba,2BAAY,GAA8B;YACtD,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,IAAI;SACjB,AAHyB,CAGxB;QAqcJ,qBAAC;KAAA,AAzcD,CAAoC,KAAK,CAAC,SAAS,GAyclD;IAzcY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, getId, getRTL, initializeComponentRef } from '@fluentui/react/lib/Utilities';\nimport { ScaleOrdinal } from 'd3-scale';\nimport { IProcessedStyleSet } from '@fluentui/react/lib/Styling';\nimport { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';\nimport { FocusZone, FocusZoneDirection, FocusZoneTabbableElements } from '@fluentui/react-focus';\nimport { IAccessibilityProps, ChartHoverCard, ILegend, Legends } from '../../index';\nimport { Pie } from './Pie/index';\nimport { IChartDataPoint, IDonutChartProps, IDonutChartStyleProps, IDonutChartStyles } from './index';\nimport {\n getAccessibleDataObject,\n getColorFromToken,\n getNextColor,\n getNextGradient,\n areArraysEqual,\n MIN_DONUT_RADIUS,\n ChartTitle,\n CHART_TITLE_PADDING,\n} from '../../utilities/index';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { IChart, IImageExportOptions } from '../../types/index';\nimport { exportChartsAsImage } from '../../utilities/image-export-utils';\nimport { ILegendContainer } from '../Legends/index';\nimport type { JSXElement } from '@fluentui/utilities';\n\nconst getClassNames = classNamesFunction<IDonutChartStyleProps, IDonutChartStyles>();\nconst LEGEND_CONTAINER_HEIGHT = 40;\n\nexport interface IDonutChartState {\n showHover?: boolean;\n value?: string | undefined;\n legend?: string | undefined;\n _width?: number | undefined;\n _height?: number | undefined;\n activeLegend?: string;\n color?: string | undefined;\n xCalloutValue?: string;\n yCalloutValue?: string;\n focusedArcId?: string;\n dataPointCalloutProps?: IChartDataPoint;\n callOutAccessibilityData?: IAccessibilityProps;\n selectedLegends: string[];\n}\n\nexport class DonutChartBase extends React.Component<IDonutChartProps, IDonutChartState> implements IChart {\n public static defaultProps: Partial<IDonutChartProps> = {\n innerRadius: 0,\n hideLabels: true,\n };\n public _colors: ScaleOrdinal<string, {}>;\n private _classNames: IProcessedStyleSet<IDonutChartStyles>;\n private _rootElem: HTMLElement | null;\n private _uniqText: string;\n /* eslint-disable @typescript-eslint/no-explicit-any */\n private _currentHoverElement: any;\n private _calloutId: string;\n private _calloutAnchorPoint: IChartDataPoint | null;\n private _emptyChartId: string | null;\n private _legendsRef: React.RefObject<ILegendContainer | null>;\n\n public static getDerivedStateFromProps(\n nextProps: Readonly<IDonutChartProps>,\n prevState: Readonly<IDonutChartState>,\n ): Partial<IDonutChartState> | null {\n let widthState: { _width: number } | undefined;\n if (nextProps.width && nextProps.width !== prevState._width) {\n widthState = { _width: nextProps.width };\n }\n\n let heightState: { _height: number } | undefined;\n if (nextProps.height && nextProps.height !== prevState._height) {\n heightState = { _height: nextProps.height - LEGEND_CONTAINER_HEIGHT };\n }\n\n return { ...widthState, ...heightState };\n }\n\n constructor(props: IDonutChartProps) {\n super(props);\n\n initializeComponentRef(this);\n\n this.state = {\n showHover: false,\n value: '',\n legend: '',\n _width: this.props.width || 200,\n _height: this.props.height || 200,\n activeLegend: undefined,\n color: '',\n xCalloutValue: '',\n yCalloutValue: '',\n focusedArcId: '',\n selectedLegends: props.legendProps?.selectedLegends || [],\n };\n this._hoverCallback = this._hoverCallback.bind(this);\n this._focusCallback = this._focusCallback.bind(this);\n this._hoverLeave = this._hoverLeave.bind(this);\n this._calloutId = getId('callout');\n this._uniqText = getId('_Pie_');\n this._emptyChartId = getId('_DonutChart_empty');\n this._legendsRef = React.createRef();\n }\n\n public componentDidMount(): void {\n if (this._rootElem) {\n const titleHeight = this._getTitleHeight();\n this.setState({\n _width: this._rootElem.offsetWidth,\n _height: this._rootElem.offsetHeight - LEGEND_CONTAINER_HEIGHT - titleHeight,\n });\n }\n }\n\n public componentDidUpdate(prevProps: IDonutChartProps): void {\n if (!areArraysEqual(prevProps.legendProps?.selectedLegends, this.props.legendProps?.selectedLegends)) {\n this.setState({\n selectedLegends: this.props.legendProps?.selectedLegends || [],\n });\n }\n }\n\n public render(): JSXElement {\n const { data, hideLegend = false } = this.props;\n const points = this._addDefaultColors(data?.chartData);\n\n this._classNames = getClassNames(this.props.styles!, {\n theme: this.props.theme!,\n color: this.state.color!,\n className: this.props.className!,\n });\n\n const legendBars = this._createLegends(points.filter(d => d.data! >= 0));\n const donutMarginHorizontal = this.props.hideLabels ? 0 : 80;\n const donutMarginVertical = this.props.hideLabels ? 0 : 40;\n const titleHeight = this._getTitleHeight();\n const outerRadius =\n Math.min(this.state._width! - donutMarginHorizontal, this.state._height! - donutMarginVertical) / 2;\n const chartData = this._elevateToMinimums(points);\n const valueInsideDonut =\n this.props.innerRadius! > MIN_DONUT_RADIUS\n ? this._valueInsideDonut(this.props.valueInsideDonut!, chartData!)\n : '';\n return !this._isChartEmpty() ? (\n <div\n className={this._classNames.root}\n ref={(rootElem: HTMLElement | null) => {\n this._rootElem = rootElem;\n }}\n onMouseLeave={this._handleChartMouseLeave}\n >\n {this.props.xAxisAnnotation && (\n <text\n className={this._classNames.axisAnnotation}\n x={this.state._width! / 2}\n y={this.state._height! - 10}\n textAnchor=\"middle\"\n >\n {this.props.xAxisAnnotation}\n </text>\n )}\n <FocusZone\n direction={FocusZoneDirection.horizontal}\n handleTabKey={FocusZoneTabbableElements.all}\n className={this._classNames.chartWrapper}\n >\n <svg\n className={this._classNames.chart}\n aria-label={data?.chartTitle}\n ref={(node: SVGElement | null) => this._setViewBox(node)}\n width={this.state._width}\n height={this.state._height!}\n >\n {!hideLegend && data?.chartTitle && (\n <ChartTitle\n title={data.chartTitle}\n x={this.state._width! / 2}\n maxWidth={this.state._width! - 20}\n className={this._classNames.chartTitle}\n titleStyles={this.props.titleStyles}\n tooltipClassName={this._classNames.svgTooltip}\n />\n )}\n <g transform={`translate(0, ${titleHeight})`}>\n <Pie\n width={this.state._width!}\n height={this.state._height!}\n outerRadius={outerRadius}\n innerRadius={this.props.innerRadius!}\n data={chartData!}\n enableGradient={this.props.enableGradient}\n roundCorners={this.props.roundCorners}\n onFocusCallback={this._focusCallback}\n hoverOnCallback={this._hoverCallback}\n hoverLeaveCallback={this._hoverLeave}\n uniqText={this._uniqText}\n onBlurCallback={this._onBlur}\n activeArc={this._getHighlightedLegend()}\n focusedArcId={this.state.focusedArcId || ''}\n href={this.props.href!}\n calloutId={this._calloutId}\n valueInsideDonut={this._toLocaleString(valueInsideDonut)}\n theme={this.props.theme!}\n showLabelsInPercent={this.props.showLabelsInPercent}\n hideLabels={this.props.hideLabels}\n />\n </g>\n </svg>\n </FocusZone>\n <Callout\n target={this._currentHoverElement}\n alignTargetEdge={true}\n isBeakVisible={false}\n directionalHint={DirectionalHint.topAutoEdge}\n gapSpace={15}\n hidden={!(!this.props.hideTooltip && this.state.showHover)}\n id={this._calloutId}\n onDismiss={this._closeCallout}\n preventDismissOnLostFocus={true}\n /** Keep the callout updated with details of focused/hovered arc */\n shouldUpdateWhenHidden={true}\n {...this.props.calloutProps!}\n {...getAccessibleDataObject(this.state.callOutAccessibilityData, 'text', false)}\n >\n {this.props.onRenderCalloutPerDataPoint ? (\n this.props.onRenderCalloutPerDataPoint(this.state.dataPointCalloutProps!)\n ) : (\n <ChartHoverCard\n Legend={this.state.xCalloutValue ? this.state.xCalloutValue : this.state.legend}\n YValue={this.state.yCalloutValue ? this.state.yCalloutValue : this.state.value}\n color={this.state.color}\n culture={this.props.culture}\n />\n )}\n </Callout>\n {!hideLegend && (\n <div className={this._classNames.legendContainer} style={{ marginTop: titleHeight }}>\n {legendBars}\n </div>\n )}\n </div>\n ) : (\n <div\n id={this._emptyChartId!}\n role={'alert'}\n style={{ opacity: '0' }}\n aria-label={'Graph has no data to display'}\n />\n );\n }\n\n public get chartContainer(): HTMLElement | null {\n return this._rootElem;\n }\n\n public toImage = (opts?: IImageExportOptions): Promise<string> => {\n return exportChartsAsImage(\n [{ container: this._rootElem }],\n this.props.hideLegend ? undefined : this._legendsRef.current?.toSVG,\n getRTL(),\n opts,\n );\n };\n\n private _closeCallout = () => {\n this.setState({\n showHover: false,\n });\n };\n\n private _getTitleHeight(): number {\n const { data } = this.props;\n return data?.chartTitle\n ? Math.max(\n (typeof this.props.titleStyles?.titleFont?.size === 'number' ? this.props.titleStyles.titleFont.size : 13) +\n CHART_TITLE_PADDING,\n 36,\n )\n : 0;\n }\n\n private _elevateToMinimums(data: IChartDataPoint[]) {\n let sumOfData = 0;\n const minPercent = 0.01;\n const elevatedData: IChartDataPoint[] = [];\n data.forEach(item => {\n sumOfData += item.data!;\n });\n data.forEach(item => {\n elevatedData.push(\n minPercent * sumOfData > item.data! && item.data! > 0\n ? {\n ...item,\n data: minPercent * sumOfData,\n yAxisCalloutData:\n item.yAxisCalloutData === undefined ? item.data!.toLocaleString() : item.yAxisCalloutData,\n }\n : item,\n );\n });\n return elevatedData;\n }\n private _setViewBox(node: SVGElement | null): void {\n if (node === null) {\n return;\n }\n\n const widthVal = node.parentElement ? node.parentElement.clientWidth : this.state._width;\n\n const heightVal =\n node.parentElement && node.parentElement?.offsetHeight > this.state._height!\n ? node.parentElement?.offsetHeight\n : this.state._height;\n const viewbox = `0 0 ${widthVal!} ${heightVal!}`;\n node.setAttribute('viewBox', viewbox);\n }\n\n private _createLegends(chartData: IChartDataPoint[]): JSXElement {\n if (this.props.order === 'sorted') {\n chartData.sort((a: IChartDataPoint, b: IChartDataPoint) => {\n return b.data! - a.data!;\n });\n }\n const legendDataItems = chartData.map((point: IChartDataPoint, index: number) => {\n const color: string = this.props.enableGradient\n ? point.gradient?.[0] || getNextGradient(index, 0, this.props.theme?.isInverted)[0]\n : point.color!;\n\n // mapping data to the format Legends component needs\n const legend: ILegend = {\n title: point.legend!,\n color,\n hoverAction: () => {\n this._handleChartMouseLeave();\n this.setState({ activeLegend: point.legend! });\n },\n onMouseOutAction: () => {\n this.setState({ activeLegend: undefined });\n },\n };\n return legend;\n });\n\n const legends = (\n <Legends\n legends={legendDataItems}\n centerLegends\n overflowProps={this.props.legendsOverflowProps}\n focusZonePropsInHoverCard={this.props.focusZonePropsForLegendsInHoverCard}\n overflowText={this.props.legendsOverflowText}\n {...this.props.legendProps}\n // eslint-disable-next-line react/jsx-no-bind\n onChange={this._onLegendSelectionChange.bind(this)}\n ref={this._legendsRef}\n />\n );\n return legends;\n }\n\n private _onLegendSelectionChange(\n selectedLegends: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: ILegend,\n ): void {\n if (this.props.legendProps && this.props.legendProps?.canSelectMultipleLegends) {\n this.setState({ selectedLegends });\n } else {\n this.setState({ selectedLegends: selectedLegends.slice(-1) });\n }\n if (this.props.legendProps?.onChange) {\n this.props.legendProps.onChange(selectedLegends, event, currentLegend);\n }\n }\n\n private _focusCallback = (data: IChartDataPoint, id: string, element: SVGPathElement): void => {\n this._currentHoverElement = element;\n this.setState({\n /** Show the callout if highlighted arc is focused and Hide it if unhighlighted arc is focused */\n showHover: this._noLegendsHighlighted() || this._isLegendHighlighted(data.legend),\n value: data.data!.toString(),\n legend: data.legend,\n color: data.color!,\n xCalloutValue: data.xAxisCalloutData!,\n yCalloutValue: data.yAxisCalloutData!,\n focusedArcId: id,\n dataPointCalloutProps: data,\n callOutAccessibilityData: data.callOutAccessibilityData!,\n });\n };\n\n private _hoverCallback = (data: IChartDataPoint, e: React.MouseEvent<SVGPathElement>): void => {\n if (this._calloutAnchorPoint !== data) {\n this._calloutAnchorPoint = data;\n this._currentHoverElement = e;\n let color: string = data.color!;\n\n if (this.props.enableGradient) {\n const pointIndex = Math.max(this.props.data?.chartData?.findIndex(item => item.legend === data.legend) || 0, 0);\n color = data.gradient?.[0] || getNextGradient(pointIndex, 0, this.props.theme?.isInverted)[0];\n }\n\n this.setState({\n /** Show the callout if highlighted arc is hovered and Hide it if unhighlighted arc is hovered */\n showHover: this._noLegendsHighlighted() || this._isLegendHighlighted(data.legend),\n value: data.data!.toString(),\n legend: data.legend,\n color,\n xCalloutValue: data.xAxisCalloutData!,\n yCalloutValue: data.yAxisCalloutData!,\n dataPointCalloutProps: data,\n callOutAccessibilityData: data.callOutAccessibilityData!,\n });\n }\n };\n private _onBlur = (): void => {\n this.setState({ focusedArcId: '' });\n };\n\n private _hoverLeave(): void {\n /**/\n }\n\n private _handleChartMouseLeave = () => {\n this._calloutAnchorPoint = null;\n this.setState({ showHover: false });\n };\n\n private _valueInsideDonut(valueInsideDonut: string | number | undefined, data: IChartDataPoint[]) {\n const highlightedLegends = this._getHighlightedLegend();\n if (valueInsideDonut !== undefined && (highlightedLegends.length === 1 || this.state.showHover)) {\n const pointValue = data.find(point => this._isLegendHighlighted(point.legend));\n return pointValue\n ? pointValue.yAxisCalloutData\n ? pointValue.yAxisCalloutData\n : pointValue.data!\n : valueInsideDonut;\n } else if (highlightedLegends.length > 0) {\n let totalValue = 0;\n data.forEach(point => {\n if (highlightedLegends.includes(point.legend!)) {\n totalValue += point.data!;\n }\n });\n return totalValue;\n } else {\n return valueInsideDonut;\n }\n }\n\n private _toLocaleString(data: string | number | undefined) {\n const localeString = formatToLocaleString(data, this.props.culture, this.props.useUTC);\n if (!localeString) {\n return data;\n }\n return localeString?.toString();\n }\n\n /**\n * This function returns\n * the selected legend if there is one\n * or the hovered legend if none of the legends is selected.\n */\n private _getHighlightedLegend() {\n return this.state.selectedLegends.length > 0\n ? this.state.selectedLegends\n : this.state.activeLegend\n ? [this.state.activeLegend]\n : [];\n }\n\n private _isLegendHighlighted = (legend: string | undefined): boolean => {\n return this._getHighlightedLegend().includes(legend!);\n };\n\n private _noLegendsHighlighted = (): boolean => {\n return this._getHighlightedLegend().length === 0;\n };\n\n private _isChartEmpty(): boolean {\n return !(\n this.props.data &&\n this.props.data.chartData &&\n this.props.data.chartData!.filter((d: IChartDataPoint) => d.data! > 0).length > 0\n );\n }\n\n private _addDefaultColors = (donutChartDataPoint?: IChartDataPoint[]): IChartDataPoint[] => {\n return donutChartDataPoint\n ? donutChartDataPoint.map((item, index) => {\n let color: string;\n // isInverted property is applicable to v8 themes only\n if (typeof item.color === 'undefined') {\n color = getNextColor(index, 0, this.props.theme?.isInverted);\n } else {\n color = getColorFromToken(item.color, this.props.theme?.isInverted);\n }\n\n return { ...item, color };\n })\n : [];\n };\n}\n"]}
@@ -27,7 +27,9 @@ define(["require", "exports", "../../utilities/index"], function (require, expor
27
27
  paddingTop: '16px',
28
28
  width: '100%',
29
29
  },
30
+ chartTitle: (0, index_1.getChartTitleStyle)(theme),
30
31
  axisAnnotation: (0, index_1.getAxisTitleStyle)(theme, theme.fonts.small),
32
+ svgTooltip: (0, index_1.getSvgTooltipStyle)(theme),
31
33
  };
32
34
  };
33
35
  exports.getStyles = getStyles;
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChart.styles.js","sourceRoot":"../src/","sources":["components/DonutChart/DonutChart.styles.ts"],"names":[],"mappings":";;;;IAGO,IAAM,SAAS,GAAG,UAAC,KAA4B;QAC5C,IAAA,SAAS,GAAY,KAAK,UAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;QACnC,OAAO;YACL,IAAI,EAAE;gBACJ,KAAK,CAAC,KAAK,CAAC,MAAM;gBAClB,eAAe;gBACf;oBACE,UAAU,EAAE,QAAQ;oBACpB,OAAO,EAAE,MAAM;oBACf,aAAa,EAAE,QAAQ;oBACvB,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;iBACf;gBACD,SAAS;aACV;YACD,KAAK,EAAE;gBACL,SAAS,EAAE,aAAa;gBACxB,QAAQ,EAAE,SAAS;gBACnB,eAAe,EAAE,QAAQ;gBACzB,OAAO,EAAE,OAAO;aACjB;YACD,eAAe,EAAE;gBACf,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,MAAM;aACd;YACD,cAAc,EAAE,IAAA,yBAAiB,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;SAC5D,CAAC;IACJ,CAAC,CAAC;IA3BW,QAAA,SAAS,aA2BpB","sourcesContent":["import { IDonutChartStyleProps, IDonutChartStyles } from './DonutChart.types';\nimport { getAxisTitleStyle } from '../../utilities/index';\n\nexport const getStyles = (props: IDonutChartStyleProps): IDonutChartStyles => {\n const { className, theme } = props;\n return {\n root: [\n theme.fonts.medium,\n 'ms-DonutChart',\n {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n },\n className,\n ],\n chart: {\n boxSizing: 'content-box',\n overflow: 'visible',\n alignmentAdjust: 'center',\n display: 'block',\n },\n legendContainer: {\n paddingTop: '16px',\n width: '100%',\n },\n axisAnnotation: getAxisTitleStyle(theme, theme.fonts.small),\n };\n};\n"]}
1
+ {"version":3,"file":"DonutChart.styles.js","sourceRoot":"../src/","sources":["components/DonutChart/DonutChart.styles.ts"],"names":[],"mappings":";;;;IAGO,IAAM,SAAS,GAAG,UAAC,KAA4B;QAC5C,IAAA,SAAS,GAAY,KAAK,UAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;QACnC,OAAO;YACL,IAAI,EAAE;gBACJ,KAAK,CAAC,KAAK,CAAC,MAAM;gBAClB,eAAe;gBACf;oBACE,UAAU,EAAE,QAAQ;oBACpB,OAAO,EAAE,MAAM;oBACf,aAAa,EAAE,QAAQ;oBACvB,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;iBACf;gBACD,SAAS;aACV;YACD,KAAK,EAAE;gBACL,SAAS,EAAE,aAAa;gBACxB,QAAQ,EAAE,SAAS;gBACnB,eAAe,EAAE,QAAQ;gBACzB,OAAO,EAAE,OAAO;aACjB;YACD,eAAe,EAAE;gBACf,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,MAAM;aACd;YACD,UAAU,EAAE,IAAA,0BAAkB,EAAC,KAAK,CAAC;YACrC,cAAc,EAAE,IAAA,yBAAiB,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;YAC3D,UAAU,EAAE,IAAA,0BAAkB,EAAC,KAAK,CAAC;SACtC,CAAC;IACJ,CAAC,CAAC;IA7BW,QAAA,SAAS,aA6BpB","sourcesContent":["import { IDonutChartStyleProps, IDonutChartStyles } from './DonutChart.types';\nimport { getAxisTitleStyle, getChartTitleStyle, getSvgTooltipStyle } from '../../utilities/index';\n\nexport const getStyles = (props: IDonutChartStyleProps): IDonutChartStyles => {\n const { className, theme } = props;\n return {\n root: [\n theme.fonts.medium,\n 'ms-DonutChart',\n {\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n height: '100%',\n },\n className,\n ],\n chart: {\n boxSizing: 'content-box',\n overflow: 'visible',\n alignmentAdjust: 'center',\n display: 'block',\n },\n legendContainer: {\n paddingTop: '16px',\n width: '100%',\n },\n chartTitle: getChartTitleStyle(theme),\n axisAnnotation: getAxisTitleStyle(theme, theme.fonts.small),\n svgTooltip: getSvgTooltipStyle(theme),\n };\n};\n"]}
@@ -3,6 +3,7 @@ import { IRefObject, IRenderFunction, IStyleFunctionOrObject } from '@fluentui/r
3
3
  import { ICartesianChartProps, ICartesianChartStyleProps } from '../CommonComponents/index';
4
4
  import { ICalloutProps } from '@fluentui/react/lib/Callout';
5
5
  import { IChartProps, IChartDataPoint, IChart } from './index';
6
+ import type { ITitleStyles } from '../../utilities/Common.styles';
6
7
  export interface IDonutChart {
7
8
  }
8
9
  /**
@@ -10,6 +11,10 @@ export interface IDonutChart {
10
11
  * {@docCategory DonutChart}
11
12
  */
12
13
  export interface IDonutChartProps extends ICartesianChartProps {
14
+ /**
15
+ * Title styles configuration for the chart title
16
+ */
17
+ titleStyles?: ITitleStyles;
13
18
  /**
14
19
  * Data to render in the chart.
15
20
  */
@@ -94,6 +99,10 @@ export interface IDonutChartStyles {
94
99
  * Style for the legend container.
95
100
  */
96
101
  legendContainer: IStyle;
102
+ /**
103
+ * Style for the chart title.
104
+ */
105
+ chartTitle?: IStyle;
97
106
  /**
98
107
  * styles for axis annotation
99
108
  */
@@ -102,4 +111,8 @@ export interface IDonutChartStyles {
102
111
  * Styles for the chart wrapper div
103
112
  */
104
113
  chartWrapper?: IStyle;
114
+ /**
115
+ * Style for SVG tooltip text
116
+ */
117
+ svgTooltip?: IStyle;
105
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChart.types.js","sourceRoot":"../src/","sources":["components/DonutChart/DonutChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IStyle } from '@fluentui/react/lib/Styling';\nimport { IRefObject, IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { ICartesianChartProps, ICartesianChartStyleProps } from '../CommonComponents/index';\nimport { ICalloutProps } from '@fluentui/react/lib/Callout';\nimport { IChartProps, IChartDataPoint, IChart } from './index';\n\nexport interface IDonutChart {}\n\n/**\n * Donut Chart properties.\n * {@docCategory DonutChart}\n */\nexport interface IDonutChartProps extends ICartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data?: IChartProps;\n\n /**\n * inner radius for donut size\n */\n innerRadius?: number;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IDonutChartStyleProps, IDonutChartStyles>;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: IRenderFunction<IChartDataPoint>;\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n * @default false\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n * @default true\n */\n hideLabels?: boolean;\n\n /**\n * Prop to enable the gradient in the chart\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Optional callback to access the IChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: IRefObject<IChart>;\n\n /**\n * Rendering order of the legend\n * @default 'default'\n * 'default' - as per data provided\n * 'sorted' - in descending order of value\n */\n order?: 'default' | 'sorted';\n}\n\n/**\n * Donut Chart style properties\n * {@docCategory DonutChart}\n */\nexport interface IDonutChartStyleProps extends ICartesianChartStyleProps {}\n\n/**\n * Donut Chart styles\n * {@docCategory DonutChart}\n */\nexport interface IDonutChartStyles {\n /**\n * Style for the root element.\n */\n root?: IStyle;\n\n /**\n * Style for the chart.\n */\n chart?: IStyle;\n /**\n * Style for the legend container.\n */\n legendContainer: IStyle;\n\n /**\n * styles for axis annotation\n */\n axisAnnotation?: IStyle;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: IStyle;\n}\n"]}
1
+ {"version":3,"file":"DonutChart.types.js","sourceRoot":"../src/","sources":["components/DonutChart/DonutChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IStyle } from '@fluentui/react/lib/Styling';\nimport { IRefObject, IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { ICartesianChartProps, ICartesianChartStyleProps } from '../CommonComponents/index';\nimport { ICalloutProps } from '@fluentui/react/lib/Callout';\nimport { IChartProps, IChartDataPoint, IChart } from './index';\nimport type { ITitleStyles } from '../../utilities/Common.styles';\n\nexport interface IDonutChart {}\n\n/**\n * Donut Chart properties.\n * {@docCategory DonutChart}\n */\nexport interface IDonutChartProps extends ICartesianChartProps {\n /**\n * Title styles configuration for the chart title\n */\n titleStyles?: ITitleStyles;\n\n /**\n * Data to render in the chart.\n */\n data?: IChartProps;\n\n /**\n * inner radius for donut size\n */\n innerRadius?: number;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IDonutChartStyleProps, IDonutChartStyles>;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: IRenderFunction<IChartDataPoint>;\n\n /**\n * props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * Prop to show the arc labels in percentage format\n * @default false\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop to hide the arc labels\n * @default true\n */\n hideLabels?: boolean;\n\n /**\n * Prop to enable the gradient in the chart\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Optional callback to access the IChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: IRefObject<IChart>;\n\n /**\n * Rendering order of the legend\n * @default 'default'\n * 'default' - as per data provided\n * 'sorted' - in descending order of value\n */\n order?: 'default' | 'sorted';\n}\n\n/**\n * Donut Chart style properties\n * {@docCategory DonutChart}\n */\nexport interface IDonutChartStyleProps extends ICartesianChartStyleProps {}\n\n/**\n * Donut Chart styles\n * {@docCategory DonutChart}\n */\nexport interface IDonutChartStyles {\n /**\n * Style for the root element.\n */\n root?: IStyle;\n\n /**\n * Style for the chart.\n */\n chart?: IStyle;\n /**\n * Style for the legend container.\n */\n legendContainer: IStyle;\n\n /**\n * Style for the chart title.\n */\n chartTitle?: IStyle;\n\n /**\n * styles for axis annotation\n */\n axisAnnotation?: IStyle;\n\n /**\n * Styles for the chart wrapper div\n */\n chartWrapper?: IStyle;\n\n /**\n * Style for SVG tooltip text\n */\n svgTooltip?: IStyle;\n}\n"]}
@@ -1,19 +1,19 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities", "@fluentui/react-focus", "../Legends/index", "@fluentui/react/lib/Callout", "../../utilities/ChartHoverCard/ChartHoverCard", "@fluentui/chart-utilities", "../../utilities/image-export-utils", "../../utilities/utilities", "./funnelGeometry"], function (require, exports, tslib_1, React, Utilities_1, react_focus_1, index_1, Callout_1, ChartHoverCard_1, chart_utilities_1, image_export_utils_1, utilities_1, funnelGeometry_1) {
1
+ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities", "@fluentui/react-focus", "../Legends/index", "@fluentui/react/lib/Callout", "../../utilities/ChartHoverCard/ChartHoverCard", "@fluentui/chart-utilities", "../../utilities/image-export-utils", "../../utilities/utilities", "../../utilities/index", "./funnelGeometry"], function (require, exports, tslib_1, React, Utilities_1, react_focus_1, index_1, Callout_1, ChartHoverCard_1, chart_utilities_1, image_export_utils_1, utilities_1, index_2, funnelGeometry_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.FunnelChartBase = void 0;
5
5
  var getClassNames = (0, Utilities_1.classNamesFunction)();
6
6
  exports.FunnelChartBase = React.forwardRef(function (_a, forwardedRef) {
7
- var _b;
8
- var _c = _a.orientation, orientation = _c === void 0 ? 'vertical' : _c, props = tslib_1.__rest(_a, ["orientation"]);
7
+ var _b, _c, _d;
8
+ var _e = _a.orientation, orientation = _e === void 0 ? 'vertical' : _e, props = tslib_1.__rest(_a, ["orientation"]);
9
9
  var _tooltipId = (0, Utilities_1.getId)('FunnelChartTooltipId_');
10
10
  var _emptyChartId = (0, Utilities_1.getId)('_FunnelChart_empty');
11
11
  var isRTL = (0, Utilities_1.getRTL)();
12
- var _d = React.useState(null), hoveredStage = _d[0], setHoveredStage = _d[1];
13
- var _e = React.useState(false), isCalloutVisible = _e[0], setIsCalloutVisible = _e[1];
14
- var _f = React.useState(null), calloutData = _f[0], setCalloutData = _f[1];
15
- var _g = React.useState(null), refSelected = _g[0], setRefSelected = _g[1];
16
- var _h = React.useState([]), selectedLegends = _h[0], setSelectedLegends = _h[1];
12
+ var _f = React.useState(null), hoveredStage = _f[0], setHoveredStage = _f[1];
13
+ var _g = React.useState(false), isCalloutVisible = _g[0], setIsCalloutVisible = _g[1];
14
+ var _h = React.useState(null), calloutData = _h[0], setCalloutData = _h[1];
15
+ var _j = React.useState(null), refSelected = _j[0], setRefSelected = _j[1];
16
+ var _k = React.useState([]), selectedLegends = _k[0], setSelectedLegends = _k[1];
17
17
  var chartContainerRef = React.useRef(null);
18
18
  var legendsRef = React.useRef(null);
19
19
  var isStacked = isStackedFunnelData(props.data);
@@ -265,12 +265,17 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
265
265
  chartWidth: width,
266
266
  chartHeight: height,
267
267
  });
268
- var funnelMarginTop = 40;
268
+ var titleHeight = props.chartTitle
269
+ ? Math.max((typeof ((_d = (_c = props.titleStyles) === null || _c === void 0 ? void 0 : _c.titleFont) === null || _d === void 0 ? void 0 : _d.size) === 'number' ? props.titleStyles.titleFont.size : 13) +
270
+ index_2.CHART_TITLE_PADDING, 40)
271
+ : 40;
272
+ var funnelMarginTop = titleHeight;
269
273
  var funnelWidth = width * 0.8;
270
274
  var funnelOffsetX = (width - funnelWidth) / 2;
271
275
  return !_isChartEmpty() ? (React.createElement("div", { ref: chartContainerRef, className: classNames.root },
272
276
  React.createElement(react_focus_1.FocusZone, { direction: react_focus_1.FocusZoneDirection.horizontal },
273
277
  React.createElement("svg", { width: width, height: height, className: classNames.chart, role: 'img', "aria-label": props.chartTitle },
278
+ !props.hideLegend && props.chartTitle && (React.createElement(index_2.ChartTitle, { title: props.chartTitle, x: width / 2, maxWidth: width - 20, className: classNames.chartTitle, titleStyles: props.titleStyles, tooltipClassName: classNames.svgTooltip })),
274
279
  React.createElement("g", { transform: isRTL
275
280
  ? "translate(".concat(funnelOffsetX + funnelWidth, ", ").concat(funnelMarginTop, ") scale(-1,1)")
276
281
  : "translate(".concat(funnelOffsetX, ", ").concat(funnelMarginTop, ")") }, isStacked
@@ -1 +1 @@
1
- {"version":3,"file":"FunnelChart.base.js","sourceRoot":"../src/","sources":["components/FunnelChart/FunnelChart.base.tsx"],"names":[],"mappings":";;;;IAyBA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAA8C,CAAC;IAE1E,QAAA,eAAe,GAA+C,KAAK,CAAC,UAAU,CAGzF,UAAC,EAAsC,EAAE,YAAY;;QAAlD,IAAA,mBAAwB,EAAxB,WAAW,mBAAG,UAAU,KAAA,EAAK,KAAK,sBAApC,eAAsC,CAAF;QACrC,IAAM,UAAU,GAAW,IAAA,iBAAK,EAAC,uBAAuB,CAAC,CAAC;QAC1D,IAAM,aAAa,GAAW,IAAA,iBAAK,EAAC,oBAAoB,CAAC,CAAC;QAC1D,IAAM,KAAK,GAAG,IAAA,kBAAM,GAAE,CAAC;QAEjB,IAAA,KAAkC,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,EAApE,YAAY,QAAA,EAAE,eAAe,QAAuC,CAAC;QACtE,IAAA,KAA0C,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA9D,gBAAgB,QAAA,EAAE,mBAAmB,QAAyB,CAAC;QAChE,IAAA,KAAgC,KAAK,CAAC,QAAQ,CAA+B,IAAI,CAAC,EAAjF,WAAW,QAAA,EAAE,cAAc,QAAsD,CAAC;QACnF,IAAA,KAAgC,KAAK,CAAC,QAAQ,CAAoB,IAAI,CAAC,EAAtE,WAAW,QAAA,EAAE,cAAc,QAA2C,CAAC;QACxE,IAAA,KAAwC,KAAK,CAAC,QAAQ,CAAW,EAAE,CAAC,EAAnE,eAAe,QAAA,EAAE,kBAAkB,QAAgC,CAAC;QAC3E,IAAM,i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,CACxB,6BAAK,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,CAAC,IAAI;YACrD,oBAAC,uBAAS,IAAC,SAAS,EAAE,gCAAkB,CAAC,UAAU;gBACjD,6BAAK,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,gBAAc,KAAK,CAAC,UAAU;oBACvG,2BACE,SAAS,EACP,KAAK;4BACH,CAAC,CAAC,oBAAa,aAAa,GAAG,WAAW,eAAK,eAAe,kBAAe;4BAC7E,CAAC,CAAC,oBAAa,aAAa,eAAK,eAAe,MAAG,IAGtD,SAAS;wBACR,CAAC,CAAC,oBAAoB,CAAC,MAAM,GAAG,eAAe,EAAE,WAAW,CAAC;wBAC7D,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,eAAe,EAAE,WAAW,CAAC,CACtD;oBACH,gBAAgB,IAAI,CACnB,oBAAC,iBAAO,uBAAK,YAAY;wBACvB,oBAAC,+BAAc,IACb,MAAM,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAgB,EACtC,MAAM,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,EAC5B,KAAK,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,GAC1B,CACM,CACX,CACG,CACI;YACX,cAAc,EAAE,CACb,CACP,CAAC,CAAC,CAAC,CACF,6BAAK,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAc,8BAA8B,GAAI,CAC/G,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,uBAAe,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, getId, getRTL } from '@fluentui/react/lib/Utilities';\nimport {\n IFunnelChartDataPoint,\n IFunnelChartProps,\n IFunnelChartStyleProps,\n IFunnelChartStyles,\n} from './FunnelChart.types';\nimport { FocusZone, FocusZoneDirection } from '@fluentui/react-focus';\nimport { ILegend, ILegendContainer, Legends } from '../Legends/index';\nimport { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';\nimport { ChartHoverCard } from '../../utilities/ChartHoverCard/ChartHoverCard';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { IImageExportOptions } from '../../types/index';\nimport { exportChartsAsImage } from '../../utilities/image-export-utils';\nimport { getContrastTextColor } from '../../utilities/utilities';\nimport {\n getHorizontalFunnelSegmentGeometry,\n getVerticalFunnelSegmentGeometry,\n getSegmentTextProps,\n getStackedHorizontalFunnelSegmentGeometry,\n getStackedVerticalFunnelSegmentGeometry,\n} from './funnelGeometry';\nimport type { JSXElement } from '@fluentui/utilities';\n\nconst getClassNames = classNamesFunction<IFunnelChartStyleProps, IFunnelChartStyles>();\n\nexport const FunnelChartBase: React.FunctionComponent<IFunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n IFunnelChartProps\n>(({ orientation = 'vertical', ...props }, forwardedRef) => {\n const _tooltipId: string = getId('FunnelChartTooltipId_');\n const _emptyChartId: string = getId('_FunnelChart_empty');\n const isRTL = getRTL();\n\n const [hoveredStage, setHoveredStage] = React.useState<string | null>(null);\n const [isCalloutVisible, setIsCalloutVisible] = React.useState(false);\n const [calloutData, setCalloutData] = React.useState<IFunnelChartDataPoint | null>(null);\n const [refSelected, setRefSelected] = React.useState<SVGElement | null>(null);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>([]);\n const chartContainerRef = React.useRef<HTMLDivElement | null>(null);\n const legendsRef = React.useRef<ILegendContainer | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: chartContainerRef ?? null,\n toImage: (opts?: IImageExportOptions): Promise<string> => {\n return exportChartsAsImage(\n [{ container: chartContainerRef.current }],\n props.hideLegend ? undefined : legendsRef.current?.toSVG,\n getRTL(),\n opts,\n );\n },\n }),\n [props.hideLegend],\n );\n\n function _handleHover(data: IFunnelChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>) {\n mouseEvent?.persist();\n setHoveredStage(data.stage as string);\n setCalloutData(data);\n setIsCalloutVisible(true);\n setRefSelected(mouseEvent.currentTarget);\n }\n\n function _handleFocus(data: IFunnelChartDataPoint, focusEvent: React.FocusEvent<SVGPathElement>) {\n focusEvent?.persist();\n setCalloutData(data);\n setIsCalloutVisible(true);\n setRefSelected(focusEvent.currentTarget);\n }\n\n function _handleStackedHover(\n stage: string,\n subValue: { category: string; value: number; color: string },\n mouseEvent: React.MouseEvent<SVGElement>,\n ) {\n mouseEvent?.persist();\n setHoveredStage(subValue.category);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as IFunnelChartDataPoint);\n setIsCalloutVisible(true);\n setRefSelected(mouseEvent.currentTarget);\n }\n\n function _handleStackedFocus(\n stage: string,\n subValue: { category: string; value: number; color: string },\n focusEvent: React.FocusEvent<SVGPathElement>,\n ) {\n focusEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as IFunnelChartDataPoint);\n setIsCalloutVisible(true);\n setRefSelected(focusEvent.currentTarget);\n }\n\n function _handleMouseOut() {\n setHoveredStage(null);\n setIsCalloutVisible(false);\n setCalloutData(null);\n setRefSelected(null);\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: ILegend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n const _onLegendSelectionChangeCallback = React.useCallback(_onLegendSelectionChange, [props.legendProps]);\n\n function getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : hoveredStage ? [hoveredStage] : [];\n }\n\n function legendHighlighted(legend: string): boolean {\n return getHighlightedLegend().includes(legend);\n }\n\n function noLegendHighlighted(): boolean {\n return getHighlightedLegend().length === 0;\n }\n\n function _getEventHandlerProps(\n data: IFunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } },\n opacity?: number,\n ) {\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity === 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onMouseMove:\n opacity === 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleStackedFocus(data.stage, data.subValue, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver: opacity === 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onMouseMove: opacity === 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text x={isRTL ? funnelWidth - x : x} y={y} textAnchor=\"middle\" alignmentBaseline=\"middle\" fill={textColor}>\n {formatToLocaleString(value.toString(), props.culture) as React.ReactNode}\n </text>\n );\n\n if (isRTL) {\n return <g transform={`scale(-1,1) translate(${-funnelWidth},0)`}>{textElement}</g>;\n }\n return textElement;\n }\n\n function _renderFunnelSegment({\n key,\n pathD,\n fill,\n opacity,\n textProps,\n data,\n isFocusable,\n }: {\n key: string | number;\n pathD: string;\n fill: string;\n opacity: number;\n textProps?: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n };\n data: IFunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } };\n isFocusable?: boolean;\n }) {\n const eventHandlers = _getEventHandlerProps(data, opacity);\n const textColor = getContrastTextColor(fill, props.theme!);\n\n return (\n <g key={key}>\n <path d={pathD} fill={fill} opacity={opacity} {...eventHandlers} data-is-focusable={isFocusable} />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor })}</g>}\n </g>\n );\n }\n\n function _createFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n return data.map((d, i) => {\n const geometryProps =\n orientation === 'vertical'\n ? getVerticalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL })\n : getHorizontalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL });\n\n const { pathD, textX, textY, availableWidth } = geometryProps;\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps(d);\n const textProps = getSegmentTextProps({\n availableWidth,\n minTextWidth,\n textX,\n textY,\n value: d.value!,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: i,\n pathD,\n fill: d.color!,\n opacity: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: d,\n isFocusable: legendHighlighted(d.stage as string) || noLegendHighlighted() ? true : false,\n });\n });\n }\n\n function isStackedFunnelData(data: IFunnelChartDataPoint[]): boolean {\n return Array.isArray(data) && data.every(stage => Array.isArray(stage.subValues));\n }\n\n function _renderStackedSegment(\n stage: IFunnelChartDataPoint,\n subValue: { value: number; color: string; category: string },\n stageIndex: number,\n subValueIndex: number,\n geometryParams: {\n stages: IFunnelChartDataPoint[];\n totals: number[];\n maxTotal: number;\n funnelWidth: number;\n funnelHeight: number;\n isRTL: boolean;\n },\n ): JSXElement {\n // Ensure stages have subValues for geometry functions\n const stagesWithSubValues = geometryParams.stages.map(s => ({\n ...s,\n subValues: s.subValues || [],\n }));\n\n const geom =\n orientation === 'vertical'\n ? getStackedVerticalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n })\n : getStackedHorizontalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n });\n\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps({ stage: stage.stage as string, subValue });\n const textProps = getSegmentTextProps({\n availableWidth: geom.availableWidth,\n minTextWidth,\n textX: geom.textX,\n textY: geom.textY,\n value: subValue.value,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: `${stageIndex}-${subValueIndex}`,\n pathD: geom.pathD,\n fill: subValue.color,\n opacity:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: { stage: stage.stage as string, subValue },\n isFocusable:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted()\n ? true\n : false,\n });\n }\n\n function _createStackedFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n\n const stages = data;\n const totals = stages.map(s => s?.subValues?.reduce((sum, subValue) => sum + subValue.value, 0) ?? 0);\n const maxTotal = Math.max(...totals);\n\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n const paths: JSXElement[] = [];\n\n const geometryParams = {\n stages,\n totals,\n maxTotal,\n funnelWidth,\n funnelHeight,\n isRTL,\n };\n\n for (let i = 0; i < stages.length; i++) {\n const cur = stages[i];\n for (let k = 0; k < (cur.subValues ?? []).length; k++) {\n const v = cur.subValues?.[k];\n if (!v) {\n continue;\n }\n paths.push(_renderStackedSegment(cur, v, i, k, geometryParams));\n }\n }\n return paths;\n }\n\n function _renderLegends(): JSXElement {\n if (props.hideLegend) {\n return <></>;\n }\n let legends: ILegend[];\n\n if (isStacked) {\n // Collect unique categories and their color\n const categoryMap: Record<string, string> = {};\n props.data.forEach((stage: IFunnelChartDataPoint) => {\n (stage.subValues || []).forEach(sub => {\n if (!(sub.category in categoryMap)) {\n categoryMap[sub.category] = sub.color;\n }\n });\n });\n legends = Object.entries(categoryMap).map(([category, color]) => ({\n title: category,\n color,\n hoverAction: () => setHoveredStage(category),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n } else {\n legends = props.data.map((d: IFunnelChartDataPoint) => ({\n title: d.stage as string,\n color: d.color!,\n hoverAction: () => setHoveredStage(d.stage as string),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n }\n\n return (\n <div style={{ display: 'flex', justifyContent: 'center' }}>\n <Legends\n ref={legendsRef}\n legends={legends}\n centerLegends={true}\n onChange={_onLegendSelectionChangeCallback}\n {...props.legendProps}\n />\n </div>\n );\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n const calloutProps = {\n isCalloutVisible,\n directionalHint: DirectionalHint.topAutoEdge,\n id: `toolTip${_tooltipId}`,\n target: refSelected,\n color: calloutData?.color,\n XValue: calloutData?.stage,\n YValue: calloutData?.value,\n isBeakVisible: false,\n gapSpace: 15,\n onDismiss: () => {\n setIsCalloutVisible(false);\n },\n preventDismissOnLostFocus: true,\n ...props.calloutProps,\n };\n\n const width = props.width || 350;\n const height = props.height || 500;\n const classNames = getClassNames(props.styles!, {\n theme: props.theme!,\n className: props.className,\n chartWidth: width,\n chartHeight: height,\n });\n\n const funnelMarginTop = 40;\n const funnelWidth = width * 0.8;\n const funnelOffsetX = (width - funnelWidth) / 2;\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classNames.root}>\n <FocusZone direction={FocusZoneDirection.horizontal}>\n <svg width={width} height={height} className={classNames.chart} role={'img'} aria-label={props.chartTitle}>\n <g\n transform={\n isRTL\n ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)`\n : `translate(${funnelOffsetX}, ${funnelMarginTop})`\n }\n >\n {isStacked\n ? _createStackedFunnel(height - funnelMarginTop, funnelWidth)\n : _createFunnel(height - funnelMarginTop, funnelWidth)}\n </g>\n {isCalloutVisible && (\n <Callout {...calloutProps}>\n <ChartHoverCard\n XValue={calloutProps?.XValue as string}\n YValue={calloutProps?.YValue}\n color={calloutProps?.color}\n />\n </Callout>\n )}\n </svg>\n </FocusZone>\n {_renderLegends()}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nFunnelChartBase.displayName = 'FunnelChart';\n"]}
1
+ {"version":3,"file":"FunnelChart.base.js","sourceRoot":"../src/","sources":["components/FunnelChart/FunnelChart.base.tsx"],"names":[],"mappings":";;;;IA0BA,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAA8C,CAAC;IAE1E,QAAA,eAAe,GAA+C,KAAK,CAAC,UAAU,CAGzF,UAAC,EAAsC,EAAE,YAAY;;QAAlD,IAAA,mBAAwB,EAAxB,WAAW,mBAAG,UAAU,KAAA,EAAK,KAAK,sBAApC,eAAsC,CAAF;QACrC,IAAM,UAAU,GAAW,IAAA,iBAAK,EAAC,uBAAuB,CAAC,CAAC;QAC1D,IAAM,aAAa,GAAW,IAAA,iBAAK,EAAC,oBAAoB,CAAC,CAAC;QAC1D,IAAM,KAAK,GAAG,IAAA,kBAAM,GAAE,CAAC;QAEjB,IAAA,KAAkC,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,EAApE,YAAY,QAAA,EAAE,eAAe,QAAuC,CAAC;QACtE,IAAA,KAA0C,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA9D,gBAAgB,QAAA,EAAE,mBAAmB,QAAyB,CAAC;QAChE,IAAA,KAAgC,KAAK,CAAC,QAAQ,CAA+B,IAAI,CAAC,EAA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,GAAG,WAAW,eAAK,eAAe,kBAAe;4BAC7E,CAAC,CAAC,oBAAa,aAAa,eAAK,eAAe,MAAG,IAGtD,SAAS;wBACR,CAAC,CAAC,oBAAoB,CAAC,MAAM,GAAG,eAAe,EAAE,WAAW,CAAC;wBAC7D,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,eAAe,EAAE,WAAW,CAAC,CACtD;oBACH,gBAAgB,IAAI,CACnB,oBAAC,iBAAO,uBAAK,YAAY;wBACvB,oBAAC,+BAAc,IACb,MAAM,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAgB,EACtC,MAAM,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,EAC5B,KAAK,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,GAC1B,CACM,CACX,CACG,CACI;YACX,cAAc,EAAE,CACb,CACP,CAAC,CAAC,CAAC,CACF,6BAAK,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAc,8BAA8B,GAAI,CAC/G,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,uBAAe,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, getId, getRTL } from '@fluentui/react/lib/Utilities';\nimport {\n IFunnelChartDataPoint,\n IFunnelChartProps,\n IFunnelChartStyleProps,\n IFunnelChartStyles,\n} from './FunnelChart.types';\nimport { FocusZone, FocusZoneDirection } from '@fluentui/react-focus';\nimport { ILegend, ILegendContainer, Legends } from '../Legends/index';\nimport { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';\nimport { ChartHoverCard } from '../../utilities/ChartHoverCard/ChartHoverCard';\nimport { formatToLocaleString } from '@fluentui/chart-utilities';\nimport { IImageExportOptions } from '../../types/index';\nimport { exportChartsAsImage } from '../../utilities/image-export-utils';\nimport { getContrastTextColor } from '../../utilities/utilities';\nimport { ChartTitle, CHART_TITLE_PADDING } from '../../utilities/index';\nimport {\n getHorizontalFunnelSegmentGeometry,\n getVerticalFunnelSegmentGeometry,\n getSegmentTextProps,\n getStackedHorizontalFunnelSegmentGeometry,\n getStackedVerticalFunnelSegmentGeometry,\n} from './funnelGeometry';\nimport type { JSXElement } from '@fluentui/utilities';\n\nconst getClassNames = classNamesFunction<IFunnelChartStyleProps, IFunnelChartStyles>();\n\nexport const FunnelChartBase: React.FunctionComponent<IFunnelChartProps> = React.forwardRef<\n HTMLDivElement,\n IFunnelChartProps\n>(({ orientation = 'vertical', ...props }, forwardedRef) => {\n const _tooltipId: string = getId('FunnelChartTooltipId_');\n const _emptyChartId: string = getId('_FunnelChart_empty');\n const isRTL = getRTL();\n\n const [hoveredStage, setHoveredStage] = React.useState<string | null>(null);\n const [isCalloutVisible, setIsCalloutVisible] = React.useState(false);\n const [calloutData, setCalloutData] = React.useState<IFunnelChartDataPoint | null>(null);\n const [refSelected, setRefSelected] = React.useState<SVGElement | null>(null);\n const [selectedLegends, setSelectedLegends] = React.useState<string[]>([]);\n const chartContainerRef = React.useRef<HTMLDivElement | null>(null);\n const legendsRef = React.useRef<ILegendContainer | null>(null);\n const isStacked = isStackedFunnelData(props.data);\n\n React.useEffect(() => {\n if (props.legendProps?.selectedLegends) {\n setSelectedLegends(props.legendProps.selectedLegends);\n }\n }, [props.legendProps?.selectedLegends]);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n chartContainer: chartContainerRef ?? null,\n toImage: (opts?: IImageExportOptions): Promise<string> => {\n return exportChartsAsImage(\n [{ container: chartContainerRef.current }],\n props.hideLegend ? undefined : legendsRef.current?.toSVG,\n getRTL(),\n opts,\n );\n },\n }),\n [props.hideLegend],\n );\n\n function _handleHover(data: IFunnelChartDataPoint, mouseEvent: React.MouseEvent<SVGElement>) {\n mouseEvent?.persist();\n setHoveredStage(data.stage as string);\n setCalloutData(data);\n setIsCalloutVisible(true);\n setRefSelected(mouseEvent.currentTarget);\n }\n\n function _handleFocus(data: IFunnelChartDataPoint, focusEvent: React.FocusEvent<SVGPathElement>) {\n focusEvent?.persist();\n setCalloutData(data);\n setIsCalloutVisible(true);\n setRefSelected(focusEvent.currentTarget);\n }\n\n function _handleStackedHover(\n stage: string,\n subValue: { category: string; value: number; color: string },\n mouseEvent: React.MouseEvent<SVGElement>,\n ) {\n mouseEvent?.persist();\n setHoveredStage(subValue.category);\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as IFunnelChartDataPoint);\n setIsCalloutVisible(true);\n setRefSelected(mouseEvent.currentTarget);\n }\n\n function _handleStackedFocus(\n stage: string,\n subValue: { category: string; value: number; color: string },\n focusEvent: React.FocusEvent<SVGPathElement>,\n ) {\n focusEvent?.persist();\n setCalloutData({\n stage,\n value: subValue.value,\n color: subValue.color,\n category: subValue.category,\n } as IFunnelChartDataPoint);\n setIsCalloutVisible(true);\n setRefSelected(focusEvent.currentTarget);\n }\n\n function _handleMouseOut() {\n setHoveredStage(null);\n setIsCalloutVisible(false);\n setCalloutData(null);\n setRefSelected(null);\n }\n\n function _onLegendSelectionChange(\n legendsSelected: string[],\n event: React.MouseEvent<HTMLButtonElement>,\n currentLegend?: ILegend,\n ): void {\n if (props.legendProps?.canSelectMultipleLegends) {\n setSelectedLegends(legendsSelected);\n } else {\n setSelectedLegends(legendsSelected.slice(-1));\n }\n\n if (props.legendProps?.onChange) {\n props.legendProps.onChange(legendsSelected, event, currentLegend);\n }\n }\n\n const _onLegendSelectionChangeCallback = React.useCallback(_onLegendSelectionChange, [props.legendProps]);\n\n function getHighlightedLegend(): string[] {\n return selectedLegends.length > 0 ? selectedLegends : hoveredStage ? [hoveredStage] : [];\n }\n\n function legendHighlighted(legend: string): boolean {\n return getHighlightedLegend().includes(legend);\n }\n\n function noLegendHighlighted(): boolean {\n return getHighlightedLegend().length === 0;\n }\n\n function _getEventHandlerProps(\n data: IFunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } },\n opacity?: number,\n ) {\n if ('subValue' in data) {\n return {\n culture: props.culture,\n onMouseOver:\n opacity === 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onMouseMove:\n opacity === 1\n ? (event: React.MouseEvent<SVGElement>) => _handleStackedHover(data.stage, data.subValue, event)\n : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleStackedFocus(data.stage, data.subValue, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n } else {\n return {\n culture: props.culture,\n onMouseOver: opacity === 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onMouseMove: opacity === 1 ? (event: React.MouseEvent<SVGElement>) => _handleHover(data, event) : undefined,\n onFocus: (event: React.FocusEvent<SVGPathElement>) => _handleFocus(data, event),\n onBlur: () => _handleMouseOut(),\n onMouseOut: () => _handleMouseOut(),\n };\n }\n }\n\n function _renderSegmentText({\n show,\n x,\n y,\n value,\n textColor,\n }: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n textColor: string;\n }) {\n if (!show) {\n return null;\n }\n\n const textElement = (\n <text x={isRTL ? funnelWidth - x : x} y={y} textAnchor=\"middle\" alignmentBaseline=\"middle\" fill={textColor}>\n {formatToLocaleString(value.toString(), props.culture) as React.ReactNode}\n </text>\n );\n\n if (isRTL) {\n return <g transform={`scale(-1,1) translate(${-funnelWidth},0)`}>{textElement}</g>;\n }\n return textElement;\n }\n\n function _renderFunnelSegment({\n key,\n pathD,\n fill,\n opacity,\n textProps,\n data,\n isFocusable,\n }: {\n key: string | number;\n pathD: string;\n fill: string;\n opacity: number;\n textProps?: {\n show: boolean;\n x: number;\n y: number;\n value: number;\n };\n data: IFunnelChartDataPoint | { stage: string; subValue: { category: string; value: number; color: string } };\n isFocusable?: boolean;\n }) {\n const eventHandlers = _getEventHandlerProps(data, opacity);\n const textColor = getContrastTextColor(fill, props.theme!);\n\n return (\n <g key={key}>\n <path d={pathD} fill={fill} opacity={opacity} {...eventHandlers} data-is-focusable={isFocusable} />\n {textProps && <g {...eventHandlers}>{_renderSegmentText({ ...textProps, textColor })}</g>}\n </g>\n );\n }\n\n function _createFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n return data.map((d, i) => {\n const geometryProps =\n orientation === 'vertical'\n ? getVerticalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL })\n : getHorizontalFunnelSegmentGeometry({ d, i, data, funnelWidth, funnelHeight, isRTL });\n\n const { pathD, textX, textY, availableWidth } = geometryProps;\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps(d);\n const textProps = getSegmentTextProps({\n availableWidth,\n minTextWidth,\n textX,\n textY,\n value: d.value!,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: i,\n pathD,\n fill: d.color!,\n opacity: legendHighlighted(d.stage as string) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: d,\n isFocusable: legendHighlighted(d.stage as string) || noLegendHighlighted() ? true : false,\n });\n });\n }\n\n function isStackedFunnelData(data: IFunnelChartDataPoint[]): boolean {\n return Array.isArray(data) && data.every(stage => Array.isArray(stage.subValues));\n }\n\n function _renderStackedSegment(\n stage: IFunnelChartDataPoint,\n subValue: { value: number; color: string; category: string },\n stageIndex: number,\n subValueIndex: number,\n geometryParams: {\n stages: IFunnelChartDataPoint[];\n totals: number[];\n maxTotal: number;\n funnelWidth: number;\n funnelHeight: number;\n isRTL: boolean;\n },\n ): JSXElement {\n // Ensure stages have subValues for geometry functions\n const stagesWithSubValues = geometryParams.stages.map(s => ({\n ...s,\n subValues: s.subValues || [],\n }));\n\n const geom =\n orientation === 'vertical'\n ? getStackedVerticalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n })\n : getStackedHorizontalFunnelSegmentGeometry({\n ...geometryParams,\n stages: stagesWithSubValues,\n i: stageIndex,\n k: subValueIndex,\n });\n\n const minTextWidth = 16;\n const eventHandlerProps = _getEventHandlerProps({ stage: stage.stage as string, subValue });\n const textProps = getSegmentTextProps({\n availableWidth: geom.availableWidth,\n minTextWidth,\n textX: geom.textX,\n textY: geom.textY,\n value: subValue.value,\n ...eventHandlerProps,\n });\n\n return _renderFunnelSegment({\n key: `${stageIndex}-${subValueIndex}`,\n pathD: geom.pathD,\n fill: subValue.color,\n opacity:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted() ? 1 : 0.1,\n textProps,\n data: { stage: stage.stage as string, subValue },\n isFocusable:\n (isStackedFunnelData(props.data) && legendHighlighted(subValue.category)) || noLegendHighlighted()\n ? true\n : false,\n });\n }\n\n function _createStackedFunnel(containerHeight: number, containerWidth: number): JSXElement[] {\n const { data } = props;\n\n const stages = data;\n const totals = stages.map(s => s?.subValues?.reduce((sum, subValue) => sum + subValue.value, 0) ?? 0);\n const maxTotal = Math.max(...totals);\n\n const funnelWidth = containerWidth;\n const funnelHeight = containerHeight * 0.8;\n\n const paths: JSXElement[] = [];\n\n const geometryParams = {\n stages,\n totals,\n maxTotal,\n funnelWidth,\n funnelHeight,\n isRTL,\n };\n\n for (let i = 0; i < stages.length; i++) {\n const cur = stages[i];\n for (let k = 0; k < (cur.subValues ?? []).length; k++) {\n const v = cur.subValues?.[k];\n if (!v) {\n continue;\n }\n paths.push(_renderStackedSegment(cur, v, i, k, geometryParams));\n }\n }\n return paths;\n }\n\n function _renderLegends(): JSXElement {\n if (props.hideLegend) {\n return <></>;\n }\n let legends: ILegend[];\n\n if (isStacked) {\n // Collect unique categories and their color\n const categoryMap: Record<string, string> = {};\n props.data.forEach((stage: IFunnelChartDataPoint) => {\n (stage.subValues || []).forEach(sub => {\n if (!(sub.category in categoryMap)) {\n categoryMap[sub.category] = sub.color;\n }\n });\n });\n legends = Object.entries(categoryMap).map(([category, color]) => ({\n title: category,\n color,\n hoverAction: () => setHoveredStage(category),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n } else {\n legends = props.data.map((d: IFunnelChartDataPoint) => ({\n title: d.stage as string,\n color: d.color!,\n hoverAction: () => setHoveredStage(d.stage as string),\n onMouseOutAction: () => setHoveredStage(null),\n }));\n }\n\n return (\n <div style={{ display: 'flex', justifyContent: 'center' }}>\n <Legends\n ref={legendsRef}\n legends={legends}\n centerLegends={true}\n onChange={_onLegendSelectionChangeCallback}\n {...props.legendProps}\n />\n </div>\n );\n }\n\n function _isChartEmpty(): boolean {\n return !(props.data && props.data.length > 0);\n }\n\n const calloutProps = {\n isCalloutVisible,\n directionalHint: DirectionalHint.topAutoEdge,\n id: `toolTip${_tooltipId}`,\n target: refSelected,\n color: calloutData?.color,\n XValue: calloutData?.stage,\n YValue: calloutData?.value,\n isBeakVisible: false,\n gapSpace: 15,\n onDismiss: () => {\n setIsCalloutVisible(false);\n },\n preventDismissOnLostFocus: true,\n ...props.calloutProps,\n };\n\n const width = props.width || 350;\n const height = props.height || 500;\n const classNames = getClassNames(props.styles!, {\n theme: props.theme!,\n className: props.className,\n chartWidth: width,\n chartHeight: height,\n });\n\n const titleHeight = props.chartTitle\n ? Math.max(\n (typeof props.titleStyles?.titleFont?.size === 'number' ? props.titleStyles.titleFont.size : 13) +\n CHART_TITLE_PADDING,\n 40,\n )\n : 40;\n const funnelMarginTop = titleHeight;\n const funnelWidth = width * 0.8;\n const funnelOffsetX = (width - funnelWidth) / 2;\n\n return !_isChartEmpty() ? (\n <div ref={chartContainerRef} className={classNames.root}>\n <FocusZone direction={FocusZoneDirection.horizontal}>\n <svg width={width} height={height} className={classNames.chart} role={'img'} aria-label={props.chartTitle}>\n {!props.hideLegend && props.chartTitle && (\n <ChartTitle\n title={props.chartTitle}\n x={width / 2}\n maxWidth={width - 20}\n className={classNames.chartTitle}\n titleStyles={props.titleStyles}\n tooltipClassName={classNames.svgTooltip}\n />\n )}\n <g\n transform={\n isRTL\n ? `translate(${funnelOffsetX + funnelWidth}, ${funnelMarginTop}) scale(-1,1)`\n : `translate(${funnelOffsetX}, ${funnelMarginTop})`\n }\n >\n {isStacked\n ? _createStackedFunnel(height - funnelMarginTop, funnelWidth)\n : _createFunnel(height - funnelMarginTop, funnelWidth)}\n </g>\n {isCalloutVisible && (\n <Callout {...calloutProps}>\n <ChartHoverCard\n XValue={calloutProps?.XValue as string}\n YValue={calloutProps?.YValue}\n color={calloutProps?.color}\n />\n </Callout>\n )}\n </svg>\n </FocusZone>\n {_renderLegends()}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n});\nFunnelChartBase.displayName = 'FunnelChart';\n"]}
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "@fluentui/react/lib/Styling"], function (require, exports, Styling_1) {
1
+ define(["require", "exports", "@fluentui/react/lib/Styling", "../../utilities/Common.styles"], function (require, exports, Styling_1, Common_styles_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.getFunnelChartStyles = void 0;
@@ -21,6 +21,7 @@ define(["require", "exports", "@fluentui/react/lib/Styling"], function (require,
21
21
  width: chartWidth,
22
22
  height: chartHeight,
23
23
  },
24
+ chartTitle: (0, Common_styles_1.getChartTitleStyle)(theme),
24
25
  text: [
25
26
  theme.fonts.medium,
26
27
  {
@@ -29,6 +30,7 @@ define(["require", "exports", "@fluentui/react/lib/Styling"], function (require,
29
30
  fill: theme.palette.neutralPrimary,
30
31
  },
31
32
  ],
33
+ svgTooltip: (0, Common_styles_1.getSvgTooltipStyle)(theme),
32
34
  subComponentStyles: {
33
35
  calloutStyles: {
34
36
  root: {
@@ -1 +1 @@
1
- {"version":3,"file":"FunnelChart.styles.js","sourceRoot":"../src/","sources":["components/FunnelChart/FunnelChart.styles.ts"],"names":[],"mappings":";;;;IAGO,IAAM,oBAAoB,GAAG,UAAC,KAA6B;QACxD,IAAA,KAAK,GAAyC,KAAK,MAA9C,EAAE,SAAS,GAA8B,KAAK,UAAnC,EAAE,UAAU,GAAkB,KAAK,WAAvB,EAAE,WAAW,GAAK,KAAK,YAAV,CAAW;QAC5D,OAAO;YACL,yEAAyE;YACzE,IAAI,EAAE;gBACJ,KAAK,CAAC,KAAK,CAAC,MAAM;gBAClB,gBAAgB;gBAChB;oBACE,UAAU,EAAE,QAAQ;oBACpB,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;iBACf;gBACD,SAAS;aACV;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,WAAW;aACpB;YACD,IAAI,EAAE;gBACJ,KAAK,CAAC,KAAK,CAAC,MAAM;gBAClB;oBACE,aAAa,EAAE,MAAM;oBACrB,UAAU,EAAE,qBAAW,CAAC,QAAQ;oBAChC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;iBACnC;aACF;YACD,kBAAkB,EAAE;gBAClB,aAAa,EAAE;oBACb,IAAI,EAAE;wBACJ,QAAQ,EAAE,OAAO;qBAClB;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IAnCW,QAAA,oBAAoB,wBAmC/B","sourcesContent":["import { FontWeights } from '@fluentui/react/lib/Styling';\nimport { IFunnelChartStyleProps, IFunnelChartStyles } from './FunnelChart.types';\n\nexport const getFunnelChartStyles = (props: IFunnelChartStyleProps): IFunnelChartStyles => {\n const { theme, className, chartWidth, chartHeight } = props;\n return {\n // root: { minHeight: '200px', minWidth: '200px', position: 'relative' },\n root: [\n theme.fonts.medium,\n 'ms-FunnelChart',\n {\n alignItems: 'center',\n width: '100%',\n height: '100%',\n },\n className,\n ],\n chart: {\n display: 'block',\n width: chartWidth,\n height: chartHeight,\n },\n text: [\n theme.fonts.medium,\n {\n pointerEvents: 'none',\n fontWeight: FontWeights.semibold,\n fill: theme.palette.neutralPrimary,\n },\n ],\n subComponentStyles: {\n calloutStyles: {\n root: {\n maxWidth: '238px',\n },\n },\n },\n };\n};\n"]}
1
+ {"version":3,"file":"FunnelChart.styles.js","sourceRoot":"../src/","sources":["components/FunnelChart/FunnelChart.styles.ts"],"names":[],"mappings":";;;;IAIO,IAAM,oBAAoB,GAAG,UAAC,KAA6B;QACxD,IAAA,KAAK,GAAyC,KAAK,MAA9C,EAAE,SAAS,GAA8B,KAAK,UAAnC,EAAE,UAAU,GAAkB,KAAK,WAAvB,EAAE,WAAW,GAAK,KAAK,YAAV,CAAW;QAC5D,OAAO;YACL,yEAAyE;YACzE,IAAI,EAAE;gBACJ,KAAK,CAAC,KAAK,CAAC,MAAM;gBAClB,gBAAgB;gBAChB;oBACE,UAAU,EAAE,QAAQ;oBACpB,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;iBACf;gBACD,SAAS;aACV;YACD,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,UAAU;gBACjB,MAAM,EAAE,WAAW;aACpB;YACD,UAAU,EAAE,IAAA,kCAAkB,EAAC,KAAK,CAAC;YACrC,IAAI,EAAE;gBACJ,KAAK,CAAC,KAAK,CAAC,MAAM;gBAClB;oBACE,aAAa,EAAE,MAAM;oBACrB,UAAU,EAAE,qBAAW,CAAC,QAAQ;oBAChC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,cAAc;iBACnC;aACF;YACD,UAAU,EAAE,IAAA,kCAAkB,EAAC,KAAK,CAAC;YACrC,kBAAkB,EAAE;gBAClB,aAAa,EAAE;oBACb,IAAI,EAAE;wBACJ,QAAQ,EAAE,OAAO;qBAClB;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IArCW,QAAA,oBAAoB,wBAqC/B","sourcesContent":["import { FontWeights } from '@fluentui/react/lib/Styling';\nimport { IFunnelChartStyleProps, IFunnelChartStyles } from './FunnelChart.types';\nimport { getChartTitleStyle, getSvgTooltipStyle } from '../../utilities/Common.styles';\n\nexport const getFunnelChartStyles = (props: IFunnelChartStyleProps): IFunnelChartStyles => {\n const { theme, className, chartWidth, chartHeight } = props;\n return {\n // root: { minHeight: '200px', minWidth: '200px', position: 'relative' },\n root: [\n theme.fonts.medium,\n 'ms-FunnelChart',\n {\n alignItems: 'center',\n width: '100%',\n height: '100%',\n },\n className,\n ],\n chart: {\n display: 'block',\n width: chartWidth,\n height: chartHeight,\n },\n chartTitle: getChartTitleStyle(theme),\n text: [\n theme.fonts.medium,\n {\n pointerEvents: 'none',\n fontWeight: FontWeights.semibold,\n fill: theme.palette.neutralPrimary,\n },\n ],\n svgTooltip: getSvgTooltipStyle(theme),\n subComponentStyles: {\n calloutStyles: {\n root: {\n maxWidth: '238px',\n },\n },\n },\n };\n};\n"]}
@@ -4,6 +4,7 @@ import { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';
4
4
  import { ICalloutContentStyleProps, ICalloutContentStyles } from '@fluentui/react/lib/Callout';
5
5
  import { ILegendsProps } from '../Legends/index';
6
6
  import { ICalloutProps } from '@fluentui/react/lib/Callout';
7
+ import { ITitleStyles } from '../../utilities/Common.styles';
7
8
  /**
8
9
  * Data point for funnel chart
9
10
  * {@docCategory FunnelChart}
@@ -36,6 +37,10 @@ export interface IFunnelChartDataPoint {
36
37
  * {@docCategory FunnelChart}
37
38
  */
38
39
  export interface IFunnelChartProps {
40
+ /**
41
+ * Title styles configuration for the chart title
42
+ */
43
+ titleStyles?: ITitleStyles;
39
44
  /**
40
45
  * Data points for the funnel chart
41
46
  */
@@ -126,10 +131,18 @@ export interface IFunnelChartStyles {
126
131
  * Styles for the chart
127
132
  */
128
133
  chart?: IStyle;
134
+ /**
135
+ * Style for the chart title.
136
+ */
137
+ chartTitle?: IStyle;
129
138
  /**
130
139
  * Styles for text elements
131
140
  */
132
141
  text?: IStyle;
142
+ /**
143
+ * Style for SVG tooltip text
144
+ */
145
+ svgTooltip?: IStyle;
133
146
  /**
134
147
  * Styles for sub-components
135
148
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FunnelChart.types.js","sourceRoot":"../src/","sources":["components/FunnelChart/FunnelChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { ICalloutContentStyleProps, ICalloutContentStyles } from '@fluentui/react/lib/Callout';\nimport { ILegendsProps } from '../Legends/index';\nimport { ICalloutProps } from '@fluentui/react/lib/Callout';\n\n/**\n * Data point for funnel chart\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartDataPoint {\n /**\n * Stage name or identifier\n */\n stage: string | number;\n /**\n * Sub-values for stacked funnel charts\n * Each sub-value represents a category within the stage\n */\n subValues?: Array<{ category: string; value: number; color: string }>;\n /**\n * Value for the stage (used for non-stacked funnel charts)\n */\n value?: number;\n /**\n * Color for the stage (used for non-stacked funnel charts)\n */\n color?: string;\n}\n\n/**\n * Funnel Chart component props\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartProps {\n /**\n * Data points for the funnel chart\n */\n data: IFunnelChartDataPoint[];\n /**\n * Title for the chart\n */\n chartTitle?: string;\n /**\n * Width of the chart\n */\n width?: number;\n\n /**\n * Height of the chart\n */\n height?: number;\n\n /**\n * Decides whether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Props for the legends in the chart\n */\n legendProps?: Partial<ILegendsProps>;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\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<IFunnelChartStyleProps, IFunnelChartStyles>;\n\n /**\n * Defines the culture to localize the numbers and dates\n */\n culture?: string;\n\n /**\n * Reference to the chart component\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentRef?: React.RefObject<any>;\n\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n\n /**\n * Orientation of the funnel chart\n * @defaultvalue 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\n/**\n * Funnel Chart style properties\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartStyleProps {\n /**\n * Theme (provided through customization)\n */\n theme: ITheme;\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n /**\n * Width of the chart\n */\n chartWidth: number;\n /**\n * Height of the chart\n */\n chartHeight: number;\n}\n\n/**\n * Funnel Chart styles\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartStyles {\n /**\n * Styles for the root element\n */\n root?: IStyle;\n\n /**\n * Styles for the chart\n */\n chart?: IStyle;\n\n /**\n * Styles for text elements\n */\n text?: IStyle;\n\n /**\n * Styles for sub-components\n */\n subComponentStyles: {\n calloutStyles: IStyleFunctionOrObject<ICalloutContentStyleProps, ICalloutContentStyles>;\n };\n}\n"]}
1
+ {"version":3,"file":"FunnelChart.types.js","sourceRoot":"../src/","sources":["components/FunnelChart/FunnelChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { ICalloutContentStyleProps, ICalloutContentStyles } from '@fluentui/react/lib/Callout';\nimport { ILegendsProps } from '../Legends/index';\nimport { ICalloutProps } from '@fluentui/react/lib/Callout';\nimport { ITitleStyles } from '../../utilities/Common.styles';\n\n/**\n * Data point for funnel chart\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartDataPoint {\n /**\n * Stage name or identifier\n */\n stage: string | number;\n /**\n * Sub-values for stacked funnel charts\n * Each sub-value represents a category within the stage\n */\n subValues?: Array<{ category: string; value: number; color: string }>;\n /**\n * Value for the stage (used for non-stacked funnel charts)\n */\n value?: number;\n /**\n * Color for the stage (used for non-stacked funnel charts)\n */\n color?: string;\n}\n\n/**\n * Funnel Chart component props\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartProps {\n /**\n * Title styles configuration for the chart title\n */\n titleStyles?: ITitleStyles;\n\n /**\n * Data points for the funnel chart\n */\n data: IFunnelChartDataPoint[];\n /**\n * Title for the chart\n */\n chartTitle?: string;\n /**\n * Width of the chart\n */\n width?: number;\n\n /**\n * Height of the chart\n */\n height?: number;\n\n /**\n * Decides whether to show/hide legends\n * @defaultvalue false\n */\n hideLegend?: boolean;\n\n /**\n * Props for the legends in the chart\n */\n legendProps?: Partial<ILegendsProps>;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\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<IFunnelChartStyleProps, IFunnelChartStyles>;\n\n /**\n * Defines the culture to localize the numbers and dates\n */\n culture?: string;\n\n /**\n * Reference to the chart component\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n componentRef?: React.RefObject<any>;\n\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n\n /**\n * Orientation of the funnel chart\n * @defaultvalue 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\n/**\n * Funnel Chart style properties\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartStyleProps {\n /**\n * Theme (provided through customization)\n */\n theme: ITheme;\n /**\n * Additional CSS class(es) to apply to the chart\n */\n className?: string;\n /**\n * Width of the chart\n */\n chartWidth: number;\n /**\n * Height of the chart\n */\n chartHeight: number;\n}\n\n/**\n * Funnel Chart styles\n * {@docCategory FunnelChart}\n */\nexport interface IFunnelChartStyles {\n /**\n * Styles for the root element\n */\n root?: IStyle;\n\n /**\n * Styles for the chart\n */\n chart?: IStyle;\n\n /**\n * Style for the chart title.\n */\n chartTitle?: IStyle;\n\n /**\n * Styles for text elements\n */\n text?: IStyle;\n\n /**\n * Style for SVG tooltip text\n */\n svgTooltip?: IStyle;\n\n /**\n * Styles for sub-components\n */\n subComponentStyles: {\n calloutStyles: IStyleFunctionOrObject<ICalloutContentStyleProps, ICalloutContentStyles>;\n };\n}\n"]}