feat: 在管理看板组件中优化最大值计算逻辑,支持根据可见数据系列动态计算并向上取整
This commit is contained in:
@@ -414,13 +414,19 @@ const { chartOption } = useChartOption(() => {
|
||||
},
|
||||
min: 0,
|
||||
max: function (value: { min: number; max: number }) {
|
||||
// 获取当前显示的数据系列
|
||||
const visibleSeries = seriesData.value.filter((_, index) => {
|
||||
const name = ['成功订单量', '总订单量', '成功率'][index];
|
||||
return legendSelected.value[name as keyof LegendSelected];
|
||||
});
|
||||
|
||||
// 否则返回订单量的最大值
|
||||
const maxValue = Math.max(
|
||||
...seriesData.value[0].data,
|
||||
...seriesData.value[1].data,
|
||||
...seriesData.value[2].data
|
||||
...visibleSeries.map(series =>
|
||||
series.data.reduce((sum, value) => sum + value, 0)
|
||||
)
|
||||
);
|
||||
return Math.ceil(maxValue); // 向上取整到最接近的千位
|
||||
return Math.ceil(maxValue + 1); // 向上取整到最接近的千位
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user