自定义折线图

//随机生成五十条数据
var data = [];
var xsxis = [];
var ran = function(max){
return Math.floor(Math.random() * max);
};
for(var i = 0; i < 50;i++){
data.push(ran(45));
xsxis.push(i+1);
}


option = {
title: {
text: '折线图'
},
tooltip: {},
legend: {
data:['销量']
},
dataZoom: [
{
type:'slider',
xAxisIndex:[0],
start:1,
end:50
}
],
xAxis: {
data: xsxis
},
yAxis: {
min:0,
max:45
},
series: [{
name: '销量',
type: 'line',
data: data
}]
};

posted @ 2017-09-27 10:55  11个条子  阅读(243)  评论(0编辑  收藏  举报