我正在制作一个 rMarkdown flex 仪表板交互式 html 页面,我们将把它嵌入到另一个页面(一个 iFrame)中。有两张并排的小地图。地图本身、内容、比例尺、图例弹出窗口都为我们的目的正确格式化。
但是,当在地图左侧(图例所在的位置)激活弹出窗口时,它会在图例后面打开。我已经调整了一些图例的不透明度......但是当碰撞时它不足以使弹出窗口有用。降低它会使辨别刻度中的颜色变得困难,从而降低图例的可解释性。地图确实继续向右,只是没有意义的内容。
我希望找到解决这种情况的三种方法之一。
1. direct the popup to open in front of the legend
2. set the legend background to complete transparency, while leaving the legends values and bin colors at opacity of 1
3. creating a fixed location in the upper right corner where the popup opens when activated so that they never conflict.
但是,我完全愿意接受任何其他可能有用的建议。我不能做的一件事是更改它们所在的图形的整体宽度,因为它们需要装入预先确定的设定尺寸的“盒子”中。他们需要并排。
map<-leaflet(width ="100%")%>%
setView(lat=43.9625, lng = -72.5506, zoom = 7)%>%
addProviderTiles("CartoDB.Positron")%>%
addPolygons(data = plot2010,
fillColor = ~pal(plot2010@data$per100K),
smoothFactor = 0.2,
fillOpacity = 0.8,
weight = 0.2,
popup=popContent,
popupOptions= popupOptions(maxWidth ="100%", closeOnClick = TRUE))%>%
addLegend(position="topleft",
pal=pal,
values= plot2010@data$per100K,
title ='Age Adjusted Rates </br> per 100,000',
na.label = "Not Available",
opacity=.5,
labFormat = labelFormat(digits=1))
map