Power BI和传单R包-未显示图块

时间:2019-03-13 13:03:28

标签: r leaflet powerbi

我在使用power bi自定义视觉效果中的传单R包显示传单拼贴时遇到问题。

在此procedure之后解释了如何在Power BI中使用自定义视觉效果,我使用了以下代码:

source('./r_files/flatten_HTML.r')

library(dplyr)
library(leaflet)

dataset <- Values
m <- leaflet() %>%   addProviderTiles("Stamen.Watercolor") %>% 
addCircleMarkers(dataset$lng, dataset$lat, radius = dataset$size) %>% 
addCircleMarkers(dataset$lng, dataset$lat, radius = runif(100, 4, 10), color = c("red"))

internalSaveWidget(m, 'out.html');

我的数据集看起来像这样(任何数据集都存在相同的问题,包括传单帮助中使用的数据集):

dput(head(dataset))

structure(list(value = c(0.0312819085485015, -0.0347865234437622, 
-0.0483830686065398, -0.0549732174222513, -0.066608077878619, 
-0.074376647461119), size = c(19.5772261708044, 9.14226635242812, 
6.23493849067017, 17.0839378878009, 13.8565228821244, 10.3433380043134
), lng = c(-93.6313250520961, -93.6473800245603, -93.6538138931705, 
-93.6456154972455, -93.6484166098675, -93.6543456657981), lat =         c(42.0347684275463, 
42.0326412382433, 42.0269432323368, 42.0222304571459, 42.0314391809256, 
42.0405492323631), Column1 = c(61L, 64L, 92L, 68L, 74L, 21L), 
category = structure(c(9L, 6L, 4L, 2L, 10L, 4L), .Label = c("A", 
"B", "C", "D", "E", "F", "G", "H", "I", "J"), class = "factor")), row.names = c(NA, 
6L), class = "data.frame")

如以下image所示,圆圈正确显示,但背景仍然为空。

1 个答案:

答案 0 :(得分:0)

我终于找到了一种替代方法,使用there提供的图块。

必须使用以下语法(例如OpenTopoMap磁贴的示例):

leaflet() %>%   
addTiles("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png") %>%
addCircleMarkers(dataset$lng, dataset$lat, radius = dataset$size) %>% 
addCircleMarkers(dataset$lng, dataset$lat, radius = runif(100, 4, 10), color = c("red"))