在Shiny中包含HTML--tabPanel不会改变大小。

问题描述 投票:4回答:1

我正在用Shiny做一个仪表盘,我想加入一些图片(并且能够把它们放在页面上。然而,我包含一些文本和图像的框没有任何高度。有人知道如何解决这个问题吗?我已经包含了我的代码和我的仪表板的截图。

我的代码(UI)(问题在Tab4)。

dashboardBody(    
    useShinyjs(),
    fluidRow(
        tabBox(
            side = 'right',
            width = 12,
            height = "100%",
            selected = "Tab1",
            tabPanel("Tab1", 
                dataTableOutput('table2')),
            tabPanel("Tab2", 
                dataTableOutput('table1')),
            tabPanel("Tab3", 
                h2("Old:"),
                h4("some text to explain the datatable"),
                DT::dataTableOutput('table3'),
                hr(),
                h2("New:"),
                h4("Some more text to explain this datatable."),
                DT::dataTableOutput('table4')
              ),
            tabPanel("Tab4", 
                div(h2("This is an example"),
                    p("some text"),
                    h3("some header"),
                    p('Even more text'),
                    img(src='logoStackOverflow.PNG'),
                    p('explain something about the image'),
                    style ="position:absolute;
                    max-width:1200px;
                    left:30px;
                    top:40px;
                    height:100%;"),
                div(img(src="logoStackOverflow.PNG"),
                    img(src="logoStackOverflow.PNG"),
                    style ="position:absolute;
                            border: 1px solid;
                            max-width:300px;
                            box-align:right;
                            position: fixed;
                            height:auto;
                            right:100px;
                            top:150px;")
             )
          )
         )
        )

Screenshot of my Shiny dashboard

html r shiny shinydashboard
1个回答
0
投票

你很接近了。 替换 img()tags$img() 并提供高度和宽度为 tags$img(height=100, width=100, src="YBS.png", style="text-align: right;"). 然后你会得到以下信息 产出 在表4中。

© www.soinside.com 2019 - 2024. All rights reserved.