假如两条折线,一条data7,8,9另一条5,6,7,8,9. 其中7,8,9的X轴相对应的应该是5,6,7 可现在对应的是1,2,3 现在我想通过选择legend。改变X轴的坐标。
配置项如下
option = {
title: {
text: 'Awesome Chart'
},
grid: {
left: 45,
top: 60,
right: 20,
bottom: 100
},
tooltip: {
trigger: 'axis'
},
legend: {
selectedMode: 'single',
top: 230,
// bottom:20,
left: 'center',
itemWidth: 0,
itemGap: 0,
data: [{
name: '轻油',
icon: 'none',
}, {
name: '重油',
icon: 'none',
}],
},
xAxis: {
data: [1, 2, 3, 4, 5, 6, 7]
},
yAxis: {},
series: [{
name: '轻油',
type: 'line',
data: [null, null, null, null, 7, 8, 9],
showSymbol: false,
smooth: true,
}, {
name: '重油',
type: 'line',
data: [5, 6, 7, 8, 9, 10],
showSymbol: false,
smooth: true,
}, ]
};