Commit 984d2638 authored by 谢章伟's avatar 谢章伟

柱状图调整,数值为零时转成null,解决数值差距大但柱子高度一样的问题

parent f86bf58f
......@@ -494,24 +494,24 @@ export default {
var car=[];
let carPlan=this.formatNumber(plan.car);
car.push(carPlan);
car.push(this.switchZeroToNull(carPlan));
let carCompletion=this.formatNumber(complete.car);
car.push(carCompletion);
car.push(this.formatNumber(remaining.car));
car.push(this.switchZeroToNull(carCompletion));
car.push(this.switchZeroToNull(this.formatNumber(remaining.car)));
this.carPlanRate=carPlan==0?100:Math.floor((100*carCompletion)/carPlan);
var ship=[];
let shipPlan=this.formatNumber(plan.ship);
ship.push(shipPlan);
ship.push(this.switchZeroToNull(shipPlan));
let shipCompletion=this.formatNumber(complete.ship);
ship.push(shipCompletion);
ship.push(this.formatNumber(remaining.ship));
ship.push(this.switchZeroToNull(shipCompletion));
ship.push(this.switchZeroToNull(this.formatNumber(remaining.ship)));
this.shipPlanRate=shipPlan==0?100:Math.floor((shipCompletion*100)/shipPlan);
var train=[];
let trainPlan=this.formatNumber(plan.train);
train.push(trainPlan);
train.push(this.switchZeroToNull(trainPlan));
let trainCompletion=this.formatNumber(complete.train);
train.push(trainCompletion);
train.push(this.formatNumber(remaining.train));
train.push(this.switchZeroToNull(trainCompletion));
train.push(this.switchZeroToNull(this.formatNumber(remaining.train)));
this.trainPlanRate=trainPlan==0?100:Math.floor((100*trainCompletion)/trainPlan);
// 渲染
var seryCar=this.getcarShipTrainCss();
......@@ -550,6 +550,10 @@ export default {
// 格式化保留两位小数,返回数字
return Number(conver_num_retain(number).replaceAll(',',''));
},
// 为0时返回null
switchZeroToNull(number){
return number===0?null:number;
},
getcarShipTrainCss(){
return {
type: 'bar',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment