Search code examples
javascriptrhighchartstreemap

highcharter convert value to percent in tooltip


I've made a treemap in high charter and I want to print the value multiplied by 100 and add a percentage symbol on the end. I currently have this code that produces the image below

hchart(dout, type = "treemap")%>%
  hc_tooltip(pointFormat = "<b>{point.name}</b>:<br>
                             value: {point.value:.3f}%<br>")

treemap tooltip

I'm thinking I need a JS function to multiply {point.value:.3f} by 100

I've been trying to hack together something based on this post but I just don't understand how higcharter or JS work enough to get it. I'm not even sure a JS function is the right way to handle it?


Solution

  • Because I don't understand how to integrate the examples provided for me using JS I decided to attack this problem differently and I just added a line earlier in my code to convert the value in the df dout that I am printing out as point.value in the tooltip, by 100 before it gets to the hchart() function. No change is necessary to the example code I posted initially