Skip to content

Commit

Permalink
basic dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
greenmmq committed Jul 23, 2024
1 parent 6ba9272 commit 4621d7b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/data/db
/data/db.tar.zst
/data/db.tar.gz
__pycache__
24 changes: 24 additions & 0 deletions dashboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from dash import Dash, html, dcc, callback, Output, Input
import plotly.express as px
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')

app = Dash()

app.layout = [
html.H1(children='Population over Time by Country', style={'textAlign':'center'}),
dcc.Dropdown(df.country.unique(), 'United States', id='dropdown-selection'),
dcc.Graph(id='graph-content')
]

@callback(
Output('graph-content', 'figure'),
Input('dropdown-selection', 'value')
)
def update_graph(value):
dff = df[df.country==value]
return px.line(dff, x='year', y='pop')

if __name__ == '__main__':
app.run(debug=True)

0 comments on commit 4621d7b

Please sign in to comment.