为什么在 R Shiny 中使用 Shinyscreenshot 包时,传单地图截图会损坏?

问题描述

我想获取当前页面截图。但我总是得到破碎的传单地图截图。

你能帮我吗?

我使用闪亮的、闪亮的仪表板、传单、闪亮的屏幕截图......包

ui.R

tags$div(
      id = "main",style = "",tags$div(
        class = "Box-body",leafletoutput("map",width=150,height=150)
      )
    )

server.R

observeEvent(input$go2,{
screenshot(
  selector = "body",filename = "shinyscreenshot11",scale = 1,timer = 1
)})

 output$map <- renderLeaflet({
  leaflet() %>% 
  addTiles() %>% 
  setView(127.68110377512068,36.35494189163784,zoom = 6)%>% 
  addpolygons(data=data_map,color = 'black',weight = 1,stroke = T,fillOpacity = 0.5,label = vec_label,layerId =  ~ CTPRVN_CD,#popup = vec_popup,#popupOptions = popupOptions(maxWidth ="100%",cloSEOnClick = TRUE),fillColor = ~pal_SIG_CD(CTPRVN_CD),highlight = highlightOptions(
                weight = 2.5))%>%
  addMinicharts(
    mydata$lng,mydata$Lat,type = "bar",chartdata = mydata$VALUE,width = 20,height = 45
)})

global.R

library(shiny)
library(shinydashboard)
library(shinyjs)
library(shinyscreenshot)
library(leaflet) 
library(leaflet.minicharts)

setwd("C:/Users/khoh/Desktop/R/nosaDataVisualization")
data_map<-shapefile("./CTPRVN_202101/TL_SCCO_CTPRVN.shp")
data_map = spTransform(data_map,CRSobj = CRS('+proj=longlat +datum=wgs84'))

test=read_excel("./test.xlsx")
mydata=as.data.frame(test)
mydata$Lat <- as.numeric(mydata$Lat)
mydata$lng <- as.numeric(mydata$lng)

截图结果:

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)