echart出现x轴双类目显示
app.title = '折柱混合';
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
dataView: {show: true, readOnly: false},
magicType: {show: true, type: ['line', 'bar']},
restore: {show: true},
saveAsImage: {show: true}
}
},
xAxis: [
{
type: 'category',
data: ['1月','2月','3月','4月','5月'],
axisPointer: {
type: 'shadow'
},
position:'bottom',
offset:20,
axisTick:{
show:true,
length:40,
lineStyle:{
type:'dotted'
}
}
},
{
type: 'category',
data: ['蒸发量','蒸发量1','降水量',
'蒸发量','蒸发量1','降水量',
'蒸发量','蒸发量1','降水量',
'蒸发量','蒸发量1','降水量',
'蒸发量','蒸发量1','降水量'],
position:'bottom',
axisPointer: {
type: 'shadow'
},
axisTick:{
show:true
}
}
],
yAxis: [
{
type: 'value',
name: '水量',
min: 0,
max: 250,
interval: 50,
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '温度',
min: 0,
max: 25,
interval: 5,
axisLabel: {
formatter: '{value} °C'
}
}
],
series: [
{
name:'蒸发量',
type:'bar',
data:[2.0, 4.9, 7.0, 23.2, 25.6]
},
{
name:'蒸发量1',
type:'bar',
data:[2.0, 4.9, 7.0, 23.2, 25.6]
},
{
name:'降水量',
type:'bar',
data:[2.6, 5.9, 9.0, 26.4, 28.7] },
{
name:'平均温度',
type:'line',
yAxisIndex: 1,
data:[2.0, 2.2, 3.3, 4.5, 6.3]
}
]
};
显示结果如图所示:
转载于:https://my.oschina.net/kxhome/blog/2990081