Description Usage Arguments Value Author(s) Examples
Creates a gallery element with buttons to switch between several content elements.
1 2 3 4 5 6 7 8 9 10 |
id |
optional element id, useful if current state is needed |
... |
content elements to show, names can be used to show titles |
style, content_style |
optional character specifying additional styles |
arrows |
optional list of arrows to use, by default defined as list( dq_icon("chevron-left"), dq_icon("chevron-right")), can be a list of other icons or freely designed html elements |
scrollable |
optional logical to specify if the gallery can be moved with a scrollbar (this option will hide arrows) |
set |
index of the content element to show |
add |
numeric amount of indexes to move (can also be negative) |
gallery element tag
richard.kunze
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## Only run examples in interactive R sessions
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
fluidRow(
column(6, dq_gallery(id = "myGallery",
Plot1 = plotOutput("plot1"), Plot2 = plotOutput("plot2"),
plotOutput("plot3"), plotOutput("plot4"),
content_style = "padding: 10px 30px;", arrows = list(
dq_icon("chevron-circle-left"), dq_icon("chevron-circle-right")
)
)),
column(6,
actionButton("show3", "Show plot 3"),
actionButton("anim", "Animate Plots")
)
)
),
server = function(input, output) {
output$plot1 <- renderPlot(plot(mtcars$mpg, mtcars$cyl))
output$plot2 <- renderPlot(plot(mtcars$disp, mtcars$hp))
output$plot3 <- renderPlot(plot(mtcars$drat, mtcars$wt))
output$plot4 <- renderPlot(plot(mtcars$qsec, mtcars$vs))
observeEvent(input$show3, update_dq_gallery("myGallery", set = 3))
observeEvent(input$anim, {
for(i in 1:30) {update_dq_gallery("myGallery", add = .1);Sys.sleep(.2)}
})
}
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.