grapher/student_graph.py
2025-01-05 01:01:39 +01:00

28 lines
837 B
Python

import imgui
import numpy as np
import random
from model import *
class StudentGraph:
def __init__(self):
super().__init__()
def __call__(self):
# Setup Data
submissions = Submission.select().where(Submission.student_id == 1)
data = np.array([submission.points/Lecture.get_by_id(submission.lecture_id).points*100 for submission in submissions], dtype=np.float32)
with imgui.begin("Student Graph", False, imgui.WINDOW_NO_MOVE | imgui.WINDOW_NO_RESIZE | imgui.WINDOW_NO_COLLAPSE):
w, h = imgui.get_content_region_available()
imgui.plot_histogram(
"##Data", data, overlay_text="Performance per Lecture (in %)",
scale_min=0.0, scale_max=100,
graph_size=(w, h*0.9)
)
imgui.button("Text")