Highcharter树形图能显示百分比吗?

问题描述 投票:-1回答:1

如何将百分比信息添加到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}")

enter image description here

javascript r highcharts
1个回答
1
投票

以下是使用tooltip.pointFormatter函数在JS中执行此操作的示例:http://jsfiddle.net/kkulig/chdn4r0d/

它可以在Highcharter中完成,如下所示:

hc_tooltip(pointFormatter = JS("function(){/* function body goes here*/}")
© www.soinside.com 2019 - 2024. All rights reserved.