10-5-2 柱状图(坐标轴刻度与标签对齐)
option = {
title: {
text: '柱状图(坐标轴刻度与标签对齐)'
},
color: ['#02f3f2'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
axisTick: {//坐标轴刻度与标签对齐
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '数值',//单个类别直接在这定义即可,相当于legend: {data: ['数值'] },
type: 'bar',
barWidth: '50%',
data: [120, 142, 220, 334, 490, 430, 320]
}
]
};