import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from dash.dependencies import Input, Output
df = pd.read_excel(r"C:\Users\Soniak1\Desktop\glint_report_Comments_2019Dec08_polarity.xlsx")
items = [
dbc.DropdownMenuItem("Box Plot"),
dbc.DropdownMenuItem("VP", "Violin Plot"),
#dbc.DropdownMenuItem("Item 3"),
]
navbar = dbc.NavbarSimple(
children=[
dbc.NavItem(dbc.NavLink("Go to Google", href="https://www.google.com")),
dbc.DropdownMenu(
nav=True,
in_navbar=True,
label="Learn More",
children=[
dbc.DropdownMenuItem("Violin Plot"),
dbc.DropdownMenuItem("Box Plot"),
dbc.DropdownMenuItem(divider=True),
dbc.DropdownMenuItem("Topic Modelling"),
],
),
],
brand="Sentiment Analysis",
brand_href="#",
sticky="top",
)
body = dbc.Container(
[
dbc.Row(
[
dbc.Col(
[
html.H2("Analysis"),
html.P(
"""\
We use Cutting edge technology and Machine learning Model for Sentiment Analysis."""
),
dbc.Row(
[
dbc.Button("View details", color="Secondary"),
dbc.DropdownMenu([dbc.DropdownMenuItem(children= "Box Plot", id ="dropdown-button1"),
dbc.DropdownMenuItem(children="Violin Plot", id = "dropdown-button2")],
label = "Plots", color="info", className="m-1")
]
)
],
md=4
),
dbc.Col(
[
html.H2(id="htmltitle"),
dcc.Graph(
figure={"data": [{"x": [1, 2, 3], "y": [1, 4, 9]}]},
),
],
),
]
)
],
className="mt-4",
)
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.DARKLY])
app.layout = html.Div([navbar, body])
# @app.callback(Output("htmltitle", "children"),
# [Input("dropdown-button1", "children")])
@app.callback(
Output('htmltitle', 'children'),
[Input('dropdown-button1', 'children'),
Input('dropdown-button2', 'children')])
def change_header(select_name):
return select_name
if __name__ == "__main__":
app.run_server()
I want to change my header figure in htmltitle id by selecting dropdown button but i am getting error
please let me know thanks!!