Bläddra i källkod

优化功率预测曲线图Y轴刻度被左缘裁切: 公共组件PowerLineChart与辐照度对比页grid由固定left(42/48)改为left=8+containLabel, 绘图区自动按Y轴刻度文字宽度自适应留白, 7个预测页面(超短期/短期/中期功率及三个修正页、辐照度对比)曲线图内容完整展示

taosj 1 vecka sedan
förälder
incheckning
191bb1a69d

+ 2 - 1
forecast-backend-vue/src/views/ufo/electricity/components/PowerLineChart.vue

@@ -49,7 +49,8 @@ const chartOption = computed(() => {
     color: props.series.map((item) => item.color).filter(Boolean),
     tooltip: {trigger: 'axis'},
     legend,
-    grid: {left: 42, right: 24, top: props.legendWidth ? 58 : 46, bottom: 52},
+    // containLabel 让 grid 自动容纳 Y 轴刻度文字,避免长数值被容器左缘裁切
+    grid: {left: 8, right: 24, top: props.legendWidth ? 58 : 46, bottom: 52, containLabel: true},
     xAxis: {type: 'category', boundaryGap: false, data: props.xAxis},
     yAxis: {type: 'value', name: props.yAxisName, splitLine: {lineStyle: {color: '#e6eef8'}}},
     dataZoom: [

+ 1 - 1
forecast-backend-vue/src/views/ufo/electricity/forecast/IrradiancePowerComparison.vue

@@ -166,7 +166,7 @@ const renderChart = () => {
       itemGap: 16,
       textStyle: { fontSize: 12 },
     },
-    grid: { left: 48, right: 48, top: 40, bottom: 52 },
+    grid: { left: 8, right: 48, top: 40, bottom: 52, containLabel: true },
     xAxis: { 
       type: 'time',
       splitLine: { show: false },