Is there a sample code similar to that for pie charts in this thread, that
would show how to build JSON data for a vertical bar chart?
I'm currently using a version with hard coded data that works fine, but
would like to read the data from a mysql database using a JSON formatted
data table. Any example of how to generate that JSON table for a bar chart
would be much appreciated.
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Strategy', 'Cumulative Percentage Returns'],
['Core', 229 ],
['S&P 500', 77 ]
]);
var options = {
'backgroundColor':'#f2f9f6',
'width':300,
'height':300,
'legend': {position: 'none'},
'colors': ['blue'],
'vAxis': {baselineColor:'blue', baseline:0, gridlines: {count:-1},
textStyle: {color:'red', bold:'true'} },
'hAxis': {textStyle: {fontName:'Trebuchet MS', fontSize:10,
color:'black', bold:'true'} },
'fontName':'Trebuchet MS'
};
var chart = new
google.visualization.ColumnChart(document.getElementById('core_chart_cumulReturns'));
chart.draw(data, options);
}
</script>
On Tuesday, July 26, 2011 12:24:36 PM UTC-7, GerBen wrote:
> Hello Colleagues,
> How can I read data from an external database (say, MS SQL Server or
> MySQL) and show it in a Google Chart?
> Thank you.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.