Plotly Dash Line Graph Using Dates and price doesn't work

Hi,

I am trying to do a nice line graph of how the price in certain areas changes, but when I use px.line graph with x-axis set to date and y-axis set to price, it does this:

I am using simple command

fig = px.line(df, x=option_x, y=option_y, color=graph_color)

where df is a dataframe with stored data and under option_x and y are names of columns used in dataframe.

Does anyone have any solution?

Hi @Deesak

Here are a couple things to check:

  • Dates are in the correct order in the dataframe.
  • Dates are either Datetime objects or strings formatted as 2021-08-04

If you that doesn’t fix it, then supplying a small amount of sample data could help.