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 81 82 83 84 85 86 87 88 89 90 91 92
| var dataset = {
"result" : [
[
{
"type" : "ServerMethodsUnit.TRecord",
"id" : 1,
"fields" : {
"T1" : "9",
"T2" : "200",
"T3" : "15",
"T4" : "200",
"TT" : "19,7999992370605",
"TA" : "32,9000015258789",
"PP" : "0",
"DATE": "28/08/2013 15:04:37"
}
},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"4","T2":"153","T3":"8","T4":"157","TT":"20,2999992370605","TA":"23,1000003814697","PP":"0","DATE":"29/08/2013 18:06:51"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"13","T4":"200","TT":"19,7999992370605","TA":"32,0999984741211","PP":"0","DATE":"30/08/2013 15:08:17"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"10","T4":"200","TT":"19,8999996185303","TA":"36","PP":"0","DATE":"31/08/2013 15:11:56"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"7","T2":"200","T3":"13","T4":"200","TT":"20,2000007629395","TA":"38,5999984741211","PP":"0","DATE":"01/09/2013 15:09:10"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"10","T2":"200","T3":"16","T4":"200","TT":"19,7999992370605","TA":"38,5999984741211","PP":"0","DATE":"02/09/2013 15:11:09"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"23","T2":"200","T3":"29","T4":"200","TT":"20,5","TA":"45,7999992370605","PP":"0","DATE":"04/09/2013 15:03:29"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"25","T4":"200","TT":"21","TA":"39,2000007629395","PP":"0","DATE":"05/09/2013 15:02:25"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"11","T4":"200","TT":"18,6000003814697","TA":"31,5","PP":"0","DATE":"08/09/2013 15:02:19"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"198","T3":"10","T4":"199","TT":"19,2000007629395","TA":"31,2000007629395","PP":"0","DATE":"10/09/2013 15:16:29"}}
],
[
{
"type" : "ServerMethodsUnit.TRecord",
"id" : 1,
"fields" : {
"T1" : "9",
"T2" : "200",
"T3" : "15",
"T4" : "200",
"TT" : "19,7999992370605",
"TA" : "32,9000015258789",
"PP" : "0",
"DATE": "28/08/2013 15:04:37"
}
},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"4","T2":"153","T3":"8","T4":"157","TT":"20,2999992370605","TA":"23,1000003814697","PP":"0","DATE":"29/08/2013 18:06:51"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"13","T4":"200","TT":"19,7999992370605","TA":"32,0999984741211","PP":"0","DATE":"30/08/2013 15:08:17"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"10","T4":"200","TT":"19,8999996185303","TA":"36","PP":"0","DATE":"31/08/2013 15:11:56"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"7","T2":"200","T3":"13","T4":"200","TT":"20,2000007629395","TA":"38,5999984741211","PP":"0","DATE":"01/09/2013 15:09:10"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"10","T2":"200","T3":"16","T4":"200","TT":"19,7999992370605","TA":"38,5999984741211","PP":"0","DATE":"02/09/2013 15:11:09"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"23","T2":"200","T3":"29","T4":"200","TT":"20,5","TA":"45,7999992370605","PP":"0","DATE":"04/09/2013 15:03:29"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"25","T4":"200","TT":"21","TA":"39,2000007629395","PP":"0","DATE":"05/09/2013 15:02:25"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"200","T3":"11","T4":"200","TT":"18,6000003814697","TA":"31,5","PP":"0","DATE":"08/09/2013 15:02:19"}},
{"type":"ServerMethodsUnit.TRecord","id":1,"fields":{"T1":"6","T2":"198","T3":"10","T4":"199","TT":"19,2000007629395","TA":"31,2000007629395","PP":"0","DATE":"10/09/2013 15:16:29"}}
]
]
};
var dates = [],
T1 = [],
T2 = [];
for ( var n in dataset[ "result" ] ){
// initialiser pour un nouveau graphique
dates = [];
T1 = [];
T2 = [];
for (var m in dataset[ "result" ][ n ] ){
$.each( dataset[ "result" ][ n ][ m ], function( i, item ){
if ( i === "fields" ){
$.each( item, function( name, value ){
switch( name ){
case "DATE" :
dates.push( value );
break;
case "T1" :
T1.push( parseInt( value, 10 ) );
break;
case "T2" :
T2.push( parseInt( value, 10 ) );
break;
};
});
}
});
}
// données pour un graphique
console.log( "dates = ", dates.join() );
console.log( "Ti = ", T1.join() );
console.log( "T2 = ", T2.join() );
} |
Partager