Google Visualization Column Chart - How to make labels as currency

danilo001

New Member
I'm just trying to figure out to format my labels to be shown as a currency and not just a number:\[code\]echo ' <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = http://stackoverflow.com/questions/3551853/new google.visualization.DataTable(); data.addColumn("string", "ZipCode"); data.addColumn("number", "Sales"); data.addRows('.$count.');';$i = 0;foreach ($results as $r) { $p = (($r->report_trans_amount / $total) * 100); $pd = strval(number_format($p, 1)); echo ' data.setValue(' . $i . ', 0, "' . $r->member_address_zip_code . ' - ' . $pd . '%");'; echo ' data.setValue(' . $i . ', 1, ' . $r->report_trans_amount . ');'; $i++;}echo ' var chart = new google.visualization.PieChart( document.getElementById("chart_div")); chart.draw(data, {width:900, height:500, is3D:true}); } </script> <div id="chart_div"></div>';\[/code\]I would like the Sales column to be shown as a USD currency value. How can I do that? I see how to do it using the URL request, but that does not help this situation.I just can't seem to find any good example on this.
 
Back
Top