第一个legend有两张图,第二个legend有1张图,如何设置legend和series里的参数?
配置项如下
option = {
title: {
text: 'Awesome Chart'
},
legend: {
data: [{
name: '增量' //first legend
}, {
name: '增速' //second legend
}]
},
xAxis: [{
gridIndex: 0,
type: 'category',
data: ['1月-3月', '4月-6月', '7月-9月', '10月-12月']
}, {
gridIndex: 1,
type: 'category',
data: ['1月-3月', '4月-6月', '7月-9月', '10月-12月']
}],
yAxis: [{
gridIndex: 0,
type: 'value',
name: ''
}, {
gridIndex: 1,
type: 'value',
name: ''
}],
grid: [{
show: false,
left: '10%',
top: '10%',
containLabel: true,
width: '30%',
height: '35%'
}, {
show: false,
left: '50%',
top: '10%',
containLabel: true,
width: '30%',
height: '35%'
}],
//this is the first legend's series data,
//how to set the second legend's series data?
series: [{
name: '增量',
type: 'line',
xAxisIndex: 0,
yAxisIndex: 0,
label: {
normal: {
show: true,
position: 'top',
}
},
data: [56, 90, 98, 151]
}, {
name: '增量',
type: 'line',
xAxisIndex: 0,
yAxisIndex: 0,
label: {
normal: {
show: true,
position: 'top',
}
},
data: [48, 152, 160, 165]
}, {
name: '增速',
type: 'line',
xAxisIndex: 1,
yAxisIndex: 1,
symbolSize: 8, //拐点大小
label: {
normal: {
show: true,
position: 'top'
}
},
data: [23, 58, 97, 106]
}, {
name: '增速',
type: 'line',
xAxisIndex: 1,
yAxisIndex: 1,
symbolSize: 8, //拐点大小
label: {
normal: {
show: true,
position: 'top'
}
},
data: [10, 85, 98, 105]
}]
};