shinyjs

clicking same plotly marker twice does not trigger events twice

女生的网名这么多〃 提交于 2019-11-28 09:15:30
问题 I am using Plotly's event_data("plotly_click") to do stuff (opening a modal) after the user clicked on a marker in a scatter plot. Afterwards (e.g. closing the modal), event_data("plotly_click") does of course not change and clicking on the same marker therefore does not trigger the same action again. Minimal example: library(plotly) ui <- fluidPage( plotlyOutput("plot") ) server <- function(input, output, session) { output$plot <- renderPlotly({ mtcars %>% plot_ly(x=~disp, y=~cyl) }) # Do

Restart Shiny Session

十年热恋 提交于 2019-11-28 08:29:08
This seems like a very obvious question but I haven't found anything on the subject. How can I refresh a shiny application (the equivalent of pressing F5, or clicking the "Reload App" button in RStudio)? ui.R shinyUI(pageWithSidebar( headerPanel("Example"), sidebarPanel( actionButton("goButton", "Refresh") ), mainPanel( h4("I would really like to refresh this please.") ) )) server.R shinyServer(function(input, output,session) { observe({ if(input$goButton==0) return(NULL) isolate({ # # I would like to refresh my session here with some sort of # function like session(refresh)... }) }) }) I don

How to collapse sidebarPanel in shiny app?

守給你的承諾、 提交于 2019-11-28 01:03:47
问题 I have a shiny app with a mainPanel and a sidebarPanel inside a tabPanel in a navbarPage. I need an option to hide the sidebarPanel similar to this: Hide sidebar in default in shinydashboard and https://github.com/daattali/shinyjs/issues/43. An actionButton should control if the sidebarPanel is shown or collapsed. This is the code: library(shiny) library(shinyjs) ui <- fluidPage( navbarPage("", tabPanel("tab", sidebarPanel( useShinyjs() ), mainPanel(actionButton("showSidebar", "Show sidebar")

Shiny leaflet easyPrint plugin

删除回忆录丶 提交于 2019-11-28 00:56:42
问题 I'm trying to incorporate the easyPrint plugin into my shiny leaflet app. What I want is something that looks like the demo, but in shiny. I have tried to mimic the examples, but have been unsuccessful. Here's my code for my R code so far: library(shiny) library(shinydashboard) library(shinyjs) library(htmlwidgets) library(htmltools) library(leaflet) library(leaflet.extras) library(sp) shinyApp( ui = fluidPage( leafletOutput("map", height = 750) ), server = function(input, output) {

Shiny Dashboard - display a dedicated “loading..” page until initial loading of the data is done

让人想犯罪 __ 提交于 2019-11-27 23:36:47
I have initial loading of data from the DB in the server.R which takes a few seconds. Until this is done, the page displayed is distorted (wrong data in selection box, and weird placing of the boxes, see below). I want to display a different page (or at least different content in my first-displayed tab) until the data is completely loaded. I thought about doing some kind of conditionalPanel using a condition based on a dedicated global variable (initial_loading_done), but wherever I tried placing the conditionalPanel it didn't work. This is the structure of my UI.R: shinyUI( dashboardPage(

activate tabpanel from another tabpanel

自古美人都是妖i 提交于 2019-11-27 22:36:45
I want when i start the application the tab panel tab2 = desactivated, and will be activated once i click the button in the first tab panel tab1, i tried with shinyjs and through CSS properties but i can not do that. thanks for your help Alex library(shiny) library(shinyjs) runApp(list( ui = bootstrapPage( tabsetPanel( tabPanel(title = "tab1", id="tab1", br(), actionButton("click", label = "View tab2 panel")), tabPanel(title = "tab2", id="tab2") ) ), server = function(input, output, session){ } )) You need a bit of javascript to do this. Here's a solution using shinyjs. I also included some

Possible to show console messages (written with `message`) in a shiny ui?

断了今生、忘了曾经 提交于 2019-11-27 11:41:29
I don't understand R's message vs cat vs print vs etc. too deeply, but I'm wondering if it's possible to capture messages and show them in a shiny app? Example: the following app can capture cat statements (and print statements as well) but not message statements runApp(shinyApp( ui = fluidPage( textOutput("test") ), server = function(input,output, session) { output$test <- renderPrint({ cat("test cat") message("test message") }) } )) Cross post from the shiny-discuss Google group since I got 0 answers. Yihui suggested I use withCallingHandlers , and that indeed let me to a solution. I wasn't

Page refresh Button in R shiny

僤鯓⒐⒋嵵緔 提交于 2019-11-27 06:22:15
问题 I tried to implement a page refresh button following the link here. However when I tried deploying to shinyapp.io , it failed and asked for installing package V8 which I had already done. The app was working fine on the machine. The code I used is: jsResetCode <- "shinyjs.reset = function() {history.go(0)}", useShinyjs(), # Include shinyjs in the UI extendShinyjs(text = jsResetCode), # Add the js code to the page p(actionButton("reset_button", "Reset Tool")) In server.R : observeEvent(input

Restart Shiny Session

六月ゝ 毕业季﹏ 提交于 2019-11-27 05:47:39
问题 This seems like a very obvious question but I haven't found anything on the subject. How can I refresh a shiny application (the equivalent of pressing F5, or clicking the "Reload App" button in RStudio)? ui.R shinyUI(pageWithSidebar( headerPanel("Example"), sidebarPanel( actionButton("goButton", "Refresh") ), mainPanel( h4("I would really like to refresh this please.") ) )) server.R shinyServer(function(input, output,session) { observe({ if(input$goButton==0) return(NULL) isolate({ # # I

Shiny Dashboard - display a dedicated “loading..” page until initial loading of the data is done

ⅰ亾dé卋堺 提交于 2019-11-27 04:37:37
问题 I have initial loading of data from the DB in the server.R which takes a few seconds. Until this is done, the page displayed is distorted (wrong data in selection box, and weird placing of the boxes, see below). I want to display a different page (or at least different content in my first-displayed tab) until the data is completely loaded. I thought about doing some kind of conditionalPanel using a condition based on a dedicated global variable (initial_loading_done), but wherever I tried