数据格式为:data[[x轴值,data]],堆叠时会出现悬空现象
配置项如下
option = {
title: {
},
tooltip: {
trigger: 'axis'
},
toolbox: {
feature: {
dataView: {
show: true,
readOnly: false
},
restore: {
show: true
},
saveAsImage: {
show: true
}
}
},
grid: {
containLabel: true
},
legend: {
},
dataZoom:{
type:'slider'
},
xAxis: [{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: ['2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016']
}],
yAxis: [{
type: 'value',
name: '检查单位',
position: 'right',
axisLabel: {
formatter: '{value} sec'
},
splitLine:{
show:false
}
}, {
type: 'value',
name: '剂量',
position: 'left',
splitLine:{
show:false
}
}],
series: [{
name: '增速',
type: 'scatter',
yAxisIndex: 0,
label: {
normal: {
show: true,
position: 'top',
}
},
data: [['2016',5],['2005',6]]
}, {
name: '销量',
type: 'bar',
yAxisIndex: 1,
stack: '总量',
itemStyle:{
normal: {
color:'#00ff00'
}
},
data: [['2000',1],['2001',1],['2002',1],['2003',1],['2004',1],['2005',1],['2006',1],['2007',1],['2008',1],['2009',1],['2010',1],['2011',1],['2012',1],['2014',1],['2015',1],['2016',1]]
}, {
name: '销量',
type: 'bar',
yAxisIndex: 1,
stack: '总量',
itemStyle:{
normal: {
color:'#00ffff'
}
},
data: [['2000',1],['2001',1],['2002',1],['2003',1],['2004',1],['2005',1],['2006',1],['2007',1],['2008',1],['2009',1],['2010',1],['2011',1],['2012',1],['2013',1],['2014',1],['2016',1]]
}]
};