|
|
@@ -15,7 +15,8 @@ export function handleRoseChartChartLogic(
|
|
|
id: yItem.id,
|
|
|
data: yItem.data.map((val) => {
|
|
|
const filters = formFilterAlign[index]?.filters || [];
|
|
|
- return val === null || (filters.length > 0 && !filters.includes(val[yItem.label]))
|
|
|
+ return val === null ||
|
|
|
+ (filters.length > 0 && !filters.includes(val[yItem.label]))
|
|
|
? null
|
|
|
: val;
|
|
|
}),
|
|
|
@@ -25,10 +26,17 @@ export function handleRoseChartChartLogic(
|
|
|
const filter = formFilterAlign[index];
|
|
|
const { number1, number2 } = filter;
|
|
|
|
|
|
- if ((number1 === null || number1 === "") && (number2 === null || number2 === "")) {
|
|
|
+ if (
|
|
|
+ (number1 === null || number1 === "") &&
|
|
|
+ (number2 === null || number2 === "")
|
|
|
+ ) {
|
|
|
return filteredItem;
|
|
|
} else {
|
|
|
- const filterDatas = filterData(filter, filteredItem.data, filteredItem.label);
|
|
|
+ const filterDatas = filterData(
|
|
|
+ filter,
|
|
|
+ filteredItem.data,
|
|
|
+ filteredItem.label
|
|
|
+ );
|
|
|
return { ...filteredItem, data: [...filterDatas] };
|
|
|
}
|
|
|
});
|
|
|
@@ -42,10 +50,20 @@ export function handleRoseChartChartLogic(
|
|
|
const xres = item.Xdata?.map((xitem) => ({
|
|
|
boundaryGap: false,
|
|
|
type: "category",
|
|
|
- data: xitem.data && xitem.data.map((val) => xitem.label + val[xitem.label] || null),
|
|
|
+ data:
|
|
|
+ xitem.data &&
|
|
|
+ xitem.data.map((val) => xitem.label + val[xitem.label] || null),
|
|
|
})).filter((items) => items);
|
|
|
|
|
|
- const baseColors = ["#E3F4BF", "#BEF7C8", "#86E6C8", "#36CFC9", "#209BDD", "#1581E6", "#0860BF"];
|
|
|
+ const baseColors = [
|
|
|
+ "#E3F4BF",
|
|
|
+ "#BEF7C8",
|
|
|
+ "#86E6C8",
|
|
|
+ "#36CFC9",
|
|
|
+ "#209BDD",
|
|
|
+ "#1581E6",
|
|
|
+ "#0860BF",
|
|
|
+ ];
|
|
|
|
|
|
const yres = item.Ydata?.map((yitem, yIndex) => ({
|
|
|
name: yitem.label,
|
|
|
@@ -54,10 +72,12 @@ export function handleRoseChartChartLogic(
|
|
|
progressiveThreshold: 3000,
|
|
|
progressive: true,
|
|
|
renderMode: "webgl",
|
|
|
- data: yitem.data && yitem.data.map((val, idx) => ({
|
|
|
- value: (val && val[yitem.label]) || 0,
|
|
|
- itemStyle: { color: baseColors[idx % baseColors.length] },
|
|
|
- })),
|
|
|
+ data:
|
|
|
+ yitem.data &&
|
|
|
+ yitem.data.map((val, idx) => ({
|
|
|
+ value: (val && val[yitem.label]) || 0,
|
|
|
+ itemStyle: { color: baseColors[idx % baseColors.length] },
|
|
|
+ })),
|
|
|
})).filter((items) => items);
|
|
|
|
|
|
if (item.Ydata[0]?.data?.length > 0) {
|
|
|
@@ -71,4 +91,40 @@ export function handleRoseChartChartLogic(
|
|
|
axisPointer: { type: "shadow" },
|
|
|
};
|
|
|
}
|
|
|
+ item.option.title = {
|
|
|
+ text: formLabelAlign.text ?? item.option.title?.text ?? "",
|
|
|
+ textStyle: {
|
|
|
+ color:
|
|
|
+ formLabelAlign.titleColor ??
|
|
|
+ item.option.title?.textStyle?.color ??
|
|
|
+ "#464646",
|
|
|
+ fontSize: formLabelAlign.titleColor
|
|
|
+ ? formLabelAlign.size
|
|
|
+ : item.option.title?.textStyle?.fontSize ?? 18,
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ item.option.backgroundColor =
|
|
|
+ formLabelAlign.background || item.option.backgroundColor || "transparent";
|
|
|
+
|
|
|
+ // 定义一个位置映射
|
|
|
+ const legendMap = {
|
|
|
+ top: { top: "top", left: "center" },
|
|
|
+ bottom: { top: "bottom", left: "center" },
|
|
|
+ left: { top: "center", left: "left", type: "scroll", orient: "vertical" },
|
|
|
+ right: { top: "center", left: "right", type: "scroll", orient: "vertical" },
|
|
|
+ };
|
|
|
+ // 获取 legendPosition,没有就默认 right
|
|
|
+ const legendPosition = formLabelAlign.legendPosition
|
|
|
+ ? legendMap[formLabelAlign.legendPosition]
|
|
|
+ : item.option.legend || legendMap.bottom;
|
|
|
+
|
|
|
+ // 设置 legend 配置
|
|
|
+ item.option.legend = {
|
|
|
+ ...legendPosition,
|
|
|
+ show: formLabelAlign.enableLegend ?? item.option.legend.show,
|
|
|
+ };
|
|
|
+ item.option.color = item.option.color.map((colorItem, colorInd) => {
|
|
|
+ return formLabelAlign?.dataColor?.[colorInd] ?? colorItem;
|
|
|
+ });
|
|
|
}
|