Commit b620dbf8 authored by Kristian Tan's avatar Kristian Tan

Display bars in correct order

parent dc82ed84
...@@ -86,7 +86,7 @@ def generate_graph_data(): ...@@ -86,7 +86,7 @@ def generate_graph_data():
# Create data for chart # Create data for chart
count = 0 count = 0
records = DailyUsage.query.order_by(asc(DailyUsage.date)).all() records = DailyUsage.query.order_by(desc(DailyUsage.date)).all()
for record in records: for record in records:
labels.append(date(record.date.year, record.date.month, record.date.day)) labels.append(date(record.date.year, record.date.month, record.date.day))
values.append(record.kwhUsed) values.append(record.kwhUsed)
...@@ -95,7 +95,7 @@ def generate_graph_data(): ...@@ -95,7 +95,7 @@ def generate_graph_data():
count += 1 count += 1
if count >= 5: if count >= 5:
break break
return labels, values, max return labels.reverse(), values.reverse(), max
db.create_all() db.create_all()
......
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