@fluentui/react-charts 0.0.0-nightly-20260112-0407.1 → 0.0.0-nightly-20260113-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 +356 -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 +12 -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 +5 -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 +8 -5
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -5
- 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 +11 -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 +4 -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 +10 -4
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +2 -5
- 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
|
@@ -10,6 +10,9 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
+
DEFAULT_POLAR_SUBPLOT: function() {
|
|
14
|
+
return DEFAULT_POLAR_SUBPLOT;
|
|
15
|
+
},
|
|
13
16
|
NON_PLOT_KEY_PREFIX: function() {
|
|
14
17
|
return NON_PLOT_KEY_PREFIX;
|
|
15
18
|
},
|
|
@@ -43,9 +46,6 @@ _export(exports, {
|
|
|
43
46
|
normalizeObjectArrayForGVBC: function() {
|
|
44
47
|
return normalizeObjectArrayForGVBC;
|
|
45
48
|
},
|
|
46
|
-
projectPolarToCartesian: function() {
|
|
47
|
-
return projectPolarToCartesian;
|
|
48
|
-
},
|
|
49
49
|
resolveXAxisPoint: function() {
|
|
50
50
|
return resolveXAxisPoint;
|
|
51
51
|
},
|
|
@@ -82,6 +82,9 @@ _export(exports, {
|
|
|
82
82
|
transformPlotlyJsonToLineChartProps: function() {
|
|
83
83
|
return transformPlotlyJsonToLineChartProps;
|
|
84
84
|
},
|
|
85
|
+
transformPlotlyJsonToPolarChartProps: function() {
|
|
86
|
+
return transformPlotlyJsonToPolarChartProps;
|
|
87
|
+
},
|
|
85
88
|
transformPlotlyJsonToSankeyProps: function() {
|
|
86
89
|
return transformPlotlyJsonToSankeyProps;
|
|
87
90
|
},
|
|
@@ -147,12 +150,37 @@ const dashOptions = {
|
|
|
147
150
|
}
|
|
148
151
|
};
|
|
149
152
|
function getTitles(layout) {
|
|
150
|
-
var
|
|
151
|
-
|
|
153
|
+
var _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
|
|
154
|
+
const titleObj = layout === null || layout === void 0 ? void 0 : layout.title;
|
|
155
|
+
var _titleObj_text;
|
|
156
|
+
const chartTitle = typeof titleObj === 'string' ? titleObj : (_titleObj_text = titleObj === null || titleObj === void 0 ? void 0 : titleObj.text) !== null && _titleObj_text !== void 0 ? _titleObj_text : '';
|
|
157
|
+
const titleFont = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.font : undefined;
|
|
158
|
+
const titleXAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.xanchor : undefined;
|
|
159
|
+
const titleYAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.yanchor : undefined;
|
|
160
|
+
const titlePad = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.pad : undefined;
|
|
161
|
+
const titleStyles = {
|
|
162
|
+
...titleFont ? {
|
|
163
|
+
titleFont
|
|
164
|
+
} : {},
|
|
165
|
+
...titleXAnchor ? {
|
|
166
|
+
titleXAnchor
|
|
167
|
+
} : {},
|
|
168
|
+
...titleYAnchor ? {
|
|
169
|
+
titleYAnchor
|
|
170
|
+
} : {},
|
|
171
|
+
...titlePad ? {
|
|
172
|
+
titlePad
|
|
173
|
+
} : {}
|
|
174
|
+
};
|
|
175
|
+
var _layout_xaxis_title_text, _layout_yaxis_title_text;
|
|
152
176
|
const titles = {
|
|
153
|
-
chartTitle
|
|
177
|
+
chartTitle,
|
|
178
|
+
...Object.keys(titleStyles).length > 0 ? {
|
|
179
|
+
titleStyles
|
|
180
|
+
} : {},
|
|
154
181
|
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 : '',
|
|
155
|
-
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 : ''
|
|
182
|
+
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 : '',
|
|
183
|
+
xAxisAnnotation: chartTitle
|
|
156
184
|
};
|
|
157
185
|
return titles;
|
|
158
186
|
}
|
|
@@ -1119,7 +1147,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
1119
1147
|
const donutMarginHorizontal = hideLabels ? 0 : 80;
|
|
1120
1148
|
const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
|
|
1121
1149
|
const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : _utilities.MIN_DONUT_RADIUS;
|
|
1122
|
-
const { chartTitle } = getTitles(input.layout);
|
|
1150
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
1123
1151
|
// Build anticlockwise order by keeping the first item, reversing the rest
|
|
1124
1152
|
const legends = Object.keys(mapLegendToDataPoint);
|
|
1125
1153
|
const reorderedEntries = legends.length > 1 ? [
|
|
@@ -1151,7 +1179,8 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
1151
1179
|
'percent+label'
|
|
1152
1180
|
].includes(firstData.textinfo) : true,
|
|
1153
1181
|
roundCorners: true,
|
|
1154
|
-
order: 'sorted'
|
|
1182
|
+
order: 'sorted',
|
|
1183
|
+
...titleStyles
|
|
1155
1184
|
};
|
|
1156
1185
|
};
|
|
1157
1186
|
const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
@@ -2152,7 +2181,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
2152
2181
|
};
|
|
2153
2182
|
};
|
|
2154
2183
|
const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
2155
|
-
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;
|
|
2184
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3, _input_layout4;
|
|
2156
2185
|
const { link, node } = input.data[0];
|
|
2157
2186
|
var _link_value;
|
|
2158
2187
|
const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
|
|
@@ -2194,7 +2223,7 @@ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorway
|
|
|
2194
2223
|
// ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
|
|
2195
2224
|
// },
|
|
2196
2225
|
// };
|
|
2197
|
-
const { chartTitle } = getTitles(input.layout);
|
|
2226
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2198
2227
|
var _input_layout_height;
|
|
2199
2228
|
return {
|
|
2200
2229
|
data: {
|
|
@@ -2202,7 +2231,11 @@ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorway
|
|
|
2202
2231
|
SankeyChartData: sankeyChartData
|
|
2203
2232
|
},
|
|
2204
2233
|
width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
|
|
2205
|
-
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
|
|
2234
|
+
height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468,
|
|
2235
|
+
// TODO
|
|
2236
|
+
// styles,
|
|
2237
|
+
hideLegend: isMultiPlot || ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.showlegend) === false,
|
|
2238
|
+
...titleStyles
|
|
2206
2239
|
};
|
|
2207
2240
|
};
|
|
2208
2241
|
const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -2253,7 +2286,7 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
2253
2286
|
const styles = {
|
|
2254
2287
|
sublabel: sublabelColor
|
|
2255
2288
|
};
|
|
2256
|
-
const { chartTitle } = getTitles(input.layout);
|
|
2289
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2257
2290
|
var _firstData_value2, _input_layout_height;
|
|
2258
2291
|
return {
|
|
2259
2292
|
segments,
|
|
@@ -2274,7 +2307,8 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
2274
2307
|
// styles,
|
|
2275
2308
|
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',
|
|
2276
2309
|
styles,
|
|
2277
|
-
roundCorners: true
|
|
2310
|
+
roundCorners: true,
|
|
2311
|
+
...titleStyles
|
|
2278
2312
|
};
|
|
2279
2313
|
};
|
|
2280
2314
|
const cleanText = (text)=>{
|
|
@@ -2417,13 +2451,16 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
|
|
|
2417
2451
|
},
|
|
2418
2452
|
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 : []
|
|
2419
2453
|
};
|
|
2454
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2420
2455
|
var _tableData_header_values;
|
|
2421
2456
|
return {
|
|
2422
2457
|
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),
|
|
2423
2458
|
rows,
|
|
2424
2459
|
width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
|
|
2425
2460
|
height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
|
|
2426
|
-
styles
|
|
2461
|
+
styles,
|
|
2462
|
+
chartTitle,
|
|
2463
|
+
...titleStyles
|
|
2427
2464
|
};
|
|
2428
2465
|
};
|
|
2429
2466
|
function getCategoriesAndValues(series) {
|
|
@@ -2567,151 +2604,88 @@ const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, col
|
|
|
2567
2604
|
});
|
|
2568
2605
|
});
|
|
2569
2606
|
}
|
|
2607
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2570
2608
|
return {
|
|
2571
2609
|
data: funnelData,
|
|
2610
|
+
chartTitle,
|
|
2572
2611
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
2573
2612
|
height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
|
|
2574
2613
|
orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
|
|
2575
|
-
hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false
|
|
2614
|
+
hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false,
|
|
2615
|
+
...titleStyles
|
|
2576
2616
|
};
|
|
2577
2617
|
};
|
|
2578
|
-
const
|
|
2618
|
+
const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
2579
2619
|
var _input_layout, _input_layout1;
|
|
2580
|
-
const
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
let categorical = false;
|
|
2634
|
-
if (!(0, _chartutilities.isNumberArray)(thetas)) {
|
|
2635
|
-
uniqueTheta = Array.from(new Set(thetas));
|
|
2636
|
-
categorical = true;
|
|
2637
|
-
}
|
|
2638
|
-
for(let ptindex = 0; ptindex < rVals.length; ptindex++){
|
|
2639
|
-
if ((0, _chartutilities.isInvalidValue)(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || (0, _chartutilities.isInvalidValue)(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
|
|
2640
|
-
continue;
|
|
2641
|
-
}
|
|
2642
|
-
// Map theta to angle in radians
|
|
2643
|
-
let thetaRad;
|
|
2644
|
-
if (categorical) {
|
|
2645
|
-
const idx = uniqueTheta.indexOf(thetas[ptindex]);
|
|
2646
|
-
const step = 2 * Math.PI / uniqueTheta.length;
|
|
2647
|
-
thetaRad = startAngleInRad + dirMultiplier * idx * step;
|
|
2620
|
+
const polarData = [];
|
|
2621
|
+
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
2622
|
+
const resolveRValue = getAxisValueResolver(getPolarAxis(input.data, 'r', input.layout)._type);
|
|
2623
|
+
input.data.forEach((series, index)=>{
|
|
2624
|
+
const legend = legends[index];
|
|
2625
|
+
if (series.type === 'scatterpolar') {
|
|
2626
|
+
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;
|
|
2627
|
+
const isAreaTrace = series.fill === 'toself' || series.fill === 'tonext';
|
|
2628
|
+
const isLineTrace = typeof series.mode === 'undefined' ? true : series.mode.includes('lines');
|
|
2629
|
+
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;
|
|
2630
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
|
|
2631
|
+
const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
|
|
2632
|
+
const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
|
|
2633
|
+
const finalSeriesColor = (0, _d3color.rgb)(seriesColor).copy({
|
|
2634
|
+
opacity: seriesOpacity
|
|
2635
|
+
}).formatHex8();
|
|
2636
|
+
const lineOptions = getLineOptions(series.line);
|
|
2637
|
+
const thetaUnit = series.thetaunit;
|
|
2638
|
+
const commonProps = {
|
|
2639
|
+
legend,
|
|
2640
|
+
legendShape: getLegendShape(series),
|
|
2641
|
+
color: finalSeriesColor,
|
|
2642
|
+
data: ((_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.map((r, rIndex)=>{
|
|
2643
|
+
var _series_theta, _series_marker, _series_marker1, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
2644
|
+
const theta = (_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[rIndex];
|
|
2645
|
+
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;
|
|
2646
|
+
const text = Array.isArray(series.text) ? series.text[rIndex] : series.text;
|
|
2647
|
+
const markerColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, rIndex, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
|
|
2648
|
+
const markerOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, rIndex);
|
|
2649
|
+
if ((0, _chartutilities.isInvalidValue)(resolveRValue(r)) || (0, _chartutilities.isInvalidValue)(theta)) {
|
|
2650
|
+
return;
|
|
2651
|
+
}
|
|
2652
|
+
return {
|
|
2653
|
+
r: resolveRValue(r),
|
|
2654
|
+
theta: typeof theta === 'number' ? thetaUnit === 'radians' ? theta * 180 / Math.PI : thetaUnit === 'gradians' ? theta * 0.9 : theta : theta,
|
|
2655
|
+
color: markerColor ? (0, _d3color.rgb)(markerColor).copy({
|
|
2656
|
+
opacity: markerOpacity
|
|
2657
|
+
}).formatHex8() : finalSeriesColor,
|
|
2658
|
+
...typeof markerSize !== 'undefined' ? {
|
|
2659
|
+
markerSize
|
|
2660
|
+
} : {},
|
|
2661
|
+
...typeof text !== 'undefined' ? {
|
|
2662
|
+
text
|
|
2663
|
+
} : {}
|
|
2664
|
+
};
|
|
2665
|
+
}).filter((item)=>typeof item !== 'undefined')) || []
|
|
2666
|
+
};
|
|
2667
|
+
if (isAreaTrace || isLineTrace) {
|
|
2668
|
+
polarData.push({
|
|
2669
|
+
type: isAreaTrace ? 'areapolar' : 'linepolar',
|
|
2670
|
+
...commonProps,
|
|
2671
|
+
lineOptions
|
|
2672
|
+
});
|
|
2648
2673
|
} else {
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
const polarRadius = rawRadius + radiusShift; // Only for projection
|
|
2654
|
-
// Calculate cartesian coordinates (with shifted polar origin)
|
|
2655
|
-
const x = polarRadius * Math.cos(thetaRad);
|
|
2656
|
-
const y = polarRadius * Math.sin(thetaRad);
|
|
2657
|
-
// Calculate the cartesian coordinates of the original polar origin (0,0)
|
|
2658
|
-
// This is the point that should be mapped to (0,0) in cartesian coordinates
|
|
2659
|
-
if (sindex === 0 && ptindex === 0) {
|
|
2660
|
-
// For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
|
|
2661
|
-
// But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
|
|
2662
|
-
originX = radiusShift;
|
|
2663
|
-
}
|
|
2664
|
-
series.x.push(x);
|
|
2665
|
-
series.y.push(y);
|
|
2666
|
-
allX.push(x);
|
|
2667
|
-
allY.push(y);
|
|
2668
|
-
}
|
|
2669
|
-
// Map text to each data point for downstream chart rendering
|
|
2670
|
-
if (series.x && series.y) {
|
|
2671
|
-
series.data = series.x.map((xVal, idx)=>({
|
|
2672
|
-
x: xVal,
|
|
2673
|
-
y: series.y[idx],
|
|
2674
|
-
...series.text ? {
|
|
2675
|
-
text: series.text[idx]
|
|
2676
|
-
} : {}
|
|
2677
|
-
}));
|
|
2678
|
-
}
|
|
2679
|
-
projection.data[sindex] = series;
|
|
2680
|
-
}
|
|
2681
|
-
// 7. Recenter all cartesian coordinates
|
|
2682
|
-
if (originX !== null) {
|
|
2683
|
-
for(let sindex = 0; sindex < projection.data.length; sindex++){
|
|
2684
|
-
const series = projection.data[sindex];
|
|
2685
|
-
if (series.x && series.y) {
|
|
2686
|
-
series.x = series.x.map((v)=>v - originX);
|
|
2674
|
+
polarData.push({
|
|
2675
|
+
type: 'scatterpolar',
|
|
2676
|
+
...commonProps
|
|
2677
|
+
});
|
|
2687
2678
|
}
|
|
2688
2679
|
}
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
// 9. Rescale all points so that the largest |x| or |y| is 0.5
|
|
2698
|
-
for(let sindex = 0; sindex < projection.data.length; sindex++){
|
|
2699
|
-
const series = projection.data[sindex];
|
|
2700
|
-
if (series.x && series.y) {
|
|
2701
|
-
series.x = series.x.map((v)=>v / (2 * maxAbs));
|
|
2702
|
-
series.y = series.y.map((v)=>v / (2 * maxAbs));
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
// 10. Customize layout for perfect square with absolute positioning
|
|
2706
|
-
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;
|
|
2707
|
-
projection.layout = {
|
|
2708
|
-
...projection.layout,
|
|
2709
|
-
width: size,
|
|
2710
|
-
height: size
|
|
2680
|
+
});
|
|
2681
|
+
var _input_layout_height;
|
|
2682
|
+
return {
|
|
2683
|
+
data: polarData,
|
|
2684
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
2685
|
+
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,
|
|
2686
|
+
hideLegend,
|
|
2687
|
+
...getPolarAxisProps(input.data, input.layout)
|
|
2711
2688
|
};
|
|
2712
|
-
// Attach originX as custom properties
|
|
2713
|
-
projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
|
|
2714
|
-
return projection;
|
|
2715
2689
|
};
|
|
2716
2690
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2717
2691
|
function isPlainObject(obj) {
|
|
@@ -3024,7 +2998,8 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3024
2998
|
const xAxisLayout = layout[key];
|
|
3025
2999
|
const domainXInfo = {
|
|
3026
3000
|
start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
|
|
3027
|
-
end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
|
|
3001
|
+
end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
|
|
3002
|
+
cellName: `x${domainX.length === 0 ? '' : domainX.length + 1}`
|
|
3028
3003
|
};
|
|
3029
3004
|
domainX.push(domainXInfo);
|
|
3030
3005
|
} else if (key.startsWith('yaxis')) {
|
|
@@ -3047,7 +3022,8 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3047
3022
|
const yAxisLayout = layout[key];
|
|
3048
3023
|
const domainYInfo = {
|
|
3049
3024
|
start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
|
|
3050
|
-
end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
|
|
3025
|
+
end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
|
|
3026
|
+
cellName: `x${domainY.length === 0 ? '' : domainY.length + 1}`
|
|
3051
3027
|
};
|
|
3052
3028
|
domainY.push(domainYInfo);
|
|
3053
3029
|
}
|
|
@@ -3060,11 +3036,13 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3060
3036
|
const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
|
|
3061
3037
|
const domainXInfo = {
|
|
3062
3038
|
start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
|
|
3063
|
-
end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
|
|
3039
|
+
end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1,
|
|
3040
|
+
cellName: `${NON_PLOT_KEY_PREFIX}${domainX.length - cartesianDomains + 1}`
|
|
3064
3041
|
};
|
|
3065
3042
|
const domainYInfo = {
|
|
3066
3043
|
start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
|
|
3067
|
-
end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
|
|
3044
|
+
end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1,
|
|
3045
|
+
cellName: `${NON_PLOT_KEY_PREFIX}${domainY.length - cartesianDomains + 1}`
|
|
3068
3046
|
};
|
|
3069
3047
|
domainX.push(domainXInfo);
|
|
3070
3048
|
domainY.push(domainYInfo);
|
|
@@ -3072,6 +3050,24 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3072
3050
|
});
|
|
3073
3051
|
if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
|
|
3074
3052
|
var _layout_annotations;
|
|
3053
|
+
Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
|
|
3054
|
+
if (key.startsWith('polar')) {
|
|
3055
|
+
var _polarLayout_domain, _polarLayout_domain1, _polarLayout_domain2, _polarLayout_domain3;
|
|
3056
|
+
const polarLayout = layout[key];
|
|
3057
|
+
const domainXInfo = {
|
|
3058
|
+
start: ((_polarLayout_domain = polarLayout.domain) === null || _polarLayout_domain === void 0 ? void 0 : _polarLayout_domain.x) ? polarLayout.domain.x[0] : 0,
|
|
3059
|
+
end: ((_polarLayout_domain1 = polarLayout.domain) === null || _polarLayout_domain1 === void 0 ? void 0 : _polarLayout_domain1.x) ? polarLayout.domain.x[1] : 1,
|
|
3060
|
+
cellName: key
|
|
3061
|
+
};
|
|
3062
|
+
const domainYInfo = {
|
|
3063
|
+
start: ((_polarLayout_domain2 = polarLayout.domain) === null || _polarLayout_domain2 === void 0 ? void 0 : _polarLayout_domain2.y) ? polarLayout.domain.y[0] : 0,
|
|
3064
|
+
end: ((_polarLayout_domain3 = polarLayout.domain) === null || _polarLayout_domain3 === void 0 ? void 0 : _polarLayout_domain3.y) ? polarLayout.domain.y[1] : 1,
|
|
3065
|
+
cellName: key
|
|
3066
|
+
};
|
|
3067
|
+
domainX.push(domainXInfo);
|
|
3068
|
+
domainY.push(domainYInfo);
|
|
3069
|
+
}
|
|
3070
|
+
});
|
|
3075
3071
|
(_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
|
|
3076
3072
|
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 ? [
|
|
3077
3073
|
idx
|
|
@@ -3100,7 +3096,6 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3100
3096
|
const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
|
|
3101
3097
|
templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
|
|
3102
3098
|
domainX.forEach((interval, index)=>{
|
|
3103
|
-
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
3104
3099
|
const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
|
|
3105
3100
|
const columnNumber = columnIndex + 1; // Column numbers are 1-based
|
|
3106
3101
|
const annotationProps = annotations[index];
|
|
@@ -3115,7 +3110,7 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3115
3110
|
end: 1
|
|
3116
3111
|
}
|
|
3117
3112
|
};
|
|
3118
|
-
gridLayout[cellName] = row;
|
|
3113
|
+
gridLayout[interval.cellName] = row;
|
|
3119
3114
|
});
|
|
3120
3115
|
}
|
|
3121
3116
|
if (domainY.length > 0) {
|
|
@@ -3130,12 +3125,11 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3130
3125
|
const numberOfRows = sortedYStart.length;
|
|
3131
3126
|
templateRows = `repeat(${numberOfRows}, 1fr)`;
|
|
3132
3127
|
domainY.forEach((interval, index)=>{
|
|
3133
|
-
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
3134
3128
|
const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
|
|
3135
3129
|
const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
|
|
3136
3130
|
const annotationProps = annotations[index];
|
|
3137
3131
|
const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
|
|
3138
|
-
const cell = gridLayout[cellName];
|
|
3132
|
+
const cell = gridLayout[interval.cellName];
|
|
3139
3133
|
if (cell !== undefined) {
|
|
3140
3134
|
cell.row = rowNumber;
|
|
3141
3135
|
cell.yAnnotation = yAnnotation;
|
|
@@ -3467,3 +3461,109 @@ const getAxisValueResolver = (axType, dateParser)=>{
|
|
|
3467
3461
|
}
|
|
3468
3462
|
return new Date(value);
|
|
3469
3463
|
};
|
|
3464
|
+
const POLAR_AXIS_BY_DATA_KEY = {
|
|
3465
|
+
r: 'radialAxis',
|
|
3466
|
+
theta: 'angularAxis'
|
|
3467
|
+
};
|
|
3468
|
+
const DEFAULT_POLAR_SUBPLOT = 'polar';
|
|
3469
|
+
const getPolarLayout = (trace, layout)=>{
|
|
3470
|
+
const subplotId = (trace === null || trace === void 0 ? void 0 : trace.subplot) || DEFAULT_POLAR_SUBPLOT;
|
|
3471
|
+
return layout === null || layout === void 0 ? void 0 : layout[subplotId];
|
|
3472
|
+
};
|
|
3473
|
+
const getValidAxisValues = (data, dataKey)=>{
|
|
3474
|
+
const values = [];
|
|
3475
|
+
data.forEach((series)=>{
|
|
3476
|
+
if ((0, _chartutilities.isArrayOrTypedArray)(series[dataKey])) {
|
|
3477
|
+
series[dataKey].forEach((val)=>{
|
|
3478
|
+
if (!(0, _chartutilities.isInvalidValue)(val)) {
|
|
3479
|
+
values.push(val);
|
|
3480
|
+
}
|
|
3481
|
+
});
|
|
3482
|
+
}
|
|
3483
|
+
});
|
|
3484
|
+
return values;
|
|
3485
|
+
};
|
|
3486
|
+
const getPolarAxisType = (data, dataKey, declaredType)=>{
|
|
3487
|
+
if ([
|
|
3488
|
+
'linear',
|
|
3489
|
+
'log',
|
|
3490
|
+
'date',
|
|
3491
|
+
'category'
|
|
3492
|
+
].includes(declaredType !== null && declaredType !== void 0 ? declaredType : '')) {
|
|
3493
|
+
return declaredType;
|
|
3494
|
+
}
|
|
3495
|
+
const values = getValidAxisValues(data, dataKey);
|
|
3496
|
+
if ((0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isYearArray)(values)) {
|
|
3497
|
+
return 'linear';
|
|
3498
|
+
}
|
|
3499
|
+
if ((0, _chartutilities.isDateArray)(values)) {
|
|
3500
|
+
return 'date';
|
|
3501
|
+
}
|
|
3502
|
+
return 'category';
|
|
3503
|
+
};
|
|
3504
|
+
const getPolarAxis = (data, dataKey, layout)=>{
|
|
3505
|
+
const polarLayout = getPolarLayout(data[0], layout);
|
|
3506
|
+
const ax = polarLayout === null || polarLayout === void 0 ? void 0 : polarLayout[POLAR_AXIS_BY_DATA_KEY[dataKey].toLowerCase()];
|
|
3507
|
+
return {
|
|
3508
|
+
...ax,
|
|
3509
|
+
_dataKey: dataKey,
|
|
3510
|
+
_type: getPolarAxisType(data, dataKey, ax === null || ax === void 0 ? void 0 : ax.type)
|
|
3511
|
+
};
|
|
3512
|
+
};
|
|
3513
|
+
const getPolarAxisTickProps = (data, ax)=>{
|
|
3514
|
+
const props = {};
|
|
3515
|
+
if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
|
|
3516
|
+
const tickValues = ax._type === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
|
|
3517
|
+
props.tickValues = tickValues;
|
|
3518
|
+
props.tickText = ax.ticktext;
|
|
3519
|
+
return props;
|
|
3520
|
+
}
|
|
3521
|
+
if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
|
|
3522
|
+
const dtick = plotlyDtick(ax.dtick, ax._type);
|
|
3523
|
+
const tick0 = plotlyTick0(ax.tick0, ax._type, dtick);
|
|
3524
|
+
props.tickStep = dtick;
|
|
3525
|
+
props.tick0 = tick0;
|
|
3526
|
+
return props;
|
|
3527
|
+
}
|
|
3528
|
+
if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
|
|
3529
|
+
props.tickCount = ax.nticks;
|
|
3530
|
+
}
|
|
3531
|
+
return props;
|
|
3532
|
+
};
|
|
3533
|
+
const getPolarAxisCategoryOrder = (data, ax)=>{
|
|
3534
|
+
if (ax._type !== 'category') {
|
|
3535
|
+
return 'data';
|
|
3536
|
+
}
|
|
3537
|
+
const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax.categoryarray) && ax.categoryarray.length > 0;
|
|
3538
|
+
if (isValidArray && (!ax.categoryorder || ax.categoryorder === 'array')) {
|
|
3539
|
+
return ax.categoryarray;
|
|
3540
|
+
}
|
|
3541
|
+
if (!ax.categoryorder || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
|
|
3542
|
+
const values = getValidAxisValues(data, ax._dataKey);
|
|
3543
|
+
const categoriesInTraceOrder = Array.from(new Set(values));
|
|
3544
|
+
return ax.autorange === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
|
|
3545
|
+
}
|
|
3546
|
+
return ax.categoryorder;
|
|
3547
|
+
};
|
|
3548
|
+
const getPolarAxisProps = (data, layout)=>{
|
|
3549
|
+
const props = {};
|
|
3550
|
+
Object.keys(POLAR_AXIS_BY_DATA_KEY).forEach((dataKey)=>{
|
|
3551
|
+
const propName = POLAR_AXIS_BY_DATA_KEY[dataKey];
|
|
3552
|
+
const ax = getPolarAxis(data, dataKey, layout);
|
|
3553
|
+
props[propName] = {
|
|
3554
|
+
scaleType: ax._type === 'log' ? 'log' : 'default',
|
|
3555
|
+
categoryOrder: getPolarAxisCategoryOrder(data, ax),
|
|
3556
|
+
tickFormat: ax.tickformat,
|
|
3557
|
+
...getPolarAxisTickProps(data, ax),
|
|
3558
|
+
...(0, _chartutilities.isArrayOrTypedArray)(ax.range) ? {
|
|
3559
|
+
rangeStart: ax.range[0],
|
|
3560
|
+
rangeEnd: ax.range[1]
|
|
3561
|
+
} : {}
|
|
3562
|
+
};
|
|
3563
|
+
if (propName === 'angularAxis') {
|
|
3564
|
+
props[propName].unit = ax.thetaunit;
|
|
3565
|
+
props.direction = ax.direction;
|
|
3566
|
+
}
|
|
3567
|
+
});
|
|
3568
|
+
return props;
|
|
3569
|
+
};
|