Removing the quotes around the numbers in the json output solved my issue. 
For some reason this wasn't an issue in most other charts. 

http://stackoverflow.com/questions/40003247/google-charts-api-pie-chart-not-displaying

On Wednesday, October 12, 2016 at 8:53:24 AM UTC-7, Matthew Poletiek wrote:
>
> Hello,
>
> Trying to get visualizations.PieChart working, but its drawing a blank 
> white box with a title even though there is data. Here is my code.
>
> <div id="globalramdonut" class="globalramdonut"></div>
>
>
> google.charts.load('current', 
> {'packages':['corechart','gauge','line','controls','geochart']});
> google.charts.setOnLoadCallback(drawAllCharts);
>
> var ramdonutdata;
> function setramdonutdata(){
> var query = "SELECT Location, SUM(RAMCapacityGB) AS 'RAM Capacity GB' FROM 
> clusterstat WHERE Date = (SELECT MAX(Date) FROM clusterstat) GROUP BY 
> Location ASC";
> //encode the query so we can submit it via URL.
> var urlencoded = encodeURI(sql2json+query);
> // get the data returned from 'urlencoded'
> var jsonData = $.ajax({
> url: urlencoded,
> dataType: "json",
> async: false
> }).responseText;
> console.log(urlencoded);
> // assign a google DataTable object 
> ramdonutdata = new google.visualization.DataTable(jsonData);
> }
>
> function drawRamDonut(){
> setramdonutdata();
> var options = {
> title: 'RAM Capacity by Location',
> pieHole: 0.4,
> sliceVisibilityThreshold: 0
> };
> var chart = new 
> google.visualization.PieChart(document.getElementById('globalramdonut'));
> chart.draw(ramdonutdata,options);
> }
>
> function drawAllCharts(){
> drawRamDonut();
> }
>
> Here is the data returned from my PHP script....
>
> {"cols":[{"label":"Location","type":"string"},{"label":"RAM Capacity 
> GB","type":"number"}],"rows":[{"c":[{"v":"Amsterdam"},{"v":"12286.34"}]},{"c":[{"v":"Argentina"},{"v":"383.97"}]},{"c":[{"v":"Belgium"},{"v":"8189.33"}]},{"c":[{"v":"Brazil"},{"v":"2047.59"}]},{"c":[{"v":"California"},{"v":"14523.22"}]},{"c":[{"v":"Guadalajara"},{"v":"767.90"}]},{"c":[{"v":"Hong
>  
> Kong"},{"v":"4351.54"}]},{"c":[{"v":"Massachusetts"},{"v":"3647.56"}]},{"c":[{"v":"Ontario"},{"v":"383.97"}]},{"c":[{"v":"Oregon"},{"v":"174896.81"}]},{"c":[{"v":"Shanghai"},{"v":"1279.90"}]},{"c":[{"v":"South
>  
> Korea"},{"v":"383.19"}]},{"c":[{"v":"Tennessee"},{"v":"3327.52"}]},{"c":[{"v":"Texas"},{"v":"1535.64"}]},{"c":[{"v":"Tokyo"},{"v":"719.64"}]},{"c":[{"v":"Virginia"},{"v":"44882.59"}]}]}
>
>
>
>
> Thanks for reading.
>

-- 
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 post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/ed9fdaba-662b-4c50-87f3-6f7ce16435d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to