Using brush double click zoom feature with the circlize package

library(circlize)
library(shiny)

set.seed(999)
n = 1000
df = data.frame(sectors = sample(letters[1:8], n, replace = TRUE),
x = rnorm(n), y = runif(n))

ui <- fluidPage(
fluidRow(
column(width = 4, class = "well",
h4("Brush and double-click to zoom"),
plotOutput("plot1", height = 300,
dblclick = "plot1_dblclick",
brush = brushOpts(
id = "plot1_brush",
resetOnNew = TRUE
)
)
))
)

server <- function(input, output) {
output$plot1 <- renderPlot({
circos.initialize(df$sectors, x = df$x)
circos.track(df$sectors, y = df$y
)
})
ranges <- reactiveValues(x = NULL, y = NULL)

observeEvent(input$plot1_dblclick, {
brush <- input$plot1_brush
if (!is.null(brush)) {
ranges$x <- c(brush$xmin, brush$xmax)
ranges$y <- c(brush$ymin, brush$ymax)

} else {
  ranges$x <- NULL
  ranges$y <- NULL
}

})

}

#)
#}

shinyApp(ui= ui, server = server)
Here is my code and it just won't zoom I am assuming it has something to do with the reactive values.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.