diff --git a/chapter2/mysite/myapp/static/scripts/trend.js b/chapter2/mysite/myapp/static/scripts/trend.js index 4916551..88893e8 100755 --- a/chapter2/mysite/myapp/static/scripts/trend.js +++ b/chapter2/mysite/myapp/static/scripts/trend.js @@ -409,7 +409,11 @@ $(function(){ }) - //年龄分布 + //终端分布 + var pieChart1Data = []; + for(var key in from_type_info){ + pieChart1Data.push({value: from_type_info[key], name: key}); + } var pieChart1 = echarts.init(document.getElementById('pieChart1')); pieChart1.setOption({ color:["#32cd32","#ff7f50","#87cefa","#FD6C88","#4b5cc4","#faff72"], @@ -420,24 +424,15 @@ $(function(){ calculable : true, series : [ { - name:'购买人群', + name:'终端分布', type:'pie', radius : [30, 110], center : ['50%', '50%'], roseType : 'area', x: '50%', - - sort : 'ascending', - data:[ - {value:10, name:'婴儿(1-3岁)'}, - {value:5, name:'少儿(4-10岁)'}, - {value:15, name:'少年(10-18岁)'}, - {value:25, name:'青年(18-45岁)'}, - {value:125, name:'中年(45-60岁)'}, - {value:175, name:'老年(60岁以上)'}, - ] + data: pieChart1Data } ] }) diff --git a/chapter2/mysite/myapp/templates/myapp/result.html b/chapter2/mysite/myapp/templates/myapp/result.html index ff28170..22c4fa6 100644 --- a/chapter2/mysite/myapp/templates/myapp/result.html +++ b/chapter2/mysite/myapp/templates/myapp/result.html @@ -105,7 +105,7 @@
-
年龄分布
+
购买终端分布