下面代码直接复制到echarts示例中:直通车
option ={
"grid": [
{
"containLabel": true,
"left": 0,
"right": 2,
"bottom": "54%"
},
{
"containLabel": true,
"left": 0,
"right": 2,
"bottom": 40,
"height": "45%"
}
],
"axisPointer": { // 是否联动显示tooltip
"link": {
"xAxisIndex": "all"
}
},
"tooltip": {
"trigger": "axis",
"show": true
},
dataset: [
{
dimensions: [ 'name', 'C001'],
source: [
{
name: 'id', C001: 231, C002: 189
},
{
name: 'id1', C001: 120, C002: 131
}
]
},
{
dimensions: [ 'name', 'C001'],
source: [
{
name: 'id1', C001: 731, C002: 131
},
{
name: 'id2', C001: 201, C002: 131
}
]
}
],
"xAxis": [
{
"show": true,
"name": "",
"type": "category",
"boundaryGap": true,
"nameLocation": "end",
"nameGap": 20,
},
{
"show": true,
"name": "",
"type": "category",
"boundaryGap": true,
"gridIndex": 1,
"position": "top",
"nameLocation": "end",
"nameGap": 20,
}
],
"yAxis": [
{
"name": "得分",
"show": true,
"nameLocation": "end",
"nameGap": 20,
"type": "value",
"axisLine": {
"show": true
},
"axisLabel": {
"show": true,
"margin": 12
},
"splitLine": {
"show": false
}
},
{
"name": "得分()",
"show": true,
"nameLocation": "end",
"nameGap": 20,
"type": "value",
"gridIndex": 1,
"inverse": true, // 倒转图
"axisLine": {
"show": true
},
"axisLabel": {
"show": true,
"margin": 12
},
"splitLine": {
"show": false,
},
"axisTick": {
"show": true
}
}
],
"series": [
{
datasetIndex: 0,
"name": "本月得分",
"type": "line",
// 设置使用那个「x、y」系列
"xAxisIndex": 0,
"yAxisIndex": 0
},
{
datasetIndex: 1,
"name": "上月得分",
"type": "line",
// 设置使用那个「x、y」系列
"xAxisIndex": 1,
"yAxisIndex": 1
}
]
}