我正在尝试使用Rmarkdown在R中准备一个 Jmeter 板。我使用下面的代码在 Jmeter 板中显示饼图,但是我如何显示总数和百分比
hc <- df %>% hchart( "pie", hcaes(x = name, y = count)) hc
我的输出只是一个有名称的饼图,但没有数字或百分比。我想要输出像这样东西
谢谢你的帮助。
wlp8pajw1#
使用tooltip.pointFormat(或tooltip.format、tooltip.formatter)和dataLabels.format(或dataLabels.formatter)。在这种情况下:
tooltip.pointFormat
tooltip.format
tooltip.formatter
dataLabels.format
dataLabels.formatter
hc_tooltip(pointFormat= "{series.name}: <br>{point.percentage:.1f} %<br>total: {point.total}"),
API参考:https://api.highcharts.com/highcharts/tooltip.pointFormat
hc_plotOptions(series = list( dataLabels = list(format = "<b>{point.name}</b>:<br>{point.percentage:.1f} %<br>total: {point.total}") ))
API引用:https://api.highcharts.com/highcharts/plotOptions.series.dataLabels.formatJS演示版:http://jsfiddle.net/BlackLabel/sry5mvzh/
1条答案
按热度按时间wlp8pajw1#
使用
tooltip.pointFormat
(或tooltip.format
、tooltip.formatter
)和dataLabels.format
(或dataLabels.formatter
)。在这种情况下:API参考:https://api.highcharts.com/highcharts/tooltip.pointFormat
API引用:https://api.highcharts.com/highcharts/plotOptions.series.dataLabels.format
JS演示版:http://jsfiddle.net/BlackLabel/sry5mvzh/