Hi Team,
I have written the below code where in when ever i select a particular drop down i want t graph to be displayed the dropdown is appering but the grap is not coming
Code:
import pandas as pd
import matplotlib.pyplot as plt
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px #(need to pip install plotly==4.4.1)
%matplotlib inline
df = pd.read_csv(r"C:\Users\Adnan\Desktop\MAR2020.csv")
app = dash.Dash(name)
#---------------------------------------------------------------
app.layout = html.Div([
html.Div([
html.Label([‘ANALYSIS MARCH’]),
dcc.Dropdown(
id=‘my_dropdown’,
options=[
{‘label’: ‘March2020’, ‘value’: ‘Count’},
],
value=‘March2020’,
multi=False,
clearable=False,
style={“width”: “50%”}
),
]),
html.Div([
dcc.Graph(id='the_graph')
]),
])
#---------------------------------------------------------------
@app.callback(
Output(component_id=‘the_graph’, component_property=‘figure’),
[Input(component_id=‘my_dropdown’, component_property=‘value’)]
)
def update_graph(my_dropdown):
dff = df
px.histogram(df, x="Trantype", y='Count')
return (histogram)
if name == ‘main’:
app.run_server()