Understood, I thought it'd be more complicated somehow. Got it to work fine 
thank you very much. Is there a way to automatically show values on the 
bars of bar charts (or on top of the bars), just like in the slices of pie 
charts? Seems like a basic function but can't find that option.

On Wednesday, October 9, 2013 5:10:35 AM UTC-7, asgallant wrote:

> The JSON format is for the DataTable, not the chart - the chart doesn't 
> care how you got the data into the DataTable.  In other words, you don't 
> have to do anything different when constructing the JSON string for a 
> DataTable for a ColumnChart (vertical bar chart) than for a PieChart.
>
> On Wednesday, October 9, 2013 12:49:37 AM UTC-4, Patrick Beaudan wrote:
>>
>> 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.

Reply via email to