Skip to content

Instantly share code, notes, and snippets.

@daohodac
Created January 16, 2015 15:39
Show Gist options
  • Save daohodac/2509fc371e756bac19f4 to your computer and use it in GitHub Desktop.
Save daohodac/2509fc371e756bac19f4 to your computer and use it in GitHub Desktop.
fleet-matrix example
//on récupere les A380 uniquement parmi les fwots
var a380s = _. where(FWOTS, {type: "A380"});
//on rajoute les colonnes et on les décrit
var columns = [
{ name: "SD-01",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "1"}).length;
}
},
{ name: "SD-13",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "13"}).length;
}
},
{ name: "SD-15",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "15"}).length;
}
},
{ name: "SD-16",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "16"}).length;
}
},
{ name: "SD-21",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "21"}).length;
}
},
{ name: "SD-100",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "100"}).length;
}
},
{ name: "SD-102",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "102"}).length;
}
},
{ name: "SD-103",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "103"}).length;
}
},
{ name: "SD-104",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "104"}).length;
}
},
{ name: "SD-107",
domain: [0,10],
colors: ['black', 'darkorange'],
formula: function(data) {
return _.where(data,{APUSDID: "107"}).length;
}
},
{ name: "FF max",
domain: [600,1000],
colors: ['black', 'lime'],
formula: function(data) {
return _.pluck(data,'APUFF').max();
},
text: function(val) {return val.toFixed(0);}
},
{ name: "IDLE EGT HI",
domain: [640,720],
colors: ['black', 'lime'],
formula: function(data) {
return _.pluck(data,'I_APUEGT').max();
},
text: function(val) {return val.toFixed(0);}
},
];
//on draw la matrice et on spécifie les parameters à récupérer
matrix_anim.init(a380s, columns, ["APUSDID", "APUFF", "I_APUEGT"], 700, 400);
//on lance les calculs
matrix_anim.updateMatrix(30, 'months', '2013-11-30T00:00:00');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment