I have loads of big data that I pull from a database into an array where I 
really need commas for usability. So, in SQL I Format the numbers and 
they're really nice (e.g. 21,876,987,000). However, when I use them in 
Google Charts, the charts break. So to make Google Charts happy I remove 
the Format in SQL and display raw numbers. 

What a dilemma. Usability of both would be splendid.

Any idea of what line(s) to add and where, so I can utilize my properly 
formatted numbers from my SQL??


Below is my current chart code.


<script type="text/javascript">
google.charts.load('current', {packages: ['corechart'],
callback: drawChart});

function drawChart() {
var tableRows = [];
var results = document.getElementById('allstage');
Array.prototype.forEach.call(results.rows, function(row) {
var tableColumns = [];
Array.prototype.forEach.call(row.cells, function(cell) {
var cellText = cell.textContent || cell.innerText;
switch (cell.cellIndex) {
case 0:
tableColumns.push(cellText.trim());
break;

default:
switch (row.rowIndex) {
case 0:
tableColumns.push(cellText.trim());
break;

default:
tableColumns.push(parseFloat(cellText));
    }
  }
});
tableRows.push(tableColumns);
});

var data = google.visualization.arrayToDataTable(tableRows);
var formatter = new google.visualization.NumberFormat(
     {negativeColor: 'red', negativeParens: true, pattern: '###,###'});
    formatter.format(data, 1);       

var options = {

title: 'All Stages In Percent', 
titleTextStyle: {color: 'black', fontSize: 28},
 bar: {groupWidth: '70%'},
    chartArea: { backgroundColor: { fill: '#F0F8FC', opacity: 100 }},
    fontSize:12,
    legend:  { position: 'right', textStyle: { color: 'black', fontSize: 12}},
     tooltip: {isHtml: true},
      is3D: true,
    };

var chart = new 
google.visualization.PieChart(document.getElementById('allstage_div'));


chart.draw(data, options);
        }
</script> 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/8298ab79-82c7-4be6-9a99-c0ae42738f37%40googlegroups.com.

Reply via email to