javascript - Shiny 的 active 颜色

标签 javascript r shiny

是否可以使用选择小部件来显示用于响应式(Reactive)颜色选择的调色板?我想让用户为 Shiny 的应用程序创建的图选择颜色。

最佳答案

shinysky 包有一个颜色选择器,您可以将其与 shiny 一起使用:

require(shinysky)
require(shiny)

runApp(list(
  ui = bootstrapPage(
    jscolorInput("colorid"), 
    uiOutput('myPanel'),
    plotOutput('plot')
  ),
  server = function(input, output) {
    output$myPanel <- renderUI({
      mystyle <- ifelse(is.null(input$colorid), "ffffff", input$colorid)
      inputPanel(
        numericInput('n', 'Number of obs', 100)
        , style = paste0("background-color:#", mystyle, ";")
      )
    })
    output$plot <- renderPlot({ hist(runif(input$n)) })
  }
))

enter image description here

它目前不在 CRAN 上,因此您需要通过 devtools 安装它,详细信息位于 https://github.com/AnalytixWare/ShinySky

关于javascript - Shiny 的 active 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24530195/

相关文章:

r - 如何为 R shiny App 连续旋转 3D Plotly

javascript - 在不知道匹配元素的嵌套位置的情况下选择匹配元素,但不选择这些匹配元素的子元素

javascript从(内部)对象文字中删除值

javascript - 数据表 - 使用选择框显示/隐藏

r - 通过知道两个数值向量得到导数

r - R-shiny : 100% height of leaflet map 中的传单

javascript - Google Apps 是否会阻止来自 Chrome 控制台的代码?

r - 绘制大量线条的更好方法(也许在 ggplot 中)?

r - R 中使用递归函数吗?

r - 如何访问/记住 Shiny 中未经检查的值?