Hi, I want to show HTML.P in Plotly Dash but when its not appearing any one can help me. Below is the code
from dash import Dash, dcc, html
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
html.H1('Dash Tabs component demo'),
dcc.Tabs(id="tabs-example-graph", value='tab-1-example-graph', children=[
dcc.Tab(label='Tab One', value='tab-1-example-graph'),
dcc.Tab(label='Tab Two', value='tab-2-example-graph'),
]),
html.Div(id='tabs-content-example-graph')
])
@app.callback(Output('tabs-content-example-graph', 'children'),
Input('tabs-example-graph', 'value'))
def render_content(tab):
if tab == 'tab-1-example-graph':
return html.Div([
html.H3('Tab content 1'),
dcc.Graph(
figure={
'data': [{
'x': [1, 2, 3],
'y': [3, 1, 2],
'type': 'bar'
}]
}
)
])
elif tab == 'tab-2-example-graph':
return html.Div([
html.H3('Tab content 2'),
html.P("hello world"),
dcc.Graph(
id='graph-2-tabs-dcc',
figure={
'data': [{
'x': [1, 2, 3],
'y': [5, 10, 6],
'type': 'bar'
}]
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)