如何将百分比信息添加到highcarter treemap工具提示?
我尝试将{point.percentage:.0f}添加到hc_tooltip,但它无效。
require(treemap)
require(highcharter)
data("GNI2014")
tm <- treemap(
GNI2014,
index = c("continent", "iso3"),
vSize = "population",
vColor = "GNI",
type = "value"
)
hctreemap(tm = tm) %>%
hc_tooltip(
pointFormat = "<b>{point.name}</b><br> {point.value:.0f} <br>{point.percentage:.0f}")
答案 0 :(得分:1)
以下是使用tooltip.pointFormatter
函数在 JS 中执行此操作的示例:http://jsfiddle.net/kkulig/chdn4r0d/
可以在 Highcharter 中完成,如下所示:
hc_tooltip(pointFormatter = JS("function(){/* function body goes here*/}")