r - 闪亮的传单
问题描述
数据框是一个
样本数据如下
ID Lat Long Address
1 12.904249 77.70253 1/2 CA
2 21.221475 72.81281 2/3 DC
3 23.039251 72.58388 3/5 HJ
library (leaflet)
shinyApp(
ui = fluidPage(
titlePanel("Lat Long Address Mapping in R"),
fluidRow(
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Map",
bootstrapPage(
tags$style(type = "text/css", "html, body {width:100%;height:100%}"),
leafletOutput("map", width = "100%", height = "100%"),
absolutePanel(
top = 80,
left = 30,
)
)
)
,
server = function(input, output,session) {
output$map <- renderLeaflet({
leaflet(a) %>%
addProviderTiles("CartoDB.Positron") %>%
addMarkers(lng = ~Long, lat = ~Lat,
popup = ~address)})
输出显示闪亮的空白屏幕
但是,当我独立运行此代码时,它可以工作并绘制地图
leaflet(a) %>%
addProviderTiles("CartoDB.Positron") %>%
addMarkers(lng = ~Long, lat = ~Lat,
popup = ~Address)
闪亮代码的一些问题
解决方案
问题似乎出height = "100%"
在leafletOutput
您的tabPanel
. 我确实在这里找到了相关的解决方案。这是基于SuperZip ui。
ui = fluidPage(
titlePanel("Lat Long Address Mapping in R"),
fluidRow(
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Map",
bootstrapPage(
div(class = "outer",
tags$style(type = "text/css", ".outer {position: fixed; top: 120px; left: 0; right: 0; bottom: 0; overflow: hidden; padding: 0}"),
leafletOutput("map", width = "100%", height = "100%"),
absolutePanel(top = 80, left = 30)
)
)
)
)
)
)
)
推荐阅读
- c# - 如何通过文本框在datagridview中搜索
- ubuntu - 如何安装 CMake 在 find_package 中包含 catkin/ROS 的项目?
- java - 使用方面修改方法参数
- eclipse - 原因:java.lang.NoClassDefFoundError: Failed to link when running JUnit tests through Arquiliqn for a Maven project
- sql - 由于 SAS 中的交错结果,如何折叠重复行
- node.js - Nodejs 发现 Nodejs 的其他实例
- javascript - 从纬度/经度坐标获取 WOEID
- java - 如何获取有关用户选择的音频文件的信息?(使用 SAF 和 MediaStore)
- json - 为什么从远程 AWS S3 服务器下载 json 文件时 axios GET 错误
- r - 输入矩阵的每一行都需要至少包含一个非零条目