企业信息的网站广告点击一次多少钱
当值为全为0时,如果不设置yAxis的最大值的话,会有默认的高度在图标中间,但是值显示是为0
如下图
需要设置yAxis的最大值
// 以下,Math.max求取两组数值中最大值,最大值为0,设置max
let max = Math.max(…cashList,…countList)
if(max == 0){
max = 0.1
}
yAxis: {
format: (val) =>{
return val.toFixed(2)
},
max: max
}
res.result.forEach((item,index) =>{daysList.push(item.data.substring(5,item.data.length));cashList.push(item.total/100);countList.push(item.count);});// 以下,Math.max求取两组数值中最大值,最大值为0,设置maxlet max = Math.max(...cashList,...countList) if(max == 0){max = 0.1}new Charts({canvasId: 'columnChart',dataPointShape: false,type: 'column',categories: daysList,series: [{name: '收入',data: cashList,color:"rgba(255, 157, 0, 0.54)"}, {name: '发展人数',data: countList,color:"rgba(0, 134, 255, 0.54)"}],legend: false,yAxis: {disabled: true,gridColor: '#fff',format: (val) =>{return val.toFixed(2)},min:0,max: max},xAxis: {disableGrid: true,},width: 300,height: 168,dataLabel: true,extra: {column: {width: 20 //柱的宽度}}});
效果如下图: