✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

Cumulative Graph with two different date ranges


I am trying to plot a cumulative time series plot given a pandas df.

The df looks something like:

Sample Scanned Extraction
Sample1 2018-Apr-01 2018-Apr-01
Sample2 2018-Apr-13 2018-Apr-14
Sample3 2018-Apr-18 2018-Apr-17

code like this:
‘data’: [
x =db_samplesIn_month.groupby([‘Scanned’,‘Samle’]).Scanned.count().unstack().index.tolist(),
y = db_samplesIn_month.groupby([‘Scanned’]).Scanned.count().cumsum().values.tolist(),
line = {“color”: “rgb(53, 83, 255)”},
mode = “lines”,
name = “Scanned”
x =db_samplesIn_month.groupby([‘Extraction’,‘Sample’]).Extraction.count().cumsum().unstack().index.tolist(),
y =db_samplesIn_month.groupby([‘Extraction’]).Extraction.count().cumsum().values.tolist(),
line = {“color”: “rgb(255, 225, 53)”},
mode = “lines”,
name = “Extraction”

The problem arises as the ‘Scanned’ or first plot has a date range e.g. 1-apr , 2apr, 3-apr and plot two x-axis has something similar but slightly different e.g. 1-apr, 3-apr, 17-apr

How can I plot the cumulative counts for each column (Scanned, Extraction) using a single x-axis ?


probably best for #api:python


I actually just made a workaround to wrangle the data through python to get it to work. However, I was thinking I was missing a functionality of Dash that did it for me. Thanks :slight_smile: