0

I have created a Shiny App with a range slider that dynamically adjusts the limits of the x axis. I have done this creating a slider called my_slider in sliderInput() in the ui, and then writing the command scale_x_date(limits = c(input$my_slider[1], input$my_slider[2])) in the GGPlot in the server.

I was wondering if the same thing can be done using Crosstalk's filter_slider(), instead of via Shiny. I have only managed to get Crosstalk's slider to hide/show the data in the plot based on the filter selected without changing the x axis limits.

cholo.trem
  • 314
  • 2
  • 9
  • Please find an example on how to use `filter_slider` on their [landing page](https://rstudio.github.io/crosstalk/) – ismirsehregal Feb 17 '21 at 13:27
  • I am familiar with this link, I applied `filter_slider` to the plot shown in the question before finding out how to do it via Shiny (https://rpubs.com/LucasT/715872). The link doesn't show an example where `filter_slider` is used to adjust plot axes, does this mean there is no way to adjust plot axes via `filter_slider`? – cholo.trem Feb 17 '21 at 13:39
  • I guess filter_slider will always filter the SharedData object. However, if you calculate the axes ranges based on the SharedData it might be possible. It's difficult to help without an example. – ismirsehregal Feb 17 '21 at 13:45
  • Fair, I will see if this can be done. Sorry for not providing a full reprod. example, I felt it would be a bit confusing because the code is so long. Thanks for the advice! – cholo.trem Feb 17 '21 at 14:58
  • For future readers: [Here](https://stackoverflow.com/questions/70943105/how-to-dynamically-change-plotly-axis-based-on-crosstalk-conditions/70953812#70953812) you can find a related post including an example. – ismirsehregal Feb 02 '22 at 10:18

0 Answers0