Black Lives Matter. Please consider donating to Black Girls Code today.

Rangeselector not choosing xaxis range correctly

I am using rangeselector in my app here:

When the app first loads with the default ‘All’ range, the xaxis range is correct - see first image. However if I choose any other range, say 1y, the the xaxis range finishes well past the end of the data - see image 2 - how can I fix this so that the 1y tab’s xaxis range is the 1 year PRIOR to date that the data ends? Thanks!

Hey @maxwell8888

try setting xaxis = dict(range=['2004-04-01','2018-04-03'])

Thanks @bcd I managed to get it working by not using step = all. For some reason once I clicked on the all tab it messes up the ranges. I managed to make a work around using the below. It’s a bit hacky though - I had to play around with it to get the range to match what the new ‘All’ tab was doing.

xaxis=dict(
range=[‘2003-12-01’,‘2018-04-20’],
rangeselector=dict(
buttons=list([
dict(count=1,
label=‘1y’,
step=‘year’,
stepmode=‘backward’),
dict(count=3,
label=‘3y’,
step=‘year’,
stepmode=‘backward’),
dict(count=14*12+4,
label=‘All’,
step=‘month’,
stepmode=‘backward’),
#dict(step=‘all’),
])
),
type=‘date’,
)
)