在RStudio查看器窗格中看不到闪亮的应用程序单选按钮

时间:2018-11-24 16:13:52

标签: r shiny rstudio

RStudio(在macOS上为1.2.1139版)查看器窗格使radioButtons(和FWIW,选定的checkboxInputs)不可见。但是,当在“运行应用程序”按钮下选择“运行外部”时,这些外观在浏览器中运行良好。下面是一个复制品和一些屏幕截图。

附录:我注意到shinyWidgets::prettyRadioButtons()可立即解决此问题。只需在顶部添加library(shinyWidgets),然后将调用替换为radioButtons()

# Reproduce radioButtons invisibility in RStudio viewer pane
library(shiny)

ui <- fluidPage(
   radioButtons("Dunit"
               ,"Dose Units"
               ,c("µg"="micrograms",
                  "mg"="milligrams",
                  "g"="grams")
               ,selected = "milligrams"
               ,inline = TRUE)
   ,checkboxGroupInput("Dper"
                       ,NULL
                       ,c("/m²"="perBSA",
                          "/kg"="perKg",
                          "abs"="absolute")
                       ,selected = "perKg"
                       ,inline = TRUE)
)

server <- function(input, output) {}

# Run the application 
shinyApp(ui = ui, server = server)

在RStudio查看器窗格中:

How this Shiny app looks in RStudio viewer pane

在外部浏览器中:

How this Shiny app looks in Safari web browser

1 个答案:

答案 0 :(得分:1)

这是MacOS上的Chromium(为RStudio的查看器提供动力的组件)中的一个已知问题。您可以通过添加zoom: 1.0000001或类似于为Shiny应用设置单选按钮样式的CSS来解决此问题。

此RStudio Github问题中的更多信息:

https://github.com/rstudio/rstudio/issues/3751

相关问题