css - 带有 CSS 的闪亮进度条
问题描述
在以下脚本中,我尝试使用 CSS 更改默认的闪亮进度条:
server <- function(input, output) {
output$plot <- renderPlot({
input$goPlot
dat <- data.frame(x = numeric(0), y = numeric(0))
withProgress(message = 'Making plot', value = 0, {
n <- 10
for (i in 1:n) {
dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1)))
incProgress(1/n, detail = paste("Doing part", i))
Sys.sleep(0.1)
}
})
plot(dat$x, dat$y)
})
}
ui <- shinyUI(basicPage(
tags$style(type = 'text/css', '.shiny-progress .progress-text { color: #020202; font-size: 30px; background-color: #FF0000; }'),
plotOutput('plot', width = "300px", height = "300px"),
actionButton('goPlot', 'Go plot')
))
shinyApp(ui = ui, server = server)
我尝试用这一行更改颜色、字体大小和背景颜色:
tags$style(type = 'text/css', '.shiny-progress .progress-text { color: #020202; font-size: 30px; background-color: #FF0000; }'),
完全按照 Winston Chang 的建议:https ://groups.google.com/forum/#!topic/shiny-discuss/aFJTOLhld3U和咨询:https ://github.com/rstudio/shiny/blob/515a67a/inst/www /shared/shiny.css#L94-L114
但无论我尝试什么,都不会改变进度条。有人有什么主意吗?例如,我是否使用正确的 css 选择器来“连接”到闪亮的进度条?
解决方案
如果要使用自定义 css,则必须设置选项style="old"
:
withProgress(message = 'Making plot', value = 0, {
n <- 10
for (i in 1:n) {
dat <- rbind(dat, data.frame(x = rnorm(1), y = rnorm(1)))
incProgress(1/n, detail = paste("Doing part", i))
Sys.sleep(0.1)
}
}, style="old")
推荐阅读
- java - Vaadin Grid Table:如何为空单元格绘制边框?
- excel - 从多个日历中删除会议
- python - 在 Windows 上运行 docker-py 时出现客户端错误
- json - AWS - API Gateway 的 IAM 策略
- erlang - 如何修改 erts 模块
- python - 将来自其他模型的额外字段添加到 Modelform 中并提供 attr
- php - Mysql Join没有在Php中获取完整数据
- javascript - 为什么视频完整路径在 netBeans IDE 中不起作用?
- shell - 如何防止在PowerShell中保存以空格开头的输入历史记录?
- twilio - Agora 或 Twilio SDK 可以为预定活动提供房间吗?