@fluentui/react-charts 9.2.3 → 9.3.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 (347) hide show
  1. package/CHANGELOG.md +79 -10
  2. package/dist/index.d.ts +98 -5
  3. package/lib/components/AreaChart/AreaChart.js +8 -6
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/AreaChart/useAreaChartStyles.styles.js +4 -2
  6. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  7. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +4 -15
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.js +95 -8
  10. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  11. package/lib/components/ChartTable/useChartTableStyles.styles.js +5 -3
  12. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  13. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +3 -2
  14. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  15. package/lib/components/CommonComponents/CartesianChart.js +45 -42
  16. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  17. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  18. package/lib/components/CommonComponents/ChartPopover.js +14 -5
  19. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  20. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +19 -14
  21. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  22. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -33
  23. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  24. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +5 -3
  25. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  26. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +3 -2
  27. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  28. package/lib/components/DeclarativeChart/DeclarativeChart.js +56 -16
  29. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  30. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +19 -0
  31. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  32. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +1096 -337
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib/components/DeclarativeChart/imageExporter.js +1 -0
  35. package/lib/components/DeclarativeChart/imageExporter.js.map +1 -1
  36. package/lib/components/DonutChart/Arc/Arc.js +8 -8
  37. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  38. package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -1
  39. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +9 -2
  40. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  41. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -1
  42. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  43. package/lib/components/DonutChart/DonutChart.js +61 -25
  44. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  45. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  46. package/lib/components/DonutChart/Pie/Pie.js +1 -0
  47. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  48. package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -1
  49. package/lib/components/DonutChart/Pie/usePieStyles.styles.js +2 -0
  50. package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
  51. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js +1 -0
  52. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +1 -1
  53. package/lib/components/DonutChart/useDonutChartStyles.styles.js +23 -4
  54. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  55. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +9 -4
  56. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  57. package/lib/components/FunnelChart/FunnelChart.js +11 -5
  58. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  59. package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
  60. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +2 -0
  61. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  62. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +1 -0
  63. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  64. package/lib/components/GanttChart/GanttChart.js +1 -0
  65. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  66. package/lib/components/GaugeChart/GaugeChart.js +2 -2
  67. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  68. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +2 -0
  69. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  70. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +1 -0
  71. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  72. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -9
  73. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  74. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +6 -17
  75. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  76. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +5 -21
  77. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  78. package/lib/components/HeatMapChart/HeatMapChart.js +2 -1
  79. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  80. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -0
  81. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  82. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +1 -0
  83. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  84. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +3 -3
  85. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  86. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +8 -2
  87. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  88. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -1
  89. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  90. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
  91. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  92. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -0
  93. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  94. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +1 -0
  95. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  96. package/lib/components/Legends/Legends.js +1 -0
  97. package/lib/components/Legends/Legends.js.map +1 -1
  98. package/lib/components/Legends/OverflowMenu.js +1 -0
  99. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  100. package/lib/components/Legends/shape.js +1 -0
  101. package/lib/components/Legends/shape.js.map +1 -1
  102. package/lib/components/Legends/useLegendsStyles.styles.js +2 -0
  103. package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -1
  104. package/lib/components/Legends/useLegendsStyles.styles.raw.js +1 -0
  105. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  106. package/lib/components/LineChart/LineChart.js +284 -281
  107. package/lib/components/LineChart/LineChart.js.map +1 -1
  108. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  109. package/lib/components/LineChart/eventAnnotation/LabelLink.js +1 -0
  110. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  111. package/lib/components/LineChart/eventAnnotation/Textbox.js +1 -0
  112. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  113. package/lib/components/LineChart/useLineChartStyles.styles.js +25 -10
  114. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  115. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +5 -21
  116. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  117. package/lib/components/ResponsiveContainer/ResponsiveContainer.js +1 -0
  118. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  119. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +2 -0
  120. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -1
  121. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +1 -0
  122. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +1 -1
  123. package/lib/components/ResponsiveContainer/withResponsiveContainer.js +1 -0
  124. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  125. package/lib/components/SankeyChart/SankeyChart.js +1 -0
  126. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  127. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +14 -25
  128. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  129. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +3 -12
  130. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  131. package/lib/components/ScatterChart/ScatterChart.js +121 -81
  132. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  133. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  134. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +13 -7
  135. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  136. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +5 -22
  137. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  138. package/lib/components/Sparkline/Sparkline.js +1 -0
  139. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  140. package/lib/components/Sparkline/useSparklineStyles.styles.js +2 -0
  141. package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
  142. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js +1 -0
  143. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js.map +1 -1
  144. package/lib/components/VerticalBarChart/VerticalBarChart.js +17 -12
  145. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  146. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +10 -6
  147. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  148. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +6 -19
  149. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  150. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +30 -25
  151. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  152. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +9 -6
  153. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  154. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +5 -19
  155. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  156. package/lib/types/DataPoint.js +3 -1
  157. package/lib/types/DataPoint.js.map +1 -1
  158. package/lib/utilities/Common.styles.js +47 -0
  159. package/lib/utilities/Common.styles.js.map +1 -0
  160. package/lib/utilities/Common.styles.raw.js +47 -0
  161. package/lib/utilities/Common.styles.raw.js.map +1 -0
  162. package/lib/utilities/FocusableTooltipText.js +1 -0
  163. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  164. package/lib/utilities/SVGTooltipText.js +1 -0
  165. package/lib/utilities/SVGTooltipText.js.map +1 -1
  166. package/lib/utilities/image-export-utils.js +1 -0
  167. package/lib/utilities/image-export-utils.js.map +1 -1
  168. package/lib/utilities/index.js +1 -0
  169. package/lib/utilities/index.js.map +1 -1
  170. package/lib/utilities/scatterpolar-utils.js +52 -0
  171. package/lib/utilities/scatterpolar-utils.js.map +1 -0
  172. package/lib/utilities/utilities.js +314 -146
  173. package/lib/utilities/utilities.js.map +1 -1
  174. package/lib/utilities/vbc-utils.js.map +1 -1
  175. package/lib-commonjs/components/AreaChart/AreaChart.js +7 -5
  176. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  177. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +1 -0
  178. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  179. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +3 -14
  180. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  181. package/lib-commonjs/components/ChartTable/ChartTable.js +95 -8
  182. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  183. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +4 -3
  184. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  185. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +3 -2
  186. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  187. package/lib-commonjs/components/CommonComponents/CartesianChart.js +45 -42
  188. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  189. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  190. package/lib-commonjs/components/CommonComponents/ChartPopover.js +14 -5
  191. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  192. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +16 -13
  193. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  194. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +5 -32
  195. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  196. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +4 -3
  197. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  198. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +3 -2
  199. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  200. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +60 -20
  201. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  202. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +22 -0
  203. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  204. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +1109 -338
  205. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  206. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +1 -0
  207. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -1
  208. package/lib-commonjs/components/DonutChart/Arc/Arc.js +8 -8
  209. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  210. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -1
  211. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +11 -1
  212. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  213. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -1
  214. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  215. package/lib-commonjs/components/DonutChart/DonutChart.js +61 -25
  216. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  217. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  218. package/lib-commonjs/components/DonutChart/Pie/Pie.js +2 -1
  219. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  220. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -1
  221. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +1 -0
  222. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -1
  223. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js +1 -0
  224. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +1 -1
  225. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +33 -4
  226. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  227. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +9 -4
  228. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  229. package/lib-commonjs/components/FunnelChart/FunnelChart.js +11 -5
  230. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  231. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
  232. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +1 -0
  233. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  234. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +1 -0
  235. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  236. package/lib-commonjs/components/GanttChart/GanttChart.js +1 -0
  237. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  238. package/lib-commonjs/components/GaugeChart/GaugeChart.js +2 -2
  239. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  240. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +1 -0
  241. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  242. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +1 -0
  243. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  244. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +15 -9
  245. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  246. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +3 -19
  247. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  248. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +4 -20
  249. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  250. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -1
  251. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  252. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +1 -0
  253. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  254. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +1 -0
  255. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  256. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +3 -3
  257. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  258. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +10 -2
  259. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  260. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -1
  261. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  262. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +2 -2
  263. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  264. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +1 -0
  265. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  266. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +1 -0
  267. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  268. package/lib-commonjs/components/Legends/Legends.js +1 -0
  269. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  270. package/lib-commonjs/components/Legends/OverflowMenu.js +1 -0
  271. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  272. package/lib-commonjs/components/Legends/shape.js +1 -0
  273. package/lib-commonjs/components/Legends/shape.js.map +1 -1
  274. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +1 -0
  275. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -1
  276. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +1 -0
  277. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  278. package/lib-commonjs/components/LineChart/LineChart.js +282 -279
  279. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  280. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  281. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +1 -0
  282. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -1
  283. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +1 -0
  284. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -1
  285. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +31 -9
  286. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  287. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +3 -20
  288. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  289. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +1 -0
  290. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -1
  291. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +1 -0
  292. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +1 -1
  293. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +1 -0
  294. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +1 -1
  295. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js +2 -1
  296. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  297. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -0
  298. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  299. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +24 -33
  300. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  301. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
  302. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  303. package/lib-commonjs/components/ScatterChart/ScatterChart.js +118 -78
  304. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  305. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  306. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +14 -7
  307. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  308. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +3 -20
  309. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  310. package/lib-commonjs/components/Sparkline/Sparkline.js +1 -0
  311. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  312. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +1 -0
  313. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
  314. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js +1 -0
  315. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js.map +1 -1
  316. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +16 -11
  317. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  318. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +6 -3
  319. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  320. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +4 -17
  321. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  322. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -24
  323. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  324. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +6 -3
  325. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  326. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +4 -18
  327. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  328. package/lib-commonjs/types/DataPoint.js +3 -1
  329. package/lib-commonjs/types/DataPoint.js.map +1 -1
  330. package/lib-commonjs/utilities/Common.styles.js +71 -0
  331. package/lib-commonjs/utilities/Common.styles.js.map +1 -0
  332. package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
  333. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
  334. package/lib-commonjs/utilities/FocusableTooltipText.js +2 -1
  335. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  336. package/lib-commonjs/utilities/SVGTooltipText.js +1 -0
  337. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  338. package/lib-commonjs/utilities/image-export-utils.js +1 -0
  339. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  340. package/lib-commonjs/utilities/index.js +1 -0
  341. package/lib-commonjs/utilities/index.js.map +1 -1
  342. package/lib-commonjs/utilities/scatterpolar-utils.js +67 -0
  343. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
  344. package/lib-commonjs/utilities/utilities.js +327 -137
  345. package/lib-commonjs/utilities/utilities.js.map +1 -1
  346. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  347. package/package.json +10 -10
@@ -1,4 +1,5 @@
1
- /* eslint-disable one-var */ /* eslint-disable vars-on-top */ /* eslint-disable no-var */ "use strict";
1
+ 'use client';
2
+ "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
4
5
  });
@@ -9,6 +10,12 @@ function _export(target, all) {
9
10
  });
10
11
  }
11
12
  _export(exports, {
13
+ NON_PLOT_KEY_PREFIX: function() {
14
+ return NON_PLOT_KEY_PREFIX;
15
+ },
16
+ SINGLE_REPEAT: function() {
17
+ return SINGLE_REPEAT;
18
+ },
12
19
  _getGaugeAxisColor: function() {
13
20
  return _getGaugeAxisColor;
14
21
  },
@@ -30,6 +37,12 @@ _export(exports, {
30
37
  getValidXYRanges: function() {
31
38
  return getValidXYRanges;
32
39
  },
40
+ isNonPlotType: function() {
41
+ return isNonPlotType;
42
+ },
43
+ normalizeObjectArrayForGVBC: function() {
44
+ return normalizeObjectArrayForGVBC;
45
+ },
33
46
  projectPolarToCartesian: function() {
34
47
  return projectPolarToCartesian;
35
48
  },
@@ -45,9 +58,15 @@ _export(exports, {
45
58
  transformPlotlyJsonToDonutProps: function() {
46
59
  return transformPlotlyJsonToDonutProps;
47
60
  },
61
+ transformPlotlyJsonToFunnelChartProps: function() {
62
+ return transformPlotlyJsonToFunnelChartProps;
63
+ },
48
64
  transformPlotlyJsonToGVBCProps: function() {
49
65
  return transformPlotlyJsonToGVBCProps;
50
66
  },
67
+ transformPlotlyJsonToGanttChartProps: function() {
68
+ return transformPlotlyJsonToGanttChartProps;
69
+ },
51
70
  transformPlotlyJsonToGaugeProps: function() {
52
71
  return transformPlotlyJsonToGaugeProps;
53
72
  },
@@ -84,6 +103,8 @@ const _chartutilities = require("@fluentui/chart-utilities");
84
103
  const _d3shape = require("d3-shape");
85
104
  const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
86
105
  const _d3color = require("d3-color");
106
+ const NON_PLOT_KEY_PREFIX = 'nonplot_';
107
+ const SINGLE_REPEAT = 'repeat(1, 1fr)';
87
108
  const dashOptions = {
88
109
  dot: {
89
110
  strokeDasharray: '1, 5',
@@ -132,6 +153,47 @@ function getTitles(layout) {
132
153
  };
133
154
  return titles;
134
155
  }
156
+ const getXAxisTickFormat = (series, layout)=>{
157
+ const xAxis = getXAxisProperties(series, layout);
158
+ if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
159
+ return {
160
+ tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
161
+ };
162
+ }
163
+ return {};
164
+ };
165
+ const getYAxisTickFormat = (series, layout)=>{
166
+ const yAxis = getYAxisProperties(series, layout);
167
+ if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
168
+ return {
169
+ yAxisTickFormat: (0, _d3format.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
170
+ };
171
+ }
172
+ return {};
173
+ };
174
+ const getYMinMaxValues = (series, layout)=>{
175
+ var _getYAxisProperties;
176
+ const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
177
+ if (range && range.length === 2) {
178
+ return {
179
+ yMinValue: range[0],
180
+ yMaxValue: range[1]
181
+ };
182
+ }
183
+ return {};
184
+ };
185
+ const getYAxisProperties = (series, layout)=>{
186
+ return layout === null || layout === void 0 ? void 0 : layout.yaxis;
187
+ };
188
+ const getXAxisProperties = (series, layout)=>{
189
+ return layout === null || layout === void 0 ? void 0 : layout.xaxis;
190
+ };
191
+ const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
192
+ if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
193
+ return yAxisFormat.yAxisTickFormat(yVal);
194
+ }
195
+ return (0, _chartutilities.formatToLocaleString)(yVal);
196
+ };
135
197
  const correctYearMonth = (xValues)=>{
136
198
  const presentYear = new Date().getFullYear();
137
199
  if (xValues.length > 0 && Array.isArray(xValues[0])) {
@@ -230,8 +292,117 @@ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
230
292
  }
231
293
  return x;
232
294
  };
295
+ /**
296
+ * Checks if a key should be ignored during normalization
297
+ * @param key The key to check
298
+ * @returns true if the key should be ignored
299
+ */ const shouldIgnoreKey = (key)=>{
300
+ const lowerKey = key.toLowerCase();
301
+ if (lowerKey.includes('style') || lowerKey === 'style') {
302
+ return true;
303
+ }
304
+ // Use regex to match common CSS property patterns
305
+ // (color, fill, stroke, border, background, font, shadow, outline, etc.)
306
+ const cssKeyRegex = new RegExp('^(color|fill|stroke|border|background|font|shadow|outline|margin|padding|gap|align|justify|display|flex|grid|' + 'text|line|letter|word|vertical|horizontal|overflow|position|top|right|bottom|left|zindex|z-index|opacity|' + 'filter|clip|cursor|resize|transition|animation|transform|box|column|row|direction|visibility|' + 'content|width|height|aspect|image|user|pointer|caret|scroll|%)|(-webkit-|-moz-|-ms-|-o-)', 'i');
307
+ if (cssKeyRegex.test(lowerKey)) {
308
+ return true;
309
+ }
310
+ return false;
311
+ };
312
+ /**
313
+ * Flattens a nested object into a single level object with dot notation keys
314
+ * @param obj Object to flatten
315
+ * @param prefix Optional prefix for keys
316
+ * @returns Flattened object
317
+ */ const flattenObject = (obj, prefix = '')=>{
318
+ const flattened = {};
319
+ for(const key in obj){
320
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
321
+ const newKey = prefix ? `${prefix}.${key}` : key;
322
+ const value = obj[key];
323
+ if (typeof value === 'object' && value !== null && !Array.isArray(value) && !(value instanceof Date)) {
324
+ // Recursively flatten nested objects
325
+ Object.assign(flattened, flattenObject(value, newKey));
326
+ } else {
327
+ flattened[newKey] = value;
328
+ }
329
+ }
330
+ }
331
+ return flattened;
332
+ };
333
+ const normalizeObjectArrayForGVBC = (data, xLabels)=>{
334
+ if (!data || data.length === 0) {
335
+ return {
336
+ traces: [],
337
+ x: []
338
+ };
339
+ }
340
+ // Use provided xLabels if available, otherwise default to Item 1, Item 2, ...
341
+ const x = xLabels && xLabels.length === data.length ? xLabels : data.map((_, index)=>`Item ${index + 1}`);
342
+ // First, flatten all objects and collect all unique keys, excluding style keys
343
+ const flattenedObjects = data.map((item, index)=>{
344
+ if (typeof item === 'object' && item !== null) {
345
+ const flattened = flattenObject(item);
346
+ // Only keep keys where the value is numeric (number or numeric string) and not a style key
347
+ const filtered = {};
348
+ Object.keys(flattened).forEach((key)=>{
349
+ const value = flattened[key];
350
+ if (!shouldIgnoreKey(key) && (typeof value === 'number' || typeof value === 'string' && (0, _chartutilities.isNumber)(value))) {
351
+ filtered[key] = value;
352
+ }
353
+ });
354
+ return filtered;
355
+ } else if (typeof item === 'number' || typeof item === 'string' && (0, _chartutilities.isNumber)(item)) {
356
+ // Only keep primitive numeric values
357
+ return {
358
+ [x[index] || `item_${index}`]: item
359
+ };
360
+ } else {
361
+ // Non-numeric primitive, ignore by returning empty object
362
+ return {};
363
+ }
364
+ });
365
+ // Collect all unique keys across all objects
366
+ const allKeys = new Set();
367
+ flattenedObjects.forEach((obj)=>{
368
+ Object.keys(obj).forEach((key)=>allKeys.add(key));
369
+ });
370
+ // Create traces for each key (property)
371
+ const traces = [];
372
+ allKeys.forEach((key)=>{
373
+ const yValues = [];
374
+ let hasValidData = false;
375
+ let isNumericData = false;
376
+ flattenedObjects.forEach((obj, index)=>{
377
+ const value = obj[key];
378
+ if (typeof value === 'number') {
379
+ yValues.push(value);
380
+ hasValidData = true;
381
+ isNumericData = true;
382
+ } else if (typeof value === 'string' && (0, _chartutilities.isNumber)(value)) {
383
+ yValues.push(parseFloat(value));
384
+ hasValidData = true;
385
+ isNumericData = true;
386
+ }
387
+ });
388
+ // Only create trace if we have valid numeric data
389
+ if (hasValidData && isNumericData) {
390
+ const trace = {
391
+ type: 'bar',
392
+ name: key,
393
+ x,
394
+ y: yValues
395
+ };
396
+ traces.push(trace);
397
+ }
398
+ });
399
+ return {
400
+ traces,
401
+ x
402
+ };
403
+ };
233
404
  const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
234
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _firstData_labels, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
405
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
235
406
  const firstData = input.data[0];
236
407
  var _input_layout_piecolorway, _input_layout_piecolorway1;
237
408
  // extract colors for each series only once
@@ -239,24 +410,53 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
239
410
  // otherwise, default to colorway from template
240
411
  const colors = (0, _PlotlyColorAdapter.extractColor)((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme);
241
412
  const mapLegendToDataPoint = {};
242
- (_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
243
- const value = getNumberAtIndexOrDefault(firstData.values, index);
244
- if ((0, _chartutilities.isInvalidValue)(value) || value < 0) {
245
- return;
246
- }
247
- const legend = `${label}`;
248
- // resolve color for each legend from the extracted colors
249
- const color = (0, _PlotlyColorAdapter.resolveColor)(colors, index, legend, colorMap, isDarkTheme);
250
- if (!mapLegendToDataPoint[legend]) {
251
- mapLegendToDataPoint[legend] = {
252
- legend,
253
- data: value,
254
- color
255
- };
256
- } else {
257
- mapLegendToDataPoint[legend].data += value;
413
+ if (colors) {
414
+ var _firstData_labels;
415
+ (_firstData_labels = firstData.labels) === null || _firstData_labels === void 0 ? void 0 : _firstData_labels.forEach((label, index)=>{
416
+ const value = getNumberAtIndexOrDefault(firstData.values, index);
417
+ if ((0, _chartutilities.isInvalidValue)(value) || value < 0) {
418
+ return;
419
+ }
420
+ const legend = `${label}`;
421
+ // resolve color for each legend from the extracted colors
422
+ const color = (0, _PlotlyColorAdapter.resolveColor)(colors, index, legend, colorMap, isDarkTheme);
423
+ if (!mapLegendToDataPoint[legend]) {
424
+ mapLegendToDataPoint[legend] = {
425
+ legend,
426
+ data: value,
427
+ color
428
+ };
429
+ } else {
430
+ mapLegendToDataPoint[legend].data += value;
431
+ }
432
+ });
433
+ } else {
434
+ // Sort labels by value descending before mapping
435
+ if (firstData.labels && firstData.values) {
436
+ const labelValuePairs = firstData.labels.map((label, index)=>({
437
+ label,
438
+ value: getNumberAtIndexOrDefault(firstData.values, index),
439
+ index
440
+ }));
441
+ // Filter out invalid values
442
+ const validPairs = labelValuePairs.filter((pair)=>!(0, _chartutilities.isInvalidValue)(pair.value));
443
+ // Sort descending by value
444
+ validPairs.sort((a, b)=>b.value - a.value);
445
+ validPairs.forEach((pair, sortedIdx)=>{
446
+ const legend = `${pair.label}`;
447
+ const color = (0, _PlotlyColorAdapter.resolveColor)(colors, sortedIdx, legend, colorMap, isDarkTheme);
448
+ if (!mapLegendToDataPoint[legend]) {
449
+ mapLegendToDataPoint[legend] = {
450
+ legend,
451
+ data: pair.value,
452
+ color
453
+ };
454
+ } else {
455
+ mapLegendToDataPoint[legend].data += pair.value;
456
+ }
457
+ });
258
458
  }
259
- });
459
+ }
260
460
  var _input_layout_width;
261
461
  const width = (_input_layout_width = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
262
462
  var _input_layout_height;
@@ -275,7 +475,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
275
475
  chartTitle,
276
476
  chartData: Object.values(mapLegendToDataPoint)
277
477
  },
278
- hideLegend: ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false ? true : false,
478
+ hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
279
479
  width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
280
480
  height,
281
481
  innerRadius,
@@ -294,17 +494,16 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
294
494
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
295
495
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
296
496
  let colorScale = undefined;
497
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
297
498
  let yMinValue = 0;
298
499
  input.data.forEach((series, index1)=>{
299
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _input_layout_template_layout1, _input_layout_template1, _input_layout2, _series_line;
300
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
301
- colorScale = createColorScale(input.layout, series);
302
- }
500
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line;
501
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
303
502
  const isXYearCategory = (0, _chartutilities.isYearArray)(series.x); // Consider year as categorical not numeric continuous axis
304
503
  // extract bar colors for each series only once
305
- const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
504
+ const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
306
505
  // extract line colors for each series only once
307
- const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
506
+ const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
308
507
  const xValues = series.x;
309
508
  const isXDate = (0, _chartutilities.isDateArray)(xValues);
310
509
  const isXString = (0, _chartutilities.isStringArray)(xValues);
@@ -327,6 +526,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
327
526
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
328
527
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
329
528
  const yVal = rangeYValues[index2];
529
+ const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
330
530
  if (series.type === 'bar') {
331
531
  var _rgb_copy_formatHex8;
332
532
  mapXToDataPoints[x].chartData.push({
@@ -334,7 +534,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
334
534
  data: yVal,
335
535
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
336
536
  opacity
337
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
537
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
538
+ yAxisCalloutData
338
539
  });
339
540
  if (typeof yVal === 'number') {
340
541
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -356,7 +557,8 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
356
557
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
357
558
  mode: series.mode
358
559
  },
359
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
560
+ useSecondaryYScale: usesSecondaryYScale(series, input.layout),
561
+ yAxisCalloutData
360
562
  });
361
563
  if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
362
564
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -367,7 +569,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
367
569
  });
368
570
  });
369
571
  });
370
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
371
572
  const vsbcData = Object.values(mapXToDataPoints);
372
573
  var _input_layout_height;
373
574
  return {
@@ -377,9 +578,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
377
578
  barWidth: 'auto',
378
579
  yMaxValue,
379
580
  yMinValue,
380
- chartTitle,
381
- xAxisTitle,
382
- yAxisTitle,
383
581
  mode: 'plotly',
384
582
  ...secondaryYAxisValues,
385
583
  wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
@@ -390,36 +588,55 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
390
588
  showYAxisLables: true,
391
589
  noOfCharsToTruncate: 20,
392
590
  showYAxisLablesTooltip: true,
393
- ...getAxisCategoryOrderProps(input.data, input.layout)
591
+ ...getTitles(input.layout),
592
+ ...getXAxisTickFormat(input.data[0], input.layout),
593
+ ...yAxisTickFormat,
594
+ ...getAxisCategoryOrderProps(input.data, input.layout),
595
+ ...getBarProps(input.data, input.layout),
596
+ ...getYMinMaxValues(input.data[0], input.layout),
597
+ ...getAxisTickProps(input.data, input.layout)
394
598
  };
395
599
  };
396
- const createColorScale = (layout, series)=>{
397
- var _layout_coloraxis, _series_marker, _layout_coloraxis1, _layout_coloraxis2;
398
- const scale = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis = layout.coloraxis) === null || _layout_coloraxis === void 0 ? void 0 : _layout_coloraxis.colorscale;
399
- const colorValues = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color;
400
- var _layout_coloraxis_cmin, _layout_coloraxis_cmax;
401
- const [dMin, dMax] = [
402
- (_layout_coloraxis_cmin = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis1 = layout.coloraxis) === null || _layout_coloraxis1 === void 0 ? void 0 : _layout_coloraxis1.cmin) !== null && _layout_coloraxis_cmin !== void 0 ? _layout_coloraxis_cmin : Math.min(...colorValues),
403
- (_layout_coloraxis_cmax = layout === null || layout === void 0 ? void 0 : (_layout_coloraxis2 = layout.coloraxis) === null || _layout_coloraxis2 === void 0 ? void 0 : _layout_coloraxis2.cmax) !== null && _layout_coloraxis_cmax !== void 0 ? _layout_coloraxis_cmax : Math.max(...colorValues)
404
- ];
405
- // Normalize colorscale domain to actual data domain
406
- const scaleDomain = scale.map(([pos])=>dMin + pos * (dMax - dMin));
407
- const scaleColors = scale.map((item)=>item[1]);
408
- return (0, _d3scale.scaleLinear)().domain(scaleDomain).range(scaleColors);
409
- };
410
600
  const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
411
- var _input_layout, _input_layout1, _gvbcData_;
601
+ var _processedInput_layout, _processedInput_layout1, _gvbcData_;
602
+ // Handle object arrays in y values by normalizing the data first
603
+ let processedInput = {
604
+ ...input
605
+ };
606
+ // Check if any bar traces have object arrays as y values
607
+ const hasObjectArrayData = input.data.some((series)=>series.type === 'bar' && (0, _chartutilities.isObjectArray)(series.y));
608
+ if (hasObjectArrayData) {
609
+ // Process each trace that has object array y values
610
+ const processedData = input.data.map((series, index)=>{
611
+ if (series.type === 'bar' && (0, _chartutilities.isObjectArray)(series.y)) {
612
+ // Normalize the object array to create multiple traces for GVBC
613
+ const { traces } = normalizeObjectArrayForGVBC(series.y, Array.isArray(series.x) ? series.x : undefined);
614
+ // Return all the new traces, each representing a property from the objects
615
+ return traces.map((trace)=>({
616
+ ...trace,
617
+ // Copy other properties from the original series if needed
618
+ marker: series.marker
619
+ }));
620
+ }
621
+ return [
622
+ series
623
+ ];
624
+ }).flat();
625
+ processedInput = {
626
+ ...input,
627
+ data: processedData
628
+ };
629
+ }
412
630
  const mapXToDataPoints = {};
413
- const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
414
- const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
631
+ const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout, 0, 0);
632
+ const { legends, hideLegend } = getLegendProps(processedInput.data, processedInput.layout, isMultiPlot);
415
633
  let colorScale = undefined;
416
- input.data.forEach((series, index1)=>{
417
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_x;
418
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
419
- colorScale = createColorScale(input.layout, series);
420
- }
634
+ const yAxisTickFormat = getYAxisTickFormat(processedInput.data[0], processedInput.layout);
635
+ processedInput.data.forEach((series, index1)=>{
636
+ var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker, _series_x;
637
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(processedInput.layout, series, colorScale);
421
638
  // extract colors for each series only once
422
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
639
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
423
640
  (_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x.forEach((x, index2)=>{
424
641
  var _series_y;
425
642
  if ((0, _chartutilities.isInvalidValue)(x) || (0, _chartutilities.isInvalidValue)((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[index2])) {
@@ -437,38 +654,42 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
437
654
  // resolve color for each legend's bars from the colorscale or extracted colors
438
655
  const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index2, legend, colorMap, isDarkTheme);
439
656
  const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
657
+ const yVal = series.y[index2];
440
658
  var _rgb_copy_formatHex8;
441
659
  mapXToDataPoints[x].series.push({
442
660
  key: legend,
443
- data: series.y[index2],
661
+ data: yVal,
444
662
  xAxisCalloutData: x,
445
663
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
446
664
  opacity
447
665
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
448
666
  legend,
449
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
667
+ useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout),
668
+ yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
450
669
  });
451
670
  }
452
671
  });
453
672
  });
454
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
455
673
  const gvbcData = Object.values(mapXToDataPoints);
456
- var _input_layout_height;
674
+ var _processedInput_layout_height;
457
675
  return {
458
676
  data: gvbcData,
459
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
460
- height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
677
+ width: (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : _processedInput_layout.width,
678
+ height: (_processedInput_layout_height = (_processedInput_layout1 = processedInput.layout) === null || _processedInput_layout1 === void 0 ? void 0 : _processedInput_layout1.height) !== null && _processedInput_layout_height !== void 0 ? _processedInput_layout_height : 350,
461
679
  barWidth: 'auto',
462
- chartTitle,
463
- xAxisTitle,
464
- yAxisTitle,
465
680
  mode: 'plotly',
466
681
  ...secondaryYAxisValues,
467
682
  hideTickOverlap: true,
468
683
  wrapXAxisLables: typeof ((_gvbcData_ = gvbcData[0]) === null || _gvbcData_ === void 0 ? void 0 : _gvbcData_.name) === 'string',
469
684
  hideLegend,
470
685
  roundCorners: true,
471
- ...getAxisCategoryOrderProps(input.data, input.layout)
686
+ ...getTitles(processedInput.layout),
687
+ ...getAxisCategoryOrderProps(processedInput.data, processedInput.layout),
688
+ ...getYMinMaxValues(processedInput.data[0], processedInput.layout),
689
+ ...getXAxisTickFormat(processedInput.data[0], processedInput.layout),
690
+ ...yAxisTickFormat,
691
+ ...getBarProps(processedInput.data, processedInput.layout),
692
+ ...getAxisTickProps(processedInput.data, processedInput.layout)
472
693
  };
473
694
  };
474
695
  const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -477,15 +698,13 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
477
698
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
478
699
  let colorScale = undefined;
479
700
  input.data.forEach((series, seriesIdx)=>{
480
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3, _series_xbins, _series_xbins1, _series_xbins2;
701
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_xbins, _series_xbins1, _series_xbins2;
481
702
  if (!series.x) {
482
703
  return;
483
704
  }
484
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
485
- colorScale = createColorScale(input.layout, series);
486
- }
705
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
487
706
  // extract colors for each series only once
488
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
707
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
489
708
  const xValues = [];
490
709
  const yValues = [];
491
710
  series.x.forEach((xVal, index)=>{
@@ -534,21 +753,19 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
534
753
  });
535
754
  });
536
755
  });
537
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
538
756
  var _input_layout_height;
539
757
  return {
540
758
  data: vbcData,
541
759
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
542
760
  height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
543
- chartTitle,
544
- xAxisTitle,
545
- yAxisTitle,
546
761
  mode: 'histogram',
547
762
  hideTickOverlap: true,
548
763
  wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
549
764
  maxBarWidth: 50,
550
765
  hideLegend,
551
766
  roundCorners: true,
767
+ ...getTitles(input.layout),
768
+ ...getYMinMaxValues(input.data[0], input.layout),
552
769
  ...getAxisCategoryOrderProps(input.data, input.layout)
553
770
  };
554
771
  };
@@ -562,20 +779,23 @@ const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, co
562
779
  return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
563
780
  };
564
781
  const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
565
- var _input_data_;
782
+ var _input_data_, _input_layout, _input_layout1;
566
783
  const isScatterMarkers = [
784
+ 'text',
567
785
  'markers',
568
786
  'text+markers',
569
787
  'markers+text',
570
788
  'lines+markers',
571
789
  'markers+line',
572
- 'text+lines+markers'
790
+ 'text+lines+markers',
791
+ 'lines+markers+text'
573
792
  ].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
574
793
  const isAreaChart = chartType === 'area';
575
794
  const isScatterChart = chartType === 'scatter';
576
795
  const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
577
796
  let mode = 'tonexty';
578
797
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
798
+ const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
579
799
  const chartData = input.data.map((series, index)=>{
580
800
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _series_mode1;
581
801
  const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
@@ -591,11 +811,12 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
591
811
  const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
592
812
  const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
593
813
  mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
594
- const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) ? getLineOptions(series.line) : undefined;
814
+ // if mode contains 'text', we prioritize showing the text over curving the line
815
+ const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
595
816
  const legendShape = getLegendShape(series);
596
817
  const validXYRanges = getValidXYRanges(series);
597
818
  return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
598
- var _series_marker;
819
+ var _series_marker, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
599
820
  const rangeXValues = xValues.slice(rangeStart, rangeEnd);
600
821
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
601
822
  const markerSizes = (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
@@ -616,7 +837,8 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
616
837
  } : {},
617
838
  ...textValues ? {
618
839
  text: textValues[i]
619
- } : {}
840
+ } : {},
841
+ yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
620
842
  };
621
843
  }),
622
844
  color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
@@ -624,58 +846,65 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
624
846
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : seriesColor,
625
847
  lineOptions: {
626
848
  ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
627
- mode: series.mode
849
+ mode: series.type !== 'scatterpolar' ? series.mode : 'scatterpolar',
850
+ // originXOffset is not typed on Layout, but may be present in input.layout as a part of projection of
851
+ // scatter polar coordingates to cartesian coordinates
852
+ ...series.type === 'scatterpolar' ? {
853
+ originXOffset: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.__polarOriginX,
854
+ direction: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_polar = _input_layout1.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction,
855
+ rotation: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout2.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation,
856
+ axisLabel: series.__axisLabel ? series.__axisLabel : {}
857
+ } : {}
628
858
  },
629
859
  useSecondaryYScale: usesSecondaryYScale(series, input.layout)
630
860
  };
631
861
  });
632
862
  }).flat();
633
- const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
634
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
863
+ const yMinMax = getYMinMaxValues(input.data[0], input.layout);
864
+ if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
865
+ const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
866
+ yMinMax.yMinValue = yMinMaxValues.startValue;
867
+ yMinMax.yMaxValue = yMinMaxValues.endValue;
868
+ }
635
869
  const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
636
870
  const chartProps = {
637
- chartTitle,
638
871
  lineChartData: chartData
639
872
  };
640
873
  const scatterChartProps = {
641
- chartTitle,
642
874
  scatterChartData: chartData
643
875
  };
876
+ var _input_layout_height;
877
+ const commonProps = {
878
+ supportNegativeData: true,
879
+ ...secondaryYAxisValues,
880
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
881
+ height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
882
+ hideTickOverlap: true,
883
+ hideLegend,
884
+ useUTC: false,
885
+ optimizeLargeData: numDataPoints > 1000,
886
+ ...getTitles(input.layout),
887
+ ...getXAxisTickFormat(input.data[0], input.layout),
888
+ ...yAxisTickFormat,
889
+ ...getAxisScaleTypeProps(input.data, input.layout),
890
+ ...getAxisTickProps(input.data, input.layout)
891
+ };
644
892
  if (isAreaChart) {
645
- var _input_layout, _input_layout1;
646
- var _input_layout_height;
647
893
  return {
648
894
  data: chartProps,
649
- supportNegativeData: true,
650
- xAxisTitle,
651
- yAxisTitle,
652
- ...secondaryYAxisValues,
653
895
  mode,
654
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
655
- height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
656
- hideTickOverlap: true,
657
- useUTC: false,
658
- hideLegend,
659
- optimizeLargeData: numDataPoints > 1000
896
+ ...commonProps
660
897
  };
661
898
  } else {
662
- var _input_layout2, _input_layout3;
663
- var _input_layout_height1;
664
899
  return {
665
900
  data: isScatterChart ? scatterChartProps : chartProps,
666
- supportNegativeData: true,
667
- xAxisTitle,
668
- yAxisTitle,
669
- ...secondaryYAxisValues,
670
901
  roundedTicks: true,
671
- yMinValue: yMinMaxValues.startValue,
672
- yMaxValue: yMinMaxValues.endValue,
673
- width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
674
- height: (_input_layout_height1 = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height1 !== void 0 ? _input_layout_height1 : 350,
675
- hideTickOverlap: true,
676
- useUTC: false,
677
- hideLegend,
678
- optimizeLargeData: numDataPoints > 1000
902
+ ...commonProps,
903
+ ...yMinMax,
904
+ ...isScatterChart ? {
905
+ showYAxisLablesTooltip: true,
906
+ ...getAxisCategoryOrderProps(input.data, input.layout)
907
+ } : {}
679
908
  };
680
909
  }
681
910
  };
@@ -684,12 +913,10 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
684
913
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
685
914
  let colorScale = undefined;
686
915
  const chartData = input.data.map((series, index)=>{
687
- var _input_layout_coloraxis_colorscale, _input_layout_coloraxis, _input_layout, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout1, _series_marker3;
688
- if (((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : (_input_layout_coloraxis_colorscale = _input_layout_coloraxis.colorscale) === null || _input_layout_coloraxis_colorscale === void 0 ? void 0 : _input_layout_coloraxis_colorscale.length) && (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) && ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length > 0 && typeof ((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[0]) === 'number') {
689
- colorScale = createColorScale(input.layout, series);
690
- }
916
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
917
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
691
918
  // extract colors for each series only once
692
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker3 = series.marker) === null || _series_marker3 === void 0 ? void 0 : _series_marker3.color, colorMap, isDarkTheme);
919
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
693
920
  const legend = legends[index];
694
921
  return series.y.map((yValue, i)=>{
695
922
  var _series_x, _series_marker, _series_marker1, _series_marker_color, _series_marker2;
@@ -721,12 +948,8 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
721
948
  const scalingFactor = 0.01;
722
949
  const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
723
950
  const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
724
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
725
951
  return {
726
952
  data: chartData,
727
- chartTitle,
728
- xAxisTitle,
729
- yAxisTitle,
730
953
  secondaryYAxistitle: typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_yaxis2 = _input_layout3.yaxis2) === null || _input_layout_yaxis2 === void 0 ? void 0 : _input_layout_yaxis2.title) === 'string' ? (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_yaxis21 = _input_layout4.yaxis2) === null || _input_layout_yaxis21 === void 0 ? void 0 : _input_layout_yaxis21.title : ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_yaxis22 = _input_layout5.yaxis2) === null || _input_layout_yaxis22 === void 0 ? void 0 : (_input_layout_yaxis2_title = _input_layout_yaxis22.title) === null || _input_layout_yaxis2_title === void 0 ? void 0 : _input_layout_yaxis2_title.text) || '',
731
954
  barHeight,
732
955
  showYAxisLables: true,
@@ -737,7 +960,67 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
737
960
  showYAxisLablesTooltip: true,
738
961
  hideLegend,
739
962
  roundCorners: true,
740
- ...getAxisCategoryOrderProps(input.data, input.layout)
963
+ ...getTitles(input.layout),
964
+ ...getAxisCategoryOrderProps(input.data, input.layout),
965
+ ...getBarProps(input.data, input.layout, true),
966
+ ...getAxisTickProps(input.data, input.layout)
967
+ };
968
+ };
969
+ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
970
+ var _input_layout, _input_layout1;
971
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
972
+ let colorScale = undefined;
973
+ const chartData = input.data.map((series, index)=>{
974
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_xaxis, _input_layout1;
975
+ colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
976
+ // extract colors for each series only once
977
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
978
+ const legend = legends[index];
979
+ const isXDate = ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_xaxis = _input_layout1.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' || (0, _chartutilities.isDateArray)(series.x);
980
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
981
+ const convertXValueToNumber = (value)=>{
982
+ return (0, _chartutilities.isInvalidValue)(value) ? 0 : isXDate ? +parseLocalDate(value) : +value;
983
+ };
984
+ return series.y.map((yVal, i)=>{
985
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _series_base, _series_x;
986
+ if ((0, _chartutilities.isInvalidValue)(yVal)) {
987
+ return null;
988
+ }
989
+ // resolve color for each legend's bars from the colorscale or extracted colors
990
+ const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
991
+ const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
992
+ const base = convertXValueToNumber((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
993
+ const xVal = convertXValueToNumber((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
994
+ var _rgb_copy_formatHex8;
995
+ return {
996
+ x: {
997
+ start: isXDate ? new Date(base) : base,
998
+ end: isXDate ? new Date(base + xVal) : base + xVal
999
+ },
1000
+ y: yVal,
1001
+ legend,
1002
+ color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1003
+ opacity
1004
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1005
+ };
1006
+ }).filter((point)=>point !== null);
1007
+ }).flat();
1008
+ var _input_layout_height;
1009
+ return {
1010
+ data: chartData,
1011
+ showYAxisLables: true,
1012
+ height: (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1013
+ width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
1014
+ hideTickOverlap: true,
1015
+ hideLegend,
1016
+ noOfCharsToTruncate: 20,
1017
+ showYAxisLablesTooltip: true,
1018
+ roundCorners: true,
1019
+ useUTC: false,
1020
+ ...getTitles(input.layout),
1021
+ ...getAxisCategoryOrderProps(input.data, input.layout),
1022
+ ...getBarProps(input.data, input.layout, true),
1023
+ ...getAxisTickProps(input.data, input.layout)
741
1024
  };
742
1025
  };
743
1026
  const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -850,7 +1133,6 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
850
1133
  }
851
1134
  const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
852
1135
  const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
853
- const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);
854
1136
  var _input_layout_height;
855
1137
  return {
856
1138
  data: [
@@ -860,9 +1142,6 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
860
1142
  rangeValuesForColorScale,
861
1143
  hideLegend: true,
862
1144
  showYAxisLables: true,
863
- chartTitle,
864
- xAxisTitle,
865
- yAxisTitle,
866
1145
  sortOrder: 'none',
867
1146
  width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
868
1147
  height: (_input_layout_height = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
@@ -870,9 +1149,11 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
870
1149
  noOfCharsToTruncate: 20,
871
1150
  showYAxisLablesTooltip: true,
872
1151
  wrapXAxisLables: true,
1152
+ ...getTitles(input.layout),
873
1153
  ...getAxisCategoryOrderProps([
874
1154
  firstData
875
- ], input.layout)
1155
+ ], input.layout),
1156
+ ...getAxisTickProps(input.data, input.layout)
876
1157
  };
877
1158
  };
878
1159
  const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -1020,37 +1301,49 @@ const formatValue = (value, colIndex, cells)=>{
1020
1301
  }
1021
1302
  return `${prefix !== null && prefix !== void 0 ? prefix : ''}${formatted}${suffix !== null && suffix !== void 0 ? suffix : ''}`;
1022
1303
  };
1304
+ function resolveCellStyle(raw, rowIndex, colIndex) {
1305
+ if (Array.isArray(raw)) {
1306
+ var _raw_colIndex;
1307
+ const rowEntry = (_raw_colIndex = raw[colIndex]) !== null && _raw_colIndex !== void 0 ? _raw_colIndex : raw[0];
1308
+ if (Array.isArray(rowEntry)) {
1309
+ var _rowEntry_rowIndex;
1310
+ return (_rowEntry_rowIndex = rowEntry[rowIndex]) !== null && _rowEntry_rowIndex !== void 0 ? _rowEntry_rowIndex : rowEntry[0];
1311
+ }
1312
+ return rowEntry;
1313
+ }
1314
+ return raw;
1315
+ }
1316
+ function mergeCells(tableCells, templateCells) {
1317
+ var _tableCells_values, _ref, _tableCells_align, _templateCells_fill, _tableCells_fill, _templateCells_font, _tableCells_font, _tableCells_format, _tableCells_prefix, _tableCells_suffix;
1318
+ return {
1319
+ values: (_ref = (_tableCells_values = tableCells === null || tableCells === void 0 ? void 0 : tableCells.values) !== null && _tableCells_values !== void 0 ? _tableCells_values : templateCells === null || templateCells === void 0 ? void 0 : templateCells.values) !== null && _ref !== void 0 ? _ref : [],
1320
+ align: (_tableCells_align = tableCells === null || tableCells === void 0 ? void 0 : tableCells.align) !== null && _tableCells_align !== void 0 ? _tableCells_align : templateCells === null || templateCells === void 0 ? void 0 : templateCells.align,
1321
+ fill: {
1322
+ ...(_templateCells_fill = templateCells === null || templateCells === void 0 ? void 0 : templateCells.fill) !== null && _templateCells_fill !== void 0 ? _templateCells_fill : {},
1323
+ ...(_tableCells_fill = tableCells === null || tableCells === void 0 ? void 0 : tableCells.fill) !== null && _tableCells_fill !== void 0 ? _tableCells_fill : {}
1324
+ },
1325
+ font: {
1326
+ ...(_templateCells_font = templateCells === null || templateCells === void 0 ? void 0 : templateCells.font) !== null && _templateCells_font !== void 0 ? _templateCells_font : {},
1327
+ ...(_tableCells_font = tableCells === null || tableCells === void 0 ? void 0 : tableCells.font) !== null && _tableCells_font !== void 0 ? _tableCells_font : {}
1328
+ },
1329
+ format: (_tableCells_format = tableCells === null || tableCells === void 0 ? void 0 : tableCells.format) !== null && _tableCells_format !== void 0 ? _tableCells_format : templateCells === null || templateCells === void 0 ? void 0 : templateCells.format,
1330
+ prefix: (_tableCells_prefix = tableCells === null || tableCells === void 0 ? void 0 : tableCells.prefix) !== null && _tableCells_prefix !== void 0 ? _tableCells_prefix : templateCells === null || templateCells === void 0 ? void 0 : templateCells.prefix,
1331
+ suffix: (_tableCells_suffix = tableCells === null || tableCells === void 0 ? void 0 : tableCells.suffix) !== null && _tableCells_suffix !== void 0 ? _tableCells_suffix : templateCells === null || templateCells === void 0 ? void 0 : templateCells.suffix
1332
+ };
1333
+ }
1023
1334
  const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1024
- var _tableData_cells, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _tableData_header, _tableData_header1, _input_layout_template_data1, _input_layout_template1, _input_layout2, _input_layout3, _input_layout4;
1335
+ var _tableData_cells, _input_layout_template_data_table_, _input_layout_template_data_table, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _input_layout_template_data_table_1, _input_layout_template_data_table1, _input_layout_template_data1, _input_layout_template1, _input_layout2, _tableData_header, _input_layout3, _input_layout4;
1025
1336
  const tableData = input.data[0];
1026
1337
  const normalizeHeaders = (values, header)=>{
1027
1338
  const cleanedValues = Array.isArray(values[0]) ? values.map((row)=>row.map((cell)=>cleanText(cell)).filter(Boolean).join(' ')) : values.map((cell)=>cleanText(cell));
1028
1339
  return cleanedValues.map((value, colIndex)=>{
1029
1340
  var _header_font, _header_font1, _header_fill;
1030
- const fontColorRaw = header === null || header === void 0 ? void 0 : (_header_font = header.font) === null || _header_font === void 0 ? void 0 : _header_font.color;
1031
- let fontColor;
1032
- if (Array.isArray(fontColorRaw)) {
1033
- const colorEntry = fontColorRaw[colIndex];
1034
- if (Array.isArray(colorEntry)) {
1035
- fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
1036
- } else if (typeof colorEntry === 'string') {
1037
- fontColor = colorEntry;
1038
- }
1039
- } else if (typeof fontColorRaw === 'string') {
1040
- fontColor = fontColorRaw;
1041
- }
1042
- const fontSizeRaw = header === null || header === void 0 ? void 0 : (_header_font1 = header.font) === null || _header_font1 === void 0 ? void 0 : _header_font1.size;
1043
- let fontSize;
1044
- if (Array.isArray(fontSizeRaw)) {
1045
- fontSize = Array.isArray(fontSizeRaw[0]) ? fontSizeRaw[0][colIndex] : fontSizeRaw[colIndex];
1046
- } else if (typeof fontSizeRaw === 'number') {
1047
- fontSize = fontSizeRaw;
1048
- }
1049
- const updatedColIndex = colIndex >= 1 ? 1 : 0;
1050
- const fillColorRaw = header === null || header === void 0 ? void 0 : (_header_fill = header.fill) === null || _header_fill === void 0 ? void 0 : _header_fill.color;
1051
- const backgroundColor = Array.isArray(fillColorRaw) ? fillColorRaw[updatedColIndex] : fillColorRaw;
1052
- const textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
1053
- const textAlign = Array.isArray(textAlignRaw) ? textAlignRaw[colIndex] : textAlignRaw;
1341
+ //headers are at first row only
1342
+ const rowIndex = 0;
1343
+ const fontColor = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_font = header.font) === null || _header_font === void 0 ? void 0 : _header_font.color, rowIndex, colIndex);
1344
+ const fontSize = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_font1 = header.font) === null || _header_font1 === void 0 ? void 0 : _header_font1.size, rowIndex, colIndex);
1345
+ const backgroundColor = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_fill = header.fill) === null || _header_fill === void 0 ? void 0 : _header_fill.color, rowIndex, colIndex);
1346
+ const textAlign = resolveCellStyle(header === null || header === void 0 ? void 0 : header.align, rowIndex, colIndex);
1054
1347
  const style = {
1055
1348
  ...typeof fontColor === 'string' ? {
1056
1349
  color: fontColor
@@ -1073,42 +1366,16 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1073
1366
  };
1074
1367
  var _tableData_cells_values;
1075
1368
  const columns = (_tableData_cells_values = (_tableData_cells = tableData.cells) === null || _tableData_cells === void 0 ? void 0 : _tableData_cells.values) !== null && _tableData_cells_values !== void 0 ? _tableData_cells_values : [];
1076
- const cells = tableData.cells.font ? tableData.cells : (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template.data) === null || _input_layout_template_data === void 0 ? void 0 : _input_layout_template_data.table[0].cells;
1369
+ const cells = mergeCells(tableData.cells, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_table = _input_layout_template_data.table) === null || _input_layout_template_data_table === void 0 ? void 0 : (_input_layout_template_data_table_ = _input_layout_template_data_table[0]) === null || _input_layout_template_data_table_ === void 0 ? void 0 : _input_layout_template_data_table_.cells);
1077
1370
  const rows = columns[0].map((_, rowIndex)=>columns.map((col, colIndex)=>{
1078
1371
  var _cells_font, _cells_font1, _cells_fill;
1079
1372
  const cellValue = col[rowIndex];
1080
1373
  const cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
1081
1374
  const formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number' ? formatValue(cleanValue, colIndex, cells) : cleanValue;
1082
- const rawFontColor = cells === null || cells === void 0 ? void 0 : (_cells_font = cells.font) === null || _cells_font === void 0 ? void 0 : _cells_font.color;
1083
- let fontColor;
1084
- if (Array.isArray(rawFontColor)) {
1085
- const entry = rawFontColor[colIndex];
1086
- const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1087
- fontColor = typeof colorValue === 'string' ? colorValue : undefined;
1088
- } else if (typeof rawFontColor === 'string') {
1089
- fontColor = rawFontColor;
1090
- }
1091
- const rawFontSize = cells === null || cells === void 0 ? void 0 : (_cells_font1 = cells.font) === null || _cells_font1 === void 0 ? void 0 : _cells_font1.size;
1092
- let fontSize;
1093
- if (Array.isArray(rawFontSize)) {
1094
- const entry = rawFontSize[colIndex];
1095
- const fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1096
- fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
1097
- } else if (typeof rawFontSize === 'number') {
1098
- fontSize = rawFontSize;
1099
- }
1100
- const updatedColIndex = colIndex >= 1 ? 1 : 0;
1101
- const rawBackgroundColor = cells === null || cells === void 0 ? void 0 : (_cells_fill = cells.fill) === null || _cells_fill === void 0 ? void 0 : _cells_fill.color;
1102
- let backgroundColor;
1103
- if (Array.isArray(rawBackgroundColor)) {
1104
- const entry = rawBackgroundColor[updatedColIndex];
1105
- const colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
1106
- backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
1107
- } else if (typeof rawBackgroundColor === 'string') {
1108
- backgroundColor = rawBackgroundColor;
1109
- }
1110
- const rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? cells.align[colIndex] : cells === null || cells === void 0 ? void 0 : cells.align;
1111
- const textAlign = rawTextAlign;
1375
+ const fontColor = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_font = cells.font) === null || _cells_font === void 0 ? void 0 : _cells_font.color, rowIndex, colIndex);
1376
+ const fontSize = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_font1 = cells.font) === null || _cells_font1 === void 0 ? void 0 : _cells_font1.size, rowIndex, colIndex);
1377
+ const backgroundColor = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_fill = cells.fill) === null || _cells_fill === void 0 ? void 0 : _cells_fill.color, rowIndex, colIndex);
1378
+ const textAlign = resolveCellStyle(cells === null || cells === void 0 ? void 0 : cells.align, rowIndex, colIndex);
1112
1379
  const style = {
1113
1380
  ...fontColor ? {
1114
1381
  color: fontColor
@@ -1135,37 +1402,314 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
1135
1402
  } : {}
1136
1403
  }
1137
1404
  };
1405
+ const templateHeader = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template1.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_table1 = _input_layout_template_data1.table) === null || _input_layout_template_data_table1 === void 0 ? void 0 : (_input_layout_template_data_table_1 = _input_layout_template_data_table1[0]) === null || _input_layout_template_data_table_1 === void 0 ? void 0 : _input_layout_template_data_table_1.header;
1406
+ const tableHeader = tableData.header;
1407
+ var _tableHeader_align, _templateHeader_fill, _tableHeader_fill, _templateHeader_font, _tableHeader_font, _tableHeader_values, _ref;
1408
+ const header = {
1409
+ align: (_tableHeader_align = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.align) !== null && _tableHeader_align !== void 0 ? _tableHeader_align : templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.align,
1410
+ fill: {
1411
+ ...(_templateHeader_fill = templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.fill) !== null && _templateHeader_fill !== void 0 ? _templateHeader_fill : {},
1412
+ ...(_tableHeader_fill = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.fill) !== null && _tableHeader_fill !== void 0 ? _tableHeader_fill : {}
1413
+ },
1414
+ font: {
1415
+ ...(_templateHeader_font = templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.font) !== null && _templateHeader_font !== void 0 ? _templateHeader_font : {},
1416
+ ...(_tableHeader_font = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.font) !== null && _tableHeader_font !== void 0 ? _tableHeader_font : {}
1417
+ },
1418
+ values: (_ref = (_tableHeader_values = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.values) !== null && _tableHeader_values !== void 0 ? _tableHeader_values : templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.values) !== null && _ref !== void 0 ? _ref : []
1419
+ };
1138
1420
  var _tableData_header_values;
1139
1421
  return {
1140
- headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : [], ((_tableData_header1 = tableData.header) === null || _tableData_header1 === void 0 ? void 0 : _tableData_header1.font) ? tableData.header : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template1.data) === null || _input_layout_template_data1 === void 0 ? void 0 : _input_layout_template_data1.table[0].header),
1422
+ headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : [], header),
1141
1423
  rows,
1142
1424
  width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
1143
1425
  height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
1144
1426
  styles
1145
1427
  };
1146
1428
  };
1429
+ function getCategoriesAndValues(series) {
1430
+ const orientation = series.orientation || 'h';
1431
+ var _series_labels, _ref;
1432
+ const y = (_ref = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref !== void 0 ? _ref : series.stage;
1433
+ var _series_values, _ref1;
1434
+ const x = (_ref1 = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : series.x) !== null && _ref1 !== void 0 ? _ref1 : series.value;
1435
+ const xIsString = (0, _chartutilities.isStringArray)(x);
1436
+ const yIsString = (0, _chartutilities.isStringArray)(y);
1437
+ const xIsNumber = (0, _chartutilities.isNumberArray)(x);
1438
+ const yIsNumber = (0, _chartutilities.isNumberArray)(y);
1439
+ // Helper to ensure array of (string | number)
1440
+ const toArray = (arr)=>{
1441
+ if (Array.isArray(arr)) {
1442
+ return arr;
1443
+ }
1444
+ if (typeof arr === 'string' || typeof arr === 'number') {
1445
+ return [
1446
+ arr
1447
+ ];
1448
+ }
1449
+ return [];
1450
+ };
1451
+ if (orientation === 'h') {
1452
+ if (yIsString && xIsNumber) {
1453
+ return {
1454
+ categories: toArray(y),
1455
+ values: toArray(x)
1456
+ };
1457
+ } else if (xIsString && yIsNumber) {
1458
+ return {
1459
+ categories: toArray(x),
1460
+ values: toArray(y)
1461
+ };
1462
+ } else {
1463
+ return {
1464
+ categories: yIsString ? toArray(y) : toArray(x),
1465
+ values: yIsString ? toArray(x) : toArray(y)
1466
+ };
1467
+ }
1468
+ } else {
1469
+ if (xIsString && yIsNumber) {
1470
+ return {
1471
+ categories: toArray(x),
1472
+ values: toArray(y)
1473
+ };
1474
+ } else if (yIsString && xIsNumber) {
1475
+ return {
1476
+ categories: toArray(y),
1477
+ values: toArray(x)
1478
+ };
1479
+ } else {
1480
+ return {
1481
+ categories: xIsString ? toArray(x) : toArray(y),
1482
+ values: xIsString ? toArray(y) : toArray(x)
1483
+ };
1484
+ }
1485
+ }
1486
+ }
1487
+ const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1488
+ var _input_layout, _input_layout1, _input_data_, _input_layout2;
1489
+ const funnelData = [];
1490
+ // Determine if data is stacked based on multiple series with multiple values per series
1491
+ const isStacked = input.data.length > 1 && input.data.every((series)=>{
1492
+ var _series_values, _ref;
1493
+ const values = (_ref = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : series.x) !== null && _ref !== void 0 ? _ref : series.value;
1494
+ var _series_labels, _ref1;
1495
+ const labels = (_ref1 = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref1 !== void 0 ? _ref1 : series.stage;
1496
+ return Array.isArray(labels) && Array.isArray(values) && values.length > 1 && labels.length > 1;
1497
+ });
1498
+ if (isStacked) {
1499
+ // Assign a color per series/category and use it for all subValues of that category
1500
+ const seriesColors = {};
1501
+ input.data.forEach((series, seriesIdx)=>{
1502
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1;
1503
+ const category = series.name || `Category ${seriesIdx + 1}`;
1504
+ var _series_marker_colors;
1505
+ // Use the same color for this category across all stages
1506
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
1507
+ // Always use the first color for the series/category
1508
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, category, colorMap, isDarkTheme);
1509
+ seriesColors[category] = color;
1510
+ var _series_labels, _ref;
1511
+ const labels = (_ref = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref !== void 0 ? _ref : series.stage;
1512
+ var _series_values, _ref1;
1513
+ const values = (_ref1 = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : series.x) !== null && _ref1 !== void 0 ? _ref1 : series.value;
1514
+ if (!(0, _chartutilities.isArrayOrTypedArray)(labels) || !(0, _chartutilities.isArrayOrTypedArray)(values)) {
1515
+ return;
1516
+ }
1517
+ if (labels && (0, _chartutilities.isArrayOrTypedArray)(labels) && labels.length > 0) {
1518
+ labels.forEach((label, i)=>{
1519
+ const stageIndex = funnelData.findIndex((stage)=>stage.stage === label);
1520
+ const valueNum = Number(values[i]);
1521
+ if (isNaN(valueNum)) {
1522
+ return;
1523
+ }
1524
+ if (stageIndex === -1) {
1525
+ funnelData.push({
1526
+ stage: label,
1527
+ subValues: [
1528
+ {
1529
+ category,
1530
+ value: valueNum,
1531
+ color
1532
+ }
1533
+ ]
1534
+ });
1535
+ } else {
1536
+ funnelData[stageIndex].subValues.push({
1537
+ category,
1538
+ value: valueNum,
1539
+ color
1540
+ });
1541
+ }
1542
+ });
1543
+ }
1544
+ });
1545
+ } else {
1546
+ // Non-stacked data handling (multiple series with single-value arrays)
1547
+ input.data.forEach((series, seriesIdx)=>{
1548
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1;
1549
+ const { categories, values } = getCategoriesAndValues(series);
1550
+ if (!(0, _chartutilities.isArrayOrTypedArray)(categories) || !(0, _chartutilities.isArrayOrTypedArray)(values)) {
1551
+ return;
1552
+ }
1553
+ var _series_marker_colors;
1554
+ const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
1555
+ categories.forEach((label, i)=>{
1556
+ const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, label, colorMap, isDarkTheme);
1557
+ const valueNum = Number(values[i]);
1558
+ if (isNaN(valueNum)) {
1559
+ return;
1560
+ }
1561
+ funnelData.push({
1562
+ stage: label,
1563
+ value: valueNum,
1564
+ color
1565
+ });
1566
+ });
1567
+ });
1568
+ }
1569
+ return {
1570
+ data: funnelData,
1571
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
1572
+ height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
1573
+ orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
1574
+ hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false
1575
+ };
1576
+ };
1147
1577
  const projectPolarToCartesian = (input)=>{
1578
+ var _input_layout, _input_layout1;
1148
1579
  const projection = {
1149
1580
  ...input
1150
1581
  };
1582
+ // Find the global min and max radius across all series
1583
+ let minRadius = 0;
1584
+ let maxRadius = 0;
1151
1585
  for(let sindex = 0; sindex < input.data.length; sindex++){
1152
- var _series_r;
1586
+ const rVals = input.data[sindex].r;
1587
+ if (rVals && (0, _chartutilities.isArrayOrTypedArray)(rVals)) {
1588
+ for(let ptindex = 0; ptindex < rVals.length; ptindex++){
1589
+ if (!(0, _chartutilities.isInvalidValue)(rVals[ptindex])) {
1590
+ minRadius = Math.min(minRadius, rVals[ptindex]);
1591
+ maxRadius = Math.max(maxRadius, rVals[ptindex]);
1592
+ }
1593
+ }
1594
+ }
1595
+ }
1596
+ // If there are negative radii, compute the shift
1597
+ const radiusShift = minRadius < 0 ? -minRadius : 0;
1598
+ // Collect all unique theta values from all scatterpolar series for equal spacing
1599
+ const allThetaValues = new Set();
1600
+ for(let sindex = 0; sindex < input.data.length; sindex++){
1601
+ const series = input.data[sindex];
1602
+ if (series.theta && (0, _chartutilities.isArrayOrTypedArray)(series.theta)) {
1603
+ series.theta.forEach((theta)=>allThetaValues.add(String(theta)));
1604
+ }
1605
+ }
1606
+ // Project all points and create a perfect square domain
1607
+ const allX = [];
1608
+ const allY = [];
1609
+ let originX = null;
1610
+ for(let sindex = 0; sindex < input.data.length; sindex++){
1611
+ var _input_layout_polar_angularaxis, _input_layout_polar, _input_layout2, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout3;
1153
1612
  const series = input.data[sindex];
1613
+ // If scatterpolar, set __axisLabel to all unique theta values for equal spacing
1614
+ if ((0, _chartutilities.isArrayOrTypedArray)(series.theta)) {
1615
+ series.__axisLabel = Array.from(allThetaValues);
1616
+ }
1154
1617
  series.x = [];
1155
1618
  series.y = [];
1156
- var _series_r_length;
1157
- for(let ptindex = 0; ptindex < ((_series_r_length = (_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.length) !== null && _series_r_length !== void 0 ? _series_r_length : 0); ptindex++){
1158
- var _series_theta, _series_r1;
1159
- if ((0, _chartutilities.isInvalidValue)((_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[ptindex]) || (0, _chartutilities.isInvalidValue)((_series_r1 = series.r) === null || _series_r1 === void 0 ? void 0 : _series_r1[ptindex])) {
1619
+ const thetas = series.theta;
1620
+ const rVals = series.r;
1621
+ // Skip if rVals or thetas are not arrays
1622
+ if (!(0, _chartutilities.isArrayOrTypedArray)(rVals) || !(0, _chartutilities.isArrayOrTypedArray)(thetas)) {
1623
+ projection.data[sindex] = series;
1624
+ continue;
1625
+ }
1626
+ // retrieve polar axis settings
1627
+ const dirMultiplier = ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar = _input_layout2.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction) === 'clockwise' ? -1 : 1;
1628
+ var _input_layout_polar_angularaxis_rotation;
1629
+ const startAngleInRad = ((_input_layout_polar_angularaxis_rotation = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout3.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation) !== null && _input_layout_polar_angularaxis_rotation !== void 0 ? _input_layout_polar_angularaxis_rotation : 0) * Math.PI / 180;
1630
+ // Compute tick positions if categorical
1631
+ let uniqueTheta = [];
1632
+ let categorical = false;
1633
+ if (!(0, _chartutilities.isNumberArray)(thetas)) {
1634
+ uniqueTheta = Array.from(new Set(thetas));
1635
+ categorical = true;
1636
+ }
1637
+ for(let ptindex = 0; ptindex < rVals.length; ptindex++){
1638
+ if ((0, _chartutilities.isInvalidValue)(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || (0, _chartutilities.isInvalidValue)(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
1160
1639
  continue;
1161
1640
  }
1162
- const thetaRad = series.theta[ptindex] * Math.PI / 180;
1163
- const radius = series.r[ptindex];
1164
- series.x.push(radius * Math.cos(thetaRad));
1165
- series.y.push(radius * Math.sin(thetaRad));
1641
+ // Map theta to angle in radians
1642
+ let thetaRad;
1643
+ if (categorical) {
1644
+ const idx = uniqueTheta.indexOf(thetas[ptindex]);
1645
+ const step = 2 * Math.PI / uniqueTheta.length;
1646
+ thetaRad = startAngleInRad + dirMultiplier * idx * step;
1647
+ } else {
1648
+ thetaRad = startAngleInRad + dirMultiplier * (thetas[ptindex] * Math.PI / 180);
1649
+ }
1650
+ // Shift only the polar origin (not the cartesian)
1651
+ const rawRadius = rVals[ptindex];
1652
+ const polarRadius = rawRadius + radiusShift; // Only for projection
1653
+ // Calculate cartesian coordinates (with shifted polar origin)
1654
+ const x = polarRadius * Math.cos(thetaRad);
1655
+ const y = polarRadius * Math.sin(thetaRad);
1656
+ // Calculate the cartesian coordinates of the original polar origin (0,0)
1657
+ // This is the point that should be mapped to (0,0) in cartesian coordinates
1658
+ if (sindex === 0 && ptindex === 0) {
1659
+ // For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
1660
+ // But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
1661
+ originX = radiusShift;
1662
+ }
1663
+ series.x.push(x);
1664
+ series.y.push(y);
1665
+ allX.push(x);
1666
+ allY.push(y);
1667
+ }
1668
+ // Map text to each data point for downstream chart rendering
1669
+ if (series.x && series.y) {
1670
+ series.data = series.x.map((xVal, idx)=>({
1671
+ x: xVal,
1672
+ y: series.y[idx],
1673
+ ...series.text ? {
1674
+ text: series.text[idx]
1675
+ } : {}
1676
+ }));
1166
1677
  }
1167
1678
  projection.data[sindex] = series;
1168
1679
  }
1680
+ // 7. Recenter all cartesian coordinates
1681
+ if (originX !== null) {
1682
+ for(let sindex = 0; sindex < projection.data.length; sindex++){
1683
+ const series = projection.data[sindex];
1684
+ if (series.x && series.y) {
1685
+ series.x = series.x.map((v)=>v - originX);
1686
+ }
1687
+ }
1688
+ // Also recenter allX for normalization
1689
+ for(let i = 0; i < allX.length; i++){
1690
+ allX[i] = allX[i] - originX;
1691
+ }
1692
+ }
1693
+ // 8. Find the maximum absolute value among all x and y
1694
+ let maxAbs = Math.max(...allX.map(Math.abs), ...allY.map(Math.abs));
1695
+ maxAbs = maxAbs === 0 ? 1 : maxAbs;
1696
+ // 9. Rescale all points so that the largest |x| or |y| is 0.5
1697
+ for(let sindex = 0; sindex < projection.data.length; sindex++){
1698
+ const series = projection.data[sindex];
1699
+ if (series.x && series.y) {
1700
+ series.x = series.x.map((v)=>v / (2 * maxAbs));
1701
+ series.y = series.y.map((v)=>v / (2 * maxAbs));
1702
+ }
1703
+ }
1704
+ // 10. Customize layout for perfect square with absolute positioning
1705
+ const size = ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) || ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) || 500;
1706
+ projection.layout = {
1707
+ ...projection.layout,
1708
+ width: size,
1709
+ height: size
1710
+ };
1711
+ // Attach originX as custom properties
1712
+ projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
1169
1713
  return projection;
1170
1714
  };
1171
1715
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1271,11 +1815,11 @@ const createBins = (data, binStart, binEnd, binSize)=>{
1271
1815
  ]);
1272
1816
  if (typeof binSize === 'number' && binSize > 0) {
1273
1817
  const thresholds = [];
1274
- const precision = Math.max(getPrecision(minVal), getPrecision(binSize));
1275
- let th = precisionRound(minVal, precision);
1276
- while(th < precisionRound(maxVal + binSize, precision)){
1818
+ const precision = Math.max((0, _utilities.calculatePrecision)(minVal), (0, _utilities.calculatePrecision)(binSize));
1819
+ let th = (0, _utilities.precisionRound)(minVal, precision);
1820
+ while(th < (0, _utilities.precisionRound)(maxVal + binSize, precision)){
1277
1821
  thresholds.push(th);
1278
- th = precisionRound(th + binSize, precision);
1822
+ th = (0, _utilities.precisionRound)(th + binSize, precision);
1279
1823
  }
1280
1824
  minVal = thresholds[0];
1281
1825
  maxVal = thresholds[thresholds.length - 1];
@@ -1321,15 +1865,6 @@ const calculateHistNorm = (histnorm, value, total, dx, dy = 1)=>{
1321
1865
  return value;
1322
1866
  }
1323
1867
  };
1324
- const getPrecision = (value)=>{
1325
- var _value_toString_split_;
1326
- var _value_toString_split__length;
1327
- return (_value_toString_split__length = (_value_toString_split_ = value.toString().split('.')[1]) === null || _value_toString_split_ === void 0 ? void 0 : _value_toString_split_.length) !== null && _value_toString_split__length !== void 0 ? _value_toString_split__length : 0;
1328
- };
1329
- const precisionRound = (value, precision)=>{
1330
- const factor = Math.pow(10, precision);
1331
- return Math.round(value * factor) / factor;
1332
- };
1333
1868
  const getLegendShape = (series)=>{
1334
1869
  var _series_line, _series_mode;
1335
1870
  const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
@@ -1340,25 +1875,44 @@ const getLegendShape = (series)=>{
1340
1875
  }
1341
1876
  return 'default';
1342
1877
  };
1343
- const getAllupLegendsProps = (input, colorMap, colorwayType, isDarkTheme)=>{
1878
+ const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
1344
1879
  const allupLegends = [];
1345
1880
  // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
1346
1881
  const toShowLegend = input.data.reduce((acc, series)=>{
1347
- return acc || series.showlegend === true;
1882
+ return acc || series.showlegend === true || series.showlegend === undefined;
1348
1883
  }, false);
1349
1884
  if (toShowLegend) {
1350
1885
  input.data.forEach((series, index)=>{
1351
- var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout;
1352
- const name = series.legendgroup;
1353
- const color = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color) || ((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color);
1354
- const legendShape = getLegendShape(series);
1355
- const resolvedColor = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, color, colorMap, isDarkTheme);
1356
- if (name !== undefined && allupLegends.some((group)=>group.title === name) === false) {
1357
- allupLegends.push({
1358
- title: name,
1359
- color: resolvedColor,
1360
- shape: legendShape
1886
+ if (traceInfo[index].type === 'donut') {
1887
+ var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker, _pieSeries_labels;
1888
+ const pieSeries = series;
1889
+ var _input_layout_piecolorway, _input_layout_piecolorway1;
1890
+ const colors = (0, _PlotlyColorAdapter.extractColor)((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme);
1891
+ (_pieSeries_labels = pieSeries.labels) === null || _pieSeries_labels === void 0 ? void 0 : _pieSeries_labels.forEach((label, labelIndex)=>{
1892
+ const legend = `${label}`;
1893
+ // resolve color for each legend from the extracted colors
1894
+ const color = (0, _PlotlyColorAdapter.resolveColor)(colors, labelIndex, legend, colorMap, isDarkTheme);
1895
+ if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
1896
+ allupLegends.push({
1897
+ title: legend,
1898
+ color
1899
+ });
1900
+ }
1361
1901
  });
1902
+ } else if (isNonPlotType(traceInfo[index].type) === false) {
1903
+ var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
1904
+ const plotSeries = series;
1905
+ const name = plotSeries.legendgroup;
1906
+ const color = ((_plotSeries_line = plotSeries.line) === null || _plotSeries_line === void 0 ? void 0 : _plotSeries_line.color) || ((_plotSeries_marker = plotSeries.marker) === null || _plotSeries_marker === void 0 ? void 0 : _plotSeries_marker.color);
1907
+ const legendShape = getLegendShape(plotSeries);
1908
+ const resolvedColor = (0, _PlotlyColorAdapter.extractColor)((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template1 = _input_layout3.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, color, colorMap, isDarkTheme);
1909
+ if (name !== undefined && name !== '' && allupLegends.some((group)=>group.title === name) === false) {
1910
+ allupLegends.push({
1911
+ title: name,
1912
+ color: resolvedColor,
1913
+ shape: legendShape
1914
+ });
1915
+ }
1362
1916
  }
1363
1917
  });
1364
1918
  }
@@ -1424,28 +1978,21 @@ const getIndexFromKey = (key, pattern)=>{
1424
1978
  const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
1425
1979
  return parseInt(normalizedKey, 10) - 1;
1426
1980
  };
1427
- const getGridProperties = (layout, isMultiPlot)=>{
1428
- var _layout_annotations;
1429
- const gridX = [];
1430
- const gridY = [];
1981
+ const isNonPlotType = (chartType)=>{
1982
+ return [
1983
+ 'donut',
1984
+ 'sankey',
1985
+ 'pie'
1986
+ ].includes(chartType);
1987
+ };
1988
+ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
1989
+ const domainX = [];
1990
+ const domainY = [];
1991
+ let cartesianDomains = 0;
1431
1992
  const annotations = {};
1432
1993
  let templateRows = '1fr';
1433
1994
  let templateColumns = '1fr';
1434
1995
  const gridLayout = {};
1435
- if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
1436
- return {
1437
- templateRows,
1438
- templateColumns,
1439
- layout: gridLayout
1440
- };
1441
- }
1442
- if (!layout.xaxis || !layout.yaxis) {
1443
- return {
1444
- templateRows,
1445
- templateColumns,
1446
- layout: gridLayout
1447
- };
1448
- }
1449
1996
  if (!isMultiPlot) {
1450
1997
  return {
1451
1998
  templateRows,
@@ -1453,144 +2000,144 @@ const getGridProperties = (layout, isMultiPlot)=>{
1453
2000
  layout: gridLayout
1454
2001
  };
1455
2002
  }
1456
- Object.keys(layout).forEach((key)=>{
1457
- if (key.startsWith('xaxis')) {
1458
- var _layout_key, _layout_key1;
1459
- const index = getIndexFromKey(key, 'xaxis');
1460
- var _layout_key_anchor;
1461
- const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
1462
- const anchorIndex = getIndexFromKey(anchor, 'y');
1463
- if (index !== anchorIndex) {
1464
- throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1465
- }
1466
- var _layout_key_domain;
1467
- gridX[index] = (_layout_key_domain = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.domain) !== null && _layout_key_domain !== void 0 ? _layout_key_domain : [];
1468
- } else if (key.startsWith('yaxis')) {
1469
- var _layout_key2, _layout_key3;
1470
- const index = getIndexFromKey(key, 'yaxis');
1471
- var _layout_key_anchor1;
1472
- const anchor = (_layout_key_anchor1 = (_layout_key2 = layout[key]) === null || _layout_key2 === void 0 ? void 0 : _layout_key2.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
1473
- const anchorIndex = getIndexFromKey(anchor, 'x');
1474
- if (index !== anchorIndex) {
1475
- var _layout_yaxis2;
1476
- if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
1477
- // Special case for secondary y axis where yaxis2 can anchor to x1
1478
- return {
1479
- templateRows,
1480
- templateColumns
1481
- };
2003
+ const layout = schema === null || schema === void 0 ? void 0 : schema.layout;
2004
+ if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
2005
+ Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
2006
+ if (key.startsWith('xaxis')) {
2007
+ var _layout_key;
2008
+ const index = getIndexFromKey(key, 'xaxis');
2009
+ var _layout_key_anchor;
2010
+ const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
2011
+ const anchorIndex = getIndexFromKey(anchor, 'y');
2012
+ if (index !== anchorIndex) {
2013
+ throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
1482
2014
  }
1483
- throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
2015
+ const xAxisLayout = layout[key];
2016
+ const domainXInfo = {
2017
+ start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
2018
+ end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
2019
+ };
2020
+ domainX.push(domainXInfo);
2021
+ } else if (key.startsWith('yaxis')) {
2022
+ var _layout_key1;
2023
+ const index = getIndexFromKey(key, 'yaxis');
2024
+ var _layout_key_anchor1;
2025
+ const anchor = (_layout_key_anchor1 = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
2026
+ const anchorIndex = getIndexFromKey(anchor, 'x');
2027
+ if (index !== anchorIndex) {
2028
+ var _layout_yaxis2;
2029
+ if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
2030
+ // Special case for secondary y axis where yaxis2 can anchor to x1
2031
+ return {
2032
+ templateRows,
2033
+ templateColumns
2034
+ };
2035
+ }
2036
+ throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
2037
+ }
2038
+ const yAxisLayout = layout[key];
2039
+ const domainYInfo = {
2040
+ start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
2041
+ end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
2042
+ };
2043
+ domainY.push(domainYInfo);
1484
2044
  }
1485
- var _layout_key_domain1;
1486
- gridY[index] = (_layout_key_domain1 = (_layout_key3 = layout[key]) === null || _layout_key3 === void 0 ? void 0 : _layout_key3.domain) !== null && _layout_key_domain1 !== void 0 ? _layout_key_domain1 : [];
2045
+ });
2046
+ }
2047
+ cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
2048
+ validTracesInfo.forEach((trace, index)=>{
2049
+ if (isNonPlotType(trace.type)) {
2050
+ var _schema_data, _series_domain, _series_domain1, _series_domain2, _series_domain3;
2051
+ const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
2052
+ const domainXInfo = {
2053
+ start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
2054
+ end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
2055
+ };
2056
+ const domainYInfo = {
2057
+ start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
2058
+ end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
2059
+ };
2060
+ domainX.push(domainXInfo);
2061
+ domainY.push(domainYInfo);
1487
2062
  }
1488
2063
  });
1489
- (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
1490
- const xMatches = gridX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [
1491
- idx
1492
- ] : []);
1493
- const yMatch = gridY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval[1]);
1494
- if (yMatch !== -1) {
1495
- if (annotations[yMatch] === undefined) {
1496
- annotations[yMatch] = {};
1497
- }
1498
- if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
1499
- annotations[yMatch].yAnnotation = annotation.text;
1500
- } else {
1501
- annotations[yMatch].xAnnotation = annotation.text;
2064
+ if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
2065
+ var _layout_annotations;
2066
+ (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
2067
+ const xMatches = domainX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval.end ? [
2068
+ idx
2069
+ ] : []);
2070
+ const yMatch = domainY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval.end);
2071
+ if (yMatch !== -1) {
2072
+ if (annotations[yMatch] === undefined) {
2073
+ annotations[yMatch] = {};
2074
+ }
2075
+ if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
2076
+ annotations[yMatch].yAnnotation = annotation.text;
2077
+ } else {
2078
+ annotations[yMatch].xAnnotation = annotation.text;
2079
+ }
1502
2080
  }
1503
- }
1504
- });
1505
- if (gridX.length > 0) {
2081
+ });
2082
+ }
2083
+ if (domainX.length > 0) {
1506
2084
  const uniqueXIntervals = new Map();
1507
- gridX.forEach((interval)=>{
1508
- const key = `${interval[0]}-${interval[1]}`;
2085
+ domainX.forEach((interval)=>{
2086
+ const key = `${interval.start}-${interval.end}`;
1509
2087
  if (!uniqueXIntervals.has(key)) {
1510
2088
  uniqueXIntervals.set(key, interval);
1511
2089
  }
1512
2090
  });
1513
- const minXInterval = Math.min(...Array.from(uniqueXIntervals.values()).map((interval)=>interval[1] - interval[0]));
1514
- templateColumns = Array.from(uniqueXIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minXInterval}fr`).join(' ');
1515
- let columnNumber = 1;
1516
- let lastIntervalEnd = 0;
1517
- gridX.forEach((interval, index)=>{
1518
- if (interval.length === 0) {
1519
- return;
1520
- }
1521
- const cellName = `x${index === 0 ? '' : index + 1}`;
2091
+ const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
2092
+ templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
2093
+ domainX.forEach((interval, index)=>{
2094
+ const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
2095
+ const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
2096
+ const columnNumber = columnIndex + 1; // Column numbers are 1-based
1522
2097
  const annotationProps = annotations[index];
1523
2098
  const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
1524
- if (interval[0] < lastIntervalEnd) {
1525
- columnNumber = 1;
1526
- }
1527
- lastIntervalEnd = interval[1];
1528
2099
  const row = {
1529
2100
  row: -1,
1530
2101
  column: columnNumber,
1531
- xAnnotation
2102
+ xAnnotation,
2103
+ xDomain: interval,
2104
+ yDomain: {
2105
+ start: 0,
2106
+ end: 1
2107
+ }
1532
2108
  };
1533
2109
  gridLayout[cellName] = row;
1534
- columnNumber += 1;
1535
2110
  });
1536
2111
  }
1537
- const numColumns = Math.max(...Object.values(gridLayout).map((cell)=>{
1538
- var _cell_column;
1539
- return (_cell_column = cell.column) !== null && _cell_column !== void 0 ? _cell_column : 0;
1540
- }));
1541
- const columnFill = {};
1542
- for(let i = 1; i <= numColumns; i++){
1543
- columnFill[i] = {
1544
- row: 1,
1545
- fillDomain: 0
1546
- };
1547
- }
1548
- if (gridY.length > 0) {
2112
+ if (domainY.length > 0) {
1549
2113
  const uniqueYIntervals = new Map();
1550
- gridY.forEach((interval)=>{
1551
- const key = `${interval[0]}-${interval[1]}`;
2114
+ domainY.forEach((interval)=>{
2115
+ const key = `${interval.start}-${interval.end}`;
1552
2116
  if (!uniqueYIntervals.has(key)) {
1553
2117
  uniqueYIntervals.set(key, interval);
1554
2118
  }
1555
2119
  });
1556
- const minYInterval = Math.min(...Array.from(uniqueYIntervals.values()).map((interval)=>interval[1] - interval[0]));
1557
- templateRows = Array.from(uniqueYIntervals.values()).map((interval)=>`${(interval[1] - interval[0]) / minYInterval}fr`).join(' ');
1558
- gridY.forEach((interval, index)=>{
1559
- if (interval.length === 0) {
1560
- return;
1561
- }
1562
- const cellName = `x${index === 0 ? '' : index + 1}`;
2120
+ const sortedYStart = Array.from(uniqueYIntervals.values()).map((interval)=>interval.start).sort();
2121
+ const numberOfRows = sortedYStart.length;
2122
+ templateRows = `repeat(${numberOfRows}, 1fr)`;
2123
+ domainY.forEach((interval, index)=>{
2124
+ const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
2125
+ const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
2126
+ const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
1563
2127
  const annotationProps = annotations[index];
1564
2128
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
1565
2129
  const cell = gridLayout[cellName];
1566
2130
  if (cell !== undefined) {
1567
- cell.row = columnFill[cell.column].row;
2131
+ cell.row = rowNumber;
1568
2132
  cell.yAnnotation = yAnnotation;
2133
+ cell.yDomain = interval;
1569
2134
  }
1570
- columnFill[cell.column].fillDomain = interval[1];
1571
- columnFill[cell.column].row += 1;
1572
2135
  });
1573
2136
  }
1574
- // reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
1575
- const reversedGridLayout = {};
1576
- // find the maximum row number
1577
- const maxRowNumber = Math.max(...Object.values(gridLayout).map((cell)=>{
1578
- var _cell_row;
1579
- return (_cell_row = cell.row) !== null && _cell_row !== void 0 ? _cell_row : 0;
1580
- }));
1581
- // iterate over the gridLayout and reverse the row numbers
1582
- Object.keys(gridLayout).forEach((key)=>{
1583
- const cell = gridLayout[key];
1584
- if (cell.row !== undefined) {
1585
- // reverse the row number
1586
- cell.row = maxRowNumber - cell.row + 1;
1587
- }
1588
- reversedGridLayout[key] = cell;
1589
- });
1590
2137
  return {
1591
2138
  templateRows,
1592
2139
  templateColumns,
1593
- layout: reversedGridLayout
2140
+ layout: gridLayout
1594
2141
  };
1595
2142
  };
1596
2143
  /**
@@ -1632,3 +2179,227 @@ const getGridProperties = (layout, isMultiPlot)=>{
1632
2179
  });
1633
2180
  return result;
1634
2181
  };
2182
+ const getBarProps = (data, layout, isHorizontal)=>{
2183
+ let padding;
2184
+ if (typeof (layout === null || layout === void 0 ? void 0 : layout.bargap) === 'number') {
2185
+ if (layout.bargap >= 0 && layout.bargap <= 1) {
2186
+ padding = layout.bargap;
2187
+ } else {
2188
+ // Plotly uses a default bargap of 0.2, as noted here: https://github.com/plotly/plotly.js/blob/1d5a249e43dd31ae50acf02117a19e5ac97387e9/src/traces/bar/layout_defaults.js#L58.
2189
+ // However, we don't use this value as our default padding because it causes the bars to
2190
+ // appear disproportionately wide in large containers.
2191
+ padding = 0.2;
2192
+ }
2193
+ }
2194
+ const plotlyBarWidths = data.map((series)=>{
2195
+ if (series.type === 'bar' && ((0, _chartutilities.isArrayOrTypedArray)(series.width) || typeof series.width === 'number')) {
2196
+ return series.width;
2197
+ }
2198
+ return [];
2199
+ }).flat();
2200
+ const maxPlotlyBarWidth = (0, _d3array.max)(plotlyBarWidths);
2201
+ if (typeof maxPlotlyBarWidth === 'number') {
2202
+ padding = 1 - maxPlotlyBarWidth;
2203
+ padding = Math.max(0, Math.min(padding, 1));
2204
+ }
2205
+ if (typeof padding === 'undefined') {
2206
+ return {};
2207
+ }
2208
+ if (isHorizontal) {
2209
+ return {
2210
+ maxBarHeight: 1000,
2211
+ yAxisPadding: padding
2212
+ };
2213
+ }
2214
+ return {
2215
+ barWidth: 'auto',
2216
+ maxBarWidth: 1000,
2217
+ xAxisInnerPadding: padding,
2218
+ xAxisOuterPadding: padding / 2
2219
+ };
2220
+ };
2221
+ const getAxisScaleTypeProps = (data, layout)=>{
2222
+ var _axisObjects_x, _axisObjects_y, _axisObjects_y2;
2223
+ const result = {};
2224
+ const axisObjects = getAxisObjects(data, layout);
2225
+ if (((_axisObjects_x = axisObjects.x) === null || _axisObjects_x === void 0 ? void 0 : _axisObjects_x.type) === 'log') {
2226
+ result.xScaleType = 'log';
2227
+ }
2228
+ if (((_axisObjects_y = axisObjects.y) === null || _axisObjects_y === void 0 ? void 0 : _axisObjects_y.type) === 'log') {
2229
+ result.yScaleType = 'log';
2230
+ }
2231
+ if (((_axisObjects_y2 = axisObjects.y2) === null || _axisObjects_y2 === void 0 ? void 0 : _axisObjects_y2.type) === 'log') {
2232
+ result.secondaryYScaleType = 'log';
2233
+ }
2234
+ return result;
2235
+ };
2236
+ /**
2237
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/tick_value_defaults.js#L8}
2238
+ */ const getAxisTickProps = (data, layout)=>{
2239
+ const props = {};
2240
+ const axisObjects = getAxisObjects(data, layout);
2241
+ Object.keys(axisObjects).forEach((axId)=>{
2242
+ const ax = axisObjects[axId];
2243
+ if (!ax) {
2244
+ return;
2245
+ }
2246
+ const axType = getAxisType(data, axId[0], ax);
2247
+ if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
2248
+ const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
2249
+ if (axId === 'x') {
2250
+ props.tickValues = tickValues;
2251
+ } else if (axId === 'y') {
2252
+ props.yAxisTickValues = tickValues;
2253
+ }
2254
+ return;
2255
+ }
2256
+ if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
2257
+ const dtick = plotlyDtick(ax.dtick, axType);
2258
+ const tick0 = plotlyTick0(ax.tick0, axType, dtick);
2259
+ if (axId === 'x') {
2260
+ props.xAxis = {
2261
+ tickStep: dtick,
2262
+ tick0: tick0
2263
+ };
2264
+ } else if (axId === 'y') {
2265
+ props.yAxis = {
2266
+ tickStep: dtick,
2267
+ tick0: tick0
2268
+ };
2269
+ }
2270
+ return;
2271
+ }
2272
+ if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
2273
+ if (axId === 'x') {
2274
+ props.xAxisTickCount = ax.nticks;
2275
+ } else if (axId === 'y') {
2276
+ props.yAxisTickCount = ax.nticks;
2277
+ }
2278
+ }
2279
+ });
2280
+ return props;
2281
+ };
2282
+ /**
2283
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L16}
2284
+ */ const plotlyDtick = (dtick, axType)=>{
2285
+ const isLogAx = axType === 'log';
2286
+ const isDateAx = axType === 'date';
2287
+ const isCatAx = axType === 'category';
2288
+ const dtickDflt = isDateAx ? 86400000 : 1;
2289
+ if (!dtick) {
2290
+ return dtickDflt;
2291
+ }
2292
+ if ((0, _chartutilities.isNumber)(dtick)) {
2293
+ dtick = Number(dtick);
2294
+ if (dtick <= 0) {
2295
+ return dtickDflt;
2296
+ }
2297
+ if (isCatAx) {
2298
+ // category dtick must be positive integers
2299
+ return Math.max(1, Math.round(dtick));
2300
+ }
2301
+ if (isDateAx) {
2302
+ // date dtick must be at least 0.1ms (our current precision)
2303
+ return Math.max(0.1, dtick);
2304
+ }
2305
+ return dtick;
2306
+ }
2307
+ if (typeof dtick !== 'string' || !(isDateAx || isLogAx)) {
2308
+ return dtickDflt;
2309
+ }
2310
+ const prefix = dtick.charAt(0);
2311
+ const dtickNum = (0, _chartutilities.isNumber)(dtick.slice(1)) ? Number(dtick.slice(1)) : 0;
2312
+ if (dtickNum <= 0 || !(isDateAx && prefix === 'M' && dtickNum === Math.round(dtickNum) || // "L<f>" gives ticks linearly spaced in data (not in position) every (float) f
2313
+ isLogAx && prefix === 'L' || // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5
2314
+ isLogAx && prefix === 'D' && (dtickNum === 1 || dtickNum === 2))) {
2315
+ return dtickDflt;
2316
+ }
2317
+ return dtick;
2318
+ };
2319
+ /**
2320
+ * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L70}
2321
+ */ const plotlyTick0 = (tick0, axType, dtick)=>{
2322
+ if (axType === 'date') {
2323
+ return (0, _chartutilities.isDate)(tick0) ? new Date(tick0) : new Date(_utilities.DEFAULT_DATE_STRING);
2324
+ }
2325
+ if (dtick === 'D1' || dtick === 'D2') {
2326
+ // D1 and D2 modes ignore tick0 entirely
2327
+ return undefined;
2328
+ }
2329
+ // Aside from date axes, tick0 must be numeric
2330
+ return (0, _chartutilities.isNumber)(tick0) ? Number(tick0) : 0;
2331
+ };
2332
+ const getAxisObjects = (data, layout)=>{
2333
+ // Traces are grouped by their xaxis property, and for each group/subplot, the adapter functions
2334
+ // are called with the corresponding filtered data. As a result, all traces passed to an adapter
2335
+ // function share the same xaxis.
2336
+ let xAxisId;
2337
+ const yAxisIds = new Set();
2338
+ data.forEach((series)=>{
2339
+ const axisIds = (0, _chartutilities.getAxisIds)(series);
2340
+ xAxisId = axisIds.x;
2341
+ yAxisIds.add(axisIds.y);
2342
+ });
2343
+ const axisObjects = {};
2344
+ if (typeof xAxisId === 'number') {
2345
+ axisObjects.x = layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)('x', xAxisId)];
2346
+ }
2347
+ const sortedYAxisIds = Array.from(yAxisIds).sort();
2348
+ if (sortedYAxisIds.length > 0) {
2349
+ axisObjects.y = layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)('y', sortedYAxisIds[0])];
2350
+ }
2351
+ if (sortedYAxisIds.length > 1) {
2352
+ axisObjects.y2 = layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)('y', sortedYAxisIds[1])];
2353
+ }
2354
+ return axisObjects;
2355
+ };
2356
+ const getAxisType = (data, axLetter, ax)=>{
2357
+ const values = [];
2358
+ data.forEach((series)=>{
2359
+ var _series_axLetter;
2360
+ (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
2361
+ if (!(0, _chartutilities.isInvalidValue)(val)) {
2362
+ values.push(val);
2363
+ }
2364
+ });
2365
+ });
2366
+ // Note: When ax.type is explicitly specified, Plotly casts the values to match that type.
2367
+ // Therefore, simply checking the type of the values may not be sufficient. At the moment,
2368
+ // we don’t always perform this casting ourselves and instead use the values as provided.
2369
+ if ((0, _chartutilities.isNumberArray)(values)) {
2370
+ if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
2371
+ return 'log';
2372
+ }
2373
+ return 'linear';
2374
+ }
2375
+ if ((0, _chartutilities.isDateArray)(values)) {
2376
+ return 'date';
2377
+ }
2378
+ if ((0, _chartutilities.isStringArray)(values)) {
2379
+ return 'category';
2380
+ }
2381
+ };
2382
+ /**
2383
+ * This is experimental. Use it only with valid datetime strings to verify if they conform to the ISO 8601 format.
2384
+ */ const isoDateRegex = /^\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z)?)?$/;
2385
+ /**
2386
+ * We want to display localized date and time in the charts, so the useUTC prop is set to false.
2387
+ * But this can sometimes cause the formatters to display the datetime incorrectly.
2388
+ * To work around this issue, we use this function to adjust datetime strings so that they are always interpreted
2389
+ * as local time, allowing the formatters to produce the correct output.
2390
+ *
2391
+ * FIXME: The formatters should always produce a clear and accurate localized output, regardless of the
2392
+ * format used to create the date object.
2393
+ */ const parseLocalDate = (value)=>{
2394
+ if (typeof value === 'string') {
2395
+ const match = value.match(isoDateRegex);
2396
+ if (match) {
2397
+ if (!match[3]) {
2398
+ value += 'T00:00';
2399
+ } else if (match[6]) {
2400
+ value = value.replace('Z', '');
2401
+ }
2402
+ }
2403
+ }
2404
+ return new Date(value);
2405
+ };