Hi Team,@charming data
I want to add multiple bar graphs for each and every drop down that is selected let me know what exactly needs to be added i have added another dropdown lable and a bar graph but it not getting displayed
Bar charts are useful for displaying data that is classified into nominal or ordinal categories.
A bar chart uses bars to show comparisons between categories of data. A bar chart will always have two axis.
One axis will generally have numerical values, and the other will describe the types of categories being compared.
import pandas as pd #(version 0.24.2)
import datetime as dt
import dash #(version 1.0.0)
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly #(version 4.4.1)
import plotly.express as px
df = pd.read_csv(r"C:\Users\Adnan\Desktop\Mar2020.csv")
app = dash.Dash(name)
#-------------------------------------------------------------------------------------
app.layout = html.Div([
html.Div([
html.Pre(children= "March Analysis",
style={"text-align": "center", "font-size":"100%", "color":"black"})
]),
html.Div([
html.Label(['March2020'],style={'font-weight': 'bold'}),
dcc.Dropdown(
id='xaxis_raditem',
options=[
{'label': 'March2020', 'value': 'Mar'},
{'label': 'Apr2020', 'value': 'Apr'},
],
value='Mar',
style={"width": "50%"}
),
]),
html.Div([
dcc.Graph(id='the_graph')
]),
])
#-------------------------------------------------------------------------------------
@app.callback(
Output(component_id=‘the_graph’, component_property=‘figure’),
[Input(component_id=‘xaxis_raditem’, component_property=‘value’)]
)
def update_graph(x_axis):
dff = df,df1
# print(dff[[x_axis,y_axis]][:1])
barchart=px.bar(
data_frame=dff,
x=df['TranType'],
y=df['Count'],
title='Output'
# facet_col='Borough',
# color='Borough',
# barmode='group',
)
barchart=px.bar(
data_frame=dff,
x=df['TranApril'],
y=df['Count1'],
title='Output'
# facet_col='Borough',
# color='Borough',
# barmode='group',
)
barchart.update_layout(xaxis={'categoryorder':'total ascending'}
)
return (barchart)
if name == ‘main’:
app.run_server()