1
0

higher graph

This commit is contained in:
2023-10-18 01:31:54 +03:00
parent 13b83e4efd
commit dfc26cedaa

View File

@@ -17,9 +17,14 @@ columns_to_summarize = ["ancient", "old", "middle", "new", "late"]
# Create the figure for the initial graph (placeholder data)
initial_data = df.groupby("place")[columns_to_summarize].sum().reset_index()
initial_fig = go.Figure()
initial_fig.layout.height = 700 # You can set the desired height here
for col in columns_to_summarize:
initial_fig.add_trace(go.Bar(name=col, x=initial_data["place"], y=initial_data[col], text=initial_data[col], textposition="auto"))
initial_fig.add_trace(
go.Bar(
name=col, x=initial_data["place"],
y=initial_data[col],
text=initial_data[col],
textposition="auto"))
# Define the app layout
app.layout = html.Div([
@@ -34,6 +39,8 @@ app.layout = html.Div([
])
# Define a callback to update the graph based on selected places
@app.callback(
Output("bar-graph", "figure"),
[Input("place-selector", "value")]
@@ -53,7 +60,11 @@ def update_graph(selected_places):
total = grouped[columns_to_summarize].iloc[index].sum()
fig.add_annotation(text=f"Total: {total}", x=place, y=total + 5)
# Adjust the height of the plot area
fig.update_layout(height=700) # You can set the desired height here
return fig
if __name__ == "__main__":
app.run_server(debug=True)