# check out Dash docs - https://dash.plotly.com/
# Plotly graphs - https://plotly.com/python/
from dash import Dash, Input, Output, callback, dcc, html
import dash_ag_grid as dag
import plotly.express as px
import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/plotly/tutorial-code/refs/heads/main/Datasets/laq-merged-30.csv")
fig = px.histogram(df, x="SiteType", y="NO2", histfunc='avg')
fig.layout.update(margin=dict(l=20, r=20, t=30, b=30))
grid = dag.AgGrid(
rowData=df.to_dict("records"),
columnDefs=[{"field": i, 'filter': True, 'sortable': True} for i in df.columns],
dashGridOptions={"pagination": True},
)
app = Dash(__name__)
app.layout = html.Div(
children=[
dcc.Graph(figure=fig),
grid
]
)
# if __name__ == "__main__":
# app.run(debug=True)