Je souhaite utiliser google drawVisualization API. Exemple:Les lignes de données de jquery google visual api graphique ne fonctionnent pas
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]
]);
Ma version reçoit des éléments par un autre google api, et se joindre à eux, et après la variable lieu entre ([
et ])
, d'être comme dans l'exemple.
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;
Mais cela ne fonctionne pas. Pourquoi?
'data.addRows ([['a', 148], ['b', 47], ['c', 80], ['d', 55], ['e', 16], [ 'f', 90], ['g', 29], ['h', 23], ['i', 58], ['j', 48]]) 'est également bon. 'eval()' ne fonctionne pas. :( –