diff --git a/frontend/src/components/v-charts/components/Line.vue b/frontend/src/components/v-charts/components/Line.vue index 6db8f967cfca..04e827d9b7ce 100644 --- a/frontend/src/components/v-charts/components/Line.vue +++ b/frontend/src/components/v-charts/components/Line.vue @@ -141,6 +141,7 @@ function initChart() { }); } + const grid = props.option.grid || { left: '7%', right: '7%', bottom: '20%' }; const option = { title: [ { @@ -205,9 +206,9 @@ function initChart() { return res; }, }, - grid: props.option.grid || { left: '7%', right: '7%', bottom: '20%' }, + grid, legend: itemSelect || { - right: 10, + right: grid.right || 10, itemWidth: 8, textStyle: { color: '#646A73', @@ -228,7 +229,14 @@ function initChart() { }, }, series: series, - dataZoom: [{ startValue: props?.option.xData[0], show: props.dataZoom }], + dataZoom: [ + { + ...(props.option.xData?.[0] ? { startValue: props.option.xData[0] } : {}), + left: grid.left, + right: grid.right, + show: props.dataZoom, + }, + ], }; // 渲染数据 itemChart.setOption(option, true); diff --git a/frontend/src/views/home/index.vue b/frontend/src/views/home/index.vue index 881d205b6836..ba1444e1bcee 100644 --- a/frontend/src/views/home/index.vue +++ b/frontend/src/views/home/index.vue @@ -118,7 +118,7 @@