Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
84a7ee99e2
|
@ -4,7 +4,10 @@
|
|||
<div class="flex-container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div id="chart1" style="width: 100%%;height:400px;margin:20px 10px;"></div>
|
||||
<div id="chart4" style="width: 100%%;height:400px;margin:20px 10px;"></div>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<div id="chart1" style="width: 100%%;height:400px;margin:10px;"></div>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<div id="chart2" style="width: 100%%;height:400px;margin:10px;"></div>
|
||||
|
@ -18,6 +21,42 @@
|
|||
{% block add_js %}
|
||||
<script src="{% static 'polls/js/echarts.min.js' %}"></script>
|
||||
<script type="text/javascript">
|
||||
var myChart4 = echarts.init(document.getElementById('chart4'));
|
||||
var option = {
|
||||
title: {
|
||||
text: '激活用户、未激活用户数量分布',
|
||||
left: 'center',
|
||||
subtext: '总数量'+{{user_total}},
|
||||
subtextStyle: {
|
||||
fontSize: 16,
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||
},
|
||||
legend: {
|
||||
top: '15%',
|
||||
data: ['激活', '未激活']
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '总量',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['50%', '60%'],
|
||||
data: {{chart4_data|safe}},
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]};
|
||||
myChart4.setOption(option);
|
||||
|
||||
var myChart = echarts.init(document.getElementById('chart1'));
|
||||
var option = {
|
||||
title: {
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
from django.shortcuts import render
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from dashboard.models import Douyin, NewMedia, Qita, Toutiao, Weibo, Weixin
|
||||
from dashboard.models import Douyin, NewMedia, Qita, Toutiao, Weibo, Weixin, Userprofile
|
||||
from django.db.models import Count, Sum
|
||||
|
||||
COMPARTMENTS = {
|
||||
|
@ -26,6 +26,15 @@ COMPARTMENTS = {
|
|||
|
||||
@csrf_exempt
|
||||
def monitor_statistics(request):
|
||||
|
||||
profile_status_0_count = Userprofile.objects.filter(status=0).count()
|
||||
profile_status_1_count = Userprofile.objects.filter(status=1).count()
|
||||
user_total = profile_status_0_count + profile_status_1_count
|
||||
chart4_data = []
|
||||
chart4_data.append({'name': '激活', 'value': profile_status_1_count})
|
||||
chart4_data.append({'name': '未激活', 'value': profile_status_0_count})
|
||||
|
||||
|
||||
wbc = Weibo.objects.exclude(status=0).count()
|
||||
wxc = Weixin.objects.exclude(status=0).count()
|
||||
ttc = Toutiao.objects.exclude(status=0).count()
|
||||
|
@ -117,7 +126,7 @@ def monitor_statistics(request):
|
|||
chart3_data.append({'name': '省直各部门', 'value': total1})
|
||||
chart3_data.append({'name': '市州政府及部门', 'value': total2})
|
||||
chart3_data.append({'name': '县区政府及部门、乡镇', 'value': total3})
|
||||
return render(request, 'polls/monitor_statistics.html', {'chart1_data': chart1_data, 'total': total, 'chart2_data': chart2_data, 'chart3_data': chart3_data})
|
||||
return render(request, 'polls/monitor_statistics.html', {'chart1_data': chart1_data, 'total': total, 'chart2_data': chart2_data, 'chart3_data': chart3_data, 'user_total': user_total, 'chart4_data': chart4_data})
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
|
|
Loading…
Reference in New Issue