Hi! I'd like to use google drawVisualization API. Example:
var data = new google.visualization.DataTable();
data.addColumn('string');
data.addColumn('number');
data.addRows([
['a', 14],
['b', 47],
['c', 80],
['d', 55],
['e', 16],
['f', 90],
['g', 29],
['h', 23],
['i', 58],
['j', 48]
]);
My version gets elements by an other google api, and join them, and after place the variable between ([
and ])
, to be like in the example.
var outputGraph = [];
for (var i = 0, entry; entry = entries[i]; ++i) {
var asd = [
entry.getValueOf('ga:pageTitle'),
entry.getValueOf('ga:pageviews')
].join("',");
outputGraph.push(" ['" + asd + "]");
//get the 2 elements and join them to be like ['asd', 2],
}
// this is fine, the outputgraph is like ['asd', 2], ['asd', 2], ['asd', 2] as seen in the example
var outputGraphFine = ("(["+outputGraph+"])");
// i suggest this is which fails the script.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows = outputGraphFine;
But it doesn't work. Why?