shiny - R Highcharter zoom selected area -


is possible store coordinates of zoomed area in highcharter shiny app?

i similar example's:

function getselection(event) {     alert(event.xaxis[0].min);     alert(event.xaxis[0].max); }  

but instead of alert, store them , use them.

the sample shiny app:

library(shiny) library(dplyr) library(highcharter) library(tidyr)  df_plot <- cbind(   seq(0, 1, = 0.1),   sample(seq(from = 100, = 300, = 10), size = 11, replace = true),   sample(seq(from = 1, = 100, = 9), size = 11, replace = true),   sample(seq(from = 50, = 60, = 2), size = 11, replace = true),   sample(seq(from = 100, = 130, = 1), size = 1, replace = true) ) %>% as.data.frame()  names(df_plot) <- c("x", "a", "b", "c", "d")   ui <- fluidpage(   column(     width = 3,     selectinput("select", "select var:", choices = c("a", "b", "x", "y"), selected = c("a", "b", "x"), multiple = true)   ),   column(     width = 9   ),   column(     width = 12,     highchartoutput("plot")   ) )  server <-  function(input, output){    output$plot <- renderhighchart({     highchart() %>%       hc_xaxis(categories = df_plot$x) %>%       hc_add_series(data = df_plot$a) %>%       hc_add_series(data = df_plot$b, yaxis = 1) %>%       hc_yaxis_multiples(         list(linewidth = 3, linecolor='#7cb5ec', title=list(text="first y-axis")),         list(linewidth = 3, linecolor="#434348", title=list(text="second y-axis"))) %>%       hc_chart(         zoomtype = "x"       )   }) }  shinyapp(ui, server) 

you can somethig this:

library(shiny) library(highcharter)   ui <- fluidpage(   column(8,highchartoutput("hcout")),   column(4,textoutput("eventout"))   )  server <- function(input, output) {     output$hcout <- renderhighchart({       highcharts_demo() %>%         hc_chart(          zoomtype = "xy",          events = list(            selection = js("function(event) {                         shiny.oninputchange('event', [event.xaxis[0].min,     event.xaxis[0].max]);                           return true;                           } ")          )        )      })     output$eventout <- rendertext({        input$event      })  } 

but don't know why reset zoom button don't work (as same jsfiddle example when enable resetzoombutton)


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -