updata code

This commit is contained in:
2024-05-30 20:08:14 +08:00
parent 9c62923cb3
commit 1c9972c389
2 changed files with 72 additions and 233 deletions
+5 -2
View File
@@ -152,6 +152,7 @@ def to_qunti(request):
# 获取Student的所有记录 # 获取Student的所有记录
student = [] student = []
data = [] data = []
data_time = []
xyz = [] xyz = []
xyz2 = [] xyz2 = []
all_student = MindUser.objects.all() all_student = MindUser.objects.all()
@@ -173,7 +174,8 @@ def to_qunti(request):
it3.append(str(it1) + "第" + str(it2) + "小组") it3.append(str(it1) + "第" + str(it2) + "小组")
if name in it3: if name in it3:
student.append(stu.username) student.append(stu.username)
data.append([random.uniform(110,150),random.uniform(100,150),random.uniform(100,150),random.uniform(90,150),random.uniform(90,150)]) data.append([random.uniform(110,150),random.uniform(100,150),random.uniform(100,150)])
data_time.append([random.uniform(10,20),random.uniform(20,40),random.uniform(40,60),random.uniform(60,80),random.uniform(80,100)])
xyz.append(random.uniform(300,800)) xyz.append(random.uniform(300,800))
xyz2.append(random.uniform(200,600)) xyz2.append(random.uniform(200,600))
sui1 = [] sui1 = []
@@ -201,6 +203,7 @@ def to_qunti(request):
datas = zip(student,data) datas = zip(student,data)
datas2 = zip(student,data) datas2 = zip(student,data)
datas3 = zip(student,xyz,xyz2) datas3 = zip(student,xyz,xyz2)
datas4 = zip(student,data_time)
student2 = student[:] student2 = student[:]
student3 = student[:] student3 = student[:]
random.shuffle(student2) random.shuffle(student2)
@@ -209,7 +212,7 @@ def to_qunti(request):
student4 = zip(student,student3) student4 = zip(student,student3)
return render(request, "html/echats.html", {"param":param,"name":name,"student":student,"datas":datas,"datas2":datas2,"datas3":datas3,"student4" return render(request, "html/echats.html", {"param":param,"name":name,"student":student,"datas":datas,"datas2":datas2,"datas3":datas3,"student4"
:student4,"sui1":sui1,"sui2":sui2,"sui3":sui3,"sui4":sui4,"sui5":sui5,"sui6":sui6,"sui7":sui7,"sui8":sui8,"sui9":sui9}) :student4,"sui1":sui1,"sui2":sui2,"sui3":sui3,"sui4":sui4,"sui5":sui5,"sui6":sui6,"sui7":sui7,"sui8":sui8,"sui9":sui9,"datas4":datas4})
def share_to_detail(request): def share_to_detail(request):
+28 -192
View File
@@ -621,6 +621,7 @@
<div id="main" style="width: 1000px;height:500px;"></div> <div id="main" style="width: 1000px;height:500px;"></div>
<div id="app2" style="width: 1000px;height:500px;"></div> <div id="app2" style="width: 1000px;height:500px;"></div>
<div id="app3" style="width: 1300px;height:500px;"></div> <div id="app3" style="width: 1300px;height:500px;"></div>
<div id="app4" style="width: 1300px;height:500px;"></div>
</main> </main>
<!-- 右侧内容 start--> <!-- 右侧内容 start-->
@@ -636,95 +637,32 @@
var myChart = echarts.init(document.getElementById('main')); var myChart = echarts.init(document.getElementById('main'));
option = { option = {
color: ['#67F9D8', '#FFE434', '#56A3F1', '#FF917C'],
title: { title: {
text: '{{ name }}雷达贡献图' text: '{{ name }}社会情感投入雷达图'
}, },
legend: {}, legend: {
radar: [ data: [ {% for stu in student %}
{ "{{ stu }}",
{% endfor %}]
},
radar: {
// shape: 'circle',
indicator: [ indicator: [
{text: '协作参与度'}, { name: '积极', max: 200 },
{text: '问答活跃度'}, { name: '消极', max: 200 },
{text: '内容贡献度'}, { name: '中立', max: 200 },
{text: '小组配合度'},
{text: '机器人使用'}
],
center: ['25%', '50%'],
radius: 120,
startAngle: 90,
splitNumber: 4,
shape: 'circle',
axisName: {
formatter: '【{value}】',
color: '#428BD4'
},
splitArea: {
areaStyle: {
color: ['#77EADF', '#26C3BE', '#64AFE9', '#428BD4'],
shadowColor: 'rgba(0, 0, 0, 0.2)',
shadowBlur: 10
}
},
axisLine: {
lineStyle: {
color: 'rgba(211, 253, 250, 0.8)'
}
},
splitLine: {
lineStyle: {
color: 'rgba(211, 253, 250, 0.8)'
}
}
},
{
indicator: [
{text: '协作参与度', max:200},
{text: '问答活跃度', max:200},
{text: '内容贡献度', max:200},
{text: '小组配合度', max:200},
{text: '机器人使用', max:200}
],
center: ['75%', '50%'],
radius: 120,
axisName: {
color: '#fff',
backgroundColor: '#666',
borderRadius: 3,
padding: [3, 5]
}
}
],
series: [
{
type: 'radar',
emphasis: {
lineStyle: {
width: 4
}
},
data: [
{% for stu,data in datas %}
{% if forloop.counter|divisibleby:2 %}
{
value: {{ data }},
name: '{{ stu }}',
},
{% endif %}
{% endfor %}
] ]
}, },
series: [
{ {
name: 'Budget vs spending',
type: 'radar', type: 'radar',
radarIndex: 1,
data: [ data: [
{% for stu,data in datas2 %} {% for stu,data in datas2 %}
{% if forloop.counter|divisibleby:2 == 0 %}
{ {
value:{{ data }}, value:{{ data }},
name: '{{ stu }}', name:'{{ stu }}'
}, },
{% endif %}
{% endfor %} {% endfor %}
] ]
} }
@@ -804,13 +742,14 @@
// 使用刚指定的配置项和数据显示图表。 // 使用刚指定的配置项和数据显示图表。
myChart.setOption(option); myChart.setOption(option);
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
// 基于准备好的dom,初始化echarts实例 // 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('app3')); var myChart = echarts.init(document.getElementById('app3'));
option = { option = {
title: { title: {
text: '{{ name }}贡献活跃度' text: '{{ name }}行为投入参与度'
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@@ -841,7 +780,7 @@
], ],
series: [ series: [
{ {
name: '发言热度', name: '写作字数',
type: 'bar', type: 'bar',
emphasis: { emphasis: {
focus: 'series' focus: 'series'
@@ -851,7 +790,7 @@
{% endfor %}] {% endfor %}]
}, },
{ {
name: '活跃热度', name: '发言条数',
type: 'bar', type: 'bar',
stack: 'Ad', stack: 'Ad',
emphasis: { emphasis: {
@@ -860,89 +799,6 @@
data: [{% for stu in sui2 %} data: [{% for stu in sui2 %}
'{{ stu }}', '{{ stu }}',
{% endfor %}] {% endfor %}]
},
{
name: '贡献热度',
type: 'bar',
stack: 'Ad',
emphasis: {
focus: 'series'
},
data: [{% for stu in sui3 %}
'{{ stu }}',
{% endfor %}]
},
{
name: '评价热度',
type: 'bar',
stack: 'Ad',
emphasis: {
focus: 'series'
},
data: [{% for stu in sui4 %}
'{{ stu }}',
{% endfor %}]
},
{
name: '交流热度',
type: 'bar',
data: [{% for stu in sui5 %}
'{{ stu }}',
{% endfor %}],
emphasis: {
focus: 'series'
},
markLine: {
lineStyle: {
type: 'dashed'
},
data: [[{ type: 'min' }, { type: 'max' }]]
}
},
{
name: '讨论热度',
type: 'bar',
barWidth: 5,
stack: 'Search Engine',
emphasis: {
focus: 'series'
},
data: [{% for stu in sui6 %}
'{{ stu }}',
{% endfor %}]
},
{
name: '情感热度',
type: 'bar',
stack: 'Search Engine',
emphasis: {
focus: 'series'
},
data: [{% for stu in sui7 %}
'{{ stu }}',
{% endfor %}]
},
{
name: '交互热度',
type: 'bar',
stack: 'Search Engine',
emphasis: {
focus: 'series'
},
data: [{% for stu in sui8 %}
'{{ stu }}',
{% endfor %}]
},
{
name: '其他',
type: 'bar',
stack: 'Search Engine',
emphasis: {
focus: 'series'
},
data: [{% for stu in sui9 %}
'{{ stu }}',
{% endfor %}]
} }
] ]
}; };
@@ -956,13 +812,15 @@
var myChart = echarts.init(document.getElementById('app4')); var myChart = echarts.init(document.getElementById('app4'));
option = { option = {
title: { title: {
text: 'Stacked Line' text: '{{name}}行为投入专注度'
}, },
tooltip: { tooltip: {
trigger: 'axis' trigger: 'axis'
}, },
legend: { legend: {
data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine'] data: [{% for stu in student %}
"{{ stu }}",
{% endfor %}]
}, },
grid: { grid: {
left: '3%', left: '3%',
@@ -978,42 +836,20 @@ option = {
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: ['2024-05/26', '2024-05/27', '2024-05/28', '2024-05/29', '2024-05/30']
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
series: [ series: [
{% for stu,data in datas4 %}
{ {
name: 'Email', name: '{{ stu }}',
type: 'line', type: 'line',
stack: 'Total', stack: 'Total',
data: [120, 132, 101, 134, 90, 230, 210] data: {{ data }},
}, },
{ {% endfor %}
name: 'Union Ads',
type: 'line',
stack: 'Total',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: 'Video Ads',
type: 'line',
stack: 'Total',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: 'Direct',
type: 'line',
stack: 'Total',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: 'Search Engine',
type: 'line',
stack: 'Total',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
] ]
}; };