From 1c9972c38957214b2ae0d667b1eb06f331b5bcf4 Mon Sep 17 00:00:00 2001 From: xiaoan <419177984@qq.com> Date: Thu, 30 May 2024 20:08:14 +0800 Subject: [PATCH] updata code --- server/views/jump.py | 7 +- static/html/echats.html | 298 +++++++++------------------------------- 2 files changed, 72 insertions(+), 233 deletions(-) diff --git a/server/views/jump.py b/server/views/jump.py index 48836a2..c813ec9 100644 --- a/server/views/jump.py +++ b/server/views/jump.py @@ -152,6 +152,7 @@ def to_qunti(request): # 获取Student的所有记录 student = [] data = [] + data_time = [] xyz = [] xyz2 = [] all_student = MindUser.objects.all() @@ -173,7 +174,8 @@ def to_qunti(request): it3.append(str(it1) + "第" + str(it2) + "小组") if name in it3: 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)) xyz2.append(random.uniform(200,600)) sui1 = [] @@ -201,6 +203,7 @@ def to_qunti(request): datas = zip(student,data) datas2 = zip(student,data) datas3 = zip(student,xyz,xyz2) + datas4 = zip(student,data_time) student2 = student[:] student3 = student[:] random.shuffle(student2) @@ -209,7 +212,7 @@ def to_qunti(request): student4 = zip(student,student3) 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): diff --git a/static/html/echats.html b/static/html/echats.html index 5d2ff7b..c265470 100644 --- a/static/html/echats.html +++ b/static/html/echats.html @@ -621,6 +621,7 @@
+
@@ -635,96 +636,33 @@ // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main')); - option = { - color: ['#67F9D8', '#FFE434', '#56A3F1', '#FF917C'], +option = { title: { - text: '{{ name }}雷达贡献图' + text: '{{ name }}社会情感投入雷达图' + }, + legend: { + data: [ {% for stu in student %} + "{{ stu }}", + {% endfor %}] + }, + radar: { + // shape: 'circle', + indicator: [ + { name: '积极', max: 200 }, + { name: '消极', max: 200 }, + { name: '中立', max: 200 }, + ] }, - legend: {}, - radar: [ - { - indicator: [ - {text: '协作参与度'}, - {text: '问答活跃度'}, - {text: '内容贡献度'}, - {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: [ { + name: 'Budget vs spending', type: 'radar', - emphasis: { - lineStyle: { - width: 4 - } - }, - data: [ - {% for stu,data in datas %} - {% if forloop.counter|divisibleby:2 %} - { - value: {{ data }}, - name: '{{ stu }}', - }, - {% endif %} - {% endfor %} - ] - }, - { - type: 'radar', - radarIndex: 1, data: [ {% for stu,data in datas2 %} - {% if forloop.counter|divisibleby:2 == 0 %} - { - value: {{ data }}, - name: '{{ stu }}', - }, - {% endif %} + { + value:{{ data }}, + name:'{{ stu }}' + }, {% endfor %} ] } @@ -804,13 +742,14 @@ // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); +