如何设置R闪亮中的列的小数宽度? [英] How can I set decimal width for a column in R Shiny?

查看:0
本文介绍了如何设置R闪亮中的列的小数宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的R闪亮仪表板中为column()元素设置小数宽度。例如,我需要5列,因此需要每列2.4的宽度。

有办法吗?

推荐答案

SHINY的列宽基于Bootstrap 12-wide grid system。您只能指定整数。但是,您可以nest multiple columns实现细粒度布局。

以下是有关嵌套列的示例:

library(shiny)

ui <- fluidPage(fluidRow(
  p(),
  column(4, p(), style = "background-color: red;"),
  column(4, p(), style = "background-color: green;"),
  column(
    4,
    column(4, p(), style = "background-color: red;"),
    column(7, p(), style = "background-color: green;"),
    column(1, p(), style = "background-color: blue;")
  ),
))

server <- function(input, output, session) {}

shinyApp(ui, server)

作为替代方案,您可能需要选中?splitLayout,该选项接受css单位:

library(shiny)

ui <- fluidPage(splitLayout(
  p("red", style = "background-color: red;"),
  p("green", style = "background-color: green;"),
  p("blue", style = "background-color: blue;"),
  p("yellow", style = "background-color: yellow;"),
  p("orange", style = "background-color: orange;"),
  cellWidths = "20%"
))

server <- function(input, output, session) {
}

shinyApp(ui, server)

这篇关于如何设置R闪亮中的列的小数宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆