r - Shiny app radioButtons invisible in RStudio viewer pane
问题描述
The RStudio (Version 1.2.1139 on macOS) viewer pane renders radioButtons (and FWIW, selected checkboxInputs) invisible. But these look and work fine in the browser, when 'Run External' is selected under the 'Run App' button. Below is a repro, and some screenshots.
Addendum: I note that shinyWidgets::prettyRadioButtons()
resolves this issue immediately. Simply add library(shinyWidgets)
at the top, and replace the call to 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)
In RStudio viewer pane:
In External browser:
解决方案
这是 MacOS 上 Chromium(支持 RStudio 查看器的组件)中的一个已知问题。您可以通过添加zoom: 1.0000001
或类似于为您的 Shiny 应用设置单选按钮样式的 CSS 来解决此问题。
此 RStudio Github 问题中的更多信息:
推荐阅读
- c++ - C++ 静态成员变量 - 文件之间的访问
- python - 检查 Pandas 数据框中的哪些值不在 SQL 数据库中
- maven - maven-archetype-plugin 因 ClassNotFoundException 而失败
- python - 如何让 pyinstaller 识别我的自定义导入?
- sql-server - 查看与查询不显示相同的结果
- python - predict_proba 不适用于我的高斯混合模型(sklearn,python)
- swift - tableview 单元格上的详细文本标签不使用倒数计时器刷新
- resharper - Resharper 在使用无扩展链接时抱怨“路径错误”
- google-cloud-platform - Python 包安装在 GCP 实例上,但当我通过 Jupiter Lab 启动笔记本时未显示
- c++ - 在 push_back() 之前保留非空 std::vector 的正确方法