Highcharter 树状图未在 shinydashboard 中呈现

Highcharter treemap not rendering in shinydashboard

树形图在 shinydashboard 中工作正常,但当我转换为 shinydashboard 时,树形图停止工作。它现在只显示一个空白块。有什么解决办法吗?

这是我的server.R

  output$TreeMap<-renderHighchart2({TM1<-hctreemap2(data = M,
                                                    group_vars = c("Status","Class","Order", "Family","Species"),
                                                    size_var = "n",
                                                    color_var = "n",
                                                    layoutAlgorithm = "squarified",
                                                    levelIsConstant = T,
                                                    levels = list(
                                                      list(level = 1, dataLabels = list(enabled = T)),
                                                      list(level = 2, dataLabels = list(enabled = F)),
                                                      list(level = 3, dataLabels = list(enabled = F)),
                                                      list(level = 4, dataLabels = list(enabled = F)),
                                                      list(level = 5, dataLabels = list(enabled = F))
                                                    )) %>% 
    hc_colorAxis(minColor = brewer.pal(9, "GnBu")[6],
                 maxColor = brewer.pal(9, "YlOrRd")[8]) %>% 
    hc_tooltip(pointFormat = "<b>{point.name}</b>:<br>
               Number Measured: {point.value:,.0f}")
  })

这是我的 ui.R

tabItem(tabName = "About",
            tabsetPanel(
              tabPanel("TreeMap",box(width = 12,highchartOutput2("TreeMap",height = "750px"))))

您只需要使用 renderHighcharthighchartOutput 而不是 renderHighchart2highchartOutput2。因为您需要热图拼接(renderHighchart2 不需要)

问题是我在 script.I 中也有 renderHighchart2highchartOutput2 将它们全部更改为 renderHighcharthighchartOutput 现在一切都恢复正常了。所以,出于某种原因,你不能在你的脚本中同时拥有这两个,可能,我不知道。