@fluentui/react-charting 5.25.4 → 5.25.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/CHANGELOG.json +107 -1
  2. package/CHANGELOG.md +30 -2
  3. package/bundle-size/PolarChart.fixture.js +7 -0
  4. package/dist/react-charting.d.ts +424 -1
  5. package/dist/react-charting.js +1 -1
  6. package/dist/react-charting.min.js +1 -1
  7. package/etc/react-charting.api.md +93 -1
  8. package/lib/PolarChart.d.ts +1 -0
  9. package/lib/PolarChart.js +2 -0
  10. package/lib/PolarChart.js.map +1 -0
  11. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  12. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  13. package/lib/components/AreaChart/AreaChart.base.d.ts +0 -1
  14. package/lib/components/AreaChart/AreaChart.base.js +2 -31
  15. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  16. package/lib/components/ChartTable/ChartTable.base.js +12 -4
  17. package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
  18. package/lib/components/ChartTable/ChartTable.styles.js +3 -0
  19. package/lib/components/ChartTable/ChartTable.styles.js.map +1 -1
  20. package/lib/components/ChartTable/ChartTable.types.d.ts +11 -0
  21. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  22. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  23. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  24. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  25. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  26. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  27. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  28. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  29. package/lib/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  30. package/lib/components/CommonComponents/CartesianChart.base.js +82 -42
  31. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  32. package/lib/components/CommonComponents/CartesianChart.styles.js +31 -27
  33. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  34. package/lib/components/CommonComponents/CartesianChart.types.d.ts +20 -1
  35. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  36. package/lib/components/DeclarativeChart/DeclarativeChart.js +24 -28
  37. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  38. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  39. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +390 -267
  40. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  41. package/lib/components/DonutChart/DonutChart.base.d.ts +1 -0
  42. package/lib/components/DonutChart/DonutChart.base.js +16 -4
  43. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  44. package/lib/components/DonutChart/DonutChart.styles.js +3 -1
  45. package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
  46. package/lib/components/DonutChart/DonutChart.types.d.ts +13 -0
  47. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  48. package/lib/components/DonutChart/Pie/Pie.js +4 -2
  49. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  50. package/lib/components/FunnelChart/FunnelChart.base.js +14 -8
  51. package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
  52. package/lib/components/FunnelChart/FunnelChart.styles.js +3 -0
  53. package/lib/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  54. package/lib/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  55. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  56. package/lib/components/GaugeChart/GaugeChart.base.js +2 -2
  57. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  58. package/lib/components/GaugeChart/GaugeChart.styles.js +16 -22
  59. package/lib/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  60. package/lib/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  61. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  62. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  63. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +6 -18
  64. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  65. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  66. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +55 -5
  67. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  68. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
  69. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  70. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  71. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  72. package/lib/components/LineChart/LineChart.base.d.ts +0 -1
  73. package/lib/components/LineChart/LineChart.base.js +2 -26
  74. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  75. package/lib/components/PolarChart/PolarChart.base.d.ts +3 -0
  76. package/lib/components/PolarChart/PolarChart.base.js +426 -0
  77. package/lib/components/PolarChart/PolarChart.base.js.map +1 -0
  78. package/lib/components/PolarChart/PolarChart.d.ts +7 -0
  79. package/lib/components/PolarChart/PolarChart.js +9 -0
  80. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  81. package/lib/components/PolarChart/PolarChart.styles.d.ts +2 -0
  82. package/lib/components/PolarChart/PolarChart.styles.js +39 -0
  83. package/lib/components/PolarChart/PolarChart.styles.js.map +1 -0
  84. package/lib/components/PolarChart/PolarChart.types.d.ts +185 -0
  85. package/lib/components/PolarChart/PolarChart.types.js +2 -0
  86. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  87. package/lib/components/PolarChart/PolarChart.utils.d.ts +43 -0
  88. package/lib/components/PolarChart/PolarChart.utils.js +180 -0
  89. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  90. package/lib/components/PolarChart/index.d.ts +2 -0
  91. package/lib/components/PolarChart/index.js +3 -0
  92. package/lib/components/PolarChart/index.js.map +1 -0
  93. package/lib/components/SankeyChart/SankeyChart.base.js +10 -3
  94. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  95. package/lib/components/SankeyChart/SankeyChart.styles.js +3 -0
  96. package/lib/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  97. package/lib/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  98. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  99. package/lib/components/ScatterChart/ScatterChart.base.js +14 -32
  100. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  101. package/lib/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  102. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  103. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  104. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +12 -80
  105. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  106. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  107. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +19 -31
  108. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  109. package/lib/index.d.ts +2 -0
  110. package/lib/index.js +1 -0
  111. package/lib/index.js.map +1 -1
  112. package/lib/types/IDataPoint.d.ts +107 -0
  113. package/lib/types/IDataPoint.js.map +1 -1
  114. package/lib/utilities/ChartTitle.d.ts +55 -0
  115. package/lib/utilities/ChartTitle.js +45 -0
  116. package/lib/utilities/ChartTitle.js.map +1 -0
  117. package/lib/utilities/Common.styles.d.ts +51 -0
  118. package/lib/utilities/Common.styles.js +70 -1
  119. package/lib/utilities/Common.styles.js.map +1 -1
  120. package/lib/utilities/image-export-utils.js +4 -4
  121. package/lib/utilities/image-export-utils.js.map +1 -1
  122. package/lib/utilities/index.d.ts +1 -0
  123. package/lib/utilities/index.js +1 -0
  124. package/lib/utilities/index.js.map +1 -1
  125. package/lib/utilities/utilities.d.ts +32 -8
  126. package/lib/utilities/utilities.js +232 -111
  127. package/lib/utilities/utilities.js.map +1 -1
  128. package/lib-amd/PolarChart.d.ts +1 -0
  129. package/lib-amd/PolarChart.js +6 -0
  130. package/lib-amd/PolarChart.js.map +1 -0
  131. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  132. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  133. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +0 -1
  134. package/lib-amd/components/AreaChart/AreaChart.base.js +1 -29
  135. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  136. package/lib-amd/components/ChartTable/ChartTable.base.js +12 -5
  137. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  138. package/lib-amd/components/ChartTable/ChartTable.styles.js +3 -1
  139. package/lib-amd/components/ChartTable/ChartTable.styles.js.map +1 -1
  140. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +11 -0
  141. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -1
  142. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  143. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  144. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  145. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  146. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  147. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  148. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  149. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  150. package/lib-amd/components/CommonComponents/CartesianChart.base.js +81 -41
  151. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  152. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +30 -26
  153. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  154. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +20 -1
  155. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  156. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +22 -28
  157. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  158. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  159. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +392 -269
  160. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  161. package/lib-amd/components/DonutChart/DonutChart.base.d.ts +1 -0
  162. package/lib-amd/components/DonutChart/DonutChart.base.js +15 -3
  163. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  164. package/lib-amd/components/DonutChart/DonutChart.styles.js +2 -0
  165. package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
  166. package/lib-amd/components/DonutChart/DonutChart.types.d.ts +13 -0
  167. package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
  168. package/lib-amd/components/DonutChart/Pie/Pie.js +4 -2
  169. package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
  170. package/lib-amd/components/FunnelChart/FunnelChart.base.js +14 -9
  171. package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
  172. package/lib-amd/components/FunnelChart/FunnelChart.styles.js +3 -1
  173. package/lib-amd/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  174. package/lib-amd/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  175. package/lib-amd/components/FunnelChart/FunnelChart.types.js.map +1 -1
  176. package/lib-amd/components/GaugeChart/GaugeChart.base.js +1 -1
  177. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  178. package/lib-amd/components/GaugeChart/GaugeChart.styles.js +16 -23
  179. package/lib-amd/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  180. package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  181. package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -1
  182. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  183. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -16
  184. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  185. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  186. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
  187. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  188. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -2
  189. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  190. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  191. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  192. package/lib-amd/components/LineChart/LineChart.base.d.ts +0 -1
  193. package/lib-amd/components/LineChart/LineChart.base.js +1 -25
  194. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  195. package/lib-amd/components/PolarChart/PolarChart.base.d.ts +3 -0
  196. package/lib-amd/components/PolarChart/PolarChart.base.js +421 -0
  197. package/lib-amd/components/PolarChart/PolarChart.base.js.map +1 -0
  198. package/lib-amd/components/PolarChart/PolarChart.d.ts +7 -0
  199. package/lib-amd/components/PolarChart/PolarChart.js +11 -0
  200. package/lib-amd/components/PolarChart/PolarChart.js.map +1 -0
  201. package/lib-amd/components/PolarChart/PolarChart.styles.d.ts +2 -0
  202. package/lib-amd/components/PolarChart/PolarChart.styles.js +43 -0
  203. package/lib-amd/components/PolarChart/PolarChart.styles.js.map +1 -0
  204. package/lib-amd/components/PolarChart/PolarChart.types.d.ts +185 -0
  205. package/lib-amd/components/PolarChart/PolarChart.types.js +5 -0
  206. package/lib-amd/components/PolarChart/PolarChart.types.js.map +1 -0
  207. package/lib-amd/components/PolarChart/PolarChart.utils.d.ts +43 -0
  208. package/lib-amd/components/PolarChart/PolarChart.utils.js +183 -0
  209. package/lib-amd/components/PolarChart/PolarChart.utils.js.map +1 -0
  210. package/lib-amd/components/PolarChart/index.d.ts +2 -0
  211. package/lib-amd/components/PolarChart/index.js +7 -0
  212. package/lib-amd/components/PolarChart/index.js.map +1 -0
  213. package/lib-amd/components/SankeyChart/SankeyChart.base.js +10 -4
  214. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  215. package/lib-amd/components/SankeyChart/SankeyChart.styles.js +3 -1
  216. package/lib-amd/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  217. package/lib-amd/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  218. package/lib-amd/components/SankeyChart/SankeyChart.types.js.map +1 -1
  219. package/lib-amd/components/ScatterChart/ScatterChart.base.js +13 -31
  220. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  221. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  222. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
  223. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  224. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +12 -79
  225. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  226. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  227. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +19 -30
  228. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  229. package/lib-amd/index.d.ts +2 -0
  230. package/lib-amd/index.js +3 -2
  231. package/lib-amd/index.js.map +1 -1
  232. package/lib-amd/types/IDataPoint.d.ts +107 -0
  233. package/lib-amd/types/IDataPoint.js.map +1 -1
  234. package/lib-amd/utilities/ChartTitle.d.ts +55 -0
  235. package/lib-amd/utilities/ChartTitle.js +46 -0
  236. package/lib-amd/utilities/ChartTitle.js.map +1 -0
  237. package/lib-amd/utilities/Common.styles.d.ts +51 -0
  238. package/lib-amd/utilities/Common.styles.js +74 -2
  239. package/lib-amd/utilities/Common.styles.js.map +1 -1
  240. package/lib-amd/utilities/image-export-utils.js +3 -3
  241. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  242. package/lib-amd/utilities/index.d.ts +1 -0
  243. package/lib-amd/utilities/index.js +2 -1
  244. package/lib-amd/utilities/index.js.map +1 -1
  245. package/lib-amd/utilities/utilities.d.ts +32 -8
  246. package/lib-amd/utilities/utilities.js +239 -114
  247. package/lib-amd/utilities/utilities.js.map +1 -1
  248. package/lib-commonjs/PolarChart.d.ts +1 -0
  249. package/lib-commonjs/PolarChart.js +5 -0
  250. package/lib-commonjs/PolarChart.js.map +1 -0
  251. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +1 -1
  252. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  253. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +0 -1
  254. package/lib-commonjs/components/AreaChart/AreaChart.base.js +0 -29
  255. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  256. package/lib-commonjs/components/ChartTable/ChartTable.base.js +12 -4
  257. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  258. package/lib-commonjs/components/ChartTable/ChartTable.styles.js +3 -0
  259. package/lib-commonjs/components/ChartTable/ChartTable.styles.js.map +1 -1
  260. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +11 -0
  261. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  262. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +11 -6
  263. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  264. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +1 -0
  265. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +17 -1
  266. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -1
  267. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +5 -0
  268. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  269. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +1 -1
  270. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +81 -41
  271. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  272. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +30 -26
  273. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  274. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +20 -1
  275. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  276. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +23 -27
  277. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  278. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +3 -1
  279. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +392 -269
  280. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  281. package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +1 -0
  282. package/lib-commonjs/components/DonutChart/DonutChart.base.js +15 -3
  283. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  284. package/lib-commonjs/components/DonutChart/DonutChart.styles.js +2 -0
  285. package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
  286. package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +13 -0
  287. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  288. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  289. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  290. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js +14 -8
  291. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
  292. package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js +3 -0
  293. package/lib-commonjs/components/FunnelChart/FunnelChart.styles.js.map +1 -1
  294. package/lib-commonjs/components/FunnelChart/FunnelChart.types.d.ts +13 -0
  295. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  296. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +1 -1
  297. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  298. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js +16 -22
  299. package/lib-commonjs/components/GaugeChart/GaugeChart.styles.js.map +1 -1
  300. package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +9 -0
  301. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  302. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +0 -1
  303. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +4 -16
  304. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  305. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -0
  306. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +54 -4
  307. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  308. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js +12 -1
  309. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.styles.js.map +1 -1
  310. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +9 -0
  311. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  312. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +0 -1
  313. package/lib-commonjs/components/LineChart/LineChart.base.js +1 -25
  314. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  315. package/lib-commonjs/components/PolarChart/PolarChart.base.d.ts +3 -0
  316. package/lib-commonjs/components/PolarChart/PolarChart.base.js +429 -0
  317. package/lib-commonjs/components/PolarChart/PolarChart.base.js.map +1 -0
  318. package/lib-commonjs/components/PolarChart/PolarChart.d.ts +7 -0
  319. package/lib-commonjs/components/PolarChart/PolarChart.js +12 -0
  320. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  321. package/lib-commonjs/components/PolarChart/PolarChart.styles.d.ts +2 -0
  322. package/lib-commonjs/components/PolarChart/PolarChart.styles.js +43 -0
  323. package/lib-commonjs/components/PolarChart/PolarChart.styles.js.map +1 -0
  324. package/lib-commonjs/components/PolarChart/PolarChart.types.d.ts +185 -0
  325. package/lib-commonjs/components/PolarChart/PolarChart.types.js +3 -0
  326. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  327. package/lib-commonjs/components/PolarChart/PolarChart.utils.d.ts +43 -0
  328. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +188 -0
  329. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  330. package/lib-commonjs/components/PolarChart/index.d.ts +2 -0
  331. package/lib-commonjs/components/PolarChart/index.js +6 -0
  332. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  333. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +10 -3
  334. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  335. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js +3 -0
  336. package/lib-commonjs/components/SankeyChart/SankeyChart.styles.js.map +1 -1
  337. package/lib-commonjs/components/SankeyChart/SankeyChart.types.d.ts +18 -0
  338. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  339. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +13 -31
  340. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  341. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +4 -0
  342. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  343. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +0 -1
  344. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +11 -79
  345. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  346. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +0 -1
  347. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +18 -30
  348. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  349. package/lib-commonjs/index.d.ts +2 -0
  350. package/lib-commonjs/index.js +3 -1
  351. package/lib-commonjs/index.js.map +1 -1
  352. package/lib-commonjs/types/IDataPoint.d.ts +107 -0
  353. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  354. package/lib-commonjs/utilities/ChartTitle.d.ts +55 -0
  355. package/lib-commonjs/utilities/ChartTitle.js +49 -0
  356. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  357. package/lib-commonjs/utilities/Common.styles.d.ts +51 -0
  358. package/lib-commonjs/utilities/Common.styles.js +74 -2
  359. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  360. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  361. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  362. package/lib-commonjs/utilities/index.d.ts +1 -0
  363. package/lib-commonjs/utilities/index.js +1 -0
  364. package/lib-commonjs/utilities/index.js.map +1 -1
  365. package/lib-commonjs/utilities/utilities.d.ts +32 -8
  366. package/lib-commonjs/utilities/utilities.js +239 -114
  367. package/lib-commonjs/utilities/utilities.js.map +1 -1
  368. package/package.json +4 -12
  369. package/project.json +0 -1
  370. package/src/components/ChartTable/ChartTable.types.ts +13 -0
  371. package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +5 -0
  372. package/src/components/CommonComponents/CartesianChart.types.ts +22 -1
  373. package/src/components/DonutChart/DonutChart.types.ts +16 -0
  374. package/src/components/FunnelChart/FunnelChart.types.ts +16 -0
  375. package/src/components/GaugeChart/GaugeChart.types.ts +11 -0
  376. package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +11 -0
  377. package/src/components/PolarChart/PolarChart.types.ts +232 -0
  378. package/src/components/SankeyChart/SankeyChart.types.ts +22 -0
  379. package/src/components/ScatterChart/ScatterChart.types.ts +5 -0
@@ -0,0 +1,185 @@
1
+ import * as React from 'react';
2
+ import { IAreaPolarSeries, AxisCategoryOrder, AxisProps, AxisScaleType, IChart, ILinePolarSeries, IMargins, IScatterPolarSeries } from '../../types/IDataPoint';
3
+ import { ILegendsProps } from '../Legends/Legends.types';
4
+ import { ICalloutProps, IStyle, IStyleFunctionOrObject, ITheme } from '@fluentui/react';
5
+ /**
6
+ * Configuration options for a polar axis.
7
+ * {@docCategory PolarChart}
8
+ */
9
+ export type PolarAxisProps = AxisProps & {
10
+ /**
11
+ * Values at which ticks should be placed on the axis.
12
+ */
13
+ tickValues?: number[] | Date[] | string[];
14
+ /**
15
+ * Format string for the axis ticks.
16
+ * For numbers, see: https://d3js.org/d3-format.
17
+ * And for dates see: https://d3js.org/d3-time-format.
18
+ */
19
+ tickFormat?: string;
20
+ /**
21
+ * Number of ticks to display on the axis.
22
+ */
23
+ tickCount?: number;
24
+ /**
25
+ * Defines the order of categories on the axis.
26
+ * @default 'default'
27
+ */
28
+ categoryOrder?: AxisCategoryOrder;
29
+ /**
30
+ * Scale type for the axis.
31
+ * @default 'default'
32
+ */
33
+ scaleType?: AxisScaleType;
34
+ /**
35
+ * Start value of the axis range.
36
+ */
37
+ rangeStart?: number | Date;
38
+ /**
39
+ * End value of the axis range.
40
+ */
41
+ rangeEnd?: number | Date;
42
+ };
43
+ /**
44
+ * Polar Chart properties
45
+ * {@docCategory PolarChart}
46
+ */
47
+ export interface IPolarChartProps {
48
+ /**
49
+ * Data series to be rendered in the polar chart.
50
+ */
51
+ data: (IAreaPolarSeries | ILinePolarSeries | IScatterPolarSeries)[];
52
+ /**
53
+ * Width of the polar chart.
54
+ * @default 200
55
+ */
56
+ width?: number;
57
+ /**
58
+ * Height of the polar chart.
59
+ * @default 200
60
+ */
61
+ height?: number;
62
+ /**
63
+ * Margins around the chart area.
64
+ */
65
+ margins?: IMargins;
66
+ /**
67
+ * If true, hides the legend.
68
+ * @default false
69
+ */
70
+ hideLegend?: boolean;
71
+ /**
72
+ * If true, hides the tooltip.
73
+ * @default false
74
+ */
75
+ hideTooltip?: boolean;
76
+ legendProps?: Partial<ILegendsProps>;
77
+ /**
78
+ * Title of the chart.
79
+ */
80
+ chartTitle?: string;
81
+ /**
82
+ * Fraction of the radius to cut out from the center of the chart.
83
+ * Accepts values in the range [0, 1].
84
+ */
85
+ hole?: number;
86
+ /**
87
+ * Shape of the polar chart.
88
+ * @default 'circle'
89
+ */
90
+ shape?: 'circle' | 'polygon';
91
+ /**
92
+ * Direction in which the chart is drawn.
93
+ * @default 'counterclockwise'
94
+ */
95
+ direction?: 'clockwise' | 'counterclockwise';
96
+ /**
97
+ * Configuration options for the radial axis.
98
+ */
99
+ radialAxis?: PolarAxisProps;
100
+ /**
101
+ * Configuration options for the angular axis.
102
+ */
103
+ angularAxis?: PolarAxisProps & {
104
+ /**
105
+ * Format unit for angular values.
106
+ * @default 'degrees'
107
+ */
108
+ unit?: 'radians' | 'degrees';
109
+ };
110
+ /**
111
+ * Optional callback to access the Chart interface. Use this instead of ref for accessing
112
+ * the public methods and properties of the component.
113
+ */
114
+ componentRef?: React.Ref<IChart>;
115
+ /**
116
+ * Locale identifier string used to format numbers and dates according to the specified culture.
117
+ * Example: 'en-US', 'fr-FR'.
118
+ */
119
+ culture?: string;
120
+ /**
121
+ * Options for localizing date values.
122
+ */
123
+ dateLocalizeOptions?: Intl.DateTimeFormatOptions;
124
+ /**
125
+ * If true, date values are treated as UTC dates.
126
+ * @default false
127
+ */
128
+ useUTC?: boolean;
129
+ /**
130
+ * Theme (provided through customization)
131
+ */
132
+ theme?: ITheme;
133
+ /**
134
+ * Call to provide customized styling that will layer on top of the variant rules
135
+ */
136
+ styles?: IStyleFunctionOrObject<IPolarChartStyleProps, IPolarChartStyles>;
137
+ /**
138
+ * Props for the callout in the chart
139
+ */
140
+ calloutProps?: Partial<ICalloutProps>;
141
+ }
142
+ /**
143
+ * Polar Chart style properties
144
+ * {@docCategory PolarChart}
145
+ */
146
+ export interface IPolarChartStyleProps {
147
+ /**
148
+ * Theme (provided through customization)
149
+ */
150
+ theme: ITheme;
151
+ }
152
+ /**
153
+ * Polar Chart styles
154
+ * {@docCategory PolarChart}
155
+ */
156
+ export interface IPolarChartStyles {
157
+ /**
158
+ * Style for the root element.
159
+ */
160
+ root?: IStyle;
161
+ /**
162
+ * Style for the chart wrapper element.
163
+ */
164
+ chartWrapper?: IStyle;
165
+ /**
166
+ * Style for the chart element.
167
+ */
168
+ chart?: IStyle;
169
+ /**
170
+ * Style for the inner grid lines.
171
+ */
172
+ gridLineInner?: IStyle;
173
+ /**
174
+ * Style for the outer grid lines.
175
+ */
176
+ gridLineOuter?: IStyle;
177
+ /**
178
+ * Style for the tick labels.
179
+ */
180
+ tickLabel?: IStyle;
181
+ /**
182
+ * Style for the legend container.
183
+ */
184
+ legendContainer?: IStyle;
185
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=PolarChart.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolarChart.types.js","sourceRoot":"../src/","sources":["components/PolarChart/PolarChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport {\n IAreaPolarSeries,\n AxisCategoryOrder,\n AxisProps,\n AxisScaleType,\n IChart,\n ILinePolarSeries,\n IMargins,\n IScatterPolarSeries,\n} from '../../types/IDataPoint';\nimport { ILegendsProps } from '../Legends/Legends.types';\nimport { ICalloutProps, IStyle, IStyleFunctionOrObject, ITheme } from '@fluentui/react';\n\n/**\n * Configuration options for a polar axis.\n * {@docCategory PolarChart}\n */\nexport type PolarAxisProps = AxisProps & {\n /**\n * Values at which ticks should be placed on the axis.\n */\n tickValues?: number[] | Date[] | string[];\n\n /**\n * Format string for the axis ticks.\n * For numbers, see: https://d3js.org/d3-format.\n * And for dates see: https://d3js.org/d3-time-format.\n */\n tickFormat?: string;\n\n /**\n * Number of ticks to display on the axis.\n */\n tickCount?: number;\n\n /**\n * Defines the order of categories on the axis.\n * @default 'default'\n */\n categoryOrder?: AxisCategoryOrder;\n\n /**\n * Scale type for the axis.\n * @default 'default'\n */\n scaleType?: AxisScaleType;\n\n /**\n * Start value of the axis range.\n */\n rangeStart?: number | Date;\n\n /**\n * End value of the axis range.\n */\n rangeEnd?: number | Date;\n};\n\n/**\n * Polar Chart properties\n * {@docCategory PolarChart}\n */\nexport interface IPolarChartProps {\n /**\n * Data series to be rendered in the polar chart.\n */\n data: (IAreaPolarSeries | ILinePolarSeries | IScatterPolarSeries)[];\n\n /**\n * Width of the polar chart.\n * @default 200\n */\n width?: number;\n\n /**\n * Height of the polar chart.\n * @default 200\n */\n height?: number;\n\n /**\n * Margins around the chart area.\n */\n margins?: IMargins;\n\n /**\n * If true, hides the legend.\n * @default false\n */\n hideLegend?: boolean;\n\n /**\n * If true, hides the tooltip.\n * @default false\n */\n hideTooltip?: boolean;\n\n /*\n * Properties for customizing the legend.\n */\n legendProps?: Partial<ILegendsProps>;\n\n /**\n * Title of the chart.\n */\n chartTitle?: string;\n\n /**\n * Fraction of the radius to cut out from the center of the chart.\n * Accepts values in the range [0, 1].\n */\n hole?: number;\n\n /**\n * Shape of the polar chart.\n * @default 'circle'\n */\n shape?: 'circle' | 'polygon';\n\n /**\n * Direction in which the chart is drawn.\n * @default 'counterclockwise'\n */\n direction?: 'clockwise' | 'counterclockwise';\n\n /**\n * Configuration options for the radial axis.\n */\n radialAxis?: PolarAxisProps;\n\n /**\n * Configuration options for the angular axis.\n */\n angularAxis?: PolarAxisProps & {\n /**\n * Format unit for angular values.\n * @default 'degrees'\n */\n unit?: 'radians' | 'degrees';\n };\n\n /**\n * Optional callback to access the Chart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.Ref<IChart>;\n\n /**\n * Locale identifier string used to format numbers and dates according to the specified culture.\n * Example: 'en-US', 'fr-FR'.\n */\n culture?: string;\n\n /**\n * Options for localizing date values.\n */\n dateLocalizeOptions?: Intl.DateTimeFormatOptions;\n\n /**\n * If true, date values are treated as UTC dates.\n * @default false\n */\n useUTC?: boolean;\n\n /**\n * Theme (provided through customization)\n */\n theme?: ITheme;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules\n */\n styles?: IStyleFunctionOrObject<IPolarChartStyleProps, IPolarChartStyles>;\n\n /**\n * Props for the callout in the chart\n */\n calloutProps?: Partial<ICalloutProps>;\n}\n\n/**\n * Polar Chart style properties\n * {@docCategory PolarChart}\n */\nexport interface IPolarChartStyleProps {\n /**\n * Theme (provided through customization)\n */\n theme: ITheme;\n}\n\n/**\n * Polar Chart styles\n * {@docCategory PolarChart}\n */\nexport interface IPolarChartStyles {\n /**\n * Style for the root element.\n */\n root?: IStyle;\n\n /**\n * Style for the chart wrapper element.\n */\n chartWrapper?: IStyle;\n\n /**\n * Style for the chart element.\n */\n chart?: IStyle;\n\n /**\n * Style for the inner grid lines.\n */\n gridLineInner?: IStyle;\n\n /**\n * Style for the outer grid lines.\n */\n gridLineOuter?: IStyle;\n\n /**\n * Style for the tick labels.\n */\n tickLabel?: IStyle;\n\n /**\n * Style for the legend container.\n */\n legendContainer?: IStyle;\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import { ScaleBand, ScaleContinuousNumeric, ScaleTime } from 'd3-scale';
2
+ import { AxisScaleType } from '../../types/IDataPoint';
3
+ import { IPolarChartProps } from './PolarChart.types';
4
+ export declare const EPSILON = 0.000001;
5
+ export declare const createRadialScale: (scaleType: string, domain: (string | number | Date)[], range: number[], opts?: {
6
+ useUTC?: boolean;
7
+ tickCount?: number;
8
+ tickValues?: (string | number | Date)[];
9
+ tickText?: string[];
10
+ tickFormat?: string;
11
+ culture?: string;
12
+ tickStep?: number | string;
13
+ tick0?: number | Date;
14
+ dateLocalizeOptions?: Intl.DateTimeFormatOptions;
15
+ }) => {
16
+ scale: ScaleBand<string> | ScaleContinuousNumeric<number, number, undefined> | ScaleTime<number, number>;
17
+ tickValues: (string | number | Date)[];
18
+ tickLabels: string[];
19
+ };
20
+ export declare const getScaleType: (values: (string | number | Date)[], opts?: {
21
+ scaleType?: AxisScaleType;
22
+ supportsLog?: boolean;
23
+ }) => string;
24
+ export declare const getContinuousScaleDomain: (scaleType: string, values: (number | Date)[], opts?: {
25
+ rangeStart?: number | Date;
26
+ rangeEnd?: number | Date;
27
+ }) => (number | Date)[];
28
+ export declare const createAngularScale: (scaleType: string, domain: (string | number | Date)[], opts?: {
29
+ tickCount?: number;
30
+ tickValues?: (string | number | Date)[];
31
+ tickText?: string[];
32
+ tickFormat?: string;
33
+ culture?: string;
34
+ tickStep?: number | string;
35
+ tick0?: number | Date;
36
+ direction?: IPolarChartProps["direction"];
37
+ unit?: NonNullable<IPolarChartProps["angularAxis"]>["unit"];
38
+ }) => {
39
+ scale: (v: string | number) => number;
40
+ tickValues: (string | number)[];
41
+ tickLabels: string[];
42
+ };
43
+ export declare const formatAngle: (value: string | number, unit: NonNullable<IPolarChartProps["angularAxis"]>["unit"]) => string;
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatAngle = exports.createAngularScale = exports.getContinuousScaleDomain = exports.getScaleType = exports.createRadialScale = exports.EPSILON = void 0;
4
+ var d3_scale_1 = require("d3-scale");
5
+ var d3_array_1 = require("d3-array");
6
+ var d3_format_1 = require("d3-format");
7
+ var utilities_1 = require("../../utilities/utilities");
8
+ var chart_utilities_1 = require("@fluentui/chart-utilities");
9
+ var d3_time_format_1 = require("d3-time-format");
10
+ var react_1 = require("@fluentui/react");
11
+ exports.EPSILON = 1e-6;
12
+ var createRadialScale = function (scaleType, domain, range, opts) {
13
+ var _a, _b;
14
+ if (opts === void 0) { opts = {}; }
15
+ if (scaleType === 'category') {
16
+ var scale_1 = (0, d3_scale_1.scaleBand)()
17
+ .domain(domain)
18
+ .range(range)
19
+ .paddingInner(1);
20
+ var tickValues_1 = Array.isArray(opts.tickValues) ? opts.tickValues : domain;
21
+ var tickFormat_1 = function (domainValue, index) {
22
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !(0, chart_utilities_1.isInvalidValue)(opts.tickText[index])) {
23
+ return opts.tickText[index];
24
+ }
25
+ return domainValue;
26
+ };
27
+ return { scale: scale_1, tickValues: tickValues_1, tickLabels: tickValues_1.map(tickFormat_1) };
28
+ }
29
+ var scale;
30
+ if (scaleType === 'date') {
31
+ scale = opts.useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
32
+ }
33
+ else {
34
+ scale = scaleType === 'log' ? (0, d3_scale_1.scaleLog)() : (0, d3_scale_1.scaleLinear)();
35
+ }
36
+ scale.domain(domain);
37
+ scale.range(range);
38
+ scale.nice();
39
+ var tickCount = (_a = opts.tickCount) !== null && _a !== void 0 ? _a : 4;
40
+ var tickFormat;
41
+ var customTickValues = Array.isArray(opts.tickValues) ? opts.tickValues : undefined;
42
+ if (scaleType === 'date') {
43
+ var lowestFormatLevel_1 = 100;
44
+ var highestFormatLevel_1 = -1;
45
+ scale.ticks().forEach(function (domainValue) {
46
+ var formatLevel = (0, utilities_1.getDateFormatLevel)(domainValue, opts.useUTC);
47
+ if (formatLevel > highestFormatLevel_1) {
48
+ highestFormatLevel_1 = formatLevel;
49
+ }
50
+ if (formatLevel < lowestFormatLevel_1) {
51
+ lowestFormatLevel_1 = formatLevel;
52
+ }
53
+ });
54
+ var formatOptions_1 = (_b = opts.dateLocalizeOptions) !== null && _b !== void 0 ? _b : (0, chart_utilities_1.getMultiLevelDateTimeFormatOptions)(lowestFormatLevel_1, highestFormatLevel_1);
55
+ tickFormat = function (domainValue, index) {
56
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !(0, chart_utilities_1.isInvalidValue)(opts.tickText[index])) {
57
+ return opts.tickText[index];
58
+ }
59
+ if ((0, chart_utilities_1.isInvalidValue)(opts.culture) && typeof opts.tickFormat === 'string') {
60
+ if (opts.useUTC) {
61
+ return (0, d3_time_format_1.utcFormat)(opts.tickFormat)(domainValue);
62
+ }
63
+ else {
64
+ return (0, d3_time_format_1.timeFormat)(opts.tickFormat)(domainValue);
65
+ }
66
+ }
67
+ return (0, chart_utilities_1.formatDateToLocaleString)(domainValue, opts.culture, opts.useUTC, false, formatOptions_1);
68
+ };
69
+ if (opts.tickStep) {
70
+ customTickValues = (0, utilities_1.generateDateTicks)(opts.tickStep, opts.tick0, scale.domain(), opts.useUTC);
71
+ }
72
+ }
73
+ else {
74
+ var defaultTickFormat_1 = scale.tickFormat(tickCount);
75
+ tickFormat = function (domainValue, index) {
76
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !(0, chart_utilities_1.isInvalidValue)(opts.tickText[index])) {
77
+ return opts.tickText[index];
78
+ }
79
+ if (typeof opts.tickFormat === 'string') {
80
+ return (0, d3_format_1.format)(opts.tickFormat)(domainValue);
81
+ }
82
+ var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
83
+ return defaultTickFormat_1(value) === '' ? '' : (0, chart_utilities_1.formatToLocaleString)(value, opts.culture);
84
+ };
85
+ if (opts.tickStep) {
86
+ customTickValues = (0, utilities_1.generateNumericTicks)(scaleType, opts.tickStep, opts.tick0, scale.domain());
87
+ }
88
+ }
89
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : scale.ticks(tickCount);
90
+ return { scale: scale, tickValues: tickValues, tickLabels: tickValues.map(tickFormat) };
91
+ };
92
+ exports.createRadialScale = createRadialScale;
93
+ var getScaleType = function (values, opts) {
94
+ if (opts === void 0) { opts = {}; }
95
+ var scaleType = 'category';
96
+ if (typeof values[0] === 'number') {
97
+ if (opts.supportsLog && opts.scaleType === 'log') {
98
+ scaleType = 'log';
99
+ }
100
+ else {
101
+ scaleType = 'linear';
102
+ }
103
+ }
104
+ else if (values[0] instanceof Date) {
105
+ scaleType = 'date';
106
+ }
107
+ return scaleType;
108
+ };
109
+ exports.getScaleType = getScaleType;
110
+ var getContinuousScaleDomain = function (scaleType, values, opts) {
111
+ var _a;
112
+ if (opts === void 0) { opts = {}; }
113
+ var _b = (0, d3_array_1.extent)(values.filter(function (v) { return (0, utilities_1.isValidDomainValue)(v, scaleType); })), min = _b[0], max = _b[1];
114
+ if (scaleType === 'linear') {
115
+ _a = (0, d3_array_1.extent)([min, max, 0]), min = _a[0], max = _a[1];
116
+ }
117
+ if (!(0, chart_utilities_1.isInvalidValue)(opts.rangeStart)) {
118
+ min = opts.rangeStart;
119
+ }
120
+ if (!(0, chart_utilities_1.isInvalidValue)(opts.rangeEnd)) {
121
+ max = opts.rangeEnd;
122
+ }
123
+ if ((0, chart_utilities_1.isInvalidValue)(min) || (0, chart_utilities_1.isInvalidValue)(max)) {
124
+ return [];
125
+ }
126
+ return [min, max];
127
+ };
128
+ exports.getContinuousScaleDomain = getContinuousScaleDomain;
129
+ var degToRad = function (deg) { return (deg * Math.PI) / 180; };
130
+ var radToDeg = function (rad) { return (rad * 180) / Math.PI; };
131
+ var normalizeAngle = function (deg, direction) {
132
+ return (((direction === 'clockwise' ? deg : 450 - deg) % 360) + 360) % 360;
133
+ };
134
+ var createAngularScale = function (scaleType, domain, opts) {
135
+ var _a, _b;
136
+ if (opts === void 0) { opts = {}; }
137
+ if (scaleType === 'category') {
138
+ var categoryIndexMap_1 = {};
139
+ domain.forEach(function (d, i) {
140
+ categoryIndexMap_1[d] = i;
141
+ });
142
+ var period_1 = 360 / domain.length;
143
+ var tickValues_2 = Array.isArray(opts.tickValues) ? opts.tickValues : domain;
144
+ var tickFormat_2 = function (domainValue, index) {
145
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !(0, chart_utilities_1.isInvalidValue)(opts.tickText[index])) {
146
+ return opts.tickText[index];
147
+ }
148
+ return domainValue;
149
+ };
150
+ return {
151
+ scale: function (v) { return degToRad(normalizeAngle(categoryIndexMap_1[v] * period_1, opts.direction)); },
152
+ tickValues: tickValues_2,
153
+ tickLabels: tickValues_2.map(tickFormat_2),
154
+ };
155
+ }
156
+ var customTickValues = Array.isArray(opts.tickValues) ? opts.tickValues : undefined;
157
+ var tickFormat = function (domainValue, index) {
158
+ if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !(0, chart_utilities_1.isInvalidValue)(opts.tickText[index])) {
159
+ return opts.tickText[index];
160
+ }
161
+ if (typeof opts.tickFormat === 'string') {
162
+ return (0, d3_format_1.format)(opts.tickFormat)(domainValue);
163
+ }
164
+ return (0, exports.formatAngle)(domainValue, opts.unit);
165
+ };
166
+ if (opts.tickStep) {
167
+ customTickValues = (_a = (0, utilities_1.generateNumericTicks)(scaleType, opts.tickStep, opts.tick0, [
168
+ 0,
169
+ (opts.unit === 'radians' ? 2 * Math.PI : 360) - exports.EPSILON,
170
+ ])) === null || _a === void 0 ? void 0 : _a.map(function (v) { return (opts.unit === 'radians' ? radToDeg(v) : v); });
171
+ }
172
+ var tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : (0, d3_array_1.range)(0, 360, 360 / ((_b = opts.tickCount) !== null && _b !== void 0 ? _b : 8));
173
+ return {
174
+ scale: function (v) { return degToRad(normalizeAngle(v, opts.direction)); },
175
+ tickValues: tickValues,
176
+ tickLabels: tickValues.map(tickFormat),
177
+ };
178
+ };
179
+ exports.createAngularScale = createAngularScale;
180
+ var formatAngle = function (value, unit) {
181
+ return typeof value === 'string'
182
+ ? value
183
+ : unit === 'radians'
184
+ ? "".concat((0, react_1.precisionRound)(value / 180, 6), "\u03C0")
185
+ : "".concat((0, react_1.precisionRound)(value, 6), "\u00B0");
186
+ };
187
+ exports.formatAngle = formatAngle;
188
+ //# sourceMappingURL=PolarChart.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolarChart.utils.js","sourceRoot":"../src/","sources":["components/PolarChart/PolarChart.utils.ts"],"names":[],"mappings":";;;AAAA,qCAUkB;AAClB,qCAAgE;AAChE,uCAA+C;AAE/C,uDAKmC;AACnC,6DAKmC;AACnC,iDAAsF;AAEtF,yCAAiD;AAEpC,QAAA,OAAO,GAAG,IAAI,CAAC;AAErB,IAAM,iBAAiB,GAAG,UAC/B,SAAiB,EACjB,MAAkC,EAClC,KAAe,EACf,IAUM;;IAVN,qBAAA,EAAA,SAUM;IAMN,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;QAC7B,IAAM,OAAK,GAAG,IAAA,oBAAW,GAAE;aACxB,MAAM,CAAC,MAAkB,CAAC;aAC1B,KAAK,CAAC,KAAK,CAAC;aACZ,YAAY,CAAC,CAAC,CAAC,CAAC;QACnB,IAAM,YAAU,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC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,MAAA,IAAI,CAAC,SAAS,mCAAI,CAAC,CAAC,CAAC,CAAC;IAEpF,OAAO;QACL,KAAK,EAAE,UAAC,CAAS,IAAK,OAAA,QAAQ,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAA3C,CAA2C;QACjE,UAAU,YAAA;QACV,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC;KACvC,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,kBAAkB,sBA0D7B;AAEK,IAAM,WAAW,GAAG,UACzB,KAAsB,EACtB,IAA0D;IAE1D,OAAA,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,IAAI,KAAK,SAAS;YACpB,CAAC,CAAC,UAAG,IAAA,sBAAc,EAAC,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC,WAAG;YACtC,CAAC,CAAC,UAAG,IAAA,sBAAc,EAAC,KAAK,EAAE,CAAC,CAAC,WAAG;AAJlC,CAIkC,CAAC;AARxB,QAAA,WAAW,eAQa","sourcesContent":["import {\n scaleBand as d3ScaleBand,\n scaleLinear as d3ScaleLinear,\n scaleLog as d3ScaleLog,\n scaleTime as d3ScaleTime,\n scaleUtc as d3ScaleUtc,\n NumberValue,\n ScaleBand,\n ScaleContinuousNumeric,\n ScaleTime,\n} from 'd3-scale';\nimport { extent as d3Extent, range as d3Range } from 'd3-array';\nimport { format as d3Format } from 'd3-format';\nimport { AxisScaleType } from '../../types/IDataPoint';\nimport {\n generateDateTicks,\n generateNumericTicks,\n getDateFormatLevel,\n isValidDomainValue,\n} from '../../utilities/utilities';\nimport {\n isInvalidValue,\n formatToLocaleString,\n getMultiLevelDateTimeFormatOptions,\n formatDateToLocaleString,\n} from '@fluentui/chart-utilities';\nimport { timeFormat as d3TimeFormat, utcFormat as d3UtcFormat } from 'd3-time-format';\nimport { IPolarChartProps } from './PolarChart.types';\nimport { precisionRound } from '@fluentui/react';\n\nexport const EPSILON = 1e-6;\n\nexport const createRadialScale = (\n scaleType: string,\n domain: (string | number | Date)[],\n range: number[],\n opts: {\n useUTC?: boolean;\n tickCount?: number;\n tickValues?: (string | number | Date)[];\n tickText?: string[];\n tickFormat?: string;\n culture?: string;\n tickStep?: number | string;\n tick0?: number | Date;\n dateLocalizeOptions?: Intl.DateTimeFormatOptions;\n } = {},\n): {\n scale: ScaleBand<string> | ScaleContinuousNumeric<number, number, undefined> | ScaleTime<number, number>;\n tickValues: (string | number | Date)[];\n tickLabels: string[];\n} => {\n if (scaleType === 'category') {\n const scale = d3ScaleBand()\n .domain(domain as string[])\n .range(range)\n .paddingInner(1);\n const tickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as string[]) : (domain as string[]);\n const tickFormat = (domainValue: string, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n return domainValue;\n };\n return { scale, tickValues, tickLabels: tickValues.map(tickFormat) };\n }\n\n let scale: ScaleContinuousNumeric<number, number, undefined> | ScaleTime<number, number>;\n if (scaleType === 'date') {\n scale = opts.useUTC ? d3ScaleUtc() : d3ScaleTime();\n } else {\n scale = scaleType === 'log' ? d3ScaleLog() : d3ScaleLinear();\n }\n\n scale.domain(domain as (number | Date)[]);\n scale.range(range);\n scale.nice();\n\n const tickCount = opts.tickCount ?? 4;\n let tickFormat;\n let customTickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as (number | Date)[]) : undefined;\n if (scaleType === 'date') {\n let lowestFormatLevel = 100;\n let highestFormatLevel = -1;\n\n (scale as ScaleTime<number, number>).ticks().forEach((domainValue: Date) => {\n const formatLevel = getDateFormatLevel(domainValue, opts.useUTC);\n if (formatLevel > highestFormatLevel) {\n highestFormatLevel = formatLevel;\n }\n if (formatLevel < lowestFormatLevel) {\n lowestFormatLevel = formatLevel;\n }\n });\n const formatOptions =\n opts.dateLocalizeOptions ?? getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);\n tickFormat = (domainValue: Date, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n if (isInvalidValue(opts.culture) && typeof opts.tickFormat === 'string') {\n if (opts.useUTC) {\n return d3UtcFormat(opts.tickFormat)(domainValue);\n } else {\n return d3TimeFormat(opts.tickFormat)(domainValue);\n }\n }\n return formatDateToLocaleString(domainValue, opts.culture, opts.useUTC, false, formatOptions);\n };\n if (opts.tickStep) {\n customTickValues = generateDateTicks(opts.tickStep, opts.tick0, scale.domain() as Date[], opts.useUTC);\n }\n } else {\n const defaultTickFormat = (scale as ScaleContinuousNumeric<number, number>).tickFormat(tickCount);\n tickFormat = (domainValue: NumberValue, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n if (typeof opts.tickFormat === 'string') {\n return d3Format(opts.tickFormat)(domainValue);\n }\n const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();\n return defaultTickFormat(value) === '' ? '' : (formatToLocaleString(value, opts.culture) as string);\n };\n if (opts.tickStep) {\n customTickValues = generateNumericTicks(\n scaleType as AxisScaleType,\n opts.tickStep,\n opts.tick0,\n scale.domain() as number[],\n );\n }\n }\n const tickValues = customTickValues ?? scale.ticks(tickCount);\n\n return { scale, tickValues, tickLabels: tickValues.map(tickFormat) };\n};\n\nexport const getScaleType = (\n values: (string | number | Date)[],\n opts: {\n scaleType?: AxisScaleType;\n supportsLog?: boolean;\n } = {},\n): string => {\n let scaleType = 'category';\n if (typeof values[0] === 'number') {\n if (opts.supportsLog && opts.scaleType === 'log') {\n scaleType = 'log';\n } else {\n scaleType = 'linear';\n }\n } else if (values[0] instanceof Date) {\n scaleType = 'date';\n }\n return scaleType;\n};\n\nexport const getContinuousScaleDomain = (\n scaleType: string,\n values: (number | Date)[],\n opts: {\n rangeStart?: number | Date;\n rangeEnd?: number | Date;\n } = {},\n): (number | Date)[] => {\n let [min, max] = d3Extent(values.filter(v => isValidDomainValue(v, scaleType as AxisScaleType)) as (number | Date)[]);\n if (scaleType === 'linear') {\n [min, max] = d3Extent([min, max, 0] as number[]);\n }\n if (!isInvalidValue(opts.rangeStart)) {\n min = opts.rangeStart;\n }\n if (!isInvalidValue(opts.rangeEnd)) {\n max = opts.rangeEnd;\n }\n\n if (isInvalidValue(min) || isInvalidValue(max)) {\n return [];\n }\n return [min!, max!];\n};\n\nconst degToRad = (deg: number) => (deg * Math.PI) / 180;\n\nconst radToDeg = (rad: number) => (rad * 180) / Math.PI;\n\nconst normalizeAngle = (deg: number, direction: IPolarChartProps['direction']) =>\n (((direction === 'clockwise' ? deg : 450 - deg) % 360) + 360) % 360;\n\nexport const createAngularScale = (\n scaleType: string,\n domain: (string | number | Date)[],\n opts: {\n tickCount?: number;\n tickValues?: (string | number | Date)[];\n tickText?: string[];\n tickFormat?: string;\n culture?: string;\n tickStep?: number | string;\n tick0?: number | Date;\n direction?: IPolarChartProps['direction'];\n unit?: NonNullable<IPolarChartProps['angularAxis']>['unit'];\n } = {},\n): { scale: (v: string | number) => number; tickValues: (string | number)[]; tickLabels: string[] } => {\n if (scaleType === 'category') {\n const categoryIndexMap: Record<string, number> = {};\n (domain as string[]).forEach((d, i) => {\n categoryIndexMap[d] = i;\n });\n const period = 360 / domain.length;\n const tickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as string[]) : (domain as string[]);\n const tickFormat = (domainValue: string, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n return domainValue;\n };\n return {\n scale: (v: string) => degToRad(normalizeAngle(categoryIndexMap[v] * period, opts.direction)),\n tickValues,\n tickLabels: tickValues.map(tickFormat),\n };\n }\n\n let customTickValues = Array.isArray(opts.tickValues) ? (opts.tickValues as number[]) : undefined;\n const tickFormat = (domainValue: number, index: number) => {\n if (Array.isArray(opts.tickValues) && Array.isArray(opts.tickText) && !isInvalidValue(opts.tickText[index])) {\n return opts.tickText[index];\n }\n if (typeof opts.tickFormat === 'string') {\n return d3Format(opts.tickFormat)(domainValue);\n }\n return formatAngle(domainValue, opts.unit);\n };\n if (opts.tickStep) {\n customTickValues = generateNumericTicks(scaleType as AxisScaleType, opts.tickStep, opts.tick0, [\n 0,\n (opts.unit === 'radians' ? 2 * Math.PI : 360) - EPSILON,\n ])?.map(v => (opts.unit === 'radians' ? radToDeg(v) : v));\n }\n const tickValues = customTickValues ?? d3Range(0, 360, 360 / (opts.tickCount ?? 8));\n\n return {\n scale: (v: number) => degToRad(normalizeAngle(v, opts.direction)),\n tickValues,\n tickLabels: tickValues.map(tickFormat),\n };\n};\n\nexport const formatAngle = (\n value: string | number,\n unit: NonNullable<IPolarChartProps['angularAxis']>['unit'],\n): string =>\n typeof value === 'string'\n ? value\n : unit === 'radians'\n ? `${precisionRound(value / 180, 6)}π`\n : `${precisionRound(value, 6)}°`;\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './PolarChart';
2
+ export * from './PolarChart.types';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./PolarChart"), exports);
5
+ tslib_1.__exportStar(require("./PolarChart.types"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PolarChart/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,6DAAmC","sourcesContent":["export * from './PolarChart';\nexport * from './PolarChart.types';\n"]}
@@ -14,6 +14,7 @@ var d3_selection_1 = require("d3-selection");
14
14
  var d3_shape_1 = require("d3-shape");
15
15
  var React = require("react");
16
16
  var ChartHoverCard_1 = require("../../utilities/ChartHoverCard/ChartHoverCard");
17
+ var index_1 = require("../../utilities/index");
17
18
  var image_export_utils_1 = require("../../utilities/image-export-utils");
18
19
  var getClassNames = (0, Utilities_1.classNamesFunction)();
19
20
  var PADDING_PERCENTAGE = 0.3;
@@ -409,6 +410,7 @@ function nodeTextColor(state, singleNode) {
409
410
  var SankeyChartBase = /** @class */ (function (_super) {
410
411
  tslib_1.__extends(SankeyChartBase, _super);
411
412
  function SankeyChartBase(props) {
413
+ var _a, _b, _c;
412
414
  var _this = _super.call(this, props) || this;
413
415
  _this._isRtl = (0, Utilities_1.getRTL)();
414
416
  _this._numColumns = 0;
@@ -476,7 +478,11 @@ var SankeyChartBase = /** @class */ (function (_super) {
476
478
  _this._chartId = (0, Utilities_1.getId)('sankeyChart');
477
479
  _this._emptyChartId = (0, Utilities_1.getId)('_SankeyChart_empty');
478
480
  _this._labelTooltipId = (0, Utilities_1.getId)('tooltip');
479
- _this._margins = { top: 36, right: 48, bottom: 32, left: 48 };
481
+ var titleHeight = ((_a = props.data) === null || _a === void 0 ? void 0 : _a.chartTitle)
482
+ ? Math.max((typeof ((_c = (_b = props.titleStyles) === null || _b === void 0 ? void 0 : _b.titleFont) === null || _c === void 0 ? void 0 : _c.size) === 'number' ? props.titleStyles.titleFont.size : 13) +
483
+ index_1.CHART_TITLE_PADDING, 36)
484
+ : 36;
485
+ _this._margins = { top: titleHeight, right: 48, bottom: 32, left: 48 };
480
486
  // We memo-ize creation so that we only create a new object when any of the fields change.
481
487
  _this._computeClassNamesProps = (0, Utilities_1.memoizeFunction)(function (theme, pathColor, className, containerWidth, containerHeight, enableReflow) { return ({
482
488
  theme: theme,
@@ -608,6 +614,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
608
614
  }, onMouseLeave: this._onCloseCallout },
609
615
  React.createElement(react_focus_1.FocusZone, { direction: react_focus_1.FocusZoneDirection.vertical, className: classNames_1.chartWrapper },
610
616
  React.createElement("svg", { width: width, height: height, id: this._chartId, className: classNames_1.chart },
617
+ !this.props.hideLegend && this.props.data.chartTitle && (React.createElement(index_1.ChartTitle, { title: this.props.data.chartTitle, x: width / 2, maxWidth: width - 20, className: classNames_1.chartTitle, titleStyles: this.props.titleStyles, tooltipClassName: classNames_1.svgTooltip })),
611
618
  nodeLinkDomOrderArray_1.map(function (item) {
612
619
  if (item.type === 'node') {
613
620
  return (React.createElement("g", { key: nodes_1[item.index].nodeId, className: classNames_1.nodes }, nodeData_1[item.index]));
@@ -841,7 +848,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
841
848
  var state = this.state;
842
849
  if (state.selectedState && state.selectedLinks.has(singleLink.index)) {
843
850
  var selectedNode = state.selectedNode;
844
- return selectedNode ? selectedNode.color : gradientUrl;
851
+ return singleLink ? singleLink.color : selectedNode ? selectedNode.color : gradientUrl;
845
852
  }
846
853
  };
847
854
  SankeyChartBase.prototype._fillStreamBorder = function (singleLink, gradientUrl) {
@@ -902,7 +909,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
902
909
  //Fixing tooltip position by attaching it to the element rather than page
903
910
  div.style('opacity', 0.9).style('color', this.props.theme.palette.neutralPrimary);
904
911
  div
905
- .html(text)
912
+ .text(text)
906
913
  .style('left', evt.pageX + 'px')
907
914
  .style('top', evt.pageY - 28 + 'px');
908
915
  }