$(function(){
// 基於準備好的dom,初始化echarts實例
var myChart = echarts.init(document.getElementById('leftDiv'),'macarons');
// 指定圖表的配置項和數據
myChart.setOption({
title: {
text: '近一個月任務完成量'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {
data:['完成數']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'category',
boundaryGap: false,
data: []
},
yAxis: {
type: 'value'
},
series: [
{
name:'完成數',
type:'line',
data:[]
}
]
});
var days = [];
var nums = [];
$.ajax({
type:'post',
async: true,
url:'reportController/getMonthFinish.do',
data: {},
success:function(data){
myChart.setOption({ //加載數據圖表
xAxis: {
data: data.days
},
series: [{
// 根據名字對應到相應的系列
name: '完成數',
data: data.taskNum
}]
});
},error:function(){
console.log(2222222);
}
});
// 使用剛指定的配置項和數據顯示圖表。
});