Commit 20542076 authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

added graph for scatter plot

parent 5690254b
......@@ -59,7 +59,7 @@
<br><br>
</form>
<a href='/instructor?quiz_id=0'>For analysis</a>
<br><h1></h1>
</body>
......
......@@ -12,6 +12,8 @@ from .models import quiz
from django.db.models import Max
from django.shortcuts import redirect
from .models import result as results
import numpy as np
from scipy.stats import norm
import csv
#for login
from django.contrib.auth.models import User
......@@ -147,7 +149,15 @@ def instructor(request):
students = results.objects.all().filter(quizId=q_id).values('studentId')
marks = results.objects.all().filter(quizId=q_id).values('marks')
fig, ax = plt.subplots()
ax.scatter([1, 10], [5, 9])
allMarks=list()
for mark in marks:
allMarks.append(mark['marks'])
allStudents=list()
for student in students:
allStudents.append(student['studentId'])
std=np.std(allMarks)
mean=np.mean(allMarks)
ax.scatter(allMarks,allStudents)
html_graph = mpld3.fig_to_html(fig)
return render(request, 'instructor.html',{"graph": html_graph, "graph1": html_graph, "graph2": html_graph,'quiz_id':q_id})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment