add_shiny doesn't work in flexdashboard
stefanavey opened this issue · 2 comments
stefanavey commented
add_shiny()
works with the example (note that I had to change 1000
to 100
since there are not that many rows in sequences
) but the same code fails in flexdashboard. Here is a minimal example where I expect the text of the mouse over to be displayed in the lower panel.
---
output:
flexdashboard::flex_dashboard
---
### Sunburst
```{r}
library(flexdashboard)
library(sunburstR)
sequences <- read.csv(
system.file("examples/visit-sequences.csv",
package="sunburstR"),
header = FALSE, stringsAsFactors = FALSE)
renderSunburst({
sequences <- sequences[sample(nrow(sequences),100),]
add_shiny(sunburst(sequences))
})
```
### Selection
```{r}
selection <- reactive({
input$sunburst_mouseover
})
renderText(selection())
```
timelyportfolio commented
@stefanavey thanks for the issue. With rmd runtime=shiny
, we will need a way to identify the sunburst output. Here is one way to make it work.
---
output:
flexdashboard::flex_dashboard
runtime: shiny
---
### Sunburst
```{r}
library(shiny)
library(flexdashboard)
library(sunburstR)
sequences <- read.csv(
system.file("examples/visit-sequences.csv",
package="sunburstR"),
header = FALSE, stringsAsFactors = FALSE)
sunburstOutput("sb")
output$sb <- renderSunburst({
sequences <- sequences[sample(nrow(sequences),100),]
add_shiny(sunburst(sequences))
})
```
### Selection
```{r}
selection <- reactive({
input$sb_mouseover
})
renderText({selection()})
```
stefanavey commented
Thanks that makes sense and is an easy fix.