views:

30

answers:

0

I'm just trying to figure out to format my labels to be shown as a currency and not just a number:

` echo ' google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = 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>
';`

I would like the Sales column to be shown as a USD currency value. 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.

Thank a bunch if you know how.