import dash
from dash import dcc, html, Input, Output
import plotly.express as px
import pandas as pd
app = dash.Dash(__name__)
df = pd.read_excel(r'C:\Users\pas1c\Documents\Reestr_RD_11_08_2022.xlsx',
skiprows=8, usecols='D, E, G, O')
app.layout = html.Div([
html.H1("Реестр РД", style={"textAlign": "center"}),
html.Hr(),
html.P("Выберите объект и здание"),
html.Div(html.Div([
dcc.Dropdown(id='dropdown-1', clearable=False,
value='Вахтовый поселок',
options=[{'label': x, 'value': x} for x in
df["Промышленная площадка"].unique()]),
], className="two columns"), className="row"),
dcc.Graph(id="graph")
])
@app.callback(
Output("graph", "figure"),
Input(component_id="dropdown-1", component_property="value"))
def make_graphs(project_chosen):
df_graph = df[df["Промышленная площадка"] == project_chosen]
df_graph = df[df["Стадия готовности"].isin(["Выполнено", "В работе", "На проверке/замечания"])]
fig_graph = px.pie(df_graph, values="Промышленная площадка", names="Стадия готовности")
fig_graph.show()
return fig_graph
if __name__ == '__main__':
app.run_server(debug=True)
Nothing shows up
Values in graph = a project
Names in graph is their stage (ready, work in progress, on inspection)
I’m discovering python for a week so please be patient to my stupidity