diff --git a/app.py b/app.py index 14199db..a38cf42 100644 --- a/app.py +++ b/app.py @@ -10,6 +10,8 @@ import minify_html from urllib.parse import urlparse from flask_socketio import SocketIO import pygal +from pygal.style import Style + from db import DataBase @@ -55,12 +57,24 @@ def overview(): cadences = db.get_all_cadences() last_cadence = cadences[-1]['rpm'] - graph = pygal.Line(show_y_guides=False, show_legend=False) + custom_style = Style( + background='transparent', + plot_background='transparent', + foreground='#53E89B', + foreground_strong='#53A0E8', + foreground_subtle='#630C0D', + opacity='.6', + opacity_hover='.9', + transition='400ms ease-in', + colors=('#E853A0', '#E8537A', '#E95355', '#E87653', '#E89B53')) + + graph = pygal.Line(show_y_guides=False, + show_legend=False, style=custom_style) graph.x_labels = [c['logged_at'] for c in cadences] graph.add('RPM', [c['rpm'] for c in cadences]) graph_data = graph.render_data_uri() - return render_template('overview.html', last_cadence=last_cadence, cadences=cadences, graph_data=graph_data) + return render_template('overview.html', last_cadence=last_cadence, cadences=cadences[-15:], graph_data=graph_data) if __name__ == '__main__':