Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding currency prefix to AmCharts

Hello fellow programmers .. Im struggling adding a $ prefix to Amcharts Has anyone had any experience adding currency format to AmCharts graphs? So far I have tried many variations around the following with no success...

chart.numberFormatter = {
numberFormatter = numberPrefix="$";
};
like image 883
leo Avatar asked Mar 12 '14 17:03

leo


2 Answers

For AmCharts v4 you can add a dollar sign using this:

chart.numberFormatter.numberFormat = '$#,###';

https://www.amcharts.com/docs/v4/concepts/formatters/formatting-numbers/

like image 107
chelsea Avatar answered Nov 09 '22 00:11

chelsea


To add a prefix to value axis:

valueAxis.unit = "$";
valueAxis.unitPosition = "left";

In case you need this in a balloon, add it to balloonText:

graph.balloonText = "$[[value]]";
like image 34
zeroin Avatar answered Nov 09 '22 00:11

zeroin