Here is my code:
both_df_sh <- dataset %>% SharedData$new(group = "boom")
selector <- filter_slider(id = "selector1", label = "Date Range", sharedData = both_df_sh, column = ~date)
v_p <- both_df_sh %>%
plot_ly(x = ~date) %>%
add_trace(y = ~variable1, type = 'scatter', mode = 'lines+markers', name = "Variable 1",
marker = list(color = ~color_v2), line = list(color = "black")) %>%
add_lines(y = ~variable2, name = "Variable 2", color = I("red")) %>%
add_lines(y = ~variable3, name = "Variable 3", color = I("red")) %>%
add_ribbons(x = ~date, ymax = ~Variable 3, ymin = ~Variable 2, color = I("red"),
alpha = .5, name = "Interval") %>%
layout(showlegend = FALSE,
xaxis = list(title = 'Date', tickmode = "linear", tickangle = 320,
type = 'date', tickformat = "%d %B"),
yaxis = list(title = 'Variable 1', tickformat = "000"),
autosize = F, margin = list(l = 0, r = 0, b = 0, t = 0, pad = 0))
bscols(selector, v_p, widths = 12)
And this is what I get:
My question is why the x-axis starts 3 days before (29 August) the first value (1 September), and ends 3 days after (26 October) the last value (23 October). How can I fix this to start and end the x-axis in the range chosen in the filter?