Hi everyone!
I am trying to create a WebApp that would display some charts based on data downloaded from an Oracle DB.
I have a separate Python file where I connect to the server=>download the data into Pandas dataframe=>save the data as Parquet file. Then in a separate Python file where I am creating a Dash app. I import the Parquet file saved by the first file, connect some callbacks and display the line chart.
Data
- contains about 50k rows
- is monthly (Jan-Dec) product data for last 3 years of the business
- looks something like this
This code is the graph part of my WebApp
@app.callback(
Output('our_graph','figure'),
[Input('product','value'),
Input('type','value'),
Input('category','value')])
def build_graph(first, second, third):
dff=df[(df['product']==first)&(df['type']==second)&(df['category']==third)]
fig = px.line(dff, x="month", y="sum", color="year",height=600)
fig.update_layout(xaxis=dict(tickmode='linear'),yaxis={'title':'Amount'}, title
{'text':'Product Analysis','font':{'size':28},'x':0.5,'xanchor':'center'})
return fig
I am basically trying to filter data by a product/category/type and then see how they were doing over last 3 years. Each line on the chart should represent a year (2021, 2022, 2023).
What I am expecting to get is something like this (made in excel): https://i.stack.imgur.com/OpWxV.png
But what I am getting is this
I have been trying to figure out what the problem but can’t find any solution. Lines are overlapping and chart is useless.
I’d appreciate any recommendations and help. Thanks in advance.