@fluentui/react-charts 9.3.21 → 9.74.3-experimental.esm.20260709-49ee7a20cf.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (767) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/package.json +15 -17
  3. package/dist/index.d.ts +0 -5724
  4. package/lib/AnnotationOnlyChart.js +0 -1
  5. package/lib/AnnotationOnlyChart.js.map +0 -1
  6. package/lib/AreaChart.js +0 -1
  7. package/lib/AreaChart.js.map +0 -1
  8. package/lib/CartesianChart.js +0 -1
  9. package/lib/CartesianChart.js.map +0 -1
  10. package/lib/ChartTable.js +0 -1
  11. package/lib/ChartTable.js.map +0 -1
  12. package/lib/DeclarativeChart.js +0 -1
  13. package/lib/DeclarativeChart.js.map +0 -1
  14. package/lib/DonutChart.js +0 -1
  15. package/lib/DonutChart.js.map +0 -1
  16. package/lib/FunnelChart.js +0 -1
  17. package/lib/FunnelChart.js.map +0 -1
  18. package/lib/GanttChart.js +0 -1
  19. package/lib/GanttChart.js.map +0 -1
  20. package/lib/GaugeChart.js +0 -1
  21. package/lib/GaugeChart.js.map +0 -1
  22. package/lib/GroupedVerticalBarChart.js +0 -1
  23. package/lib/GroupedVerticalBarChart.js.map +0 -1
  24. package/lib/HeatMapChart.js +0 -1
  25. package/lib/HeatMapChart.js.map +0 -1
  26. package/lib/HorizontalBarChart.js +0 -1
  27. package/lib/HorizontalBarChart.js.map +0 -1
  28. package/lib/HorizontalBarChartWithAxis.js +0 -1
  29. package/lib/HorizontalBarChartWithAxis.js.map +0 -1
  30. package/lib/Legends.js +0 -1
  31. package/lib/Legends.js.map +0 -1
  32. package/lib/LineChart.js +0 -1
  33. package/lib/LineChart.js.map +0 -1
  34. package/lib/PolarChart.js +0 -1
  35. package/lib/PolarChart.js.map +0 -1
  36. package/lib/Popover.js +0 -1
  37. package/lib/Popover.js.map +0 -1
  38. package/lib/ResponsiveContainer.js +0 -1
  39. package/lib/ResponsiveContainer.js.map +0 -1
  40. package/lib/SankeyChart.js +0 -1
  41. package/lib/SankeyChart.js.map +0 -1
  42. package/lib/ScatterChart.js +0 -1
  43. package/lib/ScatterChart.js.map +0 -1
  44. package/lib/Sparkline.js +0 -1
  45. package/lib/Sparkline.js.map +0 -1
  46. package/lib/VegaDeclarativeChart.js +0 -1
  47. package/lib/VegaDeclarativeChart.js.map +0 -1
  48. package/lib/VerticalBarChart.js +0 -1
  49. package/lib/VerticalBarChart.js.map +0 -1
  50. package/lib/VerticalStackedBarChart.js +0 -1
  51. package/lib/VerticalStackedBarChart.js.map +0 -1
  52. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +0 -196
  53. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +0 -1
  54. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +0 -3
  55. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +0 -1
  56. package/lib/components/AnnotationOnlyChart/index.js +0 -2
  57. package/lib/components/AnnotationOnlyChart/index.js.map +0 -1
  58. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +0 -33
  59. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +0 -1
  60. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +0 -24
  61. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +0 -1
  62. package/lib/components/AreaChart/AreaChart.js +0 -932
  63. package/lib/components/AreaChart/AreaChart.js.map +0 -1
  64. package/lib/components/AreaChart/AreaChart.types.js +0 -4
  65. package/lib/components/AreaChart/AreaChart.types.js.map +0 -1
  66. package/lib/components/AreaChart/index.js +0 -3
  67. package/lib/components/AreaChart/index.js.map +0 -1
  68. package/lib/components/AreaChart/useAreaChartStyles.styles.js +0 -63
  69. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +0 -1
  70. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +0 -33
  71. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +0 -1
  72. package/lib/components/ChartTable/ChartTable.js +0 -160
  73. package/lib/components/ChartTable/ChartTable.js.map +0 -1
  74. package/lib/components/ChartTable/ChartTable.types.js +0 -4
  75. package/lib/components/ChartTable/ChartTable.types.js.map +0 -1
  76. package/lib/components/ChartTable/index.js +0 -3
  77. package/lib/components/ChartTable/index.js.map +0 -1
  78. package/lib/components/ChartTable/useChartTableStyles.styles.js +0 -136
  79. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +0 -1
  80. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +0 -68
  81. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +0 -1
  82. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +0 -659
  83. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +0 -1
  84. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +0 -1
  85. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +0 -1
  86. package/lib/components/CommonComponents/Annotations/index.js +0 -2
  87. package/lib/components/CommonComponents/Annotations/index.js.map +0 -1
  88. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +0 -223
  89. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +0 -1
  90. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +0 -139
  91. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +0 -1
  92. package/lib/components/CommonComponents/CartesianChart.js +0 -665
  93. package/lib/components/CommonComponents/CartesianChart.js.map +0 -1
  94. package/lib/components/CommonComponents/CartesianChart.types.js +0 -2
  95. package/lib/components/CommonComponents/CartesianChart.types.js.map +0 -1
  96. package/lib/components/CommonComponents/ChartPopover.js +0 -197
  97. package/lib/components/CommonComponents/ChartPopover.js.map +0 -1
  98. package/lib/components/CommonComponents/ChartPopover.types.js +0 -1
  99. package/lib/components/CommonComponents/ChartPopover.types.js.map +0 -1
  100. package/lib/components/CommonComponents/index.js +0 -6
  101. package/lib/components/CommonComponents/index.js.map +0 -1
  102. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +0 -189
  103. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +0 -1
  104. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +0 -131
  105. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +0 -1
  106. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +0 -171
  107. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +0 -1
  108. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -127
  109. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +0 -1
  110. package/lib/components/DeclarativeChart/DeclarativeChart.js +0 -397
  111. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +0 -1
  112. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +0 -163
  113. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +0 -1
  114. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +0 -3490
  115. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +0 -1
  116. package/lib/components/DeclarativeChart/index.js +0 -1
  117. package/lib/components/DeclarativeChart/index.js.map +0 -1
  118. package/lib/components/DonutChart/Arc/Arc.js +0 -118
  119. package/lib/components/DonutChart/Arc/Arc.js.map +0 -1
  120. package/lib/components/DonutChart/Arc/Arc.types.js +0 -1
  121. package/lib/components/DonutChart/Arc/Arc.types.js.map +0 -1
  122. package/lib/components/DonutChart/Arc/index.js +0 -2
  123. package/lib/components/DonutChart/Arc/index.js.map +0 -1
  124. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +0 -80
  125. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +0 -1
  126. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +0 -49
  127. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +0 -1
  128. package/lib/components/DonutChart/DonutChart.js +0 -349
  129. package/lib/components/DonutChart/DonutChart.js.map +0 -1
  130. package/lib/components/DonutChart/DonutChart.types.js +0 -4
  131. package/lib/components/DonutChart/DonutChart.types.js.map +0 -1
  132. package/lib/components/DonutChart/Pie/Pie.js +0 -72
  133. package/lib/components/DonutChart/Pie/Pie.js.map +0 -1
  134. package/lib/components/DonutChart/Pie/Pie.types.js +0 -1
  135. package/lib/components/DonutChart/Pie/Pie.types.js.map +0 -1
  136. package/lib/components/DonutChart/Pie/index.js +0 -2
  137. package/lib/components/DonutChart/Pie/index.js.map +0 -1
  138. package/lib/components/DonutChart/Pie/usePieStyles.styles.js +0 -41
  139. package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +0 -1
  140. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js +0 -30
  141. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +0 -1
  142. package/lib/components/DonutChart/index.js +0 -3
  143. package/lib/components/DonutChart/index.js.map +0 -1
  144. package/lib/components/DonutChart/useDonutChartStyles.styles.js +0 -98
  145. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +0 -1
  146. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +0 -62
  147. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +0 -1
  148. package/lib/components/FunnelChart/FunnelChart.js +0 -401
  149. package/lib/components/FunnelChart/FunnelChart.js.map +0 -1
  150. package/lib/components/FunnelChart/FunnelChart.types.js +0 -4
  151. package/lib/components/FunnelChart/FunnelChart.types.js.map +0 -1
  152. package/lib/components/FunnelChart/funnelGeometry.js +0 -219
  153. package/lib/components/FunnelChart/funnelGeometry.js.map +0 -1
  154. package/lib/components/FunnelChart/index.js +0 -2
  155. package/lib/components/FunnelChart/index.js.map +0 -1
  156. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +0 -83
  157. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +0 -1
  158. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +0 -65
  159. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +0 -1
  160. package/lib/components/GanttChart/GanttChart.js +0 -535
  161. package/lib/components/GanttChart/GanttChart.js.map +0 -1
  162. package/lib/components/GanttChart/GanttChart.types.js +0 -4
  163. package/lib/components/GanttChart/GanttChart.types.js.map +0 -1
  164. package/lib/components/GanttChart/index.js +0 -2
  165. package/lib/components/GanttChart/index.js.map +0 -1
  166. package/lib/components/GanttChart/useGanttChartStyles.styles.js +0 -27
  167. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +0 -1
  168. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +0 -26
  169. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +0 -1
  170. package/lib/components/GaugeChart/GaugeChart.js +0 -568
  171. package/lib/components/GaugeChart/GaugeChart.js.map +0 -1
  172. package/lib/components/GaugeChart/GaugeChart.types.js +0 -4
  173. package/lib/components/GaugeChart/GaugeChart.types.js.map +0 -1
  174. package/lib/components/GaugeChart/index.js +0 -3
  175. package/lib/components/GaugeChart/index.js.map +0 -1
  176. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +0 -197
  177. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +0 -1
  178. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +0 -149
  179. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +0 -1
  180. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +0 -813
  181. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +0 -1
  182. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +0 -4
  183. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +0 -1
  184. package/lib/components/GroupedVerticalBarChart/index.js +0 -3
  185. package/lib/components/GroupedVerticalBarChart/index.js.map +0 -1
  186. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -77
  187. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +0 -1
  188. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +0 -40
  189. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +0 -1
  190. package/lib/components/HeatMapChart/HeatMapChart.js +0 -677
  191. package/lib/components/HeatMapChart/HeatMapChart.js.map +0 -1
  192. package/lib/components/HeatMapChart/HeatMapChart.types.js +0 -4
  193. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +0 -1
  194. package/lib/components/HeatMapChart/index.js +0 -3
  195. package/lib/components/HeatMapChart/index.js.map +0 -1
  196. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +0 -48
  197. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +0 -1
  198. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +0 -42
  199. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +0 -1
  200. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +0 -411
  201. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +0 -1
  202. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +0 -7
  203. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +0 -1
  204. package/lib/components/HorizontalBarChart/index.js +0 -3
  205. package/lib/components/HorizontalBarChart/index.js.map +0 -1
  206. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +0 -175
  207. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +0 -1
  208. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +0 -125
  209. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +0 -1
  210. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +0 -720
  211. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +0 -1
  212. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +0 -4
  213. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +0 -1
  214. package/lib/components/HorizontalBarChartWithAxis/index.js +0 -3
  215. package/lib/components/HorizontalBarChartWithAxis/index.js.map +0 -1
  216. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +0 -62
  217. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +0 -1
  218. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +0 -54
  219. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +0 -1
  220. package/lib/components/Legends/Legends.js +0 -323
  221. package/lib/components/Legends/Legends.js.map +0 -1
  222. package/lib/components/Legends/Legends.types.js +0 -3
  223. package/lib/components/Legends/Legends.types.js.map +0 -1
  224. package/lib/components/Legends/OverflowMenu.js +0 -33
  225. package/lib/components/Legends/OverflowMenu.js.map +0 -1
  226. package/lib/components/Legends/index.js +0 -3
  227. package/lib/components/Legends/index.js.map +0 -1
  228. package/lib/components/Legends/shape.js +0 -36
  229. package/lib/components/Legends/shape.js.map +0 -1
  230. package/lib/components/Legends/useLegendsStyles.styles.js +0 -262
  231. package/lib/components/Legends/useLegendsStyles.styles.js.map +0 -1
  232. package/lib/components/Legends/useLegendsStyles.styles.raw.js +0 -142
  233. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +0 -1
  234. package/lib/components/LineChart/LineChart.js +0 -1332
  235. package/lib/components/LineChart/LineChart.js.map +0 -1
  236. package/lib/components/LineChart/LineChart.types.js +0 -3
  237. package/lib/components/LineChart/LineChart.types.js.map +0 -1
  238. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +0 -118
  239. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +0 -1
  240. package/lib/components/LineChart/eventAnnotation/LabelLink.js +0 -59
  241. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +0 -1
  242. package/lib/components/LineChart/eventAnnotation/Textbox.js +0 -42
  243. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +0 -1
  244. package/lib/components/LineChart/index.js +0 -4
  245. package/lib/components/LineChart/index.js.map +0 -1
  246. package/lib/components/LineChart/useLineChartStyles.styles.js +0 -93
  247. package/lib/components/LineChart/useLineChartStyles.styles.js.map +0 -1
  248. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +0 -50
  249. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +0 -1
  250. package/lib/components/PolarChart/PolarChart.js +0 -577
  251. package/lib/components/PolarChart/PolarChart.js.map +0 -1
  252. package/lib/components/PolarChart/PolarChart.types.js +0 -4
  253. package/lib/components/PolarChart/PolarChart.types.js.map +0 -1
  254. package/lib/components/PolarChart/PolarChart.utils.js +0 -174
  255. package/lib/components/PolarChart/PolarChart.utils.js.map +0 -1
  256. package/lib/components/PolarChart/index.js +0 -2
  257. package/lib/components/PolarChart/index.js.map +0 -1
  258. package/lib/components/PolarChart/usePolarChartStyles.styles.js +0 -72
  259. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +0 -1
  260. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +0 -61
  261. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +0 -1
  262. package/lib/components/ResponsiveContainer/ResponsiveContainer.js +0 -99
  263. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +0 -1
  264. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +0 -4
  265. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +0 -1
  266. package/lib/components/ResponsiveContainer/index.js +0 -3
  267. package/lib/components/ResponsiveContainer/index.js.map +0 -1
  268. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +0 -30
  269. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +0 -1
  270. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +0 -29
  271. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +0 -1
  272. package/lib/components/ResponsiveContainer/withResponsiveContainer.js +0 -20
  273. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +0 -1
  274. package/lib/components/SankeyChart/SankeyChart.js +0 -1026
  275. package/lib/components/SankeyChart/SankeyChart.js.map +0 -1
  276. package/lib/components/SankeyChart/SankeyChart.types.js +0 -3
  277. package/lib/components/SankeyChart/SankeyChart.types.js.map +0 -1
  278. package/lib/components/SankeyChart/index.js +0 -3
  279. package/lib/components/SankeyChart/index.js.map +0 -1
  280. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +0 -123
  281. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +0 -1
  282. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +0 -79
  283. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +0 -1
  284. package/lib/components/ScatterChart/ScatterChart.js +0 -544
  285. package/lib/components/ScatterChart/ScatterChart.js.map +0 -1
  286. package/lib/components/ScatterChart/ScatterChart.types.js +0 -4
  287. package/lib/components/ScatterChart/ScatterChart.types.js.map +0 -1
  288. package/lib/components/ScatterChart/index.js +0 -3
  289. package/lib/components/ScatterChart/index.js.map +0 -1
  290. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +0 -84
  291. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +0 -1
  292. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +0 -41
  293. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +0 -1
  294. package/lib/components/Sparkline/Sparkline.js +0 -123
  295. package/lib/components/Sparkline/Sparkline.js.map +0 -1
  296. package/lib/components/Sparkline/Sparkline.types.js +0 -4
  297. package/lib/components/Sparkline/Sparkline.types.js.map +0 -1
  298. package/lib/components/Sparkline/index.js +0 -3
  299. package/lib/components/Sparkline/index.js.map +0 -1
  300. package/lib/components/Sparkline/useSparklineStyles.styles.js +0 -40
  301. package/lib/components/Sparkline/useSparklineStyles.styles.js.map +0 -1
  302. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js +0 -31
  303. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js.map +0 -1
  304. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js +0 -405
  305. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +0 -1
  306. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +0 -20
  307. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +0 -1
  308. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +0 -415
  309. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +0 -1
  310. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +0 -537
  311. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +0 -1
  312. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +0 -3279
  313. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +0 -1
  314. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js +0 -28
  315. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js.map +0 -1
  316. package/lib/components/VegaDeclarativeChart/index.js +0 -1
  317. package/lib/components/VegaDeclarativeChart/index.js.map +0 -1
  318. package/lib/components/VerticalBarChart/VerticalBarChart.js +0 -930
  319. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +0 -1
  320. package/lib/components/VerticalBarChart/VerticalBarChart.types.js +0 -4
  321. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +0 -1
  322. package/lib/components/VerticalBarChart/index.js +0 -3
  323. package/lib/components/VerticalBarChart/index.js.map +0 -1
  324. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -86
  325. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +0 -1
  326. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +0 -48
  327. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +0 -1
  328. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +0 -1077
  329. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +0 -1
  330. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +0 -4
  331. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +0 -1
  332. package/lib/components/VerticalStackedBarChart/index.js +0 -3
  333. package/lib/components/VerticalStackedBarChart/index.js.map +0 -1
  334. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -74
  335. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +0 -1
  336. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +0 -38
  337. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +0 -1
  338. package/lib/index.js +0 -26
  339. package/lib/index.js.map +0 -1
  340. package/lib/types/ChartAnnotation.js +0 -1
  341. package/lib/types/ChartAnnotation.js.map +0 -1
  342. package/lib/types/DataPoint.js +0 -3
  343. package/lib/types/DataPoint.js.map +0 -1
  344. package/lib/types/EventAnnotation.js +0 -1
  345. package/lib/types/EventAnnotation.js.map +0 -1
  346. package/lib/types/LegendDataItem.js +0 -1
  347. package/lib/types/LegendDataItem.js.map +0 -1
  348. package/lib/types/index.js +0 -3
  349. package/lib/types/index.js.map +0 -1
  350. package/lib/utilities/ChartTitle.js +0 -45
  351. package/lib/utilities/ChartTitle.js.map +0 -1
  352. package/lib/utilities/Common.styles.js +0 -117
  353. package/lib/utilities/Common.styles.js.map +0 -1
  354. package/lib/utilities/Common.styles.raw.js +0 -115
  355. package/lib/utilities/Common.styles.raw.js.map +0 -1
  356. package/lib/utilities/FocusableTooltipText.js +0 -65
  357. package/lib/utilities/FocusableTooltipText.js.map +0 -1
  358. package/lib/utilities/KeyCodes.js +0 -11
  359. package/lib/utilities/KeyCodes.js.map +0 -1
  360. package/lib/utilities/SVGTooltipText.js +0 -179
  361. package/lib/utilities/SVGTooltipText.js.map +0 -1
  362. package/lib/utilities/async-utils.js +0 -380
  363. package/lib/utilities/async-utils.js.map +0 -1
  364. package/lib/utilities/colors.js +0 -281
  365. package/lib/utilities/colors.js.map +0 -1
  366. package/lib/utilities/getWindow.js +0 -25
  367. package/lib/utilities/getWindow.js.map +0 -1
  368. package/lib/utilities/hooks.js +0 -34
  369. package/lib/utilities/hooks.js.map +0 -1
  370. package/lib/utilities/image-export-utils.js +0 -405
  371. package/lib/utilities/image-export-utils.js.map +0 -1
  372. package/lib/utilities/index.js +0 -5
  373. package/lib/utilities/index.js.map +0 -1
  374. package/lib/utilities/overflow-utils.js +0 -27
  375. package/lib/utilities/overflow-utils.js.map +0 -1
  376. package/lib/utilities/scatterpolar-utils.js +0 -52
  377. package/lib/utilities/scatterpolar-utils.js.map +0 -1
  378. package/lib/utilities/string.js +0 -32
  379. package/lib/utilities/string.js.map +0 -1
  380. package/lib/utilities/test-data.js +0 -565
  381. package/lib/utilities/test-data.js.map +0 -1
  382. package/lib/utilities/utilities.js +0 -1990
  383. package/lib/utilities/utilities.js.map +0 -1
  384. package/lib/utilities/vbc-utils.js +0 -51
  385. package/lib/utilities/vbc-utils.js.map +0 -1
  386. package/lib-commonjs/AnnotationOnlyChart.js +0 -6
  387. package/lib-commonjs/AnnotationOnlyChart.js.map +0 -1
  388. package/lib-commonjs/AreaChart.js +0 -6
  389. package/lib-commonjs/AreaChart.js.map +0 -1
  390. package/lib-commonjs/CartesianChart.js +0 -6
  391. package/lib-commonjs/CartesianChart.js.map +0 -1
  392. package/lib-commonjs/ChartTable.js +0 -6
  393. package/lib-commonjs/ChartTable.js.map +0 -1
  394. package/lib-commonjs/DeclarativeChart.js +0 -6
  395. package/lib-commonjs/DeclarativeChart.js.map +0 -1
  396. package/lib-commonjs/DonutChart.js +0 -6
  397. package/lib-commonjs/DonutChart.js.map +0 -1
  398. package/lib-commonjs/FunnelChart.js +0 -6
  399. package/lib-commonjs/FunnelChart.js.map +0 -1
  400. package/lib-commonjs/GanttChart.js +0 -6
  401. package/lib-commonjs/GanttChart.js.map +0 -1
  402. package/lib-commonjs/GaugeChart.js +0 -6
  403. package/lib-commonjs/GaugeChart.js.map +0 -1
  404. package/lib-commonjs/GroupedVerticalBarChart.js +0 -6
  405. package/lib-commonjs/GroupedVerticalBarChart.js.map +0 -1
  406. package/lib-commonjs/HeatMapChart.js +0 -6
  407. package/lib-commonjs/HeatMapChart.js.map +0 -1
  408. package/lib-commonjs/HorizontalBarChart.js +0 -6
  409. package/lib-commonjs/HorizontalBarChart.js.map +0 -1
  410. package/lib-commonjs/HorizontalBarChartWithAxis.js +0 -6
  411. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +0 -1
  412. package/lib-commonjs/Legends.js +0 -6
  413. package/lib-commonjs/Legends.js.map +0 -1
  414. package/lib-commonjs/LineChart.js +0 -6
  415. package/lib-commonjs/LineChart.js.map +0 -1
  416. package/lib-commonjs/PolarChart.js +0 -6
  417. package/lib-commonjs/PolarChart.js.map +0 -1
  418. package/lib-commonjs/Popover.js +0 -6
  419. package/lib-commonjs/Popover.js.map +0 -1
  420. package/lib-commonjs/ResponsiveContainer.js +0 -6
  421. package/lib-commonjs/ResponsiveContainer.js.map +0 -1
  422. package/lib-commonjs/SankeyChart.js +0 -6
  423. package/lib-commonjs/SankeyChart.js.map +0 -1
  424. package/lib-commonjs/ScatterChart.js +0 -6
  425. package/lib-commonjs/ScatterChart.js.map +0 -1
  426. package/lib-commonjs/Sparkline.js +0 -6
  427. package/lib-commonjs/Sparkline.js.map +0 -1
  428. package/lib-commonjs/VegaDeclarativeChart.js +0 -6
  429. package/lib-commonjs/VegaDeclarativeChart.js.map +0 -1
  430. package/lib-commonjs/VerticalBarChart.js +0 -6
  431. package/lib-commonjs/VerticalBarChart.js.map +0 -1
  432. package/lib-commonjs/VerticalStackedBarChart.js +0 -6
  433. package/lib-commonjs/VerticalStackedBarChart.js.map +0 -1
  434. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +0 -207
  435. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +0 -1
  436. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +0 -6
  437. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +0 -1
  438. package/lib-commonjs/components/AnnotationOnlyChart/index.js +0 -7
  439. package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +0 -1
  440. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +0 -57
  441. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +0 -1
  442. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +0 -34
  443. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +0 -1
  444. package/lib-commonjs/components/AreaChart/AreaChart.js +0 -938
  445. package/lib-commonjs/components/AreaChart/AreaChart.js.map +0 -1
  446. package/lib-commonjs/components/AreaChart/AreaChart.types.js +0 -7
  447. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +0 -1
  448. package/lib-commonjs/components/AreaChart/index.js +0 -8
  449. package/lib-commonjs/components/AreaChart/index.js.map +0 -1
  450. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -96
  451. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +0 -1
  452. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +0 -49
  453. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +0 -1
  454. package/lib-commonjs/components/ChartTable/ChartTable.js +0 -171
  455. package/lib-commonjs/components/ChartTable/ChartTable.js.map +0 -1
  456. package/lib-commonjs/components/ChartTable/ChartTable.types.js +0 -7
  457. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +0 -1
  458. package/lib-commonjs/components/ChartTable/index.js +0 -8
  459. package/lib-commonjs/components/ChartTable/index.js.map +0 -1
  460. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +0 -200
  461. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +0 -1
  462. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +0 -82
  463. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +0 -1
  464. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +0 -670
  465. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +0 -1
  466. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +0 -4
  467. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +0 -1
  468. package/lib-commonjs/components/CommonComponents/Annotations/index.js +0 -7
  469. package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +0 -1
  470. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +0 -325
  471. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +0 -1
  472. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +0 -174
  473. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +0 -1
  474. package/lib-commonjs/components/CommonComponents/CartesianChart.js +0 -673
  475. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +0 -1
  476. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +0 -5
  477. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +0 -1
  478. package/lib-commonjs/components/CommonComponents/ChartPopover.js +0 -207
  479. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +0 -1
  480. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +0 -4
  481. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +0 -1
  482. package/lib-commonjs/components/CommonComponents/index.js +0 -11
  483. package/lib-commonjs/components/CommonComponents/index.js.map +0 -1
  484. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +0 -268
  485. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +0 -1
  486. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +0 -144
  487. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +0 -1
  488. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +0 -238
  489. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +0 -1
  490. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -141
  491. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +0 -1
  492. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +0 -400
  493. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +0 -1
  494. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +0 -195
  495. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +0 -1
  496. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +0 -3577
  497. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +0 -1
  498. package/lib-commonjs/components/DeclarativeChart/index.js +0 -6
  499. package/lib-commonjs/components/DeclarativeChart/index.js.map +0 -1
  500. package/lib-commonjs/components/DonutChart/Arc/Arc.js +0 -125
  501. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +0 -1
  502. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +0 -4
  503. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +0 -1
  504. package/lib-commonjs/components/DonutChart/Arc/index.js +0 -7
  505. package/lib-commonjs/components/DonutChart/Arc/index.js.map +0 -1
  506. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +0 -110
  507. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +0 -1
  508. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +0 -63
  509. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +0 -1
  510. package/lib-commonjs/components/DonutChart/DonutChart.js +0 -356
  511. package/lib-commonjs/components/DonutChart/DonutChart.js.map +0 -1
  512. package/lib-commonjs/components/DonutChart/DonutChart.types.js +0 -7
  513. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +0 -1
  514. package/lib-commonjs/components/DonutChart/Pie/Pie.js +0 -79
  515. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +0 -1
  516. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +0 -4
  517. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +0 -1
  518. package/lib-commonjs/components/DonutChart/Pie/index.js +0 -7
  519. package/lib-commonjs/components/DonutChart/Pie/index.js.map +0 -1
  520. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +0 -55
  521. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +0 -1
  522. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js +0 -44
  523. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +0 -1
  524. package/lib-commonjs/components/DonutChart/index.js +0 -8
  525. package/lib-commonjs/components/DonutChart/index.js.map +0 -1
  526. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +0 -145
  527. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +0 -1
  528. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +0 -76
  529. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +0 -1
  530. package/lib-commonjs/components/FunnelChart/FunnelChart.js +0 -412
  531. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +0 -1
  532. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js +0 -7
  533. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +0 -1
  534. package/lib-commonjs/components/FunnelChart/funnelGeometry.js +0 -246
  535. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +0 -1
  536. package/lib-commonjs/components/FunnelChart/index.js +0 -7
  537. package/lib-commonjs/components/FunnelChart/index.js.map +0 -1
  538. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +0 -118
  539. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +0 -1
  540. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +0 -79
  541. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +0 -1
  542. package/lib-commonjs/components/GanttChart/GanttChart.js +0 -546
  543. package/lib-commonjs/components/GanttChart/GanttChart.js.map +0 -1
  544. package/lib-commonjs/components/GanttChart/GanttChart.types.js +0 -7
  545. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +0 -1
  546. package/lib-commonjs/components/GanttChart/index.js +0 -7
  547. package/lib-commonjs/components/GanttChart/index.js.map +0 -1
  548. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +0 -42
  549. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +0 -1
  550. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +0 -42
  551. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +0 -1
  552. package/lib-commonjs/components/GaugeChart/GaugeChart.js +0 -597
  553. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +0 -1
  554. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +0 -7
  555. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +0 -1
  556. package/lib-commonjs/components/GaugeChart/index.js +0 -8
  557. package/lib-commonjs/components/GaugeChart/index.js.map +0 -1
  558. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +0 -281
  559. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +0 -1
  560. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +0 -167
  561. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +0 -1
  562. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +0 -818
  563. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +0 -1
  564. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +0 -7
  565. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +0 -1
  566. package/lib-commonjs/components/GroupedVerticalBarChart/index.js +0 -8
  567. package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +0 -1
  568. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -116
  569. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +0 -1
  570. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +0 -56
  571. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +0 -1
  572. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +0 -688
  573. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +0 -1
  574. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +0 -7
  575. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +0 -1
  576. package/lib-commonjs/components/HeatMapChart/index.js +0 -8
  577. package/lib-commonjs/components/HeatMapChart/index.js.map +0 -1
  578. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +0 -71
  579. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +0 -1
  580. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +0 -60
  581. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +0 -1
  582. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +0 -417
  583. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +0 -1
  584. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +0 -17
  585. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +0 -1
  586. package/lib-commonjs/components/HorizontalBarChart/index.js +0 -8
  587. package/lib-commonjs/components/HorizontalBarChart/index.js.map +0 -1
  588. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +0 -264
  589. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +0 -1
  590. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +0 -139
  591. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +0 -1
  592. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +0 -726
  593. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +0 -1
  594. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +0 -7
  595. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +0 -1
  596. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +0 -8
  597. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +0 -1
  598. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +0 -86
  599. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +0 -1
  600. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +0 -70
  601. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +0 -1
  602. package/lib-commonjs/components/Legends/Legends.js +0 -333
  603. package/lib-commonjs/components/Legends/Legends.js.map +0 -1
  604. package/lib-commonjs/components/Legends/Legends.types.js +0 -6
  605. package/lib-commonjs/components/Legends/Legends.types.js.map +0 -1
  606. package/lib-commonjs/components/Legends/OverflowMenu.js +0 -44
  607. package/lib-commonjs/components/Legends/OverflowMenu.js.map +0 -1
  608. package/lib-commonjs/components/Legends/index.js +0 -8
  609. package/lib-commonjs/components/Legends/index.js.map +0 -1
  610. package/lib-commonjs/components/Legends/shape.js +0 -47
  611. package/lib-commonjs/components/Legends/shape.js.map +0 -1
  612. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +0 -456
  613. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +0 -1
  614. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +0 -178
  615. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +0 -1
  616. package/lib-commonjs/components/LineChart/LineChart.js +0 -1337
  617. package/lib-commonjs/components/LineChart/LineChart.js.map +0 -1
  618. package/lib-commonjs/components/LineChart/LineChart.types.js +0 -6
  619. package/lib-commonjs/components/LineChart/LineChart.types.js.map +0 -1
  620. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +0 -129
  621. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +0 -1
  622. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +0 -70
  623. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +0 -1
  624. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +0 -53
  625. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +0 -1
  626. package/lib-commonjs/components/LineChart/index.js +0 -9
  627. package/lib-commonjs/components/LineChart/index.js.map +0 -1
  628. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -132
  629. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +0 -1
  630. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +0 -63
  631. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +0 -1
  632. package/lib-commonjs/components/PolarChart/PolarChart.js +0 -587
  633. package/lib-commonjs/components/PolarChart/PolarChart.js.map +0 -1
  634. package/lib-commonjs/components/PolarChart/PolarChart.types.js +0 -7
  635. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +0 -1
  636. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +0 -204
  637. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +0 -1
  638. package/lib-commonjs/components/PolarChart/index.js +0 -7
  639. package/lib-commonjs/components/PolarChart/index.js.map +0 -1
  640. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +0 -107
  641. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +0 -1
  642. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +0 -75
  643. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +0 -1
  644. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +0 -107
  645. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +0 -1
  646. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +0 -7
  647. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +0 -1
  648. package/lib-commonjs/components/ResponsiveContainer/index.js +0 -8
  649. package/lib-commonjs/components/ResponsiveContainer/index.js.map +0 -1
  650. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +0 -50
  651. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +0 -1
  652. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +0 -47
  653. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +0 -1
  654. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js +0 -28
  655. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +0 -1
  656. package/lib-commonjs/components/SankeyChart/SankeyChart.js +0 -1042
  657. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +0 -1
  658. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +0 -6
  659. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +0 -1
  660. package/lib-commonjs/components/SankeyChart/index.js +0 -8
  661. package/lib-commonjs/components/SankeyChart/index.js.map +0 -1
  662. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -202
  663. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +0 -1
  664. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +0 -97
  665. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +0 -1
  666. package/lib-commonjs/components/ScatterChart/ScatterChart.js +0 -550
  667. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +0 -1
  668. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +0 -7
  669. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +0 -1
  670. package/lib-commonjs/components/ScatterChart/index.js +0 -8
  671. package/lib-commonjs/components/ScatterChart/index.js.map +0 -1
  672. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -120
  673. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +0 -1
  674. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +0 -55
  675. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +0 -1
  676. package/lib-commonjs/components/Sparkline/Sparkline.js +0 -129
  677. package/lib-commonjs/components/Sparkline/Sparkline.js.map +0 -1
  678. package/lib-commonjs/components/Sparkline/Sparkline.types.js +0 -7
  679. package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +0 -1
  680. package/lib-commonjs/components/Sparkline/index.js +0 -8
  681. package/lib-commonjs/components/Sparkline/index.js.map +0 -1
  682. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +0 -57
  683. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +0 -1
  684. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js +0 -45
  685. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js.map +0 -1
  686. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js +0 -274
  687. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +0 -1
  688. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +0 -35
  689. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +0 -1
  690. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +0 -412
  691. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +0 -1
  692. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +0 -533
  693. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +0 -1
  694. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +0 -3214
  695. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +0 -1
  696. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js +0 -31
  697. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js.map +0 -1
  698. package/lib-commonjs/components/VegaDeclarativeChart/index.js +0 -6
  699. package/lib-commonjs/components/VegaDeclarativeChart/index.js.map +0 -1
  700. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +0 -932
  701. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +0 -1
  702. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +0 -7
  703. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +0 -1
  704. package/lib-commonjs/components/VerticalBarChart/index.js +0 -8
  705. package/lib-commonjs/components/VerticalBarChart/index.js.map +0 -1
  706. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -128
  707. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +0 -1
  708. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +0 -64
  709. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +0 -1
  710. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +0 -1088
  711. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +0 -1
  712. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +0 -7
  713. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +0 -1
  714. package/lib-commonjs/components/VerticalStackedBarChart/index.js +0 -8
  715. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +0 -1
  716. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -116
  717. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +0 -1
  718. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +0 -56
  719. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +0 -1
  720. package/lib-commonjs/index.js +0 -31
  721. package/lib-commonjs/index.js.map +0 -1
  722. package/lib-commonjs/types/ChartAnnotation.js +0 -4
  723. package/lib-commonjs/types/ChartAnnotation.js.map +0 -1
  724. package/lib-commonjs/types/DataPoint.js +0 -6
  725. package/lib-commonjs/types/DataPoint.js.map +0 -1
  726. package/lib-commonjs/types/EventAnnotation.js +0 -4
  727. package/lib-commonjs/types/EventAnnotation.js.map +0 -1
  728. package/lib-commonjs/types/LegendDataItem.js +0 -4
  729. package/lib-commonjs/types/LegendDataItem.js.map +0 -1
  730. package/lib-commonjs/types/index.js +0 -8
  731. package/lib-commonjs/types/index.js.map +0 -1
  732. package/lib-commonjs/utilities/ChartTitle.js +0 -53
  733. package/lib-commonjs/utilities/ChartTitle.js.map +0 -1
  734. package/lib-commonjs/utilities/Common.styles.js +0 -138
  735. package/lib-commonjs/utilities/Common.styles.js.map +0 -1
  736. package/lib-commonjs/utilities/Common.styles.raw.js +0 -138
  737. package/lib-commonjs/utilities/Common.styles.raw.js.map +0 -1
  738. package/lib-commonjs/utilities/FocusableTooltipText.js +0 -75
  739. package/lib-commonjs/utilities/FocusableTooltipText.js.map +0 -1
  740. package/lib-commonjs/utilities/KeyCodes.js +0 -21
  741. package/lib-commonjs/utilities/KeyCodes.js.map +0 -1
  742. package/lib-commonjs/utilities/SVGTooltipText.js +0 -189
  743. package/lib-commonjs/utilities/SVGTooltipText.js.map +0 -1
  744. package/lib-commonjs/utilities/async-utils.js +0 -382
  745. package/lib-commonjs/utilities/async-utils.js.map +0 -1
  746. package/lib-commonjs/utilities/colors.js +0 -311
  747. package/lib-commonjs/utilities/colors.js.map +0 -1
  748. package/lib-commonjs/utilities/getWindow.js +0 -28
  749. package/lib-commonjs/utilities/getWindow.js.map +0 -1
  750. package/lib-commonjs/utilities/hooks.js +0 -45
  751. package/lib-commonjs/utilities/hooks.js.map +0 -1
  752. package/lib-commonjs/utilities/image-export-utils.js +0 -423
  753. package/lib-commonjs/utilities/image-export-utils.js.map +0 -1
  754. package/lib-commonjs/utilities/index.js +0 -10
  755. package/lib-commonjs/utilities/index.js.map +0 -1
  756. package/lib-commonjs/utilities/overflow-utils.js +0 -36
  757. package/lib-commonjs/utilities/overflow-utils.js.map +0 -1
  758. package/lib-commonjs/utilities/scatterpolar-utils.js +0 -67
  759. package/lib-commonjs/utilities/scatterpolar-utils.js.map +0 -1
  760. package/lib-commonjs/utilities/string.js +0 -29
  761. package/lib-commonjs/utilities/string.js.map +0 -1
  762. package/lib-commonjs/utilities/test-data.js +0 -628
  763. package/lib-commonjs/utilities/test-data.js.map +0 -1
  764. package/lib-commonjs/utilities/utilities.js +0 -2016
  765. package/lib-commonjs/utilities/utilities.js.map +0 -1
  766. package/lib-commonjs/utilities/vbc-utils.js +0 -72
  767. package/lib-commonjs/utilities/vbc-utils.js.map +0 -1
@@ -1,3577 +0,0 @@
1
- 'use client';
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- function _export(target, all) {
7
- for(var name in all)Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- DEFAULT_POLAR_SUBPLOT: function() {
14
- return DEFAULT_POLAR_SUBPLOT;
15
- },
16
- NON_PLOT_KEY_PREFIX: function() {
17
- return NON_PLOT_KEY_PREFIX;
18
- },
19
- SINGLE_REPEAT: function() {
20
- return SINGLE_REPEAT;
21
- },
22
- _getGaugeAxisColor: function() {
23
- return _getGaugeAxisColor;
24
- },
25
- correctYearMonth: function() {
26
- return correctYearMonth;
27
- },
28
- findArrayAttributes: function() {
29
- return findArrayAttributes;
30
- },
31
- getAllupLegendsProps: function() {
32
- return getAllupLegendsProps;
33
- },
34
- getGridProperties: function() {
35
- return getGridProperties;
36
- },
37
- getNumberAtIndexOrDefault: function() {
38
- return getNumberAtIndexOrDefault;
39
- },
40
- getValidXYRanges: function() {
41
- return getValidXYRanges;
42
- },
43
- isNonPlotType: function() {
44
- return isNonPlotType;
45
- },
46
- normalizeObjectArrayForGVBC: function() {
47
- return normalizeObjectArrayForGVBC;
48
- },
49
- resolveXAxisPoint: function() {
50
- return resolveXAxisPoint;
51
- },
52
- transformPlotlyJsonToAnnotationChartProps: function() {
53
- return transformPlotlyJsonToAnnotationChartProps;
54
- },
55
- transformPlotlyJsonToAreaChartProps: function() {
56
- return transformPlotlyJsonToAreaChartProps;
57
- },
58
- transformPlotlyJsonToChartTableProps: function() {
59
- return transformPlotlyJsonToChartTableProps;
60
- },
61
- transformPlotlyJsonToDonutProps: function() {
62
- return transformPlotlyJsonToDonutProps;
63
- },
64
- transformPlotlyJsonToFunnelChartProps: function() {
65
- return transformPlotlyJsonToFunnelChartProps;
66
- },
67
- transformPlotlyJsonToGVBCProps: function() {
68
- return transformPlotlyJsonToGVBCProps;
69
- },
70
- transformPlotlyJsonToGanttChartProps: function() {
71
- return transformPlotlyJsonToGanttChartProps;
72
- },
73
- transformPlotlyJsonToGaugeProps: function() {
74
- return transformPlotlyJsonToGaugeProps;
75
- },
76
- transformPlotlyJsonToHeatmapProps: function() {
77
- return transformPlotlyJsonToHeatmapProps;
78
- },
79
- transformPlotlyJsonToHorizontalBarWithAxisProps: function() {
80
- return transformPlotlyJsonToHorizontalBarWithAxisProps;
81
- },
82
- transformPlotlyJsonToLineChartProps: function() {
83
- return transformPlotlyJsonToLineChartProps;
84
- },
85
- transformPlotlyJsonToPolarChartProps: function() {
86
- return transformPlotlyJsonToPolarChartProps;
87
- },
88
- transformPlotlyJsonToSankeyProps: function() {
89
- return transformPlotlyJsonToSankeyProps;
90
- },
91
- transformPlotlyJsonToScatterChartProps: function() {
92
- return transformPlotlyJsonToScatterChartProps;
93
- },
94
- transformPlotlyJsonToVBCProps: function() {
95
- return transformPlotlyJsonToVBCProps;
96
- },
97
- transformPlotlyJsonToVSBCProps: function() {
98
- return transformPlotlyJsonToVSBCProps;
99
- }
100
- });
101
- const _d3array = require("d3-array");
102
- const _d3scale = require("d3-scale");
103
- const _d3format = require("d3-format");
104
- const _colors = require("../../utilities/colors");
105
- const _utilities = require("../../utilities/utilities");
106
- const _chartutilities = require("@fluentui/chart-utilities");
107
- const _d3shape = require("d3-shape");
108
- const _PlotlyColorAdapter = require("./PlotlyColorAdapter");
109
- const _d3color = require("d3-color");
110
- const NON_PLOT_KEY_PREFIX = 'nonplot_';
111
- const SINGLE_REPEAT = 'repeat(1, 1fr)';
112
- const dashOptions = {
113
- dot: {
114
- strokeDasharray: '1, 5',
115
- strokeLinecap: 'round',
116
- strokeWidth: '2',
117
- lineBorderWidth: '4'
118
- },
119
- dash: {
120
- strokeDasharray: '5, 5',
121
- strokeLinecap: 'butt',
122
- strokeWidth: '2',
123
- lineBorderWidth: '4'
124
- },
125
- longdash: {
126
- strokeDasharray: '10, 5',
127
- strokeLinecap: 'butt',
128
- strokeWidth: '2',
129
- lineBorderWidth: '4'
130
- },
131
- dashdot: {
132
- strokeDasharray: '5, 5, 1, 5',
133
- strokeLinecap: 'butt',
134
- strokeWidth: '2',
135
- lineBorderWidth: '4'
136
- },
137
- longdashdot: {
138
- strokeDasharray: '10, 5, 1, 5',
139
- strokeLinecap: 'butt',
140
- strokeWidth: '2',
141
- lineBorderWidth: '4'
142
- },
143
- solid: {
144
- strokeDasharray: '0',
145
- strokeLinecap: 'butt',
146
- strokeWidth: '2',
147
- lineBorderWidth: '4'
148
- }
149
- };
150
- function getTitles(layout) {
151
- var _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
152
- const titleObj = layout === null || layout === void 0 ? void 0 : layout.title;
153
- var _titleObj_text;
154
- const chartTitle = typeof titleObj === 'string' ? titleObj : (_titleObj_text = titleObj === null || titleObj === void 0 ? void 0 : titleObj.text) !== null && _titleObj_text !== void 0 ? _titleObj_text : '';
155
- const titleFont = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.font : undefined;
156
- const titleXAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.xanchor : undefined;
157
- const titleYAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.yanchor : undefined;
158
- const titlePad = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.pad : undefined;
159
- const titleStyles = {
160
- ...titleFont ? {
161
- titleFont
162
- } : {},
163
- ...titleXAnchor ? {
164
- titleXAnchor
165
- } : {},
166
- ...titleYAnchor ? {
167
- titleYAnchor
168
- } : {},
169
- ...titlePad ? {
170
- titlePad
171
- } : {}
172
- };
173
- var _layout_xaxis_title_text, _layout_yaxis_title_text;
174
- const titles = {
175
- chartTitle,
176
- ...Object.keys(titleStyles).length > 0 ? {
177
- titleStyles
178
- } : {},
179
- 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 : '',
180
- 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 : '',
181
- xAxisAnnotation: chartTitle
182
- };
183
- return titles;
184
- }
185
- const getXAxisTickFormat = (series, layout)=>{
186
- const xAxis = getXAxisProperties(series, layout);
187
- if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
188
- return {
189
- tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat
190
- };
191
- }
192
- return {};
193
- };
194
- const getYAxisTickFormat = (series, layout)=>{
195
- const yAxis = getYAxisProperties(series, layout);
196
- if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
197
- return {
198
- yAxisTickFormat: (0, _d3format.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat)
199
- };
200
- }
201
- return {};
202
- };
203
- const getYMinMaxValues = (series, layout)=>{
204
- var _getYAxisProperties;
205
- const range = (_getYAxisProperties = getYAxisProperties(series, layout)) === null || _getYAxisProperties === void 0 ? void 0 : _getYAxisProperties.range;
206
- if (range && range.length === 2) {
207
- return {
208
- yMinValue: range[0],
209
- yMaxValue: range[1]
210
- };
211
- }
212
- return {};
213
- };
214
- const getXMinMaxValues = (series, layout)=>{
215
- var _getXAxisProperties;
216
- const range = (_getXAxisProperties = getXAxisProperties(series, layout)) === null || _getXAxisProperties === void 0 ? void 0 : _getXAxisProperties.range;
217
- if (range && range.length === 2) {
218
- return {
219
- xMinValue: range[0],
220
- xMaxValue: range[1],
221
- showRoundOffXTickValues: false
222
- };
223
- }
224
- return {};
225
- };
226
- const getYAxisProperties = (series, layout)=>{
227
- return layout === null || layout === void 0 ? void 0 : layout.yaxis;
228
- };
229
- const getXAxisProperties = (series, layout)=>{
230
- return layout === null || layout === void 0 ? void 0 : layout.xaxis;
231
- };
232
- const getFormattedCalloutYData = (yVal, yAxisFormat)=>{
233
- if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
234
- return yAxisFormat.yAxisTickFormat(yVal);
235
- }
236
- return (0, _chartutilities.formatToLocaleString)(yVal);
237
- };
238
- const correctYearMonth = (xValues)=>{
239
- const presentYear = new Date().getFullYear();
240
- if (xValues.length > 0 && Array.isArray(xValues[0])) {
241
- throw new Error('updateXValues:: 2D array not supported');
242
- }
243
- const dates = xValues.map((possiblyMonthValue)=>{
244
- const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;
245
- return (0, _chartutilities.isDate)(parsedDate) ? new Date(parsedDate) : null;
246
- });
247
- const filteredDateIndexPairs = dates.map((date, index)=>[
248
- date,
249
- index
250
- ]).filter(([date])=>date !== null);
251
- for(let i = filteredDateIndexPairs.length - 1; i > 0; i--){
252
- const currentDate = filteredDateIndexPairs[i][0];
253
- const previousDate = filteredDateIndexPairs[i - 1][0];
254
- const currentMonth = currentDate.getMonth();
255
- const previousMonth = previousDate.getMonth();
256
- const currentYear = currentDate.getFullYear();
257
- const previousYear = previousDate.getFullYear();
258
- if (previousMonth >= currentMonth) {
259
- filteredDateIndexPairs[i - 1][0].setFullYear(currentYear - 1);
260
- } else if (previousYear > currentYear) {
261
- filteredDateIndexPairs[i - 1][0].setFullYear(currentYear);
262
- }
263
- dates[filteredDateIndexPairs[i - 1][1]] = filteredDateIndexPairs[i - 1][0];
264
- }
265
- xValues = xValues.map((month, index)=>{
266
- if (dates[index] === null) {
267
- return null;
268
- }
269
- return `${month} 01, ${dates[index].getFullYear()}`;
270
- });
271
- return xValues;
272
- };
273
- const usesSecondaryYScale = (series, layout)=>{
274
- var _layout_yaxis2, _layout_yaxis21;
275
- return series.yaxis === 'y2' && ((layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.anchor) === 'x' || (layout === null || layout === void 0 ? void 0 : (_layout_yaxis21 = layout.yaxis2) === null || _layout_yaxis21 === void 0 ? void 0 : _layout_yaxis21.side) === 'right');
276
- };
277
- const getSecondaryYAxisValues = (data, layout)=>{
278
- var _layout_yaxis2, _layout_yaxis21, _layout_yaxis2_title, _layout_yaxis22;
279
- let containsSecondaryYAxis = false;
280
- let yMinValue;
281
- let yMaxValue;
282
- let allLineSeries = true;
283
- data.forEach((series)=>{
284
- if (usesSecondaryYScale(series, layout)) {
285
- containsSecondaryYAxis = true;
286
- const yValues = series.y;
287
- if (yValues) {
288
- yMinValue = Math.min(...yValues);
289
- yMaxValue = Math.max(...yValues);
290
- }
291
- if (series.type !== 'scatter' || (0, _chartutilities.isScatterAreaChart)(series)) {
292
- allLineSeries = false;
293
- }
294
- }
295
- });
296
- if (!containsSecondaryYAxis) {
297
- return {};
298
- }
299
- if (!allLineSeries) {
300
- if (typeof yMinValue === 'number') {
301
- yMinValue = Math.min(yMinValue, 0);
302
- }
303
- if (typeof yMaxValue === 'number') {
304
- yMaxValue = Math.max(yMaxValue, 0);
305
- }
306
- }
307
- if (layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.range) {
308
- yMinValue = layout.yaxis2.range[0];
309
- yMaxValue = layout.yaxis2.range[1];
310
- }
311
- return {
312
- secondaryYAxistitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis21 = layout.yaxis2) === null || _layout_yaxis21 === void 0 ? void 0 : _layout_yaxis21.title) === 'string' ? layout.yaxis2.title : typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis22 = layout.yaxis2) === null || _layout_yaxis22 === void 0 ? void 0 : (_layout_yaxis2_title = _layout_yaxis22.title) === null || _layout_yaxis2_title === void 0 ? void 0 : _layout_yaxis2_title.text) === 'string' ? layout.yaxis2.title.text : undefined,
313
- secondaryYScaleOptions: {
314
- yMinValue,
315
- yMaxValue
316
- }
317
- };
318
- };
319
- const _getGaugeAxisColor = (colorway, colorwayType, color, colorMap, isDarkTheme)=>{
320
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)(colorway, colorwayType, color, colorMap, isDarkTheme);
321
- return (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, '', colorMap, colorway, isDarkTheme);
322
- };
323
- const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
324
- if (x === null || x === undefined) {
325
- return '';
326
- }
327
- if (isXYearCategory) {
328
- return x.toString();
329
- }
330
- if (isXString) {
331
- if (isXDate) {
332
- const date = new Date(x);
333
- return date;
334
- }
335
- if (isXNumber) {
336
- return parseFloat(x);
337
- }
338
- return x;
339
- }
340
- return x;
341
- };
342
- /**
343
- * Formats text values according to the texttemplate specification
344
- * Supports D3 format specifiers within %{text:format} patterns
345
- * @param textValue The raw text value to format
346
- * @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
347
- * @param index Optional index for array-based templates
348
- * @returns Formatted text string
349
- *
350
- * Examples:
351
- * - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
352
- * - "%{text:.2%}" → Formats as percentage with 2 decimal places
353
- * - "%{text:,.0f}" → Formats with thousands separator and no decimals
354
- * - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
355
- */ const formatTextWithTemplate = (textValue, textTemplate, index)=>{
356
- if (!textTemplate) {
357
- return String(textValue);
358
- }
359
- const numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
360
- if (isNaN(numVal)) {
361
- return String(textValue);
362
- }
363
- const template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
364
- // Match Plotly's texttemplate pattern: %{text:format} or %{text}
365
- // Can be followed by any literal text like %, $, etc.
366
- const plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
367
- const match = template.match(plotlyPattern);
368
- if (match) {
369
- const formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
370
- const suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
371
- // If no format specifier is provided (e.g., %{text}%), try to infer from suffix
372
- if (!formatSpec) {
373
- // Check if suffix starts with % - assume simple percentage with 1 decimal
374
- if (suffix.startsWith('%')) {
375
- return `${numVal.toFixed(1)}${suffix}`;
376
- }
377
- // No format specifier, just return the number with the suffix
378
- return `${numVal}${suffix}`;
379
- }
380
- try {
381
- // Use D3 format function to apply the format specifier
382
- const formatter = (0, _d3format.format)(formatSpec);
383
- const formattedValue = formatter(numVal);
384
- return `${formattedValue}${suffix}`;
385
- } catch (error) {
386
- // Try to extract precision for basic fallback
387
- const precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
388
- const precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
389
- // Check if it's a percentage format
390
- if (formatSpec.includes('%')) {
391
- return `${(numVal * 100).toFixed(precision)}%${suffix}`;
392
- }
393
- return `${numVal.toFixed(precision)}${suffix}`;
394
- }
395
- }
396
- return String(textValue);
397
- };
398
- /**
399
- * Extracts unique X-axis categories from Plotly data traces
400
- * @param data Array of Plotly data traces
401
- * @returns Array of unique x values
402
- */ const extractXCategories = (data)=>{
403
- return Array.from(new Set((data !== null && data !== void 0 ? data : []).flatMap((trace)=>{
404
- const xData = trace.x;
405
- if (!xData) {
406
- return [];
407
- }
408
- if (Array.isArray(xData)) {
409
- return xData.flat().map((x)=>{
410
- return x;
411
- });
412
- }
413
- return [];
414
- }).filter((x)=>x !== undefined && x !== null)));
415
- };
416
- /**
417
- * Checks if a key should be ignored during normalization
418
- * @param key The key to check
419
- * @returns true if the key should be ignored
420
- */ const shouldIgnoreKey = (key)=>{
421
- const lowerKey = key.toLowerCase();
422
- if (lowerKey.includes('style') || lowerKey === 'style') {
423
- return true;
424
- }
425
- // Use regex to match common CSS property patterns
426
- // (color, fill, stroke, border, background, font, shadow, outline, etc.)
427
- const cssKeyRegex = new RegExp('^(color|fill|stroke|border|background|font|shadow|outline|margin|padding|gap|align|justify|display|flex|grid|' + 'text|line|letter|word|vertical|horizontal|overflow|position|top|right|bottom|left|zindex|z-index|opacity|' + 'filter|clip|cursor|resize|transition|animation|transform|box|column|row|direction|visibility|' + 'content|width|height|aspect|image|user|pointer|caret|scroll|%)|(-webkit-|-moz-|-ms-|-o-)', 'i');
428
- if (cssKeyRegex.test(lowerKey)) {
429
- return true;
430
- }
431
- return false;
432
- };
433
- /**
434
- * Flattens a nested object into a single level object with dot notation keys
435
- * @param obj Object to flatten
436
- * @param prefix Optional prefix for keys
437
- * @returns Flattened object
438
- */ const flattenObject = (obj, prefix = '')=>{
439
- const flattened = {};
440
- for(const key in obj){
441
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
442
- const newKey = prefix ? `${prefix}.${key}` : key;
443
- const value = obj[key];
444
- if (typeof value === 'object' && value !== null && !Array.isArray(value) && !(value instanceof Date)) {
445
- // Recursively flatten nested objects
446
- Object.assign(flattened, flattenObject(value, newKey));
447
- } else {
448
- flattened[newKey] = value;
449
- }
450
- }
451
- }
452
- return flattened;
453
- };
454
- const encodeHtmlEntities = (value)=>value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
455
- const toFiniteNumber = (value)=>{
456
- if (value === undefined || value === null) {
457
- return undefined;
458
- }
459
- const numeric = typeof value === 'number' ? value : Number(value);
460
- return Number.isFinite(numeric) ? numeric : undefined;
461
- };
462
- /**
463
- * Parses Plotly axis references (e.g. `x`, `x2`, `xaxis2`, `paper`, `pixel`, `x domain`) into a ref type + axis id.
464
- */ const parseAxisRef = (ref, axis)=>{
465
- if (!ref) {
466
- return {
467
- refType: 'axis',
468
- axisId: 1
469
- };
470
- }
471
- const normalized = ref.toLowerCase().trim();
472
- if (normalized === 'pixel') {
473
- return {
474
- refType: 'pixel',
475
- axisId: 1
476
- };
477
- }
478
- if (normalized === 'paper') {
479
- return {
480
- refType: 'relative',
481
- axisId: 1
482
- };
483
- }
484
- if (normalized.endsWith(' domain')) {
485
- return normalized.startsWith(axis) ? {
486
- refType: 'relative',
487
- axisId: 1
488
- } : {
489
- refType: undefined,
490
- axisId: 1
491
- };
492
- }
493
- const match = normalized.match(/^([xy])(axis)?(\d*)$/);
494
- if (!match || match[1] !== axis) {
495
- return {
496
- refType: undefined,
497
- axisId: 1
498
- };
499
- }
500
- const suffix = match[3];
501
- if (!suffix || suffix === '1') {
502
- return {
503
- refType: 'axis',
504
- axisId: 1
505
- };
506
- }
507
- const parsed = Number(suffix);
508
- return {
509
- refType: 'axis',
510
- axisId: Number.isFinite(parsed) && parsed >= 1 ? parsed : 1
511
- };
512
- };
513
- /**
514
- * Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
515
- */ const transformRelativeYForChart = (value)=>{
516
- if (value === undefined) {
517
- return undefined;
518
- }
519
- if (!Number.isFinite(value)) {
520
- return undefined;
521
- }
522
- return 1 - value;
523
- };
524
- const mapHorizontalAlign = (anchor)=>{
525
- switch((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()){
526
- case 'left':
527
- return 'start';
528
- case 'center':
529
- return 'center';
530
- case 'right':
531
- return 'end';
532
- default:
533
- return undefined;
534
- }
535
- };
536
- const mapVerticalAlign = (anchor)=>{
537
- switch((anchor !== null && anchor !== void 0 ? anchor : '').toLowerCase()){
538
- case 'top':
539
- return 'top';
540
- case 'middle':
541
- return 'middle';
542
- case 'bottom':
543
- return 'bottom';
544
- default:
545
- return undefined;
546
- }
547
- };
548
- const appendPx = (value)=>{
549
- if (value === undefined || value === null) {
550
- return undefined;
551
- }
552
- if (typeof value === 'string') {
553
- return value;
554
- }
555
- if (typeof value === 'number' && Number.isFinite(value)) {
556
- return `${value}px`;
557
- }
558
- return undefined;
559
- };
560
- /**
561
- * Maps Plotly's axis reference string to one of our coordinate interpretation modes (axis, relative, or pixel).
562
- */ const resolveRefType = (ref, axis)=>{
563
- if (!ref) {
564
- return 'axis';
565
- }
566
- const parsed = parseAxisRef(ref, axis);
567
- if (parsed.refType !== 'axis') {
568
- return parsed.refType;
569
- }
570
- const normalized = (ref !== null && ref !== void 0 ? ref : '').toLowerCase().trim();
571
- const match = normalized.match(/^([xy])(\d*)$/);
572
- return match && match[1] === axis ? 'axis' : undefined;
573
- };
574
- /**
575
- * Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
576
- */ const getAxisLayoutByRef = (layout, ref, axis)=>{
577
- if (!layout) {
578
- return undefined;
579
- }
580
- const defaultAxisKey = `${axis}axis`;
581
- const { refType, axisId } = parseAxisRef(ref, axis);
582
- if (refType !== 'axis' || axisId === 1) {
583
- return layout[defaultAxisKey];
584
- }
585
- const axisKey = `${axis}axis${axisId}`;
586
- return layout[axisKey];
587
- };
588
- const convertAnnotationDataValue = (value, axisType)=>{
589
- if (value === undefined || value === null) {
590
- return undefined;
591
- }
592
- if (axisType === 'date') {
593
- const dateValue = value instanceof Date ? value : new Date(value);
594
- return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
595
- }
596
- if (axisType === 'linear' || axisType === 'log') {
597
- if (typeof value === 'number') {
598
- return Number.isFinite(value) ? value : undefined;
599
- }
600
- const numeric = Number(value);
601
- return Number.isFinite(numeric) ? numeric : undefined;
602
- }
603
- // For category-like axes, preserve raw strings (and avoid date parsing heuristics).
604
- if (value instanceof Date) {
605
- return value;
606
- }
607
- if (typeof value === 'number' || typeof value === 'string') {
608
- return value;
609
- }
610
- return undefined;
611
- };
612
- const createAnnotationId = (text, index)=>{
613
- const normalized = text.replace(/\s+/g, ' ').trim();
614
- if (normalized) {
615
- const slug = normalized.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 32);
616
- if (slug) {
617
- return `annotation-${index}-${slug}`;
618
- }
619
- }
620
- return `annotation-${index}`;
621
- };
622
- const DEFAULT_ARROW_OFFSET = -40;
623
- const mapArrowsideToArrow = (annotation)=>{
624
- let includeStart = false;
625
- let includeEnd = false;
626
- const arrowSide = typeof (annotation === null || annotation === void 0 ? void 0 : annotation.arrowside) === 'string' ? annotation === null || annotation === void 0 ? void 0 : annotation.arrowside.toLowerCase() : undefined;
627
- if (arrowSide) {
628
- includeStart = arrowSide.includes('start');
629
- includeEnd = arrowSide.includes('end');
630
- }
631
- const endHead = toFiniteNumber(annotation === null || annotation === void 0 ? void 0 : annotation.arrowhead);
632
- const startHead = toFiniteNumber(annotation.startarrowhead);
633
- if (endHead !== undefined && endHead > 0) {
634
- includeEnd = true;
635
- }
636
- if (startHead !== undefined && startHead > 0) {
637
- includeStart = true;
638
- }
639
- if (includeStart && includeEnd) {
640
- return 'both';
641
- }
642
- if (includeStart) {
643
- return 'start';
644
- }
645
- if (includeEnd) {
646
- return 'end';
647
- }
648
- return 'none';
649
- };
650
- const mapArrowDashToPattern = (value)=>{
651
- if (!value) {
652
- return undefined;
653
- }
654
- const normalized = value.trim().toLowerCase();
655
- switch(normalized){
656
- case 'solid':
657
- return undefined;
658
- case 'dot':
659
- return '1, 5';
660
- case 'dash':
661
- return '5, 5';
662
- case 'longdash':
663
- return '10, 5';
664
- case 'dashdot':
665
- return '5, 5, 1, 5';
666
- case 'longdashdot':
667
- return '10, 5, 1, 5';
668
- default:
669
- if (/^\d+(\s|,)*\d*$/.test(normalized.replace(/\s+/g, ' '))) {
670
- return normalized.replace(/\s+/g, ' ');
671
- }
672
- return value;
673
- }
674
- };
675
- const mapRefTypeToCoordinateType = (refType)=>{
676
- return refType === 'axis' ? 'data' : refType;
677
- };
678
- const normalizeCoordinateValueForType = (coordinateType, value)=>{
679
- if (coordinateType === 'data') {
680
- return value;
681
- }
682
- return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
683
- };
684
- const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
685
- if (refType === 'axis') {
686
- const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
687
- const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
688
- const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
689
- var _axisLayout_type;
690
- const axisType = (_axisLayout_type = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) !== null && _axisLayout_type !== void 0 ? _axisLayout_type : 'category';
691
- return convertAnnotationDataValue(rawValue, axisType);
692
- }
693
- const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
694
- if (numericValue === undefined) {
695
- return undefined;
696
- }
697
- if (refType === 'relative') {
698
- return axis === 'y' ? transformRelativeYForChart(numericValue) : numericValue;
699
- }
700
- return numericValue;
701
- };
702
- /**
703
- * Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
704
- * layout alignment, styling, and connector metadata while skipping unsupported configurations.
705
- */ const convertPlotlyAnnotation = (annotation, layout, index)=>{
706
- if (!annotation || annotation.visible === false) {
707
- return undefined;
708
- }
709
- const xRefType = resolveRefType(annotation.xref, 'x');
710
- const yRefType = resolveRefType(annotation.yref, 'y');
711
- if (!xRefType || !yRefType) {
712
- return undefined;
713
- }
714
- const xValue = getAnnotationCoordinateValue('x', xRefType, annotation, layout);
715
- const yValue = getAnnotationCoordinateValue('y', yRefType, annotation, layout);
716
- if (xValue === undefined || yValue === undefined) {
717
- return undefined;
718
- }
719
- const xCoordinateType = mapRefTypeToCoordinateType(xRefType);
720
- const yCoordinateType = mapRefTypeToCoordinateType(yRefType);
721
- const normalizedX = normalizeCoordinateValueForType(xCoordinateType, xValue);
722
- const normalizedY = normalizeCoordinateValueForType(yCoordinateType, yValue);
723
- if (normalizedX === undefined || normalizedY === undefined) {
724
- return undefined;
725
- }
726
- const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
727
- const yAxisProps = yCoordinateType === 'data' && yRefNormalized === 'y2' ? {
728
- yAxis: 'secondary'
729
- } : undefined;
730
- let coordinates;
731
- if (xCoordinateType === 'data' && yCoordinateType === 'data') {
732
- coordinates = {
733
- type: 'data',
734
- x: normalizedX,
735
- y: normalizedY,
736
- ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
737
- };
738
- } else if (xCoordinateType === 'relative' && yCoordinateType === 'relative') {
739
- coordinates = {
740
- type: 'relative',
741
- x: normalizedX,
742
- y: normalizedY
743
- };
744
- } else if (xCoordinateType === 'pixel' && yCoordinateType === 'pixel') {
745
- coordinates = {
746
- type: 'pixel',
747
- x: normalizedX,
748
- y: normalizedY
749
- };
750
- } else {
751
- coordinates = {
752
- type: 'mixed',
753
- xCoordinateType,
754
- yCoordinateType,
755
- x: normalizedX,
756
- y: normalizedY,
757
- ...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
758
- };
759
- }
760
- const textValue = annotation.text;
761
- const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
762
- const encodedText = encodeHtmlEntities(rawText);
763
- const chartAnnotation = {
764
- id: createAnnotationId(encodedText, index),
765
- text: encodedText,
766
- coordinates
767
- };
768
- const layoutProps = {};
769
- const styleProps = {};
770
- const showArrow = annotation.showarrow === undefined ? false : !!annotation.showarrow;
771
- const clipOnAxis = annotation.cliponaxis;
772
- if (clipOnAxis !== undefined) {
773
- layoutProps.clipToBounds = !!clipOnAxis;
774
- } else if (coordinates.type === 'data') {
775
- layoutProps.clipToBounds = true;
776
- }
777
- const horizontalAlign = mapHorizontalAlign(annotation.xanchor);
778
- if (horizontalAlign) {
779
- layoutProps.align = horizontalAlign;
780
- }
781
- if (!layoutProps.align) {
782
- const alignProp = mapHorizontalAlign(annotation.align);
783
- if (alignProp) {
784
- layoutProps.align = alignProp;
785
- }
786
- }
787
- const verticalAlign = mapVerticalAlign(annotation.yanchor);
788
- if (verticalAlign) {
789
- layoutProps.verticalAlign = verticalAlign;
790
- }
791
- if (!layoutProps.verticalAlign) {
792
- const valignProp = mapVerticalAlign(annotation.valign);
793
- if (valignProp) {
794
- layoutProps.verticalAlign = valignProp;
795
- }
796
- }
797
- const offsetXComponents = [];
798
- let hasExplicitOffset = false;
799
- const ax = toFiniteNumber(annotation.ax);
800
- const axRef = typeof annotation.axref === 'string' ? annotation.axref.toLowerCase() : undefined;
801
- if (ax !== undefined && (axRef === undefined || axRef === 'pixel')) {
802
- offsetXComponents.push(ax);
803
- hasExplicitOffset = true;
804
- }
805
- const xShift = toFiniteNumber(annotation.xshift);
806
- if (xShift !== undefined) {
807
- offsetXComponents.push(xShift);
808
- hasExplicitOffset = true;
809
- }
810
- if (offsetXComponents.length > 0) {
811
- const offsetX = offsetXComponents.reduce((sum, value)=>sum + value, 0);
812
- if (offsetX !== 0) {
813
- layoutProps.offsetX = offsetX;
814
- }
815
- }
816
- const offsetYComponents = [];
817
- const ay = toFiniteNumber(annotation.ay);
818
- const ayRef = typeof annotation.ayref === 'string' ? annotation.ayref.toLowerCase() : undefined;
819
- if (ay !== undefined && (ayRef === undefined || ayRef === 'pixel')) {
820
- offsetYComponents.push(ay);
821
- hasExplicitOffset = true;
822
- }
823
- const yShift = toFiniteNumber(annotation.yshift);
824
- if (yShift !== undefined) {
825
- offsetYComponents.push(yShift);
826
- hasExplicitOffset = true;
827
- }
828
- if (offsetYComponents.length > 0) {
829
- const offsetY = offsetYComponents.reduce((sum, value)=>sum + value, 0);
830
- if (offsetY !== 0) {
831
- layoutProps.offsetY = offsetY;
832
- }
833
- }
834
- if (showArrow && !hasExplicitOffset && layoutProps.offsetY === undefined) {
835
- layoutProps.offsetY = DEFAULT_ARROW_OFFSET;
836
- }
837
- const maxWidth = toFiniteNumber(annotation.width);
838
- if (maxWidth !== undefined) {
839
- layoutProps.maxWidth = maxWidth;
840
- }
841
- if (annotation.bgcolor) {
842
- styleProps.backgroundColor = annotation.bgcolor;
843
- }
844
- if (annotation.bordercolor) {
845
- styleProps.borderColor = annotation.bordercolor;
846
- }
847
- const borderWidth = toFiniteNumber(annotation.borderwidth);
848
- if (borderWidth !== undefined) {
849
- styleProps.borderWidth = borderWidth;
850
- }
851
- const borderPad = appendPx(annotation.borderpad);
852
- if (borderPad) {
853
- styleProps.padding = borderPad;
854
- }
855
- const opacity = toFiniteNumber(annotation.opacity);
856
- if (opacity !== undefined) {
857
- styleProps.opacity = opacity;
858
- }
859
- if (annotation.font) {
860
- const font = annotation.font;
861
- if (font === null || font === void 0 ? void 0 : font.color) {
862
- styleProps.textColor = font.color;
863
- }
864
- const fontSize = appendPx(font === null || font === void 0 ? void 0 : font.size);
865
- if (fontSize) {
866
- styleProps.fontSize = fontSize;
867
- }
868
- if (font === null || font === void 0 ? void 0 : font.weight) {
869
- styleProps.fontWeight = font.weight;
870
- }
871
- }
872
- const textAngle = annotation === null || annotation === void 0 ? void 0 : annotation.textangle;
873
- if (typeof textAngle === 'number' && !Number.isNaN(textAngle)) {
874
- styleProps.rotation = textAngle;
875
- } else if (typeof textAngle === 'string' && textAngle.toLowerCase() !== 'auto') {
876
- const parsedAngle = Number(textAngle);
877
- if (!Number.isNaN(parsedAngle)) {
878
- styleProps.rotation = parsedAngle;
879
- }
880
- }
881
- if (Object.keys(layoutProps).length > 0) {
882
- chartAnnotation.layout = layoutProps;
883
- }
884
- if (Object.keys(styleProps).length > 0) {
885
- chartAnnotation.style = styleProps;
886
- }
887
- if (showArrow) {
888
- var _annotation_arrowcolor;
889
- const arrowColor = (_annotation_arrowcolor = annotation.arrowcolor) !== null && _annotation_arrowcolor !== void 0 ? _annotation_arrowcolor : styleProps.textColor;
890
- const arrowWidth = toFiniteNumber(annotation.arrowwidth);
891
- const endPadding = toFiniteNumber(annotation.standoff);
892
- const startPadding = toFiniteNumber(annotation.startstandoff);
893
- const dashPattern = mapArrowDashToPattern(annotation.arrowdash);
894
- chartAnnotation.connector = {
895
- ...arrowColor ? {
896
- strokeColor: arrowColor
897
- } : {},
898
- ...arrowWidth !== undefined ? {
899
- strokeWidth: arrowWidth
900
- } : {},
901
- ...endPadding !== undefined ? {
902
- endPadding: Math.max(endPadding, 0)
903
- } : {},
904
- ...startPadding !== undefined ? {
905
- startPadding: Math.max(startPadding, 0)
906
- } : {},
907
- ...dashPattern ? {
908
- dashArray: dashPattern
909
- } : {},
910
- arrow: mapArrowsideToArrow(annotation)
911
- };
912
- }
913
- return chartAnnotation;
914
- };
915
- const getChartAnnotationsFromLayout = (data, layout, isMultiPlot)=>{
916
- if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
917
- return undefined;
918
- }
919
- // Infer axis types when they are not explicitly set.
920
- // This is needed so annotation coordinate parsing can correctly treat values as 'date' vs 'category'
921
- // (for example, bar chart category axes with date-like strings).
922
- const inferredLayout = (()=>{
923
- if (!data || !(0, _chartutilities.isArrayOrTypedArray)(data) || data.length === 0) {
924
- return layout;
925
- }
926
- const valuesByAxisKey = new Map();
927
- const axesExpectingCategories = new Set();
928
- data.forEach((series)=>{
929
- const trace = series;
930
- const axisIds = (0, _chartutilities.getAxisIds)(trace);
931
- if (trace.type === 'bar') {
932
- const categoryAxisLetter = trace.orientation === 'h' ? 'y' : 'x';
933
- axesExpectingCategories.add((0, _chartutilities.getAxisKey)(categoryAxisLetter, axisIds[categoryAxisLetter]));
934
- }
935
- [
936
- 'x',
937
- 'y'
938
- ].forEach((axLetter)=>{
939
- const coords = trace[axLetter];
940
- if (!coords || !(0, _chartutilities.isArrayOrTypedArray)(coords)) {
941
- return;
942
- }
943
- const axisKey = (0, _chartutilities.getAxisKey)(axLetter, axisIds[axLetter]);
944
- var _valuesByAxisKey_get;
945
- const existing = (_valuesByAxisKey_get = valuesByAxisKey.get(axisKey)) !== null && _valuesByAxisKey_get !== void 0 ? _valuesByAxisKey_get : [];
946
- coords.forEach((val)=>{
947
- if (!(0, _chartutilities.isInvalidValue)(val)) {
948
- existing.push(val);
949
- }
950
- });
951
- valuesByAxisKey.set(axisKey, existing);
952
- });
953
- });
954
- let nextLayout;
955
- valuesByAxisKey.forEach((values, axisKey)=>{
956
- const currentAxis = layout === null || layout === void 0 ? void 0 : layout[axisKey];
957
- const currentType = currentAxis === null || currentAxis === void 0 ? void 0 : currentAxis.type;
958
- if ([
959
- 'linear',
960
- 'log',
961
- 'date',
962
- 'category'
963
- ].includes(currentType !== null && currentType !== void 0 ? currentType : '')) {
964
- return;
965
- }
966
- let inferredType;
967
- if (axesExpectingCategories.has(axisKey) || (0, _chartutilities.isYearArray)(values)) {
968
- inferredType = 'category';
969
- } else if ((0, _chartutilities.isDateArray)(values)) {
970
- inferredType = 'date';
971
- }
972
- if (!inferredType) {
973
- return;
974
- }
975
- if (!nextLayout) {
976
- nextLayout = {
977
- ...layout
978
- };
979
- }
980
- nextLayout[axisKey] = {
981
- ...currentAxis !== null && currentAxis !== void 0 ? currentAxis : {},
982
- type: inferredType
983
- };
984
- });
985
- return nextLayout !== null && nextLayout !== void 0 ? nextLayout : layout;
986
- })();
987
- const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
988
- layout.annotations
989
- ];
990
- const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, inferredLayout, index)).filter((annotation)=>annotation !== undefined);
991
- return converted.length > 0 ? converted : undefined;
992
- };
993
- const normalizeObjectArrayForGVBC = (data, xLabels)=>{
994
- if (!data || data.length === 0) {
995
- return {
996
- traces: [],
997
- x: []
998
- };
999
- }
1000
- // Use provided xLabels if available, otherwise default to Item 1, Item 2, ...
1001
- const x = xLabels && xLabels.length === data.length ? xLabels : data.map((_, index)=>`Item ${index + 1}`);
1002
- // First, flatten all objects and collect all unique keys, excluding style keys
1003
- const flattenedObjects = data.map((item, index)=>{
1004
- if (typeof item === 'object' && item !== null) {
1005
- const flattened = flattenObject(item);
1006
- // Only keep keys where the value is numeric (number or numeric string) and not a style key
1007
- const filtered = {};
1008
- Object.keys(flattened).forEach((key)=>{
1009
- const value = flattened[key];
1010
- if (!shouldIgnoreKey(key) && (typeof value === 'number' || typeof value === 'string' && (0, _chartutilities.isNumber)(value))) {
1011
- filtered[key] = value;
1012
- }
1013
- });
1014
- return filtered;
1015
- } else if (typeof item === 'number' || typeof item === 'string' && (0, _chartutilities.isNumber)(item)) {
1016
- // Only keep primitive numeric values
1017
- return {
1018
- [x[index] || `item_${index}`]: item
1019
- };
1020
- } else {
1021
- // Non-numeric primitive, ignore by returning empty object
1022
- return {};
1023
- }
1024
- });
1025
- // Collect all unique keys across all objects
1026
- const allKeys = new Set();
1027
- flattenedObjects.forEach((obj)=>{
1028
- Object.keys(obj).forEach((key)=>allKeys.add(key));
1029
- });
1030
- // Create traces for each key (property)
1031
- const traces = [];
1032
- allKeys.forEach((key)=>{
1033
- const yValues = [];
1034
- let hasValidData = false;
1035
- let isNumericData = false;
1036
- flattenedObjects.forEach((obj, index)=>{
1037
- const value = obj[key];
1038
- if (typeof value === 'number') {
1039
- yValues.push(value);
1040
- hasValidData = true;
1041
- isNumericData = true;
1042
- } else if (typeof value === 'string' && (0, _chartutilities.isNumber)(value)) {
1043
- yValues.push(parseFloat(value));
1044
- hasValidData = true;
1045
- isNumericData = true;
1046
- }
1047
- });
1048
- // Only create trace if we have valid numeric data
1049
- if (hasValidData && isNumericData) {
1050
- const trace = {
1051
- type: 'bar',
1052
- name: key,
1053
- x,
1054
- y: yValues
1055
- };
1056
- traces.push(trace);
1057
- }
1058
- });
1059
- return {
1060
- traces,
1061
- x
1062
- };
1063
- };
1064
- const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
1065
- var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
1066
- var _getChartAnnotationsFromLayout;
1067
- const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
1068
- const titles = getTitles(input.layout);
1069
- const layoutTitle = titles.chartTitle || undefined;
1070
- const layoutWithMeta = input.layout;
1071
- const description = typeof (layoutWithMeta === null || layoutWithMeta === void 0 ? void 0 : (_layoutWithMeta_meta = layoutWithMeta.meta) === null || _layoutWithMeta_meta === void 0 ? void 0 : _layoutWithMeta_meta.description) === 'string' ? layoutWithMeta.meta.description : undefined;
1072
- const width = typeof ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) === 'number' ? input.layout.width : undefined;
1073
- const height = typeof ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) === 'number' ? input.layout.height : undefined;
1074
- const paperBackgroundColor = typeof ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.paper_bgcolor) === 'string' ? input.layout.paper_bgcolor : undefined;
1075
- const plotBackgroundColor = typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.plot_bgcolor) === 'string' ? input.layout.plot_bgcolor : undefined;
1076
- const fontColor = typeof ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_font = _input_layout4.font) === null || _input_layout_font === void 0 ? void 0 : _input_layout_font.color) === 'string' ? input.layout.font.color : undefined;
1077
- const fontFamily = typeof ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_font1 = _input_layout5.font) === null || _input_layout_font1 === void 0 ? void 0 : _input_layout_font1.family) === 'string' ? input.layout.font.family : undefined;
1078
- const margin = (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.margin;
1079
- return {
1080
- annotations,
1081
- chartTitle: layoutTitle,
1082
- description,
1083
- width,
1084
- height,
1085
- paperBackgroundColor,
1086
- plotBackgroundColor,
1087
- fontColor,
1088
- fontFamily,
1089
- margin
1090
- };
1091
- };
1092
- const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1093
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _firstData_marker, _input_layout3, _input_layout4, _input_layout5, _input_layout6;
1094
- const firstData = input.data[0];
1095
- var _input_layout_piecolorway, _input_layout_piecolorway1;
1096
- // extract colors for each series only once
1097
- // use piecolorway if available
1098
- // otherwise, default to colorway from template
1099
- const colors = (0, _PlotlyColorAdapter.extractColor)((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : firstData === null || firstData === void 0 ? void 0 : (_firstData_marker = firstData.marker) === null || _firstData_marker === void 0 ? void 0 : _firstData_marker.colors, colorMap, isDarkTheme, true);
1100
- const mapLegendToDataPoint = {};
1101
- // clear colorMap for donut chart to reassign colors as the colorMap initially gets assigned by
1102
- // getAllupLegendsProps function without sorting labels by value
1103
- colorMap.current.clear();
1104
- // Sort labels by value descending before mapping
1105
- if (firstData.labels && firstData.values) {
1106
- var _firstData_marker1;
1107
- const markerColors = ((_firstData_marker1 = firstData.marker) === null || _firstData_marker1 === void 0 ? void 0 : _firstData_marker1.colors) || undefined;
1108
- const hasMarkerColors = Array.isArray(markerColors) && markerColors.length >= firstData.labels.length;
1109
- const labelValuePairs = firstData.labels.map((label, index)=>({
1110
- label,
1111
- value: getNumberAtIndexOrDefault(firstData.values, index),
1112
- index,
1113
- color: hasMarkerColors ? markerColors[index] : undefined
1114
- }));
1115
- // Filter out invalid values
1116
- const validPairs = labelValuePairs.filter((pair)=>!(0, _chartutilities.isInvalidValue)(pair.value));
1117
- // Sort descending by value; when marker colors are present, keep color attached to the label
1118
- validPairs.sort((a, b)=>b.value - a.value);
1119
- validPairs.forEach((pair, sortedIdx)=>{
1120
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
1121
- const legend = `${pair.label}`;
1122
- var _input_layout_piecolorway, _pair_color;
1123
- const color = (_pair_color = pair.color) !== null && _pair_color !== void 0 ? _pair_color : (0, _PlotlyColorAdapter.resolveColor)(colors, sortedIdx, legend, colorMap, (_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme, true);
1124
- if (!mapLegendToDataPoint[legend]) {
1125
- mapLegendToDataPoint[legend] = {
1126
- legend,
1127
- data: pair.value,
1128
- color
1129
- };
1130
- } else {
1131
- mapLegendToDataPoint[legend].data += pair.value;
1132
- }
1133
- });
1134
- }
1135
- var _input_layout_width;
1136
- const width = (_input_layout_width = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width) !== null && _input_layout_width !== void 0 ? _input_layout_width : 440;
1137
- var _input_layout_height;
1138
- const height = (_input_layout_height = (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 220;
1139
- const hideLabels = firstData.textinfo ? ![
1140
- 'value',
1141
- 'percent',
1142
- 'label+percent',
1143
- 'percent+label'
1144
- ].includes(firstData.textinfo) : false;
1145
- const donutMarginHorizontal = hideLabels ? 0 : 80;
1146
- const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
1147
- const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : _utilities.MIN_DONUT_RADIUS;
1148
- const { chartTitle, titleStyles } = getTitles(input.layout);
1149
- // Build anticlockwise order by keeping the first item, reversing the rest
1150
- const legends = Object.keys(mapLegendToDataPoint);
1151
- const reorderedEntries = legends.length > 1 ? [
1152
- [
1153
- legends[0],
1154
- mapLegendToDataPoint[legends[0]]
1155
- ],
1156
- ...legends.slice(1).reverse().map((key)=>[
1157
- key,
1158
- mapLegendToDataPoint[key]
1159
- ])
1160
- ] : legends.map((key)=>[
1161
- key,
1162
- mapLegendToDataPoint[key]
1163
- ]);
1164
- return {
1165
- data: {
1166
- chartTitle,
1167
- chartData: reorderedEntries.map(([, v])=>v)
1168
- },
1169
- hideLegend: isMultiPlot || ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : _input_layout5.showlegend) === false,
1170
- width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
1171
- height,
1172
- innerRadius,
1173
- hideLabels,
1174
- showLabelsInPercent: firstData.textinfo ? [
1175
- 'percent',
1176
- 'label+percent',
1177
- 'percent+label'
1178
- ].includes(firstData.textinfo) : true,
1179
- roundCorners: true,
1180
- order: 'sorted',
1181
- ...titleStyles ? {
1182
- titleStyles
1183
- } : {}
1184
- };
1185
- };
1186
- const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
1187
- var _input_layout, _input_layout1, _input_layout2;
1188
- const mapXToDataPoints = {};
1189
- let yMaxValue = 0;
1190
- let yMinValue = 0;
1191
- const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
1192
- const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1193
- let colorScale = undefined;
1194
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
1195
- const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
1196
- input.data.forEach((series, index1)=>{
1197
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_line;
1198
- colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
1199
- // extract bar colors for each series only once
1200
- const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1201
- // extract line colors for each series only once
1202
- const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
1203
- const validXYRanges = getValidXYRanges(series, resolveXValue);
1204
- validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
1205
- const rangeXValues = series.x.slice(rangeStart, rangeEnd);
1206
- const rangeYValues = series.y.slice(rangeStart, rangeEnd);
1207
- const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : typeof series.text === 'string' ? series.text : undefined;
1208
- rangeXValues.forEach((x, index2)=>{
1209
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
1210
- if (!mapXToDataPoints[x]) {
1211
- mapXToDataPoints[x] = {
1212
- xAxisPoint: resolveXValue(x),
1213
- chartData: [],
1214
- lineData: []
1215
- };
1216
- }
1217
- const legend = legends[index1];
1218
- // resolve color for each legend's bars from the colorscale or extracted colors
1219
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index2 % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, index2, legend, colorMap, (_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);
1220
- const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
1221
- const yVal = rangeYValues[index2];
1222
- const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
1223
- let barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
1224
- // Apply texttemplate formatting if specified
1225
- if (barLabel && series.texttemplate) {
1226
- barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
1227
- }
1228
- if (series.type === 'bar') {
1229
- var _rgb_copy_formatHex8;
1230
- mapXToDataPoints[x].chartData.push({
1231
- legend,
1232
- data: yVal,
1233
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1234
- opacity
1235
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1236
- yAxisCalloutData,
1237
- ...barLabel ? {
1238
- barLabel: String(barLabel)
1239
- } : {}
1240
- });
1241
- if (typeof yVal === 'number') {
1242
- yMaxValue = Math.max(yMaxValue, yVal);
1243
- }
1244
- } else if (series.type === 'scatter' || !!fallbackVSBC) {
1245
- var _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode;
1246
- const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, 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);
1247
- const lineOptions = !((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('text')) ? getLineOptions(series.line) : undefined;
1248
- const legendShape = getLegendShape(series);
1249
- var _rgb_copy_formatHex81;
1250
- mapXToDataPoints[x].lineData.push({
1251
- legend: legend + (validXYRanges.length > 1 ? `.${rangeIdx + 1}` : ''),
1252
- legendShape,
1253
- y: yVal,
1254
- color: (_rgb_copy_formatHex81 = (0, _d3color.rgb)(lineColor).copy({
1255
- opacity
1256
- }).formatHex8()) !== null && _rgb_copy_formatHex81 !== void 0 ? _rgb_copy_formatHex81 : color,
1257
- lineOptions: {
1258
- ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
1259
- mode: series.mode
1260
- },
1261
- useSecondaryYScale: usesSecondaryYScale(series, input.layout),
1262
- yAxisCalloutData
1263
- });
1264
- if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
1265
- yMaxValue = Math.max(yMaxValue, yVal);
1266
- yMinValue = Math.min(yMinValue, yVal);
1267
- }
1268
- }
1269
- yMaxValue = Math.max(yMaxValue, yVal);
1270
- });
1271
- });
1272
- });
1273
- const xCategories = extractXCategories(input.data);
1274
- var _input_layout_shapes;
1275
- ((_input_layout_shapes = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.shapes) !== null && _input_layout_shapes !== void 0 ? _input_layout_shapes : []).filter((shape)=>shape.type === 'line').forEach((shape, shapeIdx)=>{
1276
- var _shape_line;
1277
- const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
1278
- const resolveX = (val)=>{
1279
- if (shape.xref === 'x domain') {
1280
- if (val === 0) {
1281
- return xCategories[0];
1282
- }
1283
- if (val === 1) {
1284
- return xCategories[xCategories.length - 1];
1285
- }
1286
- }
1287
- if (typeof val === 'number' && Array.isArray(xCategories)) {
1288
- if (xCategories[val] !== undefined) {
1289
- return xCategories[val];
1290
- } else {
1291
- return xCategories[shapeIdx];
1292
- }
1293
- }
1294
- return val;
1295
- };
1296
- const x0Key = resolveX(shape.x0);
1297
- const x1Key = resolveX(shape.x1);
1298
- const resolveY = (val)=>{
1299
- if (shape.yref === 'paper') {
1300
- if (val === 0) {
1301
- return yMinValue;
1302
- }
1303
- if (val === 1) {
1304
- return yMaxValue;
1305
- }
1306
- if (typeof val === 'number') {
1307
- return yMinValue + val * (yMaxValue - yMinValue);
1308
- }
1309
- return val;
1310
- }
1311
- return val;
1312
- };
1313
- const y0Val = resolveY(shape.y0);
1314
- const y1Val = resolveY(shape.y1);
1315
- if (mapXToDataPoints[x0Key]) {
1316
- var _rgb_formatHex8;
1317
- mapXToDataPoints[x0Key].lineData.push({
1318
- legend: `Reference_${shapeIdx}`,
1319
- y: y0Val,
1320
- color: (_rgb_formatHex8 = (0, _d3color.rgb)(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
1321
- lineOptions: getLineOptions(shape.line),
1322
- useSecondaryYScale: false
1323
- });
1324
- }
1325
- if (mapXToDataPoints[x1Key]) {
1326
- var _rgb_formatHex81;
1327
- mapXToDataPoints[x1Key].lineData.push({
1328
- legend: `Reference_${shapeIdx}`,
1329
- y: y1Val,
1330
- color: (_rgb_formatHex81 = (0, _d3color.rgb)(lineColor).formatHex8()) !== null && _rgb_formatHex81 !== void 0 ? _rgb_formatHex81 : lineColor,
1331
- lineOptions: getLineOptions(shape.line),
1332
- useSecondaryYScale: false
1333
- });
1334
- }
1335
- });
1336
- const vsbcData = Object.values(mapXToDataPoints);
1337
- const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1338
- var _input_layout_height;
1339
- return {
1340
- data: vsbcData,
1341
- width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
1342
- height: (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1343
- barWidth: 'auto',
1344
- yMaxValue,
1345
- yMinValue,
1346
- mode: 'plotly',
1347
- ...secondaryYAxisValues,
1348
- hideTickOverlap: true,
1349
- barGapMax: 2,
1350
- hideLegend,
1351
- roundCorners: true,
1352
- showYAxisLables: true,
1353
- noOfCharsToTruncate: 20,
1354
- showYAxisLablesTooltip: true,
1355
- roundedTicks: true,
1356
- ...getXMinMaxValues(input.data[0], input.layout),
1357
- ...getTitles(input.layout),
1358
- ...getXAxisTickFormat(input.data[0], input.layout),
1359
- ...yAxisTickFormat,
1360
- ...getAxisCategoryOrderProps(input.data, input.layout),
1361
- ...getBarProps(input.data, input.layout),
1362
- ...getYMinMaxValues(input.data[0], input.layout),
1363
- ...getAxisTickProps(input.data, input.layout),
1364
- ...annotations ? {
1365
- annotations
1366
- } : {}
1367
- };
1368
- };
1369
- const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1370
- var _processedInput_layout, _processedInput_layout1;
1371
- // Handle object arrays in y values by normalizing the data first
1372
- let processedInput = {
1373
- ...input
1374
- };
1375
- // Check if any bar traces have object arrays as y values
1376
- const hasObjectArrayData = input.data.some((series)=>series.type === 'bar' && (0, _chartutilities.isObjectArray)(series.y));
1377
- if (hasObjectArrayData) {
1378
- // Process each trace that has object array y values
1379
- const processedData = input.data.map((series, index)=>{
1380
- if (series.type === 'bar' && (0, _chartutilities.isObjectArray)(series.y)) {
1381
- // Normalize the object array to create multiple traces for GVBC
1382
- const { traces } = normalizeObjectArrayForGVBC(series.y, Array.isArray(series.x) ? series.x : undefined);
1383
- // Return all the new traces, each representing a property from the objects
1384
- return traces.map((trace)=>({
1385
- ...trace,
1386
- // Copy other properties from the original series if needed
1387
- marker: series.marker
1388
- }));
1389
- }
1390
- return [
1391
- series
1392
- ];
1393
- }).flat();
1394
- processedInput = {
1395
- ...input,
1396
- data: processedData
1397
- };
1398
- }
1399
- const gvbcDataV2 = [];
1400
- const secondaryYAxisValues = getSecondaryYAxisValues(processedInput.data, processedInput.layout);
1401
- const { legends, hideLegend } = getLegendProps(processedInput.data, processedInput.layout, isMultiPlot);
1402
- let colorScale = undefined;
1403
- const yAxisTickFormat = getYAxisTickFormat(processedInput.data[0], processedInput.layout);
1404
- processedInput.data.forEach((series, index1)=>{
1405
- colorScale = (0, _PlotlyColorAdapter.createColorScale)(processedInput.layout, series, colorScale);
1406
- const legend = legends[index1];
1407
- const legendShape = getLegendShape(series);
1408
- if (series.type === 'bar') {
1409
- var _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout, _series_marker;
1410
- // extract bar colors for each series only once
1411
- const extractedBarColors = (0, _PlotlyColorAdapter.extractColor)((_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1412
- gvbcDataV2.push({
1413
- type: 'bar',
1414
- legend,
1415
- key: legend,
1416
- data: series.x.map((x, xIndex)=>{
1417
- var _series_y, _series_marker, _series_marker1, _series_marker_color, _series_marker2, _processedInput_layout_template_layout, _processedInput_layout_template, _processedInput_layout;
1418
- if ((0, _chartutilities.isInvalidValue)(x) || (0, _chartutilities.isInvalidValue)((_series_y = series.y) === null || _series_y === void 0 ? void 0 : _series_y[xIndex])) {
1419
- return;
1420
- }
1421
- // resolve color for each legend's bars from the colorscale or extracted colors
1422
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.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);
1423
- const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, xIndex);
1424
- const yVal = series.y[xIndex];
1425
- // Extract text value for barLabel
1426
- let barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
1427
- // Apply texttemplate formatting if specified
1428
- if (barLabel && series.texttemplate) {
1429
- barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
1430
- }
1431
- var _rgb_copy_formatHex8;
1432
- return {
1433
- x: x.toString(),
1434
- y: yVal,
1435
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
1436
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1437
- opacity
1438
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1439
- ...barLabel ? {
1440
- barLabel: String(barLabel)
1441
- } : {}
1442
- };
1443
- }).filter((item)=>typeof item !== 'undefined'),
1444
- useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
1445
- });
1446
- } else if (series.type === 'scatter') {
1447
- var _processedInput_layout_template_layout1, _processedInput_layout_template1, _processedInput_layout1, _series_line, _processedInput_layout_template_layout2, _processedInput_layout_template2, _processedInput_layout2;
1448
- // extract line colors for each series only once
1449
- const extractedLineColors = (0, _PlotlyColorAdapter.extractColor)((_processedInput_layout1 = processedInput.layout) === null || _processedInput_layout1 === void 0 ? void 0 : (_processedInput_layout_template1 = _processedInput_layout1.template) === null || _processedInput_layout_template1 === void 0 ? void 0 : (_processedInput_layout_template_layout1 = _processedInput_layout_template1.layout) === null || _processedInput_layout_template_layout1 === void 0 ? void 0 : _processedInput_layout_template_layout1.colorway, colorwayType, (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color, colorMap, isDarkTheme);
1450
- const lineColor = (0, _PlotlyColorAdapter.resolveColor)(extractedLineColors, index1, legend, colorMap, (_processedInput_layout2 = processedInput.layout) === null || _processedInput_layout2 === void 0 ? void 0 : (_processedInput_layout_template2 = _processedInput_layout2.template) === null || _processedInput_layout_template2 === void 0 ? void 0 : (_processedInput_layout_template_layout2 = _processedInput_layout_template2.layout) === null || _processedInput_layout_template_layout2 === void 0 ? void 0 : _processedInput_layout_template_layout2.colorway, isDarkTheme);
1451
- const lineOptions = getLineOptions(series.line);
1452
- const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index1);
1453
- const validXYRanges = getValidXYRanges(series);
1454
- validXYRanges.forEach(([rangeStart, rangeEnd])=>{
1455
- const rangeXValues = series.x.slice(rangeStart, rangeEnd);
1456
- const rangeYValues = series.y.slice(rangeStart, rangeEnd);
1457
- var _rgb_copy_formatHex8;
1458
- gvbcDataV2.push({
1459
- type: 'line',
1460
- legend,
1461
- legendShape,
1462
- data: rangeXValues.map((x, i)=>{
1463
- const yVal = rangeYValues[i];
1464
- return {
1465
- x: x.toString(),
1466
- y: yVal,
1467
- yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat)
1468
- };
1469
- }),
1470
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(lineColor).copy({
1471
- opacity
1472
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : lineColor,
1473
- lineOptions: {
1474
- ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
1475
- mode: series.mode
1476
- },
1477
- useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
1478
- });
1479
- });
1480
- }
1481
- });
1482
- const annotations = getChartAnnotationsFromLayout(processedInput.data, processedInput.layout, isMultiPlot);
1483
- var _processedInput_layout_height;
1484
- return {
1485
- dataV2: gvbcDataV2,
1486
- width: (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : _processedInput_layout.width,
1487
- height: (_processedInput_layout_height = (_processedInput_layout1 = processedInput.layout) === null || _processedInput_layout1 === void 0 ? void 0 : _processedInput_layout1.height) !== null && _processedInput_layout_height !== void 0 ? _processedInput_layout_height : 350,
1488
- barWidth: 'auto',
1489
- mode: 'plotly',
1490
- ...secondaryYAxisValues,
1491
- hideTickOverlap: true,
1492
- hideLegend,
1493
- roundCorners: true,
1494
- showYAxisLables: true,
1495
- roundedTicks: true,
1496
- ...getXMinMaxValues(processedInput.data[0], processedInput.layout),
1497
- ...getTitles(processedInput.layout),
1498
- ...getAxisCategoryOrderProps(processedInput.data, processedInput.layout),
1499
- ...getYMinMaxValues(processedInput.data[0], processedInput.layout),
1500
- ...getXAxisTickFormat(processedInput.data[0], processedInput.layout),
1501
- ...yAxisTickFormat,
1502
- ...getBarProps(processedInput.data, processedInput.layout),
1503
- ...getAxisTickProps(processedInput.data, processedInput.layout),
1504
- ...annotations ? {
1505
- annotations
1506
- } : {}
1507
- };
1508
- };
1509
- const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1510
- var _input_layout, _input_layout1;
1511
- const vbcData = [];
1512
- const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1513
- let colorScale = undefined;
1514
- input.data.forEach((series, seriesIdx)=>{
1515
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_xbins, _series_xbins1, _series_xbins2;
1516
- if (!series.x) {
1517
- return;
1518
- }
1519
- colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
1520
- // extract colors for each series only once
1521
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1522
- const xValues = [];
1523
- const yValues = [];
1524
- series.x.forEach((xVal, index)=>{
1525
- var _getNumberAtIndexOrDefault;
1526
- const yVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(series.y, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
1527
- if ((0, _chartutilities.isInvalidValue)(xVal)) {
1528
- return;
1529
- }
1530
- xValues.push(xVal);
1531
- yValues.push(yVal);
1532
- });
1533
- const isXString = (0, _chartutilities.isStringArray)(xValues);
1534
- // TODO: In case of a single bin, add an empty bin of the same size to prevent the
1535
- // default bar width from being used and ensure the bar spans the full intended range.
1536
- const xBins = createBins(xValues, (_series_xbins = series.xbins) === null || _series_xbins === void 0 ? void 0 : _series_xbins.start, (_series_xbins1 = series.xbins) === null || _series_xbins1 === void 0 ? void 0 : _series_xbins1.end, (_series_xbins2 = series.xbins) === null || _series_xbins2 === void 0 ? void 0 : _series_xbins2.size);
1537
- const yBins = xBins.map(()=>[]);
1538
- let total = 0;
1539
- xValues.forEach((xVal, index)=>{
1540
- const binIdx = findBinIndex(xBins, xVal, isXString);
1541
- if (binIdx !== -1) {
1542
- yBins[binIdx].push(yValues[index]);
1543
- }
1544
- });
1545
- const y = yBins.map((bin)=>{
1546
- const yVal = calculateHistFunc(series.histfunc, bin);
1547
- total += yVal;
1548
- return yVal;
1549
- });
1550
- xBins.forEach((bin, index)=>{
1551
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
1552
- const legend = legends[seriesIdx];
1553
- // resolve color for each legend's bars from the colorscale or extracted colors
1554
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.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);
1555
- const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
1556
- const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
1557
- // Handle text values and texttemplate formatting for histogram bins
1558
- let barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
1559
- if (barLabel && series.texttemplate) {
1560
- barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
1561
- }
1562
- var _rgb_copy_formatHex8;
1563
- vbcData.push({
1564
- x: isXString ? bin.join(', ') : getBinCenter(bin),
1565
- y: yVal,
1566
- legend,
1567
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1568
- opacity
1569
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1570
- ...isXString ? {} : {
1571
- xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
1572
- },
1573
- ...barLabel ? {
1574
- barLabel: String(barLabel)
1575
- } : {}
1576
- });
1577
- });
1578
- });
1579
- const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1580
- var _input_layout_height;
1581
- return {
1582
- data: vbcData,
1583
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
1584
- 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,
1585
- mode: 'histogram',
1586
- hideTickOverlap: true,
1587
- maxBarWidth: 50,
1588
- hideLegend,
1589
- roundCorners: true,
1590
- showYAxisLables: true,
1591
- roundedTicks: true,
1592
- ...getXMinMaxValues(input.data[0], input.layout),
1593
- ...getTitles(input.layout),
1594
- ...getYMinMaxValues(input.data[0], input.layout),
1595
- ...getAxisCategoryOrderProps(input.data, input.layout),
1596
- ...annotations ? {
1597
- annotations
1598
- } : {}
1599
- };
1600
- };
1601
- const transformPlotlyJsonToAreaChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1602
- return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'area', colorMap, colorwayType, isDarkTheme);
1603
- };
1604
- const transformPlotlyJsonToLineChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1605
- return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'line', colorMap, colorwayType, isDarkTheme);
1606
- };
1607
- const transformPlotlyJsonToScatterChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1608
- return transformPlotlyJsonToScatterTraceProps(input, isMultiPlot, 'scatter', colorMap, colorwayType, isDarkTheme);
1609
- };
1610
- const mapColorFillBars = (layout)=>{
1611
- if (!Array.isArray(layout === null || layout === void 0 ? void 0 : layout.shapes)) {
1612
- return [];
1613
- }
1614
- return layout.shapes.filter((shape)=>shape.type === 'rect').map((shape)=>{
1615
- //colorFillbars doesn't support string dates or categories
1616
- if (typeof shape.x0 === 'string' || typeof shape.x1 === 'string') {
1617
- return null;
1618
- }
1619
- return {
1620
- color: shape.fillcolor,
1621
- data: [
1622
- {
1623
- startX: shape.x0,
1624
- endX: shape.x1
1625
- }
1626
- ],
1627
- applyPattern: false
1628
- };
1629
- });
1630
- };
1631
- const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme)=>{
1632
- var _input_data_, _chartData__data_, _chartData_, _chartData__data_1, _chartData_1, _chartData__data_2, _chartData_2, _chartData__data_3, _chartData_3, _input_layout, _input_layout1, _input_layout2;
1633
- const isScatterMarkers = [
1634
- 'text',
1635
- 'markers',
1636
- 'text+markers',
1637
- 'markers+text',
1638
- 'lines+markers',
1639
- 'markers+line',
1640
- 'text+lines+markers',
1641
- 'lines+markers+text'
1642
- ].includes((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.mode);
1643
- const isAreaChart = chartType === 'area';
1644
- const isScatterChart = chartType === 'scatter';
1645
- const secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
1646
- let mode = 'tonexty';
1647
- const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1648
- const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
1649
- const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
1650
- const chartData = input.data.map((series, index)=>{
1651
- 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;
1652
- 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;
1653
- // extract colors for each series only once
1654
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
1655
- const xValues = series.x;
1656
- const legend = legends[index];
1657
- // resolve color for each legend's lines from the extracted colors
1658
- const seriesColor = (0, _PlotlyColorAdapter.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);
1659
- const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
1660
- mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
1661
- // if mode contains 'text', we prioritize showing the text over curving the line
1662
- const lineOptions = !((_series_mode1 = series.mode) === null || _series_mode1 === void 0 ? void 0 : _series_mode1.includes('text')) && series.type !== 'scatterpolar' ? getLineOptions(series.line) : undefined;
1663
- const legendShape = getLegendShape(series);
1664
- const validXYRanges = getValidXYRanges(series, resolveXValue);
1665
- return validXYRanges.map(([rangeStart, rangeEnd], rangeIdx)=>{
1666
- var _series_marker, _series_marker1, _series_marker2, _input_layout, _input_layout_polar_angularaxis, _input_layout_polar, _input_layout1, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout2;
1667
- const rangeXValues = xValues.slice(rangeStart, rangeEnd);
1668
- const rangeYValues = series.y.slice(rangeStart, rangeEnd);
1669
- const markerSizes = (0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size.slice(rangeStart, rangeEnd) : [];
1670
- const markerColors = (0, _chartutilities.isArrayOrTypedArray)((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color) ? series.marker.color.slice(rangeStart, rangeEnd) : Array.isArray((_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : _series_marker2.color) ? series.marker.color.slice(rangeStart, rangeEnd) : undefined;
1671
- const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : undefined;
1672
- var _rgb_copy_formatHex8;
1673
- return {
1674
- legend,
1675
- legendShape,
1676
- data: rangeXValues.map((x, i)=>{
1677
- var _series_marker, _series_marker1;
1678
- return {
1679
- x: resolveXValue(x),
1680
- y: rangeYValues[i],
1681
- ...Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? {
1682
- markerSize: markerSizes[i]
1683
- } : typeof ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size) === 'number' ? {
1684
- markerSize: series.marker.size
1685
- } : {},
1686
- ...markerColors ? {
1687
- markerColor: markerColors[i]
1688
- } : {},
1689
- ...textValues ? {
1690
- text: textValues[i]
1691
- } : {},
1692
- yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat)
1693
- };
1694
- }),
1695
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(seriesColor).copy({
1696
- opacity: seriesOpacity
1697
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : seriesColor,
1698
- lineOptions: {
1699
- ...lineOptions !== null && lineOptions !== void 0 ? lineOptions : {},
1700
- mode: series.type !== 'scatterpolar' ? series.mode : 'scatterpolar',
1701
- // originXOffset is not typed on Layout, but may be present in input.layout as a part of projection of
1702
- // scatter polar coordingates to cartesian coordinates
1703
- ...series.type === 'scatterpolar' ? {
1704
- originXOffset: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.__polarOriginX,
1705
- direction: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_polar = _input_layout1.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction,
1706
- rotation: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout2.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation,
1707
- axisLabel: series.__axisLabel ? series.__axisLabel : {},
1708
- fill: series.fill
1709
- } : {}
1710
- },
1711
- useSecondaryYScale: usesSecondaryYScale(series, input.layout)
1712
- };
1713
- });
1714
- }).flat();
1715
- const xMinValue = (_chartData_ = chartData[0]) === null || _chartData_ === void 0 ? void 0 : (_chartData__data_ = _chartData_.data[0]) === null || _chartData__data_ === void 0 ? void 0 : _chartData__data_.x;
1716
- const xMaxValue = (_chartData_1 = chartData[0]) === null || _chartData_1 === void 0 ? void 0 : (_chartData__data_1 = _chartData_1.data[chartData[0].data.length - 1]) === null || _chartData__data_1 === void 0 ? void 0 : _chartData__data_1.x;
1717
- const yMinValue = (_chartData_2 = chartData[0]) === null || _chartData_2 === void 0 ? void 0 : (_chartData__data_2 = _chartData_2.data[0]) === null || _chartData__data_2 === void 0 ? void 0 : _chartData__data_2.y;
1718
- const yMaxValue = (_chartData_3 = chartData[0]) === null || _chartData_3 === void 0 ? void 0 : (_chartData__data_3 = _chartData_3.data[chartData[0].data.length - 1]) === null || _chartData__data_3 === void 0 ? void 0 : _chartData__data_3.y;
1719
- const xCategories = extractXCategories(input.data);
1720
- var _input_layout_shapes;
1721
- const lineShape = ((_input_layout_shapes = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.shapes) !== null && _input_layout_shapes !== void 0 ? _input_layout_shapes : []).filter((shape)=>shape.type === 'line').map((shape, shapeIdx)=>{
1722
- var _shape_line;
1723
- const lineColor = (_shape_line = shape.line) === null || _shape_line === void 0 ? void 0 : _shape_line.color;
1724
- const resolveX = (val)=>{
1725
- if (typeof val === 'number' && Array.isArray(xCategories)) {
1726
- if (xCategories[val] !== undefined) {
1727
- return xCategories[val];
1728
- } else {
1729
- return xCategories[shapeIdx];
1730
- }
1731
- }
1732
- if (shape.xref === 'paper') {
1733
- if (val === 0) {
1734
- return xMinValue;
1735
- }
1736
- if (val === 1) {
1737
- return xMaxValue;
1738
- }
1739
- if (typeof val === 'number' && typeof xMinValue === 'number' && typeof xMaxValue === 'number') {
1740
- return xMinValue + val * (xMaxValue - xMinValue);
1741
- }
1742
- return val;
1743
- }
1744
- return val;
1745
- };
1746
- const resolveY = (val)=>{
1747
- if (shape.yref === 'paper') {
1748
- if (val === 0) {
1749
- return yMinValue;
1750
- }
1751
- if (val === 1) {
1752
- return yMaxValue;
1753
- }
1754
- if (typeof val === 'number') {
1755
- return yMinValue + val * (yMaxValue - yMinValue);
1756
- }
1757
- return val;
1758
- }
1759
- return val;
1760
- };
1761
- var _rgb_formatHex8;
1762
- return {
1763
- legend: `Reference_${shapeIdx}`,
1764
- data: [
1765
- {
1766
- x: resolveXValue(resolveX(shape.x0)),
1767
- y: resolveY(shape.y0)
1768
- },
1769
- {
1770
- x: resolveXValue(resolveX(shape.x1)),
1771
- y: resolveY(shape.y1)
1772
- }
1773
- ],
1774
- color: (_rgb_formatHex8 = (0, _d3color.rgb)(lineColor).formatHex8()) !== null && _rgb_formatHex8 !== void 0 ? _rgb_formatHex8 : lineColor,
1775
- lineOptions: getLineOptions(shape.line),
1776
- useSecondaryYScale: false
1777
- };
1778
- });
1779
- const yMinMax = getYMinMaxValues(input.data[0], input.layout);
1780
- if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
1781
- const yMinMaxValues = (0, _utilities.findNumericMinMaxOfY)(chartData);
1782
- yMinMax.yMinValue = yMinMaxValues.startValue;
1783
- yMinMax.yMaxValue = yMinMaxValues.endValue;
1784
- }
1785
- const numDataPoints = chartData.reduce((total, lineChartPoints)=>total + lineChartPoints.data.length, 0);
1786
- const chartProps = {
1787
- lineChartData: [
1788
- ...chartData,
1789
- ...lineShape
1790
- ]
1791
- };
1792
- const scatterChartProps = {
1793
- scatterChartData: [
1794
- ...chartData,
1795
- ...lineShape
1796
- ]
1797
- };
1798
- const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1799
- var _input_layout_height;
1800
- const commonProps = {
1801
- supportNegativeData: true,
1802
- ...secondaryYAxisValues,
1803
- width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
1804
- height: (_input_layout_height = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1805
- hideTickOverlap: true,
1806
- hideLegend,
1807
- useUTC: false,
1808
- optimizeLargeData: numDataPoints > 1000,
1809
- showYAxisLables: true,
1810
- roundedTicks: true,
1811
- ...getXMinMaxValues(input.data[0], input.layout),
1812
- ...getTitles(input.layout),
1813
- ...getXAxisTickFormat(input.data[0], input.layout),
1814
- ...yAxisTickFormat,
1815
- ...getAxisScaleTypeProps(input.data, input.layout),
1816
- ...getAxisTickProps(input.data, input.layout),
1817
- ...annotations ? {
1818
- annotations
1819
- } : {}
1820
- };
1821
- if (isAreaChart) {
1822
- return {
1823
- data: chartProps,
1824
- mode,
1825
- ...commonProps
1826
- };
1827
- } else {
1828
- return {
1829
- data: isScatterChart ? scatterChartProps : chartProps,
1830
- ...commonProps,
1831
- ...yMinMax,
1832
- ...isScatterChart ? {
1833
- showYAxisLablesTooltip: true,
1834
- ...getAxisCategoryOrderProps(input.data, input.layout)
1835
- } : {},
1836
- ...!isScatterChart && (()=>{
1837
- const bars = mapColorFillBars(input.layout);
1838
- return bars && !bars.includes(null) ? {
1839
- colorFillBars: bars
1840
- } : {};
1841
- })()
1842
- };
1843
- }
1844
- };
1845
- const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1846
- var _input_layout, _input_layout_margin, _input_layout1, _input_layout_margin1, _input_layout2, _input_layout_yaxis2, _input_layout3, _input_layout_yaxis21, _input_layout4, _input_layout_yaxis2_title, _input_layout_yaxis22, _input_layout5, _input_layout6;
1847
- const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
1848
- let colorScale = undefined;
1849
- const chartData = input.data.map((series, index)=>{
1850
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
1851
- colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
1852
- // extract colors for each series only once
1853
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1854
- const legend = legends[index];
1855
- return series.y.map((yValue, i)=>{
1856
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x, _series_text;
1857
- if ((0, _chartutilities.isInvalidValue)(yValue)) {
1858
- return null;
1859
- }
1860
- // resolve color for each legend's bars from the colorscale or extracted colors
1861
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, (_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);
1862
- const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
1863
- var _rgb_copy_formatHex8;
1864
- return {
1865
- x: (0, _chartutilities.isInvalidValue)((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]) ? 0 : series.x[i],
1866
- y: yValue,
1867
- legend,
1868
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1869
- opacity
1870
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1871
- ...((_series_text = series.text) === null || _series_text === void 0 ? void 0 : _series_text[i]) ? {
1872
- barLabel: series.text[i].toString()
1873
- } : {}
1874
- };
1875
- }).filter((point)=>point !== null);
1876
- }).flat();
1877
- var _input_layout_height;
1878
- const chartHeight = (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 450;
1879
- var _input_layout_margin_l;
1880
- const margin = (_input_layout_margin_l = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_margin = _input_layout1.margin) === null || _input_layout_margin === void 0 ? void 0 : _input_layout_margin.l) !== null && _input_layout_margin_l !== void 0 ? _input_layout_margin_l : 0;
1881
- var _input_layout_margin_pad;
1882
- const padding = (_input_layout_margin_pad = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_margin1 = _input_layout2.margin) === null || _input_layout_margin1 === void 0 ? void 0 : _input_layout_margin1.pad) !== null && _input_layout_margin_pad !== void 0 ? _input_layout_margin_pad : 0;
1883
- const availableHeight = chartHeight - margin - padding;
1884
- const numberOfRows = new Set(chartData.map((d)=>d.y)).size || 1;
1885
- const scalingFactor = 0.01;
1886
- const gapFactor = 1 / (1 + scalingFactor * numberOfRows);
1887
- const barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
1888
- return {
1889
- data: chartData,
1890
- secondaryYAxistitle: typeof ((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_yaxis2 = _input_layout3.yaxis2) === null || _input_layout_yaxis2 === void 0 ? void 0 : _input_layout_yaxis2.title) === 'string' ? (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_yaxis21 = _input_layout4.yaxis2) === null || _input_layout_yaxis21 === void 0 ? void 0 : _input_layout_yaxis21.title : ((_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_yaxis22 = _input_layout5.yaxis2) === null || _input_layout_yaxis22 === void 0 ? void 0 : (_input_layout_yaxis2_title = _input_layout_yaxis22.title) === null || _input_layout_yaxis2_title === void 0 ? void 0 : _input_layout_yaxis2_title.text) || '',
1891
- barHeight,
1892
- showYAxisLables: true,
1893
- height: chartHeight,
1894
- width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
1895
- hideTickOverlap: true,
1896
- noOfCharsToTruncate: 20,
1897
- showYAxisLablesTooltip: true,
1898
- hideLegend,
1899
- roundCorners: true,
1900
- roundedTicks: true,
1901
- ...getXMinMaxValues(input.data[0], input.layout),
1902
- ...getTitles(input.layout),
1903
- ...getAxisCategoryOrderProps(input.data, input.layout),
1904
- ...getBarProps(input.data, input.layout, true),
1905
- ...getAxisTickProps(input.data, input.layout)
1906
- };
1907
- };
1908
- const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1909
- var _input_layout, _input_layout1;
1910
- const data = input.data.filter((series)=>series.type !== 'scatter' || series.mode !== 'markers');
1911
- const { legends, hideLegend } = getLegendProps(data, input.layout, isMultiPlot);
1912
- let colorScale = undefined;
1913
- const xAxisType = getAxisType(data, getAxisObjects(data, input.layout).x);
1914
- const resolveXValue = getAxisValueResolver(xAxisType, parseLocalDate);
1915
- const resolveGanttXValue = (value)=>{
1916
- const resolvedValue = resolveXValue(value);
1917
- return typeof resolvedValue === 'string' ? 0 : resolvedValue !== null && resolvedValue !== void 0 ? resolvedValue : 0;
1918
- };
1919
- const isXDate = xAxisType === 'date';
1920
- const ganttData = [];
1921
- data.forEach((series, index)=>{
1922
- const legend = legends[index];
1923
- if (series.type === 'bar') {
1924
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker;
1925
- colorScale = (0, _PlotlyColorAdapter.createColorScale)(input.layout, series, colorScale);
1926
- // extract colors for each series only once
1927
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1928
- series.y.forEach((yVal, i)=>{
1929
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1930
- if ((0, _chartutilities.isInvalidValue)(yVal)) {
1931
- return;
1932
- }
1933
- // resolve color for each legend's bars from the colorscale or extracted colors
1934
- const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, legend, colorMap, (_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);
1935
- const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
1936
- const base = +resolveGanttXValue((0, _chartutilities.isArrayOrTypedArray)(series.base) ? series.base[i] : series.base);
1937
- const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
1938
- var _rgb_copy_formatHex8;
1939
- ganttData.push({
1940
- x: {
1941
- start: isXDate ? new Date(base) : base,
1942
- end: isXDate ? new Date(base + xVal) : base + xVal
1943
- },
1944
- y: yVal,
1945
- legend,
1946
- color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
1947
- opacity
1948
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1949
- });
1950
- });
1951
- } else if (series.type === 'scatter' && series.mode === 'none' && series.fill === 'toself') {
1952
- for(let i = 0; i < series.y.length; i += 5){
1953
- if ((0, _chartutilities.isInvalidValue)(series.y[i]) || (0, _chartutilities.isInvalidValue)(series.y[i + 3])) {
1954
- continue;
1955
- }
1956
- const x0 = resolveGanttXValue(series.x[i]);
1957
- const x1 = resolveGanttXValue(series.x[i + 1]);
1958
- const y0 = series.y[i];
1959
- const y1 = series.y[i + 3];
1960
- ganttData.push({
1961
- x: {
1962
- start: x0,
1963
- end: x1
1964
- },
1965
- y: Math.round((y0 + y1) / 2),
1966
- legend,
1967
- color: series.fillcolor
1968
- });
1969
- }
1970
- }
1971
- });
1972
- var _input_layout_height;
1973
- return {
1974
- data: ganttData,
1975
- showYAxisLables: true,
1976
- height: (_input_layout_height = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
1977
- width: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.width,
1978
- hideTickOverlap: true,
1979
- hideLegend,
1980
- noOfCharsToTruncate: 20,
1981
- showYAxisLablesTooltip: true,
1982
- roundCorners: true,
1983
- useUTC: false,
1984
- ...getTitles(input.layout),
1985
- ...getAxisCategoryOrderProps(data, input.layout),
1986
- ...getBarProps(data, input.layout, true),
1987
- ...getAxisTickProps(data, input.layout)
1988
- };
1989
- };
1990
- const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1991
- 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;
1992
- const firstData = input.data[0];
1993
- const heatmapDataPoints = [];
1994
- let zMin = Number.POSITIVE_INFINITY;
1995
- let zMax = Number.NEGATIVE_INFINITY;
1996
- // Build a 2D array of annotations based on their grid position
1997
- const annotationGrid = [];
1998
- const rawAnnotations = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.annotations;
1999
- if (rawAnnotations) {
2000
- const annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [
2001
- rawAnnotations
2002
- ];
2003
- // Collect all unique x and y values from valid annotations
2004
- const xSet = new Set();
2005
- const ySet = new Set();
2006
- const validAnnotations = [];
2007
- annotationsArray.forEach((a)=>{
2008
- 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)) {
2009
- xSet.add(a.x);
2010
- ySet.add(a.y);
2011
- validAnnotations.push({
2012
- x: a.x,
2013
- y: a.y,
2014
- text: cleanText(a.text)
2015
- });
2016
- }
2017
- });
2018
- if (validAnnotations.length > 0) {
2019
- // Get sorted unique x and y values
2020
- const xValues = Array.from(xSet).sort((a, b)=>a - b);
2021
- const yValues = Array.from(ySet).sort((a, b)=>a - b);
2022
- // Initialize 2D grid and populate
2023
- validAnnotations.forEach((annotation)=>{
2024
- const xIdx = xValues.indexOf(annotation.x);
2025
- const yIdx = yValues.indexOf(annotation.y);
2026
- if (!annotationGrid[yIdx]) {
2027
- annotationGrid[yIdx] = [];
2028
- }
2029
- annotationGrid[yIdx][xIdx] = annotation.text;
2030
- });
2031
- }
2032
- }
2033
- // Helper function to get annotation from 2D grid by index
2034
- const getAnnotationByIndex = (xIdx, yIdx)=>{
2035
- var _annotationGrid_yIdx;
2036
- return (_annotationGrid_yIdx = annotationGrid[yIdx]) === null || _annotationGrid_yIdx === void 0 ? void 0 : _annotationGrid_yIdx[xIdx];
2037
- };
2038
- if (firstData.type === 'histogram2d') {
2039
- var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
2040
- const xValues = [];
2041
- const yValues = [];
2042
- const zValues = [];
2043
- (_firstData_x = firstData.x) === null || _firstData_x === void 0 ? void 0 : _firstData_x.forEach((xVal, index)=>{
2044
- var _firstData_y;
2045
- var _getNumberAtIndexOrDefault;
2046
- const zVal = (_getNumberAtIndexOrDefault = getNumberAtIndexOrDefault(firstData.z, index)) !== null && _getNumberAtIndexOrDefault !== void 0 ? _getNumberAtIndexOrDefault : 0;
2047
- if ((0, _chartutilities.isInvalidValue)(xVal) || (0, _chartutilities.isInvalidValue)((_firstData_y = firstData.y) === null || _firstData_y === void 0 ? void 0 : _firstData_y[index])) {
2048
- return;
2049
- }
2050
- xValues.push(xVal);
2051
- yValues.push(firstData.y[index]);
2052
- zValues.push(zVal);
2053
- });
2054
- const isXString = (0, _chartutilities.isStringArray)(xValues);
2055
- const isYString = (0, _chartutilities.isStringArray)(yValues);
2056
- const xBins = createBins(xValues, (_firstData_xbins = firstData.xbins) === null || _firstData_xbins === void 0 ? void 0 : _firstData_xbins.start, (_firstData_xbins1 = firstData.xbins) === null || _firstData_xbins1 === void 0 ? void 0 : _firstData_xbins1.end, (_firstData_xbins2 = firstData.xbins) === null || _firstData_xbins2 === void 0 ? void 0 : _firstData_xbins2.size);
2057
- const yBins = createBins(yValues, (_firstData_ybins = firstData.ybins) === null || _firstData_ybins === void 0 ? void 0 : _firstData_ybins.start, (_firstData_ybins1 = firstData.ybins) === null || _firstData_ybins1 === void 0 ? void 0 : _firstData_ybins1.end, (_firstData_ybins2 = firstData.ybins) === null || _firstData_ybins2 === void 0 ? void 0 : _firstData_ybins2.size);
2058
- const zBins = yBins.map(()=>xBins.map(()=>[]));
2059
- let total = 0;
2060
- xValues.forEach((xVal, index)=>{
2061
- const xBinIdx = findBinIndex(xBins, xVal, isXString);
2062
- const yBinIdx = findBinIndex(yBins, yValues[index], isYString);
2063
- if (xBinIdx !== -1 && yBinIdx !== -1) {
2064
- zBins[yBinIdx][xBinIdx].push(zValues[index]);
2065
- }
2066
- });
2067
- const z = zBins.map((row)=>{
2068
- return row.map((bin)=>{
2069
- const zVal = calculateHistFunc(firstData.histfunc, bin);
2070
- total += zVal;
2071
- return zVal;
2072
- });
2073
- });
2074
- xBins.forEach((xBin, xIdx)=>{
2075
- yBins.forEach((yBin, yIdx)=>{
2076
- const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
2077
- const annotationText = getAnnotationByIndex(xIdx, yIdx);
2078
- heatmapDataPoints.push({
2079
- x: isXString ? xBin.join(', ') : getBinCenter(xBin),
2080
- y: isYString ? yBin.join(', ') : getBinCenter(yBin),
2081
- value: zVal,
2082
- rectText: annotationText || zVal
2083
- });
2084
- if (typeof zVal === 'number') {
2085
- zMin = Math.min(zMin, zVal);
2086
- zMax = Math.max(zMax, zVal);
2087
- }
2088
- });
2089
- });
2090
- } else {
2091
- var _zArray_;
2092
- // If x and y are not provided, generate indices based on z dimensions
2093
- const zArray = firstData.z;
2094
- const xValues = firstData.x;
2095
- const yValues = firstData.y;
2096
- var _zArray_length;
2097
- // Determine the dimensions from z array
2098
- const yLength = (_zArray_length = zArray === null || zArray === void 0 ? void 0 : zArray.length) !== null && _zArray_length !== void 0 ? _zArray_length : 0;
2099
- var _zArray__length;
2100
- 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;
2101
- // Use provided x/y values or generate indices
2102
- const xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({
2103
- length: xLength
2104
- }, (_, i)=>i);
2105
- const yData = yValues !== null && yValues !== void 0 ? yValues : Array.from({
2106
- length: yLength
2107
- }, (_, i)=>yLength - 1 - i);
2108
- xData.forEach((xVal, xIdx)=>{
2109
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2110
- yData.forEach((yVal, yIdx)=>{
2111
- var _zArray_yIdx, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
2112
- const zVal = zArray === null || zArray === void 0 ? void 0 : (_zArray_yIdx = zArray[yIdx]) === null || _zArray_yIdx === void 0 ? void 0 : _zArray_yIdx[xIdx];
2113
- const annotationText = getAnnotationByIndex(xIdx, yIdx);
2114
- heatmapDataPoints.push({
2115
- 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,
2116
- 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,
2117
- value: zVal,
2118
- rectText: annotationText || zVal
2119
- });
2120
- if (typeof zVal === 'number') {
2121
- zMin = Math.min(zMin, zVal);
2122
- zMax = Math.max(zMax, zVal);
2123
- }
2124
- });
2125
- });
2126
- }
2127
- var _firstData_name;
2128
- const heatmapData = {
2129
- legend: (_firstData_name = firstData.name) !== null && _firstData_name !== void 0 ? _firstData_name : '',
2130
- data: heatmapDataPoints,
2131
- value: 0
2132
- };
2133
- // Initialize domain and range to default values
2134
- const defaultDomain = [
2135
- zMin,
2136
- (zMax + zMin) / 2,
2137
- zMax
2138
- ];
2139
- const defaultRange = [
2140
- (0, _colors.getColorFromToken)(_colors.DataVizPalette.color1),
2141
- (0, _colors.getColorFromToken)(_colors.DataVizPalette.color2),
2142
- (0, _colors.getColorFromToken)(_colors.DataVizPalette.color3)
2143
- ];
2144
- var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
2145
- 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;
2146
- // determine if the types diverging, sequential or sequentialminus are present in colorscale
2147
- if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
2148
- const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
2149
- const isSequential = zMin >= 0; // Data is entirely positive
2150
- const isSequentialMinus = zMax <= 0; // Data is entirely negative
2151
- if (isDivergent) {
2152
- colorscale = colorscale === null || colorscale === void 0 ? void 0 : colorscale.diverging;
2153
- } else if (isSequential) {
2154
- colorscale = colorscale === null || colorscale === void 0 ? void 0 : colorscale.sequential;
2155
- } else if (isSequentialMinus) {
2156
- colorscale = colorscale === null || colorscale === void 0 ? void 0 : colorscale.sequentialminus;
2157
- }
2158
- }
2159
- const domainValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[0] * (zMax - zMin) + zMin) : defaultDomain;
2160
- const rangeValuesForColorScale = Array.isArray(colorscale) ? colorscale.map((arr)=>arr[1]) : defaultRange;
2161
- var _input_layout_height;
2162
- return {
2163
- data: [
2164
- heatmapData
2165
- ],
2166
- domainValuesForColorScale,
2167
- rangeValuesForColorScale,
2168
- hideLegend: true,
2169
- showYAxisLables: true,
2170
- sortOrder: 'none',
2171
- width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
2172
- 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,
2173
- hideTickOverlap: true,
2174
- noOfCharsToTruncate: 20,
2175
- showYAxisLablesTooltip: true,
2176
- ...getTitles(input.layout),
2177
- ...getAxisCategoryOrderProps([
2178
- firstData
2179
- ], input.layout),
2180
- ...getAxisTickProps(input.data, input.layout)
2181
- };
2182
- };
2183
- const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2184
- 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;
2185
- const { link, node } = input.data[0];
2186
- var _link_value;
2187
- const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
2188
- var _link_source, _link_target;
2189
- if ((0, _chartutilities.isInvalidValue)(val) || (0, _chartutilities.isInvalidValue)(link === null || link === void 0 ? void 0 : (_link_source = link.source) === null || _link_source === void 0 ? void 0 : _link_source[index]) || (0, _chartutilities.isInvalidValue)(link === null || link === void 0 ? void 0 : (_link_target = link.target) === null || _link_target === void 0 ? void 0 : _link_target[index])) {
2190
- return null;
2191
- }
2192
- return {
2193
- value: val,
2194
- source: link === null || link === void 0 ? void 0 : link.source[index],
2195
- target: link === null || link === void 0 ? void 0 : link.target[index]
2196
- };
2197
- }) // Filter out negative nodes, unequal nodes and self-references (circular links)
2198
- .filter((x)=>x !== null && x.source >= 0 && x.target >= 0 && x.source !== x.target);
2199
- const extractedNodeColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, node === null || node === void 0 ? void 0 : node.color, colorMap, isDarkTheme);
2200
- const extractedLinkColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, link === null || link === void 0 ? void 0 : link.color, colorMap, isDarkTheme);
2201
- const sankeyChartData = {
2202
- nodes: (_node_label = node.label) === null || _node_label === void 0 ? void 0 : _node_label.map((label, index)=>{
2203
- var _input_layout_template_layout, _input_layout_template, _input_layout;
2204
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedNodeColors, index, label, 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);
2205
- return {
2206
- nodeId: index,
2207
- name: label,
2208
- color
2209
- };
2210
- }),
2211
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2212
- links: validLinks.map((validLink, index)=>{
2213
- var _input_layout_template_layout, _input_layout_template, _input_layout;
2214
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedLinkColors, index, validLink.target, 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);
2215
- return {
2216
- ...validLink,
2217
- color
2218
- };
2219
- })
2220
- };
2221
- // const styles: SankeyChartProps['styles'] = {
2222
- // root: {
2223
- // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
2224
- // },
2225
- // };
2226
- const { chartTitle, titleStyles } = getTitles(input.layout);
2227
- var _input_layout_height;
2228
- return {
2229
- data: {
2230
- chartTitle,
2231
- SankeyChartData: sankeyChartData
2232
- },
2233
- width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
2234
- 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,
2235
- // TODO
2236
- // styles,
2237
- hideLegend: isMultiPlot || ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.showlegend) === false,
2238
- ...titleStyles ? {
2239
- titleStyles
2240
- } : {}
2241
- };
2242
- };
2243
- const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2244
- var _firstData_gauge, _input_layout_template_layout, _input_layout_template, _input_layout, _firstData_gauge_steps, _firstData_gauge1, _firstData_gauge_axis_range, _firstData_gauge_axis, _firstData_gauge2, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _firstData_gauge_axis1, _firstData_gauge3, _firstData_gauge_axis_range1, _firstData_gauge_axis2, _firstData_gauge4, _firstData_delta, _firstData_gauge_axis_range2, _firstData_gauge_axis3, _firstData_gauge5, _firstData_gauge_axis_range3, _firstData_gauge_axis4, _firstData_gauge6, _firstData_gauge_axis_range4, _firstData_gauge_axis5, _firstData_gauge7, _firstData_gauge_axis_range5, _firstData_gauge_axis6, _firstData_gauge8, _input_layout2, _input_layout3, _firstData_gauge_steps1, _firstData_gauge9;
2245
- const firstData = input.data[0];
2246
- const stepsColors = ((_firstData_gauge = firstData.gauge) === null || _firstData_gauge === void 0 ? void 0 : _firstData_gauge.steps) ? firstData.gauge.steps.map((step)=>step.color) : undefined;
2247
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, stepsColors, colorMap, isDarkTheme);
2248
- var _firstData_gauge_axis_range_, _firstData_value, _firstData_gauge_axis_range_1, _firstData_value1;
2249
- const segments = ((_firstData_gauge1 = firstData.gauge) === null || _firstData_gauge1 === void 0 ? void 0 : (_firstData_gauge_steps = _firstData_gauge1.steps) === null || _firstData_gauge_steps === void 0 ? void 0 : _firstData_gauge_steps.length) ? firstData.gauge.steps.map((step, index)=>{
2250
- var _input_layout_template_layout, _input_layout_template, _input_layout, _step_range, _step_range1;
2251
- const legend = step.name || `Segment ${index + 1}`;
2252
- const color = (0, _PlotlyColorAdapter.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);
2253
- return {
2254
- legend,
2255
- size: ((_step_range = step.range) === null || _step_range === void 0 ? void 0 : _step_range[1]) - ((_step_range1 = step.range) === null || _step_range1 === void 0 ? void 0 : _step_range1[0]),
2256
- color
2257
- };
2258
- }) : [
2259
- {
2260
- legend: 'Current',
2261
- size: (_firstData_value = firstData.value) !== null && _firstData_value !== void 0 ? _firstData_value : 0 - ((_firstData_gauge_axis_range_ = (_firstData_gauge2 = firstData.gauge) === null || _firstData_gauge2 === void 0 ? void 0 : (_firstData_gauge_axis = _firstData_gauge2.axis) === null || _firstData_gauge_axis === void 0 ? void 0 : (_firstData_gauge_axis_range = _firstData_gauge_axis.range) === null || _firstData_gauge_axis_range === void 0 ? void 0 : _firstData_gauge_axis_range[0]) !== null && _firstData_gauge_axis_range_ !== void 0 ? _firstData_gauge_axis_range_ : 0),
2262
- color: _getGaugeAxisColor((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, (_firstData_gauge3 = firstData.gauge) === null || _firstData_gauge3 === void 0 ? void 0 : (_firstData_gauge_axis1 = _firstData_gauge3.axis) === null || _firstData_gauge_axis1 === void 0 ? void 0 : _firstData_gauge_axis1.color, colorMap, isDarkTheme)
2263
- },
2264
- {
2265
- legend: 'Target',
2266
- size: ((_firstData_gauge_axis_range_1 = (_firstData_gauge4 = firstData.gauge) === null || _firstData_gauge4 === void 0 ? void 0 : (_firstData_gauge_axis2 = _firstData_gauge4.axis) === null || _firstData_gauge_axis2 === void 0 ? void 0 : (_firstData_gauge_axis_range1 = _firstData_gauge_axis2.range) === null || _firstData_gauge_axis_range1 === void 0 ? void 0 : _firstData_gauge_axis_range1[1]) !== null && _firstData_gauge_axis_range_1 !== void 0 ? _firstData_gauge_axis_range_1 : 100) - ((_firstData_value1 = firstData.value) !== null && _firstData_value1 !== void 0 ? _firstData_value1 : 0),
2267
- color: _colors.DataVizPalette.disabled
2268
- }
2269
- ];
2270
- let sublabel;
2271
- let sublabelColor;
2272
- if ((_firstData_delta = firstData.delta) === null || _firstData_delta === void 0 ? void 0 : _firstData_delta.reference) {
2273
- const diff = firstData.value - firstData.delta.reference;
2274
- if (diff >= 0) {
2275
- var _input_layout_template_layout2, _input_layout_template2, _input_layout4, _firstData_delta_increasing, _firstData_delta1, _input_layout_template_layout3, _input_layout_template3, _input_layout5;
2276
- sublabel = `\u25B2 ${diff}`;
2277
- const extractedIncreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_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_layout2 = _input_layout_template2.layout) === null || _input_layout_template_layout2 === void 0 ? void 0 : _input_layout_template_layout2.colorway, colorwayType, (_firstData_delta1 = firstData.delta) === null || _firstData_delta1 === void 0 ? void 0 : (_firstData_delta_increasing = _firstData_delta1.increasing) === null || _firstData_delta_increasing === void 0 ? void 0 : _firstData_delta_increasing.color, colorMap, isDarkTheme);
2278
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedIncreasingDeltaColors, 0, '', colorMap, (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template3 = _input_layout5.template) === null || _input_layout_template3 === void 0 ? void 0 : (_input_layout_template_layout3 = _input_layout_template3.layout) === null || _input_layout_template_layout3 === void 0 ? void 0 : _input_layout_template_layout3.colorway, isDarkTheme);
2279
- sublabelColor = color;
2280
- } else {
2281
- var _input_layout_template_layout4, _input_layout_template4, _input_layout6, _firstData_delta_decreasing, _firstData_delta2, _input_layout_template_layout5, _input_layout_template5, _input_layout7;
2282
- sublabel = `\u25BC ${Math.abs(diff)}`;
2283
- const extractedDecreasingDeltaColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : (_input_layout_template4 = _input_layout6.template) === null || _input_layout_template4 === void 0 ? void 0 : (_input_layout_template_layout4 = _input_layout_template4.layout) === null || _input_layout_template_layout4 === void 0 ? void 0 : _input_layout_template_layout4.colorway, colorwayType, (_firstData_delta2 = firstData.delta) === null || _firstData_delta2 === void 0 ? void 0 : (_firstData_delta_decreasing = _firstData_delta2.decreasing) === null || _firstData_delta_decreasing === void 0 ? void 0 : _firstData_delta_decreasing.color, colorMap, isDarkTheme);
2284
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedDecreasingDeltaColors, 0, '', colorMap, (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : (_input_layout_template5 = _input_layout7.template) === null || _input_layout_template5 === void 0 ? void 0 : (_input_layout_template_layout5 = _input_layout_template5.layout) === null || _input_layout_template_layout5 === void 0 ? void 0 : _input_layout_template_layout5.colorway, isDarkTheme);
2285
- sublabelColor = color;
2286
- }
2287
- }
2288
- const styles = {
2289
- sublabel: sublabelColor
2290
- };
2291
- const { chartTitle, titleStyles } = getTitles(input.layout);
2292
- var _firstData_value2, _input_layout_height;
2293
- return {
2294
- segments,
2295
- chartValue: (_firstData_value2 = firstData.value) !== null && _firstData_value2 !== void 0 ? _firstData_value2 : 0,
2296
- chartTitle,
2297
- sublabel,
2298
- // range values can be null
2299
- minValue: typeof ((_firstData_gauge5 = firstData.gauge) === null || _firstData_gauge5 === void 0 ? void 0 : (_firstData_gauge_axis3 = _firstData_gauge5.axis) === null || _firstData_gauge_axis3 === void 0 ? void 0 : (_firstData_gauge_axis_range2 = _firstData_gauge_axis3.range) === null || _firstData_gauge_axis_range2 === void 0 ? void 0 : _firstData_gauge_axis_range2[0]) === 'number' ? (_firstData_gauge6 = firstData.gauge) === null || _firstData_gauge6 === void 0 ? void 0 : (_firstData_gauge_axis4 = _firstData_gauge6.axis) === null || _firstData_gauge_axis4 === void 0 ? void 0 : (_firstData_gauge_axis_range3 = _firstData_gauge_axis4.range) === null || _firstData_gauge_axis_range3 === void 0 ? void 0 : _firstData_gauge_axis_range3[0] : undefined,
2300
- maxValue: typeof ((_firstData_gauge7 = firstData.gauge) === null || _firstData_gauge7 === void 0 ? void 0 : (_firstData_gauge_axis5 = _firstData_gauge7.axis) === null || _firstData_gauge_axis5 === void 0 ? void 0 : (_firstData_gauge_axis_range4 = _firstData_gauge_axis5.range) === null || _firstData_gauge_axis_range4 === void 0 ? void 0 : _firstData_gauge_axis_range4[1]) === 'number' ? (_firstData_gauge8 = firstData.gauge) === null || _firstData_gauge8 === void 0 ? void 0 : (_firstData_gauge_axis6 = _firstData_gauge8.axis) === null || _firstData_gauge_axis6 === void 0 ? void 0 : (_firstData_gauge_axis_range5 = _firstData_gauge_axis6.range) === null || _firstData_gauge_axis_range5 === void 0 ? void 0 : _firstData_gauge_axis_range5[1] : undefined,
2301
- chartValueFormat: ()=>{
2302
- var _firstData_value;
2303
- var _firstData_value_toString;
2304
- return (_firstData_value_toString = (_firstData_value = firstData.value) === null || _firstData_value === void 0 ? void 0 : _firstData_value.toString()) !== null && _firstData_value_toString !== void 0 ? _firstData_value_toString : '';
2305
- },
2306
- width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
2307
- 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 : 220,
2308
- // TODO
2309
- // styles,
2310
- 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',
2311
- styles,
2312
- roundCorners: true,
2313
- ...titleStyles ? {
2314
- titleStyles
2315
- } : {}
2316
- };
2317
- };
2318
- const cleanText = (text)=>{
2319
- return text.replace(/&lt;[^&]*?&gt;/g, '').replace(/<[^>]*>/g, '').replace(/&lt;br&gt;|\\u003cbr\\u003e|<br>/gi, '').replace(/\$[^$]*\$/g, '$').trim();
2320
- };
2321
- const formatValue = (value, colIndex, cells)=>{
2322
- if (value === null || typeof value === 'boolean') {
2323
- return value;
2324
- }
2325
- const formatStr = Array.isArray(cells.format) ? cells.format[colIndex] : cells.format;
2326
- const prefix = Array.isArray(cells.prefix) ? cells.prefix[colIndex] : cells.prefix;
2327
- const suffix = Array.isArray(cells.suffix) ? cells.suffix[colIndex] : cells.suffix;
2328
- let formatted = value;
2329
- if (typeof value === 'number') {
2330
- if (typeof formatStr === 'string') {
2331
- try {
2332
- formatted = (0, _d3format.format)(formatStr)(value);
2333
- } catch {
2334
- formatted = (0, _utilities.formatScientificLimitWidth)(value);
2335
- }
2336
- } else {
2337
- formatted = (0, _utilities.formatScientificLimitWidth)(value);
2338
- }
2339
- }
2340
- return `${prefix !== null && prefix !== void 0 ? prefix : ''}${formatted}${suffix !== null && suffix !== void 0 ? suffix : ''}`;
2341
- };
2342
- function resolveCellStyle(raw, rowIndex, colIndex) {
2343
- if (Array.isArray(raw)) {
2344
- var _raw_colIndex;
2345
- const rowEntry = (_raw_colIndex = raw[colIndex]) !== null && _raw_colIndex !== void 0 ? _raw_colIndex : raw[0];
2346
- if (Array.isArray(rowEntry)) {
2347
- var _rowEntry_rowIndex;
2348
- return (_rowEntry_rowIndex = rowEntry[rowIndex]) !== null && _rowEntry_rowIndex !== void 0 ? _rowEntry_rowIndex : rowEntry[0];
2349
- }
2350
- return rowEntry;
2351
- }
2352
- return raw;
2353
- }
2354
- function mergeCells(tableCells, templateCells) {
2355
- var _tableCells_values, _ref, _tableCells_align, _templateCells_fill, _tableCells_fill, _templateCells_font, _tableCells_font, _tableCells_format, _tableCells_prefix, _tableCells_suffix;
2356
- return {
2357
- values: (_ref = (_tableCells_values = tableCells === null || tableCells === void 0 ? void 0 : tableCells.values) !== null && _tableCells_values !== void 0 ? _tableCells_values : templateCells === null || templateCells === void 0 ? void 0 : templateCells.values) !== null && _ref !== void 0 ? _ref : [],
2358
- align: (_tableCells_align = tableCells === null || tableCells === void 0 ? void 0 : tableCells.align) !== null && _tableCells_align !== void 0 ? _tableCells_align : templateCells === null || templateCells === void 0 ? void 0 : templateCells.align,
2359
- fill: {
2360
- ...(_templateCells_fill = templateCells === null || templateCells === void 0 ? void 0 : templateCells.fill) !== null && _templateCells_fill !== void 0 ? _templateCells_fill : {},
2361
- ...(_tableCells_fill = tableCells === null || tableCells === void 0 ? void 0 : tableCells.fill) !== null && _tableCells_fill !== void 0 ? _tableCells_fill : {}
2362
- },
2363
- font: {
2364
- ...(_templateCells_font = templateCells === null || templateCells === void 0 ? void 0 : templateCells.font) !== null && _templateCells_font !== void 0 ? _templateCells_font : {},
2365
- ...(_tableCells_font = tableCells === null || tableCells === void 0 ? void 0 : tableCells.font) !== null && _tableCells_font !== void 0 ? _tableCells_font : {}
2366
- },
2367
- format: (_tableCells_format = tableCells === null || tableCells === void 0 ? void 0 : tableCells.format) !== null && _tableCells_format !== void 0 ? _tableCells_format : templateCells === null || templateCells === void 0 ? void 0 : templateCells.format,
2368
- prefix: (_tableCells_prefix = tableCells === null || tableCells === void 0 ? void 0 : tableCells.prefix) !== null && _tableCells_prefix !== void 0 ? _tableCells_prefix : templateCells === null || templateCells === void 0 ? void 0 : templateCells.prefix,
2369
- suffix: (_tableCells_suffix = tableCells === null || tableCells === void 0 ? void 0 : tableCells.suffix) !== null && _tableCells_suffix !== void 0 ? _tableCells_suffix : templateCells === null || templateCells === void 0 ? void 0 : templateCells.suffix
2370
- };
2371
- }
2372
- const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2373
- var _tableData_cells, _input_layout_template_data_table_, _input_layout_template_data_table, _input_layout_template_data, _input_layout_template, _input_layout, _input_layout_font, _input_layout1, _input_layout_template_data_table_1, _input_layout_template_data_table1, _input_layout_template_data1, _input_layout_template1, _input_layout2, _tableData_header, _input_layout3, _input_layout4;
2374
- const tableData = input.data[0];
2375
- const normalizeHeaders = (values, header)=>{
2376
- const cleanedValues = Array.isArray(values[0]) ? values.map((row)=>row.map((cell)=>cleanText(cell)).filter(Boolean).join(' ')) : values.map((cell)=>cleanText(cell));
2377
- return cleanedValues.map((value, colIndex)=>{
2378
- var _header_font, _header_font1, _header_fill;
2379
- //headers are at first row only
2380
- const rowIndex = 0;
2381
- const fontColor = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_font = header.font) === null || _header_font === void 0 ? void 0 : _header_font.color, rowIndex, colIndex);
2382
- const fontSize = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_font1 = header.font) === null || _header_font1 === void 0 ? void 0 : _header_font1.size, rowIndex, colIndex);
2383
- const backgroundColor = resolveCellStyle(header === null || header === void 0 ? void 0 : (_header_fill = header.fill) === null || _header_fill === void 0 ? void 0 : _header_fill.color, rowIndex, colIndex);
2384
- const textAlign = resolveCellStyle(header === null || header === void 0 ? void 0 : header.align, rowIndex, colIndex);
2385
- const style = {
2386
- ...typeof fontColor === 'string' ? {
2387
- color: fontColor
2388
- } : {},
2389
- ...typeof fontSize === 'number' ? {
2390
- fontSize
2391
- } : {},
2392
- ...typeof backgroundColor === 'string' ? {
2393
- backgroundColor
2394
- } : {},
2395
- ...textAlign ? {
2396
- textAlign
2397
- } : {}
2398
- };
2399
- return {
2400
- value,
2401
- style
2402
- };
2403
- });
2404
- };
2405
- var _tableData_cells_values;
2406
- const columns = (_tableData_cells_values = (_tableData_cells = tableData.cells) === null || _tableData_cells === void 0 ? void 0 : _tableData_cells.values) !== null && _tableData_cells_values !== void 0 ? _tableData_cells_values : [];
2407
- const cells = mergeCells(tableData.cells, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_table = _input_layout_template_data.table) === null || _input_layout_template_data_table === void 0 ? void 0 : (_input_layout_template_data_table_ = _input_layout_template_data_table[0]) === null || _input_layout_template_data_table_ === void 0 ? void 0 : _input_layout_template_data_table_.cells);
2408
- const rows = columns[0].map((_, rowIndex)=>columns.map((col, colIndex)=>{
2409
- var _cells_font, _cells_font1, _cells_fill;
2410
- const cellValue = col[rowIndex];
2411
- const cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
2412
- const formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number' ? formatValue(cleanValue, colIndex, cells) : cleanValue;
2413
- const fontColor = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_font = cells.font) === null || _cells_font === void 0 ? void 0 : _cells_font.color, rowIndex, colIndex);
2414
- const fontSize = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_font1 = cells.font) === null || _cells_font1 === void 0 ? void 0 : _cells_font1.size, rowIndex, colIndex);
2415
- const backgroundColor = resolveCellStyle(cells === null || cells === void 0 ? void 0 : (_cells_fill = cells.fill) === null || _cells_fill === void 0 ? void 0 : _cells_fill.color, rowIndex, colIndex);
2416
- const textAlign = resolveCellStyle(cells === null || cells === void 0 ? void 0 : cells.align, rowIndex, colIndex);
2417
- const style = {
2418
- ...fontColor ? {
2419
- color: fontColor
2420
- } : {},
2421
- ...typeof fontSize === 'number' ? {
2422
- fontSize
2423
- } : {},
2424
- ...backgroundColor ? {
2425
- backgroundColor
2426
- } : {},
2427
- ...textAlign ? {
2428
- textAlign
2429
- } : {}
2430
- };
2431
- return {
2432
- value: formattedValue,
2433
- style
2434
- };
2435
- }));
2436
- const styles = {
2437
- root: {
2438
- ...((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_font = _input_layout1.font) === null || _input_layout_font === void 0 ? void 0 : _input_layout_font.size) ? {
2439
- fontSize: input.layout.font.size
2440
- } : {}
2441
- }
2442
- };
2443
- const templateHeader = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_template1 = _input_layout2.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template1.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_table1 = _input_layout_template_data1.table) === null || _input_layout_template_data_table1 === void 0 ? void 0 : (_input_layout_template_data_table_1 = _input_layout_template_data_table1[0]) === null || _input_layout_template_data_table_1 === void 0 ? void 0 : _input_layout_template_data_table_1.header;
2444
- const tableHeader = tableData.header;
2445
- var _tableHeader_align, _templateHeader_fill, _tableHeader_fill, _templateHeader_font, _tableHeader_font, _tableHeader_values, _ref;
2446
- const header = {
2447
- align: (_tableHeader_align = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.align) !== null && _tableHeader_align !== void 0 ? _tableHeader_align : templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.align,
2448
- fill: {
2449
- ...(_templateHeader_fill = templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.fill) !== null && _templateHeader_fill !== void 0 ? _templateHeader_fill : {},
2450
- ...(_tableHeader_fill = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.fill) !== null && _tableHeader_fill !== void 0 ? _tableHeader_fill : {}
2451
- },
2452
- font: {
2453
- ...(_templateHeader_font = templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.font) !== null && _templateHeader_font !== void 0 ? _templateHeader_font : {},
2454
- ...(_tableHeader_font = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.font) !== null && _tableHeader_font !== void 0 ? _tableHeader_font : {}
2455
- },
2456
- 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 : []
2457
- };
2458
- const { chartTitle, titleStyles } = getTitles(input.layout);
2459
- var _tableData_header_values;
2460
- return {
2461
- 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),
2462
- rows,
2463
- width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
2464
- height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
2465
- styles,
2466
- chartTitle,
2467
- ...titleStyles ? {
2468
- titleStyles
2469
- } : {}
2470
- };
2471
- };
2472
- function getCategoriesAndValues(series) {
2473
- const orientation = series.orientation || 'h';
2474
- var _series_labels, _ref;
2475
- const y = (_ref = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref !== void 0 ? _ref : series.stage;
2476
- var _series_values, _ref1;
2477
- const x = (_ref1 = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : series.x) !== null && _ref1 !== void 0 ? _ref1 : series.value;
2478
- const xIsString = (0, _chartutilities.isStringArray)(x);
2479
- const yIsString = (0, _chartutilities.isStringArray)(y);
2480
- const xIsNumber = (0, _chartutilities.isNumberArray)(x);
2481
- const yIsNumber = (0, _chartutilities.isNumberArray)(y);
2482
- // Helper to ensure array of (string | number)
2483
- const toArray = (arr)=>{
2484
- if (Array.isArray(arr)) {
2485
- return arr;
2486
- }
2487
- if (typeof arr === 'string' || typeof arr === 'number') {
2488
- return [
2489
- arr
2490
- ];
2491
- }
2492
- return [];
2493
- };
2494
- if (orientation === 'h') {
2495
- if (yIsString && xIsNumber) {
2496
- return {
2497
- categories: toArray(y),
2498
- values: toArray(x)
2499
- };
2500
- } else if (xIsString && yIsNumber) {
2501
- return {
2502
- categories: toArray(x),
2503
- values: toArray(y)
2504
- };
2505
- } else {
2506
- return {
2507
- categories: yIsString ? toArray(y) : toArray(x),
2508
- values: yIsString ? toArray(x) : toArray(y)
2509
- };
2510
- }
2511
- } else {
2512
- if (xIsString && yIsNumber) {
2513
- return {
2514
- categories: toArray(x),
2515
- values: toArray(y)
2516
- };
2517
- } else if (yIsString && xIsNumber) {
2518
- return {
2519
- categories: toArray(y),
2520
- values: toArray(x)
2521
- };
2522
- } else {
2523
- return {
2524
- categories: xIsString ? toArray(x) : toArray(y),
2525
- values: xIsString ? toArray(y) : toArray(x)
2526
- };
2527
- }
2528
- }
2529
- }
2530
- const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2531
- var _input_layout, _input_layout1, _input_data_, _input_layout2;
2532
- const funnelData = [];
2533
- // Determine if data is stacked based on multiple series with multiple values per series
2534
- const isStacked = input.data.length > 1 && input.data.every((series)=>{
2535
- var _series_values, _ref;
2536
- const values = (_ref = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : series.x) !== null && _ref !== void 0 ? _ref : series.value;
2537
- var _series_labels, _ref1;
2538
- const labels = (_ref1 = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref1 !== void 0 ? _ref1 : series.stage;
2539
- return Array.isArray(labels) && Array.isArray(values) && values.length > 1 && labels.length > 1;
2540
- });
2541
- if (isStacked) {
2542
- // Assign a color per series/category and use it for all subValues of that category
2543
- const seriesColors = {};
2544
- input.data.forEach((series, seriesIdx)=>{
2545
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1, _input_layout_template_layout1, _input_layout_template1, _input_layout1;
2546
- const category = series.name || `Category ${seriesIdx + 1}`;
2547
- var _series_marker_colors;
2548
- // Use the same color for this category across all stages
2549
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
2550
- // Always use the first color for the series/category
2551
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, 0, category, 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);
2552
- seriesColors[category] = color;
2553
- var _series_labels, _ref;
2554
- const labels = (_ref = (_series_labels = series.labels) !== null && _series_labels !== void 0 ? _series_labels : series.y) !== null && _ref !== void 0 ? _ref : series.stage;
2555
- var _series_values, _ref1;
2556
- const values = (_ref1 = (_series_values = series.values) !== null && _series_values !== void 0 ? _series_values : series.x) !== null && _ref1 !== void 0 ? _ref1 : series.value;
2557
- if (!(0, _chartutilities.isArrayOrTypedArray)(labels) || !(0, _chartutilities.isArrayOrTypedArray)(values)) {
2558
- return;
2559
- }
2560
- if (labels && (0, _chartutilities.isArrayOrTypedArray)(labels) && labels.length > 0) {
2561
- labels.forEach((label, i)=>{
2562
- const stageIndex = funnelData.findIndex((stage)=>stage.stage === label);
2563
- const valueNum = Number(values[i]);
2564
- if (isNaN(valueNum)) {
2565
- return;
2566
- }
2567
- if (stageIndex === -1) {
2568
- funnelData.push({
2569
- stage: label,
2570
- subValues: [
2571
- {
2572
- category,
2573
- value: valueNum,
2574
- color
2575
- }
2576
- ]
2577
- });
2578
- } else {
2579
- funnelData[stageIndex].subValues.push({
2580
- category,
2581
- value: valueNum,
2582
- color
2583
- });
2584
- }
2585
- });
2586
- }
2587
- });
2588
- } else {
2589
- // Non-stacked data handling (multiple series with single-value arrays)
2590
- input.data.forEach((series, seriesIdx)=>{
2591
- var _input_layout_template_layout, _input_layout_template, _input_layout, _series_marker, _series_marker1;
2592
- const { categories, values } = getCategoriesAndValues(series);
2593
- if (!(0, _chartutilities.isArrayOrTypedArray)(categories) || !(0, _chartutilities.isArrayOrTypedArray)(values)) {
2594
- return;
2595
- }
2596
- var _series_marker_colors;
2597
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker_colors = (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.colors) !== null && _series_marker_colors !== void 0 ? _series_marker_colors : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color, colorMap, isDarkTheme);
2598
- categories.forEach((label, i)=>{
2599
- var _input_layout_template_layout, _input_layout_template, _input_layout;
2600
- const color = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, label, 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);
2601
- const valueNum = Number(values[i]);
2602
- if (isNaN(valueNum)) {
2603
- return;
2604
- }
2605
- funnelData.push({
2606
- stage: label,
2607
- value: valueNum,
2608
- color
2609
- });
2610
- });
2611
- });
2612
- }
2613
- const { chartTitle, titleStyles } = getTitles(input.layout);
2614
- return {
2615
- data: funnelData,
2616
- chartTitle,
2617
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2618
- height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
2619
- orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
2620
- hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false,
2621
- ...titleStyles ? {
2622
- titleStyles
2623
- } : {}
2624
- };
2625
- };
2626
- const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2627
- var _input_layout, _input_layout1;
2628
- const polarData = [];
2629
- const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
2630
- const resolveRValue = getAxisValueResolver(getPolarAxis(input.data, 'r', input.layout)._type);
2631
- input.data.forEach((series, index)=>{
2632
- const legend = legends[index];
2633
- if (series.type === 'scatterpolar') {
2634
- 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;
2635
- const isAreaTrace = series.fill === 'toself' || series.fill === 'tonext';
2636
- const isLineTrace = typeof series.mode === 'undefined' ? true : series.mode.includes('lines');
2637
- 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;
2638
- const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
2639
- const seriesColor = (0, _PlotlyColorAdapter.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);
2640
- const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
2641
- const finalSeriesColor = (0, _d3color.rgb)(seriesColor).copy({
2642
- opacity: seriesOpacity
2643
- }).formatHex8();
2644
- const lineOptions = getLineOptions(series.line);
2645
- const thetaUnit = series.thetaunit;
2646
- const commonProps = {
2647
- legend,
2648
- legendShape: getLegendShape(series),
2649
- color: finalSeriesColor,
2650
- data: ((_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.map((r, rIndex)=>{
2651
- var _series_theta, _series_marker, _series_marker1, _input_layout_template_layout, _input_layout_template, _input_layout;
2652
- const theta = (_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[rIndex];
2653
- 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;
2654
- const text = Array.isArray(series.text) ? series.text[rIndex] : series.text;
2655
- const markerColor = (0, _PlotlyColorAdapter.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);
2656
- const markerOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, rIndex);
2657
- if ((0, _chartutilities.isInvalidValue)(resolveRValue(r)) || (0, _chartutilities.isInvalidValue)(theta)) {
2658
- return;
2659
- }
2660
- return {
2661
- r: resolveRValue(r),
2662
- theta: typeof theta === 'number' ? thetaUnit === 'radians' ? theta * 180 / Math.PI : thetaUnit === 'gradians' ? theta * 0.9 : theta : theta,
2663
- color: markerColor ? (0, _d3color.rgb)(markerColor).copy({
2664
- opacity: markerOpacity
2665
- }).formatHex8() : finalSeriesColor,
2666
- ...typeof markerSize !== 'undefined' ? {
2667
- markerSize
2668
- } : {},
2669
- ...typeof text !== 'undefined' ? {
2670
- text
2671
- } : {}
2672
- };
2673
- }).filter((item)=>typeof item !== 'undefined')) || []
2674
- };
2675
- if (isAreaTrace || isLineTrace) {
2676
- polarData.push({
2677
- type: isAreaTrace ? 'areapolar' : 'linepolar',
2678
- ...commonProps,
2679
- lineOptions
2680
- });
2681
- } else {
2682
- polarData.push({
2683
- type: 'scatterpolar',
2684
- ...commonProps
2685
- });
2686
- }
2687
- }
2688
- });
2689
- var _input_layout_height;
2690
- return {
2691
- data: polarData,
2692
- width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2693
- 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,
2694
- hideLegend,
2695
- ...getPolarAxisProps(input.data, input.layout)
2696
- };
2697
- };
2698
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2699
- function isPlainObject(obj) {
2700
- return Object.prototype.toString.call(obj) === '[object Object]' && Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty');
2701
- }
2702
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2703
- var arrayAttributes = [];
2704
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2705
- var stack = [];
2706
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2707
- var isArrayStack = [];
2708
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2709
- var baseContainer, baseAttrName;
2710
- function findArrayAttributes(trace) {
2711
- // Init basecontainer and baseAttrName
2712
- crawlIntoTrace(baseContainer, 0, '');
2713
- }
2714
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2715
- function crawlIntoTrace(container, i, astrPartial) {
2716
- var item = container[stack[i]];
2717
- var newAstrPartial = astrPartial + stack[i];
2718
- if (i === stack.length - 1) {
2719
- if ((0, _chartutilities.isArrayOrTypedArray)(item)) {
2720
- arrayAttributes.push(baseAttrName + newAstrPartial);
2721
- }
2722
- } else {
2723
- if (isArrayStack[i]) {
2724
- if (Array.isArray(item)) {
2725
- for(var j = 0; j < item.length; j++){
2726
- if (isPlainObject(item[j])) {
2727
- crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');
2728
- }
2729
- }
2730
- }
2731
- } else if (isPlainObject(item)) {
2732
- crawlIntoTrace(item, i + 1, newAstrPartial + '.');
2733
- }
2734
- }
2735
- }
2736
- function getLineOptions(line) {
2737
- if (!line) {
2738
- return;
2739
- }
2740
- let lineOptions = {};
2741
- if (line.dash) {
2742
- lineOptions = {
2743
- ...lineOptions,
2744
- ...dashOptions[line.dash]
2745
- };
2746
- }
2747
- switch(line.shape){
2748
- case 'spline':
2749
- const smoothing = typeof line.smoothing === 'number' ? line.smoothing : 1;
2750
- lineOptions.curve = _d3shape.curveCardinal.tension(1 - smoothing / 1.3);
2751
- break;
2752
- case 'hv':
2753
- lineOptions.curve = 'stepAfter';
2754
- break;
2755
- case 'vh':
2756
- lineOptions.curve = 'stepBefore';
2757
- break;
2758
- case 'hvh':
2759
- lineOptions.curve = 'step';
2760
- break;
2761
- default:
2762
- lineOptions.curve = 'linear';
2763
- }
2764
- return Object.keys(lineOptions).length > 0 ? lineOptions : undefined;
2765
- }
2766
- // TODO: Use binary search to find the appropriate bin for numeric value.
2767
- const findBinIndex = (bins, value, isString)=>{
2768
- if (typeof value === 'undefined' || value === null) {
2769
- return -1;
2770
- }
2771
- return isString ? bins.findIndex((bin)=>bin.includes(value)) : bins.findIndex((bin, index)=>value >= bin.x0 && (index === bins.length - 1 ? value <= bin.x1 : value < bin.x1));
2772
- };
2773
- const getBinSize = (bin)=>{
2774
- return bin.x1 - bin.x0;
2775
- };
2776
- const getBinCenter = (bin)=>{
2777
- return (bin.x1 + bin.x0) / 2;
2778
- };
2779
- // TODO: Add support for date axes
2780
- const createBins = (data, binStart, binEnd, binSize)=>{
2781
- if (!data || data.length === 0) {
2782
- return [];
2783
- }
2784
- if ((0, _chartutilities.isStringArray)(data)) {
2785
- const categories = Array.from(new Set(data));
2786
- const start = typeof binStart === 'number' ? Math.ceil(binStart) : 0;
2787
- const stop = typeof binEnd === 'number' ? Math.floor(binEnd) + 1 : categories.length;
2788
- const step = typeof binSize === 'number' ? binSize : 1;
2789
- return (0, _d3array.range)(start, stop, step).map((i)=>categories.slice(i, i + step));
2790
- }
2791
- const scale = (0, _d3scale.scaleLinear)().domain((0, _d3array.extent)(data)).nice();
2792
- let [minVal, maxVal] = scale.domain();
2793
- minVal = typeof binStart === 'number' ? binStart : minVal;
2794
- maxVal = typeof binEnd === 'number' ? binEnd : maxVal;
2795
- const binGenerator = (0, _d3array.bin)().domain([
2796
- minVal,
2797
- maxVal
2798
- ]);
2799
- if (typeof binSize === 'number' && binSize > 0) {
2800
- const thresholds = [];
2801
- const precision = Math.max((0, _utilities.calculatePrecision)(minVal), (0, _utilities.calculatePrecision)(binSize));
2802
- let th = (0, _utilities.precisionRound)(minVal, precision);
2803
- while(th < (0, _utilities.precisionRound)(maxVal + binSize, precision)){
2804
- thresholds.push(th);
2805
- th = (0, _utilities.precisionRound)(th + binSize, precision);
2806
- }
2807
- minVal = thresholds[0];
2808
- maxVal = thresholds[thresholds.length - 1];
2809
- binGenerator.domain([
2810
- minVal,
2811
- maxVal
2812
- ]).thresholds(thresholds);
2813
- // When the domain ends at the last threshold (maxVal), d3Bin creates an extra final bin where
2814
- // both x0 and x1 are equal to maxVal and inclusive. The previous bin also has x1 equal to maxVal,
2815
- // but it is exclusive. To maintain consistent bin widths, remove the final bin,
2816
- // making the previous bin the last one, with both x0 and x1 inclusive.
2817
- return binGenerator(data).slice(0, -1);
2818
- }
2819
- return binGenerator(data);
2820
- };
2821
- const calculateHistFunc = (histfunc, bin)=>{
2822
- switch(histfunc){
2823
- case 'sum':
2824
- return (0, _d3array.sum)(bin);
2825
- case 'avg':
2826
- return bin.length === 0 ? 0 : (0, _d3array.sum)(bin) / bin.length;
2827
- case 'min':
2828
- var _d3Min;
2829
- return (_d3Min = (0, _d3array.min)(bin)) !== null && _d3Min !== void 0 ? _d3Min : 0;
2830
- case 'max':
2831
- var _d3Max;
2832
- return (_d3Max = (0, _d3array.max)(bin)) !== null && _d3Max !== void 0 ? _d3Max : 0;
2833
- default:
2834
- return bin.length;
2835
- }
2836
- };
2837
- const calculateHistNorm = (histnorm, value, total, dx, dy = 1)=>{
2838
- switch(histnorm){
2839
- case 'percent':
2840
- return total === 0 ? 0 : value / total * 100;
2841
- case 'probability':
2842
- return total === 0 ? 0 : value / total;
2843
- case 'density':
2844
- return dx * dy === 0 ? 0 : value / (dx * dy);
2845
- case 'probability density':
2846
- return total * dx * dy === 0 ? 0 : value / (total * dx * dy);
2847
- default:
2848
- return value;
2849
- }
2850
- };
2851
- const getLegendShape = (series)=>{
2852
- var _series_line, _series_mode;
2853
- const dashType = ((_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.dash) || 'solid';
2854
- if (dashType === 'dot' || dashType === 'dash' || dashType === 'dashdot') {
2855
- return 'dottedLine';
2856
- } else if ((_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('markers')) {
2857
- return 'circle';
2858
- }
2859
- return 'default';
2860
- };
2861
- const getAllupLegendsProps = (input, colorMap, colorwayType, traceInfo, isDarkTheme)=>{
2862
- const allupLegends = [];
2863
- // reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
2864
- const toShowLegend = input.data.reduce((acc, series)=>{
2865
- return acc || series.showlegend === true || series.showlegend === undefined;
2866
- }, false);
2867
- if (toShowLegend) {
2868
- input.data.forEach((series, index)=>{
2869
- if (traceInfo[index].type === 'donut') {
2870
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1, _input_layout2, _pieSeries_marker;
2871
- const pieSeries = series;
2872
- var _input_layout_piecolorway, _input_layout_piecolorway1;
2873
- const colors = (0, _PlotlyColorAdapter.extractColor)((_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_input_layout_piecolorway1 = (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.piecolorway) !== null && _input_layout_piecolorway1 !== void 0 ? _input_layout_piecolorway1 : pieSeries === null || pieSeries === void 0 ? void 0 : (_pieSeries_marker = pieSeries.marker) === null || _pieSeries_marker === void 0 ? void 0 : _pieSeries_marker.colors, colorMap, isDarkTheme, true);
2874
- if ((0, _chartutilities.isArrayOrTypedArray)(pieSeries.labels)) {
2875
- pieSeries.labels.forEach((label, labelIndex)=>{
2876
- var _input_layout, _input_layout_template_layout, _input_layout_template, _input_layout1;
2877
- const legend = `${label}`;
2878
- var _input_layout_piecolorway;
2879
- // resolve color for each legend from the extracted colors
2880
- const color = (0, _PlotlyColorAdapter.resolveColor)(colors, labelIndex, legend, colorMap, (_input_layout_piecolorway = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.piecolorway) !== null && _input_layout_piecolorway !== void 0 ? _input_layout_piecolorway : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template = _input_layout1.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme, true);
2881
- if (legend !== '' && allupLegends.some((group)=>group.title === legend) === false) {
2882
- allupLegends.push({
2883
- title: legend,
2884
- color
2885
- });
2886
- }
2887
- });
2888
- }
2889
- } else if (isNonPlotType(traceInfo[index].type) === false) {
2890
- var _plotSeries_line, _plotSeries_marker, _input_layout_template_layout1, _input_layout_template1, _input_layout3;
2891
- const plotSeries = series;
2892
- const name = plotSeries.legendgroup;
2893
- const color = ((_plotSeries_line = plotSeries.line) === null || _plotSeries_line === void 0 ? void 0 : _plotSeries_line.color) || ((_plotSeries_marker = plotSeries.marker) === null || _plotSeries_marker === void 0 ? void 0 : _plotSeries_marker.color);
2894
- const legendShape = getLegendShape(plotSeries);
2895
- const resolvedColor = (0, _PlotlyColorAdapter.extractColor)((_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template1 = _input_layout3.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, colorwayType, color, colorMap, isDarkTheme);
2896
- if (name !== undefined && name !== '' && allupLegends.some((group)=>group.title === name) === false) {
2897
- allupLegends.push({
2898
- title: name,
2899
- color: resolvedColor,
2900
- shape: legendShape
2901
- });
2902
- }
2903
- }
2904
- });
2905
- }
2906
- return {
2907
- legends: allupLegends,
2908
- centerLegends: true,
2909
- enabledWrapLines: true,
2910
- canSelectMultipleLegends: true
2911
- };
2912
- };
2913
- const getLegendProps = (data, layout, isMultiPlot)=>{
2914
- const legends = [];
2915
- if (data.length === 1) {
2916
- legends.push(data[0].name || '');
2917
- } else {
2918
- data.forEach((series, index)=>{
2919
- legends.push(series.name || `Series ${index + 1}`);
2920
- });
2921
- }
2922
- const hideLegendsData = data.every((series)=>series.showlegend === false);
2923
- const hideLegendsInferred = (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || (layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2;
2924
- return {
2925
- legends,
2926
- hideLegend: isMultiPlot || hideLegendsInferred || hideLegendsData
2927
- };
2928
- };
2929
- const getNumberAtIndexOrDefault = (data, index)=>{
2930
- if ((0, _chartutilities.isArrayOrTypedArray)(data)) {
2931
- if (typeof data[index] !== 'number' || !isFinite(data[index])) {
2932
- return;
2933
- }
2934
- return data[index];
2935
- }
2936
- return 1;
2937
- };
2938
- const getValidXYRanges = (series, resolveX, resolveY)=>{
2939
- if (!(0, _chartutilities.isArrayOrTypedArray)(series.x) || !(0, _chartutilities.isArrayOrTypedArray)(series.y)) {
2940
- return [];
2941
- }
2942
- const ranges = [];
2943
- let start = 0;
2944
- let end = 0;
2945
- for(; end < series.x.length; end++){
2946
- if ((0, _chartutilities.isInvalidValue)(series.x[end]) || typeof resolveX === 'function' && (0, _chartutilities.isInvalidValue)(resolveX(series.x[end])) || (0, _chartutilities.isInvalidValue)(series.y[end]) || typeof resolveY === 'function' && (0, _chartutilities.isInvalidValue)(resolveY(series.y[end]))) {
2947
- if (end - start > 0) {
2948
- ranges.push([
2949
- start,
2950
- end
2951
- ]);
2952
- }
2953
- start = end + 1;
2954
- }
2955
- }
2956
- if (end - start > 0) {
2957
- ranges.push([
2958
- start,
2959
- end
2960
- ]);
2961
- }
2962
- return ranges;
2963
- };
2964
- const getIndexFromKey = (key, pattern)=>{
2965
- const normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
2966
- return parseInt(normalizedKey, 10) - 1;
2967
- };
2968
- const isNonPlotType = (chartType)=>{
2969
- return [
2970
- 'donut',
2971
- 'sankey',
2972
- 'pie',
2973
- 'annotation',
2974
- 'table',
2975
- 'gauge',
2976
- 'funnel'
2977
- ].includes(chartType);
2978
- };
2979
- const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2980
- const domainX = [];
2981
- const domainY = [];
2982
- let cartesianDomains = 0;
2983
- const annotations = {};
2984
- let templateRows = '1fr';
2985
- let templateColumns = '1fr';
2986
- const gridLayout = {};
2987
- if (!isMultiPlot) {
2988
- return {
2989
- templateRows,
2990
- templateColumns,
2991
- layout: gridLayout
2992
- };
2993
- }
2994
- const layout = schema === null || schema === void 0 ? void 0 : schema.layout;
2995
- if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
2996
- Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
2997
- if (key.startsWith('xaxis')) {
2998
- var _layout_key;
2999
- const index = getIndexFromKey(key, 'xaxis');
3000
- var _layout_key_anchor;
3001
- const anchor = (_layout_key_anchor = (_layout_key = layout[key]) === null || _layout_key === void 0 ? void 0 : _layout_key.anchor) !== null && _layout_key_anchor !== void 0 ? _layout_key_anchor : 'y';
3002
- const anchorIndex = getIndexFromKey(anchor, 'y');
3003
- if (index !== anchorIndex) {
3004
- throw new Error(`Invalid layout: xaxis ${index + 1} anchor should be y${anchorIndex + 1}`);
3005
- }
3006
- const xAxisLayout = layout[key];
3007
- const domainXInfo = {
3008
- start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
3009
- end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
3010
- cellName: `x${domainX.length === 0 ? '' : domainX.length + 1}`
3011
- };
3012
- domainX.push(domainXInfo);
3013
- } else if (key.startsWith('yaxis')) {
3014
- var _layout_key1;
3015
- const index = getIndexFromKey(key, 'yaxis');
3016
- var _layout_key_anchor1;
3017
- const anchor = (_layout_key_anchor1 = (_layout_key1 = layout[key]) === null || _layout_key1 === void 0 ? void 0 : _layout_key1.anchor) !== null && _layout_key_anchor1 !== void 0 ? _layout_key_anchor1 : 'x';
3018
- const anchorIndex = getIndexFromKey(anchor, 'x');
3019
- if (index !== anchorIndex) {
3020
- var _layout_yaxis2;
3021
- if (index === 1 && anchorIndex === 0 || ((_layout_yaxis2 = layout.yaxis2) === null || _layout_yaxis2 === void 0 ? void 0 : _layout_yaxis2.side) === 'right') {
3022
- // Special case for secondary y axis where yaxis2 can anchor to x1
3023
- return {
3024
- templateRows,
3025
- templateColumns
3026
- };
3027
- }
3028
- throw new Error(`Invalid layout: yaxis ${index + 1} anchor should be x${anchorIndex + 1}`);
3029
- }
3030
- const yAxisLayout = layout[key];
3031
- const domainYInfo = {
3032
- start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
3033
- end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
3034
- cellName: `x${domainY.length === 0 ? '' : domainY.length + 1}`
3035
- };
3036
- domainY.push(domainYInfo);
3037
- }
3038
- });
3039
- }
3040
- cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
3041
- validTracesInfo.forEach((trace, index)=>{
3042
- if (isNonPlotType(trace.type)) {
3043
- var _schema_data, _series_domain, _series_domain1, _series_domain2, _series_domain3;
3044
- const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
3045
- const domainXInfo = {
3046
- start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
3047
- end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1,
3048
- cellName: `${NON_PLOT_KEY_PREFIX}${domainX.length - cartesianDomains + 1}`
3049
- };
3050
- const domainYInfo = {
3051
- start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
3052
- end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1,
3053
- cellName: `${NON_PLOT_KEY_PREFIX}${domainY.length - cartesianDomains + 1}`
3054
- };
3055
- domainX.push(domainXInfo);
3056
- domainY.push(domainYInfo);
3057
- }
3058
- });
3059
- if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
3060
- var _layout_annotations;
3061
- Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
3062
- if (key.startsWith('polar')) {
3063
- var _polarLayout_domain, _polarLayout_domain1, _polarLayout_domain2, _polarLayout_domain3;
3064
- const polarLayout = layout[key];
3065
- const domainXInfo = {
3066
- start: ((_polarLayout_domain = polarLayout.domain) === null || _polarLayout_domain === void 0 ? void 0 : _polarLayout_domain.x) ? polarLayout.domain.x[0] : 0,
3067
- end: ((_polarLayout_domain1 = polarLayout.domain) === null || _polarLayout_domain1 === void 0 ? void 0 : _polarLayout_domain1.x) ? polarLayout.domain.x[1] : 1,
3068
- cellName: key
3069
- };
3070
- const domainYInfo = {
3071
- start: ((_polarLayout_domain2 = polarLayout.domain) === null || _polarLayout_domain2 === void 0 ? void 0 : _polarLayout_domain2.y) ? polarLayout.domain.y[0] : 0,
3072
- end: ((_polarLayout_domain3 = polarLayout.domain) === null || _polarLayout_domain3 === void 0 ? void 0 : _polarLayout_domain3.y) ? polarLayout.domain.y[1] : 1,
3073
- cellName: key
3074
- };
3075
- domainX.push(domainXInfo);
3076
- domainY.push(domainYInfo);
3077
- }
3078
- });
3079
- (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
3080
- 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 ? [
3081
- idx
3082
- ] : []);
3083
- const yMatch = domainY.findIndex((interval, yIndex)=>xMatches.includes(yIndex) && (annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval.end);
3084
- if (yMatch !== -1) {
3085
- if (annotations[yMatch] === undefined) {
3086
- annotations[yMatch] = {};
3087
- }
3088
- if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
3089
- annotations[yMatch].yAnnotation = annotation.text;
3090
- } else {
3091
- annotations[yMatch].xAnnotation = annotation.text;
3092
- }
3093
- }
3094
- });
3095
- }
3096
- if (domainX.length > 0) {
3097
- const uniqueXIntervals = new Map();
3098
- domainX.forEach((interval)=>{
3099
- const key = `${interval.start}-${interval.end}`;
3100
- if (!uniqueXIntervals.has(key)) {
3101
- uniqueXIntervals.set(key, interval);
3102
- }
3103
- });
3104
- const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
3105
- templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
3106
- domainX.forEach((interval, index)=>{
3107
- const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
3108
- const columnNumber = columnIndex + 1; // Column numbers are 1-based
3109
- const annotationProps = annotations[index];
3110
- const xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
3111
- const row = {
3112
- row: -1,
3113
- column: columnNumber,
3114
- xAnnotation,
3115
- xDomain: interval,
3116
- yDomain: {
3117
- start: 0,
3118
- end: 1
3119
- }
3120
- };
3121
- gridLayout[interval.cellName] = row;
3122
- });
3123
- }
3124
- if (domainY.length > 0) {
3125
- const uniqueYIntervals = new Map();
3126
- domainY.forEach((interval)=>{
3127
- const key = `${interval.start}-${interval.end}`;
3128
- if (!uniqueYIntervals.has(key)) {
3129
- uniqueYIntervals.set(key, interval);
3130
- }
3131
- });
3132
- const sortedYStart = Array.from(uniqueYIntervals.values()).map((interval)=>interval.start).sort();
3133
- const numberOfRows = sortedYStart.length;
3134
- templateRows = `repeat(${numberOfRows}, 1fr)`;
3135
- domainY.forEach((interval, index)=>{
3136
- const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
3137
- const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
3138
- const annotationProps = annotations[index];
3139
- const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
3140
- const cell = gridLayout[interval.cellName];
3141
- if (cell !== undefined) {
3142
- cell.row = rowNumber;
3143
- cell.yAnnotation = yAnnotation;
3144
- cell.yDomain = interval;
3145
- }
3146
- });
3147
- }
3148
- return {
3149
- templateRows,
3150
- templateColumns,
3151
- layout: gridLayout
3152
- };
3153
- };
3154
- /**
3155
- * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
3156
- */ const getAxisCategoryOrderProps = (data, layout)=>{
3157
- const result = {};
3158
- const axesById = {
3159
- x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
3160
- y: layout === null || layout === void 0 ? void 0 : layout.yaxis
3161
- };
3162
- Object.keys(axesById).forEach((axId)=>{
3163
- const ax = axesById[axId];
3164
- const axLetter = axId[0];
3165
- const propName = `${axLetter}AxisCategoryOrder`;
3166
- const values = [];
3167
- data.forEach((series)=>{
3168
- var _series_axLetter;
3169
- (_series_axLetter = series[axLetter]) === null || _series_axLetter === void 0 ? void 0 : _series_axLetter.forEach((val)=>{
3170
- if (!(0, _chartutilities.isInvalidValue)(val)) {
3171
- values.push(val);
3172
- }
3173
- });
3174
- });
3175
- const isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || (0, _chartutilities.isStringArray)(values) && !(0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isDateArray)(values);
3176
- if (!isAxisTypeCategory) {
3177
- result[propName] = 'data';
3178
- return;
3179
- }
3180
- const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
3181
- if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
3182
- result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? ax.categoryarray.slice().reverse() : ax.categoryarray;
3183
- return;
3184
- }
3185
- if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
3186
- const categoriesInTraceOrder = Array.from(new Set(values));
3187
- result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
3188
- return;
3189
- }
3190
- result[propName] = ax.categoryorder;
3191
- });
3192
- return result;
3193
- };
3194
- const getBarProps = (data, layout, isHorizontal)=>{
3195
- let padding;
3196
- if (typeof (layout === null || layout === void 0 ? void 0 : layout.bargap) === 'number') {
3197
- if (layout.bargap >= 0 && layout.bargap <= 1) {
3198
- padding = layout.bargap;
3199
- } else {
3200
- // Plotly uses a default bargap of 0.2, as noted here: https://github.com/plotly/plotly.js/blob/1d5a249e43dd31ae50acf02117a19e5ac97387e9/src/traces/bar/layout_defaults.js#L58.
3201
- // However, we don't use this value as our default padding because it causes the bars to
3202
- // appear disproportionately wide in large containers.
3203
- padding = 0.2;
3204
- }
3205
- }
3206
- const plotlyBarWidths = data.map((series)=>{
3207
- if (series.type === 'bar' && ((0, _chartutilities.isArrayOrTypedArray)(series.width) || typeof series.width === 'number')) {
3208
- return series.width;
3209
- }
3210
- return [];
3211
- }).flat();
3212
- const maxPlotlyBarWidth = (0, _d3array.max)(plotlyBarWidths);
3213
- if (typeof maxPlotlyBarWidth === 'number') {
3214
- padding = 1 - maxPlotlyBarWidth;
3215
- padding = Math.max(0, Math.min(padding, 1));
3216
- }
3217
- if (typeof padding === 'undefined') {
3218
- return {};
3219
- }
3220
- if (isHorizontal) {
3221
- return {
3222
- maxBarHeight: 1000,
3223
- yAxisPadding: padding
3224
- };
3225
- }
3226
- return {
3227
- barWidth: 'auto',
3228
- maxBarWidth: 1000,
3229
- xAxisInnerPadding: padding,
3230
- xAxisOuterPadding: padding / 2
3231
- };
3232
- };
3233
- const getAxisScaleTypeProps = (data, layout)=>{
3234
- var _axisObjects_x, _axisObjects_y, _axisObjects_y2;
3235
- const result = {};
3236
- const axisObjects = getAxisObjects(data, layout);
3237
- if (((_axisObjects_x = axisObjects.x) === null || _axisObjects_x === void 0 ? void 0 : _axisObjects_x.type) === 'log') {
3238
- result.xScaleType = 'log';
3239
- }
3240
- if (((_axisObjects_y = axisObjects.y) === null || _axisObjects_y === void 0 ? void 0 : _axisObjects_y.type) === 'log') {
3241
- result.yScaleType = 'log';
3242
- }
3243
- if (((_axisObjects_y2 = axisObjects.y2) === null || _axisObjects_y2 === void 0 ? void 0 : _axisObjects_y2.type) === 'log') {
3244
- result.secondaryYScaleType = 'log';
3245
- }
3246
- return result;
3247
- };
3248
- /**
3249
- * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/tick_value_defaults.js#L8}
3250
- */ const getAxisTickProps = (data, layout)=>{
3251
- const props = {};
3252
- const axisObjects = getAxisObjects(data, layout);
3253
- Object.keys(axisObjects).forEach((axId)=>{
3254
- const ax = axisObjects[axId];
3255
- if (!ax) {
3256
- return;
3257
- }
3258
- const axType = getAxisType(data, ax);
3259
- if (axId === 'x' && axType === 'category') {
3260
- props.xAxis = {
3261
- tickLayout: 'auto'
3262
- };
3263
- }
3264
- if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
3265
- const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3266
- if (axId === 'x') {
3267
- props.tickValues = tickValues;
3268
- props.xAxis = {
3269
- ...props.xAxis,
3270
- tickText: ax.ticktext
3271
- };
3272
- } else if (axId === 'y') {
3273
- props.yAxisTickValues = tickValues;
3274
- props.yAxis = {
3275
- ...props.yAxis,
3276
- tickText: ax.ticktext
3277
- };
3278
- }
3279
- return;
3280
- }
3281
- if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
3282
- const dtick = plotlyDtick(ax.dtick, axType);
3283
- const tick0 = plotlyTick0(ax.tick0, axType, dtick);
3284
- if (axId === 'x') {
3285
- props.xAxis = {
3286
- ...props.xAxis,
3287
- tickStep: dtick,
3288
- tick0
3289
- };
3290
- } else if (axId === 'y') {
3291
- props.yAxis = {
3292
- ...props.yAxis,
3293
- tickStep: dtick,
3294
- tick0
3295
- };
3296
- }
3297
- return;
3298
- }
3299
- if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
3300
- if (axId === 'x') {
3301
- props.xAxisTickCount = ax.nticks;
3302
- } else if (axId === 'y') {
3303
- props.yAxisTickCount = ax.nticks;
3304
- }
3305
- }
3306
- });
3307
- return props;
3308
- };
3309
- /**
3310
- * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L16}
3311
- */ const plotlyDtick = (dtick, axType)=>{
3312
- const isLogAx = axType === 'log';
3313
- const isDateAx = axType === 'date';
3314
- const isCatAx = axType === 'category';
3315
- const dtickDflt = isDateAx ? 86400000 : 1;
3316
- if (!dtick) {
3317
- return dtickDflt;
3318
- }
3319
- if ((0, _chartutilities.isNumber)(dtick)) {
3320
- dtick = Number(dtick);
3321
- if (dtick <= 0) {
3322
- return dtickDflt;
3323
- }
3324
- if (isCatAx) {
3325
- // category dtick must be positive integers
3326
- return Math.max(1, Math.round(dtick));
3327
- }
3328
- if (isDateAx) {
3329
- // date dtick must be at least 0.1ms (our current precision)
3330
- return Math.max(0.1, dtick);
3331
- }
3332
- return dtick;
3333
- }
3334
- if (typeof dtick !== 'string' || !(isDateAx || isLogAx)) {
3335
- return dtickDflt;
3336
- }
3337
- const prefix = dtick.charAt(0);
3338
- const dtickNum = (0, _chartutilities.isNumber)(dtick.slice(1)) ? Number(dtick.slice(1)) : 0;
3339
- if (dtickNum <= 0 || !(isDateAx && prefix === 'M' && dtickNum === Math.round(dtickNum) || // "L<f>" gives ticks linearly spaced in data (not in position) every (float) f
3340
- isLogAx && prefix === 'L' || // "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5
3341
- isLogAx && prefix === 'D' && (dtickNum === 1 || dtickNum === 2))) {
3342
- return dtickDflt;
3343
- }
3344
- return dtick;
3345
- };
3346
- /**
3347
- * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L70}
3348
- */ const plotlyTick0 = (tick0, axType, dtick)=>{
3349
- if (axType === 'date') {
3350
- return (0, _chartutilities.isDate)(tick0) ? new Date(tick0) : new Date(_utilities.DEFAULT_DATE_STRING);
3351
- }
3352
- if (dtick === 'D1' || dtick === 'D2') {
3353
- // D1 and D2 modes ignore tick0 entirely
3354
- return undefined;
3355
- }
3356
- // Aside from date axes, tick0 must be numeric
3357
- return (0, _chartutilities.isNumber)(tick0) ? Number(tick0) : 0;
3358
- };
3359
- const getAxisObjects = (data, layout)=>{
3360
- // Traces are grouped by their xaxis property, and for each group/subplot, the adapter functions
3361
- // are called with the corresponding filtered data. As a result, all traces passed to an adapter
3362
- // function share the same xaxis.
3363
- let xAxisId;
3364
- const yAxisIds = new Set();
3365
- data.forEach((series)=>{
3366
- const axisIds = (0, _chartutilities.getAxisIds)(series);
3367
- xAxisId = axisIds.x;
3368
- yAxisIds.add(axisIds.y);
3369
- });
3370
- const makeAxisObject = (axLetter, axId)=>({
3371
- ...layout === null || layout === void 0 ? void 0 : layout[(0, _chartutilities.getAxisKey)(axLetter, axId)],
3372
- _id: `${axLetter}${axId > 1 ? axId : ''}`
3373
- });
3374
- const axisObjects = {};
3375
- if (typeof xAxisId === 'number') {
3376
- axisObjects.x = makeAxisObject('x', xAxisId);
3377
- }
3378
- const sortedYAxisIds = Array.from(yAxisIds).sort();
3379
- if (sortedYAxisIds.length > 0) {
3380
- axisObjects.y = makeAxisObject('y', sortedYAxisIds[0]);
3381
- }
3382
- if (sortedYAxisIds.length > 1) {
3383
- axisObjects.y2 = makeAxisObject('y', sortedYAxisIds[1]);
3384
- }
3385
- return axisObjects;
3386
- };
3387
- const getAxisType = (data, ax)=>{
3388
- if (!ax) {
3389
- return 'category';
3390
- }
3391
- var _ax_type;
3392
- if ([
3393
- 'linear',
3394
- 'log',
3395
- 'date',
3396
- 'category'
3397
- ].includes((_ax_type = ax.type) !== null && _ax_type !== void 0 ? _ax_type : '')) {
3398
- return ax.type;
3399
- }
3400
- const axLetter = ax._id[0];
3401
- const values = [];
3402
- data.forEach((series)=>{
3403
- const axId = series[`${axLetter}axis`];
3404
- if ((axId === ax._id || !axId && ax._id === axLetter) && (0, _chartutilities.isArrayOrTypedArray)(series[axLetter])) {
3405
- series[axLetter].forEach((val)=>{
3406
- if (!(0, _chartutilities.isInvalidValue)(val)) {
3407
- values.push(val);
3408
- }
3409
- });
3410
- }
3411
- });
3412
- if ((0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isYearArray)(values)) {
3413
- return 'linear';
3414
- }
3415
- if ((0, _chartutilities.isDateArray)(values)) {
3416
- return 'date';
3417
- }
3418
- return 'category';
3419
- };
3420
- const getAxisValueResolver = (axType, dateParser)=>{
3421
- const toDate = (value)=>{
3422
- const date = dateParser ? dateParser(value) : new Date(value);
3423
- return isNaN(date.getTime()) ? null : date;
3424
- };
3425
- return (value)=>{
3426
- if ((0, _chartutilities.isInvalidValue)(value)) {
3427
- return null;
3428
- }
3429
- switch(axType){
3430
- case 'linear':
3431
- case 'log':
3432
- return (0, _chartutilities.isNumber)(value) ? +value : null;
3433
- case 'date':
3434
- if ((0, _chartutilities.isNumber)(value)) {
3435
- return toDate(+value);
3436
- }
3437
- if (typeof value === 'string') {
3438
- return toDate(value);
3439
- }
3440
- return null;
3441
- case 'category':
3442
- return `${value}`;
3443
- default:
3444
- return null;
3445
- }
3446
- };
3447
- };
3448
- /**
3449
- * This is experimental. Use it only with valid datetime strings to verify if they conform to the ISO 8601 format.
3450
- */ const isoDateRegex = /^\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?(Z)?)?$/;
3451
- /**
3452
- * We want to display localized date and time in the charts, so the useUTC prop is set to false.
3453
- * But this can sometimes cause the formatters to display the datetime incorrectly.
3454
- * To work around this issue, we use this function to adjust datetime strings so that they are always interpreted
3455
- * as local time, allowing the formatters to produce the correct output.
3456
- *
3457
- * FIXME: The formatters should always produce a clear and accurate localized output, regardless of the
3458
- * format used to create the date object.
3459
- */ const parseLocalDate = (value)=>{
3460
- if (typeof value === 'string') {
3461
- const match = value.match(isoDateRegex);
3462
- if (match) {
3463
- if (!match[3]) {
3464
- value += 'T00:00';
3465
- } else if (match[6]) {
3466
- value = value.replace('Z', '');
3467
- }
3468
- }
3469
- }
3470
- return new Date(value);
3471
- };
3472
- const POLAR_AXIS_BY_DATA_KEY = {
3473
- r: 'radialAxis',
3474
- theta: 'angularAxis'
3475
- };
3476
- const DEFAULT_POLAR_SUBPLOT = 'polar';
3477
- const getPolarLayout = (trace, layout)=>{
3478
- const subplotId = (trace === null || trace === void 0 ? void 0 : trace.subplot) || DEFAULT_POLAR_SUBPLOT;
3479
- return layout === null || layout === void 0 ? void 0 : layout[subplotId];
3480
- };
3481
- const getValidAxisValues = (data, dataKey)=>{
3482
- const values = [];
3483
- data.forEach((series)=>{
3484
- if ((0, _chartutilities.isArrayOrTypedArray)(series[dataKey])) {
3485
- series[dataKey].forEach((val)=>{
3486
- if (!(0, _chartutilities.isInvalidValue)(val)) {
3487
- values.push(val);
3488
- }
3489
- });
3490
- }
3491
- });
3492
- return values;
3493
- };
3494
- const getPolarAxisType = (data, dataKey, declaredType)=>{
3495
- if ([
3496
- 'linear',
3497
- 'log',
3498
- 'date',
3499
- 'category'
3500
- ].includes(declaredType !== null && declaredType !== void 0 ? declaredType : '')) {
3501
- return declaredType;
3502
- }
3503
- const values = getValidAxisValues(data, dataKey);
3504
- if ((0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isYearArray)(values)) {
3505
- return 'linear';
3506
- }
3507
- if ((0, _chartutilities.isDateArray)(values)) {
3508
- return 'date';
3509
- }
3510
- return 'category';
3511
- };
3512
- const getPolarAxis = (data, dataKey, layout)=>{
3513
- const polarLayout = getPolarLayout(data[0], layout);
3514
- const ax = polarLayout === null || polarLayout === void 0 ? void 0 : polarLayout[POLAR_AXIS_BY_DATA_KEY[dataKey].toLowerCase()];
3515
- return {
3516
- ...ax,
3517
- _dataKey: dataKey,
3518
- _type: getPolarAxisType(data, dataKey, ax === null || ax === void 0 ? void 0 : ax.type)
3519
- };
3520
- };
3521
- const getPolarAxisTickProps = (data, ax)=>{
3522
- const props = {};
3523
- if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
3524
- const tickValues = ax._type === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3525
- props.tickValues = tickValues;
3526
- props.tickText = ax.ticktext;
3527
- return props;
3528
- }
3529
- if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
3530
- const dtick = plotlyDtick(ax.dtick, ax._type);
3531
- const tick0 = plotlyTick0(ax.tick0, ax._type, dtick);
3532
- props.tickStep = dtick;
3533
- props.tick0 = tick0;
3534
- return props;
3535
- }
3536
- if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
3537
- props.tickCount = ax.nticks;
3538
- }
3539
- return props;
3540
- };
3541
- const getPolarAxisCategoryOrder = (data, ax)=>{
3542
- if (ax._type !== 'category') {
3543
- return 'data';
3544
- }
3545
- const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax.categoryarray) && ax.categoryarray.length > 0;
3546
- if (isValidArray && (!ax.categoryorder || ax.categoryorder === 'array')) {
3547
- return ax.categoryarray;
3548
- }
3549
- if (!ax.categoryorder || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
3550
- const values = getValidAxisValues(data, ax._dataKey);
3551
- const categoriesInTraceOrder = Array.from(new Set(values));
3552
- return ax.autorange === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
3553
- }
3554
- return ax.categoryorder;
3555
- };
3556
- const getPolarAxisProps = (data, layout)=>{
3557
- const props = {};
3558
- Object.keys(POLAR_AXIS_BY_DATA_KEY).forEach((dataKey)=>{
3559
- const propName = POLAR_AXIS_BY_DATA_KEY[dataKey];
3560
- const ax = getPolarAxis(data, dataKey, layout);
3561
- props[propName] = {
3562
- scaleType: ax._type === 'log' ? 'log' : 'default',
3563
- categoryOrder: getPolarAxisCategoryOrder(data, ax),
3564
- tickFormat: ax.tickformat,
3565
- ...getPolarAxisTickProps(data, ax),
3566
- ...(0, _chartutilities.isArrayOrTypedArray)(ax.range) ? {
3567
- rangeStart: ax.range[0],
3568
- rangeEnd: ax.range[1]
3569
- } : {}
3570
- };
3571
- if (propName === 'angularAxis') {
3572
- props[propName].unit = ax.thetaunit;
3573
- props.direction = ax.direction;
3574
- }
3575
- });
3576
- return props;
3577
- };