@fluentui/react-charting 5.24.38 → 5.25.0

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 (264) hide show
  1. package/CHANGELOG.json +99 -1
  2. package/CHANGELOG.md +34 -2
  3. package/dist/react-charting.d.ts +129 -1
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +76 -1
  7. package/lib/components/AreaChart/AreaChart.base.d.ts +2 -1
  8. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.base.d.ts +2 -1
  10. package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
  11. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  12. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +343 -0
  13. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  15. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +111 -0
  16. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  17. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  18. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +2 -0
  19. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  20. package/lib/components/CommonComponents/CartesianChart.base.d.ts +2 -1
  21. package/lib/components/CommonComponents/CartesianChart.base.js +38 -46
  22. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  23. package/lib/components/CommonComponents/CartesianChart.styles.js +9 -1
  24. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  25. package/lib/components/CommonComponents/CartesianChart.types.d.ts +19 -2
  26. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  27. package/lib/components/CommonComponents/index.d.ts +2 -0
  28. package/lib/components/CommonComponents/index.js +2 -0
  29. package/lib/components/CommonComponents/index.js.map +1 -1
  30. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  31. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  32. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib/components/DonutChart/Arc/Arc.d.ts +2 -1
  35. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  36. package/lib/components/DonutChart/DonutChart.base.d.ts +2 -1
  37. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  38. package/lib/components/DonutChart/Pie/Pie.d.ts +3 -2
  39. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  40. package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
  41. package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
  42. package/lib/components/GanttChart/GanttChart.base.js.map +1 -1
  43. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  44. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  45. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  46. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
  47. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  48. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
  49. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  50. package/lib/components/Legends/Legends.base.d.ts +2 -1
  51. package/lib/components/Legends/Legends.base.js.map +1 -1
  52. package/lib/components/LineChart/LineChart.base.d.ts +2 -1
  53. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  54. package/lib/components/PieChart/Arc/Arc.d.ts +3 -2
  55. package/lib/components/PieChart/Arc/Arc.js.map +1 -1
  56. package/lib/components/PieChart/Pie/Pie.d.ts +3 -2
  57. package/lib/components/PieChart/Pie/Pie.js.map +1 -1
  58. package/lib/components/PieChart/PieChart.base.d.ts +2 -1
  59. package/lib/components/PieChart/PieChart.base.js.map +1 -1
  60. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  61. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  62. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  63. package/lib/components/Sparkline/Sparkline.base.d.ts +3 -2
  64. package/lib/components/Sparkline/Sparkline.base.js.map +1 -1
  65. package/lib/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
  66. package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  67. package/lib/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
  68. package/lib/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  69. package/lib/components/TreeChart/TreeChart.base.d.ts +2 -1
  70. package/lib/components/TreeChart/TreeChart.base.js.map +1 -1
  71. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
  72. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  73. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  74. package/lib/index.d.ts +1 -1
  75. package/lib/index.js.map +1 -1
  76. package/lib/types/IChartAnnotation.d.ts +99 -0
  77. package/lib/types/IChartAnnotation.js +2 -0
  78. package/lib/types/IChartAnnotation.js.map +1 -0
  79. package/lib/types/IDataPoint.d.ts +4 -0
  80. package/lib/types/IDataPoint.js.map +1 -1
  81. package/lib/types/index.d.ts +1 -0
  82. package/lib/types/index.js +1 -0
  83. package/lib/types/index.js.map +1 -1
  84. package/lib/utilities/image-export-utils.js +55 -0
  85. package/lib/utilities/image-export-utils.js.map +1 -1
  86. package/lib/utilities/scatterpolar-utils.d.ts +2 -2
  87. package/lib/utilities/scatterpolar-utils.js.map +1 -1
  88. package/lib/utilities/utilities.d.ts +14 -14
  89. package/lib/utilities/utilities.js +72 -20
  90. package/lib/utilities/utilities.js.map +1 -1
  91. package/lib/utilities/vbc-utils.js.map +1 -1
  92. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +2 -1
  93. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  94. package/lib-amd/components/ChartTable/ChartTable.base.d.ts +2 -1
  95. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  96. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  97. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +344 -0
  98. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  99. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  100. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +119 -0
  101. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  102. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  103. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +5 -0
  104. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  105. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +2 -1
  106. package/lib-amd/components/CommonComponents/CartesianChart.base.js +38 -47
  107. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  108. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +9 -1
  109. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  110. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +19 -2
  111. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  112. package/lib-amd/components/CommonComponents/index.d.ts +2 -0
  113. package/lib-amd/components/CommonComponents/index.js +3 -1
  114. package/lib-amd/components/CommonComponents/index.js.map +1 -1
  115. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  116. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  117. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  118. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  119. package/lib-amd/components/DonutChart/Arc/Arc.d.ts +2 -1
  120. package/lib-amd/components/DonutChart/Arc/Arc.js.map +1 -1
  121. package/lib-amd/components/DonutChart/DonutChart.base.d.ts +2 -1
  122. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  123. package/lib-amd/components/DonutChart/Pie/Pie.d.ts +3 -2
  124. package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
  125. package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
  126. package/lib-amd/components/FunnelChart/funnelGeometry.js.map +1 -1
  127. package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -1
  128. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  129. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  130. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  131. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
  132. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  133. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
  134. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  135. package/lib-amd/components/Legends/Legends.base.d.ts +2 -1
  136. package/lib-amd/components/Legends/Legends.base.js.map +1 -1
  137. package/lib-amd/components/LineChart/LineChart.base.d.ts +2 -1
  138. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  139. package/lib-amd/components/PieChart/Arc/Arc.d.ts +3 -2
  140. package/lib-amd/components/PieChart/Arc/Arc.js.map +1 -1
  141. package/lib-amd/components/PieChart/Pie/Pie.d.ts +3 -2
  142. package/lib-amd/components/PieChart/Pie/Pie.js.map +1 -1
  143. package/lib-amd/components/PieChart/PieChart.base.d.ts +2 -1
  144. package/lib-amd/components/PieChart/PieChart.base.js.map +1 -1
  145. package/lib-amd/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  146. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  147. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  148. package/lib-amd/components/Sparkline/Sparkline.base.d.ts +3 -2
  149. package/lib-amd/components/Sparkline/Sparkline.base.js.map +1 -1
  150. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
  151. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  152. package/lib-amd/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
  153. package/lib-amd/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  154. package/lib-amd/components/TreeChart/TreeChart.base.d.ts +2 -1
  155. package/lib-amd/components/TreeChart/TreeChart.base.js.map +1 -1
  156. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
  157. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  158. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  159. package/lib-amd/index.d.ts +1 -1
  160. package/lib-amd/index.js.map +1 -1
  161. package/lib-amd/types/IChartAnnotation.d.ts +99 -0
  162. package/lib-amd/types/IChartAnnotation.js +5 -0
  163. package/lib-amd/types/IChartAnnotation.js.map +1 -0
  164. package/lib-amd/types/IDataPoint.d.ts +4 -0
  165. package/lib-amd/types/IDataPoint.js.map +1 -1
  166. package/lib-amd/types/index.d.ts +1 -0
  167. package/lib-amd/types/index.js +2 -1
  168. package/lib-amd/types/index.js.map +1 -1
  169. package/lib-amd/utilities/image-export-utils.js +55 -0
  170. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  171. package/lib-amd/utilities/scatterpolar-utils.d.ts +2 -2
  172. package/lib-amd/utilities/scatterpolar-utils.js.map +1 -1
  173. package/lib-amd/utilities/utilities.d.ts +14 -14
  174. package/lib-amd/utilities/utilities.js +72 -20
  175. package/lib-amd/utilities/utilities.js.map +1 -1
  176. package/lib-amd/utilities/vbc-utils.js.map +1 -1
  177. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +2 -1
  178. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  179. package/lib-commonjs/components/ChartTable/ChartTable.base.d.ts +2 -1
  180. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  181. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
  182. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +346 -0
  183. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
  184. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
  185. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +118 -0
  186. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
  187. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
  188. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +3 -0
  189. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
  190. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +2 -1
  191. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +38 -46
  192. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  193. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +9 -1
  194. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  195. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +19 -2
  196. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  197. package/lib-commonjs/components/CommonComponents/index.d.ts +2 -0
  198. package/lib-commonjs/components/CommonComponents/index.js +2 -0
  199. package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
  200. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  201. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  202. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
  203. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  204. package/lib-commonjs/components/DonutChart/Arc/Arc.d.ts +2 -1
  205. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  206. package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +2 -1
  207. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  208. package/lib-commonjs/components/DonutChart/Pie/Pie.d.ts +3 -2
  209. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  210. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
  211. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
  212. package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -1
  213. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  214. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  215. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  216. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
  217. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  218. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
  219. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  220. package/lib-commonjs/components/Legends/Legends.base.d.ts +2 -1
  221. package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
  222. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +2 -1
  223. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  224. package/lib-commonjs/components/PieChart/Arc/Arc.d.ts +3 -2
  225. package/lib-commonjs/components/PieChart/Arc/Arc.js.map +1 -1
  226. package/lib-commonjs/components/PieChart/Pie/Pie.d.ts +3 -2
  227. package/lib-commonjs/components/PieChart/Pie/Pie.js.map +1 -1
  228. package/lib-commonjs/components/PieChart/PieChart.base.d.ts +2 -1
  229. package/lib-commonjs/components/PieChart/PieChart.base.js.map +1 -1
  230. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  231. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  232. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  233. package/lib-commonjs/components/Sparkline/Sparkline.base.d.ts +3 -2
  234. package/lib-commonjs/components/Sparkline/Sparkline.base.js.map +1 -1
  235. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
  236. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  237. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
  238. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  239. package/lib-commonjs/components/TreeChart/TreeChart.base.d.ts +2 -1
  240. package/lib-commonjs/components/TreeChart/TreeChart.base.js.map +1 -1
  241. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
  242. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  243. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  244. package/lib-commonjs/index.d.ts +1 -1
  245. package/lib-commonjs/index.js.map +1 -1
  246. package/lib-commonjs/types/IChartAnnotation.d.ts +99 -0
  247. package/lib-commonjs/types/IChartAnnotation.js +3 -0
  248. package/lib-commonjs/types/IChartAnnotation.js.map +1 -0
  249. package/lib-commonjs/types/IDataPoint.d.ts +4 -0
  250. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  251. package/lib-commonjs/types/index.d.ts +1 -0
  252. package/lib-commonjs/types/index.js +1 -0
  253. package/lib-commonjs/types/index.js.map +1 -1
  254. package/lib-commonjs/utilities/image-export-utils.js +55 -0
  255. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  256. package/lib-commonjs/utilities/scatterpolar-utils.d.ts +2 -2
  257. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
  258. package/lib-commonjs/utilities/utilities.d.ts +14 -14
  259. package/lib-commonjs/utilities/utilities.js +72 -20
  260. package/lib-commonjs/utilities/utilities.js.map +1 -1
  261. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  262. package/package.json +9 -9
  263. package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +58 -0
  264. package/src/components/CommonComponents/CartesianChart.types.ts +23 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChartTable.base.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.base.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEnG,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,SAAS,cAAc,CAAC,GAAW,EAAE,KAAa;IAChD,IAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QAC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gCACJ,CAAC,CAAC,CACC,CACC;4BACP,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1B,mCACG,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,EAAE,MAAM,IAAK,OAAA,CACzB,4BAAI,GAAG,EAAE,MAAM,IACZ,GAAG,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,MAAM;gCACpB,IAAM,KAAK,gBAAQ,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAE,CAAC;gCACjC,IAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC;gCACvB,IAAM,EAAE,GAAG,KAAK,CAAC,eAAe,CAAC;gCACjC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;oCACb,KAAK,CAAC,eAAe,GAAG,sBAAsB,CAAC,KAAM,EAAE,KAAI,CAAC,SAAU,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gCAClF,CAAC;gCACD,OAAO,CACL,4BAAI,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,IAC1D,IAAI,CAAC,KAAK,CACR,CACN,CAAC;4BACJ,CAAC,CAAC,CACC,CACN,EAhB0B,CAgB1B,CAAC,CACI,CACT,CACK,CACJ,CACQ,CACZ,CACF,CACP,CAAC;IACJ,CAAC;IACH,qBAAC;AAAD,CAAC,AA9HD,CAAoC,KAAK,CAAC,SAAS,GA8HlD","sourcesContent":["import * as React from 'react';\nimport { IChartTableProps } from './ChartTable.types';\nimport { IChartTableStyleProps, IChartTableStyles } from '../../index';\nimport { classNamesFunction, getRTL, initializeComponentRef } from '@fluentui/react/lib/Utilities';\nimport { IImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\nimport * as d3 from 'd3-color';\nimport { getColorContrast } from '../../utilities/colors';\nimport { ITheme } from '@fluentui/react';\nimport { resolveCSSVariables } from '../../utilities/utilities';\n\nfunction invertHexColor(hex: string, theme: ITheme): string {\n const color = d3.color(hex);\n if (!color) {\n return theme.semanticColors.bodyText!;\n }\n const rgb = color.rgb();\n return d3.rgb(255 - rgb.r, 255 - rgb.g, 255 - rgb.b).formatHex();\n}\n\nfunction getSafeBackgroundColor(\n theme: ITheme,\n chartContainer: HTMLElement,\n foreground?: string,\n background?: string,\n): string {\n const fallbackFg = theme.semanticColors.bodyText;\n const fallbackBg = theme.semanticColors.bodyBackground;\n if (!chartContainer) {\n return fallbackBg;\n }\n\n const resolvedFg = resolveCSSVariables(chartContainer, foreground || fallbackFg);\n const resolvedBg = resolveCSSVariables(chartContainer, background || fallbackBg);\n\n const fg = d3.color(resolvedFg);\n const bg = d3.color(resolvedBg);\n\n if (!fg || !bg) {\n return resolvedBg;\n }\n const contrast = getColorContrast(fg.formatHex(), bg.formatHex());\n if (contrast >= 3) {\n return bg.formatHex();\n }\n\n const invertedBg = invertHexColor(bg.formatHex(), theme);\n const invertedContrast = getColorContrast(fg.formatHex(), invertedBg);\n return invertedContrast >= 3 ? invertedBg : fallbackBg;\n}\n\nconst getClassNames = classNamesFunction<IChartTableStyleProps, IChartTableStyles>();\n\nexport class ChartTableBase extends React.Component<IChartTableProps> {\n private _isRTL: boolean;\n private _rootElem: HTMLDivElement | null;\n\n constructor(props: IChartTableProps) {\n super(props);\n initializeComponentRef(this);\n this._isRTL = getRTL(props.theme);\n }\n public toImage = (opts?: IImageExportOptions): Promise<string> => {\n return toImage(this._rootElem, undefined, this._isRTL, opts);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public render(): JSX.Element {\n const { headers, rows, width, height, styles, theme } = this.props;\n\n const classNames = getClassNames(styles!, {\n theme: theme!,\n });\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n const bgColorSet = new Set<string>();\n headers.forEach(header => {\n const bg = header?.style?.backgroundColor;\n const normalized = d3.color(bg || '')?.formatHex();\n if (normalized) {\n bgColorSet.add(normalized);\n }\n });\n let sharedBackgroundColor: string | undefined;\n let useSharedBackground = false;\n\n /*\n If we have only one or two unique background colors, we can consider using a shared background color\n for the table headers. This is to ensure better contrast with the foreground text.\n For size 1, we will consider that as default color if it satisfies the contrast ratio.\n There could also be a scenario where backgroundcolor array is of size 2, for eg: [\"dimsgray\", \"gray\"],\n which will assign 1st column header bg color to dimsgray and rest to gray. so our logic of shared background\n color won't run here. So will consider for size 2 as well.\n For size greater than this, we will consider that user wants different colors and will let color contrast fail\n if any.\n */\n if (bgColorSet.size === 1 || bgColorSet.size === 2) {\n const candidateBg = bgColorSet.size === 1 ? Array.from(bgColorSet)[0] : Array.from(bgColorSet)[1];\n for (const header of headers) {\n const fg = header?.style?.color;\n if (fg && getColorContrast(fg, candidateBg) >= 3) {\n sharedBackgroundColor = candidateBg;\n useSharedBackground = true;\n break;\n }\n }\n }\n\n return (\n <div\n ref={el => (this._rootElem = el)}\n className={classNames.root}\n style={{ height: height ? `${height}px` : '650px', overflow: 'hidden' }}\n >\n <svg width={width ?? '100%'} height={height ?? '650px'} className={classNames.chart}>\n <foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classNames.table}\n style={{\n width: width ? `${width}px` : '100%',\n }}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => {\n const style = { ...header?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n\n if (useSharedBackground) {\n style.backgroundColor = sharedBackgroundColor;\n } else if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(theme!, this._rootElem!, fg, bg);\n }\n return (\n <th key={idx} className={classNames.headerCell} style={style}>\n {header.value}\n </th>\n );\n })}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => {\n const style = { ...cell?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(theme!, this._rootElem!, fg, bg);\n }\n return (\n <td key={colIdx} className={classNames.bodyCell} style={style}>\n {cell.value}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ChartTable.base.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.base.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEnG,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGhE,SAAS,cAAc,CAAC,GAAW,EAAE,KAAa;IAChD,IAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC,cAAc,CAAC,QAAS,CAAC;IACxC,CAAC;IACD,IAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IACxB,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AACnE,CAAC;AAED,SAAS,sBAAsB,CAC7B,KAAa,EACb,cAA2B,EAC3B,UAAmB,EACnB,UAAmB;IAEnB,IAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;IACjD,IAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,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K,CAAC,eAAe,GAAG,sBAAsB,CAAC,KAAM,EAAE,KAAI,CAAC,SAAU,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gCAClF,CAAC;gCACD,OAAO,CACL,4BAAI,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,IAC1D,IAAI,CAAC,KAAK,CACR,CACN,CAAC;4BACJ,CAAC,CAAC,CACC,CACN,EAhB0B,CAgB1B,CAAC,CACI,CACT,CACK,CACJ,CACQ,CACZ,CACF,CACP,CAAC;IACJ,CAAC;IACH,qBAAC;AAAD,CAAC,AA9HD,CAAoC,KAAK,CAAC,SAAS,GA8HlD","sourcesContent":["import * as React from 'react';\nimport { IChartTableProps } from './ChartTable.types';\nimport { IChartTableStyleProps, IChartTableStyles } from '../../index';\nimport { classNamesFunction, getRTL, initializeComponentRef } from '@fluentui/react/lib/Utilities';\nimport { IImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\nimport * as d3 from 'd3-color';\nimport { getColorContrast } from '../../utilities/colors';\nimport { ITheme } from '@fluentui/react';\nimport { resolveCSSVariables } from '../../utilities/utilities';\nimport type { JSXElement } from '@fluentui/utilities';\n\nfunction invertHexColor(hex: string, theme: ITheme): string {\n const color = d3.color(hex);\n if (!color) {\n return theme.semanticColors.bodyText!;\n }\n const rgb = color.rgb();\n return d3.rgb(255 - rgb.r, 255 - rgb.g, 255 - rgb.b).formatHex();\n}\n\nfunction getSafeBackgroundColor(\n theme: ITheme,\n chartContainer: HTMLElement,\n foreground?: string,\n background?: string,\n): string {\n const fallbackFg = theme.semanticColors.bodyText;\n const fallbackBg = theme.semanticColors.bodyBackground;\n if (!chartContainer) {\n return fallbackBg;\n }\n\n const resolvedFg = resolveCSSVariables(chartContainer, foreground || fallbackFg);\n const resolvedBg = resolveCSSVariables(chartContainer, background || fallbackBg);\n\n const fg = d3.color(resolvedFg);\n const bg = d3.color(resolvedBg);\n\n if (!fg || !bg) {\n return resolvedBg;\n }\n const contrast = getColorContrast(fg.formatHex(), bg.formatHex());\n if (contrast >= 3) {\n return bg.formatHex();\n }\n\n const invertedBg = invertHexColor(bg.formatHex(), theme);\n const invertedContrast = getColorContrast(fg.formatHex(), invertedBg);\n return invertedContrast >= 3 ? invertedBg : fallbackBg;\n}\n\nconst getClassNames = classNamesFunction<IChartTableStyleProps, IChartTableStyles>();\n\nexport class ChartTableBase extends React.Component<IChartTableProps> {\n private _isRTL: boolean;\n private _rootElem: HTMLDivElement | null;\n\n constructor(props: IChartTableProps) {\n super(props);\n initializeComponentRef(this);\n this._isRTL = getRTL(props.theme);\n }\n public toImage = (opts?: IImageExportOptions): Promise<string> => {\n return toImage(this._rootElem, undefined, this._isRTL, opts);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n public render(): JSXElement {\n const { headers, rows, width, height, styles, theme } = this.props;\n\n const classNames = getClassNames(styles!, {\n theme: theme!,\n });\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n const bgColorSet = new Set<string>();\n headers.forEach(header => {\n const bg = header?.style?.backgroundColor;\n const normalized = d3.color(bg || '')?.formatHex();\n if (normalized) {\n bgColorSet.add(normalized);\n }\n });\n let sharedBackgroundColor: string | undefined;\n let useSharedBackground = false;\n\n /*\n If we have only one or two unique background colors, we can consider using a shared background color\n for the table headers. This is to ensure better contrast with the foreground text.\n For size 1, we will consider that as default color if it satisfies the contrast ratio.\n There could also be a scenario where backgroundcolor array is of size 2, for eg: [\"dimsgray\", \"gray\"],\n which will assign 1st column header bg color to dimsgray and rest to gray. so our logic of shared background\n color won't run here. So will consider for size 2 as well.\n For size greater than this, we will consider that user wants different colors and will let color contrast fail\n if any.\n */\n if (bgColorSet.size === 1 || bgColorSet.size === 2) {\n const candidateBg = bgColorSet.size === 1 ? Array.from(bgColorSet)[0] : Array.from(bgColorSet)[1];\n for (const header of headers) {\n const fg = header?.style?.color;\n if (fg && getColorContrast(fg, candidateBg) >= 3) {\n sharedBackgroundColor = candidateBg;\n useSharedBackground = true;\n break;\n }\n }\n }\n\n return (\n <div\n ref={el => (this._rootElem = el)}\n className={classNames.root}\n style={{ height: height ? `${height}px` : '650px', overflow: 'hidden' }}\n >\n <svg width={width ?? '100%'} height={height ?? '650px'} className={classNames.chart}>\n <foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classNames.table}\n style={{\n width: width ? `${width}px` : '100%',\n }}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => {\n const style = { ...header?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n\n if (useSharedBackground) {\n style.backgroundColor = sharedBackgroundColor;\n } else if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(theme!, this._rootElem!, fg, bg);\n }\n return (\n <th key={idx} className={classNames.headerCell} style={style}>\n {header.value}\n </th>\n );\n })}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => {\n const style = { ...cell?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(theme!, this._rootElem!, fg, bg);\n }\n return (\n <td key={colIdx} className={classNames.bodyCell} style={style}>\n {cell.value}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { IChartAnnotationLayerProps } from './ChartAnnotationLayer.types';
3
+ export declare const ChartAnnotationLayer: React.FC<IChartAnnotationLayerProps>;
@@ -0,0 +1,343 @@
1
+ import { __assign } from "tslib";
2
+ import * as React from 'react';
3
+ import { classNamesFunction, css, getId } from '@fluentui/react/lib/Utilities';
4
+ import { applyOpacityToColor, DEFAULT_ANNOTATION_BACKGROUND_OPACITY, DEFAULT_CONNECTOR_ARROW, DEFAULT_CONNECTOR_END_PADDING, DEFAULT_CONNECTOR_START_PADDING, DEFAULT_CONNECTOR_STROKE_WIDTH, getDefaultConnectorStrokeColor, getStyles, } from './ChartAnnotationLayer.styles';
5
+ var getClassNames = classNamesFunction();
6
+ var DEFAULT_HORIZONTAL_ALIGN = 'center';
7
+ var DEFAULT_VERTICAL_ALIGN = 'middle';
8
+ var DEFAULT_FOREIGN_OBJECT_WIDTH = 180;
9
+ var DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;
10
+ var MIN_ARROW_SIZE = 6;
11
+ var MAX_ARROW_SIZE = 24;
12
+ var ARROW_SIZE_SCALE = 0.35;
13
+ var getAnnotationKey = function (annotation, index) {
14
+ var _a, _b;
15
+ return (_b = (_a = annotation.id) !== null && _a !== void 0 ? _a : (typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined)) !== null && _b !== void 0 ? _b : "annotation-".concat(index);
16
+ };
17
+ var decodeHtmlEntities = function (html, documentRef) {
18
+ var _a, _b;
19
+ if (!html || html.indexOf('&') === -1) {
20
+ return html;
21
+ }
22
+ if (!((_a = documentRef === null || documentRef === void 0 ? void 0 : documentRef.implementation) === null || _a === void 0 ? void 0 : _a.createHTMLDocument)) {
23
+ return html;
24
+ }
25
+ var workingDocument = documentRef.implementation.createHTMLDocument('');
26
+ workingDocument.body.innerHTML = html;
27
+ return (_b = workingDocument.body.textContent) !== null && _b !== void 0 ? _b : '';
28
+ };
29
+ var sanitizeAnnotationHtml = function (html) {
30
+ var _a, _b;
31
+ if (!html) {
32
+ return '';
33
+ }
34
+ if (typeof window === 'undefined' || !((_b = (_a = window.document) === null || _a === void 0 ? void 0 : _a.implementation) === null || _b === void 0 ? void 0 : _b.createHTMLDocument)) {
35
+ return html;
36
+ }
37
+ var workingDocument = window.document.implementation.createHTMLDocument('');
38
+ workingDocument.body.innerHTML = decodeHtmlEntities(html, window.document);
39
+ workingDocument.body.querySelectorAll('script, iframe, object, embed, link').forEach(function (node) { return node.remove(); });
40
+ workingDocument.body.querySelectorAll('*').forEach(function (node) {
41
+ Array.from(node.attributes).forEach(function (attr) {
42
+ if (/^on/i.test(attr.name)) {
43
+ node.removeAttribute(attr.name);
44
+ }
45
+ });
46
+ });
47
+ return workingDocument.body.innerHTML;
48
+ };
49
+ var normalizeBandOffset = function (scale, value) {
50
+ var position = scale === null || scale === void 0 ? void 0 : scale(value);
51
+ if (typeof position !== 'number' || Number.isNaN(position)) {
52
+ return undefined;
53
+ }
54
+ if (scale && typeof scale.bandwidth === 'function') {
55
+ return position + scale.bandwidth() / 2;
56
+ }
57
+ return position;
58
+ };
59
+ var clamp = function (value, min, max) { return Math.max(min, Math.min(max, value)); };
60
+ var createMeasurementSignature = function (annotationHtml, containerStyle, contentStyle, layoutClassName, styleClassName) {
61
+ return JSON.stringify({
62
+ annotationHtml: annotationHtml,
63
+ containerStyle: containerStyle,
64
+ contentStyle: contentStyle,
65
+ layoutClassName: layoutClassName !== null && layoutClassName !== void 0 ? layoutClassName : '',
66
+ styleClassName: styleClassName !== null && styleClassName !== void 0 ? styleClassName : '',
67
+ });
68
+ };
69
+ var resolveCoordinates = function (annotation, context) {
70
+ var _a, _b;
71
+ var coordinates = annotation.coordinates, layout = annotation.layout;
72
+ if (!coordinates) {
73
+ return undefined;
74
+ }
75
+ var offsetX = (_a = layout === null || layout === void 0 ? void 0 : layout.offsetX) !== null && _a !== void 0 ? _a : 0;
76
+ var offsetY = (_b = layout === null || layout === void 0 ? void 0 : layout.offsetY) !== null && _b !== void 0 ? _b : 0;
77
+ var anchor = { x: 0, y: 0 };
78
+ switch (coordinates.type) {
79
+ case 'data': {
80
+ var x = coordinates.x, y = coordinates.y, _c = coordinates.yAxis, yAxis = _c === void 0 ? 'primary' : _c;
81
+ var xScale = context.xScale;
82
+ var yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;
83
+ if (!xScale || !yScale) {
84
+ return undefined;
85
+ }
86
+ var xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);
87
+ var yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);
88
+ if (typeof xValue !== 'number' || typeof yValue !== 'number') {
89
+ return undefined;
90
+ }
91
+ anchor.x = xValue;
92
+ anchor.y = yValue;
93
+ break;
94
+ }
95
+ case 'relative': {
96
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
97
+ return undefined;
98
+ }
99
+ anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;
100
+ anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;
101
+ break;
102
+ }
103
+ case 'pixel': {
104
+ if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {
105
+ return undefined;
106
+ }
107
+ anchor.x = context.plotRect.x + coordinates.x;
108
+ anchor.y = context.plotRect.y + coordinates.y;
109
+ break;
110
+ }
111
+ default:
112
+ return undefined;
113
+ }
114
+ var left = anchor.x + offsetX;
115
+ var top = anchor.y + offsetY;
116
+ if (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) {
117
+ left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);
118
+ top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);
119
+ }
120
+ return {
121
+ anchor: anchor,
122
+ point: { x: left, y: top },
123
+ };
124
+ };
125
+ export var ChartAnnotationLayer = React.memo(function (props) {
126
+ var annotationsProp = props.annotations, theme = props.theme, context = props.context, className = props.className;
127
+ var classNames = getClassNames(getStyles, { theme: theme, className: className });
128
+ var idPrefix = React.useMemo(function () { return getId('chart-annotation'); }, []);
129
+ var _a = React.useState({}), measurements = _a[0], setMeasurements = _a[1];
130
+ var resolvedAnnotations = React.useMemo(function () {
131
+ return (annotationsProp !== null && annotationsProp !== void 0 ? annotationsProp : []).map(function (annotation, index) { return ({ annotation: annotation, key: getAnnotationKey(annotation, index) }); });
132
+ }, [annotationsProp]);
133
+ React.useEffect(function () {
134
+ setMeasurements(function (prev) {
135
+ if (resolvedAnnotations.length === 0) {
136
+ if (Object.keys(prev).length === 0) {
137
+ return prev;
138
+ }
139
+ return {};
140
+ }
141
+ var next = {};
142
+ resolvedAnnotations.forEach(function (_a) {
143
+ var key = _a.key;
144
+ if (prev[key]) {
145
+ next[key] = prev[key];
146
+ }
147
+ });
148
+ if (Object.keys(next).length === Object.keys(prev).length) {
149
+ var identical = true;
150
+ for (var _i = 0, _a = Object.keys(next); _i < _a.length; _i++) {
151
+ var key = _a[_i];
152
+ if (next[key] !== prev[key]) {
153
+ identical = false;
154
+ break;
155
+ }
156
+ }
157
+ if (identical) {
158
+ return prev;
159
+ }
160
+ }
161
+ return next;
162
+ });
163
+ }, [resolvedAnnotations]);
164
+ var updateMeasurement = React.useCallback(function (key, width, height, signature) {
165
+ setMeasurements(function (prev) {
166
+ var _a;
167
+ var prevEntry = prev[key];
168
+ if (prevEntry &&
169
+ prevEntry.signature === signature &&
170
+ Math.abs(prevEntry.width - width) < 0.5 &&
171
+ Math.abs(prevEntry.height - height) < 0.5) {
172
+ return prev;
173
+ }
174
+ if (width === 0 && height === 0) {
175
+ return prev;
176
+ }
177
+ return __assign(__assign({}, prev), (_a = {}, _a[key] = { width: width, height: height, signature: signature }, _a));
178
+ });
179
+ }, []);
180
+ var annotationForeignObjects = [];
181
+ var measurementElements = [];
182
+ var connectors = [];
183
+ resolvedAnnotations.forEach(function (_a) {
184
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
185
+ var annotation = _a.annotation, key = _a.key;
186
+ var resolved = resolveCoordinates(annotation, context);
187
+ if (!resolved) {
188
+ return;
189
+ }
190
+ var annotationHtml = sanitizeAnnotationHtml((_b = annotation.text) !== null && _b !== void 0 ? _b : '');
191
+ var layout = annotation.layout;
192
+ var horizontalAlign = (_c = layout === null || layout === void 0 ? void 0 : layout.align) !== null && _c !== void 0 ? _c : DEFAULT_HORIZONTAL_ALIGN;
193
+ var verticalAlign = (_d = layout === null || layout === void 0 ? void 0 : layout.verticalAlign) !== null && _d !== void 0 ? _d : DEFAULT_VERTICAL_ALIGN;
194
+ var backgroundOpacity = (_f = (_e = annotation.style) === null || _e === void 0 ? void 0 : _e.opacity) !== null && _f !== void 0 ? _f : DEFAULT_ANNOTATION_BACKGROUND_OPACITY;
195
+ var baseBackgroundColor = (_h = (_g = annotation.style) === null || _g === void 0 ? void 0 : _g.backgroundColor) !== null && _h !== void 0 ? _h : theme.semanticColors.bodyBackground;
196
+ var hasCustomBackground = ((_j = annotation.style) === null || _j === void 0 ? void 0 : _j.backgroundColor) !== undefined || ((_k = annotation.style) === null || _k === void 0 ? void 0 : _k.opacity) !== undefined;
197
+ var containerStyle = __assign(__assign({ maxWidth: layout === null || layout === void 0 ? void 0 : layout.maxWidth }, (hasCustomBackground && {
198
+ backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity),
199
+ })), { borderColor: (_l = annotation.style) === null || _l === void 0 ? void 0 : _l.borderColor, borderWidth: (_m = annotation.style) === null || _m === void 0 ? void 0 : _m.borderWidth, borderStyle: (_p = (_o = annotation.style) === null || _o === void 0 ? void 0 : _o.borderStyle) !== null && _p !== void 0 ? _p : (((_q = annotation.style) === null || _q === void 0 ? void 0 : _q.borderColor) ? 'solid' : undefined), borderRadius: (_r = annotation.style) === null || _r === void 0 ? void 0 : _r.borderRadius, padding: (_s = annotation.style) === null || _s === void 0 ? void 0 : _s.padding, boxShadow: (_t = annotation.style) === null || _t === void 0 ? void 0 : _t.boxShadow });
200
+ var contentStyle = {
201
+ color: (_u = annotation.style) === null || _u === void 0 ? void 0 : _u.textColor,
202
+ fontSize: (_v = annotation.style) === null || _v === void 0 ? void 0 : _v.fontSize,
203
+ fontWeight: (_w = annotation.style) === null || _w === void 0 ? void 0 : _w.fontWeight,
204
+ opacity: 1,
205
+ };
206
+ var measurementSignature = createMeasurementSignature(annotationHtml, containerStyle, contentStyle, layout === null || layout === void 0 ? void 0 : layout.className, (_x = annotation.style) === null || _x === void 0 ? void 0 : _x.className);
207
+ var measurementEntry = measurements[key];
208
+ var isMeasurementValid = (measurementEntry === null || measurementEntry === void 0 ? void 0 : measurementEntry.signature) === measurementSignature;
209
+ var measuredSize = isMeasurementValid ? measurementEntry : undefined;
210
+ var width = Math.max((_z = (_y = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.width) !== null && _y !== void 0 ? _y : layout === null || layout === void 0 ? void 0 : layout.maxWidth) !== null && _z !== void 0 ? _z : DEFAULT_FOREIGN_OBJECT_WIDTH, 1);
211
+ var height = Math.max((_0 = measuredSize === null || measuredSize === void 0 ? void 0 : measuredSize.height) !== null && _0 !== void 0 ? _0 : DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);
212
+ var offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;
213
+ var offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;
214
+ var baseTopLeftX = resolved.point.x + offsetX;
215
+ var baseTopLeftY = resolved.point.y + offsetY;
216
+ var usePlotBounds = (layout === null || layout === void 0 ? void 0 : layout.clipToBounds) !== false;
217
+ var viewportX = usePlotBounds ? context.plotRect.x : 0;
218
+ var viewportY = usePlotBounds ? context.plotRect.y : 0;
219
+ var viewportWidth = usePlotBounds ? context.plotRect.width : (_1 = context.svgRect.width) !== null && _1 !== void 0 ? _1 : 0;
220
+ var viewportHeight = usePlotBounds ? context.plotRect.height : (_2 = context.svgRect.height) !== null && _2 !== void 0 ? _2 : 0;
221
+ var maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;
222
+ var maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;
223
+ var topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;
224
+ var topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;
225
+ var displayPoint = {
226
+ x: topLeftX - offsetX,
227
+ y: topLeftY - offsetY,
228
+ };
229
+ if (annotation.connector) {
230
+ var startPadding = (_3 = annotation.connector.startPadding) !== null && _3 !== void 0 ? _3 : 12;
231
+ var endPadding = (_4 = annotation.connector.endPadding) !== null && _4 !== void 0 ? _4 : 0;
232
+ var minArrowClearance = 6;
233
+ var minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);
234
+ var dx = displayPoint.x - resolved.anchor.x;
235
+ var dy = displayPoint.y - resolved.anchor.y;
236
+ var distance = Math.sqrt(dx * dx + dy * dy);
237
+ if (distance < minDistance) {
238
+ var fallbackDirection = { x: 0, y: -1 };
239
+ var ux = distance === 0 ? fallbackDirection.x : dx / distance;
240
+ var uy = distance === 0 ? fallbackDirection.y : dy / distance;
241
+ var desiredDisplayX = resolved.anchor.x + ux * minDistance;
242
+ var desiredDisplayY = resolved.anchor.y + uy * minDistance;
243
+ var desiredTopLeftX = desiredDisplayX + offsetX;
244
+ var desiredTopLeftY = desiredDisplayY + offsetY;
245
+ desiredTopLeftX =
246
+ viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;
247
+ desiredTopLeftY =
248
+ viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;
249
+ topLeftX = desiredTopLeftX;
250
+ topLeftY = desiredTopLeftY;
251
+ displayPoint = {
252
+ x: topLeftX - offsetX,
253
+ y: topLeftY - offsetY,
254
+ };
255
+ }
256
+ }
257
+ var measurementStyle = __assign({ left: topLeftX, top: topLeftY, pointerEvents: 'none' }, containerStyle);
258
+ if (!isMeasurementValid) {
259
+ measurementElements.push(React.createElement("div", { key: "".concat(key, "-measurement"), ref: function (node) {
260
+ if (node) {
261
+ var rect = node.getBoundingClientRect();
262
+ if (rect.width !== 0 || rect.height !== 0) {
263
+ updateMeasurement(key, rect.width, rect.height, measurementSignature);
264
+ }
265
+ }
266
+ }, className: css(classNames.annotation, classNames.measurement, layout === null || layout === void 0 ? void 0 : layout.className, (_5 = annotation.style) === null || _5 === void 0 ? void 0 : _5.className), style: measurementStyle, "aria-hidden": true, "data-annotation-key": key, "data-chart-annotation-measurement": "true" },
267
+ React.createElement("div", { className: css(classNames.annotationContent, layout === null || layout === void 0 ? void 0 : layout.className, (_6 = annotation.style) === null || _6 === void 0 ? void 0 : _6.className), style: contentStyle, dangerouslySetInnerHTML: { __html: annotationHtml } })));
268
+ }
269
+ annotationForeignObjects.push(React.createElement("foreignObject", { key: "".concat(key, "-annotation"), x: topLeftX, y: topLeftY, width: width, height: height, className: css(classNames.annotationForeignObject), "data-annotation-key": key },
270
+ React.createElement("div", { className: css(classNames.annotation, layout === null || layout === void 0 ? void 0 : layout.className, (_7 = annotation.style) === null || _7 === void 0 ? void 0 : _7.className), style: containerStyle, "data-annotation-key": key },
271
+ React.createElement("div", { className: css(classNames.annotationContent, (_8 = annotation.style) === null || _8 === void 0 ? void 0 : _8.className), style: contentStyle, role: (_10 = (_9 = annotation.accessibility) === null || _9 === void 0 ? void 0 : _9.role) !== null && _10 !== void 0 ? _10 : 'note', "aria-label": (_11 = annotation.accessibility) === null || _11 === void 0 ? void 0 : _11.ariaLabel, "aria-describedby": (_12 = annotation.accessibility) === null || _12 === void 0 ? void 0 : _12.ariaDescribedBy, "data-chart-annotation": "true", "data-annotation-key": key, dangerouslySetInnerHTML: { __html: annotationHtml } }))));
272
+ if (annotation.connector) {
273
+ var _13 = annotation.connector, _14 = _13.startPadding, startPadding = _14 === void 0 ? DEFAULT_CONNECTOR_START_PADDING : _14, _15 = _13.endPadding, endPadding = _15 === void 0 ? DEFAULT_CONNECTOR_END_PADDING : _15, _16 = _13.strokeColor, strokeColor = _16 === void 0 ? getDefaultConnectorStrokeColor(theme) : _16, _17 = _13.strokeWidth, strokeWidth = _17 === void 0 ? DEFAULT_CONNECTOR_STROKE_WIDTH : _17, dashArray = _13.dashArray, _18 = _13.arrow, arrow = _18 === void 0 ? DEFAULT_CONNECTOR_ARROW : _18;
274
+ var dx = resolved.anchor.x - displayPoint.x;
275
+ var dy = resolved.anchor.y - displayPoint.y;
276
+ var distance = Math.sqrt(dx * dx + dy * dy) || 1;
277
+ var ux = dx / distance;
278
+ var uy = dy / distance;
279
+ var sizeBasis = Math.max(1, Math.min(width, height));
280
+ var proportionalSize = sizeBasis * ARROW_SIZE_SCALE;
281
+ var maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;
282
+ var maxByDistance = distance * 0.6;
283
+ var markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));
284
+ var markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);
285
+ var start = {
286
+ x: displayPoint.x + ux * startPadding,
287
+ y: displayPoint.y + uy * startPadding,
288
+ };
289
+ var end = {
290
+ x: resolved.anchor.x - ux * endPadding,
291
+ y: resolved.anchor.y - uy * endPadding,
292
+ };
293
+ connectors.push({
294
+ key: "".concat(key, "-connector"),
295
+ start: start,
296
+ end: end,
297
+ strokeColor: strokeColor,
298
+ strokeWidth: strokeWidth,
299
+ dashArray: dashArray,
300
+ arrow: arrow,
301
+ markerSize: markerSize,
302
+ markerStrokeWidth: markerStrokeWidth,
303
+ });
304
+ }
305
+ });
306
+ if (annotationForeignObjects.length === 0 && connectors.length === 0) {
307
+ return null;
308
+ }
309
+ var viewBoxWidth = context.svgRect.width || 1;
310
+ var viewBoxHeight = context.svgRect.height || 1;
311
+ var markerDefs = [];
312
+ var createMarkerId = function (color, position, size, markerStrokeWidth) {
313
+ var id = "".concat(idPrefix, "-").concat(position, "-").concat(markerDefs.length);
314
+ var refY = size / 2;
315
+ var refX = position === 'end' ? size : 0;
316
+ var pathEnd = "M0 0 L ".concat(size, " ").concat(refY, " L0 ").concat(size, " Z");
317
+ var pathStart = "M ".concat(size, " 0 L0 ").concat(refY, " L ").concat(size, " ").concat(size, " Z");
318
+ var path = position === 'end' ? pathEnd : pathStart;
319
+ markerDefs.push(React.createElement("marker", { key: id, id: id, markerWidth: size, markerHeight: size, viewBox: "0 0 ".concat(size, " ").concat(size), refX: refX, refY: refY, orient: "auto", markerUnits: "userSpaceOnUse" },
320
+ React.createElement("path", { d: path, fill: color, stroke: color, strokeWidth: markerStrokeWidth, strokeLinecap: "round", strokeLinejoin: "round" })));
321
+ return id;
322
+ };
323
+ var connectorElements = connectors.map(function (connector) {
324
+ var markerStart;
325
+ var markerEnd;
326
+ if (connector.arrow === 'start' || connector.arrow === 'both') {
327
+ markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);
328
+ }
329
+ if (connector.arrow === 'end' || connector.arrow === 'both') {
330
+ markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);
331
+ }
332
+ return (React.createElement("line", { key: connector.key, x1: connector.start.x, y1: connector.start.y, x2: connector.end.x, y2: connector.end.y, stroke: connector.strokeColor, strokeWidth: connector.strokeWidth, strokeDasharray: connector.dashArray, strokeLinecap: "round", markerStart: markerStart ? "url(#".concat(markerStart, ")") : undefined, markerEnd: markerEnd ? "url(#".concat(markerEnd, ")") : undefined }));
333
+ });
334
+ var shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;
335
+ return (React.createElement("div", { className: classNames.root, role: "presentation", "data-chart-annotation-layer": "true" },
336
+ shouldRenderSvg && (React.createElement("svg", { className: classNames.connectorLayer, width: "100%", height: "100%", viewBox: "0 0 ".concat(viewBoxWidth, " ").concat(viewBoxHeight), preserveAspectRatio: "none", "data-chart-annotation-svg": "true" },
337
+ markerDefs.length > 0 && React.createElement("defs", null, markerDefs),
338
+ connectorElements.length > 0 && (React.createElement("g", { "aria-hidden": "true", className: classNames.connectorGroup }, connectorElements)),
339
+ annotationForeignObjects)),
340
+ measurementElements));
341
+ });
342
+ ChartAnnotationLayer.displayName = 'ChartAnnotationLayer';
343
+ //# sourceMappingURL=ChartAnnotationLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartAnnotationLayer.js","sourceRoot":"../src/","sources":["components/CommonComponents/Annotations/ChartAnnotationLayer.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAS/E,OAAO,EACL,mBAAmB,EACnB,qCAAqC,EACrC,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,8BAA8B,EAC9B,8BAA8B,EAC9B,SAAS,GAGV,MAAM,+BAA+B,CAAC;AAEvC,IAAM,aAAa,GAAG,kBAAkB,EAAgE,CAAC;AAEzG,IAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,IAAM,sBAAsB,GAAG,QAAQ,CAAC;AACxC,IAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,IAAM,6BAA6B,GAAG,EAAE,CAAC;AACzC,IAAM,cAAc,GAAG,CAAC,CAAC;AACzB,IAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,IAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,IAAM,gBAAgB,GAAG,UAAC,UAA4B,EAAE,KAAa;;IACnE,OAAA,MAAA,MAAA,UAAU,CAAC,EAAE,mCACb,CAAC,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,mCAClH,qBAAc,KAAK,CAAE,CAAA;CAAA,CAAC;AAExB,IAAM,kBAAkB,GAAG,UAAC,IAAY,EAAE,WAAqB;;IAC7D,IAAI,CAAC,IAAI,I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IAAM,eAAe,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,wBAAwB,CAAC,MAAM,GAAG,CAAC,CAAC;IACrF,OAAO,CACL,6BAAK,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAC,cAAc,iCAA6B,MAAM;QACpF,eAAe,IAAI,CAClB,6BACE,SAAS,EAAE,UAAU,CAAC,cAAc,EACpC,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,MAAM,EACb,OAAO,EAAE,cAAO,YAAY,cAAI,aAAa,CAAE,EAC/C,mBAAmB,EAAC,MAAM,+BACA,MAAM;YAE/B,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,kCAAO,UAAU,CAAQ;YAClD,iBAAiB,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,0CAAe,MAAM,EAAC,SAAS,EAAE,UAAU,CAAC,cAAc,IACvD,iBAAiB,CAChB,CACL;YACA,wBAAwB,CACrB,CACP;QACA,mBAAmB,CAChB,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC","sourcesContent":["import * as React from 'react';\nimport { classNamesFunction, css, getId } from '@fluentui/react/lib/Utilities';\nimport { IChartAnnotation } from '../../../types/IChartAnnotation';\nimport {\n IAnnotationPoint,\n IChartAnnotationContext,\n IChartAnnotationLayerProps,\n ConnectorRenderData,\n IResolvedAnnotationPosition,\n} from './ChartAnnotationLayer.types';\nimport {\n applyOpacityToColor,\n DEFAULT_ANNOTATION_BACKGROUND_OPACITY,\n DEFAULT_CONNECTOR_ARROW,\n DEFAULT_CONNECTOR_END_PADDING,\n DEFAULT_CONNECTOR_START_PADDING,\n DEFAULT_CONNECTOR_STROKE_WIDTH,\n getDefaultConnectorStrokeColor,\n getStyles,\n IChartAnnotationLayerStyleProps,\n IChartAnnotationLayerStyles,\n} from './ChartAnnotationLayer.styles';\n\nconst getClassNames = classNamesFunction<IChartAnnotationLayerStyleProps, IChartAnnotationLayerStyles>();\n\nconst DEFAULT_HORIZONTAL_ALIGN = 'center';\nconst DEFAULT_VERTICAL_ALIGN = 'middle';\nconst DEFAULT_FOREIGN_OBJECT_WIDTH = 180;\nconst DEFAULT_FOREIGN_OBJECT_HEIGHT = 60;\nconst MIN_ARROW_SIZE = 6;\nconst MAX_ARROW_SIZE = 24;\nconst ARROW_SIZE_SCALE = 0.35;\nconst getAnnotationKey = (annotation: IChartAnnotation, index: number) =>\n annotation.id ??\n (typeof annotation.text === 'string' || typeof annotation.text === 'number' ? String(annotation.text) : undefined) ??\n `annotation-${index}`;\n\nconst decodeHtmlEntities = (html: string, documentRef: Document): string => {\n if (!html || html.indexOf('&') === -1) {\n return html;\n }\n\n if (!documentRef?.implementation?.createHTMLDocument) {\n return html;\n }\n\n const workingDocument = documentRef.implementation.createHTMLDocument('');\n workingDocument.body.innerHTML = html;\n return workingDocument.body.textContent ?? '';\n};\n\nconst sanitizeAnnotationHtml = (html: string): string => {\n if (!html) {\n return '';\n }\n\n if (typeof window === 'undefined' || !window.document?.implementation?.createHTMLDocument) {\n return html;\n }\n\n const workingDocument = window.document.implementation.createHTMLDocument('');\n workingDocument.body.innerHTML = decodeHtmlEntities(html, window.document);\n\n workingDocument.body.querySelectorAll('script, iframe, object, embed, link').forEach(node => node.remove());\n\n workingDocument.body.querySelectorAll('*').forEach(node => {\n Array.from(node.attributes).forEach(attr => {\n if (/^on/i.test(attr.name)) {\n node.removeAttribute(attr.name);\n }\n });\n });\n\n return workingDocument.body.innerHTML;\n};\n\nconst normalizeBandOffset = (\n scale: (((value: unknown) => number) & { bandwidth?: () => number }) | undefined,\n value: unknown,\n) => {\n const position = scale?.(value as never);\n if (typeof position !== 'number' || Number.isNaN(position)) {\n return undefined;\n }\n if (scale && typeof scale.bandwidth === 'function') {\n return position + scale.bandwidth() / 2;\n }\n return position;\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(max, value));\n\nconst createMeasurementSignature = (\n annotationHtml: string,\n containerStyle: React.CSSProperties,\n contentStyle: React.CSSProperties,\n layoutClassName?: string,\n styleClassName?: string,\n) =>\n JSON.stringify({\n annotationHtml,\n containerStyle,\n contentStyle,\n layoutClassName: layoutClassName ?? '',\n styleClassName: styleClassName ?? '',\n });\n\ntype MeasurementEntry = { width: number; height: number; signature: string };\n\nconst resolveCoordinates = (\n annotation: IChartAnnotation,\n context: IChartAnnotationContext,\n): IResolvedAnnotationPosition | undefined => {\n const { coordinates, layout } = annotation;\n\n if (!coordinates) {\n return undefined;\n }\n\n const offsetX = layout?.offsetX ?? 0;\n const offsetY = layout?.offsetY ?? 0;\n\n const anchor: IAnnotationPoint = { x: 0, y: 0 };\n\n switch (coordinates.type) {\n case 'data': {\n const { x, y, yAxis = 'primary' } = coordinates;\n const xScale = context.xScale;\n const yScale = yAxis === 'secondary' ? context.yScaleSecondary : context.yScalePrimary;\n if (!xScale || !yScale) {\n return undefined;\n }\n const xValue = normalizeBandOffset(xScale, x instanceof Date ? x.getTime() : x);\n const yValue = normalizeBandOffset(yScale, y instanceof Date ? y.getTime() : y);\n if (typeof xValue !== 'number' || typeof yValue !== 'number') {\n return undefined;\n }\n anchor.x = xValue;\n anchor.y = yValue;\n break;\n }\n case 'relative': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + context.plotRect.width * coordinates.x;\n anchor.y = context.plotRect.y + context.plotRect.height * coordinates.y;\n break;\n }\n case 'pixel': {\n if (typeof coordinates.x !== 'number' || typeof coordinates.y !== 'number') {\n return undefined;\n }\n anchor.x = context.plotRect.x + coordinates.x;\n anchor.y = context.plotRect.y + coordinates.y;\n break;\n }\n default:\n return undefined;\n }\n\n let left = anchor.x + offsetX;\n let top = anchor.y + offsetY;\n\n if (layout?.clipToBounds) {\n left = clamp(left, context.plotRect.x, context.plotRect.x + context.plotRect.width);\n top = clamp(top, context.plotRect.y, context.plotRect.y + context.plotRect.height);\n }\n\n return {\n anchor,\n point: { x: left, y: top },\n };\n};\n\nexport const ChartAnnotationLayer: React.FC<IChartAnnotationLayerProps> = React.memo(props => {\n const { annotations: annotationsProp, theme, context, className } = props;\n\n const classNames = getClassNames(getStyles, { theme, className });\n const idPrefix = React.useMemo(() => getId('chart-annotation'), []);\n\n const [measurements, setMeasurements] = React.useState<Record<string, MeasurementEntry>>({});\n\n const resolvedAnnotations = React.useMemo(\n () =>\n (annotationsProp ?? []).map((annotation, index) => ({ annotation, key: getAnnotationKey(annotation, index) })),\n [annotationsProp],\n );\n\n React.useEffect(() => {\n setMeasurements(prev => {\n if (resolvedAnnotations.length === 0) {\n if (Object.keys(prev).length === 0) {\n return prev;\n }\n return {} as Record<string, MeasurementEntry>;\n }\n\n const next: Record<string, MeasurementEntry> = {};\n resolvedAnnotations.forEach(({ key }) => {\n if (prev[key]) {\n next[key] = prev[key];\n }\n });\n\n if (Object.keys(next).length === Object.keys(prev).length) {\n let identical = true;\n for (const key of Object.keys(next)) {\n if (next[key] !== prev[key]) {\n identical = false;\n break;\n }\n }\n if (identical) {\n return prev;\n }\n }\n\n return next;\n });\n }, [resolvedAnnotations]);\n\n const updateMeasurement = React.useCallback((key: string, width: number, height: number, signature: string) => {\n setMeasurements(prev => {\n const prevEntry = prev[key];\n if (\n prevEntry &&\n prevEntry.signature === signature &&\n Math.abs(prevEntry.width - width) < 0.5 &&\n Math.abs(prevEntry.height - height) < 0.5\n ) {\n return prev;\n }\n\n if (width === 0 && height === 0) {\n return prev;\n }\n\n return {\n ...prev,\n [key]: { width, height, signature },\n };\n });\n }, []);\n\n const annotationForeignObjects: React.ReactNode[] = [];\n const measurementElements: React.ReactNode[] = [];\n const connectors: ConnectorRenderData[] = [];\n\n resolvedAnnotations.forEach(({ annotation, key }) => {\n const resolved = resolveCoordinates(annotation, context);\n if (!resolved) {\n return;\n }\n\n const annotationHtml = sanitizeAnnotationHtml(annotation.text ?? '');\n\n const layout = annotation.layout;\n const horizontalAlign = layout?.align ?? DEFAULT_HORIZONTAL_ALIGN;\n const verticalAlign = layout?.verticalAlign ?? DEFAULT_VERTICAL_ALIGN;\n const backgroundOpacity = annotation.style?.opacity ?? DEFAULT_ANNOTATION_BACKGROUND_OPACITY;\n const baseBackgroundColor = annotation.style?.backgroundColor ?? theme.semanticColors.bodyBackground;\n const hasCustomBackground =\n annotation.style?.backgroundColor !== undefined || annotation.style?.opacity !== undefined;\n\n const containerStyle: React.CSSProperties = {\n maxWidth: layout?.maxWidth,\n ...(hasCustomBackground && {\n backgroundColor: applyOpacityToColor(baseBackgroundColor, backgroundOpacity),\n }),\n borderColor: annotation.style?.borderColor,\n borderWidth: annotation.style?.borderWidth,\n borderStyle: annotation.style?.borderStyle ?? (annotation.style?.borderColor ? 'solid' : undefined),\n borderRadius: annotation.style?.borderRadius,\n padding: annotation.style?.padding,\n boxShadow: annotation.style?.boxShadow,\n };\n\n const contentStyle: React.CSSProperties = {\n color: annotation.style?.textColor,\n fontSize: annotation.style?.fontSize,\n fontWeight: annotation.style?.fontWeight,\n opacity: 1,\n };\n\n const measurementSignature = createMeasurementSignature(\n annotationHtml,\n containerStyle,\n contentStyle,\n layout?.className,\n annotation.style?.className,\n );\n const measurementEntry = measurements[key];\n const isMeasurementValid = measurementEntry?.signature === measurementSignature;\n const measuredSize = isMeasurementValid ? measurementEntry : undefined;\n const width = Math.max(measuredSize?.width ?? layout?.maxWidth ?? DEFAULT_FOREIGN_OBJECT_WIDTH, 1);\n const height = Math.max(measuredSize?.height ?? DEFAULT_FOREIGN_OBJECT_HEIGHT, 1);\n\n const offsetX = horizontalAlign === 'center' ? -width / 2 : horizontalAlign === 'end' ? -width : 0;\n const offsetY = verticalAlign === 'middle' ? -height / 2 : verticalAlign === 'bottom' ? -height : 0;\n\n const baseTopLeftX = resolved.point.x + offsetX;\n const baseTopLeftY = resolved.point.y + offsetY;\n\n const usePlotBounds = layout?.clipToBounds !== false;\n const viewportX = usePlotBounds ? context.plotRect.x : 0;\n const viewportY = usePlotBounds ? context.plotRect.y : 0;\n const viewportWidth = usePlotBounds ? context.plotRect.width : context.svgRect.width ?? 0;\n const viewportHeight = usePlotBounds ? context.plotRect.height : context.svgRect.height ?? 0;\n\n const maxTopLeftX = viewportWidth > 0 ? viewportX + viewportWidth - width : baseTopLeftX;\n const maxTopLeftY = viewportHeight > 0 ? viewportY + viewportHeight - height : baseTopLeftY;\n\n let topLeftX = viewportWidth > 0 ? clamp(baseTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : baseTopLeftX;\n let topLeftY = viewportHeight > 0 ? clamp(baseTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : baseTopLeftY;\n\n let displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n\n if (annotation.connector) {\n const startPadding = annotation.connector.startPadding ?? 12;\n const endPadding = annotation.connector.endPadding ?? 0;\n const minArrowClearance = 6;\n const minDistance = Math.max(startPadding + endPadding + minArrowClearance, startPadding);\n\n const dx = displayPoint.x - resolved.anchor.x;\n const dy = displayPoint.y - resolved.anchor.y;\n const distance = Math.sqrt(dx * dx + dy * dy);\n\n if (distance < minDistance) {\n const fallbackDirection: IAnnotationPoint = { x: 0, y: -1 };\n const ux = distance === 0 ? fallbackDirection.x : dx / distance;\n const uy = distance === 0 ? fallbackDirection.y : dy / distance;\n\n const desiredDisplayX = resolved.anchor.x + ux * minDistance;\n const desiredDisplayY = resolved.anchor.y + uy * minDistance;\n\n let desiredTopLeftX = desiredDisplayX + offsetX;\n let desiredTopLeftY = desiredDisplayY + offsetY;\n\n desiredTopLeftX =\n viewportWidth > 0 ? clamp(desiredTopLeftX, viewportX, Math.max(viewportX, maxTopLeftX)) : desiredTopLeftX;\n desiredTopLeftY =\n viewportHeight > 0 ? clamp(desiredTopLeftY, viewportY, Math.max(viewportY, maxTopLeftY)) : desiredTopLeftY;\n\n topLeftX = desiredTopLeftX;\n topLeftY = desiredTopLeftY;\n displayPoint = {\n x: topLeftX - offsetX,\n y: topLeftY - offsetY,\n };\n }\n }\n\n const measurementStyle: React.CSSProperties = {\n left: topLeftX,\n top: topLeftY,\n pointerEvents: 'none',\n ...containerStyle,\n };\n\n if (!isMeasurementValid) {\n measurementElements.push(\n <div\n key={`${key}-measurement`}\n ref={node => {\n if (node) {\n const rect = node.getBoundingClientRect();\n if (rect.width !== 0 || rect.height !== 0) {\n updateMeasurement(key, rect.width, rect.height, measurementSignature);\n }\n }\n }}\n className={css(classNames.annotation, classNames.measurement, layout?.className, annotation.style?.className)}\n style={measurementStyle}\n aria-hidden={true}\n data-annotation-key={key}\n data-chart-annotation-measurement=\"true\"\n >\n {/* eslint-disable-next-line react/no-danger -- content sanitized via sanitizeAnnotationHtml */}\n <div\n className={css(classNames.annotationContent, layout?.className, annotation.style?.className)}\n style={contentStyle}\n dangerouslySetInnerHTML={{ __html: annotationHtml }}\n />\n </div>,\n );\n }\n\n annotationForeignObjects.push(\n <foreignObject\n key={`${key}-annotation`}\n x={topLeftX}\n y={topLeftY}\n width={width}\n height={height}\n className={css(classNames.annotationForeignObject)}\n data-annotation-key={key}\n >\n <div\n className={css(classNames.annotation, layout?.className, annotation.style?.className)}\n style={containerStyle}\n data-annotation-key={key}\n >\n {/* eslint-disable-next-line react/no-danger -- content sanitized via sanitizeAnnotationHtml */}\n <div\n className={css(classNames.annotationContent, annotation.style?.className)}\n style={contentStyle}\n role={annotation.accessibility?.role ?? 'note'}\n aria-label={annotation.accessibility?.ariaLabel}\n aria-describedby={annotation.accessibility?.ariaDescribedBy}\n data-chart-annotation=\"true\"\n data-annotation-key={key}\n dangerouslySetInnerHTML={{ __html: annotationHtml }}\n />\n </div>\n </foreignObject>,\n );\n\n if (annotation.connector) {\n const {\n startPadding = DEFAULT_CONNECTOR_START_PADDING,\n endPadding = DEFAULT_CONNECTOR_END_PADDING,\n strokeColor = getDefaultConnectorStrokeColor(theme),\n strokeWidth = DEFAULT_CONNECTOR_STROKE_WIDTH,\n dashArray,\n arrow = DEFAULT_CONNECTOR_ARROW,\n } = annotation.connector;\n\n const dx = resolved.anchor.x - displayPoint.x;\n const dy = resolved.anchor.y - displayPoint.y;\n const distance = Math.sqrt(dx * dx + dy * dy) || 1;\n const ux = dx / distance;\n const uy = dy / distance;\n\n const sizeBasis = Math.max(1, Math.min(width, height));\n const proportionalSize = sizeBasis * ARROW_SIZE_SCALE;\n const maxByPadding = startPadding > 0 ? startPadding * 1.25 : MAX_ARROW_SIZE;\n const maxByDistance = distance * 0.6;\n const markerSize = clamp(proportionalSize, MIN_ARROW_SIZE, Math.min(MAX_ARROW_SIZE, maxByPadding, maxByDistance));\n const markerStrokeWidth = clamp(strokeWidth, 1, markerSize / 2);\n\n const start: IAnnotationPoint = {\n x: displayPoint.x + ux * startPadding,\n y: displayPoint.y + uy * startPadding,\n };\n\n const end: IAnnotationPoint = {\n x: resolved.anchor.x - ux * endPadding,\n y: resolved.anchor.y - uy * endPadding,\n };\n\n connectors.push({\n key: `${key}-connector`,\n start,\n end,\n strokeColor,\n strokeWidth,\n dashArray,\n arrow,\n markerSize,\n markerStrokeWidth,\n });\n }\n });\n\n if (annotationForeignObjects.length === 0 && connectors.length === 0) {\n return null;\n }\n\n const viewBoxWidth = context.svgRect.width || 1;\n const viewBoxHeight = context.svgRect.height || 1;\n\n const markerDefs: React.ReactNode[] = [];\n\n const createMarkerId = (color: string, position: 'start' | 'end', size: number, markerStrokeWidth: number) => {\n const id = `${idPrefix}-${position}-${markerDefs.length}`;\n const refY = size / 2;\n const refX = position === 'end' ? size : 0;\n const pathEnd = `M0 0 L ${size} ${refY} L0 ${size} Z`;\n const pathStart = `M ${size} 0 L0 ${refY} L ${size} ${size} Z`;\n const path = position === 'end' ? pathEnd : pathStart;\n\n markerDefs.push(\n <marker\n key={id}\n id={id}\n markerWidth={size}\n markerHeight={size}\n viewBox={`0 0 ${size} ${size}`}\n refX={refX}\n refY={refY}\n orient=\"auto\"\n markerUnits=\"userSpaceOnUse\"\n >\n <path\n d={path}\n fill={color}\n stroke={color}\n strokeWidth={markerStrokeWidth}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </marker>,\n );\n\n return id;\n };\n\n const connectorElements = connectors.map(connector => {\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n\n if (connector.arrow === 'start' || connector.arrow === 'both') {\n markerStart = createMarkerId(connector.strokeColor, 'start', connector.markerSize, connector.markerStrokeWidth);\n }\n if (connector.arrow === 'end' || connector.arrow === 'both') {\n markerEnd = createMarkerId(connector.strokeColor, 'end', connector.markerSize, connector.markerStrokeWidth);\n }\n\n return (\n <line\n key={connector.key}\n x1={connector.start.x}\n y1={connector.start.y}\n x2={connector.end.x}\n y2={connector.end.y}\n stroke={connector.strokeColor}\n strokeWidth={connector.strokeWidth}\n strokeDasharray={connector.dashArray}\n strokeLinecap=\"round\"\n markerStart={markerStart ? `url(#${markerStart})` : undefined}\n markerEnd={markerEnd ? `url(#${markerEnd})` : undefined}\n />\n );\n });\n\n const shouldRenderSvg = connectors.length > 0 || annotationForeignObjects.length > 0;\n return (\n <div className={classNames.root} role=\"presentation\" data-chart-annotation-layer=\"true\">\n {shouldRenderSvg && (\n <svg\n className={classNames.connectorLayer}\n width=\"100%\"\n height=\"100%\"\n viewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}\n preserveAspectRatio=\"none\"\n data-chart-annotation-svg=\"true\"\n >\n {markerDefs.length > 0 && <defs>{markerDefs}</defs>}\n {connectorElements.length > 0 && (\n <g aria-hidden=\"true\" className={classNames.connectorGroup}>\n {connectorElements}\n </g>\n )}\n {annotationForeignObjects}\n </svg>\n )}\n {measurementElements}\n </div>\n );\n});\n\nChartAnnotationLayer.displayName = 'ChartAnnotationLayer';\n"]}
@@ -0,0 +1,28 @@
1
+ import { ITheme, IStyle } from '@fluentui/react/lib/Styling';
2
+ import { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';
3
+ export interface IChartAnnotationLayerStyleProps {
4
+ theme: ITheme;
5
+ className?: string;
6
+ }
7
+ import { ChartAnnotationArrowHead } from '../../../types/IChartAnnotation';
8
+ export interface IChartAnnotationLayerStyles {
9
+ root?: IStyle;
10
+ annotation?: IStyle;
11
+ connectorLayer?: IStyle;
12
+ measurement?: IStyle;
13
+ annotationContent?: IStyle;
14
+ annotationForeignObject?: IStyle;
15
+ annotationContentInteractive?: IStyle;
16
+ annotationForeignObjectInteractive?: IStyle;
17
+ connectorGroup?: IStyle;
18
+ }
19
+ export declare const DEFAULT_ANNOTATION_BACKGROUND_OPACITY = 0.8;
20
+ export declare const DEFAULT_ANNOTATION_PADDING = "4px 8px";
21
+ export declare const DEFAULT_CONNECTOR_START_PADDING = 12;
22
+ export declare const DEFAULT_CONNECTOR_END_PADDING = 0;
23
+ export declare const DEFAULT_CONNECTOR_STROKE_WIDTH = 2;
24
+ export declare const DEFAULT_CONNECTOR_ARROW: ChartAnnotationArrowHead;
25
+ export declare const applyOpacityToColor: (color: string | undefined, opacity: number) => string | undefined;
26
+ export declare const getDefaultAnnotationBackgroundColor: (theme: ITheme) => string | undefined;
27
+ export declare const getDefaultConnectorStrokeColor: (theme: ITheme) => string;
28
+ export declare const getStyles: IStyleFunctionOrObject<IChartAnnotationLayerStyleProps, IChartAnnotationLayerStyles>;