File size: 943 Bytes
7688c47
84504c5
d0a269c
e92aba2
d0a269c
5ec5b1a
904867f
8b3c6e0
7f80541
 
 
 
 
 
 
 
8b3c6e0
 
7f80541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8b3c6e0
d0a269c
c931497
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from dash import Dash, html, dcc, callback, Output, Input
import plotly.express as px
from app import app
import pandas as pd

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

# def serve_content():
    # """
    # :return: html div component
    # """
    # return html.Div([
    #     dcc.Location(id='url', refresh=False),
    #     html.Div(id='page-content')
    # ])


# app.layout = serve_content()

app.layout = html.Div([
    html.H1(children='Title of Dash App', style={'textAlign':'center'}),
    dcc.Dropdown(df.country.unique(), 'Canada', 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_server(debug=True)