diff --git a/src/pv_routes.py b/src/pv_routes.py index 862aa6a..8237d79 100644 --- a/src/pv_routes.py +++ b/src/pv_routes.py @@ -19,7 +19,7 @@ def pvstats(): dbh = psycopg.connect() engine = sqlalchemy.create_engine("postgresql+psycopg://", creator=lambda: dbh) - df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM pv_energy_by_month", con=engine) + df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM pv_energy_by_month ORDER BY year, month", con=engine) fig_1 = px.bar(df, x='month', y='value', color='year', barmode='group') fig_1.update_layout( title=f"Jahreswerte Exportierte Energie PV-Anlage", @@ -35,7 +35,7 @@ def pvstats(): ) graph_html_1 = fig_1.to_html(full_html=False, default_height='30%') - df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM car_energy_by_month", con=engine) + df = pd.read_sql("SELECT month, cast(year AS varchar), current_energy AS value FROM car_energy_by_month ORDER BY year, month", con=engine) fig_2 = px.bar(df, x='month', y='value', color='year', barmode='group') fig_2.update_layout( title=f"Jahreswerte Verbrauch Elektroauto",