diff --git a/chapter2/mysite/myapp/static/scripts/trend.js b/chapter2/mysite/myapp/static/scripts/trend.js index 88893e8..f0de9ea 100755 --- a/chapter2/mysite/myapp/static/scripts/trend.js +++ b/chapter2/mysite/myapp/static/scripts/trend.js @@ -221,6 +221,14 @@ $(function(){ }) //TOP10销量趋势 + var histogramChart3_names = []; + var histogramChart3_datas =[]; + for(var key in top10_sells){ + histogramChart3_names.push(key['product_name']); + histogramChart3_datas.push(key['good_c']); + } + + var histogramChart3 = echarts.init(document.getElementById('histogramChart3')); histogramChart3.setOption({ @@ -233,7 +241,7 @@ $(function(){ }, yAxis: [{ show: true, - data: ['女装','鞋靴','童装玩具','手机','美妆 ','珠宝','保健品','眼镜'], + data: histogramChart3_names, inverse: true, axisLine: { show: false @@ -269,7 +277,7 @@ $(function(){ }, { show: true, inverse: true, - data: [2000, 1800, 1200, 1100,900,900,800,700], + data: histogramChart3_datas, axisLabel: { textStyle: { fontSize: 12,