@fluentui/react-charts 0.0.0-nightly-20260112-0407.1 → 0.0.0-nightly-20260114-0406.1

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 (143) hide show
  1. package/CHANGELOG.md +13 -13
  2. package/dist/index.d.ts +360 -0
  3. package/lib/PolarChart.js +1 -0
  4. package/lib/PolarChart.js.map +1 -0
  5. package/lib/components/ChartTable/ChartTable.js +21 -7
  6. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  7. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  8. package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
  9. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  10. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  11. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  12. package/lib/components/CommonComponents/CartesianChart.js +5 -3
  13. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  14. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  15. package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
  16. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  17. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +250 -153
  18. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  19. package/lib/components/DonutChart/DonutChart.js +14 -4
  20. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  21. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  22. package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
  23. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  24. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
  25. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  26. package/lib/components/FunnelChart/FunnelChart.js +13 -4
  27. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  28. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  29. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
  30. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  31. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  32. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  33. package/lib/components/GaugeChart/GaugeChart.js +6 -5
  34. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  35. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  36. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
  37. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  38. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  39. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  40. package/lib/components/PolarChart/PolarChart.js +576 -0
  41. package/lib/components/PolarChart/PolarChart.js.map +1 -0
  42. package/lib/components/PolarChart/PolarChart.types.js +1 -0
  43. package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
  44. package/lib/components/PolarChart/PolarChart.utils.js +174 -0
  45. package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
  46. package/lib/components/PolarChart/index.js +2 -0
  47. package/lib/components/PolarChart/index.js.map +1 -0
  48. package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
  49. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  50. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
  51. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  52. package/lib/components/SankeyChart/SankeyChart.js +13 -3
  53. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  54. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  55. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +23 -6
  56. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  57. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
  58. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  59. package/lib/index.js +1 -0
  60. package/lib/index.js.map +1 -1
  61. package/lib/types/DataPoint.js +1 -1
  62. package/lib/types/DataPoint.js.map +1 -1
  63. package/lib/utilities/ChartTitle.js +33 -0
  64. package/lib/utilities/ChartTitle.js.map +1 -0
  65. package/lib/utilities/Common.styles.js +73 -1
  66. package/lib/utilities/Common.styles.js.map +1 -1
  67. package/lib/utilities/Common.styles.raw.js +70 -0
  68. package/lib/utilities/Common.styles.raw.js.map +1 -1
  69. package/lib/utilities/index.js +1 -0
  70. package/lib/utilities/index.js.map +1 -1
  71. package/lib/utilities/utilities.js +2 -2
  72. package/lib/utilities/utilities.js.map +1 -1
  73. package/lib-commonjs/PolarChart.js +6 -0
  74. package/lib-commonjs/PolarChart.js.map +1 -0
  75. package/lib-commonjs/components/ChartTable/ChartTable.js +21 -7
  76. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  77. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  78. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
  79. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
  80. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
  81. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
  82. package/lib-commonjs/components/CommonComponents/CartesianChart.js +4 -2
  83. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  84. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  85. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
  86. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  87. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +256 -156
  88. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  89. package/lib-commonjs/components/DonutChart/DonutChart.js +13 -3
  90. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  91. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  92. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
  93. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  94. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
  95. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  96. package/lib-commonjs/components/FunnelChart/FunnelChart.js +12 -3
  97. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  98. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  99. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
  100. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
  101. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
  102. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
  103. package/lib-commonjs/components/GaugeChart/GaugeChart.js +5 -4
  104. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  105. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  106. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
  107. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  108. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
  109. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
  110. package/lib-commonjs/components/PolarChart/PolarChart.js +586 -0
  111. package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
  112. package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
  113. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
  114. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
  115. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
  116. package/lib-commonjs/components/PolarChart/index.js +7 -0
  117. package/lib-commonjs/components/PolarChart/index.js.map +1 -0
  118. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
  119. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
  120. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
  121. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
  122. package/lib-commonjs/components/SankeyChart/SankeyChart.js +13 -3
  123. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  124. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  125. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -4
  126. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  127. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
  128. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  129. package/lib-commonjs/index.js +1 -0
  130. package/lib-commonjs/index.js.map +1 -1
  131. package/lib-commonjs/types/DataPoint.js +1 -1
  132. package/lib-commonjs/types/DataPoint.js.map +1 -1
  133. package/lib-commonjs/utilities/ChartTitle.js +41 -0
  134. package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
  135. package/lib-commonjs/utilities/Common.styles.js +69 -0
  136. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  137. package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
  138. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  139. package/lib-commonjs/utilities/index.js +1 -0
  140. package/lib-commonjs/utilities/index.js.map +1 -1
  141. package/lib-commonjs/utilities/utilities.js +6 -0
  142. package/lib-commonjs/utilities/utilities.js.map +1 -1
  143. package/package.json +10 -10
@@ -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
  }
@@ -1028,7 +1053,7 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
1028
1053
  const donutMarginHorizontal = hideLabels ? 0 : 80;
1029
1054
  const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
1030
1055
  const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : MIN_DONUT_RADIUS;
1031
- const { chartTitle } = getTitles(input.layout);
1056
+ const { chartTitle, titleStyles } = getTitles(input.layout);
1032
1057
  // Build anticlockwise order by keeping the first item, reversing the rest
1033
1058
  const legends = Object.keys(mapLegendToDataPoint);
1034
1059
  const reorderedEntries = legends.length > 1 ? [
@@ -1060,7 +1085,8 @@ export const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, co
1060
1085
  'percent+label'
1061
1086
  ].includes(firstData.textinfo) : true,
1062
1087
  roundCorners: true,
1063
- order: 'sorted'
1088
+ order: 'sorted',
1089
+ ...titleStyles
1064
1090
  };
1065
1091
  };
1066
1092
  export const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
@@ -2061,7 +2087,7 @@ export const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap,
2061
2087
  };
2062
2088
  };
2063
2089
  export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2064
- 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;
2090
+ 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;
2065
2091
  const { link, node } = input.data[0];
2066
2092
  var _link_value;
2067
2093
  const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
@@ -2103,7 +2129,7 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
2103
2129
  // ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
2104
2130
  // },
2105
2131
  // };
2106
- const { chartTitle } = getTitles(input.layout);
2132
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2107
2133
  var _input_layout_height;
2108
2134
  return {
2109
2135
  data: {
@@ -2111,7 +2137,11 @@ export const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, c
2111
2137
  SankeyChartData: sankeyChartData
2112
2138
  },
2113
2139
  width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
2114
- 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
2140
+ 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,
2141
+ // TODO
2142
+ // styles,
2143
+ hideLegend: isMultiPlot || ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.showlegend) === false,
2144
+ ...titleStyles
2115
2145
  };
2116
2146
  };
2117
2147
  export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
@@ -2162,7 +2192,7 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
2162
2192
  const styles = {
2163
2193
  sublabel: sublabelColor
2164
2194
  };
2165
- const { chartTitle } = getTitles(input.layout);
2195
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2166
2196
  var _firstData_value2, _input_layout_height;
2167
2197
  return {
2168
2198
  segments,
@@ -2183,7 +2213,8 @@ export const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, co
2183
2213
  // styles,
2184
2214
  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',
2185
2215
  styles,
2186
- roundCorners: true
2216
+ roundCorners: true,
2217
+ ...titleStyles
2187
2218
  };
2188
2219
  };
2189
2220
  const cleanText = (text)=>{
@@ -2326,13 +2357,16 @@ export const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMa
2326
2357
  },
2327
2358
  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 : []
2328
2359
  };
2360
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2329
2361
  var _tableData_header_values;
2330
2362
  return {
2331
2363
  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),
2332
2364
  rows,
2333
2365
  width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
2334
2366
  height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
2335
- styles
2367
+ styles,
2368
+ chartTitle,
2369
+ ...titleStyles
2336
2370
  };
2337
2371
  };
2338
2372
  function getCategoriesAndValues(series) {
@@ -2476,151 +2510,88 @@ export const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorM
2476
2510
  });
2477
2511
  });
2478
2512
  }
2513
+ const { chartTitle, titleStyles } = getTitles(input.layout);
2479
2514
  return {
2480
2515
  data: funnelData,
2516
+ chartTitle,
2481
2517
  width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2482
2518
  height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
2483
2519
  orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
2484
- hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false
2520
+ hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false,
2521
+ ...titleStyles
2485
2522
  };
2486
2523
  };
2487
- export const projectPolarToCartesian = (input)=>{
2524
+ export const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
2488
2525
  var _input_layout, _input_layout1;
2489
- const projection = {
2490
- ...input
2491
- };
2492
- // Find the global min and max radius across all series
2493
- let minRadius = 0;
2494
- let maxRadius = 0;
2495
- for(let sindex = 0; sindex < input.data.length; sindex++){
2496
- const rVals = input.data[sindex].r;
2497
- if (rVals && isArrayOrTypedArray(rVals)) {
2498
- for(let ptindex = 0; ptindex < rVals.length; ptindex++){
2499
- if (!isInvalidValue(rVals[ptindex])) {
2500
- minRadius = Math.min(minRadius, rVals[ptindex]);
2501
- maxRadius = Math.max(maxRadius, rVals[ptindex]);
2502
- }
2503
- }
2504
- }
2505
- }
2506
- // If there are negative radii, compute the shift
2507
- const radiusShift = minRadius < 0 ? -minRadius : 0;
2508
- // Collect all unique theta values from all scatterpolar series for equal spacing
2509
- const allThetaValues = new Set();
2510
- for(let sindex = 0; sindex < input.data.length; sindex++){
2511
- const series = input.data[sindex];
2512
- if (series.theta && isArrayOrTypedArray(series.theta)) {
2513
- series.theta.forEach((theta)=>allThetaValues.add(String(theta)));
2514
- }
2515
- }
2516
- // Project all points and create a perfect square domain
2517
- const allX = [];
2518
- const allY = [];
2519
- let originX = null;
2520
- for(let sindex = 0; sindex < input.data.length; sindex++){
2521
- var _input_layout_polar_angularaxis, _input_layout_polar, _input_layout2, _input_layout_polar_angularaxis1, _input_layout_polar1, _input_layout3;
2522
- const series = input.data[sindex];
2523
- // If scatterpolar, set __axisLabel to all unique theta values for equal spacing
2524
- if (isArrayOrTypedArray(series.theta)) {
2525
- series.__axisLabel = Array.from(allThetaValues);
2526
- }
2527
- series.x = [];
2528
- series.y = [];
2529
- const thetas = series.theta;
2530
- const rVals = series.r;
2531
- // Skip if rVals or thetas are not arrays
2532
- if (!isArrayOrTypedArray(rVals) || !isArrayOrTypedArray(thetas)) {
2533
- projection.data[sindex] = series;
2534
- continue;
2535
- }
2536
- // retrieve polar axis settings
2537
- 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;
2538
- var _input_layout_polar_angularaxis_rotation;
2539
- 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;
2540
- // Compute tick positions if categorical
2541
- let uniqueTheta = [];
2542
- let categorical = false;
2543
- if (!isNumberArray(thetas)) {
2544
- uniqueTheta = Array.from(new Set(thetas));
2545
- categorical = true;
2546
- }
2547
- for(let ptindex = 0; ptindex < rVals.length; ptindex++){
2548
- if (isInvalidValue(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || isInvalidValue(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
2549
- continue;
2550
- }
2551
- // Map theta to angle in radians
2552
- let thetaRad;
2553
- if (categorical) {
2554
- const idx = uniqueTheta.indexOf(thetas[ptindex]);
2555
- const step = 2 * Math.PI / uniqueTheta.length;
2556
- thetaRad = startAngleInRad + dirMultiplier * idx * step;
2526
+ const polarData = [];
2527
+ const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
2528
+ const resolveRValue = getAxisValueResolver(getPolarAxis(input.data, 'r', input.layout)._type);
2529
+ input.data.forEach((series, index)=>{
2530
+ const legend = legends[index];
2531
+ if (series.type === 'scatterpolar') {
2532
+ 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;
2533
+ const isAreaTrace = series.fill === 'toself' || series.fill === 'tonext';
2534
+ const isLineTrace = typeof series.mode === 'undefined' ? true : series.mode.includes('lines');
2535
+ 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;
2536
+ 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);
2537
+ 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);
2538
+ const seriesOpacity = getOpacity(series, index);
2539
+ const finalSeriesColor = rgb(seriesColor).copy({
2540
+ opacity: seriesOpacity
2541
+ }).formatHex8();
2542
+ const lineOptions = getLineOptions(series.line);
2543
+ const thetaUnit = series.thetaunit;
2544
+ const commonProps = {
2545
+ legend,
2546
+ legendShape: getLegendShape(series),
2547
+ color: finalSeriesColor,
2548
+ data: ((_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.map((r, rIndex)=>{
2549
+ var _series_theta, _series_marker, _series_marker1, _input_layout_template_layout, _input_layout_template, _input_layout;
2550
+ const theta = (_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[rIndex];
2551
+ 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;
2552
+ const text = Array.isArray(series.text) ? series.text[rIndex] : series.text;
2553
+ 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);
2554
+ const markerOpacity = getOpacity(series, rIndex);
2555
+ if (isInvalidValue(resolveRValue(r)) || isInvalidValue(theta)) {
2556
+ return;
2557
+ }
2558
+ return {
2559
+ r: resolveRValue(r),
2560
+ theta: typeof theta === 'number' ? thetaUnit === 'radians' ? theta * 180 / Math.PI : thetaUnit === 'gradians' ? theta * 0.9 : theta : theta,
2561
+ color: markerColor ? rgb(markerColor).copy({
2562
+ opacity: markerOpacity
2563
+ }).formatHex8() : finalSeriesColor,
2564
+ ...typeof markerSize !== 'undefined' ? {
2565
+ markerSize
2566
+ } : {},
2567
+ ...typeof text !== 'undefined' ? {
2568
+ text
2569
+ } : {}
2570
+ };
2571
+ }).filter((item)=>typeof item !== 'undefined')) || []
2572
+ };
2573
+ if (isAreaTrace || isLineTrace) {
2574
+ polarData.push({
2575
+ type: isAreaTrace ? 'areapolar' : 'linepolar',
2576
+ ...commonProps,
2577
+ lineOptions
2578
+ });
2557
2579
  } else {
2558
- thetaRad = startAngleInRad + dirMultiplier * (thetas[ptindex] * Math.PI / 180);
2559
- }
2560
- // Shift only the polar origin (not the cartesian)
2561
- const rawRadius = rVals[ptindex];
2562
- const polarRadius = rawRadius + radiusShift; // Only for projection
2563
- // Calculate cartesian coordinates (with shifted polar origin)
2564
- const x = polarRadius * Math.cos(thetaRad);
2565
- const y = polarRadius * Math.sin(thetaRad);
2566
- // Calculate the cartesian coordinates of the original polar origin (0,0)
2567
- // This is the point that should be mapped to (0,0) in cartesian coordinates
2568
- if (sindex === 0 && ptindex === 0) {
2569
- // For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
2570
- // But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
2571
- originX = radiusShift;
2572
- }
2573
- series.x.push(x);
2574
- series.y.push(y);
2575
- allX.push(x);
2576
- allY.push(y);
2577
- }
2578
- // Map text to each data point for downstream chart rendering
2579
- if (series.x && series.y) {
2580
- series.data = series.x.map((xVal, idx)=>({
2581
- x: xVal,
2582
- y: series.y[idx],
2583
- ...series.text ? {
2584
- text: series.text[idx]
2585
- } : {}
2586
- }));
2587
- }
2588
- projection.data[sindex] = series;
2589
- }
2590
- // 7. Recenter all cartesian coordinates
2591
- if (originX !== null) {
2592
- for(let sindex = 0; sindex < projection.data.length; sindex++){
2593
- const series = projection.data[sindex];
2594
- if (series.x && series.y) {
2595
- series.x = series.x.map((v)=>v - originX);
2580
+ polarData.push({
2581
+ type: 'scatterpolar',
2582
+ ...commonProps
2583
+ });
2596
2584
  }
2597
2585
  }
2598
- // Also recenter allX for normalization
2599
- for(let i = 0; i < allX.length; i++){
2600
- allX[i] = allX[i] - originX;
2601
- }
2602
- }
2603
- // 8. Find the maximum absolute value among all x and y
2604
- let maxAbs = Math.max(...allX.map(Math.abs), ...allY.map(Math.abs));
2605
- maxAbs = maxAbs === 0 ? 1 : maxAbs;
2606
- // 9. Rescale all points so that the largest |x| or |y| is 0.5
2607
- for(let sindex = 0; sindex < projection.data.length; sindex++){
2608
- const series = projection.data[sindex];
2609
- if (series.x && series.y) {
2610
- series.x = series.x.map((v)=>v / (2 * maxAbs));
2611
- series.y = series.y.map((v)=>v / (2 * maxAbs));
2612
- }
2613
- }
2614
- // 10. Customize layout for perfect square with absolute positioning
2615
- 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;
2616
- projection.layout = {
2617
- ...projection.layout,
2618
- width: size,
2619
- height: size
2586
+ });
2587
+ var _input_layout_height;
2588
+ return {
2589
+ data: polarData,
2590
+ width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
2591
+ 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,
2592
+ hideLegend,
2593
+ ...getPolarAxisProps(input.data, input.layout)
2620
2594
  };
2621
- // Attach originX as custom properties
2622
- projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
2623
- return projection;
2624
2595
  };
2625
2596
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2626
2597
  function isPlainObject(obj) {
@@ -2938,7 +2909,8 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2938
2909
  const xAxisLayout = layout[key];
2939
2910
  const domainXInfo = {
2940
2911
  start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
2941
- end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
2912
+ end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
2913
+ cellName: `x${domainX.length === 0 ? '' : domainX.length + 1}`
2942
2914
  };
2943
2915
  domainX.push(domainXInfo);
2944
2916
  } else if (key.startsWith('yaxis')) {
@@ -2961,7 +2933,8 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2961
2933
  const yAxisLayout = layout[key];
2962
2934
  const domainYInfo = {
2963
2935
  start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
2964
- end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
2936
+ end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
2937
+ cellName: `x${domainY.length === 0 ? '' : domainY.length + 1}`
2965
2938
  };
2966
2939
  domainY.push(domainYInfo);
2967
2940
  }
@@ -2974,11 +2947,13 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2974
2947
  const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
2975
2948
  const domainXInfo = {
2976
2949
  start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
2977
- end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
2950
+ end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1,
2951
+ cellName: `${NON_PLOT_KEY_PREFIX}${domainX.length - cartesianDomains + 1}`
2978
2952
  };
2979
2953
  const domainYInfo = {
2980
2954
  start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
2981
- end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
2955
+ end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1,
2956
+ cellName: `${NON_PLOT_KEY_PREFIX}${domainY.length - cartesianDomains + 1}`
2982
2957
  };
2983
2958
  domainX.push(domainXInfo);
2984
2959
  domainY.push(domainYInfo);
@@ -2986,6 +2961,24 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
2986
2961
  });
2987
2962
  if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
2988
2963
  var _layout_annotations;
2964
+ Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
2965
+ if (key.startsWith('polar')) {
2966
+ var _polarLayout_domain, _polarLayout_domain1, _polarLayout_domain2, _polarLayout_domain3;
2967
+ const polarLayout = layout[key];
2968
+ const domainXInfo = {
2969
+ start: ((_polarLayout_domain = polarLayout.domain) === null || _polarLayout_domain === void 0 ? void 0 : _polarLayout_domain.x) ? polarLayout.domain.x[0] : 0,
2970
+ end: ((_polarLayout_domain1 = polarLayout.domain) === null || _polarLayout_domain1 === void 0 ? void 0 : _polarLayout_domain1.x) ? polarLayout.domain.x[1] : 1,
2971
+ cellName: key
2972
+ };
2973
+ const domainYInfo = {
2974
+ start: ((_polarLayout_domain2 = polarLayout.domain) === null || _polarLayout_domain2 === void 0 ? void 0 : _polarLayout_domain2.y) ? polarLayout.domain.y[0] : 0,
2975
+ end: ((_polarLayout_domain3 = polarLayout.domain) === null || _polarLayout_domain3 === void 0 ? void 0 : _polarLayout_domain3.y) ? polarLayout.domain.y[1] : 1,
2976
+ cellName: key
2977
+ };
2978
+ domainX.push(domainXInfo);
2979
+ domainY.push(domainYInfo);
2980
+ }
2981
+ });
2989
2982
  (_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
2990
2983
  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 ? [
2991
2984
  idx
@@ -3014,7 +3007,6 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
3014
3007
  const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
3015
3008
  templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
3016
3009
  domainX.forEach((interval, index)=>{
3017
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
3018
3010
  const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
3019
3011
  const columnNumber = columnIndex + 1; // Column numbers are 1-based
3020
3012
  const annotationProps = annotations[index];
@@ -3029,7 +3021,7 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
3029
3021
  end: 1
3030
3022
  }
3031
3023
  };
3032
- gridLayout[cellName] = row;
3024
+ gridLayout[interval.cellName] = row;
3033
3025
  });
3034
3026
  }
3035
3027
  if (domainY.length > 0) {
@@ -3044,12 +3036,11 @@ export const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
3044
3036
  const numberOfRows = sortedYStart.length;
3045
3037
  templateRows = `repeat(${numberOfRows}, 1fr)`;
3046
3038
  domainY.forEach((interval, index)=>{
3047
- const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
3048
3039
  const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
3049
3040
  const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
3050
3041
  const annotationProps = annotations[index];
3051
3042
  const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
3052
- const cell = gridLayout[cellName];
3043
+ const cell = gridLayout[interval.cellName];
3053
3044
  if (cell !== undefined) {
3054
3045
  cell.row = rowNumber;
3055
3046
  cell.yAnnotation = yAnnotation;
@@ -3382,3 +3373,109 @@ const getAxisValueResolver = (axType, dateParser)=>{
3382
3373
  }
3383
3374
  return new Date(value);
3384
3375
  };
3376
+ const POLAR_AXIS_BY_DATA_KEY = {
3377
+ r: 'radialAxis',
3378
+ theta: 'angularAxis'
3379
+ };
3380
+ export const DEFAULT_POLAR_SUBPLOT = 'polar';
3381
+ const getPolarLayout = (trace, layout)=>{
3382
+ const subplotId = (trace === null || trace === void 0 ? void 0 : trace.subplot) || DEFAULT_POLAR_SUBPLOT;
3383
+ return layout === null || layout === void 0 ? void 0 : layout[subplotId];
3384
+ };
3385
+ const getValidAxisValues = (data, dataKey)=>{
3386
+ const values = [];
3387
+ data.forEach((series)=>{
3388
+ if (isArrayOrTypedArray(series[dataKey])) {
3389
+ series[dataKey].forEach((val)=>{
3390
+ if (!isInvalidValue(val)) {
3391
+ values.push(val);
3392
+ }
3393
+ });
3394
+ }
3395
+ });
3396
+ return values;
3397
+ };
3398
+ const getPolarAxisType = (data, dataKey, declaredType)=>{
3399
+ if ([
3400
+ 'linear',
3401
+ 'log',
3402
+ 'date',
3403
+ 'category'
3404
+ ].includes(declaredType !== null && declaredType !== void 0 ? declaredType : '')) {
3405
+ return declaredType;
3406
+ }
3407
+ const values = getValidAxisValues(data, dataKey);
3408
+ if (isNumberArray(values) && !isYearArray(values)) {
3409
+ return 'linear';
3410
+ }
3411
+ if (isDateArray(values)) {
3412
+ return 'date';
3413
+ }
3414
+ return 'category';
3415
+ };
3416
+ const getPolarAxis = (data, dataKey, layout)=>{
3417
+ const polarLayout = getPolarLayout(data[0], layout);
3418
+ const ax = polarLayout === null || polarLayout === void 0 ? void 0 : polarLayout[POLAR_AXIS_BY_DATA_KEY[dataKey].toLowerCase()];
3419
+ return {
3420
+ ...ax,
3421
+ _dataKey: dataKey,
3422
+ _type: getPolarAxisType(data, dataKey, ax === null || ax === void 0 ? void 0 : ax.type)
3423
+ };
3424
+ };
3425
+ const getPolarAxisTickProps = (data, ax)=>{
3426
+ const props = {};
3427
+ if ((!ax.tickmode || ax.tickmode === 'array') && isArrayOrTypedArray(ax.tickvals)) {
3428
+ const tickValues = ax._type === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
3429
+ props.tickValues = tickValues;
3430
+ props.tickText = ax.ticktext;
3431
+ return props;
3432
+ }
3433
+ if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
3434
+ const dtick = plotlyDtick(ax.dtick, ax._type);
3435
+ const tick0 = plotlyTick0(ax.tick0, ax._type, dtick);
3436
+ props.tickStep = dtick;
3437
+ props.tick0 = tick0;
3438
+ return props;
3439
+ }
3440
+ if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
3441
+ props.tickCount = ax.nticks;
3442
+ }
3443
+ return props;
3444
+ };
3445
+ const getPolarAxisCategoryOrder = (data, ax)=>{
3446
+ if (ax._type !== 'category') {
3447
+ return 'data';
3448
+ }
3449
+ const isValidArray = isArrayOrTypedArray(ax.categoryarray) && ax.categoryarray.length > 0;
3450
+ if (isValidArray && (!ax.categoryorder || ax.categoryorder === 'array')) {
3451
+ return ax.categoryarray;
3452
+ }
3453
+ if (!ax.categoryorder || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
3454
+ const values = getValidAxisValues(data, ax._dataKey);
3455
+ const categoriesInTraceOrder = Array.from(new Set(values));
3456
+ return ax.autorange === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
3457
+ }
3458
+ return ax.categoryorder;
3459
+ };
3460
+ const getPolarAxisProps = (data, layout)=>{
3461
+ const props = {};
3462
+ Object.keys(POLAR_AXIS_BY_DATA_KEY).forEach((dataKey)=>{
3463
+ const propName = POLAR_AXIS_BY_DATA_KEY[dataKey];
3464
+ const ax = getPolarAxis(data, dataKey, layout);
3465
+ props[propName] = {
3466
+ scaleType: ax._type === 'log' ? 'log' : 'default',
3467
+ categoryOrder: getPolarAxisCategoryOrder(data, ax),
3468
+ tickFormat: ax.tickformat,
3469
+ ...getPolarAxisTickProps(data, ax),
3470
+ ...isArrayOrTypedArray(ax.range) ? {
3471
+ rangeStart: ax.range[0],
3472
+ rangeEnd: ax.range[1]
3473
+ } : {}
3474
+ };
3475
+ if (propName === 'angularAxis') {
3476
+ props[propName].unit = ax.thetaunit;
3477
+ props.direction = ax.direction;
3478
+ }
3479
+ });
3480
+ return props;
3481
+ };