Removed rapport and period mean from plot data

This commit is contained in:
Eljakim Herrewijnen 2021-09-20 22:39:36 +02:00
parent 95856aee0b
commit f55f925bdf
6 changed files with 50 additions and 14 deletions

View File

@ -1,9 +1,19 @@
from flask import Flask, render_template from flask import Flask, render_template
app = Flask("Project Numeri") app = Flask("Project Numeri")
from plots import Cijferlijst
import base64
cf = Cijferlijst()
import matplotlib.pyplot as plt
@app.route('/') @app.route('/')
def index(): def index():
return render_template('index.html')
data = cf.GetSubjectByYear("godsdienst", "2010/2011")
x = data['Datum invoer(Voortgangsdossier)']
y = data['Cijfer(Voortgangsdossier)']
plt.plot(x,y)
return render_template('index.html', title="joe", imgdata=None)
def RunWeb(): def RunWeb():
app.run(debug=True) app.run(debug=True)

23
main.py
View File

@ -1,9 +1,30 @@
from flaskapp import * from flaskapp import *
from plots import Cijferlijst from plots import Cijferlijst
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from datetime import datetime
import matplotlib.dates as mdates
if __name__ == "__main__": if __name__ == "__main__":
cf = Cijferlijst() cf = Cijferlijst()
data = cf.GetSubjectByYear("godsdienst", "2010/2011") data = cf.GetSubjectByYear("godsdienst", "2010/2011")
cf.CalculateMedian()
#Get dates and convert them to actual dates
x = data['Datum invoer(Voortgangsdossier)']
x = [datetime.strptime(date, "%d-%m-%Y") for date in x]
y = data['Cijfer(Voortgangsdossier)']
y = [float(line.replace(",", ".")) for line in y]
# p = plt.scatter(x,y)
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%m/%d/%Y'))
# plt.gca().xaxis.set_major_locator(mdates.DayLocator())
plt.scatter(x,y)
plt.gcf().autofmt_xdate()
# plt.show()
# plt.plot(range(5))
# plt.xlim(0, 10)
# plt.ylim(0, 10)
# cf.CalculateMedian()
RunWeb() RunWeb()

View File

@ -15,10 +15,17 @@ class Cijferlijst:
def GetSubjectByYear(self, subject, year): def GetSubjectByYear(self, subject, year):
if(type(subject) == str and type(year) == str): if(type(subject) == str and type(year) == str):
select_year = self.ps[self.ps['Schooljaar(Voortgangsdossier)'] == year] select_year = self.ps[self.ps['Schooljaar(Voortgangsdossier)'] == year]
return select_year[select_year["Vak(Voortgangsdossier)"] == subject] select_subject = select_year[select_year["Vak(Voortgangsdossier)"] == subject]
#filter period and rapport
rapports = select_subject[select_subject['Cijfertype(Voortgangsdossier)'] != "Periodegemiddelde"]
return rapports[rapports ['Cijfertype(Voortgangsdossier)'] != "Rapportcijfer"]
else: else:
return False return False
def iets(self): def iets(self):
print(self.grade_list) print(self.grade_list)

2
static/jquery-3.6.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

0
static/style.css Normal file
View File

View File

@ -2,16 +2,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <link rel="stylesheet" href="style.css">
<meta name="Anthony Federico" content="Flaskex"> <script>"jquery-3.6.0.min.js"</script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.2/css/bulma.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="../static/style.css">
</head> </head>
<body> <body>
{% block body %}{% endblock %} <h1>{{title}}</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> <img src="data:image/png;base64,{house.image}" alt="img_data" id="imgslot"/>
{% block scripts %}{% endblock %} </body>
</body>
</html> </html>