1.代碼示例
option = {
legend: {
data:['曲線1', '曲線2']
},
tooltip : {
trigger: 'axis',
axisPointer: {
type: 'cross',
animation: false,
}
},
toolbox: {
show: true,
feature: {
dataZoom: {
yAxisIndex: 'none'
},
dataView: {readOnly: false},
magicType: {type: ['line', 'bar']},
restore: {},
saveAsImage: {}
}
},
grid: {
top: 70,
bottom: 50
},
xAxis: {
type: 'category',
name:'寬度(mm)',
nameTextStyle:{
color:'#333'
},
boundaryGap: true
},
yAxis:{
name:'高度(mm)',
type: 'value',
nameTextStyle:{
color:'#333'
}
},
series: [{
name:'曲線1',
symbolSize: 5,
data: [
[0, 2],
[2, 5],
[3, 9],
[5, 16],
[7, 24],
[9, 18],
[12, 15],
[15, 5],
[17, 2],
[19, 1]
],
type: 'line',
smooth:true,
showSymbol: false,
barGap: 0
},
{
name:'曲線2',
symbolSize: 5,
data: [
[0, 1],
[2, 3],
[3, 7],
[5, 13],
[7, 21],
[9, 16],
[12, 12],
[15, 3],
[17, 1],
[19, 0]
],
type: 'line',
smooth:true,
showSymbol:false,
barGap: 0
}
]
};
2.圖片示例