diff --git a/chapter2/mysite/myapp/static/scripts/trend.js b/chapter2/mysite/myapp/static/scripts/trend.js index 2c75b4d..f47bc75 100755 --- a/chapter2/mysite/myapp/static/scripts/trend.js +++ b/chapter2/mysite/myapp/static/scripts/trend.js @@ -147,6 +147,14 @@ $(function(){ if (document.getElementById('lineChart1')) { var lineChart1 = echarts.init(document.getElementById('lineChart1')); + var lineChart1_names = []; + var lineChart1_datas = []; + for(var key in last_month_sell){ + lineChart1_names.push(key); + lineChart1_datas.push(last_month_sell[key]); + } + + if(lineChart1){ lineChart1.setOption({ title: { @@ -193,7 +201,7 @@ $(function(){ xAxis: [ { type: 'category', - data : symptomName, + data : lineChart1_names, boundaryGap : false, axisLine:{ lineStyle:{ @@ -221,7 +229,7 @@ $(function(){ type:'line', smooth:true, itemStyle: {normal: {areaStyle: {type: 'default'}}}, - data:[120, 132, 101, 134, 90, 230, 210,120, 132, 101, 134, 90] + data:lineChart1_datas, }, ]