@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.
- package/CHANGELOG.md +13 -13
- package/dist/index.d.ts +360 -0
- package/lib/PolarChart.js +1 -0
- package/lib/PolarChart.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.js +21 -7
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +5 -3
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +250 -153
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +14 -4
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +13 -4
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +6 -5
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/PolarChart/PolarChart.js +576 -0
- package/lib/components/PolarChart/PolarChart.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.types.js +1 -0
- package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.utils.js +174 -0
- package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib/components/PolarChart/index.js +2 -0
- package/lib/components/PolarChart/index.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.js +13 -3
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +23 -6
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/ChartTitle.js +33 -0
- package/lib/utilities/ChartTitle.js.map +1 -0
- package/lib/utilities/Common.styles.js +73 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +70 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.js +2 -2
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/PolarChart.js +6 -0
- package/lib-commonjs/PolarChart.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js +21 -7
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +4 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +256 -156
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +13 -3
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +12 -3
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +5 -4
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/PolarChart/PolarChart.js +586 -0
- package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib-commonjs/components/PolarChart/index.js +7 -0
- package/lib-commonjs/components/PolarChart/index.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +13 -3
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -4
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/ChartTitle.js +41 -0
- package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.js +69 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +6 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +10 -10
|
@@ -50,12 +50,37 @@ const dashOptions = {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
function getTitles(layout) {
|
|
53
|
-
var
|
|
54
|
-
|
|
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
|
|
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
|
|
2524
|
+
export const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
2488
2525
|
var _input_layout, _input_layout1;
|
|
2489
|
-
const
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
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
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
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
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
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
|
+
};
|