echart 折线统计图

var myChart = echarts.init(document.getElementById('chart'));
$.get('is.json', function(data) {
myChart.setOption(option = {
legend: {
data: ["接单数", "金额"]
},
tooltip: {
trigger: 'axis'
},
xAxis: {
data: data.map(function(item) {
return item[0];
})
},
yAxis: [{
type: 'value',
name: '金额'
},
{
type: 'value',
name: '接单数
'
}
//          splitLine: {
//              show: true
//          }
],
calculable: true,
toolbox: {
left: 'center',
feature: {
dataZoom: {
yAxisIndex: 'none'
},
restore: {},
saveAsImage: {}
}
},
dataZoom: [{
startValue: '2014-06-01'
}, {
type: 'inside'
}],
visualMap: {
show: false,
top: 10,
right: 10,
pieces: [{
gt: 0,
lte: 50,
color: '#2e88ff'
}],
outOfRange: {
color: '#2e88ff'
}
},
series: [{
"name": "金额",
"type": "line",
itemStyle: {
normal: {
lineStyle: {
color: '#b6a2de'
}
}
},
"data": data.map(function(item) {
return item[1];
}),
"smooth": true
}, {
"name": "接单数",
"type": "line",
yAxisIndex:1,  //不加就不会出现第二个y轴的数据
itemStyle: {
normal: {
lineStyle: {
color: '#2ec7c9'
}
}
},
"data": data.map(function(item) {
return item[2];
}),
"smooth": true
}]
});
});
posted @ 2017-06-30 16:32  Sun_Song  阅读(791)  评论(0编辑  收藏  举报