我正在使用预测工具,并基于一些特征,我将计算风险预测并以图作为输出。
我有一个FluidPage,我希望将我的绘图显示在框中。 我发现可以通过使用useShinydashboard()在FluidPage中使用Shinydashboard函数。 这似乎可以正常工作,但是我发现当我的ui中也有useShinydashboard()选项时,bsTooltip函数不起作用。
那么,有没有办法让bsTooltip正常工作并将我的绘图放在一个盒子里?
在下面的代码中,bsTooltip在此示例中不起作用,但是,如果在useShinydashboard()前面加上#,它将起作用。
library(shiny)
library(shinyWidgets)
library(shinydashboard)
library(personograph)
library(shinyBS)
# Define UI ----
ui <- fluidPage(
setBackgroundColor(color = "#CEF6F5"),
titlePanel(title=div( "Risk prediction tool")),
p("Chronic Obstructive Pulmonary Disease (COPD) is a lung problem that can affect people mainly as they get older."),
selectInput("sex", label=p("What is your gender?"),
choices=list("Female"=1, "Male"=0), selected=1),
bsTooltip("sex", "What is your sex?","right"),
sliderInput("age", label=p("What is your age?"), min = 18, max = 90, value = 35),
bsTooltip("age", "What is your current age in years?","right"),
br(),
useShinydashboard(),
box(title ="Your risk", status = "warning", solidHeader = T, collapsible = F, width = NULL,
plotOutput('plot1', height="350px"))
)
# Define server logic ----
server <- function(input, output, session) {
prediction <- observe({
vals <- list(first=0.3, second=0.7)
output$plot1 <- renderPlot({
personograph(data=vals, colors=list(first="red", second="blue"), draw.legend=FALSE) })
})
}
# Run the app ----
shinyApp(ui = ui, server = server)