Ash*_*aul 9 r shiny shinydashboard dt
这是一个在 R 中创建的数据表的脚本。我试图通过调整图的宽度来完全适应框中的图。下面是情节的脚本以及我试图适应的盒子。请帮我调整使用数据表生成的图的宽度。另外,我不想增加框的宽度。可能的解决方案的链接将有很大帮助。谢谢。
数据表脚本:
r3_blood = subset(patient, handling == "Blood test" & employee == "r3")
datatable(r3_blood, options = list(
searching = FALSE,
pageLength = 5,
lengthMenu = c(5, 10, 15, 20)
))
Run Code Online (Sandbox Code Playgroud)
将表格放入框中的脚本:
box( title = "Case Summary", status = "primary", height =
"575",solidHeader = T,
dataTableOutput("sankey_table"))
Run Code Online (Sandbox Code Playgroud)
Por*_*hop 17
1) 连同已经提出的possible duplicate 票,您可以使用div(DT::dataTableOutput("table"), style = "font-size: 75%; width: 75%")
2)您也可以添加scrollX = T到您的选项中
library(DT)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody(
box(title = "Case Summary", width = 4,status = "primary", height = "575",solidHeader = T, dataTableOutput("Table"))
)
)
server <- function(input, output, session) {
output$Table <- renderDataTable(
datatable(mtcars, options = list(searching = FALSE,pageLength = 5,lengthMenu = c(5, 10, 15, 20), scrollX = T))
)
}
shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)