Voila, je suis actuellement en train de vouloir créer des graph's pour un apps internet avec google api. mais j'arrive pas a faire ce qui est demandé. Mon code ne passe pas
Code HTML :
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {'packages':['imagepiechart','piechart']});
Code Javascript :
var Action = {
tableau: [],
Traitement: function(transport,json){
Action.tableau.sexe = json.sexe;
Action.Graphisme.Sexe();
},
Graphisme: {
Sexe: function(){
tableau = Action.tableau.sexe;
var total = 0;
for(i=0;i<tableau.length;i++){
total += parseFloat(tableau[i].total);
}
var data = new google.visualization.DataTable();
data.addColumn('string', 'Sexe');
data.addColumn('number', 'Nombre de personne');
data.addRows(tableau.length);
for(i=0;i<tableau.length;i++){
pourcentage = Action.arrondir((parseFloat(tableau[i].total)*100)/total,2);
nom = tableau[i].nom+" "+parseFloat(tableau[i].total)+" ("+pourcentage+" %)";
nombre = parseFloat(tableau[i].total);
data.setValue(i, 0, nom);
data.setValue(i, 1, nombre);
}
var chart = new google.visualization.PieChart(document.getElementById('visusexe'));
chart.draw(data, {width: 400, height: 240, is3D: true, title: 'Sexe'});
}
}
};
Je n'arrive pas a comprendre pourquoi ImagePieChart peut passer mais pas PieChart
Bien entendu, la div existe bien...