Echarts 取消柱状图坐标轴线、设置不同颜色、
取消柱状图坐标轴线 splitLine
xAxis: {
type: 'value',
boundaryGap: [0, 0.01],
// 取消坐标线
splitLine: {
show: false
},
axisLabel: {
show: true,
textStyle: {
// color: '#c3dbff', //更改坐标轴文字颜色
// fontSize : 12 //更改坐标轴文字大小
}
}
},
yAxis: {
type: 'category',
data: ['黄色预警', '红色预警'],
// 取消坐标线
// show: false,
splitLine: {
show: false,
},
axisLabel: {
show: true,
textStyle: {
// color: '#c3dbff', //更改坐标轴文字颜色
// fontSize : 12 //更改坐标轴文字大小
}
}
},
设置不同颜色
series: [
{
type: 'bar',
data: [18203,52563],
itemStyle: {
normal: {
color: function(params) {
//首先定义一个数组,设置颜色
let colorList = ['#D8E500','#AD4D36']; // 颜色
return colorList[params.dataIndex]
},
// 柱状图上显示数量
label: {
show: true, // 是否显示
// position: 'right' // 位置
formatter: '{@value}', // 内容
color: '#fff' // 文字颜色
}
}
},
},
],
还没有评论,来说两句吧...