This commit is contained in:
guange 2019-01-18 18:58:51 +08:00
parent 096d2ea2fd
commit 26fcbe549c
3 changed files with 14 additions and 4 deletions

View File

@ -83,6 +83,13 @@ $(function(){
var histogramChart2 = echarts.init(document.getElementById('histogramChart2')); var histogramChart2 = echarts.init(document.getElementById('histogramChart2'));
var histogramChart2_names = [];
var histogramChart2_datas = [];
for(var key in hour_sell){
histogramChart2_names.push(key);
histogramChart2_names.push(hour_sell[key]);
}
histogramChart2.setOption({ histogramChart2.setOption({
color:['#FD6C88'], color:['#FD6C88'],
@ -100,7 +107,7 @@ $(function(){
yAxis : [ yAxis : [
{ {
type : 'category', type : 'category',
data : ['1秒-3秒', '4-6秒', '7-9秒', '10-30秒', '30-60秒', '1-3分钟', '3-10分钟', '10-30分钟','30分钟','1-3小时','4-6小时','7-9小时','10-30小时','30-60小时','60小时'], data : histogramChart2_names,
axisLine:{ axisLine:{
lineStyle:{ lineStyle:{
color: '#FD6C88' color: '#FD6C88'
@ -138,8 +145,8 @@ $(function(){
{ {
name:'', name:'',
type:'bar', type:'bar',
barWidth : 20, barWidth : 5,
data:[170,146,116,819,704,413,251,175,20,18,30,50,11], data:histogramChart2_datas,
}, },
] ]
}) })

View File

@ -10,6 +10,7 @@
var from_type_info = {{from_type_info|safe}}; var from_type_info = {{from_type_info|safe}};
var top10_sells = {{top10_sells|safe}}; var top10_sells = {{top10_sells|safe}};
var last_month_sell = {{last_month_sell|safe}}; var last_month_sell = {{last_month_sell|safe}};
var hour_sell = {{hour_sell|safe}};
</script> </script>
<script src="{% static "scripts/Plugin/jquery-3.3.1.min.js" %}"></script> <script src="{% static "scripts/Plugin/jquery-3.3.1.min.js" %}"></script>

View File

@ -32,5 +32,7 @@ def result(request):
top10_sells = [entry for entry in Top10Sells.objects.order_by('id').values()] top10_sells = [entry for entry in Top10Sells.objects.order_by('id').values()]
last_month_sell = json.loads(Datas.objects.filter(key='last_month_sell').first().data) last_month_sell = json.loads(Datas.objects.filter(key='last_month_sell').first().data)
hour_sell = json.loads(Datas.objects.filter(key='hour_sell').first().data)
return render(request, 'myapp/result.html', {"from_type_info": from_type_info, return render(request, 'myapp/result.html', {"from_type_info": from_type_info,
"top10_sells": top10_sells, "last_month_sell": last_month_sell}) "top10_sells": top10_sells, "last_month_sell": last_month_sell, "hour_sell": hour_sell})