简体   繁体   中英

Highcharter treemap not rendering in shinydashboard

The treemap was working fine in shiny but when I converted to shinydashboard the treemap stopped working. It just show a blank block now. Any ideas how to fix this?

This is in my 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}")
  })

This is in my ui.R

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

You just need to use renderHighchart and highchartOutput instead of renderHighchart2 and highchartOutput2 . Because you need heatmap pluing (and is not required by renderHighchart2 )

The problem was that I had renderHighchart2 and highchartOutput2 also in the script.I changed them all to renderHighchart and highchartOutput now everything works again. So, for some reason you can't have both in your script, possibly, I don't know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM