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

How to use rangeselector on xaxis for auto scaling xaxis and yaxis?

I would like to use the rangelector buttons on the xaxis autoscaling on the yaxis.
Currently I can only zoom in on the xaxis, as in the following gif:

The code is the same used in the example:

I modified the layout of the chart as follows:
‘layout’: {
‘xaxis’: {‘rangeslider’: {‘visible’: False},
‘rangeselector’: {‘visible’: True, ‘buttons’: [
{‘count’: 1, ‘label’: ‘1m’, ‘step’: ‘month’, ‘stepmode’: ‘backward’},
{‘count’: 6, ‘label’: ‘6m’, ‘step’: ‘month’, ‘stepmode’: ‘backward’},
{‘count’: 1, ‘label’: ‘YTD’, ‘step’: ‘year’, ‘stepmode’: ‘todate’},
{‘count’: 1, ‘label’: ‘1y’, ‘step’: ‘year’, ‘stepmode’: ‘backward’},
{‘count’: 5, ‘label’: ‘5y’, ‘step’: ‘year’, ‘stepmode’: ‘backward’},
{‘label’: ‘all’, ‘step’: ‘all’}
‘autorange’: True,
‘yaxis’: {‘title’: ‘yaxis title’, ‘autorange’: True},

  • Can someone help me? Thx