datastorm-open / rAmCharts

API for Amcharts
48 stars 16 forks source link

How to display percentage in amFunnel chart? #60

Closed ThoDuyNguyen closed 7 years ago

ThoDuyNguyen commented 7 years ago

Is there any proper method to display the percentage along side with the numeric value?

My current approach is to calculate the percentage and append them to description column.

TitouanRobert commented 7 years ago

Hi,

You can use amFunnelChart function :

data('data_funnel')

Plot

g1 <- amFunnelChart(dataProvider = data_funnel, startDuration = 0, labelPosition = 'left', marginLeft = 200, marginRight = 100, titleField = 'description', valueField = 'value', balloonText = "[[title]]
[[value]] : [[percents]] %", labelText = "[[title]]: [[value]]
[[percents]] %") g1

You can also modify object render by amFunnel :

data('data_funnel') g2 <-amFunnel(data_funnel) g2@otherProperties$balloonText <- "[[title]]
[[value]] : [[percents]] %" g2@otherProperties$labelText <- "[[title]]: [[value]]
[[percents]] %" g2

Regards, Titouan

ThoDuyNguyen commented 7 years ago

That would be a nice solution.

Thank you for the help.