So I'm trying to create a google pie chart from an array of objects.
Here is an example:
{title: "Robert Olson - Debate Paper 2017-18 - 489494 - Google Docs", url:
"https://docs.google.com/document/d/16P-9H6iJPj4LHEJW3SVAc_k7Q6T8zCPLJCTCLwL9DqQ/edit",
time: 42.812, seconds: " 43s"}
whenever i make a column from the time key/value pair, the chart appears
and works fine. Like this:
data.addColumn('number', 'Time');
However when I used the seconds, the chart doesn't show. Any help would be
appreciated.
Here is my code:
google.charts.load('current', {'packages':['corechart', 'timeline']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
// Create the data table
var data = new google.visualization.DataTable();
data.addColumn('string', 'Title');
data.addColumn('string', 'Time');
for(var i=0;i<sitesData.length;i+=1){
data.addRow([sitesData[i].title, sitesData[i].seconds]);
}
// Set chart options
var options = {'title':'What links I looked At',
'width':1000,
'height':600,
pieHole: 0.3
};
// Instantiate and draw our chart, passing in some options.
var chart = new
google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
--
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 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/fd33fa08-9fc0-48f8-babf-32f935fabafc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.