Plotly px plots x values in the wrong order on line graph

Hello,

i am having a bunch of sorted time values, which polty plots in the wrong order.
i am having the following setup:

    dfLineGraphOut = pd.DataFramerows = connectionLineGraphListOutSorted
    figOut = px.line(dfLineGraphOut, x="time", y="amount", color="list")
    graphJSONLineGraphOut = plotly.io.to_json(figOut, pretty=True)

And here is a sample of my set:
set=[ {
‘list’': ‘done’,
‘amount’: 500,
‘time’ : ‘15:20’,
}]

My set is sorted by time.

This is how my plot looks like:

If i try to plot less values, then it works

Thank you for your help in advance, since i couldn’t find anything regarding that topic.

Hi @ruh welcome to the forums.

This most likely is due to a wrong dtype in your dataframe. Make sure, you format the date or time column as datetime.

Thank you so much!
It works now!

For all those ppl, which r having the same problem: I’ve converted my time string via pandas:
Example:

  time_str = '13:55:26'
  df = pd.to_datetime(time_str)
1 Like