#14; Prototype du graphique du sexe (homme/femme) pour chaque communication

This commit is contained in:
xdrm-brackets 2016-05-22 15:20:49 +02:00
parent d5d6887a58
commit 1975587df3
7 changed files with 464 additions and 197 deletions

View File

@ -94,7 +94,7 @@
$db = new lightdb('phone_db', __ROOT__.'/src/dynamic/');
var_dump( array_keys($db->index()));
$db->close();
$req = new ModuleRequest('chart/communication_type', array( 'subject' => 273 ));
$req = new ModuleRequest('chart/sexe', array( 'subject' => 273 ));
$res = $req->dispatch();

View File

@ -120,6 +120,14 @@
"parameters": {
"subject": { "description": "Identifiant du sujet à étudier,", "type": "id" }
}
},
"sexe": {
"description": "Renvoie les données pour un graphique sur le sexe des contacts",
"permissions": ["admin"],
"parameters": {
"subject": { "description": "Identifiant du sujet à étudier,", "type": "id" }
}
}
},

View File

@ -1,83 +1,82 @@
{
"logs": [
{ "id":"1", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"2", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"3", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"4", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"5", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"6", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"7", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"8", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"9", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"10", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"11", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"12", "date":"2014-02-28T15:00:10", "duration":"125", "direction":"1", "type":"1" },
{ "id":"13", "date":"2014-02-15T23:06:46", "duration":"0", "direction":"0", "type":"1" },
{ "id":"14", "date":"2014-02-15T23:06:18", "duration":"0", "direction":"0", "type":"1" },
{ "id":"15", "date":"2014-02-15T21:08:34", "duration":"349", "direction":"1", "type":"1" },
{ "id":"16", "date":"2014-02-15T20:51:38", "duration":"0", "direction":"1", "type":"1" },
{ "id":"17", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"1", "type":"1" },
{ "id":"18", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"2", "type":"1" },
{ "id":"19", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"1", "type":"1" },
{ "id":"20", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"1", "type":"1" },
{ "id":"21", "date":"2014-02-15T17:24:18", "duration":"276", "direction":"1", "type":"1" },
{ "id":"22", "date":"2014-02-15T16:34:29", "duration":"36", "direction":"1", "type":"1" }
],
"logs": [
{ "id":"1", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"2", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"3", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"4", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"5", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"6", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"7", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"8", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"9", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"10", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"11", "date":"2014-05-28T14:43:25", "duration":"0", "direction":"0", "type":"0" },
{ "id":"12", "date":"2014-02-28T15:00:10", "duration":"125", "direction":"1", "type":"1" },
{ "id":"13", "date":"2014-02-15T23:06:46", "duration":"0", "direction":"0", "type":"1" },
{ "id":"14", "date":"2014-02-15T23:06:18", "duration":"0", "direction":"0", "type":"1" },
{ "id":"15", "date":"2014-02-15T21:08:34", "duration":"349", "direction":"1", "type":"1" },
{ "id":"16", "date":"2014-02-15T20:51:38", "duration":"0", "direction":"1", "type":"1" },
{ "id":"17", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"1", "type":"1" },
{ "id":"18", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"2", "type":"1" },
{ "id":"19", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"1", "type":"1" },
{ "id":"20", "date":"2014-02-15T19:06:33", "duration":"657", "direction":"1", "type":"1" },
{ "id":"21", "date":"2014-02-15T17:24:18", "duration":"276", "direction":"1", "type":"1" },
{ "id":"22", "date":"2014-02-15T16:34:29", "duration":"36", "direction":"1", "type":"1" }
],
"contacts": [
{ "id":"0", "number":"0102030405", "name":"", "sexe":"0", "age":"1", "studies1":"1", "reltype":"1", "dist":"0" },
{ "id":"1", "number":"0502030405", "name":"", "sexe":"0", "age":"1", "studies1":"1", "reltype":"1", "dist":"0" },
{ "id":"2", "number":"0502030561", "name":"", "sexe":"0", "age":"2", "studies1":"2", "reltype":"2", "dist":"1" },
{ "id":"3", "number":"0502030717", "name":"", "sexe":"0", "age":"3", "studies1":"3", "reltype":"3", "dist":"2" },
{ "id":"4", "number":"0502030873", "name":"", "sexe":"0", "age":"4", "studies1":"4", "reltype":"4", "dist":"3" },
{ "id":"5", "number":"0502031029", "name":"", "sexe":"0", "age":"5", "studies1":"5", "reltype":"5", "dist":"4" },
{ "id":"6", "number":"0502031185", "name":"", "sexe":"0", "age":"6", "studies1":"6", "reltype":"6", "dist":"5" },
{ "id":"7", "number":"0502031341", "name":"", "sexe":"0", "age":"7", "studies1":"7", "reltype":"7", "dist":"6" },
{ "id":"8", "number":"0502031497", "name":"", "sexe":"0", "age":"8", "studies1":"8", "reltype":"8", "dist":"7" },
{ "id":"9", "number":"0502031653", "name":"", "sexe":"0", "age":"9", "studies1":"9", "reltype":"9", "dist":"8" },
{ "id":"10", "number":"0502031809", "name":"", "sexe":"0", "age":"10", "studies1":"10", "reltype":"autretext", "dist":"9" },
{ "id":"11", "number":"0502031965", "name":"", "sexe":"0", "age":"11", "studies1":"11", "reltype":"11", "dist":"10" },
{ "id":"12", "number":"0502032121", "name":"", "sexe":"1", "age":"12", "studies1":"12", "reltype":"12", "dist":"11" },
{ "id":"13", "number":"0502032277", "name":"", "sexe":"1", "age":"13", "studies1":"13", "reltype":"13", "dist":"12" },
{ "id":"14", "number":"0502032433", "name":"", "sexe":"1", "age":"14", "studies1":"14", "reltype":"14", "dist":"13" },
{ "id":"15", "number":"0502032589", "name":"", "sexe":"1", "age":"15", "studies1":"15", "reltype":"15", "dist":"14" },
{ "id":"16", "number":"0502032745", "name":"", "sexe":"1", "age":"16", "studies1":"16", "reltype":"16", "dist":"15" },
{ "id":"17", "number":"0502032901", "name":"", "sexe":"1", "age":"17", "studies1":"17", "reltype":"17", "dist":"16" },
{ "id":"18", "number":"0502033057", "name":"", "sexe":"1", "age":"18", "studies1":"18", "reltype":"18", "dist":"17" },
{ "id":"19", "number":"0502033213", "name":"", "sexe":"1", "age":"19", "studies1":"19", "reltype":"19", "dist":"18" },
{ "id":"20", "number":"0502033369", "name":"", "sexe":"1", "age":"20", "studies1":"20", "reltype":"20", "dist":"19" },
{ "id":"21", "number":"0502033525", "name":"", "sexe":"1", "age":"21", "studies1":"21", "reltype":"21", "dist":"20" },
{ "id":"22", "number":"0502033681", "name":"", "sexe":"1", "age":"22", "studies1":"22", "reltype":"22", "dist":"21" },
"contacts": [
{ "id":"1", "number":"0502030405", "name":"", "sexe":"0", "age":"1", "studies1":"1", "reltype":"1", "dist":"0" },
{ "id":"2", "number":"0502030561", "name":"", "sexe":"0", "age":"2", "studies1":"2", "reltype":"2", "dist":"1" },
{ "id":"3", "number":"0502030717", "name":"", "sexe":"0", "age":"3", "studies1":"3", "reltype":"3", "dist":"2" },
{ "id":"4", "number":"0502030873", "name":"", "sexe":"0", "age":"4", "studies1":"4", "reltype":"4", "dist":"3" },
{ "id":"5", "number":"0502031029", "name":"", "sexe":"0", "age":"5", "studies1":"5", "reltype":"5", "dist":"4" },
{ "id":"6", "number":"0502031185", "name":"", "sexe":"0", "age":"6", "studies1":"6", "reltype":"6", "dist":"5" },
{ "id":"7", "number":"0502031341", "name":"", "sexe":"0", "age":"7", "studies1":"7", "reltype":"7", "dist":"6" },
{ "id":"8", "number":"0502031497", "name":"", "sexe":"0", "age":"8", "studies1":"8", "reltype":"8", "dist":"7" },
{ "id":"9", "number":"0502031653", "name":"", "sexe":"0", "age":"9", "studies1":"9", "reltype":"9", "dist":"8" },
{ "id":"10", "number":"0502031809", "name":"", "sexe":"0", "age":"10", "studies1":"10", "reltype":"autretext", "dist":"9" },
{ "id":"11", "number":"0502031965", "name":"", "sexe":"0", "age":"11", "studies1":"11", "reltype":"11", "dist":"10" },
{ "id":"12", "number":"0502032121", "name":"", "sexe":"1", "age":"12", "studies1":"12", "reltype":"12", "dist":"11" },
{ "id":"13", "number":"0502032277", "name":"", "sexe":"1", "age":"13", "studies1":"13", "reltype":"13", "dist":"12" },
{ "id":"14", "number":"0502032433", "name":"", "sexe":"1", "age":"14", "studies1":"14", "reltype":"14", "dist":"13" },
{ "id":"15", "number":"0502032589", "name":"", "sexe":"1", "age":"15", "studies1":"15", "reltype":"15", "dist":"14" },
{ "id":"16", "number":"0502032745", "name":"", "sexe":"1", "age":"16", "studies1":"16", "reltype":"16", "dist":"15" },
{ "id":"17", "number":"0502032901", "name":"", "sexe":"1", "age":"17", "studies1":"17", "reltype":"17", "dist":"16" },
{ "id":"18", "number":"0502033057", "name":"", "sexe":"1", "age":"18", "studies1":"18", "reltype":"18", "dist":"17" },
{ "id":"19", "number":"0502033213", "name":"", "sexe":"1", "age":"19", "studies1":"19", "reltype":"19", "dist":"18" },
{ "id":"20", "number":"0502033369", "name":"", "sexe":"1", "age":"20", "studies1":"20", "reltype":"20", "dist":"19" },
{ "id":"21", "number":"0502033525", "name":"", "sexe":"1", "age":"21", "studies1":"21", "reltype":"21", "dist":"20" },
{ "id":"22", "number":"0502033681", "name":"", "sexe":"1", "age":"22", "studies1":"22", "reltype":"22", "dist":"21" },
{ "id":"23", "number":"0606060606", "name":"", "sexe":"0", "age":".", "studies2":".", "reltype":"0", "dist":"0",
"job":"82",
"famsit":"1",
"city":"Toulouse",
"cp":"31000",
"duration":["2","5"],
"context":"11",
"contextExtra": ["facebook", "", ""],
"freq":["4","9","14","19","24"],
"connect":["1","3","5","7","9","11"],
"connectExtra":["",""]},
{ "id":"23", "number":"0606060606", "name":"", "sexe":"0", "age":".", "studies2":".", "reltype":"0", "dist":"0",
"job":"82",
"famsit":"1",
"city":"Toulouse",
"cp":"31000",
"duration":["2","5"],
"context":"11",
"contextExtra": ["facebook", "", ""],
"freq":["4","9","14","19","24"],
"connect":["1","3","5","7","9","11"],
"connectExtra":["",""]},
{ "id":"23", "number":"0606060606", "name":"", "sexe":"0", "age":".", "studies2":".", "reltype":"autretext", "dist":"0",
"job":"82",
"famsit":"1",
"city":"Toulouse",
"cp":"31000",
"duration":["2","5"],
"context":"10",
"contextExtra": ["", "", ""],
"freq":["4","9","14","19","24"],
"connect":["1","3","5","7","9","11"],
"connectExtra":["",""]}
],
{ "id":"23", "number":"0606060606", "name":"", "sexe":"0", "age":".", "studies2":".", "reltype":"autretext", "dist":"0",
"job":"82",
"famsit":"1",
"city":"Toulouse",
"cp":"31000",
"duration":["2","5"],
"context":"10",
"contextExtra": ["", "", ""],
"freq":["4","9","14","19","24"],
"connect":["1","3","5","7","9","11"],
"connectExtra":["",""]}
],
"relations": {
"0": ["1", "4", "6", "8"],
"5": ["cd 4", "5", "6"]
}
"relations": {
"0": ["1", "4", "6", "8"],
"5": ["cd 4", "5", "6"]
}

View File

@ -119,9 +119,8 @@
}else{
/* (1) On initialise les compteurs */
$MISSED = 0;
$OUTGOING = 0;
$INCOMING = 0;
$H = 0;
$F = 0;
}
@ -133,6 +132,73 @@
);
}
/* RETOURNE UN JEU DE DONNEES POUR LE SEXE DES CONTACTS
*
*/
public static function sexe($params){
extract($params);
$subject = intval($subject);
/* [1] On récupère les données de ce sujet
=========================================================*/
$db = new lightdb('phone_db', __ROOT__.'/src/dynamic/');
$data = $db->fetch($subject);
$db->close();
// Si erreur
if( $data === false )
return array( 'ModuleError' => ManagerError::ModuleError );
/* [2] S'il a un journal d'appel, on renvoie les données
=========================================================*/
if( isset($data['logs']) && is_array($data['logs']) ){
/* (1) On initialise les compteurs */
$H = 0;
$F = 0;
/* (2) On incrémente les compteurs */
foreach($data['logs'] as $log){
/* (3) On récupère le contact associé */
$associatedContact = null;
foreach($data['contacts'] as $contact)
if( $log['id'] == $contact['id'] )
$associatedContact = $contact;
// Si on ne trouve pas, on passe au suivant
if( is_null($associatedContact) )
continue;
/* (4) On incrémente les compteurs */
$H += ($associatedContact['sexe']==0) ? 1 : 0;
$F += ($associatedContact['sexe']==1) ? 1 : 0;
}
/* [3] Si aucun journal d'appel
=========================================================*/
}else{
/* (1) On initialise les compteurs */
$H = 0;
$F = 0;
}/* (1) On initialise les compteurs */
return array(
'ModuleError' => ManagerError::Success,
'labels' => array('HOMME', 'FEMME'),
'data' => array($H, $F)
);
}
}

View File

@ -1,147 +1,147 @@
{
"logs": {
"direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" },
"type": { "0": "PHONE", "1": "SMS" }
"logs": {
"direction": { "0": "INCOMING", "1": "OUTGOING", "2": "MISSED" },
"type": { "0": "PHONE", "1": "SMS" }
},
},
"contacts": {
"sexe": { "0":"Homme", "1":"Femme" },
"age": {
".": "NA",
"0": "5 à 10", "1": "10 à 15", "2": "15 à 20", "3": "20 à 25", "4": "25 à 30",
"5": "30 à 35", "6": "35 à 40", "7": "40 à 45", "8": "45 à 50", "9": "50 à 55",
"10": "55 à 60", "11": "60 à 65", "12": "65 à 70", "13": "70 à 75", "14": "75 à 80",
"15": "80 à 85", "16": "85 à 90", "17": "90 à 95", "18": "95 à 100"
},
"contacts": {
"sexe": { "0":"Homme", "1":"Femme" },
"age": {
".": "NA",
"0": "5 à 10", "1": "10 à 15", "2": "15 à 20", "3": "20 à 25", "4": "25 à 30",
"5": "30 à 35", "6": "35 à 40", "7": "40 à 45", "8": "45 à 50", "9": "50 à 55",
"10": "55 à 60", "11": "60 à 65", "12": "65 à 70", "13": "70 à 75", "14": "75 à 80",
"15": "80 à 85", "16": "85 à 90", "17": "90 à 95", "18": "95 à 100"
},
"studies1": {
".": "NA",
"0": "Inconnu",
"1": "< BAC",
"2": "BAC",
"3": "BAC+2",
"4": "BAC+3",
"5": "BAC+4 et plus"
},
"studies1": {
".": "NA",
"0": "Inconnu",
"1": "< BAC",
"2": "BAC",
"3": "BAC+2",
"4": "BAC+3",
"5": "BAC+4 et plus"
},
"studies2": {
".": "NA",
"0": "Inconnue",
"01": "Pas de scolarité",
"02": "Aucun diplôme mais scolarité jusqu'en école primaire ou au collège",
"03": "Aucun diplôme mais scolarité au-delà du collège",
"04": "Certificat d'études primaires (CEP)",
"05": "BEPC, brevet élémentaire, brevet des collèges",
"06": "Certificat d'aptitudes professionnelles (CAP), brevet de compagnon, y compris CAPA",
"07": "Brevet d'études professionnelles (BEP), y compris BEPA et diplômes agricoles (BAA, BPA) Diplômes sociaux (aide-soignante, auxiliaire de puériculture, travailleuse familiale)",
"08": "Baccalauréat général, brevet supérieur BAC ( L, ES, S ou A, B , C, D, D, E )",
"09": "Bac technologique ou professionnel, brevet professionnel ou de technicien BAC (STI, STL, SMS, STT ou F, G, H) BEC, BEI, BEH, capacité en droit Brevet de technicien agricole (BTA)",
"10": "Diplôme universitaire de 1er cycle BTS, DUT, DEUG Diplôme des professions sociales ou de santé, d'infirmier(ère) Diplôme universitaire propédeutique, DUEL, DUES, DEUG, PCEM",
"11": "Diplôme universitaire de 2ème ou 3ème cycle MASTER, DOCTORAT (y compris médecine, pharmacie, dentaire), Maîtrise, DEA, DESS, CAPES, CAPET, agrégation Diplôme d'ingénieur, d'une grande école, etc."
},
"studies2": {
".": "NA",
"0": "Inconnue",
"01": "Pas de scolarité",
"02": "Aucun diplôme mais scolarité jusqu'en école primaire ou au collège",
"03": "Aucun diplôme mais scolarité au-delà du collège",
"04": "Certificat d'études primaires (CEP)",
"05": "BEPC, brevet élémentaire, brevet des collèges",
"06": "Certificat d'aptitudes professionnelles (CAP), brevet de compagnon, y compris CAPA",
"07": "Brevet d'études professionnelles (BEP), y compris BEPA et diplômes agricoles (BAA, BPA) Diplômes sociaux (aide-soignante, auxiliaire de puériculture, travailleuse familiale)",
"08": "Baccalauréat général, brevet supérieur BAC ( L, ES, S ou A, B , C, D, D, E )",
"09": "Bac technologique ou professionnel, brevet professionnel ou de technicien BAC (STI, STL, SMS, STT ou F, G, H) BEC, BEI, BEH, capacité en droit Brevet de technicien agricole (BTA)",
"10": "Diplôme universitaire de 1er cycle BTS, DUT, DEUG Diplôme des professions sociales ou de santé, d'infirmier(ère) Diplôme universitaire propédeutique, DUEL, DUES, DEUG, PCEM",
"11": "Diplôme universitaire de 2ème ou 3ème cycle MASTER, DOCTORAT (y compris médecine, pharmacie, dentaire), Maîtrise, DEA, DESS, CAPES, CAPET, agrégation Diplôme d'ingénieur, d'une grande école, etc."
},
"job": {
".": "NA",
"10": "Agriculteurs exploitants (Agriculteurs, maraîchers, viticulteurs…)",
"21": "Artisans (Maçons, électriciens, couturiers, boulangers, garagistes, coiffeurs…)",
"22": "Commerçants et assimilés (Commerçants en détail ou en gros, buralistes, cafetiers, agents immobiliers…)",
"23": "Chefs d'entreprise de 10 salariés ou plus",
"31": "Professions libérales et assimilés (Médecins, avocats, notaires, architectes libéraux…)",
"32": "Cadres de la fonction publique, professions intellectuelles et artistiques (Personnels administratifs de catégorie A, professeurs de lenseignement secondaire ou supérieur, médecins hospitaliers, artistes…)",
"36": "Cadres d'entreprise (Cadres administratifs, cadres commerciaux, ingénieurs…)",
"41": "Professions intermédiaires de l'enseignement, de la santé, de la fonction publique et assimilés (Personnels administratifs de catégorie B, instituteurs, infirmiers, travailleurs sociaux…)",
"46": "Professions intermédiaires administratives et commerciales des entreprises (Comptables, chargés de clientèles…)",
"47": "Techniciens (Techniciens détudes, techniciens de contrôle, dessinateurs en bâtiment, géomètres…)",
"48": "Contremaîtres, agents de maîtrise (Conducteurs de travaux, chefs déquipe…)",
"51": "Employés de la fonction publique (Personnels de catégorie C, agents administratifs, agents de service…)",
"54": "Employés administratifs d'entreprise (Secrétaires, agents daccueil…)",
"55": "Employés de commerce (Vendeurs, caissiers…)",
"56": "Personnels des services directs aux particuliers (Serveurs, coiffeurs, assistantes maternelles…)",
"61": "Ouvriers qualifiés de type industriel ou artisanal (Mécaniciens, chauffeurs, cuisiniers…)",
"66": "Ouvriers non qualifiés de type industriel ou artisanal (Ouvrier de production, manœuvres…)",
"69": "Ouvriers agricoles (Bergers, ouvriers de la viticulture, bûcherons, ouvrier forestiers…)",
"71": "Anciens agriculteurs exploitants",
"72": "Anciens artisans, commerçants, chefs d'entreprise",
"73": "Anciens cadres",
"74": "Anciennes professions intermédiaires",
"75": "Anciens employés",
"76": "Anciens ouvriers",
"81": "Chômeurs n'ayant jamais travaillé",
"82": "Inactifs divers (autres que retraités)"
},
"job": {
".": "NA",
"10": "Agriculteurs exploitants (Agriculteurs, maraîchers, viticulteurs…)",
"21": "Artisans (Maçons, électriciens, couturiers, boulangers, garagistes, coiffeurs…)",
"22": "Commerçants et assimilés (Commerçants en détail ou en gros, buralistes, cafetiers, agents immobiliers…)",
"23": "Chefs d'entreprise de 10 salariés ou plus",
"31": "Professions libérales et assimilés (Médecins, avocats, notaires, architectes libéraux…)",
"32": "Cadres de la fonction publique, professions intellectuelles et artistiques (Personnels administratifs de catégorie A, professeurs de lenseignement secondaire ou supérieur, médecins hospitaliers, artistes…)",
"36": "Cadres d'entreprise (Cadres administratifs, cadres commerciaux, ingénieurs…)",
"41": "Professions intermédiaires de l'enseignement, de la santé, de la fonction publique et assimilés (Personnels administratifs de catégorie B, instituteurs, infirmiers, travailleurs sociaux…)",
"46": "Professions intermédiaires administratives et commerciales des entreprises (Comptables, chargés de clientèles…)",
"47": "Techniciens (Techniciens détudes, techniciens de contrôle, dessinateurs en bâtiment, géomètres…)",
"48": "Contremaîtres, agents de maîtrise (Conducteurs de travaux, chefs déquipe…)",
"51": "Employés de la fonction publique (Personnels de catégorie C, agents administratifs, agents de service…)",
"54": "Employés administratifs d'entreprise (Secrétaires, agents daccueil…)",
"55": "Employés de commerce (Vendeurs, caissiers…)",
"56": "Personnels des services directs aux particuliers (Serveurs, coiffeurs, assistantes maternelles…)",
"61": "Ouvriers qualifiés de type industriel ou artisanal (Mécaniciens, chauffeurs, cuisiniers…)",
"66": "Ouvriers non qualifiés de type industriel ou artisanal (Ouvrier de production, manœuvres…)",
"69": "Ouvriers agricoles (Bergers, ouvriers de la viticulture, bûcherons, ouvrier forestiers…)",
"71": "Anciens agriculteurs exploitants",
"72": "Anciens artisans, commerçants, chefs d'entreprise",
"73": "Anciens cadres",
"74": "Anciennes professions intermédiaires",
"75": "Anciens employés",
"76": "Anciens ouvriers",
"81": "Chômeurs n'ayant jamais travaillé",
"82": "Inactifs divers (autres que retraités)"
},
"context": {
"0": "De la même famille",
"1": "Grandi ensemble",
"2": "Par mon mari/ma femme/relation amoureuse",
"3": "Par mes parents",
"4": "Par mes enfants",
"5": "Par un ami",
"6": "Comme voisin",
"7": "Par dautres membres de la famille",
"8": "Etudes",
"9": "Etudes supérieures",
"10": "Au travail",
"11": "Internet",
"12": "Association",
"13": "Autre"
},
"context": {
"0": "De la même famille",
"1": "Grandi ensemble",
"2": "Par mon mari/ma femme/relation amoureuse",
"3": "Par mes parents",
"4": "Par mes enfants",
"5": "Par un ami",
"6": "Comme voisin",
"7": "Par dautres membres de la famille",
"8": "Etudes",
"9": "Etudes supérieures",
"10": "Au travail",
"11": "Internet",
"12": "Association",
"13": "Autre"
},
"famsit": {
"0": "Seul",
"1": "Seul avec enfant(s)",
"2": "En couple sans enfants",
"3": "En couple avec enfants"
},
"famsit": {
"0": "Seul",
"1": "Seul avec enfant(s)",
"2": "En couple sans enfants",
"3": "En couple avec enfants"
},
"reltype": {
"0": "Père, mère ou équivalent",
"1": "Frère ou soeur",
"2": "Autre membre de la famille",
"3": "Relation amoureuse",
"4": "Collègue",
"5": "Voisin",
"6": "Ami proche",
"7": "Ami",
"8": "Relation de service (médecin, ...)",
"9": "Inconnu"
},
"reltype": {
"0": "Père, mère ou équivalent",
"1": "Frère ou soeur",
"2": "Autre membre de la famille",
"3": "Relation amoureuse",
"4": "Collègue",
"5": "Voisin",
"6": "Ami proche",
"7": "Ami",
"8": "Relation de service (médecin, ...)",
"9": "Inconnu"
},
"dist": {
"0": "- de 5 minutes",
"1": "de 5 à 15 minutes",
"2": "de 15 à 60 minutes",
"3": "+ d'une heure"
},
"dist": {
"0": "- de 5 minutes",
"1": "de 5 à 15 minutes",
"2": "de 15 à 60 minutes",
"3": "+ d'une heure"
},
"freq": {
"0": "plusieurs fois par semaine",
"1": "1 fois par semaine",
"2": "1 fois par mois",
"3": "1 fois par an ou moins",
"4": "Jamais"
},
"freq": {
"0": "plusieurs fois par semaine",
"1": "1 fois par semaine",
"2": "1 fois par mois",
"3": "1 fois par an ou moins",
"4": "Jamais"
},
"connect": {
"0": "Oui",
"1": "Non"
}
"connect": {
"0": "Oui",
"1": "Non"
}
}
}
}

137
test-charts/all.php Normal file
View File

@ -0,0 +1,137 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Chart du sexe (HOMME/FEMME)</title>
<script type='text/javascript' src='/f/js/api-min/js/lib'></script> <!-- Gestion des transactions avec le serveur -->
<script type='text/javascript' src='/f/js/_charts-min/js/lib'></script>
</head>
<body style='display: flex; flex-direction: row; justify-content: space-around; flex-wrap: wrap;'>
<canvas id="direction" width="400" height="400"></canvas>
<canvas id="type" width="400" height="400"></canvas>
<canvas id="sexe" width="400" height="400"></canvas>
<script type='text/javascript'>
var api = new APIClass('/api/');
var direction = document.getElementById('direction');
var type = document.getElementById('type');
var sexe = document.getElementById('sexe');
/* [0] Paramètres globaux
=========================================================*/
Chart.defaults.global.responsive = false;
/* [1] On récupére les données SEXE
=========================================================*/
/* (1) On rédige la requête */
var request = {
path: 'chart/sexe',
subject: 273
}
/* (2) On lance la requête */
api.send(request, function(response){
/* (3) Si erreur, on quitte */
if( response.ModuleError != 0 )
return false;
/* [2] On construit les données
=========================================================*/
var data = {
labels: response.labels,
datasets: [{
data: response.data,
backgroundColor: [ "#FF6384", "#36A2EB" ],
hoverBackgroundColor: [ "#E65977", "#3090D1" ]
}]
}
/* [3] On construit notre graphique
=========================================================*/
var myDoughnutChart = new Chart(sexe, {
type: 'doughnut',
animation: { animateScale: true },
data: data
});
});
/* [2] On récupére les données DIRECTION
=========================================================*/
/* (1) On rédige la requête */
var request = {
path: 'chart/communication_direction',
subject: 273
}
/* (2) On lance la requête */
api.send(request, function(response){
/* (3) Si erreur, on quitte */
if( response.ModuleError != 0 )
return false;
/* [2] On construit les données
=========================================================*/
var data = {
labels: response.labels,
datasets: [{
data: response.data,
backgroundColor: [ "#FF6384", "#36A2EB", "#FFCE56" ],
hoverBackgroundColor: [ "#E65977", "#3090D1", "#E6B94D" ]
}]
}
/* [3] On construit notre graphique
=========================================================*/
var myDoughnutChart = new Chart(direction, {
type: 'doughnut',
animation: { animateScale: true },
data: data
});
});
/* [1] On récupére les données TYPE
=========================================================*/
/* (1) On rédige la requête */
var request = {
path: 'chart/communication_type',
subject: 273
}
/* (2) On lance la requête */
api.send(request, function(response){
/* (3) Si erreur, on quitte */
if( response.ModuleError != 0 )
return false;
/* [2] On construit les données
=========================================================*/
var data = {
labels: response.labels,
datasets: [{
data: response.data,
backgroundColor: [ "#FF6384", "#36A2EB" ],
hoverBackgroundColor: [ "#E65977", "#3090D1" ]
}]
}
/* [3] On construit notre graphique
=========================================================*/
var myDoughnutChart = new Chart(type, {
type: 'doughnut',
animation: { animateScale: true },
data: data
});
});
</script>
</body>
</html>

57
test-charts/sexe.php Normal file
View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Chart du sexe (HOMME/FEMME)</title>
<script type='text/javascript' src='/f/js/api-min/js/lib'></script> <!-- Gestion des transactions avec le serveur -->
<script type='text/javascript' src='/f/js/_charts-min/js/lib'></script>
</head>
<body>
<canvas id="container" width="400" height="400"></canvas>
<script type='text/javascript'>
var api = new APIClass('/api/');
var ctx = document.getElementById('container').getContext('2d');
/* [1] On récupére les données
=========================================================*/
/* (1) On rédige la requête */
var request = {
path: 'chart/sexe',
subject: 273
}
/* (2) On lance la requête */
api.send(request, function(response){
/* (3) Si erreur, on quitte */
if( response.ModuleError != 0 )
return false;
/* [2] On construit les données
=========================================================*/
var data = {
labels: response.labels,
datasets: [{
data: response.data,
backgroundColor: [ "#FF6384", "#36A2EB" ],
hoverBackgroundColor: [ "#E65977", "#3090D1" ]
}]
}
/* [3] On construit notre graphique
=========================================================*/
var myDoughnutChart = new Chart(ctx, {
type: 'doughnut',
animation: { animateScale: true },
data: data
});
});
</script>
</body>
</html>