树形图在闪亮的情况下运行良好,但当我转换为shinydashboard时,树形图停止工作。它现在只显示一个空白块。任何想法如何解决这个问题?
这是我的服务器.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"))))
答案 0 :(得分:1)
您只需使用 renderHighchart
和 highchartOutput
,而不是renderHighchart2
和highchartOutput2
。因为你需要热图填充(renderHighchart2
不需要)
答案 1 :(得分:0)
问题是我在脚本中也有renderHighchart2
和highchartOutput2
。我将它们全部更改为renderHighchart
和highchartOutput
现在一切正常。因此,出于某种原因,你不能在你的剧本中同时拥有这两者,我可能不知道。