Only fetch last 100 cadence readings and display as sparklines graph

This commit is contained in:
Peter Stockings
2023-01-30 22:12:10 +11:00
parent cf2dc204e7
commit fa3a8990cf
4 changed files with 16 additions and 6 deletions

View File

@@ -26,3 +26,11 @@ def generate_graph(x_labels, data, style=custom_style):
graph.add(title, values)
graph_data = graph.render_data_uri()
return graph_data
def generate_sparkline_graph(data, style=custom_style):
chart = pygal.Line(show_y_guides=False,
show_legend=False, style=style)
chart.add('', data)
return chart.render_sparkline(disable_xml_declaration=True)