0
我試圖自定義rCharts nvd3餅圖的工具提示,但是當我使用下面的代碼時,圖表不顯示。我想知道是否調整nvd3餅圖工具提示的工作方式與其他nvd3圖表不同?任何有識之士將不勝感激!rCharts餅圖 - 自定義工具頂部
這裏是我跑的代碼:
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
真正有用的評論。 我相信有一個小錯誤,文字表明它應該是y =「VALUE」而不是y =「PERCENT」 – 2015-03-10 15:30:04
謝謝,確實有一個錯誤我編輯了我的答案。 – Victorp 2015-03-11 18:24:57