@fluentui/react-charts 9.3.7 → 9.3.9

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 (259) hide show
  1. package/CHANGELOG.md +60 -2
  2. package/dist/index.d.ts +433 -7
  3. package/lib/PolarChart.js +1 -0
  4. package/lib/PolarChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  7. package/lib/components/AreaChart/AreaChart.js +1 -28
  8. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  10. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  11. package/lib/components/ChartTable/ChartTable.js +27 -8
  12. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  13. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  14. package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
  15. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  16. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  17. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  18. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  19. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  20. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  21. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +54 -4
  22. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  23. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  24. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  25. package/lib/components/CommonComponents/CartesianChart.js +81 -44
  26. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  27. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  28. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
  29. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  30. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
  31. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  32. package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
  33. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +643 -366
  35. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  36. package/lib/components/DonutChart/DonutChart.js +24 -9
  37. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  38. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  39. package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
  40. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  41. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
  42. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  43. package/lib/components/FunnelChart/FunnelChart.js +33 -8
  44. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  45. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  46. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
  47. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  48. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  49. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  50. package/lib/components/GanttChart/GanttChart.js +1 -1
  51. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  52. package/lib/components/GaugeChart/GaugeChart.js +13 -9
  53. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  54. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  55. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
  56. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  57. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  58. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  59. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +18 -18
  60. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  61. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  62. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  63. package/lib/components/HeatMapChart/HeatMapChart.js +5 -1
  64. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  65. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +60 -10
  66. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  67. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  68. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
  69. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  70. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  71. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  72. package/lib/components/Legends/Legends.js +3 -4
  73. package/lib/components/Legends/Legends.js.map +1 -1
  74. package/lib/components/Legends/OverflowMenu.js +9 -2
  75. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  76. package/lib/components/LineChart/LineChart.js +65 -64
  77. package/lib/components/LineChart/LineChart.js.map +1 -1
  78. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  79. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  80. package/lib/components/PolarChart/PolarChart.js +577 -0
  81. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  82. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  83. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  84. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  85. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  86. package/lib/components/PolarChart/index.js +2 -0
  87. package/lib/components/PolarChart/index.js.map +1 -0
  88. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  89. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  90. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  91. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  92. package/lib/components/SankeyChart/SankeyChart.js +15 -5
  93. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  94. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  95. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +24 -8
  96. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  97. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  98. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  99. package/lib/components/ScatterChart/ScatterChart.js +13 -25
  100. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  101. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  102. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
  103. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  104. package/lib/components/VerticalBarChart/VerticalBarChart.js +13 -78
  105. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  106. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  107. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  108. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +48 -68
  109. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  110. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  111. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  112. package/lib/index.js +1 -0
  113. package/lib/index.js.map +1 -1
  114. package/lib/types/ChartAnnotation.js.map +1 -1
  115. package/lib/types/DataPoint.js +1 -1
  116. package/lib/types/DataPoint.js.map +1 -1
  117. package/lib/utilities/ChartTitle.js +45 -0
  118. package/lib/utilities/ChartTitle.js.map +1 -0
  119. package/lib/utilities/Common.styles.js +73 -2
  120. package/lib/utilities/Common.styles.js.map +1 -1
  121. package/lib/utilities/Common.styles.raw.js +70 -1
  122. package/lib/utilities/Common.styles.raw.js.map +1 -1
  123. package/lib/utilities/image-export-utils.js +4 -4
  124. package/lib/utilities/image-export-utils.js.map +1 -1
  125. package/lib/utilities/index.js +1 -0
  126. package/lib/utilities/index.js.map +1 -1
  127. package/lib/utilities/utilities.js +219 -77
  128. package/lib/utilities/utilities.js.map +1 -1
  129. package/lib-commonjs/PolarChart.js +6 -0
  130. package/lib-commonjs/PolarChart.js.map +1 -0
  131. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  132. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  133. package/lib-commonjs/components/AreaChart/AreaChart.js +0 -26
  134. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  135. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  136. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  137. package/lib-commonjs/components/ChartTable/ChartTable.js +27 -8
  138. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  139. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  140. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  141. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  142. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  143. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  144. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +111 -69
  145. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  146. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  147. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +65 -5
  148. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  149. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
  150. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  151. package/lib-commonjs/components/CommonComponents/CartesianChart.js +80 -43
  152. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  153. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  154. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +3 -4
  155. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  156. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
  157. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  158. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  159. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  160. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +649 -368
  161. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  162. package/lib-commonjs/components/DonutChart/DonutChart.js +22 -7
  163. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  164. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  165. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  166. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  167. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  168. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  169. package/lib-commonjs/components/FunnelChart/FunnelChart.js +31 -6
  170. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  171. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  172. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  173. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  174. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  175. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  176. package/lib-commonjs/components/GanttChart/GanttChart.js +1 -1
  177. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  178. package/lib-commonjs/components/GaugeChart/GaugeChart.js +11 -7
  179. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  180. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  181. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
  182. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  183. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  184. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  185. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +16 -16
  186. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  187. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  188. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  189. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -1
  190. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  191. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +59 -9
  192. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  193. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  194. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
  195. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  196. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  197. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  198. package/lib-commonjs/components/Legends/Legends.js +3 -4
  199. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  200. package/lib-commonjs/components/Legends/OverflowMenu.js +9 -2
  201. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  202. package/lib-commonjs/components/LineChart/LineChart.js +64 -63
  203. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  204. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  205. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  206. package/lib-commonjs/components/PolarChart/PolarChart.js +587 -0
  207. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  208. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  209. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  210. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  211. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  212. package/lib-commonjs/components/PolarChart/index.js +7 -0
  213. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  214. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  215. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  216. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  217. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  218. package/lib-commonjs/components/SankeyChart/SankeyChart.js +15 -5
  219. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  220. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  221. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -6
  222. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  223. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  224. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  225. package/lib-commonjs/components/ScatterChart/ScatterChart.js +12 -24
  226. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  227. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  228. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  229. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  230. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +12 -77
  231. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  232. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  233. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  234. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +47 -67
  235. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  236. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  237. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  238. package/lib-commonjs/index.js +1 -0
  239. package/lib-commonjs/index.js.map +1 -1
  240. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  241. package/lib-commonjs/types/DataPoint.js +1 -1
  242. package/lib-commonjs/types/DataPoint.js.map +1 -1
  243. package/lib-commonjs/utilities/ChartTitle.js +53 -0
  244. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  245. package/lib-commonjs/utilities/Common.styles.js +69 -1
  246. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  247. package/lib-commonjs/utilities/Common.styles.raw.js +69 -1
  248. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  249. package/lib-commonjs/utilities/image-export-utils.js +3 -3
  250. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  251. package/lib-commonjs/utilities/index.js +1 -0
  252. package/lib-commonjs/utilities/index.js.map +1 -1
  253. package/lib-commonjs/utilities/utilities.js +235 -78
  254. package/lib-commonjs/utilities/utilities.js.map +1 -1
  255. package/package.json +11 -17
  256. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  257. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  258. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  259. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -50,12 +50,37 @@ const dashOptions = {
50
50
  }
51
51
  };
52
52
  function getTitles(layout) {
53
- var _layout_title, _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
54
- var _layout_title_text, _layout_xaxis_title_text, _layout_yaxis_title_text;
53
+ var _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
54
+ const titleObj = layout === null || layout === void 0 ? void 0 : layout.title;
55
+ var _titleObj_text;
56
+ const chartTitle = typeof titleObj === 'string' ? titleObj : (_titleObj_text = titleObj === null || titleObj === void 0 ? void 0 : titleObj.text) !== null && _titleObj_text !== void 0 ? _titleObj_text : '';
57
+ const titleFont = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.font : undefined;
58
+ const titleXAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.xanchor : undefined;
59
+ const titleYAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.yanchor : undefined;
60
+ const titlePad = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.pad : undefined;
61
+ const titleStyles = {
62
+ ...titleFont ? {
63
+ titleFont
64
+ } : {},
65
+ ...titleXAnchor ? {
66
+ titleXAnchor
67
+ } : {},
68
+ ...titleYAnchor ? {
69
+ titleYAnchor
70
+ } : {},
71
+ ...titlePad ? {
72
+ titlePad
73
+ } : {}
74
+ };
75
+ var _layout_xaxis_title_text, _layout_yaxis_title_text;
55
76
  const titles = {
56
- chartTitle: typeof (layout === null || layout === void 0 ? void 0 : layout.title) === 'string' ? layout.title : (_layout_title_text = layout === null || layout === void 0 ? void 0 : (_layout_title = layout.title) === null || _layout_title === void 0 ? void 0 : _layout_title.text) !== null && _layout_title_text !== void 0 ? _layout_title_text : '',
77
+ chartTitle,
78
+ ...Object.keys(titleStyles).length > 0 ? {
79
+ titleStyles
80
+ } : {},
57
81
  xAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_xaxis = layout.xaxis) === null || _layout_xaxis === void 0 ? void 0 : _layout_xaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_xaxis1 = layout.xaxis) === null || _layout_xaxis1 === void 0 ? void 0 : _layout_xaxis1.title : (_layout_xaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_xaxis2 = layout.xaxis) === null || _layout_xaxis2 === void 0 ? void 0 : (_layout_xaxis_title = _layout_xaxis2.title) === null || _layout_xaxis_title === void 0 ? void 0 : _layout_xaxis_title.text) !== null && _layout_xaxis_title_text !== void 0 ? _layout_xaxis_title_text : '',
58
- yAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis = layout.yaxis) === null || _layout_yaxis === void 0 ? void 0 : _layout_yaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_yaxis1 = layout.yaxis) === null || _layout_yaxis1 === void 0 ? void 0 : _layout_yaxis1.title : (_layout_yaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis) === null || _layout_yaxis2 === void 0 ? void 0 : (_layout_yaxis_title = _layout_yaxis2.title) === null || _layout_yaxis_title === void 0 ? void 0 : _layout_yaxis_title.text) !== null && _layout_yaxis_title_text !== void 0 ? _layout_yaxis_title_text : ''
82
+ yAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis = layout.yaxis) === null || _layout_yaxis === void 0 ? void 0 : _layout_yaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_yaxis1 = layout.yaxis) === null || _layout_yaxis1 === void 0 ? void 0 : _layout_yaxis1.title : (_layout_yaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis) === null || _layout_yaxis2 === void 0 ? void 0 : (_layout_yaxis_title = _layout_yaxis2.title) === null || _layout_yaxis_title === void 0 ? void 0 : _layout_yaxis_title.text) !== null && _layout_yaxis_title_text !== void 0 ? _layout_yaxis_title_text : '',
83
+ xAxisAnnotation: chartTitle
59
84
  };
60
85
  return titles;
61
86
  }
@@ -217,6 +242,62 @@ export const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNum
217
242
  }
218
243
  return x;
219
244
  };
245
+ /**
246
+ * Formats text values according to the texttemplate specification
247
+ * Supports D3 format specifiers within %{text:format} patterns
248
+ * @param textValue The raw text value to format
249
+ * @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
250
+ * @param index Optional index for array-based templates
251
+ * @returns Formatted text string
252
+ *
253
+ * Examples:
254
+ * - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
255
+ * - "%{text:.2%}" → Formats as percentage with 2 decimal places
256
+ * - "%{text:,.0f}" → Formats with thousands separator and no decimals
257
+ * - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
258
+ */ const formatTextWithTemplate = (textValue, textTemplate, index)=>{
259
+ if (!textTemplate) {
260
+ return String(textValue);
261
+ }
262
+ const numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
263
+ if (isNaN(numVal)) {
264
+ return String(textValue);
265
+ }
266
+ const template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
267
+ // Match Plotly's texttemplate pattern: %{text:format} or %{text}
268
+ // Can be followed by any literal text like %, $, etc.
269
+ const plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
270
+ const match = template.match(plotlyPattern);
271
+ if (match) {
272
+ const formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
273
+ const suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
274
+ // If no format specifier is provided (e.g., %{text}%), try to infer from suffix
275
+ if (!formatSpec) {
276
+ // Check if suffix starts with % - assume simple percentage with 1 decimal
277
+ if (suffix.startsWith('%')) {
278
+ return `${numVal.toFixed(1)}${suffix}`;
279
+ }
280
+ // No format specifier, just return the number with the suffix
281
+ return `${numVal}${suffix}`;
282
+ }
283
+ try {
284
+ // Use D3 format function to apply the format specifier
285
+ const formatter = d3Format(formatSpec);
286
+ const formattedValue = formatter(numVal);
287
+ return `${formattedValue}${suffix}`;
288
+ } catch (error) {
289
+ // Try to extract precision for basic fallback
290
+ const precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
291
+ const precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
292
+ // Check if it's a percentage format
293
+ if (formatSpec.includes('%')) {
294
+ return `${(numVal * 100).toFixed(precision)}%${suffix}`;
295
+ }
296
+ return `${numVal.toFixed(precision)}${suffix}`;
297
+ }
298
+ }
299
+ return String(textValue);
300
+ };
220
301
  /**
221
302
  * Extracts unique X-axis categories from Plotly data traces
222
303
  * @param data Array of Plotly data traces
@@ -282,60 +363,55 @@ const toFiniteNumber = (value)=>{
282
363
  return Number.isFinite(numeric) ? numeric : undefined;
283
364
  };
284
365
  /**
285
- * Normalizes Plotly axis reference strings so equivalent aliases (e.g. `xaxis1`, `x1`) collapse to the base axis id.
286
- */ const normalizeAxisRef = (ref, axis)=>{
366
+ * Parses Plotly axis references (e.g. `x`, `x2`, `xaxis2`, `paper`, `pixel`, `x domain`) into a ref type + axis id.
367
+ */ const parseAxisRef = (ref, axis)=>{
287
368
  if (!ref) {
288
- return axis;
369
+ return {
370
+ refType: 'axis',
371
+ axisId: 1
372
+ };
289
373
  }
290
- const normalized = ref.toLowerCase();
291
- if (normalized === axis || normalized === `${axis}axis` || normalized === `${axis}axis1` || normalized === `${axis}1`) {
292
- return axis;
374
+ const normalized = ref.toLowerCase().trim();
375
+ if (normalized === 'pixel') {
376
+ return {
377
+ refType: 'pixel',
378
+ axisId: 1
379
+ };
293
380
  }
294
- const match = normalized.match(/^([xy])(axis)?(\d+)$/);
295
- if (match && match[1] === axis && match[3]) {
296
- return match[3] === '1' ? axis : `${axis}${match[3]}`;
381
+ if (normalized === 'paper') {
382
+ return {
383
+ refType: 'relative',
384
+ axisId: 1
385
+ };
297
386
  }
298
- return normalized;
299
- };
300
- /**
301
- * Scans the data traces bound to a given axis and returns the numeric min/max values plotted on that axis.
302
- */ const getAxisNumericRangeFromData = (axis, ref, layout, data)=>{
303
- if (!data || data.length === 0) {
304
- return undefined;
387
+ if (normalized.endsWith(' domain')) {
388
+ return normalized.startsWith(axis) ? {
389
+ refType: 'relative',
390
+ axisId: 1
391
+ } : {
392
+ refType: undefined,
393
+ axisId: 1
394
+ };
305
395
  }
306
- const axisLayout = getAxisLayoutByRef(layout, ref, axis);
307
- const targetRef = normalizeAxisRef(ref, axis);
308
- const traceAxisKey = axis === 'x' ? 'xaxis' : 'yaxis';
309
- let minValue;
310
- let maxValue;
311
- data.forEach((trace)=>{
312
- const plotTrace = trace;
313
- const traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
314
- if (traceAxisRef !== targetRef) {
315
- return;
316
- }
317
- const values = axis === 'x' ? plotTrace.x : plotTrace.y;
318
- if (!isArrayOrTypedArray(values)) {
319
- return;
320
- }
321
- const arrayLike = values;
322
- for(let index = 0; index < arrayLike.length; index++){
323
- const value = arrayLike[index];
324
- const numeric = toNumericValue(convertDataValue(value, axisLayout));
325
- if (numeric === undefined || Number.isNaN(numeric)) {
326
- continue;
327
- }
328
- minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
329
- maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
330
- }
331
- });
332
- if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
333
- return undefined;
396
+ const match = normalized.match(/^([xy])(axis)?(\d*)$/);
397
+ if (!match || match[1] !== axis) {
398
+ return {
399
+ refType: undefined,
400
+ axisId: 1
401
+ };
334
402
  }
335
- return [
336
- minValue,
337
- maxValue
338
- ];
403
+ const suffix = match[3];
404
+ if (!suffix || suffix === '1') {
405
+ return {
406
+ refType: 'axis',
407
+ axisId: 1
408
+ };
409
+ }
410
+ const parsed = Number(suffix);
411
+ return {
412
+ refType: 'axis',
413
+ axisId: Number.isFinite(parsed) && parsed >= 1 ? parsed : 1
414
+ };
339
415
  };
340
416
  /**
341
417
  * Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
@@ -390,21 +466,13 @@ const appendPx = (value)=>{
390
466
  if (!ref) {
391
467
  return 'axis';
392
468
  }
393
- const normalized = ref.toLowerCase();
394
- if (normalized === 'pixel') {
395
- return 'pixel';
396
- }
397
- if (normalized === 'paper') {
398
- return 'relative';
399
- }
400
- if (normalized.endsWith(' domain')) {
401
- return normalized.startsWith(axis) ? 'relative' : undefined;
469
+ const parsed = parseAxisRef(ref, axis);
470
+ if (parsed.refType !== 'axis') {
471
+ return parsed.refType;
402
472
  }
473
+ const normalized = (ref !== null && ref !== void 0 ? ref : '').toLowerCase().trim();
403
474
  const match = normalized.match(/^([xy])(\d*)$/);
404
- if (match && match[1] === axis) {
405
- return 'axis';
406
- }
407
- return undefined;
475
+ return match && match[1] === axis ? 'axis' : undefined;
408
476
  };
409
477
  /**
410
478
  * Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
@@ -413,74 +481,37 @@ const appendPx = (value)=>{
413
481
  return undefined;
414
482
  }
415
483
  const defaultAxisKey = `${axis}axis`;
416
- if (!ref) {
484
+ const { refType, axisId } = parseAxisRef(ref, axis);
485
+ if (refType !== 'axis' || axisId === 1) {
417
486
  return layout[defaultAxisKey];
418
487
  }
419
- const normalized = ref.toLowerCase();
420
- if (normalized === 'paper' || normalized === 'pixel' || normalized.endsWith(' domain')) {
421
- return layout[defaultAxisKey];
422
- }
423
- const match = normalized.match(/^([xy])(\d*)$/);
424
- if (match && match[1] === axis) {
425
- const index = match[2];
426
- if (index && index !== '' && index !== '1') {
427
- const axisKey = `${axis}axis${index}`;
428
- return layout[axisKey];
429
- }
430
- return layout[defaultAxisKey];
431
- }
432
- return layout[defaultAxisKey];
488
+ const axisKey = `${axis}axis${axisId}`;
489
+ return layout[axisKey];
433
490
  };
434
- /**
435
- * Normalizes raw Plotly data values into canonical number/date/string types based on axis configuration.
436
- */ const convertDataValue = (value, axisLayout)=>{
491
+ const convertAnnotationDataValue = (value, axisType)=>{
437
492
  if (value === undefined || value === null) {
438
493
  return undefined;
439
494
  }
440
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'date' || isDate(value)) {
495
+ if (axisType === 'date') {
441
496
  const dateValue = value instanceof Date ? value : new Date(value);
442
497
  return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
443
498
  }
444
- if (typeof value === 'number') {
445
- return value;
446
- }
447
- if ((axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'linear' || (axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) === 'log') {
499
+ if (axisType === 'linear' || axisType === 'log') {
500
+ if (typeof value === 'number') {
501
+ return Number.isFinite(value) ? value : undefined;
502
+ }
448
503
  const numeric = Number(value);
449
504
  return Number.isFinite(numeric) ? numeric : undefined;
450
505
  }
506
+ // For category-like axes, preserve raw strings (and avoid date parsing heuristics).
451
507
  if (value instanceof Date) {
452
508
  return value;
453
509
  }
454
- return value;
455
- };
456
- const toNumericValue = (value)=>{
457
- if (value instanceof Date) {
458
- const timestamp = value.getTime();
459
- return Number.isFinite(timestamp) ? timestamp : undefined;
460
- }
461
- if (typeof value === 'number') {
462
- return Number.isFinite(value) ? value : undefined;
463
- }
464
- if (typeof value === 'string') {
465
- const numeric = Number(value);
466
- return Number.isFinite(numeric) ? numeric : undefined;
510
+ if (typeof value === 'number' || typeof value === 'string') {
511
+ return value;
467
512
  }
468
513
  return undefined;
469
514
  };
470
- const toRelativeCoordinate = (value, axisLayout, fallbackRange)=>{
471
- const range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
472
- let start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
473
- let end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
474
- if ((start === undefined || end === undefined || start === end) && fallbackRange) {
475
- [start, end] = fallbackRange;
476
- }
477
- const current = toNumericValue(convertDataValue(value, axisLayout));
478
- if (start === undefined || end === undefined || current === undefined || start === end) {
479
- return undefined;
480
- }
481
- const relative = (current - start) / (end - start);
482
- return Number.isFinite(relative) ? relative : undefined;
483
- };
484
515
  const createAnnotationId = (text, index)=>{
485
516
  const normalized = text.replace(/\s+/g, ' ').trim();
486
517
  if (normalized) {
@@ -544,10 +575,37 @@ const mapArrowDashToPattern = (value)=>{
544
575
  return value;
545
576
  }
546
577
  };
578
+ const mapRefTypeToCoordinateType = (refType)=>{
579
+ return refType === 'axis' ? 'data' : refType;
580
+ };
581
+ const normalizeCoordinateValueForType = (coordinateType, value)=>{
582
+ if (coordinateType === 'data') {
583
+ return value;
584
+ }
585
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
586
+ };
587
+ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
588
+ if (refType === 'axis') {
589
+ const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
590
+ const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
591
+ const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
592
+ var _axisLayout_type;
593
+ const axisType = (_axisLayout_type = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) !== null && _axisLayout_type !== void 0 ? _axisLayout_type : 'category';
594
+ return convertAnnotationDataValue(rawValue, axisType);
595
+ }
596
+ const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
597
+ if (numericValue === undefined) {
598
+ return undefined;
599
+ }
600
+ if (refType === 'relative') {
601
+ return axis === 'y' ? transformRelativeYForChart(numericValue) : numericValue;
602
+ }
603
+ return numericValue;
604
+ };
547
605
  /**
548
606
  * Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
549
607
  * layout alignment, styling, and connector metadata while skipping unsupported configurations.
550
- */ const convertPlotlyAnnotation = (annotation, layout, data, index)=>{
608
+ */ const convertPlotlyAnnotation = (annotation, layout, index)=>{
551
609
  if (!annotation || annotation.visible === false) {
552
610
  return undefined;
553
611
  }
@@ -556,77 +614,51 @@ const mapArrowDashToPattern = (value)=>{
556
614
  if (!xRefType || !yRefType) {
557
615
  return undefined;
558
616
  }
617
+ const xValue = getAnnotationCoordinateValue('x', xRefType, annotation, layout);
618
+ const yValue = getAnnotationCoordinateValue('y', yRefType, annotation, layout);
619
+ if (xValue === undefined || yValue === undefined) {
620
+ return undefined;
621
+ }
622
+ const xCoordinateType = mapRefTypeToCoordinateType(xRefType);
623
+ const yCoordinateType = mapRefTypeToCoordinateType(yRefType);
624
+ const normalizedX = normalizeCoordinateValueForType(xCoordinateType, xValue);
625
+ const normalizedY = normalizeCoordinateValueForType(yCoordinateType, yValue);
626
+ if (normalizedX === undefined || normalizedY === undefined) {
627
+ return undefined;
628
+ }
629
+ const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
630
+ const yAxisProps = yCoordinateType === 'data' && yRefNormalized === 'y2' ? {
631
+ yAxis: 'secondary'
632
+ } : undefined;
559
633
  let coordinates;
560
- if (xRefType === 'axis' && yRefType === 'axis') {
561
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
562
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
563
- const xValue = convertDataValue(annotation.x, xAxisLayout);
564
- const yValue = convertDataValue(annotation.y, yAxisLayout);
565
- if (xValue === undefined || yValue === undefined) {
566
- return undefined;
567
- }
568
- const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
634
+ if (xCoordinateType === 'data' && yCoordinateType === 'data') {
569
635
  coordinates = {
570
636
  type: 'data',
571
- x: xValue,
572
- y: yValue,
573
- ...yRefNormalized === 'y2' ? {
574
- yAxis: 'secondary'
575
- } : {}
637
+ x: normalizedX,
638
+ y: normalizedY,
639
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
576
640
  };
577
- } else if (xRefType === 'relative' && yRefType === 'relative') {
578
- const xValue = toFiniteNumber(annotation.x);
579
- const yValue = toFiniteNumber(annotation.y);
580
- const chartRelativeY = transformRelativeYForChart(yValue);
581
- if (xValue === undefined || chartRelativeY === undefined) {
582
- return undefined;
583
- }
641
+ } else if (xCoordinateType === 'relative' && yCoordinateType === 'relative') {
584
642
  coordinates = {
585
643
  type: 'relative',
586
- x: xValue,
587
- y: chartRelativeY
644
+ x: normalizedX,
645
+ y: normalizedY
588
646
  };
589
- } else if (xRefType === 'relative' && yRefType === 'axis') {
590
- const xValue = toFiniteNumber(annotation.x);
591
- const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
592
- const yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
593
- const yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
594
- const chartRelativeY = transformRelativeYForChart(yRelative);
595
- if (xValue === undefined || chartRelativeY === undefined) {
596
- return undefined;
597
- }
598
- coordinates = {
599
- type: 'relative',
600
- x: xValue,
601
- y: chartRelativeY
602
- };
603
- } else if (xRefType === 'axis' && yRefType === 'relative') {
604
- const yValue = toFiniteNumber(annotation.y);
605
- const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
606
- const xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
607
- const xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
608
- const chartRelativeY = transformRelativeYForChart(yValue);
609
- if (xRelative === undefined || chartRelativeY === undefined) {
610
- return undefined;
611
- }
612
- coordinates = {
613
- type: 'relative',
614
- x: xRelative,
615
- y: chartRelativeY
616
- };
617
- } else if (xRefType === 'pixel' && yRefType === 'pixel') {
618
- const xValue = toFiniteNumber(annotation.x);
619
- const yValue = toFiniteNumber(annotation.y);
620
- if (xValue === undefined || yValue === undefined) {
621
- return undefined;
622
- }
647
+ } else if (xCoordinateType === 'pixel' && yCoordinateType === 'pixel') {
623
648
  coordinates = {
624
649
  type: 'pixel',
625
- x: xValue,
626
- y: yValue
650
+ x: normalizedX,
651
+ y: normalizedY
627
652
  };
628
653
  } else {
629
- return undefined;
654
+ coordinates = {
655
+ type: 'mixed',
656
+ xCoordinateType,
657
+ yCoordinateType,
658
+ x: normalizedX,
659
+ y: normalizedY,
660
+ ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
661
+ };
630
662
  }
631
663
  const textValue = annotation.text;
632
664
  const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
@@ -783,14 +815,82 @@ const mapArrowDashToPattern = (value)=>{
783
815
  }
784
816
  return chartAnnotation;
785
817
  };
786
- const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
818
+ const getChartAnnotationsFromLayout = (data, layout, isMultiPlot)=>{
787
819
  if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
788
820
  return undefined;
789
821
  }
822
+ // Infer axis types when they are not explicitly set.
823
+ // This is needed so annotation coordinate parsing can correctly treat values as 'date' vs 'category'
824
+ // (for example, bar chart category axes with date-like strings).
825
+ const inferredLayout = (()=>{
826
+ if (!data || !isArrayOrTypedArray(data) || data.length === 0) {
827
+ return layout;
828
+ }
829
+ const valuesByAxisKey = new Map();
830
+ const axesExpectingCategories = new Set();
831
+ data.forEach((series)=>{
832
+ const trace = series;
833
+ const axisIds = getAxisIds(trace);
834
+ if (trace.type === 'bar') {
835
+ const categoryAxisLetter = trace.orientation === 'h' ? 'y' : 'x';
836
+ axesExpectingCategories.add(getAxisKey(categoryAxisLetter, axisIds[categoryAxisLetter]));
837
+ }
838
+ [
839
+ 'x',
840
+ 'y'
841
+ ].forEach((axLetter)=>{
842
+ const coords = trace[axLetter];
843
+ if (!coords || !isArrayOrTypedArray(coords)) {
844
+ return;
845
+ }
846
+ const axisKey = getAxisKey(axLetter, axisIds[axLetter]);
847
+ var _valuesByAxisKey_get;
848
+ const existing = (_valuesByAxisKey_get = valuesByAxisKey.get(axisKey)) !== null && _valuesByAxisKey_get !== void 0 ? _valuesByAxisKey_get : [];
849
+ coords.forEach((val)=>{
850
+ if (!isInvalidValue(val)) {
851
+ existing.push(val);
852
+ }
853
+ });
854
+ valuesByAxisKey.set(axisKey, existing);
855
+ });
856
+ });
857
+ let nextLayout;
858
+ valuesByAxisKey.forEach((values, axisKey)=>{
859
+ const currentAxis = layout === null || layout === void 0 ? void 0 : layout[axisKey];
860
+ const currentType = currentAxis === null || currentAxis === void 0 ? void 0 : currentAxis.type;
861
+ if ([
862
+ 'linear',
863
+ 'log',
864
+ 'date',
865
+ 'category'
866
+ ].includes(currentType !== null && currentType !== void 0 ? currentType : '')) {
867
+ return;
868
+ }
869
+ let inferredType;
870
+ if (axesExpectingCategories.has(axisKey) || isYearArray(values)) {
871
+ inferredType = 'category';
872
+ } else if (isDateArray(values)) {
873
+ inferredType = 'date';
874
+ }
875
+ if (!inferredType) {
876
+ return;
877
+ }
878
+ if (!nextLayout) {
879
+ nextLayout = {
880
+ ...layout
881
+ };
882
+ }
883
+ nextLayout[axisKey] = {
884
+ ...currentAxis !== null && currentAxis !== void 0 ? currentAxis : {},
885
+ type: inferredType
886
+ };
887
+ });
888
+ return nextLayout !== null && nextLayout !== void 0 ? nextLayout : layout;
889
+ })();
790
890
  const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
791
891
  layout.annotations
792
892
  ];
793
- const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, data, index)).filter((annotation)=>annotation !== undefined);
893
+ const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, inferredLayout, index)).filter((annotation)=>annotation !== undefined);
794
894
  return converted.length > 0 ? converted : undefined;
795
895
  };
796
896
  /**
@@ -872,7 +972,7 @@ const getChartAnnotationsFromLayout = (layout, data, isMultiPlot)=>{
872
972
  export const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
873
973
  var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
874
974
  var _getChartAnnotationsFromLayout;
875
- const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
975
+ const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
876
976
  const titles = getTitles(input.layout);
877
977
  const layoutTitle = titles.chartTitle || undefined;
878
978
  const layoutWithMeta = input.layout;
@@ -947,12 +1047,13 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
947
1047
  const hideLabels = firstData.textinfo ? ![
948
1048
  'value',
949
1049
  'percent',
950
- 'label+percent'
1050
+ 'label+percent',
1051
+ 'percent+label'
951
1052
  ].includes(firstData.textinfo) : false;
952
1053
  const donutMarginHorizontal = hideLabels ? 0 : 80;
953
1054
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
954
1055
  const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : MIN_DONUT_RADIUS;
955
- const { chartTitle } = getTitles(input.layout);
1056
+ const { chartTitle, titleStyles } = getTitles(input.layout);
956
1057
  // Build anticlockwise order by keeping the first item, reversing the rest
957
1058
  const legends = Object.keys(mapLegendToDataPoint);
958
1059
  const reorderedEntries = legends.length > 1 ? [
@@ -980,14 +1081,18 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
980
1081
  hideLabels,
981
1082
  showLabelsInPercent: firstData.textinfo ? [
982
1083
  'percent',
983
- 'label+percent'
1084
+ 'label+percent',
1085
+ 'percent+label'
984
1086
  ].includes(firstData.textinfo) : true,
985
1087
  roundCorners: true,
986
- order: 'sorted'
1088
+ order: 'sorted',
1089
+ ...titleStyles ? {
1090
+ titleStyles
1091
+ } : {}
987
1092
  };
988
1093
  };
989
1094
  export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
990
- var _input_layout, _input_layout1, _input_layout2, _vsbcData_;
1095
+ var _input_layout, _input_layout1, _input_layout2;
991
1096
  const mapXToDataPoints = {};
992
1097
  let yMaxValue = 0;
993
1098
  let yMinValue = 0;
@@ -1007,6 +1112,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1007
1112
  validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
1008
1113
  const rangeXValues = series.x.slice(rangeStart, rangeEnd);
1009
1114
  const rangeYValues = series.y.slice(rangeStart, rangeEnd);
1115
+ const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : typeof series.text === 'string' ? series.text : undefined;
1010
1116
  rangeXValues.forEach((x, index2)=>{
1011
1117
  var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
1012
1118
  if (!mapXToDataPoints[x]) {
@@ -1022,6 +1128,11 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1022
1128
  const opacity = getOpacity(series, index2);
1023
1129
  const yVal = rangeYValues[index2];
1024
1130
  const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
1131
+ let barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
1132
+ // Apply texttemplate formatting if specified
1133
+ if (barLabel && series.texttemplate) {
1134
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
1135
+ }
1025
1136
  if (series.type === 'bar') {
1026
1137
  var _rgb_copy_formatHex8;
1027
1138
  mapXToDataPoints[x].chartData.push({
@@ -1030,7 +1141,10 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1030
1141
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1031
1142
  opacity
1032
1143
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1033
- yAxisCalloutData
1144
+ yAxisCalloutData,
1145
+ ...barLabel ? {
1146
+ barLabel: String(barLabel)
1147
+ } : {}
1034
1148
  });
1035
1149
  if (typeof yVal === 'number') {
1036
1150
  yMaxValue = Math.max(yMaxValue, yVal);
@@ -1128,7 +1242,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1128
1242
  }
1129
1243
  });
1130
1244
  const vsbcData = Object.values(mapXToDataPoints);
1131
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1245
+ const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1132
1246
  var _input_layout_height;
1133
1247
  return {
1134
1248
  data: vsbcData,
@@ -1139,7 +1253,6 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1139
1253
  yMinValue,
1140
1254
  mode: 'plotly',
1141
1255
  ...secondaryYAxisValues,
1142
- wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
1143
1256
  hideTickOverlap: true,
1144
1257
  barGapMax: 2,
1145
1258
  hideLegend,
@@ -1217,6 +1330,12 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1217
1330
  const color = colorScale ? colorScale(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[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedBarColors, xIndex, legend, colorMap, (_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, isDarkTheme);
1218
1331
  const opacity = getOpacity(series, xIndex);
1219
1332
  const yVal = series.y[xIndex];
1333
+ // Extract text value for barLabel
1334
+ let barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
1335
+ // Apply texttemplate formatting if specified
1336
+ if (barLabel && series.texttemplate) {
1337
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
1338
+ }
1220
1339
  var _rgb_copy_formatHex8;
1221
1340
  return {
1222
1341
  x: x.toString(),
@@ -1224,7 +1343,10 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1224
1343
  yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
1225
1344
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1226
1345
  opacity
1227
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1346
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1347
+ ...barLabel ? {
1348
+ barLabel: String(barLabel)
1349
+ } : {}
1228
1350
  };
1229
1351
  }).filter((item)=>typeof item !== 'undefined'),
1230
1352
  useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
@@ -1265,7 +1387,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1265
1387
  });
1266
1388
  }
1267
1389
  });
1268
- const annotations = getChartAnnotationsFromLayout(processedInput.layout, processedInput.data, isMultiPlot);
1390
+ const annotations = getChartAnnotationsFromLayout(processedInput.data, processedInput.layout, isMultiPlot);
1269
1391
  var _processedInput_layout_height;
1270
1392
  return {
1271
1393
  dataV2: gvbcDataV2,
@@ -1275,7 +1397,6 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1275
1397
  mode: 'plotly',
1276
1398
  ...secondaryYAxisValues,
1277
1399
  hideTickOverlap: true,
1278
- wrapXAxisLables: true,
1279
1400
  hideLegend,
1280
1401
  roundCorners: true,
1281
1402
  showYAxisLables: true,
@@ -1294,7 +1415,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1294
1415
  };
1295
1416
  };
1296
1417
  export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1297
- var _input_layout, _input_layout1, _vbcData_;
1418
+ var _input_layout, _input_layout1;
1298
1419
  const vbcData = [];
1299
1420
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1300
1421
  let colorScale = undefined;
@@ -1341,6 +1462,11 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1341
1462
  const color = colorScale ? colorScale(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[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : resolveColor(extractedColors, index, legend, colorMap, (_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, isDarkTheme);
1342
1463
  const opacity = getOpacity(series, index);
1343
1464
  const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
1465
+ // Handle text values and texttemplate formatting for histogram bins
1466
+ let barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
1467
+ if (barLabel && series.texttemplate) {
1468
+ barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
1469
+ }
1344
1470
  var _rgb_copy_formatHex8;
1345
1471
  vbcData.push({
1346
1472
  x: isXString ? bin.join(', ') : getBinCenter(bin),
@@ -1351,11 +1477,14 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1351
1477
  }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1352
1478
  ...isXString ? {} : {
1353
1479
  xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
1354
- }
1480
+ },
1481
+ ...barLabel ? {
1482
+ barLabel: String(barLabel)
1483
+ } : {}
1355
1484
  });
1356
1485
  });
1357
1486
  });
1358
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1487
+ const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1359
1488
  var _input_layout_height;
1360
1489
  return {
1361
1490
  data: vbcData,
@@ -1363,7 +1492,6 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1363
1492
  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,
1364
1493
  mode: 'histogram',
1365
1494
  hideTickOverlap: true,
1366
- wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
1367
1495
  maxBarWidth: 50,
1368
1496
  hideLegend,
1369
1497
  roundCorners: true,
@@ -1426,9 +1554,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1426
1554
  let mode = 'tonexty';
1427
1555
  const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1428
1556
  const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
1429
- const xAxisType = getAxisType(input.data, getAxisObjects(input.data, input.layout).x);
1430
- const resolveXValue = getAxisValueResolver(xAxisType);
1431
- const shouldWrapLabels = xAxisType === 'category';
1557
+ const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
1432
1558
  const chartData = input.data.map((series, index)=>{
1433
1559
  var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode1;
1434
1560
  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;
@@ -1577,7 +1703,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1577
1703
  ...lineShape
1578
1704
  ]
1579
1705
  };
1580
- const annotations = getChartAnnotationsFromLayout(input.layout, input.data, isMultiPlot);
1706
+ const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1581
1707
  var _input_layout_height;
1582
1708
  const commonProps = {
1583
1709
  supportNegativeData: true,
@@ -1587,7 +1713,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1587
1713
  hideTickOverlap: true,
1588
1714
  hideLegend,
1589
1715
  useUTC: false,
1590
- wrapXAxisLabels: shouldWrapLabels,
1591
1716
  optimizeLargeData: numDataPoints > 1000,
1592
1717
  showYAxisLables: true,
1593
1718
  roundedTicks: true,
@@ -1636,7 +1761,7 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
1636
1761
  const extractedColors = 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);
1637
1762
  const legend = legends[index];
1638
1763
  return series.y.map((yValue, i)=>{
1639
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1764
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x, _series_text;
1640
1765
  if (isInvalidValue(yValue)) {
1641
1766
  return null;
1642
1767
  }
@@ -1650,7 +1775,10 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
1650
1775
  legend,
1651
1776
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1652
1777
  opacity
1653
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1778
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1779
+ ...((_series_text = series.text) === null || _series_text === void 0 ? void 0 : _series_text[i]) ? {
1780
+ barLabel: series.text[i].toString()
1781
+ } : {}
1654
1782
  };
1655
1783
  }).filter((point)=>point !== null);
1656
1784
  }).flat();
@@ -1706,14 +1834,14 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
1706
1834
  // extract colors for each series only once
1707
1835
  const extractedColors = 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);
1708
1836
  series.y.forEach((yVal, i)=>{
1709
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_base, _series_x;
1837
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1710
1838
  if (isInvalidValue(yVal)) {
1711
1839
  return;
1712
1840
  }
1713
1841
  // resolve color for each legend's bars from the colorscale or extracted colors
1714
1842
  const color = colorScale ? colorScale(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) : resolveColor(extractedColors, i, legend, colorMap, (_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, isDarkTheme);
1715
1843
  const opacity = getOpacity(series, i);
1716
- const base = +resolveGanttXValue((_series_base = series.base) === null || _series_base === void 0 ? void 0 : _series_base[i]);
1844
+ const base = +resolveGanttXValue(isArrayOrTypedArray(series.base) ? series.base[i] : series.base);
1717
1845
  const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
1718
1846
  var _rgb_copy_formatHex8;
1719
1847
  ganttData.push({
@@ -1768,11 +1896,53 @@ export const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMa
1768
1896
  };
1769
1897
  };
1770
1898
  export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1771
- var _input_layout, _input_layout_coloraxis, _input_layout1, _input_layout_template_layout, _input_layout_template, _input_layout2, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout3, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout4, _input_layout5, _input_layout6;
1899
+ var _input_layout, _input_layout1, _input_layout_coloraxis, _input_layout2, _input_layout_template_layout, _input_layout_template, _input_layout3, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout4, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout5, _input_layout6, _input_layout7;
1772
1900
  const firstData = input.data[0];
1773
1901
  const heatmapDataPoints = [];
1774
1902
  let zMin = Number.POSITIVE_INFINITY;
1775
1903
  let zMax = Number.NEGATIVE_INFINITY;
1904
+ // Build a 2D array of annotations based on their grid position
1905
+ const annotationGrid = [];
1906
+ const rawAnnotations = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.annotations;
1907
+ if (rawAnnotations) {
1908
+ const annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [
1909
+ rawAnnotations
1910
+ ];
1911
+ // Collect all unique x and y values from valid annotations
1912
+ const xSet = new Set();
1913
+ const ySet = new Set();
1914
+ const validAnnotations = [];
1915
+ annotationsArray.forEach((a)=>{
1916
+ if (a && typeof a.x === 'number' && typeof a.y === 'number' && typeof a.text === 'string' && (a.xref === 'x' || a.xref === undefined) && (a.yref === 'y' || a.yref === undefined)) {
1917
+ xSet.add(a.x);
1918
+ ySet.add(a.y);
1919
+ validAnnotations.push({
1920
+ x: a.x,
1921
+ y: a.y,
1922
+ text: cleanText(a.text)
1923
+ });
1924
+ }
1925
+ });
1926
+ if (validAnnotations.length > 0) {
1927
+ // Get sorted unique x and y values
1928
+ const xValues = Array.from(xSet).sort((a, b)=>a - b);
1929
+ const yValues = Array.from(ySet).sort((a, b)=>a - b);
1930
+ // Initialize 2D grid and populate
1931
+ validAnnotations.forEach((annotation)=>{
1932
+ const xIdx = xValues.indexOf(annotation.x);
1933
+ const yIdx = yValues.indexOf(annotation.y);
1934
+ if (!annotationGrid[yIdx]) {
1935
+ annotationGrid[yIdx] = [];
1936
+ }
1937
+ annotationGrid[yIdx][xIdx] = annotation.text;
1938
+ });
1939
+ }
1940
+ }
1941
+ // Helper function to get annotation from 2D grid by index
1942
+ const getAnnotationByIndex = (xIdx, yIdx)=>{
1943
+ var _annotationGrid_yIdx;
1944
+ return (_annotationGrid_yIdx = annotationGrid[yIdx]) === null || _annotationGrid_yIdx === void 0 ? void 0 : _annotationGrid_yIdx[xIdx];
1945
+ };
1776
1946
  if (firstData.type === 'histogram2d') {
1777
1947
  var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
1778
1948
  const xValues = [];
@@ -1812,11 +1982,12 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1812
1982
  xBins.forEach((xBin, xIdx)=>{
1813
1983
  yBins.forEach((yBin, yIdx)=>{
1814
1984
  const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
1985
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1815
1986
  heatmapDataPoints.push({
1816
1987
  x: isXString ? xBin.join(', ') : getBinCenter(xBin),
1817
1988
  y: isYString ? yBin.join(', ') : getBinCenter(yBin),
1818
1989
  value: zVal,
1819
- rectText: zVal
1990
+ rectText: annotationText || zVal
1820
1991
  });
1821
1992
  if (typeof zVal === 'number') {
1822
1993
  zMin = Math.min(zMin, zVal);
@@ -1825,18 +1996,34 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1825
1996
  });
1826
1997
  });
1827
1998
  } else {
1828
- var _firstData_x1;
1829
- (_firstData_x1 = firstData.x) === null || _firstData_x1 === void 0 ? void 0 : _firstData_x1.forEach((xVal, xIdx)=>{
1830
- var // eslint-disable-next-line @typescript-eslint/no-explicit-any
1831
- _firstData_y;
1832
- (_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y.forEach((yVal, yIdx)=>{
1833
- var _firstData_z_yIdx, _firstData_z, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
1834
- const zVal = (_firstData_z = firstData.z) === null || _firstData_z === void 0 ? void 0 : (_firstData_z_yIdx = _firstData_z[yIdx]) === null || _firstData_z_yIdx === void 0 ? void 0 : _firstData_z_yIdx[xIdx];
1999
+ var _zArray_;
2000
+ // If x and y are not provided, generate indices based on z dimensions
2001
+ const zArray = firstData.z;
2002
+ const xValues = firstData.x;
2003
+ const yValues = firstData.y;
2004
+ var _zArray_length;
2005
+ // Determine the dimensions from z array
2006
+ const yLength = (_zArray_length = zArray === null || zArray === void 0 ? void 0 : zArray.length) !== null && _zArray_length !== void 0 ? _zArray_length : 0;
2007
+ var _zArray__length;
2008
+ const xLength = (_zArray__length = zArray === null || zArray === void 0 ? void 0 : (_zArray_ = zArray[0]) === null || _zArray_ === void 0 ? void 0 : _zArray_.length) !== null && _zArray__length !== void 0 ? _zArray__length : 0;
2009
+ // Use provided x/y values or generate indices
2010
+ const xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({
2011
+ length: xLength
2012
+ }, (_, i)=>i);
2013
+ const yData = yValues !== null && yValues !== void 0 ? yValues : Array.from({
2014
+ length: yLength
2015
+ }, (_, i)=>yLength - 1 - i);
2016
+ xData.forEach((xVal, xIdx)=>{
2017
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2018
+ yData.forEach((yVal, yIdx)=>{
2019
+ var _zArray_yIdx, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
2020
+ const zVal = zArray === null || zArray === void 0 ? void 0 : (_zArray_yIdx = zArray[yIdx]) === null || _zArray_yIdx === void 0 ? void 0 : _zArray_yIdx[xIdx];
2021
+ const annotationText = getAnnotationByIndex(xIdx, yIdx);
1835
2022
  heatmapDataPoints.push({
1836
2023
  x: ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_xaxis = _input_layout.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
1837
2024
  y: ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_yaxis = _input_layout1.yaxis) === null || _input_layout_yaxis === void 0 ? void 0 : _input_layout_yaxis.type) === 'date' ? yVal : yVal,
1838
2025
  value: zVal,
1839
- rectText: zVal
2026
+ rectText: annotationText || zVal
1840
2027
  });
1841
2028
  if (typeof zVal === 'number') {
1842
2029
  zMin = Math.min(zMin, zVal);
@@ -1863,7 +2050,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1863
2050
  getColorFromToken(DataVizPalette.color3)
1864
2051
  ];
1865
2052
  var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
1866
- let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout1.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template = _input_layout2.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.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_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_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template2 = _input_layout4.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
2053
+ let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout2.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template = _input_layout3.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.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template1 = _input_layout4.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template2 = _input_layout5.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
1867
2054
  // determine if the types diverging, sequential or sequentialminus are present in colorscale
1868
2055
  if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
1869
2056
  const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
@@ -1889,12 +2076,11 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1889
2076
  hideLegend: true,
1890
2077
  showYAxisLables: true,
1891
2078
  sortOrder: 'none',
1892
- width: (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.width,
1893
- 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,
2079
+ width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
2080
+ height: (_input_layout_height = (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : _input_layout7.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1894
2081
  hideTickOverlap: true,
1895
2082
  noOfCharsToTruncate: 20,
1896
2083
  showYAxisLablesTooltip: true,
1897
- wrapXAxisLables: true,
1898
2084
  ...getTitles(input.layout),
1899
2085
  ...getAxisCategoryOrderProps([
1900
2086
  firstData
@@ -1903,7 +2089,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1903
2089
  };
1904
2090
  };
1905
2091
  export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1906
- var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3;
2092
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3, _input_layout4;
1907
2093
  const { link, node } = input.data[0];
1908
2094
  var _link_value;
1909
2095
  const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
@@ -1945,7 +2131,7 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1945
2131
  // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
1946
2132
  // },
1947
2133
  // };
1948
- const { chartTitle } = getTitles(input.layout);
2134
+ const { chartTitle, titleStyles } = getTitles(input.layout);
1949
2135
  var _input_layout_height;
1950
2136
  return {
1951
2137
  data: {
@@ -1953,7 +2139,13 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
1953
2139
  SankeyChartData: sankeyChartData
1954
2140
  },
1955
2141
  width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
1956
- height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468
2142
+ height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468,
2143
+ // TODO
2144
+ // styles,
2145
+ hideLegend: isMultiPlot || ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.showlegend) === false,
2146
+ ...titleStyles ? {
2147
+ titleStyles
2148
+ } : {}
1957
2149
  };
1958
2150
  };
1959
2151
  export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -2004,7 +2196,7 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
2004
2196
  const styles = {
2005
2197
  sublabel: sublabelColor
2006
2198
  };
2007
- const { chartTitle } = getTitles(input.layout);
2199
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2008
2200
  var _firstData_value2, _input_layout_height;
2009
2201
  return {
2010
2202
  segments,
@@ -2025,7 +2217,10 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
2025
2217
  // styles,
2026
2218
  variant: ((_firstData_gauge9 = firstData.gauge) === null || _firstData_gauge9 === void 0 ? void 0 : (_firstData_gauge_steps1 = _firstData_gauge9.steps) === null || _firstData_gauge_steps1 === void 0 ? void 0 : _firstData_gauge_steps1.length) ? 'multiple-segments' : 'single-segment',
2027
2219
  styles,
2028
- roundCorners: true
2220
+ roundCorners: true,
2221
+ ...titleStyles ? {
2222
+ titleStyles
2223
+ } : {}
2029
2224
  };
2030
2225
  };
2031
2226
  const cleanText = (text)=>{
@@ -2168,13 +2363,18 @@ export const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMa
2168
2363
  },
2169
2364
  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 : []
2170
2365
  };
2366
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2171
2367
  var _tableData_header_values;
2172
2368
  return {
2173
2369
  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),
2174
2370
  rows,
2175
2371
  width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
2176
2372
  height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
2177
- styles
2373
+ styles,
2374
+ chartTitle,
2375
+ ...titleStyles ? {
2376
+ titleStyles
2377
+ } : {}
2178
2378
  };
2179
2379
  };
2180
2380
  function getCategoriesAndValues(series) {
@@ -2318,151 +2518,90 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
2318
2518
  });
2319
2519
  });
2320
2520
  }
2521
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2321
2522
  return {
2322
2523
  data: funnelData,
2524
+ chartTitle,
2323
2525
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2324
2526
  height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
2325
2527
  orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
2326
- hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false
2528
+ hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false,
2529
+ ...titleStyles ? {
2530
+ titleStyles
2531
+ } : {}
2327
2532
  };
2328
2533
  };
2329
- export const projectPolarToCartesian = (input)=>{
2534
+ export const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2330
2535
  var _input_layout, _input_layout1;
2331
- const projection = {
2332
- ...input
2333
- };
2334
- // Find the global min and max radius across all series
2335
- let minRadius = 0;
2336
- let maxRadius = 0;
2337
- for(let sindex = 0; sindex < input.data.length; sindex++){
2338
- const rVals = input.data[sindex].r;
2339
- if (rVals && isArrayOrTypedArray(rVals)) {
2340
- for(let ptindex = 0; ptindex < rVals.length; ptindex++){
2341
- if (!isInvalidValue(rVals[ptindex])) {
2342
- minRadius = Math.min(minRadius, rVals[ptindex]);
2343
- maxRadius = Math.max(maxRadius, rVals[ptindex]);
2344
- }
2345
- }
2346
- }
2347
- }
2348
- // If there are negative radii, compute the shift
2349
- const radiusShift = minRadius < 0 ? -minRadius : 0;
2350
- // Collect all unique theta values from all scatterpolar series for equal spacing
2351
- const allThetaValues = new Set();
2352
- for(let sindex = 0; sindex < input.data.length; sindex++){
2353
- const series = input.data[sindex];
2354
- if (series.theta && isArrayOrTypedArray(series.theta)) {
2355
- series.theta.forEach((theta)=>allThetaValues.add(String(theta)));
2356
- }
2357
- }
2358
- // Project all points and create a perfect square domain
2359
- const allX = [];
2360
- const allY = [];
2361
- let originX = null;
2362
- for(let sindex = 0; sindex < input.data.length; sindex++){
2363
- var _input_layout_polar_angularaxis, _input_layout_polar, _input_layout2, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout3;
2364
- const series = input.data[sindex];
2365
- // If scatterpolar, set __axisLabel to all unique theta values for equal spacing
2366
- if (isArrayOrTypedArray(series.theta)) {
2367
- series.__axisLabel = Array.from(allThetaValues);
2368
- }
2369
- series.x = [];
2370
- series.y = [];
2371
- const thetas = series.theta;
2372
- const rVals = series.r;
2373
- // Skip if rVals or thetas are not arrays
2374
- if (!isArrayOrTypedArray(rVals) || !isArrayOrTypedArray(thetas)) {
2375
- projection.data[sindex] = series;
2376
- continue;
2377
- }
2378
- // retrieve polar axis settings
2379
- 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;
2380
- var _input_layout_polar_angularaxis_rotation;
2381
- 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;
2382
- // Compute tick positions if categorical
2383
- let uniqueTheta = [];
2384
- let categorical = false;
2385
- if (!isNumberArray(thetas)) {
2386
- uniqueTheta = Array.from(new Set(thetas));
2387
- categorical = true;
2388
- }
2389
- for(let ptindex = 0; ptindex < rVals.length; ptindex++){
2390
- if (isInvalidValue(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || isInvalidValue(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
2391
- continue;
2392
- }
2393
- // Map theta to angle in radians
2394
- let thetaRad;
2395
- if (categorical) {
2396
- const idx = uniqueTheta.indexOf(thetas[ptindex]);
2397
- const step = 2 * Math.PI / uniqueTheta.length;
2398
- thetaRad = startAngleInRad + dirMultiplier * idx * step;
2536
+ const polarData = [];
2537
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
2538
+ const resolveRValue = getAxisValueResolver(getPolarAxis(input.data, 'r', input.layout)._type);
2539
+ input.data.forEach((series, index)=>{
2540
+ const legend = legends[index];
2541
+ if (series.type === 'scatterpolar') {
2542
+ var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_r;
2543
+ const isAreaTrace = series.fill === 'toself' || series.fill === 'tonext';
2544
+ const isLineTrace = typeof series.mode === 'undefined' ? true : series.mode.includes('lines');
2545
+ const colors = isAreaTrace ? series.fillcolor : isLineTrace ? (_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;
2546
+ const extractedColors = 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, colors, colorMap, isDarkTheme);
2547
+ const seriesColor = resolveColor(extractedColors, index, legend, colorMap, (_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, isDarkTheme);
2548
+ const seriesOpacity = getOpacity(series, index);
2549
+ const finalSeriesColor = rgb(seriesColor).copy({
2550
+ opacity: seriesOpacity
2551
+ }).formatHex8();
2552
+ const lineOptions = getLineOptions(series.line);
2553
+ const thetaUnit = series.thetaunit;
2554
+ const commonProps = {
2555
+ legend,
2556
+ legendShape: getLegendShape(series),
2557
+ color: finalSeriesColor,
2558
+ data: ((_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.map((r, rIndex)=>{
2559
+ var _series_theta, _series_marker, _series_marker1, _input_layout_template_layout, _input_layout_template, _input_layout;
2560
+ const theta = (_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[rIndex];
2561
+ const markerSize = Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size[rIndex] : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size;
2562
+ const text = Array.isArray(series.text) ? series.text[rIndex] : series.text;
2563
+ const markerColor = resolveColor(extractedColors, rIndex, legend, colorMap, (_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, isDarkTheme);
2564
+ const markerOpacity = getOpacity(series, rIndex);
2565
+ if (isInvalidValue(resolveRValue(r)) || isInvalidValue(theta)) {
2566
+ return;
2567
+ }
2568
+ return {
2569
+ r: resolveRValue(r),
2570
+ theta: typeof theta === 'number' ? thetaUnit === 'radians' ? theta * 180 / Math.PI : thetaUnit === 'gradians' ? theta * 0.9 : theta : theta,
2571
+ color: markerColor ? rgb(markerColor).copy({
2572
+ opacity: markerOpacity
2573
+ }).formatHex8() : finalSeriesColor,
2574
+ ...typeof markerSize !== 'undefined' ? {
2575
+ markerSize
2576
+ } : {},
2577
+ ...typeof text !== 'undefined' ? {
2578
+ text
2579
+ } : {}
2580
+ };
2581
+ }).filter((item)=>typeof item !== 'undefined')) || []
2582
+ };
2583
+ if (isAreaTrace || isLineTrace) {
2584
+ polarData.push({
2585
+ type: isAreaTrace ? 'areapolar' : 'linepolar',
2586
+ ...commonProps,
2587
+ lineOptions
2588
+ });
2399
2589
  } else {
2400
- thetaRad = startAngleInRad + dirMultiplier * (thetas[ptindex] * Math.PI / 180);
2401
- }
2402
- // Shift only the polar origin (not the cartesian)
2403
- const rawRadius = rVals[ptindex];
2404
- const polarRadius = rawRadius + radiusShift; // Only for projection
2405
- // Calculate cartesian coordinates (with shifted polar origin)
2406
- const x = polarRadius * Math.cos(thetaRad);
2407
- const y = polarRadius * Math.sin(thetaRad);
2408
- // Calculate the cartesian coordinates of the original polar origin (0,0)
2409
- // This is the point that should be mapped to (0,0) in cartesian coordinates
2410
- if (sindex === 0 && ptindex === 0) {
2411
- // For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
2412
- // But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
2413
- originX = radiusShift;
2414
- }
2415
- series.x.push(x);
2416
- series.y.push(y);
2417
- allX.push(x);
2418
- allY.push(y);
2419
- }
2420
- // Map text to each data point for downstream chart rendering
2421
- if (series.x && series.y) {
2422
- series.data = series.x.map((xVal, idx)=>({
2423
- x: xVal,
2424
- y: series.y[idx],
2425
- ...series.text ? {
2426
- text: series.text[idx]
2427
- } : {}
2428
- }));
2429
- }
2430
- projection.data[sindex] = series;
2431
- }
2432
- // 7. Recenter all cartesian coordinates
2433
- if (originX !== null) {
2434
- for(let sindex = 0; sindex < projection.data.length; sindex++){
2435
- const series = projection.data[sindex];
2436
- if (series.x && series.y) {
2437
- series.x = series.x.map((v)=>v - originX);
2590
+ polarData.push({
2591
+ type: 'scatterpolar',
2592
+ ...commonProps
2593
+ });
2438
2594
  }
2439
2595
  }
2440
- // Also recenter allX for normalization
2441
- for(let i = 0; i < allX.length; i++){
2442
- allX[i] = allX[i] - originX;
2443
- }
2444
- }
2445
- // 8. Find the maximum absolute value among all x and y
2446
- let maxAbs = Math.max(...allX.map(Math.abs), ...allY.map(Math.abs));
2447
- maxAbs = maxAbs === 0 ? 1 : maxAbs;
2448
- // 9. Rescale all points so that the largest |x| or |y| is 0.5
2449
- for(let sindex = 0; sindex < projection.data.length; sindex++){
2450
- const series = projection.data[sindex];
2451
- if (series.x && series.y) {
2452
- series.x = series.x.map((v)=>v / (2 * maxAbs));
2453
- series.y = series.y.map((v)=>v / (2 * maxAbs));
2454
- }
2455
- }
2456
- // 10. Customize layout for perfect square with absolute positioning
2457
- 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;
2458
- projection.layout = {
2459
- ...projection.layout,
2460
- width: size,
2461
- height: size
2596
+ });
2597
+ var _input_layout_height;
2598
+ return {
2599
+ data: polarData,
2600
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2601
+ 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 : 400,
2602
+ hideLegend,
2603
+ ...getPolarAxisProps(input.data, input.layout)
2462
2604
  };
2463
- // Attach originX as custom properties
2464
- projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
2465
- return projection;
2466
2605
  };
2467
2606
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2468
2607
  function isPlainObject(obj) {
@@ -2744,7 +2883,10 @@ export const isNonPlotType = (chartType)=>{
2744
2883
  'donut',
2745
2884
  'sankey',
2746
2885
  'pie',
2747
- 'annotation'
2886
+ 'annotation',
2887
+ 'table',
2888
+ 'gauge',
2889
+ 'funnel'
2748
2890
  ].includes(chartType);
2749
2891
  };
2750
2892
  export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
@@ -2777,7 +2919,8 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2777
2919
  const xAxisLayout = layout[key];
2778
2920
  const domainXInfo = {
2779
2921
  start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
2780
- end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
2922
+ end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
2923
+ cellName: `x${domainX.length === 0 ? '' : domainX.length + 1}`
2781
2924
  };
2782
2925
  domainX.push(domainXInfo);
2783
2926
  } else if (key.startsWith('yaxis')) {
@@ -2800,7 +2943,8 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2800
2943
  const yAxisLayout = layout[key];
2801
2944
  const domainYInfo = {
2802
2945
  start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
2803
- end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
2946
+ end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
2947
+ cellName: `x${domainY.length === 0 ? '' : domainY.length + 1}`
2804
2948
  };
2805
2949
  domainY.push(domainYInfo);
2806
2950
  }
@@ -2813,11 +2957,13 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2813
2957
  const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
2814
2958
  const domainXInfo = {
2815
2959
  start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
2816
- end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
2960
+ end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1,
2961
+ cellName: `${NON_PLOT_KEY_PREFIX}${domainX.length - cartesianDomains + 1}`
2817
2962
  };
2818
2963
  const domainYInfo = {
2819
2964
  start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
2820
- end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
2965
+ end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1,
2966
+ cellName: `${NON_PLOT_KEY_PREFIX}${domainY.length - cartesianDomains + 1}`
2821
2967
  };
2822
2968
  domainX.push(domainXInfo);
2823
2969
  domainY.push(domainYInfo);
@@ -2825,6 +2971,24 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2825
2971
  });
2826
2972
  if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
2827
2973
  var _layout_annotations;
2974
+ Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
2975
+ if (key.startsWith('polar')) {
2976
+ var _polarLayout_domain, _polarLayout_domain1, _polarLayout_domain2, _polarLayout_domain3;
2977
+ const polarLayout = layout[key];
2978
+ const domainXInfo = {
2979
+ start: ((_polarLayout_domain = polarLayout.domain) === null || _polarLayout_domain === void 0 ? void 0 : _polarLayout_domain.x) ? polarLayout.domain.x[0] : 0,
2980
+ end: ((_polarLayout_domain1 = polarLayout.domain) === null || _polarLayout_domain1 === void 0 ? void 0 : _polarLayout_domain1.x) ? polarLayout.domain.x[1] : 1,
2981
+ cellName: key
2982
+ };
2983
+ const domainYInfo = {
2984
+ start: ((_polarLayout_domain2 = polarLayout.domain) === null || _polarLayout_domain2 === void 0 ? void 0 : _polarLayout_domain2.y) ? polarLayout.domain.y[0] : 0,
2985
+ end: ((_polarLayout_domain3 = polarLayout.domain) === null || _polarLayout_domain3 === void 0 ? void 0 : _polarLayout_domain3.y) ? polarLayout.domain.y[1] : 1,
2986
+ cellName: key
2987
+ };
2988
+ domainX.push(domainXInfo);
2989
+ domainY.push(domainYInfo);
2990
+ }
2991
+ });
2828
2992
  (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
2829
2993
  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 ? [
2830
2994
  idx
@@ -2853,7 +3017,6 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2853
3017
  const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
2854
3018
  templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
2855
3019
  domainX.forEach((interval, index)=>{
2856
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
2857
3020
  const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
2858
3021
  const columnNumber = columnIndex + 1; // Column numbers are 1-based
2859
3022
  const annotationProps = annotations[index];
@@ -2868,7 +3031,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2868
3031
  end: 1
2869
3032
  }
2870
3033
  };
2871
- gridLayout[cellName] = row;
3034
+ gridLayout[interval.cellName] = row;
2872
3035
  });
2873
3036
  }
2874
3037
  if (domainY.length > 0) {
@@ -2883,12 +3046,11 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2883
3046
  const numberOfRows = sortedYStart.length;
2884
3047
  templateRows = `repeat(${numberOfRows}, 1fr)`;
2885
3048
  domainY.forEach((interval, index)=>{
2886
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
2887
3049
  const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
2888
3050
  const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
2889
3051
  const annotationProps = annotations[index];
2890
3052
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
2891
- const cell = gridLayout[cellName];
3053
+ const cell = gridLayout[interval.cellName];
2892
3054
  if (cell !== undefined) {
2893
3055
  cell.row = rowNumber;
2894
3056
  cell.yAnnotation = yAnnotation;
@@ -2930,7 +3092,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2930
3092
  }
2931
3093
  const isValidArray = isArrayOrTypedArray(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
2932
3094
  if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
2933
- result[propName] = ax.categoryarray;
3095
+ result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? ax.categoryarray.slice().reverse() : ax.categoryarray;
2934
3096
  return;
2935
3097
  }
2936
3098
  if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
@@ -3007,16 +3169,23 @@ const getAxisScaleTypeProps = (data, layout)=>{
3007
3169
  return;
3008
3170
  }
3009
3171
  const axType = getAxisType(data, ax);
3172
+ if (axId === 'x' && axType === 'category') {
3173
+ props.xAxis = {
3174
+ tickLayout: 'auto'
3175
+ };
3176
+ }
3010
3177
  if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
3011
3178
  const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3012
3179
  if (axId === 'x') {
3013
3180
  props.tickValues = tickValues;
3014
3181
  props.xAxis = {
3182
+ ...props.xAxis,
3015
3183
  tickText: ax.ticktext
3016
3184
  };
3017
3185
  } else if (axId === 'y') {
3018
3186
  props.yAxisTickValues = tickValues;
3019
3187
  props.yAxis = {
3188
+ ...props.yAxis,
3020
3189
  tickText: ax.ticktext
3021
3190
  };
3022
3191
  }
@@ -3027,11 +3196,13 @@ const getAxisScaleTypeProps = (data, layout)=>{
3027
3196
  const tick0 = plotlyTick0(ax.tick0, axType, dtick);
3028
3197
  if (axId === 'x') {
3029
3198
  props.xAxis = {
3199
+ ...props.xAxis,
3030
3200
  tickStep: dtick,
3031
3201
  tick0
3032
3202
  };
3033
3203
  } else if (axId === 'y') {
3034
3204
  props.yAxis = {
3205
+ ...props.yAxis,
3035
3206
  tickStep: dtick,
3036
3207
  tick0
3037
3208
  };
@@ -3212,3 +3383,109 @@ const getAxisValueResolver = (axType, dateParser)=>{
3212
3383
  }
3213
3384
  return new Date(value);
3214
3385
  };
3386
+ const POLAR_AXIS_BY_DATA_KEY = {
3387
+ r: 'radialAxis',
3388
+ theta: 'angularAxis'
3389
+ };
3390
+ export const DEFAULT_POLAR_SUBPLOT = 'polar';
3391
+ const getPolarLayout = (trace, layout)=>{
3392
+ const subplotId = (trace === null || trace === void 0 ? void 0 : trace.subplot) || DEFAULT_POLAR_SUBPLOT;
3393
+ return layout === null || layout === void 0 ? void 0 : layout[subplotId];
3394
+ };
3395
+ const getValidAxisValues = (data, dataKey)=>{
3396
+ const values = [];
3397
+ data.forEach((series)=>{
3398
+ if (isArrayOrTypedArray(series[dataKey])) {
3399
+ series[dataKey].forEach((val)=>{
3400
+ if (!isInvalidValue(val)) {
3401
+ values.push(val);
3402
+ }
3403
+ });
3404
+ }
3405
+ });
3406
+ return values;
3407
+ };
3408
+ const getPolarAxisType = (data, dataKey, declaredType)=>{
3409
+ if ([
3410
+ 'linear',
3411
+ 'log',
3412
+ 'date',
3413
+ 'category'
3414
+ ].includes(declaredType !== null && declaredType !== void 0 ? declaredType : '')) {
3415
+ return declaredType;
3416
+ }
3417
+ const values = getValidAxisValues(data, dataKey);
3418
+ if (isNumberArray(values) && !isYearArray(values)) {
3419
+ return 'linear';
3420
+ }
3421
+ if (isDateArray(values)) {
3422
+ return 'date';
3423
+ }
3424
+ return 'category';
3425
+ };
3426
+ const getPolarAxis = (data, dataKey, layout)=>{
3427
+ const polarLayout = getPolarLayout(data[0], layout);
3428
+ const ax = polarLayout === null || polarLayout === void 0 ? void 0 : polarLayout[POLAR_AXIS_BY_DATA_KEY[dataKey].toLowerCase()];
3429
+ return {
3430
+ ...ax,
3431
+ _dataKey: dataKey,
3432
+ _type: getPolarAxisType(data, dataKey, ax === null || ax === void 0 ? void 0 : ax.type)
3433
+ };
3434
+ };
3435
+ const getPolarAxisTickProps = (data, ax)=>{
3436
+ const props = {};
3437
+ if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
3438
+ const tickValues = ax._type === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3439
+ props.tickValues = tickValues;
3440
+ props.tickText = ax.ticktext;
3441
+ return props;
3442
+ }
3443
+ if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
3444
+ const dtick = plotlyDtick(ax.dtick, ax._type);
3445
+ const tick0 = plotlyTick0(ax.tick0, ax._type, dtick);
3446
+ props.tickStep = dtick;
3447
+ props.tick0 = tick0;
3448
+ return props;
3449
+ }
3450
+ if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
3451
+ props.tickCount = ax.nticks;
3452
+ }
3453
+ return props;
3454
+ };
3455
+ const getPolarAxisCategoryOrder = (data, ax)=>{
3456
+ if (ax._type !== 'category') {
3457
+ return 'data';
3458
+ }
3459
+ const isValidArray = isArrayOrTypedArray(ax.categoryarray) && ax.categoryarray.length > 0;
3460
+ if (isValidArray && (!ax.categoryorder || ax.categoryorder === 'array')) {
3461
+ return ax.categoryarray;
3462
+ }
3463
+ if (!ax.categoryorder || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
3464
+ const values = getValidAxisValues(data, ax._dataKey);
3465
+ const categoriesInTraceOrder = Array.from(new Set(values));
3466
+ return ax.autorange === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
3467
+ }
3468
+ return ax.categoryorder;
3469
+ };
3470
+ const getPolarAxisProps = (data, layout)=>{
3471
+ const props = {};
3472
+ Object.keys(POLAR_AXIS_BY_DATA_KEY).forEach((dataKey)=>{
3473
+ const propName = POLAR_AXIS_BY_DATA_KEY[dataKey];
3474
+ const ax = getPolarAxis(data, dataKey, layout);
3475
+ props[propName] = {
3476
+ scaleType: ax._type === 'log' ? 'log' : 'default',
3477
+ categoryOrder: getPolarAxisCategoryOrder(data, ax),
3478
+ tickFormat: ax.tickformat,
3479
+ ...getPolarAxisTickProps(data, ax),
3480
+ ...isArrayOrTypedArray(ax.range) ? {
3481
+ rangeStart: ax.range[0],
3482
+ rangeEnd: ax.range[1]
3483
+ } : {}
3484
+ };
3485
+ if (propName === 'angularAxis') {
3486
+ props[propName].unit = ax.thetaunit;
3487
+ props.direction = ax.direction;
3488
+ }
3489
+ });
3490
+ return props;
3491
+ };