【发布时间】:2014-12-11 02:16:00
【问题描述】:
我正在尝试自定义 rCharts nvd3 饼图的工具提示,但是当我使用下面的代码时,图表不会呈现。我想知道为 nvd3 饼图调整工具提示的工作方式是否与其他 nvd3 图表不同?任何见解将不胜感激!
这是我运行的代码:
pie.sum$CATEGORY = c('Cat1','Cat2','Cat3','Cat4')
pie.sum$VALUE = c(124,55,275,20)
pie.sum$PERCENT = round((pie.sum$VALUE/sum(pie.sum$VALUE)) * 100,2)
n3 = nPlot(x = "CATEGORY", y = "VALUE", data = pie.sum, type = "pieChart")
n3$chart(tooltipYContent = NA, tooltipYContent = NA)
n3$chart(tooltipContent = "#! function(key, x, y, e){
return 'Category: ' + x +
'
Value' + y +
'
% of value: ' + e.point.PERCENT
} !#")
n3$set(width = 800, height = 500) # mk changed width to 800 and height to 500
n3
【问题讨论】: