简体   繁体   English

Shinydashboard box() 被 Shiny 中的图形包屏蔽

[英]Shinydashboard box() masked by graphics package in Shiny

I am trying to create boxes for my shiny app but I believe the box() function from shinydashboard is being masked by the box() function from graphics package.我想为我的闪亮的应用程序创建盒,但我相信box()从功能shinydashboard正在被屏蔽box()从函数graphics软件包。

Here is a very simple reproduction of my problem with a screenshot of what my box looks like.这是我的问题的一个非常简单的再现,其中包含我的盒子外观的屏幕截图。 I've included the packages that I use in my actual shinyapp in case that is important, but they aren't used in this reproduction.我已经包含了我在我的实际 Shinyapp 中使用的包,以防万一很重要,但在这次复制中没有使用它们。 I have tried running it with shinydashboard::box() but that didn't work either.我试过用shinydashboard::box()运行它,但这也不起作用。

library(shiny)
library(shinydashboard)
library(flexdashboard)
library(dplyr)

server <- shinyServer(function(input, output){
 })

ui <- shinyUI(
    fluidPage(
        titlePanel("title panel"),
        sidebarLayout(
            sidebarPanel("Sidebar"),
            mainPanel(
                shinydashboard::box(title = "Box Fail.", status = "primary", background = "red")
            )) ))

shinyApp(ui = ui, server = server)

``
[![shiny screenshot][1]][1]


  [1]: https://i.stack.imgur.com/a17d2.png

You can use the useShinydashboard() from shinyWidgets package您可以使用shinyWidgets包中的useShinydashboard()

Description描述

Allow to use functions from 'shinydashboard' into a classic 'shiny' app, specifically valueBox, infoBox and box.允许将“shinydashboard”中的功能用于经典的“shiny”应用程序,特别是 valueBox、infoBox 和 box。

library(shiny)
library(shinydashboard)
library(flexdashboard)
library(dplyr)
library(shinyWidgets)

server <- shinyServer(function(input, output){})

ui <- shinyUI(
  fluidPage(
    useShinydashboard(),
    titlePanel("title panel"),
    sidebarLayout(
      sidebarPanel("Sidebar"),
      mainPanel(
        shinydashboard::box(title = "Box Fail.", status = "primary", background = "red")
      )) ))

shinyApp(ui = ui, server = server)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM