@fluentui/react-charts 9.3.8 → 9.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/dist/index.d.ts +378 -0
  3. package/lib/PolarChart.js +1 -0
  4. package/lib/PolarChart.js.map +1 -0
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  6. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  7. package/lib/components/ChartTable/ChartTable.js +21 -7
  8. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  10. package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
  11. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  12. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  13. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
  15. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  16. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  17. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +47 -3
  18. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  19. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
  20. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  21. package/lib/components/CommonComponents/CartesianChart.js +32 -13
  22. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  23. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  24. package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
  25. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  26. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +413 -210
  27. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  28. package/lib/components/DonutChart/DonutChart.js +18 -6
  29. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  30. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  31. package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
  32. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  33. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
  34. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  35. package/lib/components/FunnelChart/FunnelChart.js +28 -6
  36. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  37. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  38. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
  39. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  40. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  41. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  42. package/lib/components/GaugeChart/GaugeChart.js +7 -6
  43. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  44. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  45. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
  46. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  47. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  48. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  49. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  50. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  51. package/lib/components/HeatMapChart/HeatMapChart.js +5 -1
  52. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  53. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +58 -6
  54. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  55. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  56. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
  57. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  58. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  59. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  60. package/lib/components/Legends/OverflowMenu.js +9 -2
  61. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  62. package/lib/components/LineChart/LineChart.js +5 -6
  63. package/lib/components/LineChart/LineChart.js.map +1 -1
  64. package/lib/components/PolarChart/PolarChart.js +577 -0
  65. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  66. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  67. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  68. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  69. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  70. package/lib/components/PolarChart/index.js +2 -0
  71. package/lib/components/PolarChart/index.js.map +1 -0
  72. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  73. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  74. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  75. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  76. package/lib/components/SankeyChart/SankeyChart.js +14 -4
  77. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  78. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  79. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +23 -6
  80. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  81. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  82. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  83. package/lib/components/ScatterChart/ScatterChart.js +1 -5
  84. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  85. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -38
  86. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  87. package/lib/index.js +1 -0
  88. package/lib/index.js.map +1 -1
  89. package/lib/types/DataPoint.js +1 -1
  90. package/lib/types/DataPoint.js.map +1 -1
  91. package/lib/utilities/ChartTitle.js +45 -0
  92. package/lib/utilities/ChartTitle.js.map +1 -0
  93. package/lib/utilities/Common.styles.js +73 -1
  94. package/lib/utilities/Common.styles.js.map +1 -1
  95. package/lib/utilities/Common.styles.raw.js +70 -0
  96. package/lib/utilities/Common.styles.raw.js.map +1 -1
  97. package/lib/utilities/index.js +1 -0
  98. package/lib/utilities/index.js.map +1 -1
  99. package/lib/utilities/utilities.js +6 -6
  100. package/lib/utilities/utilities.js.map +1 -1
  101. package/lib-commonjs/PolarChart.js +6 -0
  102. package/lib-commonjs/PolarChart.js.map +1 -0
  103. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
  104. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  105. package/lib-commonjs/components/ChartTable/ChartTable.js +21 -7
  106. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  107. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  108. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  109. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  110. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  111. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  112. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
  113. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  114. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
  115. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +58 -4
  116. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  117. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
  118. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  119. package/lib-commonjs/components/CommonComponents/CartesianChart.js +31 -12
  120. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  122. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  123. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  124. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +419 -213
  125. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  126. package/lib-commonjs/components/DonutChart/DonutChart.js +17 -5
  127. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  128. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  129. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  130. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  131. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  132. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  133. package/lib-commonjs/components/FunnelChart/FunnelChart.js +27 -5
  134. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  135. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  136. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  137. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  138. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  139. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  140. package/lib-commonjs/components/GaugeChart/GaugeChart.js +6 -5
  141. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  142. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  143. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
  144. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  145. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  146. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  147. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  148. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  149. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -1
  150. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  151. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +57 -5
  152. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  153. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
  154. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
  155. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  156. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
  157. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  158. package/lib-commonjs/components/Legends/OverflowMenu.js +9 -2
  159. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  160. package/lib-commonjs/components/LineChart/LineChart.js +5 -6
  161. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  162. package/lib-commonjs/components/PolarChart/PolarChart.js +587 -0
  163. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  164. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  165. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  166. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  167. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  168. package/lib-commonjs/components/PolarChart/index.js +7 -0
  169. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  170. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  171. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  172. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  173. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  174. package/lib-commonjs/components/SankeyChart/SankeyChart.js +14 -4
  175. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  176. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  177. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -4
  178. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  179. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  180. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  181. package/lib-commonjs/components/ScatterChart/ScatterChart.js +1 -5
  182. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  183. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -38
  184. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  185. package/lib-commonjs/index.js +1 -0
  186. package/lib-commonjs/index.js.map +1 -1
  187. package/lib-commonjs/types/DataPoint.js +1 -1
  188. package/lib-commonjs/types/DataPoint.js.map +1 -1
  189. package/lib-commonjs/utilities/ChartTitle.js +53 -0
  190. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  191. package/lib-commonjs/utilities/Common.styles.js +69 -0
  192. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  193. package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
  194. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  195. package/lib-commonjs/utilities/index.js +1 -0
  196. package/lib-commonjs/utilities/index.js.map +1 -1
  197. package/lib-commonjs/utilities/utilities.js +10 -4
  198. package/lib-commonjs/utilities/utilities.js.map +1 -1
  199. package/package.json +10 -16
@@ -50,12 +50,37 @@ const dashOptions = {
50
50
  }
51
51
  };
52
52
  function getTitles(layout) {
53
- var _layout_title, _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
54
- var _layout_title_text, _layout_xaxis_title_text, _layout_yaxis_title_text;
53
+ var _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
54
+ const titleObj = layout === null || layout === void 0 ? void 0 : layout.title;
55
+ var _titleObj_text;
56
+ const chartTitle = typeof titleObj === 'string' ? titleObj : (_titleObj_text = titleObj === null || titleObj === void 0 ? void 0 : titleObj.text) !== null && _titleObj_text !== void 0 ? _titleObj_text : '';
57
+ const titleFont = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.font : undefined;
58
+ const titleXAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.xanchor : undefined;
59
+ const titleYAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.yanchor : undefined;
60
+ const titlePad = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.pad : undefined;
61
+ const titleStyles = {
62
+ ...titleFont ? {
63
+ titleFont
64
+ } : {},
65
+ ...titleXAnchor ? {
66
+ titleXAnchor
67
+ } : {},
68
+ ...titleYAnchor ? {
69
+ titleYAnchor
70
+ } : {},
71
+ ...titlePad ? {
72
+ titlePad
73
+ } : {}
74
+ };
75
+ var _layout_xaxis_title_text, _layout_yaxis_title_text;
55
76
  const titles = {
56
- chartTitle: typeof (layout === null || layout === void 0 ? void 0 : layout.title) === 'string' ? layout.title : (_layout_title_text = layout === null || layout === void 0 ? void 0 : (_layout_title = layout.title) === null || _layout_title === void 0 ? void 0 : _layout_title.text) !== null && _layout_title_text !== void 0 ? _layout_title_text : '',
77
+ chartTitle,
78
+ ...Object.keys(titleStyles).length > 0 ? {
79
+ titleStyles
80
+ } : {},
57
81
  xAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_xaxis = layout.xaxis) === null || _layout_xaxis === void 0 ? void 0 : _layout_xaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_xaxis1 = layout.xaxis) === null || _layout_xaxis1 === void 0 ? void 0 : _layout_xaxis1.title : (_layout_xaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_xaxis2 = layout.xaxis) === null || _layout_xaxis2 === void 0 ? void 0 : (_layout_xaxis_title = _layout_xaxis2.title) === null || _layout_xaxis_title === void 0 ? void 0 : _layout_xaxis_title.text) !== null && _layout_xaxis_title_text !== void 0 ? _layout_xaxis_title_text : '',
58
- yAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis = layout.yaxis) === null || _layout_yaxis === void 0 ? void 0 : _layout_yaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_yaxis1 = layout.yaxis) === null || _layout_yaxis1 === void 0 ? void 0 : _layout_yaxis1.title : (_layout_yaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis) === null || _layout_yaxis2 === void 0 ? void 0 : (_layout_yaxis_title = _layout_yaxis2.title) === null || _layout_yaxis_title === void 0 ? void 0 : _layout_yaxis_title.text) !== null && _layout_yaxis_title_text !== void 0 ? _layout_yaxis_title_text : ''
82
+ yAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis = layout.yaxis) === null || _layout_yaxis === void 0 ? void 0 : _layout_yaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_yaxis1 = layout.yaxis) === null || _layout_yaxis1 === void 0 ? void 0 : _layout_yaxis1.title : (_layout_yaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis) === null || _layout_yaxis2 === void 0 ? void 0 : (_layout_yaxis_title = _layout_yaxis2.title) === null || _layout_yaxis_title === void 0 ? void 0 : _layout_yaxis_title.text) !== null && _layout_yaxis_title_text !== void 0 ? _layout_yaxis_title_text : '',
83
+ xAxisAnnotation: chartTitle
59
84
  };
60
85
  return titles;
61
86
  }
@@ -337,6 +362,57 @@ const toFiniteNumber = (value)=>{
337
362
  const numeric = typeof value === 'number' ? value : Number(value);
338
363
  return Number.isFinite(numeric) ? numeric : undefined;
339
364
  };
365
+ /**
366
+ * Parses Plotly axis references (e.g. `x`, `x2`, `xaxis2`, `paper`, `pixel`, `x domain`) into a ref type + axis id.
367
+ */ const parseAxisRef = (ref, axis)=>{
368
+ if (!ref) {
369
+ return {
370
+ refType: 'axis',
371
+ axisId: 1
372
+ };
373
+ }
374
+ const normalized = ref.toLowerCase().trim();
375
+ if (normalized === 'pixel') {
376
+ return {
377
+ refType: 'pixel',
378
+ axisId: 1
379
+ };
380
+ }
381
+ if (normalized === 'paper') {
382
+ return {
383
+ refType: 'relative',
384
+ axisId: 1
385
+ };
386
+ }
387
+ if (normalized.endsWith(' domain')) {
388
+ return normalized.startsWith(axis) ? {
389
+ refType: 'relative',
390
+ axisId: 1
391
+ } : {
392
+ refType: undefined,
393
+ axisId: 1
394
+ };
395
+ }
396
+ const match = normalized.match(/^([xy])(axis)?(\d*)$/);
397
+ if (!match || match[1] !== axis) {
398
+ return {
399
+ refType: undefined,
400
+ axisId: 1
401
+ };
402
+ }
403
+ const suffix = match[3];
404
+ if (!suffix || suffix === '1') {
405
+ return {
406
+ refType: 'axis',
407
+ axisId: 1
408
+ };
409
+ }
410
+ const parsed = Number(suffix);
411
+ return {
412
+ refType: 'axis',
413
+ axisId: Number.isFinite(parsed) && parsed >= 1 ? parsed : 1
414
+ };
415
+ };
340
416
  /**
341
417
  * Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
342
418
  */ const transformRelativeYForChart = (value)=>{
@@ -390,21 +466,13 @@ const appendPx = (value)=>{
390
466
  if (!ref) {
391
467
  return 'axis';
392
468
  }
393
- const normalized = ref.toLowerCase();
394
- if (normalized === 'pixel') {
395
- return 'pixel';
396
- }
397
- if (normalized === 'paper') {
398
- return 'relative';
399
- }
400
- if (normalized.endsWith(' domain')) {
401
- return normalized.startsWith(axis) ? 'relative' : undefined;
469
+ const parsed = parseAxisRef(ref, axis);
470
+ if (parsed.refType !== 'axis') {
471
+ return parsed.refType;
402
472
  }
473
+ const normalized = (ref !== null && ref !== void 0 ? ref : '').toLowerCase().trim();
403
474
  const match = normalized.match(/^([xy])(\d*)$/);
404
- if (match && match[1] === axis) {
405
- return 'axis';
406
- }
407
- return undefined;
475
+ return match && match[1] === axis ? 'axis' : undefined;
408
476
  };
409
477
  /**
410
478
  * Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
@@ -413,56 +481,36 @@ const appendPx = (value)=>{
413
481
  return undefined;
414
482
  }
415
483
  const defaultAxisKey = `${axis}axis`;
416
- if (!ref) {
417
- return layout[defaultAxisKey];
418
- }
419
- const normalized = ref.toLowerCase();
420
- if (normalized === 'paper' || normalized === 'pixel' || normalized.endsWith(' domain')) {
484
+ const { refType, axisId } = parseAxisRef(ref, axis);
485
+ if (refType !== 'axis' || axisId === 1) {
421
486
  return layout[defaultAxisKey];
422
487
  }
423
- const match = normalized.match(/^([xy])(\d*)$/);
424
- if (match && match[1] === axis) {
425
- const index = match[2];
426
- if (index && index !== '' && index !== '1') {
427
- const axisKey = `${axis}axis${index}`;
428
- return layout[axisKey];
429
- }
430
- return layout[defaultAxisKey];
431
- }
432
- return layout[defaultAxisKey];
488
+ const axisKey = `${axis}axis${axisId}`;
489
+ return layout[axisKey];
433
490
  };
434
- /**
435
- * Normalizes raw Plotly data values into canonical number/date/string types based on axis configuration.
436
- */ const convertDataValue = (value, axisLayout)=>{
491
+ const convertAnnotationDataValue = (value, axisType)=>{
437
492
  if (value === undefined || value === null) {
438
493
  return undefined;
439
494
  }
440
- const axisType = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type;
441
495
  if (axisType === 'date') {
442
496
  const dateValue = value instanceof Date ? value : new Date(value);
443
497
  return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
444
498
  }
445
- if (value instanceof Date) {
446
- return Number.isNaN(value.getTime()) ? undefined : value;
447
- }
448
- if (typeof value === 'number') {
449
- return Number.isFinite(value) ? value : undefined;
450
- }
451
499
  if (axisType === 'linear' || axisType === 'log') {
500
+ if (typeof value === 'number') {
501
+ return Number.isFinite(value) ? value : undefined;
502
+ }
452
503
  const numeric = Number(value);
453
504
  return Number.isFinite(numeric) ? numeric : undefined;
454
505
  }
455
- if (typeof value === 'string') {
456
- const shouldTryParseDate = axisType === undefined || axisType === '-' || axisType === null;
457
- if (shouldTryParseDate && isDate(value)) {
458
- const parsedDate = new Date(value);
459
- if (!Number.isNaN(parsedDate.getTime()) && parsedDate.getFullYear() >= 1900) {
460
- return parsedDate;
461
- }
462
- }
506
+ // For category-like axes, preserve raw strings (and avoid date parsing heuristics).
507
+ if (value instanceof Date) {
508
+ return value;
509
+ }
510
+ if (typeof value === 'number' || typeof value === 'string') {
463
511
  return value;
464
512
  }
465
- return value;
513
+ return undefined;
466
514
  };
467
515
  const createAnnotationId = (text, index)=>{
468
516
  const normalized = text.replace(/\s+/g, ' ').trim();
@@ -541,7 +589,9 @@ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
541
589
  const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
542
590
  const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
543
591
  const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
544
- return convertDataValue(rawValue, axisLayout);
592
+ var _axisLayout_type;
593
+ const axisType = (_axisLayout_type = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) !== null && _axisLayout_type !== void 0 ? _axisLayout_type : 'category';
594
+ return convertAnnotationDataValue(rawValue, axisType);
545
595
  }
546
596
  const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
547
597
  if (numericValue === undefined) {
@@ -765,14 +815,82 @@ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
765
815
  }
766
816
  return chartAnnotation;
767
817
  };
768
- const getChartAnnotationsFromLayout = (layout, isMultiPlot)=>{
818
+ const getChartAnnotationsFromLayout = (data, layout, isMultiPlot)=>{
769
819
  if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
770
820
  return undefined;
771
821
  }
822
+ // Infer axis types when they are not explicitly set.
823
+ // This is needed so annotation coordinate parsing can correctly treat values as 'date' vs 'category'
824
+ // (for example, bar chart category axes with date-like strings).
825
+ const inferredLayout = (()=>{
826
+ if (!data || !isArrayOrTypedArray(data) || data.length === 0) {
827
+ return layout;
828
+ }
829
+ const valuesByAxisKey = new Map();
830
+ const axesExpectingCategories = new Set();
831
+ data.forEach((series)=>{
832
+ const trace = series;
833
+ const axisIds = getAxisIds(trace);
834
+ if (trace.type === 'bar') {
835
+ const categoryAxisLetter = trace.orientation === 'h' ? 'y' : 'x';
836
+ axesExpectingCategories.add(getAxisKey(categoryAxisLetter, axisIds[categoryAxisLetter]));
837
+ }
838
+ [
839
+ 'x',
840
+ 'y'
841
+ ].forEach((axLetter)=>{
842
+ const coords = trace[axLetter];
843
+ if (!coords || !isArrayOrTypedArray(coords)) {
844
+ return;
845
+ }
846
+ const axisKey = getAxisKey(axLetter, axisIds[axLetter]);
847
+ var _valuesByAxisKey_get;
848
+ const existing = (_valuesByAxisKey_get = valuesByAxisKey.get(axisKey)) !== null && _valuesByAxisKey_get !== void 0 ? _valuesByAxisKey_get : [];
849
+ coords.forEach((val)=>{
850
+ if (!isInvalidValue(val)) {
851
+ existing.push(val);
852
+ }
853
+ });
854
+ valuesByAxisKey.set(axisKey, existing);
855
+ });
856
+ });
857
+ let nextLayout;
858
+ valuesByAxisKey.forEach((values, axisKey)=>{
859
+ const currentAxis = layout === null || layout === void 0 ? void 0 : layout[axisKey];
860
+ const currentType = currentAxis === null || currentAxis === void 0 ? void 0 : currentAxis.type;
861
+ if ([
862
+ 'linear',
863
+ 'log',
864
+ 'date',
865
+ 'category'
866
+ ].includes(currentType !== null && currentType !== void 0 ? currentType : '')) {
867
+ return;
868
+ }
869
+ let inferredType;
870
+ if (axesExpectingCategories.has(axisKey) || isYearArray(values)) {
871
+ inferredType = 'category';
872
+ } else if (isDateArray(values)) {
873
+ inferredType = 'date';
874
+ }
875
+ if (!inferredType) {
876
+ return;
877
+ }
878
+ if (!nextLayout) {
879
+ nextLayout = {
880
+ ...layout
881
+ };
882
+ }
883
+ nextLayout[axisKey] = {
884
+ ...currentAxis !== null && currentAxis !== void 0 ? currentAxis : {},
885
+ type: inferredType
886
+ };
887
+ });
888
+ return nextLayout !== null && nextLayout !== void 0 ? nextLayout : layout;
889
+ })();
772
890
  const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
773
891
  layout.annotations
774
892
  ];
775
- const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, layout, index)).filter((annotation)=>annotation !== undefined);
893
+ const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, inferredLayout, index)).filter((annotation)=>annotation !== undefined);
776
894
  return converted.length > 0 ? converted : undefined;
777
895
  };
778
896
  /**
@@ -854,7 +972,7 @@ const getChartAnnotationsFromLayout = (layout, isMultiPlot)=>{
854
972
  export const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
855
973
  var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
856
974
  var _getChartAnnotationsFromLayout;
857
- const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
975
+ const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
858
976
  const titles = getTitles(input.layout);
859
977
  const layoutTitle = titles.chartTitle || undefined;
860
978
  const layoutWithMeta = input.layout;
@@ -935,7 +1053,7 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
935
1053
  const donutMarginHorizontal = hideLabels ? 0 : 80;
936
1054
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
937
1055
  const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : MIN_DONUT_RADIUS;
938
- const { chartTitle } = getTitles(input.layout);
1056
+ const { chartTitle, titleStyles } = getTitles(input.layout);
939
1057
  // Build anticlockwise order by keeping the first item, reversing the rest
940
1058
  const legends = Object.keys(mapLegendToDataPoint);
941
1059
  const reorderedEntries = legends.length > 1 ? [
@@ -967,7 +1085,10 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
967
1085
  'percent+label'
968
1086
  ].includes(firstData.textinfo) : true,
969
1087
  roundCorners: true,
970
- order: 'sorted'
1088
+ order: 'sorted',
1089
+ ...titleStyles ? {
1090
+ titleStyles
1091
+ } : {}
971
1092
  };
972
1093
  };
973
1094
  export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
@@ -1121,7 +1242,7 @@ export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, col
1121
1242
  }
1122
1243
  });
1123
1244
  const vsbcData = Object.values(mapXToDataPoints);
1124
- const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1245
+ const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1125
1246
  var _input_layout_height;
1126
1247
  return {
1127
1248
  data: vsbcData,
@@ -1266,7 +1387,7 @@ export const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, col
1266
1387
  });
1267
1388
  }
1268
1389
  });
1269
- const annotations = getChartAnnotationsFromLayout(processedInput.layout, isMultiPlot);
1390
+ const annotations = getChartAnnotationsFromLayout(processedInput.data, processedInput.layout, isMultiPlot);
1270
1391
  var _processedInput_layout_height;
1271
1392
  return {
1272
1393
  dataV2: gvbcDataV2,
@@ -1363,7 +1484,7 @@ export const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colo
1363
1484
  });
1364
1485
  });
1365
1486
  });
1366
- const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1487
+ const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1367
1488
  var _input_layout_height;
1368
1489
  return {
1369
1490
  data: vbcData,
@@ -1582,7 +1703,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
1582
1703
  ...lineShape
1583
1704
  ]
1584
1705
  };
1585
- const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
1706
+ const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
1586
1707
  var _input_layout_height;
1587
1708
  const commonProps = {
1588
1709
  supportNegativeData: true,
@@ -1640,7 +1761,7 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
1640
1761
  const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
1641
1762
  const legend = legends[index];
1642
1763
  return series.y.map((yValue, i)=>{
1643
- var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
1764
+ var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x, _series_text;
1644
1765
  if (isInvalidValue(yValue)) {
1645
1766
  return null;
1646
1767
  }
@@ -1654,7 +1775,10 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPl
1654
1775
  legend,
1655
1776
  color: (_rgb_copy_formatHex8 = rgb(color).copy({
1656
1777
  opacity
1657
- }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
1778
+ }).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
1779
+ ...((_series_text = series.text) === null || _series_text === void 0 ? void 0 : _series_text[i]) ? {
1780
+ barLabel: series.text[i].toString()
1781
+ } : {}
1658
1782
  };
1659
1783
  }).filter((point)=>point !== null);
1660
1784
  }).flat();
@@ -1965,7 +2089,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
1965
2089
  };
1966
2090
  };
1967
2091
  export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
1968
- var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3;
2092
+ var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3, _input_layout4;
1969
2093
  const { link, node } = input.data[0];
1970
2094
  var _link_value;
1971
2095
  const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
@@ -2007,7 +2131,7 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
2007
2131
  // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
2008
2132
  // },
2009
2133
  // };
2010
- const { chartTitle } = getTitles(input.layout);
2134
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2011
2135
  var _input_layout_height;
2012
2136
  return {
2013
2137
  data: {
@@ -2015,7 +2139,13 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
2015
2139
  SankeyChartData: sankeyChartData
2016
2140
  },
2017
2141
  width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
2018
- height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468
2142
+ height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468,
2143
+ // TODO
2144
+ // styles,
2145
+ hideLegend: isMultiPlot || ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.showlegend) === false,
2146
+ ...titleStyles ? {
2147
+ titleStyles
2148
+ } : {}
2019
2149
  };
2020
2150
  };
2021
2151
  export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -2066,7 +2196,7 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
2066
2196
  const styles = {
2067
2197
  sublabel: sublabelColor
2068
2198
  };
2069
- const { chartTitle } = getTitles(input.layout);
2199
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2070
2200
  var _firstData_value2, _input_layout_height;
2071
2201
  return {
2072
2202
  segments,
@@ -2087,7 +2217,10 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
2087
2217
  // styles,
2088
2218
  variant: ((_firstData_gauge9 = firstData.gauge) === null || _firstData_gauge9 === void 0 ? void 0 : (_firstData_gauge_steps1 = _firstData_gauge9.steps) === null || _firstData_gauge_steps1 === void 0 ? void 0 : _firstData_gauge_steps1.length) ? 'multiple-segments' : 'single-segment',
2089
2219
  styles,
2090
- roundCorners: true
2220
+ roundCorners: true,
2221
+ ...titleStyles ? {
2222
+ titleStyles
2223
+ } : {}
2091
2224
  };
2092
2225
  };
2093
2226
  const cleanText = (text)=>{
@@ -2230,13 +2363,18 @@ export const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMa
2230
2363
  },
2231
2364
  values: (_ref = (_tableHeader_values = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.values) !== null && _tableHeader_values !== void 0 ? _tableHeader_values : templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.values) !== null && _ref !== void 0 ? _ref : []
2232
2365
  };
2366
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2233
2367
  var _tableData_header_values;
2234
2368
  return {
2235
2369
  headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : [], header),
2236
2370
  rows,
2237
2371
  width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
2238
2372
  height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
2239
- styles
2373
+ styles,
2374
+ chartTitle,
2375
+ ...titleStyles ? {
2376
+ titleStyles
2377
+ } : {}
2240
2378
  };
2241
2379
  };
2242
2380
  function getCategoriesAndValues(series) {
@@ -2380,151 +2518,90 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
2380
2518
  });
2381
2519
  });
2382
2520
  }
2521
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2383
2522
  return {
2384
2523
  data: funnelData,
2524
+ chartTitle,
2385
2525
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2386
2526
  height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
2387
2527
  orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
2388
- hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false
2528
+ hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false,
2529
+ ...titleStyles ? {
2530
+ titleStyles
2531
+ } : {}
2389
2532
  };
2390
2533
  };
2391
- export const projectPolarToCartesian = (input)=>{
2534
+ export const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2392
2535
  var _input_layout, _input_layout1;
2393
- const projection = {
2394
- ...input
2395
- };
2396
- // Find the global min and max radius across all series
2397
- let minRadius = 0;
2398
- let maxRadius = 0;
2399
- for(let sindex = 0; sindex < input.data.length; sindex++){
2400
- const rVals = input.data[sindex].r;
2401
- if (rVals && isArrayOrTypedArray(rVals)) {
2402
- for(let ptindex = 0; ptindex < rVals.length; ptindex++){
2403
- if (!isInvalidValue(rVals[ptindex])) {
2404
- minRadius = Math.min(minRadius, rVals[ptindex]);
2405
- maxRadius = Math.max(maxRadius, rVals[ptindex]);
2406
- }
2407
- }
2408
- }
2409
- }
2410
- // If there are negative radii, compute the shift
2411
- const radiusShift = minRadius < 0 ? -minRadius : 0;
2412
- // Collect all unique theta values from all scatterpolar series for equal spacing
2413
- const allThetaValues = new Set();
2414
- for(let sindex = 0; sindex < input.data.length; sindex++){
2415
- const series = input.data[sindex];
2416
- if (series.theta && isArrayOrTypedArray(series.theta)) {
2417
- series.theta.forEach((theta)=>allThetaValues.add(String(theta)));
2418
- }
2419
- }
2420
- // Project all points and create a perfect square domain
2421
- const allX = [];
2422
- const allY = [];
2423
- let originX = null;
2424
- for(let sindex = 0; sindex < input.data.length; sindex++){
2425
- var _input_layout_polar_angularaxis, _input_layout_polar, _input_layout2, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout3;
2426
- const series = input.data[sindex];
2427
- // If scatterpolar, set __axisLabel to all unique theta values for equal spacing
2428
- if (isArrayOrTypedArray(series.theta)) {
2429
- series.__axisLabel = Array.from(allThetaValues);
2430
- }
2431
- series.x = [];
2432
- series.y = [];
2433
- const thetas = series.theta;
2434
- const rVals = series.r;
2435
- // Skip if rVals or thetas are not arrays
2436
- if (!isArrayOrTypedArray(rVals) || !isArrayOrTypedArray(thetas)) {
2437
- projection.data[sindex] = series;
2438
- continue;
2439
- }
2440
- // retrieve polar axis settings
2441
- const dirMultiplier = ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_polar = _input_layout2.polar) === null || _input_layout_polar === void 0 ? void 0 : (_input_layout_polar_angularaxis = _input_layout_polar.angularaxis) === null || _input_layout_polar_angularaxis === void 0 ? void 0 : _input_layout_polar_angularaxis.direction) === 'clockwise' ? -1 : 1;
2442
- var _input_layout_polar_angularaxis_rotation;
2443
- const startAngleInRad = ((_input_layout_polar_angularaxis_rotation = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_polar1 = _input_layout3.polar) === null || _input_layout_polar1 === void 0 ? void 0 : (_input_layout_polar_angularaxis1 = _input_layout_polar1.angularaxis) === null || _input_layout_polar_angularaxis1 === void 0 ? void 0 : _input_layout_polar_angularaxis1.rotation) !== null && _input_layout_polar_angularaxis_rotation !== void 0 ? _input_layout_polar_angularaxis_rotation : 0) * Math.PI / 180;
2444
- // Compute tick positions if categorical
2445
- let uniqueTheta = [];
2446
- let categorical = false;
2447
- if (!isNumberArray(thetas)) {
2448
- uniqueTheta = Array.from(new Set(thetas));
2449
- categorical = true;
2450
- }
2451
- for(let ptindex = 0; ptindex < rVals.length; ptindex++){
2452
- if (isInvalidValue(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || isInvalidValue(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
2453
- continue;
2454
- }
2455
- // Map theta to angle in radians
2456
- let thetaRad;
2457
- if (categorical) {
2458
- const idx = uniqueTheta.indexOf(thetas[ptindex]);
2459
- const step = 2 * Math.PI / uniqueTheta.length;
2460
- thetaRad = startAngleInRad + dirMultiplier * idx * step;
2536
+ const polarData = [];
2537
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
2538
+ const resolveRValue = getAxisValueResolver(getPolarAxis(input.data, 'r', input.layout)._type);
2539
+ input.data.forEach((series, index)=>{
2540
+ const legend = legends[index];
2541
+ if (series.type === 'scatterpolar') {
2542
+ var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_r;
2543
+ const isAreaTrace = series.fill === 'toself' || series.fill === 'tonext';
2544
+ const isLineTrace = typeof series.mode === 'undefined' ? true : series.mode.includes('lines');
2545
+ const colors = isAreaTrace ? series.fillcolor : isLineTrace ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color;
2546
+ const extractedColors = extractColor((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
2547
+ const seriesColor = resolveColor(extractedColors, index, legend, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
2548
+ const seriesOpacity = getOpacity(series, index);
2549
+ const finalSeriesColor = rgb(seriesColor).copy({
2550
+ opacity: seriesOpacity
2551
+ }).formatHex8();
2552
+ const lineOptions = getLineOptions(series.line);
2553
+ const thetaUnit = series.thetaunit;
2554
+ const commonProps = {
2555
+ legend,
2556
+ legendShape: getLegendShape(series),
2557
+ color: finalSeriesColor,
2558
+ data: ((_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.map((r, rIndex)=>{
2559
+ var _series_theta, _series_marker, _series_marker1, _input_layout_template_layout, _input_layout_template, _input_layout;
2560
+ const theta = (_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[rIndex];
2561
+ const markerSize = Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size[rIndex] : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size;
2562
+ const text = Array.isArray(series.text) ? series.text[rIndex] : series.text;
2563
+ const markerColor = resolveColor(extractedColors, rIndex, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
2564
+ const markerOpacity = getOpacity(series, rIndex);
2565
+ if (isInvalidValue(resolveRValue(r)) || isInvalidValue(theta)) {
2566
+ return;
2567
+ }
2568
+ return {
2569
+ r: resolveRValue(r),
2570
+ theta: typeof theta === 'number' ? thetaUnit === 'radians' ? theta * 180 / Math.PI : thetaUnit === 'gradians' ? theta * 0.9 : theta : theta,
2571
+ color: markerColor ? rgb(markerColor).copy({
2572
+ opacity: markerOpacity
2573
+ }).formatHex8() : finalSeriesColor,
2574
+ ...typeof markerSize !== 'undefined' ? {
2575
+ markerSize
2576
+ } : {},
2577
+ ...typeof text !== 'undefined' ? {
2578
+ text
2579
+ } : {}
2580
+ };
2581
+ }).filter((item)=>typeof item !== 'undefined')) || []
2582
+ };
2583
+ if (isAreaTrace || isLineTrace) {
2584
+ polarData.push({
2585
+ type: isAreaTrace ? 'areapolar' : 'linepolar',
2586
+ ...commonProps,
2587
+ lineOptions
2588
+ });
2461
2589
  } else {
2462
- thetaRad = startAngleInRad + dirMultiplier * (thetas[ptindex] * Math.PI / 180);
2463
- }
2464
- // Shift only the polar origin (not the cartesian)
2465
- const rawRadius = rVals[ptindex];
2466
- const polarRadius = rawRadius + radiusShift; // Only for projection
2467
- // Calculate cartesian coordinates (with shifted polar origin)
2468
- const x = polarRadius * Math.cos(thetaRad);
2469
- const y = polarRadius * Math.sin(thetaRad);
2470
- // Calculate the cartesian coordinates of the original polar origin (0,0)
2471
- // This is the point that should be mapped to (0,0) in cartesian coordinates
2472
- if (sindex === 0 && ptindex === 0) {
2473
- // For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
2474
- // But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
2475
- originX = radiusShift;
2476
- }
2477
- series.x.push(x);
2478
- series.y.push(y);
2479
- allX.push(x);
2480
- allY.push(y);
2481
- }
2482
- // Map text to each data point for downstream chart rendering
2483
- if (series.x && series.y) {
2484
- series.data = series.x.map((xVal, idx)=>({
2485
- x: xVal,
2486
- y: series.y[idx],
2487
- ...series.text ? {
2488
- text: series.text[idx]
2489
- } : {}
2490
- }));
2491
- }
2492
- projection.data[sindex] = series;
2493
- }
2494
- // 7. Recenter all cartesian coordinates
2495
- if (originX !== null) {
2496
- for(let sindex = 0; sindex < projection.data.length; sindex++){
2497
- const series = projection.data[sindex];
2498
- if (series.x && series.y) {
2499
- series.x = series.x.map((v)=>v - originX);
2590
+ polarData.push({
2591
+ type: 'scatterpolar',
2592
+ ...commonProps
2593
+ });
2500
2594
  }
2501
2595
  }
2502
- // Also recenter allX for normalization
2503
- for(let i = 0; i < allX.length; i++){
2504
- allX[i] = allX[i] - originX;
2505
- }
2506
- }
2507
- // 8. Find the maximum absolute value among all x and y
2508
- let maxAbs = Math.max(...allX.map(Math.abs), ...allY.map(Math.abs));
2509
- maxAbs = maxAbs === 0 ? 1 : maxAbs;
2510
- // 9. Rescale all points so that the largest |x| or |y| is 0.5
2511
- for(let sindex = 0; sindex < projection.data.length; sindex++){
2512
- const series = projection.data[sindex];
2513
- if (series.x && series.y) {
2514
- series.x = series.x.map((v)=>v / (2 * maxAbs));
2515
- series.y = series.y.map((v)=>v / (2 * maxAbs));
2516
- }
2517
- }
2518
- // 10. Customize layout for perfect square with absolute positioning
2519
- const size = ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) || ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) || 500;
2520
- projection.layout = {
2521
- ...projection.layout,
2522
- width: size,
2523
- height: size
2596
+ });
2597
+ var _input_layout_height;
2598
+ return {
2599
+ data: polarData,
2600
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2601
+ height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 400,
2602
+ hideLegend,
2603
+ ...getPolarAxisProps(input.data, input.layout)
2524
2604
  };
2525
- // Attach originX as custom properties
2526
- projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
2527
- return projection;
2528
2605
  };
2529
2606
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2530
2607
  function isPlainObject(obj) {
@@ -2842,7 +2919,8 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2842
2919
  const xAxisLayout = layout[key];
2843
2920
  const domainXInfo = {
2844
2921
  start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
2845
- end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
2922
+ end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
2923
+ cellName: `x${domainX.length === 0 ? '' : domainX.length + 1}`
2846
2924
  };
2847
2925
  domainX.push(domainXInfo);
2848
2926
  } else if (key.startsWith('yaxis')) {
@@ -2865,7 +2943,8 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2865
2943
  const yAxisLayout = layout[key];
2866
2944
  const domainYInfo = {
2867
2945
  start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
2868
- end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
2946
+ end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
2947
+ cellName: `x${domainY.length === 0 ? '' : domainY.length + 1}`
2869
2948
  };
2870
2949
  domainY.push(domainYInfo);
2871
2950
  }
@@ -2878,11 +2957,13 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2878
2957
  const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
2879
2958
  const domainXInfo = {
2880
2959
  start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
2881
- end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
2960
+ end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1,
2961
+ cellName: `${NON_PLOT_KEY_PREFIX}${domainX.length - cartesianDomains + 1}`
2882
2962
  };
2883
2963
  const domainYInfo = {
2884
2964
  start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
2885
- end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
2965
+ end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1,
2966
+ cellName: `${NON_PLOT_KEY_PREFIX}${domainY.length - cartesianDomains + 1}`
2886
2967
  };
2887
2968
  domainX.push(domainXInfo);
2888
2969
  domainY.push(domainYInfo);
@@ -2890,6 +2971,24 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2890
2971
  });
2891
2972
  if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
2892
2973
  var _layout_annotations;
2974
+ Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
2975
+ if (key.startsWith('polar')) {
2976
+ var _polarLayout_domain, _polarLayout_domain1, _polarLayout_domain2, _polarLayout_domain3;
2977
+ const polarLayout = layout[key];
2978
+ const domainXInfo = {
2979
+ start: ((_polarLayout_domain = polarLayout.domain) === null || _polarLayout_domain === void 0 ? void 0 : _polarLayout_domain.x) ? polarLayout.domain.x[0] : 0,
2980
+ end: ((_polarLayout_domain1 = polarLayout.domain) === null || _polarLayout_domain1 === void 0 ? void 0 : _polarLayout_domain1.x) ? polarLayout.domain.x[1] : 1,
2981
+ cellName: key
2982
+ };
2983
+ const domainYInfo = {
2984
+ start: ((_polarLayout_domain2 = polarLayout.domain) === null || _polarLayout_domain2 === void 0 ? void 0 : _polarLayout_domain2.y) ? polarLayout.domain.y[0] : 0,
2985
+ end: ((_polarLayout_domain3 = polarLayout.domain) === null || _polarLayout_domain3 === void 0 ? void 0 : _polarLayout_domain3.y) ? polarLayout.domain.y[1] : 1,
2986
+ cellName: key
2987
+ };
2988
+ domainX.push(domainXInfo);
2989
+ domainY.push(domainYInfo);
2990
+ }
2991
+ });
2893
2992
  (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
2894
2993
  const xMatches = domainX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval.end ? [
2895
2994
  idx
@@ -2918,7 +3017,6 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2918
3017
  const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
2919
3018
  templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
2920
3019
  domainX.forEach((interval, index)=>{
2921
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
2922
3020
  const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
2923
3021
  const columnNumber = columnIndex + 1; // Column numbers are 1-based
2924
3022
  const annotationProps = annotations[index];
@@ -2933,7 +3031,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2933
3031
  end: 1
2934
3032
  }
2935
3033
  };
2936
- gridLayout[cellName] = row;
3034
+ gridLayout[interval.cellName] = row;
2937
3035
  });
2938
3036
  }
2939
3037
  if (domainY.length > 0) {
@@ -2948,12 +3046,11 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2948
3046
  const numberOfRows = sortedYStart.length;
2949
3047
  templateRows = `repeat(${numberOfRows}, 1fr)`;
2950
3048
  domainY.forEach((interval, index)=>{
2951
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
2952
3049
  const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
2953
3050
  const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
2954
3051
  const annotationProps = annotations[index];
2955
3052
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
2956
- const cell = gridLayout[cellName];
3053
+ const cell = gridLayout[interval.cellName];
2957
3054
  if (cell !== undefined) {
2958
3055
  cell.row = rowNumber;
2959
3056
  cell.yAnnotation = yAnnotation;
@@ -3286,3 +3383,109 @@ const getAxisValueResolver = (axType, dateParser)=>{
3286
3383
  }
3287
3384
  return new Date(value);
3288
3385
  };
3386
+ const POLAR_AXIS_BY_DATA_KEY = {
3387
+ r: 'radialAxis',
3388
+ theta: 'angularAxis'
3389
+ };
3390
+ export const DEFAULT_POLAR_SUBPLOT = 'polar';
3391
+ const getPolarLayout = (trace, layout)=>{
3392
+ const subplotId = (trace === null || trace === void 0 ? void 0 : trace.subplot) || DEFAULT_POLAR_SUBPLOT;
3393
+ return layout === null || layout === void 0 ? void 0 : layout[subplotId];
3394
+ };
3395
+ const getValidAxisValues = (data, dataKey)=>{
3396
+ const values = [];
3397
+ data.forEach((series)=>{
3398
+ if (isArrayOrTypedArray(series[dataKey])) {
3399
+ series[dataKey].forEach((val)=>{
3400
+ if (!isInvalidValue(val)) {
3401
+ values.push(val);
3402
+ }
3403
+ });
3404
+ }
3405
+ });
3406
+ return values;
3407
+ };
3408
+ const getPolarAxisType = (data, dataKey, declaredType)=>{
3409
+ if ([
3410
+ 'linear',
3411
+ 'log',
3412
+ 'date',
3413
+ 'category'
3414
+ ].includes(declaredType !== null && declaredType !== void 0 ? declaredType : '')) {
3415
+ return declaredType;
3416
+ }
3417
+ const values = getValidAxisValues(data, dataKey);
3418
+ if (isNumberArray(values) && !isYearArray(values)) {
3419
+ return 'linear';
3420
+ }
3421
+ if (isDateArray(values)) {
3422
+ return 'date';
3423
+ }
3424
+ return 'category';
3425
+ };
3426
+ const getPolarAxis = (data, dataKey, layout)=>{
3427
+ const polarLayout = getPolarLayout(data[0], layout);
3428
+ const ax = polarLayout === null || polarLayout === void 0 ? void 0 : polarLayout[POLAR_AXIS_BY_DATA_KEY[dataKey].toLowerCase()];
3429
+ return {
3430
+ ...ax,
3431
+ _dataKey: dataKey,
3432
+ _type: getPolarAxisType(data, dataKey, ax === null || ax === void 0 ? void 0 : ax.type)
3433
+ };
3434
+ };
3435
+ const getPolarAxisTickProps = (data, ax)=>{
3436
+ const props = {};
3437
+ if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
3438
+ const tickValues = ax._type === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3439
+ props.tickValues = tickValues;
3440
+ props.tickText = ax.ticktext;
3441
+ return props;
3442
+ }
3443
+ if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
3444
+ const dtick = plotlyDtick(ax.dtick, ax._type);
3445
+ const tick0 = plotlyTick0(ax.tick0, ax._type, dtick);
3446
+ props.tickStep = dtick;
3447
+ props.tick0 = tick0;
3448
+ return props;
3449
+ }
3450
+ if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
3451
+ props.tickCount = ax.nticks;
3452
+ }
3453
+ return props;
3454
+ };
3455
+ const getPolarAxisCategoryOrder = (data, ax)=>{
3456
+ if (ax._type !== 'category') {
3457
+ return 'data';
3458
+ }
3459
+ const isValidArray = isArrayOrTypedArray(ax.categoryarray) && ax.categoryarray.length > 0;
3460
+ if (isValidArray && (!ax.categoryorder || ax.categoryorder === 'array')) {
3461
+ return ax.categoryarray;
3462
+ }
3463
+ if (!ax.categoryorder || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
3464
+ const values = getValidAxisValues(data, ax._dataKey);
3465
+ const categoriesInTraceOrder = Array.from(new Set(values));
3466
+ return ax.autorange === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
3467
+ }
3468
+ return ax.categoryorder;
3469
+ };
3470
+ const getPolarAxisProps = (data, layout)=>{
3471
+ const props = {};
3472
+ Object.keys(POLAR_AXIS_BY_DATA_KEY).forEach((dataKey)=>{
3473
+ const propName = POLAR_AXIS_BY_DATA_KEY[dataKey];
3474
+ const ax = getPolarAxis(data, dataKey, layout);
3475
+ props[propName] = {
3476
+ scaleType: ax._type === 'log' ? 'log' : 'default',
3477
+ categoryOrder: getPolarAxisCategoryOrder(data, ax),
3478
+ tickFormat: ax.tickformat,
3479
+ ...getPolarAxisTickProps(data, ax),
3480
+ ...isArrayOrTypedArray(ax.range) ? {
3481
+ rangeStart: ax.range[0],
3482
+ rangeEnd: ax.range[1]
3483
+ } : {}
3484
+ };
3485
+ if (propName === 'angularAxis') {
3486
+ props[propName].unit = ax.thetaunit;
3487
+ props.direction = ax.direction;
3488
+ }
3489
+ });
3490
+ return props;
3491
+ };