1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
$(document).ready(function(){
$('#bt_showGraph').click(function() {
drawChart();
return false;
});
});
function drawChart()
{
alert( $("#endItem").val());
s1 = [$("#totalValue0").html(), $("#totalValue1").html(), $("#totalValue2").html(), $("#totalValue3").html()
, $("#totalValue4").html() , $("#totalValue5").html() , $("#totalValue6").html() , $("#totalValue7").html()
,$("#totalValue8").html(), $("#totalValue9").html() , 0 , 0,
50, 45, 20, 8, 15, 19, 78];
//s1 fonctionne tel quel donc il récupère bien les données comme celà
var graphValue = new Array($("#endItem").val()-1);
for(i=0;i<$("#endItem").val();i++)
{
graphValue[i]=$("#totalValue"+i).html();
}
//qd je fais un alert du tableau graphValue j'obtiens un résultat qui semble correct
//mais si j'utilise le tableau graphValue ça ne fontionne pas (voir erreur plus //bas)
s1Bis = ["40"];
for(i=0;i<20;i++)
{
s1Bis.push($("#totalValue"+i).html()+"");
}
alert(s1Bis);
//alors ici ça semble bon aussi via alert mais ça ne fonctionne pas
// Par contre c'est très curieux mais si
// mon for va de 0 a 5 là ça fonctionne :s
//s1 = s1Bis;
ticks = ['01','02','03','04','05','06','07','08','09','10',
'11','12','13','14','15','16','17','18','19','20'
,'21','22','23','24','25','26','27','28','29','30'];
plot1 = $.jqplot('chart1', [s1], {
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
pointLabels: { show: true }
},
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: ticks
}
},
highlighter: { show: false }
});
$('#chart1').bind('jqplotDataClick',
function (ev, seriesIndex, pointIndex, data) {
$('#info1').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
}
);
$(document).unload(function() {$('*').unbind(); });
} |
Partager