R:在传单中使用 browsable() 会导致屏幕高度变小

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

我用 R 制作了一个传单,如下所示:

my_leaflet <- my_data %>%
leaflet (options = leafletOptions(
-
) %>^%
addProvidersTiles(
-
)
setView(
-
) %>%
addMarkers (
--
) %>%
addCircleMarkers(
-
) %>%
addLegend(  ..  )

我在生成的 html 代码的这一部分中得到“height: 100%”: 没有可浏览():

enter image description here

但是当我使用 browsable() 时:

browsable(
  tagList(list(
    tags$head(
      tags$style(
        ".leaflet .legend i{
            border-radius: 50%;
            width:12px;
            height: 12px;
            margin-top: 4px;

         }",
    ),
     my_leaflet
  ))
))

然后我在生成的 html 代码中得到“height: 400px”(见下图),并且传单地图只显示了我屏幕的一半。

使用可浏览():

enter image description here

有没有办法让html代码显示全屏高度?我不确定“高度:400px”是否是造成这种情况的原因。使用 browsable() 时有没有办法让这个高度达到 100%?

html css r r-leaflet
1个回答
0
投票

尝试

vh
单位。根据您的情况,将
my_leaflet
修改为
leaflet(height = '100vh', ...)

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