0

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"))))
Allie
  • 105
  • 9

2 Answers2

1

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

jbkunst
  • 3,009
  • 1
  • 22
  • 28
  • When I built the example, it worked. But it still won't work in my original code. Thank you for the help, I will have to go through my code to see what is causing the treemap not to render. – Allie Oct 12 '17 at 18:52
0

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.

Allie
  • 105
  • 9