使用dataset 和 datasetIndex
option = {
legend: {},
tooltip: {},
dataset: [
{
dimensions: ['date', 'A'],
source: [
['8/1', 1.1],
['8/2', 1.2],
['8/3', 1.25],
['8/4', 1.15]
]
},
{
dimensions: ['date', 'B'],
source: [
['8/2', 1.02],
['8/3', 1.15],
['8/5', 1.2]
]
},
],
xAxis: {type: 'category'},
yAxis: {},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{
type: 'line',
datasetIndex: 0
},
{
type: 'line',
datasetIndex: 1
},
]
};