代码
option = {
// X 轴的配置信息
xAxis: {
type: 'category',
data: ['昨日','今日'],
axisTick:{
show:false
},
axisLine:{
show:false
}
},
// Y轴信息的配置
yAxis: {
type: 'value',
min:0,
max:70.00,
interval:10.00,
// 坐标轴刻度相关设置
axisTick:{
// 隐藏坐标轴刻度
show:false
},
// 坐标轴轴线相关设置
axisLine:{
// 隐藏坐标轴线
show:false
},
// 坐标轴刻度标签的相关设置
axisLabel:{
formatter:function(value,index){
return value.toFixed(2)
}
}
},
series: [{
data: [46.42, 28.60],
type: 'bar',
barWidth:50,
barGap:'90%'
},{
data: [62.28, 37.22],
type: 'bar',
barWidth:50,
}]
};
核心代码【实现Y轴数据保留小数点后两位】
axisLabel:{
// 内容格式器
formatter:function(value,index){
return value.toFixed(2)
}
}