I don’t know how to hide a chart. Really, I need to change, for example, two charts for another one as you can see in the figures attached.
I’d like to change from this layout
to this one
using the PUSH ME button, for example.
My example code is this one… without a valid Callback
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
external_stylesheets=[dbc.themes.BOOTSTRAP]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(className="container",children=[
html.Div(id='main-div',className='row',children=[
]),
html.Div(className='col-12',children=[
dcc.Graph(
id='example-graph3',
figure={
'data': [
{'x': [1, 2, 3], 'y': [11, 22,44], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 25, 12], 'type': 'bar', 'name': 'NYC'},
],
'layout': {
'title': 'GRAPH3'
}
}
)
]),
html.Div(className="row",children=[
dbc.Button("Push me", id="mybutton")
]),])
@app.callback(Output('main-div','className'),
[Input('mybutton','n_clicks')]
)
def mycallback(n_clicks):
if n_clicks is None:
raise PreventUpdate
return "row"
if __name__ == '__main__':
app.run_server(debug=False)
Thank you in advance for your help