@fluentui/react-charting 5.25.1 → 5.25.3

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 (285) hide show
  1. package/CHANGELOG.json +123 -1
  2. package/CHANGELOG.md +34 -2
  3. package/dist/react-charting.d.ts +48 -45
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +24 -11
  7. package/lib/AnnotationOnlyChart.d.ts +1 -0
  8. package/lib/AnnotationOnlyChart.js +2 -0
  9. package/lib/AnnotationOnlyChart.js.map +1 -0
  10. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.d.ts +3 -0
  11. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +158 -0
  12. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  13. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.d.ts +33 -0
  14. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +2 -0
  15. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  16. package/lib/components/AnnotationOnlyChart/index.d.ts +2 -0
  17. package/lib/components/AnnotationOnlyChart/index.js +3 -0
  18. package/lib/components/AnnotationOnlyChart/index.js.map +1 -0
  19. package/lib/components/AreaChart/AreaChart.base.js +2 -2
  20. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  21. package/lib/components/ChartTable/ChartTable.base.js +5 -3
  22. package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
  23. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +1 -1
  24. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +18 -14
  25. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  26. package/lib/components/CommonComponents/Annotations/index.d.ts +2 -0
  27. package/lib/components/CommonComponents/Annotations/index.js +3 -0
  28. package/lib/components/CommonComponents/Annotations/index.js.map +1 -0
  29. package/lib/components/CommonComponents/CartesianChart.base.d.ts +6 -1
  30. package/lib/components/CommonComponents/CartesianChart.base.js +131 -157
  31. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  32. package/lib/components/CommonComponents/CartesianChart.types.d.ts +11 -2
  33. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  34. package/lib/components/DeclarativeChart/DeclarativeChart.js +85 -51
  35. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  36. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +12 -4
  37. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  38. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  39. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +176 -63
  40. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  41. package/lib/components/DonutChart/DonutChart.base.js +5 -3
  42. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  43. package/lib/components/FunnelChart/FunnelChart.base.js +15 -18
  44. package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
  45. package/lib/components/GanttChart/GanttChart.base.js +6 -6
  46. package/lib/components/GanttChart/GanttChart.base.js.map +1 -1
  47. package/lib/components/GanttChart/GanttChart.types.d.ts +0 -11
  48. package/lib/components/GanttChart/GanttChart.types.js.map +1 -1
  49. package/lib/components/GaugeChart/GaugeChart.base.js +5 -3
  50. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  51. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +11 -6
  52. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  53. package/lib/components/HeatMapChart/HeatMapChart.base.js +3 -3
  54. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  55. package/lib/components/HeatMapChart/HeatMapChart.types.d.ts +0 -9
  56. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  57. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  58. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +4 -4
  59. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  60. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +0 -9
  61. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  62. package/lib/components/Legends/Legends.base.d.ts +1 -1
  63. package/lib/components/Legends/Legends.base.js +6 -2
  64. package/lib/components/Legends/Legends.base.js.map +1 -1
  65. package/lib/components/Legends/Legends.types.d.ts +1 -1
  66. package/lib/components/Legends/Legends.types.js.map +1 -1
  67. package/lib/components/LineChart/LineChart.base.js +3 -3
  68. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  69. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  70. package/lib/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
  71. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  72. package/lib/components/SankeyChart/SankeyChart.base.js +5 -3
  73. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  74. package/lib/components/ScatterChart/ScatterChart.base.js +41 -31
  75. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  76. package/lib/components/ScatterChart/ScatterChart.types.d.ts +0 -4
  77. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  78. package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  79. package/lib/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  80. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +6 -4
  81. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  82. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +22 -10
  83. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  84. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +0 -9
  85. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  86. package/lib/index.d.ts +2 -0
  87. package/lib/index.js +1 -0
  88. package/lib/index.js.map +1 -1
  89. package/lib/types/IChartAnnotation.d.ts +2 -0
  90. package/lib/types/IChartAnnotation.js.map +1 -1
  91. package/lib/utilities/image-export-utils.d.ts +7 -2
  92. package/lib/utilities/image-export-utils.js +176 -86
  93. package/lib/utilities/image-export-utils.js.map +1 -1
  94. package/lib/utilities/utilities.d.ts +5 -4
  95. package/lib/utilities/utilities.js +18 -17
  96. package/lib/utilities/utilities.js.map +1 -1
  97. package/lib-amd/AnnotationOnlyChart.d.ts +1 -0
  98. package/lib-amd/AnnotationOnlyChart.js +6 -0
  99. package/lib-amd/AnnotationOnlyChart.js.map +1 -0
  100. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.d.ts +3 -0
  101. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js +159 -0
  102. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  103. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.types.d.ts +33 -0
  104. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +5 -0
  105. package/lib-amd/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  106. package/lib-amd/components/AnnotationOnlyChart/index.d.ts +2 -0
  107. package/lib-amd/components/AnnotationOnlyChart/index.js +7 -0
  108. package/lib-amd/components/AnnotationOnlyChart/index.js.map +1 -0
  109. package/lib-amd/components/AreaChart/AreaChart.base.js +1 -1
  110. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  111. package/lib-amd/components/ChartTable/ChartTable.base.js +4 -2
  112. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  113. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +1 -1
  114. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +18 -14
  115. package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  116. package/lib-amd/components/CommonComponents/Annotations/index.d.ts +2 -0
  117. package/lib-amd/components/CommonComponents/Annotations/index.js +7 -0
  118. package/lib-amd/components/CommonComponents/Annotations/index.js.map +1 -0
  119. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +6 -1
  120. package/lib-amd/components/CommonComponents/CartesianChart.base.js +131 -157
  121. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  122. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +11 -2
  123. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  124. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +80 -50
  125. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  126. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +12 -4
  127. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  128. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  129. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +178 -64
  130. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  131. package/lib-amd/components/DonutChart/DonutChart.base.js +4 -2
  132. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  133. package/lib-amd/components/FunnelChart/FunnelChart.base.js +13 -16
  134. package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
  135. package/lib-amd/components/GanttChart/GanttChart.base.js +5 -5
  136. package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -1
  137. package/lib-amd/components/GanttChart/GanttChart.types.d.ts +0 -11
  138. package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -1
  139. package/lib-amd/components/GaugeChart/GaugeChart.base.js +4 -2
  140. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  141. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +10 -6
  142. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  143. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +2 -2
  144. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  145. package/lib-amd/components/HeatMapChart/HeatMapChart.types.d.ts +0 -9
  146. package/lib-amd/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  147. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  148. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +3 -3
  149. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  150. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +0 -9
  151. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  152. package/lib-amd/components/Legends/Legends.base.d.ts +1 -1
  153. package/lib-amd/components/Legends/Legends.base.js +6 -2
  154. package/lib-amd/components/Legends/Legends.base.js.map +1 -1
  155. package/lib-amd/components/Legends/Legends.types.d.ts +1 -1
  156. package/lib-amd/components/Legends/Legends.types.js.map +1 -1
  157. package/lib-amd/components/LineChart/LineChart.base.js +2 -2
  158. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  159. package/lib-amd/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  160. package/lib-amd/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
  161. package/lib-amd/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  162. package/lib-amd/components/SankeyChart/SankeyChart.base.js +4 -2
  163. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  164. package/lib-amd/components/ScatterChart/ScatterChart.base.js +39 -29
  165. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  166. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +0 -4
  167. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
  168. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  169. package/lib-amd/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  170. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +5 -3
  171. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  172. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +20 -8
  173. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  174. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +0 -9
  175. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  176. package/lib-amd/index.d.ts +2 -0
  177. package/lib-amd/index.js +3 -2
  178. package/lib-amd/index.js.map +1 -1
  179. package/lib-amd/types/IChartAnnotation.d.ts +2 -0
  180. package/lib-amd/types/IChartAnnotation.js.map +1 -1
  181. package/lib-amd/utilities/image-export-utils.d.ts +7 -2
  182. package/lib-amd/utilities/image-export-utils.js +175 -85
  183. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  184. package/lib-amd/utilities/utilities.d.ts +5 -4
  185. package/lib-amd/utilities/utilities.js +18 -17
  186. package/lib-amd/utilities/utilities.js.map +1 -1
  187. package/lib-commonjs/AnnotationOnlyChart.d.ts +1 -0
  188. package/lib-commonjs/AnnotationOnlyChart.js +5 -0
  189. package/lib-commonjs/AnnotationOnlyChart.js.map +1 -0
  190. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.d.ts +3 -0
  191. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +162 -0
  192. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -0
  193. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.d.ts +33 -0
  194. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +3 -0
  195. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -0
  196. package/lib-commonjs/components/AnnotationOnlyChart/index.d.ts +2 -0
  197. package/lib-commonjs/components/AnnotationOnlyChart/index.js +6 -0
  198. package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +1 -0
  199. package/lib-commonjs/components/AreaChart/AreaChart.base.js +1 -1
  200. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  201. package/lib-commonjs/components/ChartTable/ChartTable.base.js +4 -2
  202. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  203. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +1 -1
  204. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +18 -14
  205. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  206. package/lib-commonjs/components/CommonComponents/Annotations/index.d.ts +2 -0
  207. package/lib-commonjs/components/CommonComponents/Annotations/index.js +6 -0
  208. package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +1 -0
  209. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +6 -1
  210. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +131 -157
  211. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  212. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +11 -2
  213. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  214. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +83 -49
  215. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  216. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +12 -4
  217. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  218. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  219. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +178 -64
  220. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  221. package/lib-commonjs/components/DonutChart/DonutChart.base.js +4 -2
  222. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  223. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js +13 -16
  224. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
  225. package/lib-commonjs/components/GanttChart/GanttChart.base.js +5 -5
  226. package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -1
  227. package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +0 -11
  228. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -1
  229. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +4 -2
  230. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  231. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +10 -5
  232. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  233. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +2 -2
  234. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  235. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.d.ts +0 -9
  236. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -1
  237. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  238. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +3 -3
  239. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  240. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +0 -9
  241. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  242. package/lib-commonjs/components/Legends/Legends.base.d.ts +1 -1
  243. package/lib-commonjs/components/Legends/Legends.base.js +6 -2
  244. package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
  245. package/lib-commonjs/components/Legends/Legends.types.d.ts +1 -1
  246. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  247. package/lib-commonjs/components/LineChart/LineChart.base.js +2 -2
  248. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  249. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  250. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +1 -1
  251. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  252. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +4 -2
  253. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  254. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +39 -29
  255. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  256. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +0 -4
  257. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  258. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  259. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  260. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +5 -3
  261. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  262. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +20 -8
  263. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  264. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +0 -9
  265. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  266. package/lib-commonjs/index.d.ts +2 -0
  267. package/lib-commonjs/index.js +3 -1
  268. package/lib-commonjs/index.js.map +1 -1
  269. package/lib-commonjs/types/IChartAnnotation.d.ts +2 -0
  270. package/lib-commonjs/types/IChartAnnotation.js.map +1 -1
  271. package/lib-commonjs/utilities/image-export-utils.d.ts +7 -2
  272. package/lib-commonjs/utilities/image-export-utils.js +175 -85
  273. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  274. package/lib-commonjs/utilities/utilities.d.ts +5 -4
  275. package/lib-commonjs/utilities/utilities.js +18 -17
  276. package/lib-commonjs/utilities/utilities.js.map +1 -1
  277. package/package.json +5 -5
  278. package/src/components/AnnotationOnlyChart/AnnotationOnlyChart.types.ts +34 -0
  279. package/src/components/CommonComponents/CartesianChart.types.ts +12 -1
  280. package/src/components/GanttChart/GanttChart.types.ts +0 -13
  281. package/src/components/HeatMapChart/HeatMapChart.types.ts +0 -11
  282. package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +0 -11
  283. package/src/components/Legends/Legends.types.ts +1 -1
  284. package/src/components/ScatterChart/ScatterChart.types.ts +0 -5
  285. package/src/components/VerticalStackedBarChart/VerticalStackedBarChart.types.ts +0 -11
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GanttChart = exports.withResponsiveContainer = exports.ResponsiveContainer = exports.DeclarativeChart = exports.GaugeValueFormat = exports.GaugeChartVariant = exports.GaugeChart = exports.getNextGradient = exports.getGradientFromToken = exports.DataVizGradientPalette = exports.getNextColor = exports.getColorFromToken = exports.DataVizPalette = exports.FunnelChart = exports.HorizontalBarChartWithAxis = exports.ChartTable = exports.Sparkline = exports.TreeTraverse = exports.TreeChart = exports.NodesComposition = exports.SankeyChart = exports.HeatMapChart = exports.getChartHoverCardStyles = exports.ChartHoverCard = exports.CartesianChart = exports.GroupedVerticalBarChart = exports.VerticalStackedBarChart = exports.VerticalBarChart = exports.StackedBarChart = exports.MultiStackedBarChartVariant = exports.MultiStackedBarChart = exports.PieChart = exports.AreaChart = exports.ScatterChart = exports.Textbox = exports.LineChart = exports.Shape = exports.Legends = exports.DonutChart = exports.HorizontalBarChartVariant = exports.HorizontalBarChart = void 0;
3
+ exports.GanttChart = exports.withResponsiveContainer = exports.ResponsiveContainer = exports.AnnotationOnlyChart = exports.DeclarativeChart = exports.GaugeValueFormat = exports.GaugeChartVariant = exports.GaugeChart = exports.getNextGradient = exports.getGradientFromToken = exports.DataVizGradientPalette = exports.getNextColor = exports.getColorFromToken = exports.DataVizPalette = exports.FunnelChart = exports.HorizontalBarChartWithAxis = exports.ChartTable = exports.Sparkline = exports.TreeTraverse = exports.TreeChart = exports.NodesComposition = exports.SankeyChart = exports.HeatMapChart = exports.getChartHoverCardStyles = exports.ChartHoverCard = exports.CartesianChart = exports.GroupedVerticalBarChart = exports.VerticalStackedBarChart = exports.VerticalBarChart = exports.StackedBarChart = exports.MultiStackedBarChartVariant = exports.MultiStackedBarChart = exports.PieChart = exports.AreaChart = exports.ScatterChart = exports.Textbox = exports.LineChart = exports.Shape = exports.Legends = exports.DonutChart = exports.HorizontalBarChartVariant = exports.HorizontalBarChart = void 0;
4
4
  var HorizontalBarChart_1 = require("./HorizontalBarChart");
5
5
  Object.defineProperty(exports, "HorizontalBarChart", { enumerable: true, get: function () { return HorizontalBarChart_1.HorizontalBarChart; } });
6
6
  Object.defineProperty(exports, "HorizontalBarChartVariant", { enumerable: true, get: function () { return HorizontalBarChart_1.HorizontalBarChartVariant; } });
@@ -63,6 +63,8 @@ Object.defineProperty(exports, "GaugeChartVariant", { enumerable: true, get: fun
63
63
  Object.defineProperty(exports, "GaugeValueFormat", { enumerable: true, get: function () { return GaugeChart_1.GaugeValueFormat; } });
64
64
  var DeclarativeChart_1 = require("./DeclarativeChart");
65
65
  Object.defineProperty(exports, "DeclarativeChart", { enumerable: true, get: function () { return DeclarativeChart_1.DeclarativeChart; } });
66
+ var AnnotationOnlyChart_1 = require("./AnnotationOnlyChart");
67
+ Object.defineProperty(exports, "AnnotationOnlyChart", { enumerable: true, get: function () { return AnnotationOnlyChart_1.AnnotationOnlyChart; } });
66
68
  var ResponsiveContainer_1 = require("./ResponsiveContainer");
67
69
  Object.defineProperty(exports, "ResponsiveContainer", { enumerable: true, get: function () { return ResponsiveContainer_1.ResponsiveContainer; } });
68
70
  Object.defineProperty(exports, "withResponsiveContainer", { enumerable: true, get: function () { return ResponsiveContainer_1.withResponsiveContainer; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;AAMA,2DAAqF;AAA5E,wHAAA,kBAAkB,OAAA;AAAE,+HAAA,yBAAyB,OAAA;AAEtD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAWnB,qCAA2C;AAAlC,kGAAA,OAAO,OAAA;AAAE,gGAAA,KAAK,OAAA;AASvB,yCAAiD;AAAxC,sGAAA,SAAS,OAAA;AAAE,oGAAA,OAAO,OAAA;AAC3B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAUjB,qDAAuG;AAA9F,uHAAA,oBAAoB,OAAA;AAAE,8HAAA,2BAA2B,OAAA;AAAE,kHAAA,eAAe,OAAA;AAE3E,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAMzB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAMhC,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAShC,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AA4DvB,0DAA2F;AAAlF,uGAAA,cAAc,OAAA;AAAE,gHAAA,uBAAuB,OAAA;AAEhD,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAQrB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AASpB,yCAAwE;AAA/D,6GAAA,gBAAgB,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,yGAAA,YAAY,OAAA;AAElD,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAMnB,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AAEnC,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,6CAAqF;AAA5E,wGAAA,cAAc,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,sGAAA,YAAY,OAAA;AACxD,mDAAsG;AAA7F,mHAAA,sBAAsB,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAEtE,2CAA+E;AAAtE,wGAAA,UAAU,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAExD,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAEzB,6DAAqF;AAA5E,0HAAA,mBAAmB,OAAA;AAAE,8HAAA,uBAAuB,OAAA;AAGrD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAEnB,qBAAmB","sourcesContent":["export type {\n ChartDataMode,\n IHorizontalBarChartProps,\n IHorizontalBarChartStyleProps,\n IHorizontalBarChartStyles,\n} from './HorizontalBarChart';\nexport { HorizontalBarChart, HorizontalBarChartVariant } from './HorizontalBarChart';\nexport type { IDonutChart, IDonutChartProps, IDonutChartStyleProps, IDonutChartStyles } from './DonutChart';\nexport { DonutChart } from './DonutChart';\nexport type {\n ILegend,\n ILegendOverflowData,\n ILegendStyleProps,\n ILegendSubComponentStyles,\n ILegendsProps,\n ILegendsStyles,\n IShapeProps,\n LegendShape,\n} from './Legends';\nexport { Legends, Shape } from './Legends';\nexport type {\n IColorFillBarData,\n IColorFillBarsProps,\n IEventsAnnotationProps,\n ILineChartProps,\n ILineChartStyleProps,\n ILineChartStyles,\n} from './LineChart';\nexport { LineChart, Textbox } from './LineChart';\nexport { ScatterChart } from './ScatterChart';\nexport type { IAreaChartProps, IAreaChartStyleProps, IAreaChartStyles } from './AreaChart';\nexport { AreaChart } from './AreaChart';\nexport type { IPieChart, IPieChartProps, IPieChartStyleProps, IPieChartStyles } from './PieChart';\nexport { PieChart } from './PieChart';\nexport type {\n IMultiStackedBarChartProps,\n IMultiStackedBarChartStyleProps,\n IMultiStackedBarChartStyles,\n IStackedBarChart,\n IStackedBarChartProps,\n IStackedBarChartStyleProps,\n IStackedBarChartStyles,\n} from './StackedBarChart';\nexport { MultiStackedBarChart, MultiStackedBarChartVariant, StackedBarChart } from './StackedBarChart';\nexport type { IVerticalBarChartProps, IVerticalBarChartStyleProps, IVerticalBarChartStyles } from './VerticalBarChart';\nexport { VerticalBarChart } from './VerticalBarChart';\nexport type {\n IVerticalStackedBarChartProps,\n IVerticalStackedBarChartStyleProps,\n IVerticalStackedBarChartStyles,\n} from './VerticalStackedBarChart';\nexport { VerticalStackedBarChart } from './VerticalStackedBarChart';\nexport type {\n IGroupedVerticalBarChartProps,\n IGroupedVerticalBarChartStyleProps,\n IGroupedVerticalBarChartStyles,\n} from './GroupedVerticalBarChart';\nexport { GroupedVerticalBarChart } from './GroupedVerticalBarChart';\nexport type {\n ICartesianChartProps,\n ICartesianChartStyleProps,\n ICartesianChartStyles,\n IChildProps,\n IModifiedCartesianChartProps,\n IYValueHover,\n} from './CartesianChart';\nexport { CartesianChart } from './CartesianChart';\nexport type {\n IAccessibilityProps,\n IBasestate,\n IChartDataPoint,\n IChartProps,\n ICustomizedCalloutData,\n ICustomizedCalloutDataPoint,\n IDataPoint,\n IGVBarChartSeriesPoint,\n IGVDataPoint,\n IGVForBarChart,\n IGVSingleDataPoint,\n IGroupedVerticalBarChartData,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IHorizontalBarChartWithAxisDataPoint,\n IHorizontalDataPoint,\n ILegendDataItem,\n ILineChartDataPoint,\n ILineChartGap,\n ILineChartLineOptions,\n ILineChartPoints,\n ILineDataInVerticalBarChart,\n ILineDataInVerticalStackedBarChart,\n IMargins,\n IRefArrayData,\n ISankeyChartData,\n IVSChartDataPoint,\n IVerticalBarChartDataPoint,\n IVerticalStackedBarDataPoint,\n IVerticalStackedChartProps,\n SLink,\n SNode,\n IChart,\n IImageExportOptions,\n IScatterChartPoints,\n IScatterChartDataPoint,\n IBaseDataPoint,\n AxisCategoryOrder,\n IGanttChartDataPoint,\n AxisScaleType,\n AxisProps,\n IDataPointV2,\n IDataSeries,\n IBarSeries,\n ILineSeries,\n IChartAnnotation as ChartAnnotation,\n ChartAnnotationCoordinate,\n IChartAnnotationConnectorProps as ChartAnnotationConnectorProps,\n ChartAnnotationArrowHead,\n IChartAnnotationLayoutProps as ChartAnnotationLayoutProps,\n IChartAnnotationStyleProps as ChartAnnotationStyleProps,\n IChartAnnotationAccessibilityProps as ChartAnnotationAccessibilityProps,\n} from './types/index';\nexport type {\n IChartHoverCardProps,\n IChartHoverCardStyleProps,\n IChartHoverCardStyles,\n} from './utilities/ChartHoverCard/index';\nexport { ChartHoverCard, getChartHoverCardStyles } from './utilities/ChartHoverCard/index';\nexport type { IHeatMapChartProps, IHeatMapChartStyleProps, IHeatMapChartStyles } from './HeatMapChart';\nexport { HeatMapChart } from './HeatMapChart';\nexport type {\n ISankeyChartAccessibilityProps,\n ISankeyChartProps,\n ISankeyChartStrings,\n ISankeyChartStyleProps,\n ISankeyChartStyles,\n} from './SankeyChart';\nexport { SankeyChart } from './SankeyChart';\nexport type {\n ITreeChartDataPoint,\n ITreeDataStructure,\n ITreeProps,\n ITreeState,\n ITreeStyleProps,\n ITreeStyles,\n} from './TreeChart';\nexport { NodesComposition, TreeChart, TreeTraverse } from './TreeChart';\nexport type { ISparklineProps, ISparklineStyleProps, ISparklineStyles } from './Sparkline';\nexport { Sparkline } from './Sparkline';\nexport type { IChartTableProps, IChartTableStyleProps, IChartTableStyles } from './ChartTable';\nexport { ChartTable } from './ChartTable';\nexport type {\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisStyleProps,\n IHorizontalBarChartWithAxisStyles,\n} from './HorizontalBarChartWithAxis';\nexport { HorizontalBarChartWithAxis } from './HorizontalBarChartWithAxis';\nexport type { IFunnelChartProps, IFunnelChartStyleProps, IFunnelChartStyles } from './FunnelChart';\nexport { FunnelChart } from './FunnelChart';\nexport { DataVizPalette, getColorFromToken, getNextColor } from './utilities/colors';\nexport { DataVizGradientPalette, getGradientFromToken, getNextGradient } from './utilities/gradients';\nexport type { IGaugeChartProps, IGaugeChartSegment, IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart';\nexport { GaugeChart, GaugeChartVariant, GaugeValueFormat } from './GaugeChart';\nexport type { DeclarativeChartProps, Schema, IDeclarativeChart } from './DeclarativeChart';\nexport { DeclarativeChart } from './DeclarativeChart';\nexport type { IResponsiveContainerProps, IResponsiveChildProps } from './ResponsiveContainer';\nexport { ResponsiveContainer, withResponsiveContainer } from './ResponsiveContainer';\nexport type { IScatterChartProps, IScatterChartStyleProps, IScatterChartStyles } from './ScatterChart';\nexport type { IGanttChartProps, IGanttChartStyleProps, IGanttChartStyles } from './GanttChart';\nexport { GanttChart } from './GanttChart';\n\nimport './version';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":";;;AAMA,2DAAqF;AAA5E,wHAAA,kBAAkB,OAAA;AAAE,+HAAA,yBAAyB,OAAA;AAEtD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAWnB,qCAA2C;AAAlC,kGAAA,OAAO,OAAA;AAAE,gGAAA,KAAK,OAAA;AASvB,yCAAiD;AAAxC,sGAAA,SAAS,OAAA;AAAE,oGAAA,OAAO,OAAA;AAC3B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAUjB,qDAAuG;AAA9F,uHAAA,oBAAoB,OAAA;AAAE,8HAAA,2BAA2B,OAAA;AAAE,kHAAA,eAAe,OAAA;AAE3E,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAMzB,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAMhC,qEAAoE;AAA3D,kIAAA,uBAAuB,OAAA;AAShC,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AA4DvB,0DAA2F;AAAlF,uGAAA,cAAc,OAAA;AAAE,gHAAA,uBAAuB,OAAA;AAEhD,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAQrB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AASpB,yCAAwE;AAA/D,6GAAA,gBAAgB,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,yGAAA,YAAY,OAAA;AAElD,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAMnB,2EAA0E;AAAjE,wIAAA,0BAA0B,OAAA;AAEnC,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,6CAAqF;AAA5E,wGAAA,cAAc,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,sGAAA,YAAY,OAAA;AACxD,mDAAsG;AAA7F,mHAAA,sBAAsB,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AAAE,4GAAA,eAAe,OAAA;AAEtE,2CAA+E;AAAtE,wGAAA,UAAU,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAExD,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAEzB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAE5B,6DAAqF;AAA5E,0HAAA,mBAAmB,OAAA;AAAE,8HAAA,uBAAuB,OAAA;AAGrD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAEnB,qBAAmB","sourcesContent":["export type {\n ChartDataMode,\n IHorizontalBarChartProps,\n IHorizontalBarChartStyleProps,\n IHorizontalBarChartStyles,\n} from './HorizontalBarChart';\nexport { HorizontalBarChart, HorizontalBarChartVariant } from './HorizontalBarChart';\nexport type { IDonutChart, IDonutChartProps, IDonutChartStyleProps, IDonutChartStyles } from './DonutChart';\nexport { DonutChart } from './DonutChart';\nexport type {\n ILegend,\n ILegendOverflowData,\n ILegendStyleProps,\n ILegendSubComponentStyles,\n ILegendsProps,\n ILegendsStyles,\n IShapeProps,\n LegendShape,\n} from './Legends';\nexport { Legends, Shape } from './Legends';\nexport type {\n IColorFillBarData,\n IColorFillBarsProps,\n IEventsAnnotationProps,\n ILineChartProps,\n ILineChartStyleProps,\n ILineChartStyles,\n} from './LineChart';\nexport { LineChart, Textbox } from './LineChart';\nexport { ScatterChart } from './ScatterChart';\nexport type { IAreaChartProps, IAreaChartStyleProps, IAreaChartStyles } from './AreaChart';\nexport { AreaChart } from './AreaChart';\nexport type { IPieChart, IPieChartProps, IPieChartStyleProps, IPieChartStyles } from './PieChart';\nexport { PieChart } from './PieChart';\nexport type {\n IMultiStackedBarChartProps,\n IMultiStackedBarChartStyleProps,\n IMultiStackedBarChartStyles,\n IStackedBarChart,\n IStackedBarChartProps,\n IStackedBarChartStyleProps,\n IStackedBarChartStyles,\n} from './StackedBarChart';\nexport { MultiStackedBarChart, MultiStackedBarChartVariant, StackedBarChart } from './StackedBarChart';\nexport type { IVerticalBarChartProps, IVerticalBarChartStyleProps, IVerticalBarChartStyles } from './VerticalBarChart';\nexport { VerticalBarChart } from './VerticalBarChart';\nexport type {\n IVerticalStackedBarChartProps,\n IVerticalStackedBarChartStyleProps,\n IVerticalStackedBarChartStyles,\n} from './VerticalStackedBarChart';\nexport { VerticalStackedBarChart } from './VerticalStackedBarChart';\nexport type {\n IGroupedVerticalBarChartProps,\n IGroupedVerticalBarChartStyleProps,\n IGroupedVerticalBarChartStyles,\n} from './GroupedVerticalBarChart';\nexport { GroupedVerticalBarChart } from './GroupedVerticalBarChart';\nexport type {\n ICartesianChartProps,\n ICartesianChartStyleProps,\n ICartesianChartStyles,\n IChildProps,\n IModifiedCartesianChartProps,\n IYValueHover,\n} from './CartesianChart';\nexport { CartesianChart } from './CartesianChart';\nexport type {\n IAccessibilityProps,\n IBasestate,\n IChartDataPoint,\n IChartProps,\n ICustomizedCalloutData,\n ICustomizedCalloutDataPoint,\n IDataPoint,\n IGVBarChartSeriesPoint,\n IGVDataPoint,\n IGVForBarChart,\n IGVSingleDataPoint,\n IGroupedVerticalBarChartData,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IHorizontalBarChartWithAxisDataPoint,\n IHorizontalDataPoint,\n ILegendDataItem,\n ILineChartDataPoint,\n ILineChartGap,\n ILineChartLineOptions,\n ILineChartPoints,\n ILineDataInVerticalBarChart,\n ILineDataInVerticalStackedBarChart,\n IMargins,\n IRefArrayData,\n ISankeyChartData,\n IVSChartDataPoint,\n IVerticalBarChartDataPoint,\n IVerticalStackedBarDataPoint,\n IVerticalStackedChartProps,\n SLink,\n SNode,\n IChart,\n IImageExportOptions,\n IScatterChartPoints,\n IScatterChartDataPoint,\n IBaseDataPoint,\n AxisCategoryOrder,\n IGanttChartDataPoint,\n AxisScaleType,\n AxisProps,\n IDataPointV2,\n IDataSeries,\n IBarSeries,\n ILineSeries,\n IChartAnnotation as ChartAnnotation,\n ChartAnnotationCoordinate,\n IChartAnnotationConnectorProps as ChartAnnotationConnectorProps,\n ChartAnnotationArrowHead,\n IChartAnnotationLayoutProps as ChartAnnotationLayoutProps,\n IChartAnnotationStyleProps as ChartAnnotationStyleProps,\n IChartAnnotationAccessibilityProps as ChartAnnotationAccessibilityProps,\n} from './types/index';\nexport type {\n IChartHoverCardProps,\n IChartHoverCardStyleProps,\n IChartHoverCardStyles,\n} from './utilities/ChartHoverCard/index';\nexport { ChartHoverCard, getChartHoverCardStyles } from './utilities/ChartHoverCard/index';\nexport type { IHeatMapChartProps, IHeatMapChartStyleProps, IHeatMapChartStyles } from './HeatMapChart';\nexport { HeatMapChart } from './HeatMapChart';\nexport type {\n ISankeyChartAccessibilityProps,\n ISankeyChartProps,\n ISankeyChartStrings,\n ISankeyChartStyleProps,\n ISankeyChartStyles,\n} from './SankeyChart';\nexport { SankeyChart } from './SankeyChart';\nexport type {\n ITreeChartDataPoint,\n ITreeDataStructure,\n ITreeProps,\n ITreeState,\n ITreeStyleProps,\n ITreeStyles,\n} from './TreeChart';\nexport { NodesComposition, TreeChart, TreeTraverse } from './TreeChart';\nexport type { ISparklineProps, ISparklineStyleProps, ISparklineStyles } from './Sparkline';\nexport { Sparkline } from './Sparkline';\nexport type { IChartTableProps, IChartTableStyleProps, IChartTableStyles } from './ChartTable';\nexport { ChartTable } from './ChartTable';\nexport type {\n IHorizontalBarChartWithAxisProps,\n IHorizontalBarChartWithAxisStyleProps,\n IHorizontalBarChartWithAxisStyles,\n} from './HorizontalBarChartWithAxis';\nexport { HorizontalBarChartWithAxis } from './HorizontalBarChartWithAxis';\nexport type { IFunnelChartProps, IFunnelChartStyleProps, IFunnelChartStyles } from './FunnelChart';\nexport { FunnelChart } from './FunnelChart';\nexport { DataVizPalette, getColorFromToken, getNextColor } from './utilities/colors';\nexport { DataVizGradientPalette, getGradientFromToken, getNextGradient } from './utilities/gradients';\nexport type { IGaugeChartProps, IGaugeChartSegment, IGaugeChartStyleProps, IGaugeChartStyles } from './GaugeChart';\nexport { GaugeChart, GaugeChartVariant, GaugeValueFormat } from './GaugeChart';\nexport type { DeclarativeChartProps, Schema, IDeclarativeChart } from './DeclarativeChart';\nexport { DeclarativeChart } from './DeclarativeChart';\nexport type { IAnnotationOnlyChartProps } from './AnnotationOnlyChart';\nexport { AnnotationOnlyChart } from './AnnotationOnlyChart';\nexport type { IResponsiveContainerProps, IResponsiveChildProps } from './ResponsiveContainer';\nexport { ResponsiveContainer, withResponsiveContainer } from './ResponsiveContainer';\nexport type { IScatterChartProps, IScatterChartStyleProps, IScatterChartStyles } from './ScatterChart';\nexport type { IGanttChartProps, IGanttChartStyleProps, IGanttChartStyles } from './GanttChart';\nexport { GanttChart } from './GanttChart';\n\nimport './version';\n"]}
@@ -70,6 +70,8 @@ export interface IChartAnnotationStyleProps {
70
70
  opacity?: number;
71
71
  /** Optional class name applied to the annotation element */
72
72
  className?: string;
73
+ /** Rotation, in degrees, applied to the annotation container */
74
+ rotation?: number;
73
75
  }
74
76
  export interface IChartAnnotationAccessibilityProps {
75
77
  /** Accessible label announced by assistive technologies */
@@ -1 +1 @@
1
- {"version":3,"file":"IChartAnnotation.js","sourceRoot":"../src/","sources":["types/IChartAnnotation.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport type ChartAnnotationCoordinate = {\n /** Cartesian data coordinates mapped through the chart scales or\n * Normalised coordinates within the plot area (0-1) or\n * Absolute pixel position relative to the chart's SVG origin\n */\n type: 'data' | 'relative' | 'pixel';\n /** x-axis value in the data domain */\n x: number | string | Date;\n /** y-axis value in the data domain */\n y: number | string | Date;\n /** Use the secondary y scale when available */\n yAxis?: 'primary' | 'secondary';\n};\n\nexport type ChartAnnotationHorizontalAlign = 'start' | 'center' | 'end';\nexport type ChartAnnotationVerticalAlign = 'top' | 'middle' | 'bottom';\n\nexport type ChartAnnotationArrowHead = 'none' | 'start' | 'end' | 'both';\n\nexport interface IChartAnnotationConnectorProps {\n /** Distance in pixels between the annotation element and the start of the connector. */\n startPadding?: number;\n /** Distance in pixels between the anchor point and the end of the connector. */\n endPadding?: number;\n /** Stroke colour for the connector. */\n strokeColor?: string;\n /** Stroke width in pixels. */\n strokeWidth?: number;\n /** SVG stroke dash array for dashed connectors. */\n dashArray?: string;\n /** Arrow head placement. Defaults to `'end'`. */\n arrow?: ChartAnnotationArrowHead;\n}\n\nexport interface IChartAnnotationLayoutProps {\n /** Horizontal alignment of the annotation relative to the anchor point */\n align?: ChartAnnotationHorizontalAlign;\n /** Vertical alignment of the annotation relative to the anchor point */\n verticalAlign?: ChartAnnotationVerticalAlign;\n /** Horizontal offset in pixels applied after alignment */\n offsetX?: number;\n /** Vertical offset in pixels applied after alignment */\n offsetY?: number;\n /** Optional maximum width for wrapped text */\n maxWidth?: number;\n /** Whether the annotation should remain inside the plot area */\n clipToBounds?: boolean;\n /** Additional CSS classes applied to the annotation wrapper */\n className?: string;\n}\n\nexport interface IChartAnnotationStyleProps {\n /** Text colour */\n textColor?: string;\n /** Background colour for the annotation container */\n backgroundColor?: string;\n /** Border colour */\n borderColor?: string;\n /** Border width */\n borderWidth?: number;\n /** Border style (solid, dashed, etc.) */\n borderStyle?: React.CSSProperties['borderStyle'];\n /** Border radius */\n borderRadius?: number;\n /** Box shadow applied to annotation */\n boxShadow?: string;\n /** Font size override */\n fontSize?: string;\n /** Font weight override */\n fontWeight?: React.CSSProperties['fontWeight'];\n /** Padding around the text. Accepts CSS shorthand notation */\n padding?: string;\n /** Opacity for the annotation container */\n opacity?: number;\n /** Optional class name applied to the annotation element */\n className?: string;\n}\n\nexport interface IChartAnnotationAccessibilityProps {\n /** Accessible label announced by assistive technologies */\n ariaLabel?: string;\n /** Accessible description id */\n ariaDescribedBy?: string;\n /** Custom role */\n role?: string;\n}\n\nexport interface IChartAnnotation {\n /** Optional id for React reconciliation */\n id?: string;\n /** Primary textual content */\n text: string;\n /** Coordinates describing where the annotation should be anchored */\n coordinates: ChartAnnotationCoordinate;\n /** Layout customisation */\n layout?: IChartAnnotationLayoutProps;\n /** Visual styling */\n style?: IChartAnnotationStyleProps;\n /** Optional connector line that links the annotation to its anchor. */\n connector?: IChartAnnotationConnectorProps;\n /** Accessibility metadata */\n accessibility?: IChartAnnotationAccessibilityProps;\n /** Optional application specific metadata */\n data?: Record<string, unknown>;\n}\n"]}
1
+ {"version":3,"file":"IChartAnnotation.js","sourceRoot":"../src/","sources":["types/IChartAnnotation.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport type ChartAnnotationCoordinate = {\n /** Cartesian data coordinates mapped through the chart scales or\n * Normalised coordinates within the plot area (0-1) or\n * Absolute pixel position relative to the chart's SVG origin\n */\n type: 'data' | 'relative' | 'pixel';\n /** x-axis value in the data domain */\n x: number | string | Date;\n /** y-axis value in the data domain */\n y: number | string | Date;\n /** Use the secondary y scale when available */\n yAxis?: 'primary' | 'secondary';\n};\n\nexport type ChartAnnotationHorizontalAlign = 'start' | 'center' | 'end';\nexport type ChartAnnotationVerticalAlign = 'top' | 'middle' | 'bottom';\n\nexport type ChartAnnotationArrowHead = 'none' | 'start' | 'end' | 'both';\n\nexport interface IChartAnnotationConnectorProps {\n /** Distance in pixels between the annotation element and the start of the connector. */\n startPadding?: number;\n /** Distance in pixels between the anchor point and the end of the connector. */\n endPadding?: number;\n /** Stroke colour for the connector. */\n strokeColor?: string;\n /** Stroke width in pixels. */\n strokeWidth?: number;\n /** SVG stroke dash array for dashed connectors. */\n dashArray?: string;\n /** Arrow head placement. Defaults to `'end'`. */\n arrow?: ChartAnnotationArrowHead;\n}\n\nexport interface IChartAnnotationLayoutProps {\n /** Horizontal alignment of the annotation relative to the anchor point */\n align?: ChartAnnotationHorizontalAlign;\n /** Vertical alignment of the annotation relative to the anchor point */\n verticalAlign?: ChartAnnotationVerticalAlign;\n /** Horizontal offset in pixels applied after alignment */\n offsetX?: number;\n /** Vertical offset in pixels applied after alignment */\n offsetY?: number;\n /** Optional maximum width for wrapped text */\n maxWidth?: number;\n /** Whether the annotation should remain inside the plot area */\n clipToBounds?: boolean;\n /** Additional CSS classes applied to the annotation wrapper */\n className?: string;\n}\n\nexport interface IChartAnnotationStyleProps {\n /** Text colour */\n textColor?: string;\n /** Background colour for the annotation container */\n backgroundColor?: string;\n /** Border colour */\n borderColor?: string;\n /** Border width */\n borderWidth?: number;\n /** Border style (solid, dashed, etc.) */\n borderStyle?: React.CSSProperties['borderStyle'];\n /** Border radius */\n borderRadius?: number;\n /** Box shadow applied to annotation */\n boxShadow?: string;\n /** Font size override */\n fontSize?: string;\n /** Font weight override */\n fontWeight?: React.CSSProperties['fontWeight'];\n /** Padding around the text. Accepts CSS shorthand notation */\n padding?: string;\n /** Opacity for the annotation container */\n opacity?: number;\n /** Optional class name applied to the annotation element */\n className?: string;\n /** Rotation, in degrees, applied to the annotation container */\n rotation?: number;\n}\n\nexport interface IChartAnnotationAccessibilityProps {\n /** Accessible label announced by assistive technologies */\n ariaLabel?: string;\n /** Accessible description id */\n ariaDescribedBy?: string;\n /** Custom role */\n role?: string;\n}\n\nexport interface IChartAnnotation {\n /** Optional id for React reconciliation */\n id?: string;\n /** Primary textual content */\n text: string;\n /** Coordinates describing where the annotation should be anchored */\n coordinates: ChartAnnotationCoordinate;\n /** Layout customisation */\n layout?: IChartAnnotationLayoutProps;\n /** Visual styling */\n style?: IChartAnnotationStyleProps;\n /** Optional connector line that links the annotation to its anchor. */\n connector?: IChartAnnotationConnectorProps;\n /** Accessibility metadata */\n accessibility?: IChartAnnotationAccessibilityProps;\n /** Optional application specific metadata */\n data?: Record<string, unknown>;\n}\n"]}
@@ -1,13 +1,18 @@
1
1
  import { IImageExportOptions } from '../types/index';
2
2
  import { ILegend, ILegendContainer } from '../Legends';
3
- export declare function toImage(chartContainer: HTMLElement | null | undefined, legendsToSvgCallback?: ILegendContainer['toSVG'], isRTL?: boolean, opts?: IImageExportOptions): Promise<string>;
3
+ export type GridChart = {
4
+ container: HTMLElement | null | undefined;
5
+ row?: number;
6
+ col?: number;
7
+ };
8
+ export declare function exportChartsAsImage(charts: GridChart[], legendsToSvg?: ILegendContainer['toSVG'], isRTL?: boolean, opts?: IImageExportOptions): Promise<string>;
4
9
  export declare function cloneLegendsToSVG(legends: ILegend[], svgWidth: number, config: {
5
10
  selectedLegends: Record<string, boolean>;
6
11
  centerLegends: boolean;
7
12
  textClassName: string;
8
13
  isRTL: boolean;
9
14
  }, legendContainer?: HTMLElement | null): {
10
- node: SVGGElement | null;
15
+ node: SVGSVGElement | null;
11
16
  width: number;
12
17
  height: number;
13
18
  };
@@ -1,44 +1,58 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toImage = toImage;
3
+ exports.exportChartsAsImage = exportChartsAsImage;
4
4
  exports.cloneLegendsToSVG = cloneLegendsToSVG;
5
5
  var tslib_1 = require("tslib");
6
6
  var d3_selection_1 = require("d3-selection");
7
7
  var index_1 = require("./index");
8
8
  var Legends_styles_1 = require("../components/Legends/Legends.styles");
9
- function toImage(chartContainer, legendsToSvgCallback, isRTL, opts) {
10
- if (isRTL === void 0) { isRTL = false; }
11
- if (opts === void 0) { opts = {}; }
12
- return new Promise(function (resolve, reject) {
13
- if (!chartContainer) {
14
- return reject(new Error('Chart container is not defined'));
15
- }
16
- try {
17
- var background = typeof opts.background === 'string' ? (0, index_1.resolveCSSVariables)(chartContainer, opts.background) : 'transparent';
18
- var svg = toSVG(chartContainer, legendsToSvgCallback, isRTL, background);
19
- if (!svg.node) {
20
- return reject(new Error('SVG node is null'));
9
+ function exportChartsAsImage(charts_1, legendsToSvg_1) {
10
+ return tslib_1.__awaiter(this, arguments, void 0, function (charts, legendsToSvg, isRTL, opts) {
11
+ var chartImages, grid, totalWidth_1, svg, svgDataUrl;
12
+ if (isRTL === void 0) { isRTL = false; }
13
+ if (opts === void 0) { opts = {}; }
14
+ return tslib_1.__generator(this, function (_a) {
15
+ switch (_a.label) {
16
+ case 0:
17
+ if (charts.length === 0 && !legendsToSvg) {
18
+ throw new Error('No charts or legends to export');
19
+ }
20
+ return [4 /*yield*/, Promise.all(charts.map(function (chart) {
21
+ return new Promise(function (resolve) {
22
+ var svg = cloneStyledSVG(chart.container, isRTL);
23
+ var svgDataUrl = svgToBase64(svg.node);
24
+ resolve({ dataUrl: svgDataUrl, width: svg.width, height: svg.height });
25
+ });
26
+ }))];
27
+ case 1:
28
+ chartImages = _a.sent();
29
+ grid = [];
30
+ charts.forEach(function (chart, i) {
31
+ var row = chart.row || 0;
32
+ var col = chart.col || 0;
33
+ if (!grid[row]) {
34
+ grid[row] = [];
35
+ }
36
+ grid[row][col] = chartImages[i];
37
+ });
38
+ if (legendsToSvg) {
39
+ totalWidth_1 = 0;
40
+ grid.forEach(function (row) {
41
+ var rowWidth = 0;
42
+ row.forEach(function (item) {
43
+ rowWidth += item.width;
44
+ });
45
+ totalWidth_1 = Math.max(totalWidth_1, rowWidth);
46
+ });
47
+ svg = legendsToSvg(totalWidth_1, isRTL);
48
+ if (svg.node) {
49
+ svgDataUrl = svgToBase64(svg.node);
50
+ grid.push([{ dataUrl: svgDataUrl, width: svg.width, height: svg.height }]);
51
+ }
52
+ }
53
+ return [2 /*return*/, svgToPng(grid, opts)];
21
54
  }
22
- var svgData = new XMLSerializer().serializeToString(svg.node);
23
- // This node is already detached from the DOM, so there's no need to call remove() on it.
24
- // Just clear the reference.
25
- svg.node = null;
26
- var svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
- svgData = null;
29
- svgToPng(svgDataUrl, {
30
- width: opts.width || svg.width,
31
- height: opts.height || svg.height,
32
- scale: opts.scale,
33
- })
34
- .then(resolve)
35
- .catch(reject);
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- svgDataUrl = null;
38
- }
39
- catch (err) {
40
- return reject(err);
41
- }
55
+ });
42
56
  });
43
57
  }
44
58
  var SVG_STYLE_PROPERTIES = [
@@ -63,27 +77,55 @@ var SVG_TEXT_STYLE_PROPERTIES = [
63
77
  'border',
64
78
  ];
65
79
  var ANNOTATION_HTML_STYLE_PROPERTIES = [
80
+ 'align-items',
81
+ 'background',
66
82
  'background-color',
67
83
  'border',
68
84
  'border-radius',
69
85
  'box-shadow',
86
+ 'box-sizing',
70
87
  'color',
88
+ 'column-gap',
89
+ 'display',
90
+ 'flex',
91
+ 'flex-direction',
71
92
  'font-family',
72
93
  'font-size',
73
94
  'font-style',
74
95
  'font-weight',
96
+ 'gap',
97
+ 'height',
98
+ 'justify-content',
75
99
  'letter-spacing',
76
100
  'line-height',
101
+ 'margin',
102
+ 'max-height',
103
+ 'max-width',
104
+ 'min-height',
105
+ 'min-width',
77
106
  'opacity',
107
+ 'overflow',
78
108
  'padding',
79
109
  'pointer-events',
110
+ 'position',
111
+ 'row-gap',
80
112
  'text-align',
81
113
  'text-decoration',
82
114
  'text-transform',
115
+ 'top',
116
+ 'right',
117
+ 'bottom',
118
+ 'left',
119
+ 'visibility',
83
120
  'white-space',
121
+ 'width',
122
+ 'z-index',
84
123
  ];
85
124
  var ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES = ['overflow', 'pointer-events'];
86
- function toSVG(chartContainer, legendsToSvgCallback, isRTL, background) {
125
+ function cloneStyledSVG(chartContainer, isRTL) {
126
+ if (!chartContainer) {
127
+ throw new Error('Chart container is not defined');
128
+ }
87
129
  var svg = chartContainer.querySelector('svg');
88
130
  if (!svg) {
89
131
  throw new Error('SVG not found');
@@ -109,12 +151,27 @@ function toSVG(chartContainer, legendsToSvgCallback, isRTL, background) {
109
151
  svgElements = null;
110
152
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
111
153
  clonedSvgElements = null;
112
- var _a = svg.getBoundingClientRect(), svgWidth = _a.width, svgHeight = _a.height;
113
- var legendGroup = typeof legendsToSvgCallback === 'function'
114
- ? legendsToSvgCallback(svgWidth, isRTL)
115
- : { node: null, width: 0, height: 0 };
116
- var w1 = Math.max(svgWidth, legendGroup.width);
117
- var h1 = svgHeight + legendGroup.height;
154
+ var originalForeignObjects = svg.querySelectorAll('foreignObject');
155
+ var clonedForeignObjects = clonedSvg.node().querySelectorAll('foreignObject');
156
+ originalForeignObjects.forEach(function (originalFo, index) {
157
+ var clonedFo = clonedForeignObjects[index];
158
+ if (!clonedFo) {
159
+ return;
160
+ }
161
+ var originalRoot = originalFo.firstElementChild;
162
+ var clonedRoot = clonedFo.firstElementChild;
163
+ if (originalRoot && clonedRoot) {
164
+ (0, index_1.copyStyle)(ANNOTATION_HTML_STYLE_PROPERTIES, originalRoot, clonedRoot);
165
+ }
166
+ var originalHtmlElements = originalFo.querySelectorAll('*');
167
+ var clonedHtmlElements = clonedFo.querySelectorAll('*');
168
+ originalHtmlElements.forEach(function (originalEl, elementIndex) {
169
+ var clonedEl = clonedHtmlElements[elementIndex];
170
+ if (clonedEl) {
171
+ (0, index_1.copyStyle)(ANNOTATION_HTML_STYLE_PROPERTIES, originalEl, clonedEl);
172
+ }
173
+ });
174
+ });
118
175
  var annotationSvg = chartContainer.querySelector('[data-chart-annotation-svg="true"]');
119
176
  var annotationClone = null;
120
177
  if (annotationSvg) {
@@ -145,30 +202,21 @@ function toSVG(chartContainer, legendsToSvgCallback, isRTL, background) {
145
202
  }
146
203
  }
147
204
  }
148
- if (legendGroup.node) {
149
- (0, d3_selection_1.select)(legendGroup.node).attr('transform', "translate(0, ".concat(svgHeight, ")"));
150
- clonedSvg.append(function () { return legendGroup.node; });
151
- }
152
- clonedSvg
153
- .insert('rect', ':first-child')
154
- .attr('x', 0)
155
- .attr('y', 0)
156
- .attr('width', w1)
157
- .attr('height', h1)
158
- .attr('fill', background);
205
+ var _a = svg.getBoundingClientRect(), width = _a.width, height = _a.height;
159
206
  clonedSvg
160
- .attr('width', w1)
161
- .attr('height', h1)
162
- .attr('viewBox', "0 0 ".concat(w1, " ").concat(h1))
207
+ .attr('width', width)
208
+ .attr('height', height)
209
+ .attr('viewBox', "0 0 ".concat(width, " ").concat(height))
163
210
  .attr('direction', isRTL ? 'rtl' : 'ltr');
164
211
  if (annotationClone) {
165
- (0, d3_selection_1.select)(annotationClone).attr('x', 0).attr('y', 0).attr('width', svgWidth).attr('height', svgHeight);
212
+ clonedSvg.selectAll('[data-chart-annotation-layer="true"]').remove();
213
+ (0, d3_selection_1.select)(annotationClone).attr('x', 0).attr('y', 0).attr('width', width).attr('height', height);
166
214
  clonedSvg.append(function () { return annotationClone; });
167
215
  }
168
216
  var result = {
169
217
  node: clonedSvg.node(),
170
- width: w1,
171
- height: h1,
218
+ width: width,
219
+ height: height,
172
220
  };
173
221
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
174
222
  clonedSvg = null;
@@ -262,40 +310,82 @@ function cloneLegendsToSVG(legends, svgWidth, config, legendContainer) {
262
310
  });
263
311
  });
264
312
  }
313
+ var w1 = Math.max.apply(Math, tslib_1.__spreadArray([svgWidth], legendLineWidths, false));
314
+ var h1 = legendY;
315
+ var svg = (0, d3_selection_1.create)('svg').attr('width', w1).attr('height', h1).attr('viewBox', "0 0 ".concat(w1, " ").concat(h1));
316
+ svg.append(function () { return legendGroup.node(); });
265
317
  return {
266
- node: legendGroup.node(),
267
- width: Math.max.apply(Math, legendLineWidths),
268
- height: legendY,
318
+ node: svg.node(),
319
+ width: w1,
320
+ height: h1,
269
321
  };
270
322
  }
271
- function svgToPng(svgDataUrl, opts) {
272
- if (opts === void 0) { opts = {}; }
273
- return new Promise(function (resolve, reject) {
274
- var scale = opts.scale || 1;
275
- var w0 = opts.width || 300;
276
- var h0 = opts.height || 150;
277
- var w1 = scale * w0;
278
- var h1 = scale * h0;
279
- var canvas = document.createElement('canvas');
280
- var img = new Image();
281
- canvas.width = w1;
282
- canvas.height = h1;
283
- img.onload = function () {
284
- var ctx = canvas.getContext('2d');
285
- if (!ctx) {
286
- return reject(new Error('Canvas context is null'));
323
+ function svgToPng(grid_1) {
324
+ return tslib_1.__awaiter(this, arguments, void 0, function (grid, opts) {
325
+ var totalWidth, totalHeight, positionedImages, scale, w0, h0, scaleX, scaleY, canvas, ctx;
326
+ if (opts === void 0) { opts = {}; }
327
+ return tslib_1.__generator(this, function (_a) {
328
+ switch (_a.label) {
329
+ case 0:
330
+ totalWidth = 0;
331
+ totalHeight = 0;
332
+ positionedImages = grid
333
+ .map(function (row) {
334
+ var rowWidth = 0;
335
+ var rowHeight = 0;
336
+ var items = row.map(function (item) {
337
+ var positioned = tslib_1.__assign(tslib_1.__assign({}, item), { x: rowWidth, y: totalHeight });
338
+ rowWidth += item.width;
339
+ rowHeight = Math.max(rowHeight, item.height);
340
+ return positioned;
341
+ });
342
+ totalWidth = Math.max(totalWidth, rowWidth);
343
+ totalHeight += rowHeight;
344
+ return items;
345
+ })
346
+ .flat();
347
+ scale = opts.scale || 1;
348
+ w0 = opts.width || totalWidth;
349
+ h0 = opts.height || totalHeight;
350
+ scaleX = (scale * w0) / totalWidth;
351
+ scaleY = (scale * h0) / totalHeight;
352
+ totalWidth = scaleX * totalWidth;
353
+ totalHeight = scaleY * totalHeight;
354
+ canvas = document.createElement('canvas');
355
+ canvas.width = totalWidth;
356
+ canvas.height = totalHeight;
357
+ ctx = canvas.getContext('2d');
358
+ if (!ctx) {
359
+ throw new Error('Canvas context is null');
360
+ }
361
+ ctx.fillStyle = opts.background || 'transparent';
362
+ ctx.fillRect(0, 0, totalWidth, totalHeight);
363
+ return [4 /*yield*/, Promise.all(positionedImages.map(function (item) {
364
+ return new Promise(function (resolve, reject) {
365
+ var img = new Image();
366
+ img.onload = function () {
367
+ ctx.drawImage(img, scaleX * item.x, scaleY * item.y, scaleX * item.width, scaleY * item.height);
368
+ resolve();
369
+ };
370
+ img.onerror = reject;
371
+ img.src = item.dataUrl;
372
+ });
373
+ }))];
374
+ case 1:
375
+ _a.sent();
376
+ return [2 /*return*/, canvas.toDataURL('image/png')];
287
377
  }
288
- ctx.clearRect(0, 0, w1, h1);
289
- ctx.drawImage(img, 0, 0, w1, h1);
290
- var imgData = canvas.toDataURL('image/png');
291
- resolve(imgData);
292
- };
293
- img.onerror = function (err) {
294
- reject(err);
295
- };
296
- img.src = svgDataUrl;
378
+ });
297
379
  });
298
380
  }
381
+ function svgToBase64(svgNode) {
382
+ if (!svgNode) {
383
+ throw new Error('SVG node is null');
384
+ }
385
+ var svgData = new XMLSerializer().serializeToString(svgNode);
386
+ var svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));
387
+ return svgDataUrl;
388
+ }
299
389
  var hex2 = /^[\da-f]{2}$/i;
300
390
  var hex4 = /^[\da-f]{4}$/i;
301
391
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"image-export-utils.js","sourceRoot":"../src/","sources":["utilities/image-export-utils.ts"],"names":[],"mappings":";;AAeA,0BA0CC;AAqKD,8CAwGC;;AAtUD,6CAAiF;AACjF,iCAAgF;AAGhF,uEAS8C;AAE9C,SAAgB,OAAO,CAC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,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACnC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBAClD,KAAK,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { copyStyle, createMeasurementSpan, resolveCSSVariables } from './index';\nimport { IImageExportOptions } from '../types/index';\nimport { ILegend, ILegendContainer } from '../Legends';\nimport {\n LEGEND_CONTAINER_MARGIN_TOP,\n LEGEND_CONTAINER_MARGIN_START,\n LEGEND_PADDING,\n LEGEND_HEIGHT,\n LEGEND_SHAPE_BORDER,\n LEGEND_SHAPE_SIZE,\n LEGEND_SHAPE_MARGIN_END,\n INACTIVE_LEGEND_TEXT_OPACITY,\n} from '../components/Legends/Legends.styles';\n\nexport function toImage(\n chartContainer: HTMLElement | null | undefined,\n legendsToSvgCallback?: ILegendContainer['toSVG'],\n isRTL: boolean = false,\n opts: IImageExportOptions = {},\n): Promise<string> {\n return new Promise((resolve, reject) => {\n if (!chartContainer) {\n return reject(new Error('Chart container is not defined'));\n }\n\n try {\n const background =\n typeof opts.background === 'string' ? resolveCSSVariables(chartContainer, opts.background) : 'transparent';\n\n const svg = toSVG(chartContainer, legendsToSvgCallback, isRTL, background);\n if (!svg.node) {\n return reject(new Error('SVG node is null'));\n }\n\n let svgData = new XMLSerializer().serializeToString(svg.node);\n // This node is already detached from the DOM, so there's no need to call remove() on it.\n // Just clear the reference.\n svg.node = null;\n\n let svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgData = null as any;\n\n svgToPng(svgDataUrl, {\n width: opts.width || svg.width,\n height: opts.height || svg.height,\n scale: opts.scale,\n })\n .then(resolve)\n .catch(reject);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgDataUrl = null as any;\n } catch (err) {\n return reject(err);\n }\n });\n}\n\nconst SVG_STYLE_PROPERTIES = [\n 'display',\n 'fill',\n 'fill-opacity',\n 'opacity',\n 'stroke',\n 'stroke-width',\n 'transform',\n 'border-collapse',\n];\nconst SVG_TEXT_STYLE_PROPERTIES = [\n 'font-family',\n 'font-size',\n 'font-weight',\n 'text-anchor',\n 'background-color',\n 'color',\n 'padding',\n 'text-align',\n 'border',\n];\nconst ANNOTATION_HTML_STYLE_PROPERTIES = [\n 'background-color',\n 'border',\n 'border-radius',\n 'box-shadow',\n 'color',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'letter-spacing',\n 'line-height',\n 'opacity',\n 'padding',\n 'pointer-events',\n 'text-align',\n 'text-decoration',\n 'text-transform',\n 'white-space',\n];\nconst ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES = ['overflow', 'pointer-events'];\n\nfunction toSVG(\n chartContainer: HTMLElement,\n legendsToSvgCallback: ILegendContainer['toSVG'] | undefined,\n isRTL: boolean,\n background: string,\n) {\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n let clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n let svgElements = svg.getElementsByTagName('*');\n let clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n const TEXT_ELEMENTS = ['text'];\n const TABLE_ELEMENTS = ['table', 'thead', 'tbody', 'tr', 'th', 'td'];\n\n for (let i = 0; i < svgElements.length; i++) {\n const tag = svgElements[i].tagName.toLowerCase();\n\n if (TEXT_ELEMENTS.includes(tag) || TABLE_ELEMENTS.includes(tag)) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgElements = null as any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvgElements = null as any;\n\n const { width: svgWidth, height: svgHeight } = svg.getBoundingClientRect();\n const legendGroup =\n typeof legendsToSvgCallback === 'function'\n ? legendsToSvgCallback(svgWidth, isRTL)\n : { node: null, width: 0, height: 0 };\n const w1 = Math.max(svgWidth, legendGroup.width);\n const h1 = svgHeight + legendGroup.height;\n\n const annotationSvg = chartContainer.querySelector<SVGSVGElement>('[data-chart-annotation-svg=\"true\"]');\n let annotationClone: SVGSVGElement | null = null;\n\n if (annotationSvg) {\n annotationClone = annotationSvg.cloneNode(true) as SVGSVGElement;\n copyStyle(SVG_STYLE_PROPERTIES, annotationSvg, annotationClone);\n\n const annotationElements = annotationSvg.getElementsByTagName('*');\n const clonedAnnotationElements = annotationClone.getElementsByTagName('*');\n\n for (let i = 0; i < annotationElements.length; i++) {\n const original = annotationElements[i];\n const cloned = clonedAnnotationElements[i];\n const tag = original.tagName.toLowerCase();\n const isSvgElement = original instanceof SVGElement;\n const isTextElement = tag === 'text';\n const isHtmlElement = original instanceof HTMLElement;\n\n if (isSvgElement) {\n if (isTextElement) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], original, cloned);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, original, cloned);\n }\n }\n\n if (isHtmlElement) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, original, cloned);\n }\n\n if (tag === 'foreignobject') {\n copyStyle(ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES, original, cloned);\n }\n }\n }\n\n if (legendGroup.node) {\n d3Select(legendGroup.node).attr('transform', `translate(0, ${svgHeight})`);\n clonedSvg.append(() => legendGroup.node);\n }\n clonedSvg\n .insert('rect', ':first-child')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', w1)\n .attr('height', h1)\n .attr('fill', background);\n clonedSvg\n .attr('width', w1)\n .attr('height', h1)\n .attr('viewBox', `0 0 ${w1} ${h1}`)\n .attr('direction', isRTL ? 'rtl' : 'ltr');\n\n if (annotationClone) {\n d3Select(annotationClone).attr('x', 0).attr('y', 0).attr('width', svgWidth).attr('height', svgHeight);\n clonedSvg.append(() => annotationClone as SVGSVGElement);\n }\n\n const result = {\n node: clonedSvg.node(),\n width: w1,\n height: h1,\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvg = null as any;\n\n return result;\n}\n\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n};\n\nexport function cloneLegendsToSVG(\n legends: ILegend[],\n svgWidth: number,\n config: {\n selectedLegends: Record<string, boolean>;\n centerLegends: boolean;\n textClassName: string;\n isRTL: boolean;\n },\n legendContainer?: HTMLElement | null,\n): { node: SVGGElement | null; width: number; height: number } {\n if (legends.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const { selectedLegends, centerLegends, textClassName, isRTL } = config;\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n let legendY = LEGEND_CONTAINER_MARGIN_TOP;\n let legendLine: { elem: Selection<SVGGElement, unknown, null, undefined>; width: number }[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n const noLegendsSelected = Object.keys(selectedLegends).length === 0;\n\n for (let i = 0; i < legends.length; i++) {\n const textOffset = LEGEND_PADDING + LEGEND_SHAPE_SIZE + LEGEND_SHAPE_MARGIN_END;\n const legendText = createMeasurementSpan(legends[i].title, textClassName, legendContainer);\n const legendWidth = textOffset + legendText.getBoundingClientRect().width + LEGEND_PADDING;\n const legendItem = legendGroup.append('g');\n\n legendLine.push({ elem: legendItem, width: legendWidth });\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [{ elem: legendItem, width: legendWidth }];\n legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n legendY += LEGEND_HEIGHT;\n }\n\n const isLegendActive = selectedLegends[legends[i].title] || noLegendsSelected;\n\n legendItem\n .append('rect')\n .attr('x', legendX + (isRTL ? legendWidth - LEGEND_PADDING - LEGEND_SHAPE_SIZE : LEGEND_PADDING))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('width', LEGEND_SHAPE_SIZE)\n .attr('height', LEGEND_SHAPE_SIZE)\n .style('fill', isLegendActive ? legends[i].color : 'transparent')\n .style('stroke-width', LEGEND_SHAPE_BORDER)\n .style('stroke', legends[i].color);\n\n legendItem\n .append('text')\n .attr('x', legendX + (isRTL ? legendWidth - textOffset : textOffset))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('dominant-baseline', 'hanging')\n .style('opacity', isLegendActive ? 1 : INACTIVE_LEGEND_TEXT_OPACITY)\n .text(legends[i].title)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText, selection.node()!));\n\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += LEGEND_HEIGHT;\n\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const lineOffsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n let remLineWidth = legendLineWidths[idx];\n let itemOffsetX = 0;\n ln.forEach(item => {\n const newOffsetX = lineOffsetX + (isRTL ? remLineWidth - item.width - itemOffsetX : 0);\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n } else if (isRTL) {\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n legendLines.forEach(ln => {\n let remLineWidth = w1 - LEGEND_CONTAINER_MARGIN_START;\n let itemOffsetX = LEGEND_CONTAINER_MARGIN_START;\n ln.forEach(item => {\n const newOffsetX = remLineWidth - item.width - itemOffsetX;\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n }\n\n return {\n node: legendGroup.node(),\n width: Math.max(...legendLineWidths),\n height: legendY,\n };\n}\n\nfunction svgToPng(svgDataUrl: string, opts: IImageExportOptions = {}): Promise<string> {\n return new Promise((resolve, reject) => {\n const scale = opts.scale || 1;\n const w0 = opts.width || 300;\n const h0 = opts.height || 150;\n const w1 = scale * w0;\n const h1 = scale * h0;\n\n const canvas = document.createElement('canvas');\n const img = new Image();\n\n canvas.width = w1;\n canvas.height = h1;\n\n img.onload = function () {\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return reject(new Error('Canvas context is null'));\n }\n\n ctx.clearRect(0, 0, w1, h1);\n ctx.drawImage(img, 0, 0, w1, h1);\n\n const imgData = canvas.toDataURL('image/png');\n resolve(imgData);\n };\n\n img.onerror = function (err) {\n reject(err);\n };\n\n img.src = svgDataUrl;\n });\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n"]}
1
+ {"version":3,"file":"image-export-utils.js","sourceRoot":"../src/","sources":["utilities/image-export-utils.ts"],"names":[],"mappings":";;AA2BA,kDAgDC;AAwMD,8CA6GC;;AAhYD,6CAAiF;AACjF,iCAA2D;AAG3D,uEAS8C;AAc9C,SAAsB,mBAAmB;gEACvC,MAAmB,EACnB,YAAwC,EACxC,KAAsB,EACtB,IAA8B;;QAD9B,sBAAA,EAAA,aAAsB;QACtB,qBAAA,EAAA,SAA8B;;;;oBAE9B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;wBACzC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;oBACpD,CAAC;oBAEmB,qBAAM,OAAO,CAAC,GAAG,CACnC,MAAM,CAAC,GAAG,CAAC,UAAA,KAAK;4BACd,OAAO,IAAI,OAAO,CAAW,UAAA,OAAO;gCAClC,IAAM,GAAG,GAAG,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;gCACnD,IAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gCACzC,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;4BACzE,CAAC,CAAC,CAAC;wBACL,CAAC,CAAC,CACH,EAAA;;oBARK,WAAW,GAAG,SAQnB;oBAEK,IAAI,GAAiB,EAAE,CAAC;oBAC9B,MAAM,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,CAAC;wBACtB,IAAM,GAAG,G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;;;GAIG;AACH,SAAS,gBAAgB,CAAC,GAAW;IACnC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAC1B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,CAAC;IACR,IAAI,IAAI,CAAC;IACT,OAAO,KAAK,GAAG,MAAM,EAAE,CAAC;QACtB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YAChB,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;gBAC9B,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACvC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBAClD,KAAK,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBACnC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBAClD,KAAK,IAAI,CAAC,CAAC;oBACX,SAAS;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { copyStyle, createMeasurementSpan } from './index';\nimport { IImageExportOptions } from '../types/index';\nimport { ILegend, ILegendContainer } from '../Legends';\nimport {\n LEGEND_CONTAINER_MARGIN_TOP,\n LEGEND_CONTAINER_MARGIN_START,\n LEGEND_PADDING,\n LEGEND_HEIGHT,\n LEGEND_SHAPE_BORDER,\n LEGEND_SHAPE_SIZE,\n LEGEND_SHAPE_MARGIN_END,\n INACTIVE_LEGEND_TEXT_OPACITY,\n} from '../components/Legends/Legends.styles';\n\nexport type GridChart = {\n container: HTMLElement | null | undefined;\n row?: number;\n col?: number;\n};\n\ntype SvgImage = {\n dataUrl: string;\n width: number;\n height: number;\n};\n\nexport async function exportChartsAsImage(\n charts: GridChart[],\n legendsToSvg?: ILegendContainer['toSVG'],\n isRTL: boolean = false,\n opts: IImageExportOptions = {},\n): Promise<string> {\n if (charts.length === 0 && !legendsToSvg) {\n throw new Error('No charts or legends to export');\n }\n\n const chartImages = await Promise.all(\n charts.map(chart => {\n return new Promise<SvgImage>(resolve => {\n const svg = cloneStyledSVG(chart.container, isRTL);\n const svgDataUrl = svgToBase64(svg.node);\n resolve({ dataUrl: svgDataUrl, width: svg.width, height: svg.height });\n });\n }),\n );\n\n const grid: SvgImage[][] = []; // Sparse 2D array\n charts.forEach((chart, i) => {\n const row = chart.row || 0;\n const col = chart.col || 0;\n if (!grid[row]) {\n grid[row] = [];\n }\n grid[row][col] = chartImages[i];\n });\n\n if (legendsToSvg) {\n let totalWidth = 0;\n grid.forEach(row => {\n let rowWidth = 0;\n row.forEach(item => {\n rowWidth += item.width;\n });\n totalWidth = Math.max(totalWidth, rowWidth);\n });\n\n const svg = legendsToSvg(totalWidth, isRTL);\n if (svg.node) {\n const svgDataUrl = svgToBase64(svg.node);\n grid.push([{ dataUrl: svgDataUrl, width: svg.width, height: svg.height }]);\n }\n }\n\n return svgToPng(grid, opts);\n}\n\nconst SVG_STYLE_PROPERTIES = [\n 'display',\n 'fill',\n 'fill-opacity',\n 'opacity',\n 'stroke',\n 'stroke-width',\n 'transform',\n 'border-collapse',\n];\nconst SVG_TEXT_STYLE_PROPERTIES = [\n 'font-family',\n 'font-size',\n 'font-weight',\n 'text-anchor',\n 'background-color',\n 'color',\n 'padding',\n 'text-align',\n 'border',\n];\nconst ANNOTATION_HTML_STYLE_PROPERTIES = [\n 'align-items',\n 'background',\n 'background-color',\n 'border',\n 'border-radius',\n 'box-shadow',\n 'box-sizing',\n 'color',\n 'column-gap',\n 'display',\n 'flex',\n 'flex-direction',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'gap',\n 'height',\n 'justify-content',\n 'letter-spacing',\n 'line-height',\n 'margin',\n 'max-height',\n 'max-width',\n 'min-height',\n 'min-width',\n 'opacity',\n 'overflow',\n 'padding',\n 'pointer-events',\n 'position',\n 'row-gap',\n 'text-align',\n 'text-decoration',\n 'text-transform',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'visibility',\n 'white-space',\n 'width',\n 'z-index',\n];\nconst ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES = ['overflow', 'pointer-events'];\n\nfunction cloneStyledSVG(chartContainer: HTMLElement | null | undefined, isRTL: boolean) {\n if (!chartContainer) {\n throw new Error('Chart container is not defined');\n }\n\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n let clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n let svgElements = svg.getElementsByTagName('*');\n let clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n const TEXT_ELEMENTS = ['text'];\n const TABLE_ELEMENTS = ['table', 'thead', 'tbody', 'tr', 'th', 'td'];\n\n for (let i = 0; i < svgElements.length; i++) {\n const tag = svgElements[i].tagName.toLowerCase();\n\n if (TEXT_ELEMENTS.includes(tag) || TABLE_ELEMENTS.includes(tag)) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n svgElements = null as any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvgElements = null as any;\n\n const originalForeignObjects = svg.querySelectorAll('foreignObject');\n const clonedForeignObjects = clonedSvg.node()!.querySelectorAll('foreignObject');\n\n originalForeignObjects.forEach((originalFo, index) => {\n const clonedFo = clonedForeignObjects[index];\n if (!clonedFo) {\n return;\n }\n\n const originalRoot = originalFo.firstElementChild as HTMLElement | null;\n const clonedRoot = clonedFo.firstElementChild as HTMLElement | null;\n\n if (originalRoot && clonedRoot) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalRoot, clonedRoot);\n }\n\n const originalHtmlElements = originalFo.querySelectorAll<HTMLElement>('*');\n const clonedHtmlElements = clonedFo.querySelectorAll<HTMLElement>('*');\n\n originalHtmlElements.forEach((originalEl, elementIndex) => {\n const clonedEl = clonedHtmlElements[elementIndex];\n if (clonedEl) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, originalEl, clonedEl);\n }\n });\n });\n\n const annotationSvg = chartContainer.querySelector<SVGSVGElement>('[data-chart-annotation-svg=\"true\"]');\n let annotationClone: SVGSVGElement | null = null;\n\n if (annotationSvg) {\n annotationClone = annotationSvg.cloneNode(true) as SVGSVGElement;\n copyStyle(SVG_STYLE_PROPERTIES, annotationSvg, annotationClone);\n\n const annotationElements = annotationSvg.getElementsByTagName('*');\n const clonedAnnotationElements = annotationClone.getElementsByTagName('*');\n\n for (let i = 0; i < annotationElements.length; i++) {\n const original = annotationElements[i];\n const cloned = clonedAnnotationElements[i];\n const tag = original.tagName.toLowerCase();\n const isSvgElement = original instanceof SVGElement;\n const isTextElement = tag === 'text';\n const isHtmlElement = original instanceof HTMLElement;\n\n if (isSvgElement) {\n if (isTextElement) {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], original, cloned);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, original, cloned);\n }\n }\n\n if (isHtmlElement) {\n copyStyle(ANNOTATION_HTML_STYLE_PROPERTIES, original, cloned);\n }\n\n if (tag === 'foreignobject') {\n copyStyle(ANNOTATION_FOREIGN_OBJECT_STYLE_PROPERTIES, original, cloned);\n }\n }\n }\n\n const { width, height } = svg.getBoundingClientRect();\n\n clonedSvg\n .attr('width', width)\n .attr('height', height)\n .attr('viewBox', `0 0 ${width} ${height}`)\n .attr('direction', isRTL ? 'rtl' : 'ltr');\n\n if (annotationClone) {\n clonedSvg.selectAll('[data-chart-annotation-layer=\"true\"]').remove();\n d3Select(annotationClone).attr('x', 0).attr('y', 0).attr('width', width).attr('height', height);\n clonedSvg.append(() => annotationClone as SVGSVGElement);\n }\n\n const result = {\n node: clonedSvg.node(),\n width,\n height,\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n clonedSvg = null as any;\n\n return result;\n}\n\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n};\n\nexport function cloneLegendsToSVG(\n legends: ILegend[],\n svgWidth: number,\n config: {\n selectedLegends: Record<string, boolean>;\n centerLegends: boolean;\n textClassName: string;\n isRTL: boolean;\n },\n legendContainer?: HTMLElement | null,\n): { node: SVGSVGElement | null; width: number; height: number } {\n if (legends.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const { selectedLegends, centerLegends, textClassName, isRTL } = config;\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n let legendY = LEGEND_CONTAINER_MARGIN_TOP;\n let legendLine: { elem: Selection<SVGGElement, unknown, null, undefined>; width: number }[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n const noLegendsSelected = Object.keys(selectedLegends).length === 0;\n\n for (let i = 0; i < legends.length; i++) {\n const textOffset = LEGEND_PADDING + LEGEND_SHAPE_SIZE + LEGEND_SHAPE_MARGIN_END;\n const legendText = createMeasurementSpan(legends[i].title, textClassName, legendContainer);\n const legendWidth = textOffset + legendText.getBoundingClientRect().width + LEGEND_PADDING;\n const legendItem = legendGroup.append('g');\n\n legendLine.push({ elem: legendItem, width: legendWidth });\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [{ elem: legendItem, width: legendWidth }];\n legendX = centerLegends ? 0 : LEGEND_CONTAINER_MARGIN_START;\n legendY += LEGEND_HEIGHT;\n }\n\n const isLegendActive = selectedLegends[legends[i].title] || noLegendsSelected;\n\n legendItem\n .append('rect')\n .attr('x', legendX + (isRTL ? legendWidth - LEGEND_PADDING - LEGEND_SHAPE_SIZE : LEGEND_PADDING))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('width', LEGEND_SHAPE_SIZE)\n .attr('height', LEGEND_SHAPE_SIZE)\n .style('fill', isLegendActive ? legends[i].color : 'transparent')\n .style('stroke-width', LEGEND_SHAPE_BORDER)\n .style('stroke', legends[i].color);\n\n legendItem\n .append('text')\n .attr('x', legendX + (isRTL ? legendWidth - textOffset : textOffset))\n .attr('y', legendY + LEGEND_PADDING)\n .attr('dominant-baseline', 'hanging')\n .style('opacity', isLegendActive ? 1 : INACTIVE_LEGEND_TEXT_OPACITY)\n .text(legends[i].title)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText, selection.node()!));\n\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += LEGEND_HEIGHT;\n\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const lineOffsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n let remLineWidth = legendLineWidths[idx];\n let itemOffsetX = 0;\n ln.forEach(item => {\n const newOffsetX = lineOffsetX + (isRTL ? remLineWidth - item.width - itemOffsetX : 0);\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n } else if (isRTL) {\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n legendLines.forEach(ln => {\n let remLineWidth = w1 - LEGEND_CONTAINER_MARGIN_START;\n let itemOffsetX = LEGEND_CONTAINER_MARGIN_START;\n ln.forEach(item => {\n const newOffsetX = remLineWidth - item.width - itemOffsetX;\n item.elem.attr('transform', `translate(${newOffsetX}, 0)`);\n remLineWidth -= item.width;\n itemOffsetX += item.width;\n });\n });\n }\n\n const w1 = Math.max(svgWidth, ...legendLineWidths);\n const h1 = legendY;\n const svg = d3Create<SVGSVGElement>('svg').attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n svg.append(() => legendGroup.node()!);\n\n return {\n node: svg.node(),\n width: w1,\n height: h1,\n };\n}\n\ntype PositionedImage = SvgImage & {\n x: number;\n y: number;\n};\n\nasync function svgToPng(grid: SvgImage[][], opts: IImageExportOptions = {}): Promise<string> {\n let totalWidth = 0;\n let totalHeight = 0;\n\n const positionedImages: PositionedImage[] = grid\n .map(row => {\n let rowWidth = 0;\n let rowHeight = 0;\n\n const items = row.map(item => {\n const positioned = { ...item, x: rowWidth, y: totalHeight };\n rowWidth += item.width;\n rowHeight = Math.max(rowHeight, item.height);\n return positioned;\n });\n\n totalWidth = Math.max(totalWidth, rowWidth);\n totalHeight += rowHeight;\n\n return items;\n })\n .flat();\n\n const scale = opts.scale || 1;\n const w0 = opts.width || totalWidth;\n const h0 = opts.height || totalHeight;\n const scaleX = (scale * w0) / totalWidth;\n const scaleY = (scale * h0) / totalHeight;\n totalWidth = scaleX * totalWidth;\n totalHeight = scaleY * totalHeight;\n\n const canvas = document.createElement('canvas');\n canvas.width = totalWidth;\n canvas.height = totalHeight;\n\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n throw new Error('Canvas context is null');\n }\n\n ctx.fillStyle = opts.background || 'transparent';\n ctx.fillRect(0, 0, totalWidth, totalHeight);\n\n await Promise.all(\n positionedImages.map(\n item =>\n new Promise<void>((resolve, reject) => {\n const img = new Image();\n img.onload = () => {\n ctx.drawImage(img, scaleX * item.x, scaleY * item.y, scaleX * item.width, scaleY * item.height);\n resolve();\n };\n img.onerror = reject;\n img.src = item.dataUrl;\n }),\n ),\n );\n\n return canvas.toDataURL('image/png');\n}\n\nfunction svgToBase64(svgNode: SVGSVGElement | null) {\n if (!svgNode) {\n throw new Error('SVG node is null');\n }\n\n const svgData = new XMLSerializer().serializeToString(svgNode);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n return svgDataUrl;\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n"]}