Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Access the recorded webinar.

Time Series Help

Hi everyone, I have a problem with plotly. I am visualizing a time series and previously I generated a graph of this style but when I rerun my streamlit application my graph changed completely. I reconfigured my programming environment but nothing seems to work. This is the previous graph (the graph I want):

Sorry but it was the only shot I took, in the bars when you hovered the mouse you could see the detail per day.

Current graph:

Code used:

def chart_time_series(df, n_column):
    fig = go.Figure()
    fig.add_trace(go.Bar(
        name="spend",
        x=df["date_start"], y=df[n_column],
        xperiod="M1",
        xperiodalignment="middle"))
    fig.update_layout(title_text = 'Time Series - ' + n_column)
    fig.update_traces(marker_color='rgb(255,0,0)')
    fig.update_xaxes(showgrid=True, ticklabelmode="period")
    fig.update_xaxes(rangeslider_visible=True)
    return fig

If someone can help me I will be very grateful.

looks like the problem is with your data, maybe wrong df or the n_column provided to function i was betting n_column like date vs months but is see its the same in both via the title so i guess its your data. looking at your date axis its day on the bottom and month on top i.e bottom is plotting per day and top is per day per month, maybe you have forgot to set datetime or somewhere in you app you are changing df. Whatever the issue is if you havnet changed to code then the problem is most likely elsewhere