I’m trying to get the y-axis to scale when I click a range selector button. It’s an issue because if I look at one month’s worth of data it looks flat unless I manually change the y-axis. Here’s a repeatable example of what I’m trying to fix:
x <- data.frame(Date = seq(Sys.Date()-365, Sys.Date(), by = 1), Value = 366:1) p <- plot_ly(x = x$Date, y = x$Value, type = 'scatter', mode = 'lines') %>% layout( xaxis = list(title = "", type = 'date', rangeselector = list( buttons = list( list(count = 30, label = "30 days", step = "day", stepmode = "backward") , list(step = "all", label = 'All') ) )) )
When you click the “30 days” button it changes the range of the x-axis, but not the y-axis leaving the graph really flat.
Is there any way to automatically reset the y-axis when a range selector button is clicked?
Thanks in advance!