在amCharts的Stacked Bar图表中添加自定义文本标签

时间:2018-03-22 13:34:46

标签: r amcharts

我试图使用 R实现的amCharts 来调整Stacked Horizo​​ntal Bar图表的Text-label。以下是我的代码:

Fn

我希望将文本标签显示为https://www.amcharts.com/demos/stacked-bar-chart/,但是与'%'连接(与此处的自定义函数labelTextFunction一样)。

我希望有一个像with open("textfile.txt") as f: content = f.readlines() for line in content: # Get all variable-length spaces down to two. Then use two spaces as the delimiter. while line.replace(" ", " ") != line: line = line.replace(" ", " ") # The strip is optional here. data = line.strip().split(" ") print(data) 这样的函数可以实现上述计划,但没有成功。

任何人都可以指导我如何使用amCharts的R实现来实现相同的目标。

谢谢,

1 个答案:

答案 0 :(得分:1)

阐述我的评论,这是对所有图形元素的一种方式:

P@graphs <- lapply(P@graphs, FUN = function(x) {
  c(x, "labelText" = "[[value]]%")
})

enter image description here