splitLayout中的多个colourpicker,颜色框被隐藏

zx8*_*754 6 r colors shiny

当两个颜色选择器使用splitLayout并排使用,颜色映射将被隐藏.tags$style...HTML()任何想法都可以很容易地修复它?

这是一个例子:

library(shiny)
library(colourpicker)

shinyApp(
  ui = fluidPage(
    sidebarPanel(
      splitLayout(
        colourInput("PlotThemeColour1",
                    "Plot theme shade 1",
                    "#C2C2C2"),
        colourInput("PlotThemeColour2",
                    "Plot theme shade 2",
                    "#E5E5E5"))),
    mainPanel(textOutput("myCols"))
  ),

  server = function(input, output, session) {
    output$myCols <- renderText({
      paste(input$PlotThemeColour1, "and", input$PlotThemeColour2)

    })
  })
Run Code Online (Sandbox Code Playgroud)

产量

在此输入图像描述

amr*_*rrs 6

我不确定修复它的正确方法是什么.但一个快速的解决方法是覆盖导致它的CSS.目前该CSS值.shiny-split-layout>divoverflow设置为auto,这是出现在shiny.css如此使用内联CSS来覆盖它overflow:visible似乎解决了问题.

在此输入图像描述

library(shiny)
library(colourpicker)

shinyApp(
  ui = fluidPage(
     tags$style(HTML('.shiny-split-layout>div {
                         overflow:visible;
                                   }')), 
    sidebarPanel(
      splitLayout(
        colourInput("PlotThemeColour1",
                    "Plot theme shade 1",
                    "#C2C2C2"),
        colourInput("PlotThemeColour2",
                    "Plot theme shade 2",
                    "#E5E5E5"))),
    mainPanel(textOutput("myCols"))
  ),

  server = function(input, output, session) {
    output$myCols <- renderText({
      paste(input$PlotThemeColour1, "and", input$PlotThemeColour2)

    })
  })
Run Code Online (Sandbox Code Playgroud)

方法#2:

使用cellArgssplitLayout覆盖单个细胞的CSS.

library(shiny)
library(colourpicker)

shinyApp(
  ui = fluidPage(

    sidebarPanel(
      splitLayout(
        colourInput("PlotThemeColour1",
                    "Plot theme shade 1",
                    "#C2C2C2"),
        colourInput("PlotThemeColour2",
                    "Plot theme shade 2",
                    "#E5E5E5"), cellArgs = list (style = "overflow:visible"))),
    mainPanel(textOutput("myCols"))
    ),

  server = function(input, output, session) {
    output$myCols <- renderText({
      paste(input$PlotThemeColour1, "and", input$PlotThemeColour2)

    })
  })
Run Code Online (Sandbox Code Playgroud)