Hi ,
I wanted to add another graph in the same page . Can you please help me out. I will paste my code here.
Thanks in advance.
app = dash.Dash(name, external_stylesheets=[dbc.themes.BOOTSTRAP])
styling the sidebar
SIDEBAR_STYLE = {
“position”: “fixed”,
“top”: 0,
“left”: 0,
“bottom”: 0,
“width”: “16rem”,
“padding”: “2rem 1rem”,
“background-color”: “#BBCBB7”,
}
padding for the page content
CONTENT_STYLE = {
“margin-left”: “18rem”,
“margin-right”: “2rem”,
“padding”: “2rem 1rem”,
}
sidebar = html.Div(
[
html.H4(“Dashboard”, className=“display-4”),
html.Hr(),
dbc.Nav(
[
dbc.NavLink("Home", href="/", active="exact"),
dbc.NavLink("India", href="/page-1", active="exact"),
dbc.NavLink("About", href="/page-2", active="exact"),
],
vertical=True,
pills=True,
),
],
style=SIDEBAR_STYLE,
)
content = html.Div(id=“page-content”, children=, style=CONTENT_STYLE)
app.layout = html.Div([
dcc.Location(id=“url”),
sidebar,
content
])
@app.callback(
Output(“page-content”, “children”),
[Input(“url”, “pathname”),
]
)
def render_page_content(pathname):
if pathname == “/”:
return [
html.H1(‘Covid 19 Dashboard’,
style={‘textAlign’: ‘center’}),
dcc.Graph(
figure=go.Figure(
data=[go.Pie(labels=[‘Active’, ‘Deaths’, ‘Recovered’, ],
values=[total_world_active, total_world_deaths, total_world_recovered, ])],
layout=go.Layout(font=dict(family=“Arial, Helvetica, sans-serif”, size=24, ),
title=‘Active vs Deaths vs Recovered’, title_x=0.5,
paper_bgcolor=‘rgb(248,249,252)’, plot_bgcolor=‘rgb(248,249,252)’)
)
)
]
if name == ‘main’:
app.run_server(debug=True, port=3000)