对以下问题的回答表明可以将SVG添加到传单弹出窗口中:looking for examples of SVG graphics in Leaflet popups
以下是另一个例子:Making a graph inside a leaflet popup using geoJson data
但是,我从传单的R包装器尝试以后失败了:
library(magrittr)
library(leaflet)
content <- paste(sep = '<body>'
,'<svg height="100" width="100">'
,'<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />'
,'Sorry, your browser does not support inline SVG.'
,'</svg>'
,'</body>'
)
leaflet() %>%
addTiles() %>%
addPopups(-122.327298
,47.597131
,content
,options = popupOptions(closeButton = FALSE)
)
问题:是否可以从R中向小册子弹出窗口添加SVG?
答案 0 :(得分:0)
您的sep = "<body>"
不正确,因为使用<body>
,您在paste()
来电中的每个其他代码之间插入了\n
代码。使用content <- paste('<body>'
,'<svg height="100" width="100">'
,'<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />'
,'Sorry, your browser does not support inline SVG.'
,'</svg>'
,'</body>', sep = "\n"
)
作为分隔符,弹出窗口中的SVG适用于我:
for(int rowNumber = 0; rowNumber < MATRIX_SIZE; rowNumber++)
{
if(rowNumber == 2){
break;
}
// do something with this row
for(int colNumber = 0; colNumber < MATRIX_SIZE; colNumber++)
{
if(colNumber == 3){
break;
}
// do something with this row
}
}