r - Shiny 应用程序中的“SummaryTools”使用“bootswatch”应用自定义主题
问题描述
我正在使用“Shiny”创建一个网络应用程序,并且曾经summarytools::dfSummary
打印出我的数据摘要。我曾经bs_theme
使用选择的十六进制值来主题化应用程序。
我正在努力格式化来自 的输出summarytools::dfSummary
,它最终只格式化了摘要的图形部分,而其余的输出没有主题化。
我可以DT::datatable
通过添加来设置我的主题style = "bootstrap"
,但是无法获得相同的效果dfsummary
。
应用程序主题:查看我的主题在我的应用程序的其他部分中的工作方式
服务器代码
shinyServer(function(input, output, session) {
output$data_dt <- DT::renderDataTable({
DT::datatable(data = as.data.frame(data_a2),
style = "bootstrap")
})
output$Summary <- renderUI({
summary_stats <- data_a2 %>%
summarytools::dfSummary() %>%
print(method = "render",
plain.ascii = FALSE,
graph.magnif = 0.8,
headings = TRUE,
bootstrap.css = FALSE,
style= "bootstrap")
})
})
用户界面代码
shinyUI(
navbarPage(
title = ("stuff"),
#Raw data
tabPanel("raw data",
DT::dataTableOutput(outputId= "data_dt")
),
#summary
tabPanel("summary",
htmlOutput(outputId= "Summary")
),
#theme
inverse = TRUE,
theme = bs_theme(version = 4,
bg = "#1A1A1A",
fg = "#BC7B7D",
primary = "#CFB1B3",
base_font = font_google("Space Mono"))
)
)
对此的任何帮助将不胜感激,谢谢!
解决方案
推荐阅读
- html - 在服务器上使用应用程序时图像抛出 404 错误
- javascript - html表单在mysql中插入数据的数据提交中断
- javascript - 循环遍历数组并填充矩阵 - JS
- python - 我正在尝试打开扩展名为 .ml 的文件
- jsonpath - jsonpath查找所有键离开包含一个字符串
- swift - 在 swiftui 中 2 秒后推送视图
- c++ - 是否有任何 C++ 函数可以对地图进行排序?
- python - 在字符串之后对齐文本以更加对称
- php - Slim 4:使用容器与模型和控制器共享数据库连接,无需 Eloquent
- javascript - Javascript 检查数据可用性和 http 状态