我在 flexdashboard 中使用闪亮的运行时。
我想在按钮按下(input$updt
)时隐藏图表,我正在尝试这个:
---
title: "Students Data - College of Business"
output:
flexdashboard::flex_dashboard:
orientation: columns
runtime: shiny
---
```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(shinyjs)
shinyjs::useShinyjs(rmd=TRUE)
```
Column {data-width=650}
-----------------------------------------------------------------------
### Chart A
```{r}
actionButton('updt', 'Update chart')
output$p1 <-renderPlot({ ggplot(diamonds, aes(carat, price)) + geom_point() }, height=800)
plotOutput("p1")
output$p2 <- renderPlot({
ggplot(mtcars, aes(cyl, disp))+ geom_point()
})
plotOutput("p2")
observeEvent(input$updt, {hide("p1")})
```
但是,当我单击按钮时,它不会隐藏p1