zoom {linevis} | R Documentation |
Zoom in/out the current visible window
Description
Zoom in/out the current visible window
Usage
zoomIn(id, percent = 0.5, animation = TRUE)
zoomOut(id, percent = 0.5, animation = TRUE)
Arguments
id |
graph2d id or a |
percent |
The amount to zoom in or out. Must be a number between 0 and 1. A value of 0.5 means that after zooming out the graph2d will show 50% more content. |
animation |
Whether or not to animate the zoom. |
Value
None, side-effect is Javascript call
Examples
## Not run:
linevis() %>%
zoomIn()
linevis() %>%
zoomOut(0.3)
## End(Not run)
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
linevisOutput("graph2d"),
sliderInput("zoom", "Zoom by", min = 0, max = 1, value = 0.5, step = 0.1),
checkboxInput("animate", "Animate?", TRUE),
actionButton("zoomIn", "Zoom IN"),
actionButton("zoomOut", "Zoom OUT")
),
server = function(input, output) {
output$graph2d <- renderLinevis(
linevis()
)
observeEvent(input$zoomIn, {
zoomIn("graph2d", percent = input$zoom, animation = input$animate)
})
observeEvent(input$zoomOut, {
zoomOut("graph2d", percent = input$zoom, animation = input$animate)
})
}
)
}
[Package linevis version 1.0.0 Index]