Cleanup
This commit is contained in:
parent
5133ff8760
commit
3348c7556e
50
automate.php
50
automate.php
|
@ -87,17 +87,51 @@
|
|||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
/* [4] Test download via AJAX
|
||||
=========================================================*/
|
||||
// $_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
$req = new ModuleRequest('download/multiple', array(
|
||||
'phone' => true,
|
||||
'all' => false
|
||||
));
|
||||
$dates = array(
|
||||
'01 janv. 2015',
|
||||
'02 févr. 2015',
|
||||
'03 mars 2015',
|
||||
'04 avr. 2015',
|
||||
'05 mai 2015',
|
||||
'06 juin 2015',
|
||||
'07 juil. 2015',
|
||||
'08 août 2015',
|
||||
'09 sept. 2015',
|
||||
'10 nov. 2015',
|
||||
'11 oct. 2015',
|
||||
'12 dec. 2015',
|
||||
);
|
||||
|
||||
$res = $req->download();
|
||||
function correctDates($date){
|
||||
$date = str_replace('janv.', 'jan.', $date);
|
||||
$date = str_replace('févr.', 'feb.', $date);
|
||||
$date = str_replace('mars', 'march', $date);
|
||||
$date = str_replace('avr.', 'apr.', $date);
|
||||
$date = str_replace('mai', 'may', $date);
|
||||
$date = str_replace('juin', 'june', $date);
|
||||
$date = str_replace('juil.', 'july', $date);
|
||||
$date = str_replace('août', 'aug.', $date);
|
||||
|
||||
return strtotime($date);
|
||||
}
|
||||
|
||||
foreach($dates as $date)
|
||||
var_dump( date('d/m/Y H:i:s', correctDates($date)) );
|
||||
|
||||
|
||||
|
||||
$db = new lightdb('phone_db', __ROOT__.'/src/dynamic/');
|
||||
var_dump( array_keys($db->index()));
|
||||
$db->close();
|
||||
|
||||
$db = new lightdb('facebook_db', __ROOT__.'/src/dynamic/');
|
||||
var_dump( array_keys($db->index()));
|
||||
$db->close();
|
||||
$req = new ModuleRequest('chart/direction', array( 'subject' => 273 ));
|
||||
|
||||
$res = $req->dispatch();
|
||||
|
||||
if( $res->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($res->error) );
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"css" : "/css",
|
||||
"js" : "/js",
|
||||
|
||||
"highcharts": "/js/lib/highcharts",
|
||||
"highcharts": "/js/lib/highcharts/js",
|
||||
"sigma": "/js/lib/sigma",
|
||||
|
||||
"upload": "/src/upload"
|
||||
|
|
|
@ -106,17 +106,43 @@
|
|||
|
||||
"chart": {
|
||||
|
||||
"network_data": {
|
||||
"description": "Renvoie un jeu de donnees fictif pour un graphique de type #network.",
|
||||
"permissions": [],
|
||||
"parameters": {}
|
||||
"direction": {
|
||||
"description": "Renvoie les données pour un graphique sur les sens de communications",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"subject": { "description": "Identifiant du sujet à étudier,", "type": "id" }
|
||||
}
|
||||
},
|
||||
|
||||
"network_render": {
|
||||
"description": "Renvoie le contenu du svg representant un graphique de type #network avec les donnees recues.",
|
||||
"permissions": [],
|
||||
"type": {
|
||||
"description": "Renvoie les données pour un graphique sur les types de communications",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"dataset": { "description": "Dataset au bon format pour un graphique de type #network." }
|
||||
"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" }
|
||||
}
|
||||
},
|
||||
|
||||
"ages": {
|
||||
"description": "Renvoie les données pour un graphique sur les ages des contacts",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"subject": { "description": "Identifiant du sujet à étudier,", "type": "id" }
|
||||
}
|
||||
},
|
||||
|
||||
"relations": {
|
||||
"description": "Renvoie les données pour un graphique sur les types de relations des contacts",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"subject": { "description": "Identifiant du sujet à étudier,", "type": "id" }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -236,6 +262,15 @@
|
|||
},
|
||||
|
||||
|
||||
"iexplorer_convert": {
|
||||
"description": "Convertisseur .txt (iExplorer) vers .xml (Call Log)",
|
||||
"permissions": ["admin"],
|
||||
"parameters": {
|
||||
"file": { "description": "Fichier exporté de iExplorer", "type": "FILE" }
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"local_data": {
|
||||
"description": "Upload d'une sauvegarde de formulaire local au format .json.",
|
||||
"permissions": ["admin"],
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"root": "/src/upload",
|
||||
"directories": [
|
||||
"call_log",
|
||||
"local_data"
|
||||
"local_data",
|
||||
"convert_iexplorer"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
{
|
||||
"root": "/var/www/socioview",
|
||||
|
||||
|
||||
|
||||
"permissions": {
|
||||
"public": { "chown": "xdrm:www-data", "chmod": 750 },
|
||||
"private": { "chown": "xdrm:xdrm", "chmod": 700, ".htaccess": "Order deny,allow\nDeny from all" },
|
||||
"phponly": { "chown": "xdrm:www-data", "chmod": 770, ".htaccess": "Order deny,allow\nDeny from all" },
|
||||
"php": { "chown": "xdrm:www-data", "chmod": 770 }
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
"files": {
|
||||
"permissions": "public",
|
||||
|
||||
".git": { "permissions": "private" },
|
||||
|
||||
"config": { "permissions": "private" },
|
||||
"manager": { "permissions": "private" },
|
||||
|
||||
"src": {
|
||||
"permissions": "phponly",
|
||||
"static": "public"
|
||||
},
|
||||
|
||||
|
||||
"tmp": {
|
||||
"permissions": "php"
|
||||
},
|
||||
|
||||
|
||||
".htaccess": { "permissions": "private" }
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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"]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
function sociogramClass(a){this.container=a;this.log("sociogram created")}
|
||||
sociogramClass.prototype={container:this.container,sigma:null,request:{path:"chart/network_data"},response:null,nodes:[],edges:[],rad:500,nodeDistance:100,overloadGraph:function(){},load:function(){},nodeAt:function(a,b){},arrange:function(a,b,d){},extractNodesFromResponse:function(){},extractEdgesFromResponse:function(){},renderNodes:function(){},renderEdges:function(){},overload:{nodeNeighbors:function(a){},nodeDirectNeighbors:function(a){}},bindings:{clickNode:function(a,b){},clickStage:function(a,
|
||||
b){}},log:function(a){console.log("--[SOCIOGRAM]--");console.warn(a);console.log("--[/SOCIOGRAM]--")}};sociogramClass.prototype.overloadGraph=function(){sigma.classes.graph.addMethod("nodeNeighbors",this.overload.nodeNeighbors);sigma.classes.graph.addMethod("nodeDirectNeighbors",this.overload.nodeDirectNeighbors);this.log("graph overloaded")};
|
||||
sociogramClass.prototype.load=function(){this.sigma=new sigma({renderer:{container:this.container,type:"canvas"}});var a=this;api.send(this.request,function(b){a.log(b);0==b.ModuleError&&(a.response=b,a.sigma.settings({defaultNodeColor:"#348ed8",defaultLabelSize:14,defaultLabelBGColor:"#ddd",defaultHoverLabelBGColor:"#002147",defaultLabelHoverColor:"#fff",labelThreshold:10,defaultEdgeType:"line"}),a.extractNodesFromResponse(),a.extractEdgesFromResponse(),a.addNodes(),a.addEdges(),a.sigma.bind("clickNode",
|
||||
function(b){a.bindings.clickNode(a,b)}),a.sigma.bind("clickStage",function(b){a.bindings.clickStage(a,b)}),a.sigma.graph.nodes().forEach(function(b){a.arrange(b.id,null,!0)}),a.sigma.camera.ratio=1.2,a.sigma.refresh())})};sociogramClass.prototype.nodeAt=function(a,b){var d=this.sigma.graph.nodes(),c=null,e;for(e in d){var f=Math.sqrt(Math.pow(a-d[e].x,2)+Math.pow(b-d[e].y,2));if(null==c||f<c)c=f}return c};
|
||||
sociogramClass.prototype.arrange=function(a,b,d){var c=this.sigma.graph.nodes(a);if(0==c.x&&0==c.y){b=null==b?{x:c.x,y:c.y}:b;if(d)for(;this.nodeAt(b.x,b.y)<2*this.nodeDistance;)b={x:b.x+2*this.nodeDistance*Math.cos(2*Math.random()*Math.PI),y:b.y+2*this.nodeDistance*Math.sin(2*Math.random()*Math.PI)};d=this.sigma.graph.nodeDirectNeighbors(a);a={};var e=0,f;for(f in d)a[f]=this.sigma.graph.nodes(f),e++;c.x=b.x;c.y=b.y;c=[];for(f in a)if(a=this.sigma.graph.nodes(f),0==a.x&&0==a.y){e=!1;do{d=2*Math.random()*
|
||||
Math.PI;for(var g=0;g<c.length;g++)if(Math.abs(d-c[g])>Math.PI/10){e=!0;break}}while(e);a.x=b.x+this.nodeDistance*Math.cos(d);a.y=b.y+this.nodeDistance*Math.sin(d);this.arrange(a.id)}this.sigma.refresh()}};sociogramClass.prototype.overload.nodeNeighbors=function(a){a=this.allNeighborsIndex[a];var b=[],d;for(d in a)b.push(d);for(;0<b.length;){d=this.allNeighborsIndex[b[0]];for(var c in d)null==a[c]&&(b.push(c),a[c]=d[c]);b.shift()}return a};sociogramClass.prototype.overload.nodeDirectNeighbors=function(a){return this.allNeighborsIndex[a]};
|
||||
sociogramClass.prototype.extractNodesFromResponse=function(){this.nodes=[];for(var a=0;a<this.response.data.alter.length;a++)this.nodes.push({id:"n-"+this.response.data.alter[a][0],label:this.response.data.alter[a][1],x:0,y:0,size:this.response.data.alter[a][2]})};
|
||||
sociogramClass.prototype.extractEdgesFromResponse=function(){this.edges=[];for(var a=0;a<this.response.data.inter.length;a++)this.edges.push({id:"e-"+this.response.data.inter[a][0]+"-"+this.response.data.inter[a][1],source:"n-"+this.response.data.inter[a][0],target:"n-"+this.response.data.inter[a][1]})};sociogramClass.prototype.addNodes=function(){for(var a=0;a<this.nodes.length;a++)this.sigma.graph.addNode(this.nodes[a])};sociogramClass.prototype.addEdges=function(){for(var a=0;a<this.edges.length;a++)this.sigma.graph.addEdge(this.edges[a])};
|
||||
sociogramClass.prototype.bindings.clickNode=function(a,b){console.log(a);var d=b.data.node.id,c=a.sigma.graph.nodeNeighbors(d);c[d]=b.data.node;a.sigma.graph.nodes().forEach(function(a){a.color=null!=c[a.id]?a.originalColor:"#888"});a.sigma.refresh()};sociogramClass.prototype.bindings.clickStage=function(a,b){a.sigma.graph.nodes().forEach(function(a){a.color=a.originalColor});a.sigma.refresh()};
|
|
@ -1,558 +0,0 @@
|
|||
/* Gestion du SOCIOGRAMME SPATIAL
|
||||
*
|
||||
* [1] - Récupération du conteneur (élément du DOM/HTML)
|
||||
* [2] - Construction de la classe (objet type)
|
||||
* [3] - Construction de l'objet SIGMA
|
||||
* [4] - Récupération des données
|
||||
* [5] - Paramétrage de SIGMA
|
||||
* [6] - On extrait les noeuds/liens des données reçues
|
||||
* [7] - On ajoute les noeuds/liens à SIGMA
|
||||
* [8] - On positionne le tout dans l'espace
|
||||
* [9] - On bind() les évènements
|
||||
* [10]- On affiche le rendu
|
||||
*
|
||||
*/
|
||||
|
||||
/* [1] Récupération du conteneur
|
||||
======================================*/
|
||||
function sociogramClass(container){
|
||||
this.container = container;
|
||||
this.log('sociogram created');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [2] Construction de la classe
|
||||
======================================*/
|
||||
sociogramClass.prototype = {
|
||||
container: this.container,
|
||||
sigma: null,
|
||||
request: { path: 'chart/network_data' },
|
||||
response: null,
|
||||
nodes: [],
|
||||
edges: [],
|
||||
rad: 500,
|
||||
nodeDistance: 100,
|
||||
|
||||
/* (0) Ajout de méthodes à @this.sigma.graph */
|
||||
overloadGraph: function(){},
|
||||
|
||||
/* (1) Point d'amorçage */
|
||||
load: function(){},
|
||||
|
||||
/* (2) Retourne la distance avec le noeud le plus près de la position (@x, @y) */
|
||||
nodeAt: function(x, y){},
|
||||
/* (3) Positionnement spatial d'un noeud d'id @nodeId à une position @pos(x,y) */
|
||||
arrange: function(nodeId, pos, alone){},
|
||||
|
||||
/* (4) Extraction de des @this.nodes depuis @this.response */
|
||||
extractNodesFromResponse: function(){},
|
||||
/* (5) Extraction de des @this.edges depuis @this.response */
|
||||
extractEdgesFromResponse: function(){},
|
||||
|
||||
/* (6) Ajout des noeuds @this.nodes au rendu */
|
||||
renderNodes: function(){},
|
||||
/* (7) Ajout des liens @this.edges au rendu */
|
||||
renderEdges: function(){},
|
||||
|
||||
/* (8) Ajout des fonctions dans @this.sigma.graph */
|
||||
overload: {
|
||||
// {1} Renvoie la liste des voisins directs et indirects du noeud d'id @nodeId //
|
||||
nodeNeighbors: function(nodeId){},
|
||||
// {2} Renvoie la liste des voisins directs du noeud d'id @nodeId //
|
||||
nodeDirectNeighbors: function(nodeId){}
|
||||
},
|
||||
|
||||
/* (9) Fonctions de callback pour les évènements */
|
||||
bindings: {
|
||||
// {1} Action quand on clique sur un noeud //
|
||||
clickNode: function(thisPtr, e){},
|
||||
// {2} Action quand on clique dans le vide //
|
||||
clickStage: function(thisPtr, e){}
|
||||
},
|
||||
|
||||
|
||||
log: function(message){
|
||||
console.log('--[SOCIOGRAM]--');
|
||||
console.warn(message);
|
||||
console.log('--[/SOCIOGRAM]--');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* SURCHARGE DU GRAPH (@this.sigma.graph) -> Ajout de méthodes
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.overloadGraph = function(){
|
||||
sigma.classes.graph.addMethod('nodeNeighbors', this.overload.nodeNeighbors);
|
||||
sigma.classes.graph.addMethod('nodeDirectNeighbors', this.overload.nodeDirectNeighbors);
|
||||
this.log('graph overloaded');
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* (1) Point d'amorçage */
|
||||
sociogramClass.prototype.load = function(){
|
||||
// {1} On instancie SIGMA //
|
||||
this.sigma = new sigma({ renderer: { container: this.container, 'type': 'canvas' } });
|
||||
|
||||
var thisPtr = this;
|
||||
|
||||
// {2} On récupère les données via l'API //
|
||||
api.send(this.request, function(response){
|
||||
thisPtr.log(response);
|
||||
|
||||
// Si erreur, on quitte
|
||||
if( response.ModuleError != 0 ) return;
|
||||
|
||||
// On enregistre la réponse
|
||||
thisPtr.response = response;
|
||||
|
||||
|
||||
// {3} On paramètre SIGMA //
|
||||
thisPtr.sigma.settings({
|
||||
defaultNodeColor: '#348ed8',
|
||||
defaultLabelSize: 14,
|
||||
defaultLabelBGColor: "#ddd",
|
||||
defaultHoverLabelBGColor: "#002147",
|
||||
defaultLabelHoverColor: "#fff",
|
||||
labelThreshold: 10,
|
||||
defaultEdgeType: "line"
|
||||
});
|
||||
|
||||
// {4} On recupere les noeuds et les liens //
|
||||
thisPtr.extractNodesFromResponse();
|
||||
thisPtr.extractEdgesFromResponse();
|
||||
|
||||
// {5} On ajoute les noeuds et les liens au rendu //
|
||||
thisPtr.addNodes();
|
||||
thisPtr.addEdges();
|
||||
|
||||
|
||||
// {6} On définit les évènements //
|
||||
// On affiche que les voisins d'un noeud quand on clique sur lui
|
||||
thisPtr.sigma.bind('clickNode', function(e){
|
||||
thisPtr.bindings.clickNode(thisPtr, e);
|
||||
});
|
||||
|
||||
// On affiche tous les noeuds quand on clique dans le vide
|
||||
thisPtr.sigma.bind('clickStage', function(e){
|
||||
thisPtr.bindings.clickStage(thisPtr, e);
|
||||
});
|
||||
|
||||
// {7} On positionne spatialement les noeuds //
|
||||
thisPtr.sigma.graph.nodes().forEach(function(n){ thisPtr.arrange(n.id, null, true); });
|
||||
|
||||
// {8} On affiche le rendu //
|
||||
thisPtr.sigma.camera.ratio = 1.2;
|
||||
thisPtr.sigma.refresh();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE LA DISTANCE AVEC LE NOEUD LE PLUS PRES
|
||||
*
|
||||
* @x<float> Abscisse du point
|
||||
* @y<float> Ordonnees du point
|
||||
*
|
||||
* @return distance<float> Retourne la distance du noeud le plus proche
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.nodeAt = function(x, y){
|
||||
var nodes = this.sigma.graph.nodes();
|
||||
var minDistance = null;
|
||||
for( var nodeId in nodes ){
|
||||
var distance = Math.sqrt( Math.pow(x-nodes[nodeId].x, 2) + Math.pow(y-nodes[nodeId].y, 2) );
|
||||
if( minDistance == null || distance < minDistance )
|
||||
minDistance = distance;
|
||||
}
|
||||
|
||||
return minDistance;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* POSITIONNE LES VOISINS AUTOUR DU NOEUD COURANT
|
||||
*
|
||||
* @nodeId<String> Id du noeud courant
|
||||
* @pos<Object> Contient {x, y} position initiale, sinon la position actuelle du noeud
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.arrange = function(nodeId, pos, alone){
|
||||
var node = this.sigma.graph.nodes(nodeId);
|
||||
|
||||
// Si le noeud est deja place, on ne fais rien
|
||||
if( node.x != 0 || node.y != 0 ) return;
|
||||
|
||||
pos = (pos==null) ? {x: node.x, y: node.y} : pos; // On recupere la position
|
||||
|
||||
// Tant que le noeud est trop proche d'un autre, on l'eloigne
|
||||
// UNIQUEMENT si alone n'est pas NULL
|
||||
if( alone ){
|
||||
while( this.nodeAt(pos.x, pos.y) < 2*this.nodeDistance ){
|
||||
pos = {
|
||||
x: pos.x + 2*this.nodeDistance*Math.cos(Math.random()*2*Math.PI),
|
||||
y: pos.y + 2*this.nodeDistance*Math.sin(Math.random()*2*Math.PI)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// On recupere les voisins directs
|
||||
var neighborsId = this.sigma.graph.nodeDirectNeighbors(nodeId);
|
||||
var neighbors = {};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var neighborsCount = 0;
|
||||
for( var neighborId in neighborsId ){
|
||||
neighbors[neighborId] = this.sigma.graph.nodes(neighborId);
|
||||
neighborsCount++;
|
||||
}
|
||||
|
||||
|
||||
// On positionne le noeud
|
||||
node.x = pos.x;
|
||||
node.y = pos.y;
|
||||
|
||||
var angles = [];
|
||||
|
||||
// On positionne chaque voisin si c'est pas deja fait
|
||||
for( neighborId in neighbors ){
|
||||
var current = this.sigma.graph.nodes(neighborId);
|
||||
// Si n'est pas deja positionne
|
||||
if( current.x == 0 && current.y == 0 ){
|
||||
// On cherche un angle tant qu'il est pas trop pres d'un deja pris
|
||||
var angle, alreadyUsed = false;
|
||||
do{
|
||||
angle = Math.random()*2*Math.PI;
|
||||
for( var i = 0 ; i < angles.length ; i++ )
|
||||
if( Math.abs(angle-angles[i]) > Math.PI/10 ){
|
||||
alreadyUsed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}while( alreadyUsed );
|
||||
|
||||
current.x = pos.x + this.nodeDistance*Math.cos(angle);
|
||||
current.y = pos.y + this.nodeDistance*Math.sin(angle);
|
||||
this.arrange(current.id);
|
||||
}
|
||||
}
|
||||
|
||||
this.sigma.refresh();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RENVOIE LA LISTE DES VOISINS (DIRECTS & INDIRECTS) D'UN NOEUD DONNÉ
|
||||
*
|
||||
* @nodeId<String> Id du noeud en question
|
||||
*
|
||||
* @return neighbors<array> Liste des voisins directs+indirects
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.overload.nodeNeighbors = function(nodeId){
|
||||
var neighbors = this.allNeighborsIndex[nodeId];
|
||||
|
||||
// Pile des voisins pour lesquels il faut chercher leurs voisins
|
||||
var stack = [];
|
||||
for( var neighborId in neighbors ) stack.push(neighborId);
|
||||
|
||||
// Tant qu'il reste des voisins a trouver
|
||||
while( stack.length > 0 ){
|
||||
var subneighbors = this.allNeighborsIndex[stack[0]];
|
||||
for( var subId in subneighbors )
|
||||
// Si le voisin est pas deja dans la liste/pile, on l'ajoute a la liste des voisins
|
||||
if( neighbors[subId] == null ){
|
||||
stack.push(subId); // On ajoute a la pile
|
||||
neighbors[subId] = subneighbors[subId]; // On ajoute a la liste complete
|
||||
}
|
||||
|
||||
stack.shift();
|
||||
}
|
||||
|
||||
|
||||
// On retourne le resultat
|
||||
return neighbors;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RENVOIE LA LISTE DES VOISINS DIRECTS D'UN NOEUD DONNÉ
|
||||
*
|
||||
* @nodeId<String> Id du noeud en question
|
||||
*
|
||||
* @return neighbors<array> Liste des voisins directs
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.overload.nodeDirectNeighbors = function(nodeId){
|
||||
return this.allNeighborsIndex[nodeId];
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* EXTRAIT LES NOEUDS DE LA RÉPONSE DE L'API
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.extractNodesFromResponse = function(){
|
||||
this.nodes = [];
|
||||
|
||||
// Pour chaque alter
|
||||
for( var i = 0 ; i < this.response.data.alter.length ; i++ )
|
||||
this.nodes.push({
|
||||
'id': 'n-'+this.response.data.alter[i][0],
|
||||
'label': this.response.data.alter[i][1],
|
||||
'x': 0,
|
||||
'y': 0,
|
||||
'size': this.response.data.alter[i][2]
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* EXTRAIT LES NOEUDS DE LA RÉPONSE DE L'API
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.extractEdgesFromResponse = function(){
|
||||
this.edges = [];
|
||||
|
||||
// Pour chaque inter
|
||||
for( var i = 0 ; i < this.response.data.inter.length ; i++ )
|
||||
this.edges.push({
|
||||
'id': 'e-'+this.response.data.inter[i][0]+'-'+this.response.data.inter[i][1],
|
||||
'source': 'n-'+this.response.data.inter[i][0],
|
||||
'target': 'n-'+this.response.data.inter[i][1]
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* AJOUTE LES NOEUDS AU RENDU (SIGMA GRAPH)
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.addNodes = function(){
|
||||
/* (5) On ajoute nos noeuds */
|
||||
for( var i = 0 ; i < this.nodes.length ; i++)
|
||||
this.sigma.graph.addNode(this.nodes[i]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* AJOUTE LES LIENS AU RENDU (SIGMA GRAPH)
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.addEdges = function(){
|
||||
/* (6) On ajoute nos liens */
|
||||
for( var i = 0 ; i < this.edges.length ; i++)
|
||||
this.sigma.graph.addEdge(this.edges[i]);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* FONCTION ACTIVÉE LORS DU CLIC SUR UN NOEUD
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.bindings.clickNode = function(thisPtr, e){
|
||||
console.log( thisPtr );
|
||||
var nodeId = e.data.node.id;
|
||||
// On recupere les voisins
|
||||
var neighborNodes = thisPtr.sigma.graph.nodeNeighbors(nodeId);
|
||||
neighborNodes[nodeId] = e.data.node; // on ajoute le noeud clique
|
||||
|
||||
thisPtr.sigma.graph.nodes().forEach(function(n) {
|
||||
if( neighborNodes[n.id] != null ) n.color = n.originalColor;
|
||||
else n.color = '#888';
|
||||
});
|
||||
|
||||
thisPtr.sigma.refresh();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/* FONCTION ACTIVÉE LORS DU CLIC DANS LE VIDE
|
||||
*
|
||||
*/
|
||||
sociogramClass.prototype.bindings.clickStage = function(thisPtr, e){
|
||||
thisPtr.sigma.graph.nodes().forEach(function(n){ n.color = n.originalColor; });
|
||||
thisPtr.sigma.refresh();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// var i,
|
||||
// s,
|
||||
// o,
|
||||
// L = 10,
|
||||
// N = 100,
|
||||
// E = 500,
|
||||
// g = {
|
||||
// nodes: [],
|
||||
// edges: []
|
||||
// },
|
||||
// step = 0;
|
||||
// // Generate a random graph:
|
||||
// for (i = 0; i < N; i++) {
|
||||
// o = {
|
||||
// id: 'n' + i,
|
||||
// label: 'Node ' + i,
|
||||
// circular_x: L * Math.cos(Math.PI * 2 * i / N - Math.PI / 2),
|
||||
// circular_y: L * Math.sin(Math.PI * 2 * i / N - Math.PI / 2),
|
||||
// circular_size: Math.random(),
|
||||
// circular_color: '#' + (
|
||||
// Math.floor(Math.random() * 16777215).toString(16) + '000000'
|
||||
// ).substr(0, 6),
|
||||
// grid_x: i % L,
|
||||
// grid_y: Math.floor(i / L),
|
||||
// grid_size: 1,
|
||||
// grid_color: '#ccc'
|
||||
// };
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ['x', 'y', 'size', 'color'].forEach(function(val) {
|
||||
// o[val] = o['grid_' + val];
|
||||
// });
|
||||
// g.nodes.push(o);
|
||||
// }
|
||||
// for (i = 0; i < E; i++)
|
||||
// g.edges.push({
|
||||
// id: 'e' + i,
|
||||
// source: 'n' + (Math.random() * N | 0),
|
||||
// target: 'n' + (Math.random() * N | 0),
|
||||
// });
|
||||
// // Instantiate sigma:
|
||||
// s = new sigma({
|
||||
// graph: g,
|
||||
// renderer: { container: document.getElementById('graph-container'), 'type': 'canvas' },
|
||||
// settings: {
|
||||
// animationsTime: 1000
|
||||
// }
|
||||
// });
|
||||
|
||||
// setInterval(function(){
|
||||
// var prefix = ['grid_', 'circular_'][step = +!step];
|
||||
// sigma.plugins.animate(
|
||||
// s,
|
||||
// {
|
||||
// x: prefix + 'x',
|
||||
// y: prefix + 'y',
|
||||
// size: prefix + 'size',
|
||||
// color: prefix + 'color'
|
||||
// }
|
||||
// );
|
||||
// }, 10000);
|
|
@ -2,4 +2,4 @@ function inputPhoneMatrice(a){this.container=a}inputPhoneMatrice.prototype={cont
|
|||
inputPhoneMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("p_matrice",0,d)};
|
||||
inputPhoneMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches"),d=lsi.get("p_matrice",0),b=lsi["export"]("p_contacts"),e=[],c;for(c in a)-1==e.indexOf(a[c].contact)&&e.push(a[c].contact);a="<table class='line'>";for(c=0;c<e.length;c++){var g=b[c],a=a+"<tr>";0<c?(a+='<td style="text-align: right;">',a+=g.username,a+="</td>"):a+="<td></td>";for(var f=0;f<e.length;f++)if(f<e.length-1){var h=b[f];0==c?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">',
|
||||
a+=h.username,a+="</span>"):f<c?(a+="<td>",a+="<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='matrice_"+g.uid+"_"+h.uid+"'",null!=d[c]&&-1<d[c].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
|
||||
inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)};
|
||||
inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1);this.snake()};inputPhoneMatrice.prototype.snake=function(){this.sVelocity=[0,0];this.sLength=0;this.sStack=[]};
|
||||
|
|
|
@ -170,4 +170,26 @@ inputPhoneMatrice.prototype.attach = function(){
|
|||
ptr.fieldsToStorage();
|
||||
ptr.storageToFields();
|
||||
}, false);
|
||||
|
||||
this.snake();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inputPhoneMatrice.prototype.snake = function(){
|
||||
|
||||
/* [0] On écrit les fonctions principales
|
||||
=========================================================*/
|
||||
this.sVelocity = [0, 0];
|
||||
this.sLength = 0;
|
||||
this.sStack = [];
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,304 @@
|
|||
(function e$$0(m,n,f){function e(a,h){if(!n[a]){if(!m[a]){var k="function"==typeof require&&require;if(!h&&k)return k(a,!0);if(c)return c(a,!0);k=Error("Cannot find module '"+a+"'");throw k.code="MODULE_NOT_FOUND",k;}k=n[a]={exports:{}};m[a][0].call(k.exports,function(c){var k=m[a][1][c];return e(k?k:c)},k,k.exports,e$$0,m,n,f)}return n[a].exports}for(var c="function"==typeof require&&require,a=0;a<f.length;a++)e(f[a]);return e})({1:[function(p,m,n){},{}],2:[function(p,m,n){function f(a){var c=a[0]/
|
||||
255,d=a[1]/255,k=a[2]/255;a=Math.min(c,d,k);var h=Math.max(c,d,k),e=h-a,l;h==a?l=0:c==h?l=(d-k)/e:d==h?l=2+(k-c)/e:k==h&&(l=4+(c-d)/e);l=Math.min(60*l,360);0>l&&(l+=360);c=(a+h)/2;return[l,100*(h==a?0:.5>=c?e/(h+a):e/(2-h-a)),100*c]}function e(a){var c=a[0],d=a[1];a=a[2];var k=Math.min(c,d,a),h=Math.max(c,d,a),e=h-k,l;h==k?l=0:c==h?l=(d-a)/e:d==h?l=2+(a-c)/e:a==h&&(l=4+(c-d)/e);l=Math.min(60*l,360);0>l&&(l+=360);return[l,0==h?0:e/h*1E3/10,h/255*1E3/10]}function c(a){var c=a[0],d=a[1],k=a[2];a=f(a)[0];
|
||||
var h=1/255*Math.min(c,Math.min(d,k)),k=1-1/255*Math.max(c,Math.max(d,k));return[a,100*h,100*k]}function a(a){var c=a[0]/255,d=a[1]/255;a=a[2]/255;var k;k=Math.min(1-c,1-d,1-a);return[100*((1-c-k)/(1-k)||0),100*((1-d-k)/(1-k)||0),100*((1-a-k)/(1-k)||0),100*k]}function d(a){return I[JSON.stringify(a)]}function h(a){var c=a[0]/255,d=a[1]/255;a=a[2]/255;c=.04045<c?Math.pow((c+.055)/1.055,2.4):c/12.92;d=.04045<d?Math.pow((d+.055)/1.055,2.4):d/12.92;a=.04045<a?Math.pow((a+.055)/1.055,2.4):a/12.92;return[100*
|
||||
(.4124*c+.3576*d+.1805*a),100*(.2126*c+.7152*d+.0722*a),100*(.0193*c+.1192*d+.9505*a)]}function k(a){var c=h(a);a=c[0];var d=c[1],c=c[2];a/=95.047;d/=100;c/=108.883;a=.008856<a?Math.pow(a,1/3):7.787*a+16/116;d=.008856<d?Math.pow(d,1/3):7.787*d+16/116;c=.008856<c?Math.pow(c,1/3):7.787*c+16/116;return[116*d-16,500*(a-d),200*(d-c)]}function l(a){var c=a[0]/360,d=a[1]/100;a=a[2]/100;var k,h;if(0==d)return k=255*a,[k,k,k];d=.5>a?a*(1+d):a+d-a*d;a=2*a-d;h=[0,0,0];for(var e=0;3>e;e++)k=c+1/3*-(e-1),0>k&&
|
||||
k++,1<k&&k--,k=1>6*k?a+6*(d-a)*k:1>2*k?d:2>3*k?a+(d-a)*(2/3-k)*6:a,h[e]=255*k;return h}function q(a){var c=a[0]/60,d=a[1]/100;a=a[2]/100;var k=Math.floor(c)%6,h=c-Math.floor(c),c=255*a*(1-d),e=255*a*(1-d*h),d=255*a*(1-d*(1-h));a*=255;switch(k){case 0:return[a,d,c];case 1:return[e,a,c];case 2:return[c,a,d];case 3:return[c,e,a];case 4:return[d,c,a];case 5:return[a,c,e]}}function t(a){var c=a[0]/360,d=a[1]/100,k=a[2]/100;a=d+k;1<a&&(d/=a,k/=a);a=Math.floor(6*c);k=1-k;c=6*c-a;0!=(a&1)&&(c=1-c);c=d+c*
|
||||
(k-d);switch(a){default:case 6:case 0:r=k;g=c;b=d;break;case 1:r=c;g=k;b=d;break;case 2:r=d;g=k;b=c;break;case 3:r=d;g=c;b=k;break;case 4:r=c;g=d;b=k;break;case 5:r=k,g=d,b=c}return[255*r,255*g,255*b]}function w(a){var c=a[3]/100;return[255*(1-Math.min(1,a[0]/100*(1-c)+c)),255*(1-Math.min(1,a[1]/100*(1-c)+c)),255*(1-Math.min(1,a[2]/100*(1-c)+c))]}function x(a){var c=a[0]/100,d=a[1]/100,k=a[2]/100,h;a=3.2406*c+-1.5372*d+-.4986*k;h=-.9689*c+1.8758*d+.0415*k;c=.0557*c+-.204*d+1.057*k;a=.0031308<a?1.055*
|
||||
Math.pow(a,1/2.4)-.055:a*=12.92;h=.0031308<h?1.055*Math.pow(h,1/2.4)-.055:h*=12.92;c=.0031308<c?1.055*Math.pow(c,1/2.4)-.055:c*=12.92;a=Math.min(Math.max(0,a),1);h=Math.min(Math.max(0,h),1);c=Math.min(Math.max(0,c),1);return[255*a,255*h,255*c]}function u(a){var c=a[0],d=a[1];a=a[2];c/=95.047;d/=100;a/=108.883;c=.008856<c?Math.pow(c,1/3):7.787*c+16/116;d=.008856<d?Math.pow(d,1/3):7.787*d+16/116;a=.008856<a?Math.pow(a,1/3):7.787*a+16/116;return[116*d-16,500*(c-d),200*(d-a)]}function E(a){var c=a[0],
|
||||
d=a[1];a=a[2];var k,h,e;8>=c?(c=100*c/903.3,e=c/100*7.787+16/116):(c=100*Math.pow((c+16)/116,3),e=Math.pow(c/100,1/3));k=.008856>=k/95.047?k=95.047*(d/500+e-16/116)/7.787:95.047*Math.pow(d/500+e,3);h=.008859>=h/108.883?h=108.883*(e-a/200-16/116)/7.787:108.883*Math.pow(e-a/200,3);return[k,c,h]}function v(a){var c=a[0],d=a[1];a=a[2];var k;k=360*Math.atan2(a,d)/2/Math.PI;0>k&&(k+=360);return[c,Math.sqrt(d*d+a*a),k]}function A(a){return x(E(a))}function F(a){var c=a[0],d=a[1];a=a[2]/360*2*Math.PI;return[c,
|
||||
d*Math.cos(a),d*Math.sin(a)]}m.exports={rgb2hsl:f,rgb2hsv:e,rgb2hwb:c,rgb2cmyk:a,rgb2keyword:d,rgb2xyz:h,rgb2lab:k,rgb2lch:function(a){return v(k(a))},hsl2rgb:l,hsl2hsv:function(a){var c=a[0],d=a[1]/100;a=a[2]/100;if(0===a)return[0,0,0];a*=2;d*=1>=a?a:2-a;return[c,2*d/(a+d)*100,(a+d)/2*100]},hsl2hwb:function(a){return c(l(a))},hsl2cmyk:function(c){return a(l(c))},hsl2keyword:function(a){return d(l(a))},hsv2rgb:q,hsv2hsl:function(a){var c=a[0],d=a[1]/100,k=a[2]/100;a=(2-d)*k;d=(d=d*k/(1>=a?a:2-a))||
|
||||
0;return[c,100*d,a/2*100]},hsv2hwb:function(a){return c(q(a))},hsv2cmyk:function(c){return a(q(c))},hsv2keyword:function(a){return d(q(a))},hwb2rgb:t,hwb2hsl:function(a){return f(t(a))},hwb2hsv:function(a){return e(t(a))},hwb2cmyk:function(c){return a(t(c))},hwb2keyword:function(a){return d(t(a))},cmyk2rgb:w,cmyk2hsl:function(a){return f(w(a))},cmyk2hsv:function(a){return e(w(a))},cmyk2hwb:function(a){return c(w(a))},cmyk2keyword:function(a){return d(w(a))},keyword2rgb:function(a){return z[a]},keyword2hsl:function(a){return f(z[a])},
|
||||
keyword2hsv:function(a){return e(z[a])},keyword2hwb:function(a){return c(z[a])},keyword2cmyk:function(c){return a(z[c])},keyword2lab:function(a){return k(z[a])},keyword2xyz:function(a){return h(z[a])},xyz2rgb:x,xyz2lab:u,xyz2lch:function(a){return v(u(a))},lab2xyz:E,lab2rgb:A,lab2lch:v,lch2lab:F,lch2xyz:function(a){return E(F(a))},lch2rgb:function(a){return A(F(a))}};var z={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,
|
||||
245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,
|
||||
0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,
|
||||
220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,
|
||||
211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,
|
||||
104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,
|
||||
218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,
|
||||
180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},I={},y;for(y in z)I[JSON.stringify(z[y])]=y},{}],3:[function(p,m,n){var f=p("./conversions"),e=function(){return new a},c;for(c in f)e[c+"Raw"]=function(a){return function(c){"number"==typeof c&&(c=Array.prototype.slice.call(arguments));return f[a](c)}}(c),n=/(\w+)2(\w+)/.exec(c),
|
||||
p=n[1],n=n[2],e[p]=e[p]||{},e[p][n]=e[c]=function(a){return function(c){"number"==typeof c&&(c=Array.prototype.slice.call(arguments));var k=f[a](c);if("string"==typeof k||void 0===k)return k;for(var e=0;e<k.length;e++)k[e]=Math.round(k[e]);return k}}(c);var a=function(){this.convs={}};a.prototype.routeSpace=function(a,c){var k=c[0];if(void 0===k)return this.getValues(a);"number"==typeof k&&(k=Array.prototype.slice.call(c));return this.setValues(a,k)};a.prototype.setValues=function(a,c){this.space=
|
||||
a;this.convs={};this.convs[a]=c;return this};a.prototype.getValues=function(a){var c=this.convs[a];c||(c=this.space,c=e[c][a](this.convs[c]),this.convs[a]=c);return c};["rgb","hsl","hsv","cmyk","keyword"].forEach(function(c){a.prototype[c]=function(a){return this.routeSpace(c,arguments)}});m.exports=e},{"./conversions":2}],4:[function(p,m,n){function f(a){if(a){var c=/^#([a-fA-F0-9]{6})$/,d=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,h=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,
|
||||
e=/(\w+)/,l=[0,0,0],f=1,t=a.match(/^#([a-fA-F0-9]{3})$/);if(t)for(t=t[1],a=0;a<l.length;a++)l[a]=parseInt(t[a]+t[a],16);else if(t=a.match(c))for(t=t[1],a=0;a<l.length;a++)l[a]=parseInt(t.slice(2*a,2*a+2),16);else if(t=a.match(d)){for(a=0;a<l.length;a++)l[a]=parseInt(t[a+1]);f=parseFloat(t[4])}else if(t=a.match(h)){for(a=0;a<l.length;a++)l[a]=Math.round(2.55*parseFloat(t[a+1]));f=parseFloat(t[4])}else if(t=a.match(e)){if("transparent"==t[1])return[0,0,0,0];l=q[t[1]];if(!l)return}for(a=0;a<l.length;a++)l[a]=
|
||||
k(l[a],0,255);f=f||0==f?k(f,0,1):1;l[3]=f;return l}}function e(a){if(a){var c=a.match(/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(c){var d=parseFloat(c[4]);a=k(parseInt(c[1]),0,360);var h=k(parseFloat(c[2]),0,100),c=k(parseFloat(c[3]),0,100),d=k(isNaN(d)?1:d,0,1);return[a,h,c,d]}}}function c(a){if(a){var c=a.match(/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/);if(c){var d=
|
||||
parseFloat(c[4]);a=k(parseInt(c[1]),0,360);var h=k(parseFloat(c[2]),0,100),c=k(parseFloat(c[3]),0,100),d=k(isNaN(d)?1:d,0,1);return[a,h,c,d]}}}function a(a,c){void 0===c&&(c=void 0!==a[3]?a[3]:1);return"rgba("+a[0]+", "+a[1]+", "+a[2]+", "+c+")"}function d(a,c){return"rgba("+Math.round(a[0]/255*100)+"%, "+Math.round(a[1]/255*100)+"%, "+Math.round(a[2]/255*100)+"%, "+(c||a[3]||1)+")"}function h(a,c){void 0===c&&(c=void 0!==a[3]?a[3]:1);return"hsla("+a[0]+", "+a[1]+"%, "+a[2]+"%, "+c+")"}function k(a,
|
||||
c,d){return Math.min(Math.max(c,a),d)}function l(a){a=a.toString(16).toUpperCase();return 2>a.length?"0"+a:a}var q=p("color-name");m.exports={getRgba:f,getHsla:e,getRgb:function(a){return(a=f(a))&&a.slice(0,3)},getHsl:function(a){return(a=e(a))&&a.slice(0,3)},getHwb:c,getAlpha:function(a){var d=f(a);if(d||(d=e(a))||(d=c(a)))return d[3]},hexString:function(a){return"#"+l(a[0])+l(a[1])+l(a[2])},rgbString:function(c,d){return 1>d||c[3]&&1>c[3]?a(c,d):"rgb("+c[0]+", "+c[1]+", "+c[2]+")"},rgbaString:a,
|
||||
percentString:function(a,c){return 1>c||a[3]&&1>a[3]?d(a,c):"rgb("+Math.round(a[0]/255*100)+"%, "+Math.round(a[1]/255*100)+"%, "+Math.round(a[2]/255*100)+"%)"},percentaString:d,hslString:function(a,c){return 1>c||a[3]&&1>a[3]?h(a,c):"hsl("+a[0]+", "+a[1]+"%, "+a[2]+"%)"},hslaString:h,hwbString:function(a,c){void 0===c&&(c=void 0!==a[3]?a[3]:1);return"hwb("+a[0]+", "+a[1]+"%, "+a[2]+"%"+(void 0!==c&&1!==c?", "+c:"")+")"},keyword:function(a){return t[a.slice(0,3)]}};var t={},w;for(w in q)t[q[w]]=w},
|
||||
{"color-name":5}],5:[function(p,m,n){m.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],
|
||||
darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,
|
||||
105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,
|
||||
252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,
|
||||
0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,
|
||||
69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],
|
||||
silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],6:[function(p,m,n){var f=p("color-convert"),e=p("color-string"),c=function(a){if(a instanceof
|
||||
c)return a;if(!(this instanceof c))return new c(a);this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1};if("string"==typeof a){var d=e.getRgba(a);if(d)this.setValues("rgb",d);else if(d=e.getHsla(a))this.setValues("hsl",d);else if(d=e.getHwb(a))this.setValues("hwb",d);else throw Error('Unable to parse color from string "'+a+'"');}else if("object"==typeof a)if(d=a,void 0!==d.r||void 0!==d.red)this.setValues("rgb",d);else if(void 0!==d.l||void 0!==d.lightness)this.setValues("hsl",
|
||||
d);else if(void 0!==d.v||void 0!==d.value)this.setValues("hsv",d);else if(void 0!==d.w||void 0!==d.whiteness)this.setValues("hwb",d);else if(void 0!==d.c||void 0!==d.cyan)this.setValues("cmyk",d);else throw Error("Unable to parse color from object "+JSON.stringify(a));};c.prototype={rgb:function(a){return this.setSpace("rgb",arguments)},hsl:function(a){return this.setSpace("hsl",arguments)},hsv:function(a){return this.setSpace("hsv",arguments)},hwb:function(a){return this.setSpace("hwb",arguments)},
|
||||
cmyk:function(a){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){return 1!==this.values.alpha?this.values.hwb.concat([this.values.alpha]):this.values.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){return this.values.rgb.concat([this.values.alpha])},hslaArray:function(){return this.values.hsl.concat([this.values.alpha])},alpha:function(a){if(void 0===
|
||||
a)return this.values.alpha;this.setValues("alpha",a);return this},red:function(a){return this.setChannel("rgb",0,a)},green:function(a){return this.setChannel("rgb",1,a)},blue:function(a){return this.setChannel("rgb",2,a)},hue:function(a){return this.setChannel("hsl",0,a)},saturation:function(a){return this.setChannel("hsl",1,a)},lightness:function(a){return this.setChannel("hsl",2,a)},saturationv:function(a){return this.setChannel("hsv",1,a)},whiteness:function(a){return this.setChannel("hwb",1,a)},
|
||||
blackness:function(a){return this.setChannel("hwb",2,a)},value:function(a){return this.setChannel("hsv",2,a)},cyan:function(a){return this.setChannel("cmyk",0,a)},magenta:function(a){return this.setChannel("cmyk",1,a)},yellow:function(a){return this.setChannel("cmyk",2,a)},black:function(a){return this.setChannel("cmyk",3,a)},hexString:function(){return e.hexString(this.values.rgb)},rgbString:function(){return e.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return e.rgbaString(this.values.rgb,
|
||||
this.values.alpha)},percentString:function(){return e.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return e.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return e.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return e.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return e.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){return this.values.rgb[0]<<16|this.values.rgb[1]<<8|this.values.rgb[2]},luminosity:function(){for(var a=
|
||||
this.values.rgb,c=[],h=0;h<a.length;h++){var k=a[h]/255;c[h]=.03928>=k?k/12.92:Math.pow((k+.055)/1.055,2.4)}return.2126*c[0]+.7152*c[1]+.0722*c[2]},contrast:function(a){var c=this.luminosity();a=a.luminosity();return c>a?(c+.05)/(a+.05):(a+.05)/(c+.05)},level:function(a){a=this.contrast(a);return 7.1<=a?"AAA":4.5<=a?"AA":""},dark:function(){var a=this.values.rgb;return 128>(299*a[0]+587*a[1]+114*a[2])/1E3},light:function(){return!this.dark()},negate:function(){for(var a=[],c=0;3>c;c++)a[c]=255-this.values.rgb[c];
|
||||
this.setValues("rgb",a);return this},lighten:function(a){this.values.hsl[2]+=this.values.hsl[2]*a;this.setValues("hsl",this.values.hsl);return this},darken:function(a){this.values.hsl[2]-=this.values.hsl[2]*a;this.setValues("hsl",this.values.hsl);return this},saturate:function(a){this.values.hsl[1]+=this.values.hsl[1]*a;this.setValues("hsl",this.values.hsl);return this},desaturate:function(a){this.values.hsl[1]-=this.values.hsl[1]*a;this.setValues("hsl",this.values.hsl);return this},whiten:function(a){this.values.hwb[1]+=
|
||||
this.values.hwb[1]*a;this.setValues("hwb",this.values.hwb);return this},blacken:function(a){this.values.hwb[2]+=this.values.hwb[2]*a;this.setValues("hwb",this.values.hwb);return this},greyscale:function(){var a=this.values.rgb,a=.3*a[0]+.59*a[1]+.11*a[2];this.setValues("rgb",[a,a,a]);return this},clearer:function(a){this.setValues("alpha",this.values.alpha-this.values.alpha*a);return this},opaquer:function(a){this.setValues("alpha",this.values.alpha+this.values.alpha*a);return this},rotate:function(a){var c=
|
||||
this.values.hsl[0],c=(c+a)%360;this.values.hsl[0]=0>c?360+c:c;this.setValues("hsl",this.values.hsl);return this},mix:function(a,c){c=1-(null==c?.5:c);for(var h=2*c-1,k=this.alpha()-a.alpha(),h=((-1==h*k?h:(h+k)/(1+h*k))+1)/2,k=1-h,e=this.rgbArray(),q=a.rgbArray(),f=0;f<e.length;f++)e[f]=e[f]*h+q[f]*k;this.setValues("rgb",e);h=this.alpha()*c+a.alpha()*(1-c);this.setValues("alpha",h);return this},toJSON:function(){return this.rgb()},clone:function(){return new c(this.rgb())}};c.prototype.getValues=
|
||||
function(a){for(var c={},h=0;h<a.length;h++)c[a.charAt(h)]=this.values[a][h];1!=this.values.alpha&&(c.a=this.values.alpha);return c};c.prototype.setValues=function(a,c){var h={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},k={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},e=1;if("alpha"==a)e=c;else if(c.length)this.values[a]=
|
||||
c.slice(0,a.length),e=c[a.length];else if(void 0!==c[a.charAt(0)]){for(e=0;e<a.length;e++)this.values[a][e]=c[a.charAt(e)];e=c.a}else if(void 0!==c[h[a][0]]){for(var q=h[a],e=0;e<a.length;e++)this.values[a][e]=c[q[e]];e=c.alpha}this.values.alpha=Math.max(0,Math.min(1,void 0!==e?e:this.values.alpha));if("alpha"!=a){for(e=0;e<a.length;e++)q=Math.max(0,Math.min(k[a][e],this.values[a][e])),this.values[a][e]=Math.round(q);for(var t in h)for(t!=a&&(this.values[t]=f[a][t](this.values[a])),e=0;e<t.length;e++)q=
|
||||
Math.max(0,Math.min(k[t][e],this.values[t][e])),this.values[t][e]=Math.round(q);return!0}};c.prototype.setSpace=function(a,c){var e=c[0];if(void 0===e)return this.getValues(a);"number"==typeof e&&(e=Array.prototype.slice.call(c));this.setValues(a,e);return this};c.prototype.setChannel=function(a,c,e){if(void 0===e)return this.values[a][c];this.values[a][c]=e;this.setValues(a,this.values[a]);return this};window.Color=m.exports=c},{"color-convert":3,"color-string":4}],7:[function(p,m,n){n=p("./core/core.js")();
|
||||
p("./core/core.helpers")(n);p("./core/core.element")(n);p("./core/core.animation")(n);p("./core/core.controller")(n);p("./core/core.datasetController")(n);p("./core/core.layoutService")(n);p("./core/core.legend")(n);p("./core/core.scale")(n);p("./core/core.scaleService")(n);p("./core/core.title")(n);p("./core/core.tooltip")(n);p("./controllers/controller.bar")(n);p("./controllers/controller.bubble")(n);p("./controllers/controller.doughnut")(n);p("./controllers/controller.line")(n);p("./controllers/controller.polarArea")(n);
|
||||
p("./controllers/controller.radar")(n);p("./scales/scale.category")(n);p("./scales/scale.linear")(n);p("./scales/scale.logarithmic")(n);p("./scales/scale.radialLinear")(n);p("./scales/scale.time")(n);p("./elements/element.arc")(n);p("./elements/element.line")(n);p("./elements/element.point")(n);p("./elements/element.rectangle")(n);p("./charts/Chart.Bar")(n);p("./charts/Chart.Bubble")(n);p("./charts/Chart.Doughnut")(n);p("./charts/Chart.Line")(n);p("./charts/Chart.PolarArea")(n);p("./charts/Chart.Radar")(n);
|
||||
p("./charts/Chart.Scatter")(n);window.Chart=m.exports=n},{"./charts/Chart.Bar":8,"./charts/Chart.Bubble":9,"./charts/Chart.Doughnut":10,"./charts/Chart.Line":11,"./charts/Chart.PolarArea":12,"./charts/Chart.Radar":13,"./charts/Chart.Scatter":14,"./controllers/controller.bar":15,"./controllers/controller.bubble":16,"./controllers/controller.doughnut":17,"./controllers/controller.line":18,"./controllers/controller.polarArea":19,"./controllers/controller.radar":20,"./core/core.animation":21,"./core/core.controller":22,
|
||||
"./core/core.datasetController":23,"./core/core.element":24,"./core/core.helpers":25,"./core/core.js":26,"./core/core.layoutService":27,"./core/core.legend":28,"./core/core.scale":29,"./core/core.scaleService":30,"./core/core.title":31,"./core/core.tooltip":32,"./elements/element.arc":33,"./elements/element.line":34,"./elements/element.point":35,"./elements/element.rectangle":36,"./scales/scale.category":37,"./scales/scale.linear":38,"./scales/scale.logarithmic":39,"./scales/scale.radialLinear":40,
|
||||
"./scales/scale.time":41}],8:[function(p,m,n){m.exports=function(f){f.Bar=function(e,c){c.type="bar";return new f(e,c)}}},{}],9:[function(p,m,n){m.exports=function(f){f.Bubble=function(e,c){c.type="bubble";return new f(e,c)}}},{}],10:[function(p,m,n){m.exports=function(f){f.Doughnut=function(e,c){c.type="doughnut";return new f(e,c)}}},{}],11:[function(p,m,n){m.exports=function(f){f.Line=function(e,c){c.type="line";return new f(e,c)}}},{}],12:[function(p,m,n){m.exports=function(f){f.PolarArea=function(e,
|
||||
c){c.type="polarArea";return new f(e,c)}}},{}],13:[function(p,m,n){m.exports=function(f){var e=f.helpers,c={aspectRatio:1};f.Radar=function(a,d){d.options=e.configMerge(c,d.options);d.type="radar";return new f(a,d)}}},{}],14:[function(p,m,n){m.exports=function(f){f.defaults.scatter={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-1"}],yAxes:[{type:"linear",position:"left",id:"y-axis-1"}]},tooltips:{callbacks:{title:function(e,c){return""},label:function(e,c){return"("+
|
||||
e.xLabel+", "+e.yLabel+")"}}}};f.controllers.scatter=f.controllers.line;f.Scatter=function(e,c){c.type="scatter";return new f(e,c)}}},{}],15:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.bar={hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}};f.controllers.bar=f.DatasetController.extend({initialize:function(c,a){f.DatasetController.prototype.initialize.call(this,c,a);this.getDataset().bar=
|
||||
!0},getBarCount:function(){var c=0;e.each(this.chart.data.datasets,function(a){e.isDatasetVisible(a)&&a.bar&&++c});return c},addElements:function(){this.getDataset().metaData=this.getDataset().metaData||[];e.each(this.getDataset().data,function(c,a){this.getDataset().metaData[a]=this.getDataset().metaData[a]||new f.elements.Rectangle({_chart:this.chart.chart,_datasetIndex:this.index,_index:a})},this)},addElementAndReset:function(c){this.getDataset().metaData=this.getDataset().metaData||[];var a=new f.elements.Rectangle({_chart:this.chart.chart,
|
||||
_datasetIndex:this.index,_index:c}),d=this.getBarCount();this.updateElement(a,c,!0,d);this.getDataset().metaData.splice(c,0,a)},update:function(c){var a=this.getBarCount();e.each(this.getDataset().metaData,function(d,e){this.updateElement(d,e,c,a)},this)},updateElement:function(c,a,d,h){var k=this.getScaleForId(this.getDataset().xAxisID),l=this.getScaleForId(this.getDataset().yAxisID),q;q=0>l.min&&0>l.max?l.getPixelForValue(l.max):0<l.min&&0<l.max?l.getPixelForValue(l.min):l.getPixelForValue(0);e.extend(c,
|
||||
{_chart:this.chart.chart,_xScale:k,_yScale:l,_datasetIndex:this.index,_index:a,_model:{x:this.calculateBarX(a,this.index),y:d?q:this.calculateBarY(a,this.index),label:this.chart.data.labels[a],datasetLabel:this.getDataset().label,base:d?q:this.calculateBarBase(this.index,a),width:this.calculateBarWidth(h),backgroundColor:c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.rectangle.backgroundColor),
|
||||
borderSkipped:c.custom&&c.custom.borderSkipped?c.custom.borderSkipped:this.chart.options.elements.rectangle.borderSkipped,borderColor:c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.rectangle.borderColor),borderWidth:c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.rectangle.borderWidth)}});c.pivot()},calculateBarBase:function(c,
|
||||
a){this.getScaleForId(this.getDataset().xAxisID);var d=this.getScaleForId(this.getDataset().yAxisID),h=0;if(d.options.stacked){if(0>this.chart.data.datasets[c].data[a])for(var k=0;k<c;k++){var l=this.chart.data.datasets[k];e.isDatasetVisible(l)&&l.yAxisID===d.id&&l.bar&&(h+=0>l.data[a]?l.data[a]:0)}else for(k=0;k<c;k++)l=this.chart.data.datasets[k],e.isDatasetVisible(l)&&l.yAxisID===d.id&&l.bar&&(h+=0<l.data[a]?l.data[a]:0);return d.getPixelForValue(h)}h=d.getPixelForValue(d.min);d.beginAtZero||0>=
|
||||
d.min&&0<=d.max||0<=d.min&&0>=d.max?h=d.getPixelForValue(0,0):0>d.min&&0>d.max&&(h=d.getPixelForValue(d.max));return h},getRuler:function(){var c=this.getScaleForId(this.getDataset().xAxisID);this.getScaleForId(this.getDataset().yAxisID);var a=this.getBarCount(),d;d=c.getPixelForTick(1)-c.getPixelForTick(0);for(var e=2;e<this.getDataset().data.length;e++)d=Math.min(c.getPixelForTick(e)-c.getPixelForTick(e-1),d);var e=d*c.options.categoryPercentage,k=e/a;return{datasetCount:a,tickWidth:d,categoryWidth:e,
|
||||
categorySpacing:(d-d*c.options.categoryPercentage)/2,fullBarWidth:k,barWidth:k*c.options.barPercentage,barSpacing:k-k*c.options.barPercentage}},calculateBarWidth:function(){var c=this.getScaleForId(this.getDataset().xAxisID),a=this.getRuler();return c.options.stacked?a.categoryWidth:a.barWidth},getBarIndex:function(c){for(var a=0,d=0;d<c;++d)e.isDatasetVisible(this.chart.data.datasets[d])&&this.chart.data.datasets[d].bar&&++a;return a},calculateBarX:function(c,a){this.getScaleForId(this.getDataset().yAxisID);
|
||||
var d=this.getScaleForId(this.getDataset().xAxisID),e=this.getBarIndex(a),k=this.getRuler(),l=d.getPixelForValue(null,c,a,this.chart.isCombo),l=l-(this.chart.isCombo?k.tickWidth/2:0);return d.options.stacked?l+k.categoryWidth/2+k.categorySpacing:l+k.barWidth/2+k.categorySpacing+k.barWidth*e+k.barSpacing/2+k.barSpacing*e},calculateBarY:function(c,a){this.getScaleForId(this.getDataset().xAxisID);var d=this.getScaleForId(this.getDataset().yAxisID),h=this.getDataset().data[c];if(d.options.stacked){for(var k=
|
||||
0,l=0,q=0;q<a;q++){var f=this.chart.data.datasets[q];e.isDatasetVisible(f)&&f.bar&&f.yAxisID===d.id&&(0>f.data[c]?l+=f.data[c]||0:k+=f.data[c]||0)}return 0>h?d.getPixelForValue(l+h):d.getPixelForValue(k+h)}return d.getPixelForValue(h)},draw:function(c){var a=c||1;e.each(this.getDataset().metaData,function(c,e){var k=this.getDataset().data[e];null===k||void 0===k||isNaN(k)||c.transition(a).draw()},this)},setHoverStyle:function(c){var a=this.chart.data.datasets[c._datasetIndex],d=c._index;c._model.backgroundColor=
|
||||
c.custom&&c.custom.hoverBackgroundColor?c.custom.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.hoverBackgroundColor,d,e.color(c._model.backgroundColor).saturate(.5).darken(.1).rgbString());c._model.borderColor=c.custom&&c.custom.hoverBorderColor?c.custom.hoverBorderColor:e.getValueAtIndexOrDefault(a.hoverBorderColor,d,e.color(c._model.borderColor).saturate(.5).darken(.1).rgbString());c._model.borderWidth=c.custom&&c.custom.hoverBorderWidth?c.custom.hoverBorderWidth:e.getValueAtIndexOrDefault(a.hoverBorderWidth,
|
||||
d,c._model.borderWidth)},removeHoverStyle:function(c){var a=c._index;c._model.backgroundColor=c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.rectangle.backgroundColor);c._model.borderColor=c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.rectangle.borderColor);c._model.borderWidth=c.custom&&c.custom.borderWidth?
|
||||
c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.rectangle.borderWidth)}})}},{}],16:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.bubble={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(c,a){return""},label:function(c,a){var d=a.datasets[c.datasetIndex].data[c.index];return(a.datasets[c.datasetIndex].label||
|
||||
"")+": ("+d.x+", "+d.y+", "+d.r+")"}}}};f.controllers.bubble=f.DatasetController.extend({addElements:function(){this.getDataset().metaData=this.getDataset().metaData||[];e.each(this.getDataset().data,function(c,a){this.getDataset().metaData[a]=this.getDataset().metaData[a]||new f.elements.Point({_chart:this.chart.chart,_datasetIndex:this.index,_index:a})},this)},addElementAndReset:function(c){this.getDataset().metaData=this.getDataset().metaData||[];var a=new f.elements.Point({_chart:this.chart.chart,
|
||||
_datasetIndex:this.index,_index:c});this.updateElement(a,c,!0);this.getDataset().metaData.splice(c,0,a)},update:function(c){var a=this.getDataset().metaData,d=this.getScaleForId(this.getDataset().yAxisID);this.getScaleForId(this.getDataset().xAxisID);0>d.min&&0>d.max?d.getPixelForValue(d.max):0<d.min&&0<d.max?d.getPixelForValue(d.min):d.getPixelForValue(0);e.each(a,function(a,d){this.updateElement(a,d,c)},this)},updateElement:function(c,a,d){var h=this.getScaleForId(this.getDataset().yAxisID),k=this.getScaleForId(this.getDataset().xAxisID),
|
||||
l;l=0>h.min&&0>h.max?h.getPixelForValue(h.max):0<h.min&&0<h.max?h.getPixelForValue(h.min):h.getPixelForValue(0);e.extend(c,{_chart:this.chart.chart,_xScale:k,_yScale:h,_datasetIndex:this.index,_index:a,_model:{x:d?k.getPixelForDecimal(.5):k.getPixelForValue(this.getDataset().data[a],a,this.index,this.chart.isCombo),y:d?l:h.getPixelForValue(this.getDataset().data[a],a,this.index),radius:d?0:c.custom&&c.custom.radius?c.custom.radius:this.getRadius(this.getDataset().data[a]),backgroundColor:c.custom&&
|
||||
c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.point.backgroundColor),borderColor:c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.point.borderColor),borderWidth:c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.point.borderWidth),
|
||||
hitRadius:c.custom&&c.custom.hitRadius?c.custom.hitRadius:e.getValueAtIndexOrDefault(this.getDataset().hitRadius,a,this.chart.options.elements.point.hitRadius)}});c._model.skip=c.custom&&c.custom.skip?c.custom.skip:isNaN(c._model.x)||isNaN(c._model.y);c.pivot()},getRadius:function(c){return c.r||this.chart.options.elements.point.radius},draw:function(c){var a=c||1;e.each(this.getDataset().metaData,function(c,e){c.transition(a);c.draw()})},setHoverStyle:function(c){var a=this.chart.data.datasets[c._datasetIndex],
|
||||
d=c._index;c._model.radius=c.custom&&c.custom.hoverRadius?c.custom.hoverRadius:e.getValueAtIndexOrDefault(a.hoverRadius,d,this.chart.options.elements.point.hoverRadius)+this.getRadius(this.getDataset().data[c._index]);c._model.backgroundColor=c.custom&&c.custom.hoverBackgroundColor?c.custom.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.hoverBackgroundColor,d,e.color(c._model.backgroundColor).saturate(.5).darken(.1).rgbString());c._model.borderColor=c.custom&&c.custom.hoverBorderColor?c.custom.hoverBorderColor:
|
||||
e.getValueAtIndexOrDefault(a.hoverBorderColor,d,e.color(c._model.borderColor).saturate(.5).darken(.1).rgbString());c._model.borderWidth=c.custom&&c.custom.hoverBorderWidth?c.custom.hoverBorderWidth:e.getValueAtIndexOrDefault(a.hoverBorderWidth,d,c._model.borderWidth)},removeHoverStyle:function(c){var a=c._index;c._model.radius=c.custom&&c.custom.radius?c.custom.radius:this.getRadius(this.getDataset().data[c._index]);c._model.backgroundColor=c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:
|
||||
e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.point.backgroundColor);c._model.borderColor=c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.point.borderColor);c._model.borderWidth=c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.point.borderWidth)}})}},{}],17:[function(p,m,n){m.exports=
|
||||
function(f){var e=f.helpers;f.defaults.doughnut={animation:{animateRotate:!0,animateScale:!1},aspectRatio:1,hover:{mode:"single"},legendCallback:function(c){var a=[];a.push('<ul class="'+c.id+'-legend">');if(c.data.datasets.length)for(var d=0;d<c.data.datasets[0].data.length;++d)a.push('<li><span style="background-color:'+c.data.datasets[0].backgroundColor[d]+'">'),c.data.labels[d]&&a.push(c.data.labels[d]),a.push("</span></li>");a.push("</ul>");return a.join("")},legend:{labels:{generateLabels:function(c){return c.labels.length&&
|
||||
c.datasets.length?c.labels.map(function(a,d){return{text:a,fillStyle:c.datasets[0].backgroundColor[d],hidden:isNaN(c.datasets[0].data[d]),index:d}}):[]}},onClick:function(c,a){e.each(this.chart.data.datasets,function(c){c.metaHiddenData=c.metaHiddenData||[];var e=a.index;isNaN(c.data[e])?isNaN(c.metaHiddenData[e])||(c.data[e]=c.metaHiddenData[e]):(c.metaHiddenData[e]=c.data[e],c.data[e]=NaN)});this.chart.update()}},cutoutPercentage:50,rotation:-.5*Math.PI,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},
|
||||
label:function(c,a){return a.labels[c.index]+": "+a.datasets[c.datasetIndex].data[c.index]}}}};f.defaults.pie=e.clone(f.defaults.doughnut);e.extend(f.defaults.pie,{cutoutPercentage:0});f.controllers.doughnut=f.controllers.pie=f.DatasetController.extend({linkScales:function(){},addElements:function(){this.getDataset().metaData=this.getDataset().metaData||[];e.each(this.getDataset().data,function(c,a){this.getDataset().metaData[a]=this.getDataset().metaData[a]||new f.elements.Arc({_chart:this.chart.chart,
|
||||
_datasetIndex:this.index,_index:a})},this)},addElementAndReset:function(c,a){this.getDataset().metaData=this.getDataset().metaData||[];var d=new f.elements.Arc({_chart:this.chart.chart,_datasetIndex:this.index,_index:c});a&&e.isArray(this.getDataset().backgroundColor)&&this.getDataset().backgroundColor.splice(c,0,a);this.updateElement(d,c,!0);this.getDataset().metaData.splice(c,0,d)},getVisibleDatasetCount:function(){return e.where(this.chart.data.datasets,function(c){return e.isDatasetVisible(c)}).length},
|
||||
getRingIndex:function(c){for(var a=0,d=0;d<c;++d)e.isDatasetVisible(this.chart.data.datasets[d])&&++a;return a},update:function(c){var a=this.chart.chartArea.right-this.chart.chartArea.left-this.chart.options.elements.arc.borderWidth,d=this.chart.chartArea.bottom-this.chart.chartArea.top-this.chart.options.elements.arc.borderWidth,h=Math.min(a,d),k=0,l=0;if(this.chart.options.circumference&&this.chart.options.circumference<2*Math.PI)var h=this.chart.options.rotation%(2*Math.PI),h=h+2*Math.PI*(h>=
|
||||
Math.PI?-1:h<-Math.PI?1:0),q=h+this.chart.options.circumference,f=Math.cos(h),w=Math.sin(h),x=Math.cos(q),u=Math.sin(q),m=this.chart.options.cutoutPercentage/100,k=h<=-Math.PI&&-Math.PI<=q||h<=Math.PI&&Math.PI<=q?-1:Math.min(f*(0>f?1:m),x*(0>x?1:m)),l=h<=.5*-Math.PI&&.5*-Math.PI<=q||h<=1.5*Math.PI&&1.5*Math.PI<=q?-1:Math.min(w*(0>w?1:m),u*(0>u?1:m)),f=0>=h&&0<=q||h<=2*Math.PI&&2*Math.PI<=q?1:Math.max(f*(0<f?1:m),x*(0<x?1:m)),q=h<=.5*Math.PI&&.5*Math.PI<=q||h<=2.5*Math.PI&&2.5*Math.PI<=q?1:Math.max(w*
|
||||
(0<w?1:m),u*(0<u?1:m)),h=Math.min(a/(.5*(f-k)),d/(.5*(q-l))),k=-.5*(f+k),l=-.5*(q+l);this.chart.outerRadius=Math.max(h/2,0);this.chart.innerRadius=Math.max(this.chart.options.cutoutPercentage?this.chart.outerRadius/100*this.chart.options.cutoutPercentage:1,0);this.chart.radiusLength=(this.chart.outerRadius-this.chart.innerRadius)/this.getVisibleDatasetCount();this.chart.offsetX=k*this.chart.outerRadius;this.chart.offsetY=l*this.chart.outerRadius;this.getDataset().total=0;e.each(this.getDataset().data,
|
||||
function(a){isNaN(a)||(this.getDataset().total+=Math.abs(a))},this);this.outerRadius=this.chart.outerRadius-this.chart.radiusLength*this.getRingIndex(this.index);this.innerRadius=this.outerRadius-this.chart.radiusLength;e.each(this.getDataset().metaData,function(a,d){this.updateElement(a,d,c)},this)},updateElement:function(c,a,d){var h=(this.chart.chartArea.left+this.chart.chartArea.right)/2,k=(this.chart.chartArea.top+this.chart.chartArea.bottom)/2,l=this.chart.options.rotation||-.5*Math.PI,q=this.chart.options.rotation||
|
||||
-.5*Math.PI,f=d&&this.chart.options.animation.animateRotate?0:this.calculateCircumference(this.getDataset().data[a])*((this.chart.options.circumference||2*Math.PI)/(2*Math.PI));e.extend(c,{_chart:this.chart.chart,_datasetIndex:this.index,_index:a,_model:{x:h+this.chart.offsetX,y:k+this.chart.offsetY,startAngle:l,endAngle:q,circumference:f,outerRadius:d&&this.chart.options.animation.animateScale?0:this.outerRadius,innerRadius:d&&this.chart.options.animation.animateScale?0:this.innerRadius,backgroundColor:c.custom&&
|
||||
c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.arc.backgroundColor),hoverBackgroundColor:c.custom&&c.custom.hoverBackgroundColor?c.custom.hoverBackgroundColor:e.getValueAtIndexOrDefault(this.getDataset().hoverBackgroundColor,a,this.chart.options.elements.arc.hoverBackgroundColor),borderWidth:c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.arc.borderWidth),
|
||||
borderColor:c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.arc.borderColor),label:e.getValueAtIndexOrDefault(this.getDataset().label,a,this.chart.data.labels[a])}});d||(c._model.startAngle=0===a?this.chart.options.rotation||-.5*Math.PI:this.getDataset().metaData[a-1]._model.endAngle,c._model.endAngle=c._model.startAngle+c._model.circumference);c.pivot()},draw:function(c){var a=c||1;e.each(this.getDataset().metaData,
|
||||
function(c,e){c.transition(a).draw()})},setHoverStyle:function(c){var a=this.chart.data.datasets[c._datasetIndex],d=c._index;c._model.backgroundColor=c.custom&&c.custom.hoverBackgroundColor?c.custom.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.hoverBackgroundColor,d,e.color(c._model.backgroundColor).saturate(.5).darken(.1).rgbString());c._model.borderColor=c.custom&&c.custom.hoverBorderColor?c.custom.hoverBorderColor:e.getValueAtIndexOrDefault(a.hoverBorderColor,d,e.color(c._model.borderColor).saturate(.5).darken(.1).rgbString());
|
||||
c._model.borderWidth=c.custom&&c.custom.hoverBorderWidth?c.custom.hoverBorderWidth:e.getValueAtIndexOrDefault(a.hoverBorderWidth,d,c._model.borderWidth)},removeHoverStyle:function(c){var a=c._index;c._model.backgroundColor=c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.arc.backgroundColor);c._model.borderColor=c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,
|
||||
a,this.chart.options.elements.arc.borderColor);c._model.borderWidth=c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.arc.borderWidth)},calculateCircumference:function(c){return 0<this.getDataset().total&&!isNaN(c)?1.999999*Math.PI*(c/this.getDataset().total):0}})}},{}],18:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.line={showLines:!0,hover:{mode:"label"},scales:{xAxes:[{type:"category",
|
||||
id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}};f.controllers.line=f.DatasetController.extend({addElements:function(){this.getDataset().metaData=this.getDataset().metaData||[];this.getDataset().metaDataset=this.getDataset().metaDataset||new f.elements.Line({_chart:this.chart.chart,_datasetIndex:this.index,_points:this.getDataset().metaData});e.each(this.getDataset().data,function(c,a){this.getDataset().metaData[a]=this.getDataset().metaData[a]||new f.elements.Point({_chart:this.chart.chart,
|
||||
_datasetIndex:this.index,_index:a})},this)},addElementAndReset:function(c){this.getDataset().metaData=this.getDataset().metaData||[];var a=new f.elements.Point({_chart:this.chart.chart,_datasetIndex:this.index,_index:c});this.updateElement(a,c,!0);this.getDataset().metaData.splice(c,0,a);this.chart.options.showLines&&0!==this.chart.options.elements.line.tension&&this.updateBezierControlPoints()},update:function(c){var a=this.getDataset().metaDataset,d=this.getDataset().metaData,h=this.getScaleForId(this.getDataset().yAxisID);
|
||||
this.getScaleForId(this.getDataset().xAxisID);var k;k=0>h.min&&0>h.max?h.getPixelForValue(h.max):0<h.min&&0<h.max?h.getPixelForValue(h.min):h.getPixelForValue(0);this.chart.options.showLines&&(a._scale=h,a._datasetIndex=this.index,a._children=d,a._model={tension:a.custom&&a.custom.tension?a.custom.tension:e.getValueOrDefault(this.getDataset().tension,this.chart.options.elements.line.tension),backgroundColor:a.custom&&a.custom.backgroundColor?a.custom.backgroundColor:this.getDataset().backgroundColor||
|
||||
this.chart.options.elements.line.backgroundColor,borderWidth:a.custom&&a.custom.borderWidth?a.custom.borderWidth:this.getDataset().borderWidth||this.chart.options.elements.line.borderWidth,borderColor:a.custom&&a.custom.borderColor?a.custom.borderColor:this.getDataset().borderColor||this.chart.options.elements.line.borderColor,borderCapStyle:a.custom&&a.custom.borderCapStyle?a.custom.borderCapStyle:this.getDataset().borderCapStyle||this.chart.options.elements.line.borderCapStyle,borderDash:a.custom&&
|
||||
a.custom.borderDash?a.custom.borderDash:this.getDataset().borderDash||this.chart.options.elements.line.borderDash,borderDashOffset:a.custom&&a.custom.borderDashOffset?a.custom.borderDashOffset:this.getDataset().borderDashOffset||this.chart.options.elements.line.borderDashOffset,borderJoinStyle:a.custom&&a.custom.borderJoinStyle?a.custom.borderJoinStyle:this.getDataset().borderJoinStyle||this.chart.options.elements.line.borderJoinStyle,fill:a.custom&&a.custom.fill?a.custom.fill:void 0!==this.getDataset().fill?
|
||||
this.getDataset().fill:this.chart.options.elements.line.fill,scaleTop:h.top,scaleBottom:h.bottom,scaleZero:k},a.pivot());e.each(d,function(a,d){this.updateElement(a,d,c)},this);this.chart.options.showLines&&0!==this.chart.options.elements.line.tension&&this.updateBezierControlPoints()},getPointBackgroundColor:function(c,a){var d=this.chart.options.elements.point.backgroundColor,h=this.getDataset();c.custom&&c.custom.backgroundColor?d=c.custom.backgroundColor:h.pointBackgroundColor?d=e.getValueAtIndexOrDefault(h.pointBackgroundColor,
|
||||
a,d):h.backgroundColor&&(d=h.backgroundColor);return d},getPointBorderColor:function(c,a){var d=this.chart.options.elements.point.borderColor,h=this.getDataset();c.custom&&c.custom.borderColor?d=c.custom.borderColor:h.pointBorderColor?d=e.getValueAtIndexOrDefault(this.getDataset().pointBorderColor,a,d):h.borderColor&&(d=h.borderColor);return d},getPointBorderWidth:function(c,a){var d=this.chart.options.elements.point.borderWidth,h=this.getDataset();c.custom&&void 0!==c.custom.borderWidth?d=c.custom.borderWidth:
|
||||
void 0!==h.pointBorderWidth?d=e.getValueAtIndexOrDefault(h.pointBorderWidth,a,d):void 0!==h.borderWidth&&(d=h.borderWidth);return d},updateElement:function(c,a,d){var h=this.getScaleForId(this.getDataset().yAxisID),k=this.getScaleForId(this.getDataset().xAxisID),l;l=0>h.min&&0>h.max?h.getPixelForValue(h.max):0<h.min&&0<h.max?h.getPixelForValue(h.min):h.getPixelForValue(0);c._chart=this.chart.chart;c._xScale=k;c._yScale=h;c._datasetIndex=this.index;c._index=a;c._model={x:k.getPixelForValue(this.getDataset().data[a],
|
||||
a,this.index,this.chart.isCombo),y:d?l:this.calculatePointY(this.getDataset().data[a],a,this.index,this.chart.isCombo),tension:c.custom&&c.custom.tension?c.custom.tension:e.getValueOrDefault(this.getDataset().tension,this.chart.options.elements.line.tension),radius:c.custom&&c.custom.radius?c.custom.radius:e.getValueAtIndexOrDefault(this.getDataset().radius,a,this.chart.options.elements.point.radius),pointStyle:c.custom&&c.custom.pointStyle?c.custom.pointStyle:e.getValueAtIndexOrDefault(this.getDataset().pointStyle,
|
||||
a,this.chart.options.elements.point.pointStyle),backgroundColor:this.getPointBackgroundColor(c,a),borderColor:this.getPointBorderColor(c,a),borderWidth:this.getPointBorderWidth(c,a),hitRadius:c.custom&&c.custom.hitRadius?c.custom.hitRadius:e.getValueAtIndexOrDefault(this.getDataset().hitRadius,a,this.chart.options.elements.point.hitRadius)};c._model.skip=c.custom&&c.custom.skip?c.custom.skip:isNaN(c._model.x)||isNaN(c._model.y)},calculatePointY:function(c,a,d,h){this.getScaleForId(this.getDataset().xAxisID);
|
||||
h=this.getScaleForId(this.getDataset().yAxisID);if(h.options.stacked){for(var k=0,l=0,q=0;q<d;q++){var f=this.chart.data.datasets[q];"line"===f.type&&e.isDatasetVisible(f)&&(0>f.data[a]?l+=f.data[a]||0:k+=f.data[a]||0)}return 0>c?h.getPixelForValue(l+c):h.getPixelForValue(k+c)}return h.getPixelForValue(c)},updateBezierControlPoints:function(){e.each(this.getDataset().metaData,function(c,a){var d=e.splineCurve(e.previousItem(this.getDataset().metaData,a)._model,c._model,e.nextItem(this.getDataset().metaData,
|
||||
a)._model,c._model.tension);c._model.controlPointPreviousX=Math.max(Math.min(d.previous.x,this.chart.chartArea.right),this.chart.chartArea.left);c._model.controlPointPreviousY=Math.max(Math.min(d.previous.y,this.chart.chartArea.bottom),this.chart.chartArea.top);c._model.controlPointNextX=Math.max(Math.min(d.next.x,this.chart.chartArea.right),this.chart.chartArea.left);c._model.controlPointNextY=Math.max(Math.min(d.next.y,this.chart.chartArea.bottom),this.chart.chartArea.top);c.pivot()},this)},draw:function(c){var a=
|
||||
c||1;e.each(this.getDataset().metaData,function(c){c.transition(a)});this.chart.options.showLines&&this.getDataset().metaDataset.transition(a).draw();e.each(this.getDataset().metaData,function(a){a.draw()})},setHoverStyle:function(c){var a=this.chart.data.datasets[c._datasetIndex],d=c._index;c._model.radius=c.custom&&c.custom.hoverRadius?c.custom.hoverRadius:e.getValueAtIndexOrDefault(a.pointHoverRadius,d,this.chart.options.elements.point.hoverRadius);c._model.backgroundColor=c.custom&&c.custom.hoverBackgroundColor?
|
||||
c.custom.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.pointHoverBackgroundColor,d,e.color(c._model.backgroundColor).saturate(.5).darken(.1).rgbString());c._model.borderColor=c.custom&&c.custom.hoverBorderColor?c.custom.hoverBorderColor:e.getValueAtIndexOrDefault(a.pointHoverBorderColor,d,e.color(c._model.borderColor).saturate(.5).darken(.1).rgbString());c._model.borderWidth=c.custom&&c.custom.hoverBorderWidth?c.custom.hoverBorderWidth:e.getValueAtIndexOrDefault(a.pointHoverBorderWidth,d,c._model.borderWidth)},
|
||||
removeHoverStyle:function(c){var a=c._index;c._model.radius=c.custom&&c.custom.radius?c.custom.radius:e.getValueAtIndexOrDefault(this.getDataset().radius,a,this.chart.options.elements.point.radius);c._model.backgroundColor=this.getPointBackgroundColor(c,a);c._model.borderColor=this.getPointBorderColor(c,a);c._model.borderWidth=this.getPointBorderWidth(c,a)}})}},{}],19:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.polarArea={scale:{type:"radialLinear",lineArc:!0},animateRotate:!0,
|
||||
animateScale:!0,aspectRatio:1,legendCallback:function(c){var a=[];a.push('<ul class="'+c.id+'-legend">');if(c.data.datasets.length)for(var d=0;d<c.data.datasets[0].data.length;++d)a.push('<li><span style="background-color:'+c.data.datasets[0].backgroundColor[d]+'">'),c.data.labels[d]&&a.push(c.data.labels[d]),a.push("</span></li>");a.push("</ul>");return a.join("")},legend:{labels:{generateLabels:function(c){return c.labels.length&&c.datasets.length?c.labels.map(function(a,d){return{text:a,fillStyle:c.datasets[0].backgroundColor[d],
|
||||
hidden:isNaN(c.datasets[0].data[d]),index:d}}):[]}},onClick:function(c,a){e.each(this.chart.data.datasets,function(c){c.metaHiddenData=c.metaHiddenData||[];var e=a.index;isNaN(c.data[e])?isNaN(c.metaHiddenData[e])||(c.data[e]=c.metaHiddenData[e]):(c.metaHiddenData[e]=c.data[e],c.data[e]=NaN)});this.chart.update()}},tooltips:{callbacks:{title:function(){return""},label:function(c,a){return a.labels[c.index]+": "+c.yLabel}}}};f.controllers.polarArea=f.DatasetController.extend({linkScales:function(){},
|
||||
addElements:function(){this.getDataset().metaData=this.getDataset().metaData||[];e.each(this.getDataset().data,function(c,a){this.getDataset().metaData[a]=this.getDataset().metaData[a]||new f.elements.Arc({_chart:this.chart.chart,_datasetIndex:this.index,_index:a})},this)},addElementAndReset:function(c){this.getDataset().metaData=this.getDataset().metaData||[];var a=new f.elements.Arc({_chart:this.chart.chart,_datasetIndex:this.index,_index:c});this.updateElement(a,c,!0);this.getDataset().metaData.splice(c,
|
||||
0,a)},getVisibleDatasetCount:function(){return e.where(this.chart.data.datasets,function(c){return e.isDatasetVisible(c)}).length},update:function(c){this.chart.outerRadius=Math.max((Math.min(this.chart.chartArea.right-this.chart.chartArea.left,this.chart.chartArea.bottom-this.chart.chartArea.top)-this.chart.options.elements.arc.borderWidth/2)/2,0);this.chart.innerRadius=Math.max(this.chart.options.cutoutPercentage?this.chart.outerRadius/100*this.chart.options.cutoutPercentage:1,0);this.chart.radiusLength=
|
||||
(this.chart.outerRadius-this.chart.innerRadius)/this.getVisibleDatasetCount();this.getDataset().total=0;e.each(this.getDataset().data,function(a){this.getDataset().total+=Math.abs(a)},this);this.outerRadius=this.chart.outerRadius-this.chart.radiusLength*this.index;this.innerRadius=this.outerRadius-this.chart.radiusLength;e.each(this.getDataset().metaData,function(a,d){this.updateElement(a,d,c)},this)},updateElement:function(c,a,d){for(var h=this.calculateCircumference(this.getDataset().data[a]),k=
|
||||
(this.chart.chartArea.left+this.chart.chartArea.right)/2,l=(this.chart.chartArea.top+this.chart.chartArea.bottom)/2,q=0,f=0;f<a;++f)isNaN(this.getDataset().data[f])||++q;q=-.5*Math.PI+h*q;h=q+h;f={x:k,y:l,innerRadius:0,outerRadius:this.chart.options.animateScale?0:this.chart.scale.getDistanceFromCenterForValue(this.getDataset().data[a]),startAngle:this.chart.options.animateRotate?-.5*Math.PI:q,endAngle:this.chart.options.animateRotate?-.5*Math.PI:h,backgroundColor:c.custom&&c.custom.backgroundColor?
|
||||
c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.arc.backgroundColor),borderWidth:c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.arc.borderWidth),borderColor:c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.arc.borderColor),label:e.getValueAtIndexOrDefault(this.chart.data.labels,
|
||||
a,this.chart.data.labels[a])};e.extend(c,{_chart:this.chart.chart,_datasetIndex:this.index,_index:a,_scale:this.chart.scale,_model:d?f:{x:k,y:l,innerRadius:0,outerRadius:this.chart.scale.getDistanceFromCenterForValue(this.getDataset().data[a]),startAngle:q,endAngle:h,backgroundColor:c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.arc.backgroundColor),borderWidth:c.custom&&c.custom.borderWidth?c.custom.borderWidth:
|
||||
e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.arc.borderWidth),borderColor:c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.arc.borderColor),label:e.getValueAtIndexOrDefault(this.chart.data.labels,a,this.chart.data.labels[a])}});c.pivot()},draw:function(c){var a=c||1;e.each(this.getDataset().metaData,function(c,e){c.transition(a).draw()})},setHoverStyle:function(c){var a=
|
||||
this.chart.data.datasets[c._datasetIndex],d=c._index;c._model.backgroundColor=c.custom&&c.custom.hoverBackgroundColor?c.custom.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.hoverBackgroundColor,d,e.color(c._model.backgroundColor).saturate(.5).darken(.1).rgbString());c._model.borderColor=c.custom&&c.custom.hoverBorderColor?c.custom.hoverBorderColor:e.getValueAtIndexOrDefault(a.hoverBorderColor,d,e.color(c._model.borderColor).saturate(.5).darken(.1).rgbString());c._model.borderWidth=c.custom&&c.custom.hoverBorderWidth?
|
||||
c.custom.hoverBorderWidth:e.getValueAtIndexOrDefault(a.hoverBorderWidth,d,c._model.borderWidth)},removeHoverStyle:function(c){var a=c._index;c._model.backgroundColor=c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().backgroundColor,a,this.chart.options.elements.arc.backgroundColor);c._model.borderColor=c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().borderColor,a,this.chart.options.elements.arc.borderColor);
|
||||
c._model.borderWidth=c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().borderWidth,a,this.chart.options.elements.arc.borderWidth)},calculateCircumference:function(c){if(isNaN(c))return 0;c=e.where(this.getDataset().data,function(a){return isNaN(a)}).length;return 2*Math.PI/(this.getDataset().data.length-c)}})}},{}],20:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.radar={scale:{type:"radialLinear"},elements:{line:{tension:0}}};f.controllers.radar=
|
||||
f.DatasetController.extend({linkScales:function(){},addElements:function(){this.getDataset().metaData=this.getDataset().metaData||[];this.getDataset().metaDataset=this.getDataset().metaDataset||new f.elements.Line({_chart:this.chart.chart,_datasetIndex:this.index,_points:this.getDataset().metaData,_loop:!0});e.each(this.getDataset().data,function(c,a){this.getDataset().metaData[a]=this.getDataset().metaData[a]||new f.elements.Point({_chart:this.chart.chart,_datasetIndex:this.index,_index:a,_model:{x:0,
|
||||
y:0}})},this)},addElementAndReset:function(c){this.getDataset().metaData=this.getDataset().metaData||[];var a=new f.elements.Point({_chart:this.chart.chart,_datasetIndex:this.index,_index:c});this.updateElement(a,c,!0);this.getDataset().metaData.splice(c,0,a);this.updateBezierControlPoints()},update:function(c){var a=this.getDataset().metaDataset,d=this.getDataset().metaData,h=this.chart.scale,k;k=0>h.min&&0>h.max?h.getPointPositionForValue(0,h.max):0<h.min&&0<h.max?h.getPointPositionForValue(0,h.min):
|
||||
h.getPointPositionForValue(0,0);e.extend(this.getDataset().metaDataset,{_datasetIndex:this.index,_children:this.getDataset().metaData,_model:{tension:a.custom&&a.custom.tension?a.custom.tension:e.getValueOrDefault(this.getDataset().tension,this.chart.options.elements.line.tension),backgroundColor:a.custom&&a.custom.backgroundColor?a.custom.backgroundColor:this.getDataset().backgroundColor||this.chart.options.elements.line.backgroundColor,borderWidth:a.custom&&a.custom.borderWidth?a.custom.borderWidth:
|
||||
this.getDataset().borderWidth||this.chart.options.elements.line.borderWidth,borderColor:a.custom&&a.custom.borderColor?a.custom.borderColor:this.getDataset().borderColor||this.chart.options.elements.line.borderColor,fill:a.custom&&a.custom.fill?a.custom.fill:void 0!==this.getDataset().fill?this.getDataset().fill:this.chart.options.elements.line.fill,borderCapStyle:a.custom&&a.custom.borderCapStyle?a.custom.borderCapStyle:this.getDataset().borderCapStyle||this.chart.options.elements.line.borderCapStyle,
|
||||
borderDash:a.custom&&a.custom.borderDash?a.custom.borderDash:this.getDataset().borderDash||this.chart.options.elements.line.borderDash,borderDashOffset:a.custom&&a.custom.borderDashOffset?a.custom.borderDashOffset:this.getDataset().borderDashOffset||this.chart.options.elements.line.borderDashOffset,borderJoinStyle:a.custom&&a.custom.borderJoinStyle?a.custom.borderJoinStyle:this.getDataset().borderJoinStyle||this.chart.options.elements.line.borderJoinStyle,scaleTop:h.top,scaleBottom:h.bottom,scaleZero:k}});
|
||||
this.getDataset().metaDataset.pivot();e.each(d,function(a,d){this.updateElement(a,d,c)},this);this.updateBezierControlPoints()},updateElement:function(c,a,d){var h=this.chart.scale.getPointPositionForValue(a,this.getDataset().data[a]);e.extend(c,{_datasetIndex:this.index,_index:a,_scale:this.chart.scale,_model:{x:d?this.chart.scale.xCenter:h.x,y:d?this.chart.scale.yCenter:h.y,tension:c.custom&&c.custom.tension?c.custom.tension:e.getValueOrDefault(this.getDataset().tension,this.chart.options.elements.line.tension),
|
||||
radius:c.custom&&c.custom.radius?c.custom.radius:e.getValueAtIndexOrDefault(this.getDataset().pointRadius,a,this.chart.options.elements.point.radius),backgroundColor:c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().pointBackgroundColor,a,this.chart.options.elements.point.backgroundColor),borderColor:c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().pointBorderColor,a,this.chart.options.elements.point.borderColor),
|
||||
borderWidth:c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().pointBorderWidth,a,this.chart.options.elements.point.borderWidth),pointStyle:c.custom&&c.custom.pointStyle?c.custom.pointStyle:e.getValueAtIndexOrDefault(this.getDataset().pointStyle,a,this.chart.options.elements.point.pointStyle),hitRadius:c.custom&&c.custom.hitRadius?c.custom.hitRadius:e.getValueAtIndexOrDefault(this.getDataset().hitRadius,a,this.chart.options.elements.point.hitRadius)}});
|
||||
c._model.skip=c.custom&&c.custom.skip?c.custom.skip:isNaN(c._model.x)||isNaN(c._model.y)},updateBezierControlPoints:function(){e.each(this.getDataset().metaData,function(c,a){var d=e.splineCurve(e.previousItem(this.getDataset().metaData,a,!0)._model,c._model,e.nextItem(this.getDataset().metaData,a,!0)._model,c._model.tension);c._model.controlPointPreviousX=Math.max(Math.min(d.previous.x,this.chart.chartArea.right),this.chart.chartArea.left);c._model.controlPointPreviousY=Math.max(Math.min(d.previous.y,
|
||||
this.chart.chartArea.bottom),this.chart.chartArea.top);c._model.controlPointNextX=Math.max(Math.min(d.next.x,this.chart.chartArea.right),this.chart.chartArea.left);c._model.controlPointNextY=Math.max(Math.min(d.next.y,this.chart.chartArea.bottom),this.chart.chartArea.top);c.pivot()},this)},draw:function(c){var a=c||1;e.each(this.getDataset().metaData,function(c,e){c.transition(a)});this.getDataset().metaDataset.transition(a).draw();e.each(this.getDataset().metaData,function(a){a.draw()})},setHoverStyle:function(c){var a=
|
||||
this.chart.data.datasets[c._datasetIndex],d=c._index;c._model.radius=c.custom&&c.custom.hoverRadius?c.custom.hoverRadius:e.getValueAtIndexOrDefault(a.pointHoverRadius,d,this.chart.options.elements.point.hoverRadius);c._model.backgroundColor=c.custom&&c.custom.hoverBackgroundColor?c.custom.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.pointHoverBackgroundColor,d,e.color(c._model.backgroundColor).saturate(.5).darken(.1).rgbString());c._model.borderColor=c.custom&&c.custom.hoverBorderColor?c.custom.hoverBorderColor:
|
||||
e.getValueAtIndexOrDefault(a.pointHoverBorderColor,d,e.color(c._model.borderColor).saturate(.5).darken(.1).rgbString());c._model.borderWidth=c.custom&&c.custom.hoverBorderWidth?c.custom.hoverBorderWidth:e.getValueAtIndexOrDefault(a.pointHoverBorderWidth,d,c._model.borderWidth)},removeHoverStyle:function(c){var a=c._index;c._model.radius=c.custom&&c.custom.radius?c.custom.radius:e.getValueAtIndexOrDefault(this.getDataset().radius,a,this.chart.options.elements.point.radius);c._model.backgroundColor=
|
||||
c.custom&&c.custom.backgroundColor?c.custom.backgroundColor:e.getValueAtIndexOrDefault(this.getDataset().pointBackgroundColor,a,this.chart.options.elements.point.backgroundColor);c._model.borderColor=c.custom&&c.custom.borderColor?c.custom.borderColor:e.getValueAtIndexOrDefault(this.getDataset().pointBorderColor,a,this.chart.options.elements.point.borderColor);c._model.borderWidth=c.custom&&c.custom.borderWidth?c.custom.borderWidth:e.getValueAtIndexOrDefault(this.getDataset().pointBorderWidth,a,this.chart.options.elements.point.borderWidth)}})}},
|
||||
{}],21:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.global.animation={duration:1E3,easing:"easeOutQuart",onProgress:e.noop,onComplete:e.noop};f.Animation=f.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null});f.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(c,a,d,e){e||(c.animating=!0);for(d=0;d<this.animations.length;++d)if(this.animations[d].chartInstance===c){this.animations[d].animationObject=
|
||||
a;return}this.animations.push({chartInstance:c,animationObject:a});1===this.animations.length&&this.requestAnimationFrame()},cancelAnimation:function(c){var a=e.findIndex(this.animations,function(a){return a.chartInstance===c});-1!==a&&(this.animations.splice(a,1),c.animating=!1)},requestAnimationFrame:function(){var c=this;null===c.request&&(c.request=e.requestAnimFrame.call(window,function(){c.request=null;c.startDigest()}))},startDigest:function(){var c=Date.now(),a=0;1<this.dropFrames&&(a=Math.floor(this.dropFrames),
|
||||
this.dropFrames%=1);for(var d=0;d<this.animations.length;)null===this.animations[d].animationObject.currentStep&&(this.animations[d].animationObject.currentStep=0),this.animations[d].animationObject.currentStep+=1+a,this.animations[d].animationObject.currentStep>this.animations[d].animationObject.numSteps&&(this.animations[d].animationObject.currentStep=this.animations[d].animationObject.numSteps),this.animations[d].animationObject.render(this.animations[d].chartInstance,this.animations[d].animationObject),
|
||||
this.animations[d].animationObject.onAnimationProgress&&this.animations[d].animationObject.onAnimationProgress.call&&this.animations[d].animationObject.onAnimationProgress.call(this.animations[d].chartInstance,this.animations[d]),this.animations[d].animationObject.currentStep===this.animations[d].animationObject.numSteps?(this.animations[d].animationObject.onAnimationComplete&&this.animations[d].animationObject.onAnimationComplete.call&&this.animations[d].animationObject.onAnimationComplete.call(this.animations[d].chartInstance,
|
||||
this.animations[d]),this.animations[d].chartInstance.animating=!1,this.animations.splice(d,1)):++d;c=(Date.now()-c)/this.frameDuration;this.dropFrames+=c;0<this.animations.length&&this.requestAnimationFrame()}}}},{}],22:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.types={};f.instances={};f.controllers={};f.Controller=function(c){this.chart=c;this.config=c.config;this.options=this.config.options=e.configMerge(f.defaults.global,f.defaults[this.config.type],this.config.options||{});this.id=
|
||||
e.uid();Object.defineProperty(this,"data",{get:function(){return this.config.data}});f.instances[this.id]=this;this.options.responsive&&this.resize(!0);this.initialize();return this};e.extend(f.Controller.prototype,{initialize:function(){this.bindEvents();this.ensureScalesHaveIDs();this.buildOrUpdateControllers();this.buildScales();this.buildSurroundingItems();this.updateLayout();this.resetElements();this.initToolTip();this.update();return this},clear:function(){e.clear(this.chart);return this},stop:function(){f.animationService.cancelAnimation(this);
|
||||
return this},resize:function(c){var a=this.chart.canvas,d=e.getMaximumWidth(this.chart.canvas),h=this.options.maintainAspectRatio&&!1===isNaN(this.chart.aspectRatio)&&isFinite(this.chart.aspectRatio)&&0!==this.chart.aspectRatio?d/this.chart.aspectRatio:e.getMaximumHeight(this.chart.canvas);if(this.chart.width===d&&this.chart.height===h)return this;a.width=this.chart.width=d;a.height=this.chart.height=h;e.retinaScale(this.chart);c||(this.stop(),this.update(this.options.responsiveAnimationDuration));
|
||||
return this},ensureScalesHaveIDs:function(){this.options.scales&&(this.options.scales.xAxes&&this.options.scales.xAxes.length&&e.each(this.options.scales.xAxes,function(c,a){c.id=c.id||"x-axis-"+a}),this.options.scales.yAxes&&this.options.scales.yAxes.length&&e.each(this.options.scales.yAxes,function(c,a){c.id=c.id||"y-axis-"+a}))},buildScales:function(){this.scales={};this.options.scales&&(this.options.scales.xAxes&&this.options.scales.xAxes.length&&e.each(this.options.scales.xAxes,function(a,c){var h=
|
||||
e.getValueOrDefault(a.type,"category");if(h=f.scaleService.getScaleConstructor(h))h=new h({ctx:this.chart.ctx,options:a,chart:this,id:a.id}),this.scales[h.id]=h},this),this.options.scales.yAxes&&this.options.scales.yAxes.length&&e.each(this.options.scales.yAxes,function(a,c){var h=e.getValueOrDefault(a.type,"linear");if(h=f.scaleService.getScaleConstructor(h))h=new h({ctx:this.chart.ctx,options:a,chart:this,id:a.id}),this.scales[h.id]=h},this));if(this.options.scale){var c=f.scaleService.getScaleConstructor(this.options.scale.type);
|
||||
c&&(this.scale=c=new c({ctx:this.chart.ctx,options:this.options.scale,chart:this}),this.scales.radialScale=c)}f.scaleService.addScalesToLayout(this)},buildSurroundingItems:function(){this.options.title&&(this.titleBlock=new f.Title({ctx:this.chart.ctx,options:this.options.title,chart:this}),f.layoutService.addBox(this,this.titleBlock));this.options.legend&&(this.legend=new f.Legend({ctx:this.chart.ctx,options:this.options.legend,chart:this}),f.layoutService.addBox(this,this.legend))},updateLayout:function(){f.layoutService.update(this,
|
||||
this.chart.width,this.chart.height)},buildOrUpdateControllers:function(){var c=[],a=[];e.each(this.data.datasets,function(d,k){d.type||(d.type=this.config.type);var e=d.type;c.push(e);d.controller?d.controller.updateIndex(k):(d.controller=new f.controllers[e](this,k),a.push(d.controller))},this);if(1<c.length)for(var d=1;d<c.length;d++)if(c[d]!==c[d-1]){this.isCombo=!0;break}return a},resetElements:function(){e.each(this.data.datasets,function(c,a){c.controller.reset()})},update:function(c,a){this.tooltip._data=
|
||||
this.data;var d=this.buildOrUpdateControllers();f.layoutService.update(this,this.chart.width,this.chart.height);e.each(d,function(a){a.reset()});e.each(this.data.datasets,function(a,c){a.controller.buildOrUpdateElements()});e.each(this.data.datasets,function(a,c){a.controller.update()});this.render(c,a)},render:function(c,a){if(this.options.animation&&("undefined"!==typeof c&&0!==c||"undefined"===typeof c&&0!==this.options.animation.duration)){var d=new f.Animation;d.numSteps=(c||this.options.animation.duration)/
|
||||
16.66;d.easing=this.options.animation.easing;d.render=function(a,c){var d=c.currentStep/c.numSteps,q=(0,e.easingEffects[c.easing])(d);a.draw(q,d,c.currentStep)};d.onAnimationProgress=this.options.animation.onProgress;d.onAnimationComplete=this.options.animation.onComplete;f.animationService.addAnimation(this,d,c,a)}else this.draw(),this.options.animation&&this.options.animation.onComplete&&this.options.animation.onComplete.call&&this.options.animation.onComplete.call(this);return this},draw:function(c){var a=
|
||||
c||1;this.clear();e.each(this.boxes,function(a){a.draw(this.chartArea)},this);this.scale&&this.scale.draw();this.chart.ctx.save();this.chart.ctx.beginPath();this.chart.ctx.rect(this.chartArea.left,this.chartArea.top,this.chartArea.right-this.chartArea.left,this.chartArea.bottom-this.chartArea.top);this.chart.ctx.clip();e.each(this.data.datasets,function(a,h){e.isDatasetVisible(a)&&a.controller.draw(c)},null,!0);this.chart.ctx.restore();this.tooltip.transition(a).draw()},getElementAtEvent:function(c){var a=
|
||||
e.getRelativePosition(c,this.chart),d=[];e.each(this.data.datasets,function(c,k){e.isDatasetVisible(c)&&e.each(c.metaData,function(c,k){if(c.inRange(a.x,a.y))return d.push(c),d})});return d},getElementsAtEvent:function(c){var a=e.getRelativePosition(c,this.chart),d=[],h=function(){if(this.data.datasets)for(var c=0;c<this.data.datasets.length;c++)if(e.isDatasetVisible(this.data.datasets[c]))for(var d=0;d<this.data.datasets[c].metaData.length;d++)if(this.data.datasets[c].metaData[d].inRange(a.x,a.y))return this.data.datasets[c].metaData[d]}.call(this);
|
||||
if(!h)return d;e.each(this.data.datasets,function(a,c){e.isDatasetVisible(a)&&d.push(a.metaData[h._index])});return d},getDatasetAtEvent:function(c){c=this.getElementAtEvent(c);0<c.length&&(c=this.data.datasets[c[0]._datasetIndex].metaData);return c},generateLegend:function(){return this.options.legendCallback(this)},destroy:function(){this.clear();e.unbindEvents(this,this.events);e.removeResizeListener(this.chart.canvas.parentNode);var c=this.chart.canvas;c.width=this.chart.width;c.height=this.chart.height;
|
||||
void 0!==this.chart.originalDevicePixelRatio&&this.chart.ctx.scale(1/this.chart.originalDevicePixelRatio,1/this.chart.originalDevicePixelRatio);c.style.width=this.chart.originalCanvasStyleWidth;c.style.height=this.chart.originalCanvasStyleHeight;delete f.instances[this.id]},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)},initToolTip:function(){this.tooltip=new f.Tooltip({_chart:this.chart,_chartInstance:this,_data:this.data,_options:this.options},this)},
|
||||
bindEvents:function(){e.bindEvents(this,this.options.events,function(c){this.eventHandler(c)})},eventHandler:function(c){this.lastActive=this.lastActive||[];this.lastTooltipActive=this.lastTooltipActive||[];if("mouseout"===c.type)this.active=[],this.tooltipActive=[];else{var a=this,d=function(d){switch(d){case "single":return a.getElementAtEvent(c);case "label":return a.getElementsAtEvent(c);case "dataset":return a.getDatasetAtEvent(c);default:return c}};this.active=d(this.options.hover.mode);this.tooltipActive=
|
||||
d(this.options.tooltips.mode)}this.options.hover.onHover&&this.options.hover.onHover.call(this,this.active);if("mouseup"===c.type||"click"===c.type)this.options.onClick&&this.options.onClick.call(this,c,this.active),this.legend&&this.legend.handleEvent&&this.legend.handleEvent(c);if(this.lastActive.length)switch(this.options.hover.mode){case "single":this.data.datasets[this.lastActive[0]._datasetIndex].controller.removeHoverStyle(this.lastActive[0],this.lastActive[0]._datasetIndex,this.lastActive[0]._index);
|
||||
break;case "label":case "dataset":for(d=0;d<this.lastActive.length;d++)this.lastActive[d]&&this.data.datasets[this.lastActive[d]._datasetIndex].controller.removeHoverStyle(this.lastActive[d],this.lastActive[d]._datasetIndex,this.lastActive[d]._index)}if(this.active.length&&this.options.hover.mode)switch(this.options.hover.mode){case "single":this.data.datasets[this.active[0]._datasetIndex].controller.setHoverStyle(this.active[0]);break;case "label":case "dataset":for(d=0;d<this.active.length;d++)this.active[d]&&
|
||||
this.data.datasets[this.active[d]._datasetIndex].controller.setHoverStyle(this.active[d])}if(this.options.tooltips.enabled||this.options.tooltips.custom)this.tooltip.initialize(),this.tooltip._active=this.tooltipActive,this.tooltip.update();this.tooltip.pivot();if(!this.animating){var h;e.each(this.active,function(a,c){a!==this.lastActive[c]&&(h=!0)},this);e.each(this.tooltipActive,function(a,c){a!==this.lastTooltipActive[c]&&(h=!0)},this);if(this.lastActive.length!==this.active.length||this.lastTooltipActive.length!==
|
||||
this.tooltipActive.length||h)this.stop(),(this.options.tooltips.enabled||this.options.tooltips.custom)&&this.tooltip.update(!0),this.render(this.options.hover.animationDuration,!0)}this.lastActive=this.active;this.lastTooltipActive=this.tooltipActive;return this}})}},{}],23:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.DatasetController=function(c,a){this.initialize.call(this,c,a)};e.extend(f.DatasetController.prototype,{initialize:function(c,a){this.chart=c;this.index=a;this.linkScales();
|
||||
this.addElements()},updateIndex:function(c){this.index=c},linkScales:function(){this.getDataset().xAxisID||(this.getDataset().xAxisID=this.chart.options.scales.xAxes[0].id);this.getDataset().yAxisID||(this.getDataset().yAxisID=this.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getScaleForId:function(c){return this.chart.scales[c]},reset:function(){this.update(!0)},buildOrUpdateElements:function(){var c=this.getDataset().data.length,a=this.getDataset().metaData.length;
|
||||
if(c<a)this.getDataset().metaData.splice(c,a-c);else if(c>a)for(;a<c;++a)this.addElementAndReset(a)},addElements:e.noop,addElementAndReset:e.noop,draw:e.noop,removeHoverStyle:e.noop,setHoverStyle:e.noop,update:e.noop});f.DatasetController.extend=e.inherits}},{}],24:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.elements={};f.Element=function(c){e.extend(this,c);this.initialize.apply(this,arguments)};e.extend(f.Element.prototype,{initialize:function(){},pivot:function(){this._view||(this._view=
|
||||
e.clone(this._model));this._start=e.clone(this._view);return this},transition:function(c){this._view||(this._view=e.clone(this._model));if(1===c)return this._view=this._model,this._start=null,this;this._start||this.pivot();e.each(this._model,function(a,d){if("_"!==d[0]&&this._model.hasOwnProperty(d))if(!this._view.hasOwnProperty(d))"number"!==typeof a||isNaN(this._view[d])?this._view[d]=a:this._view[d]=a*c;else if(a!==this._view[d])if("string"===typeof a)try{var h=e.color(this._start[d]).mix(e.color(this._model[d]),
|
||||
c);this._view[d]=h.rgbString()}catch(k){this._view[d]=a}else"number"===typeof a?(h=void 0!==this._start[d]&&!1===isNaN(this._start[d])?this._start[d]:0,this._view[d]=(this._model[d]-h)*c+h):this._view[d]=a},this);return this},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return e.isNumber(this._model.x)&&e.isNumber(this._model.y)}});f.Element.extend=e.inherits}},{}],25:[function(p,m,n){var f=p("chartjs-color");m.exports=function(e){function c(a,c,d){var e;
|
||||
"string"===typeof a?(e=parseInt(a,10),-1!=a.indexOf("%")&&(e=e/100*c.parentNode[d])):e=a;return e}function a(a,d,e){var h,f=document.defaultView.getComputedStyle(a)[d];d=document.defaultView.getComputedStyle(a.parentNode)[d];var x=null!==f&&"none"!==f,u=null!==d&&"none"!==d;if(x||u)h=Math.min(x?c(f,a,e):Number.POSITIVE_INFINITY,u?c(d,a.parentNode,e):Number.POSITIVE_INFINITY);return h}var d=e.helpers={};d.each=function(a,c,e,h){var f;if(d.isArray(a))if(f=a.length,h)for(h=f-1;0<=h;h--)c.call(e,a[h],
|
||||
h);else for(h=0;h<f;h++)c.call(e,a[h],h);else if("object"===typeof a){var x=Object.keys(a);f=x.length;for(h=0;h<f;h++)c.call(e,a[x[h]],x[h])}};d.clone=function(a){var c={};d.each(a,function(e,h){a.hasOwnProperty(h)&&(d.isArray(e)?c[h]=e.slice(0):c[h]="object"===typeof e&&null!==e?d.clone(e):e)});return c};d.extend=function(a){for(var c=arguments.length,e=[],h=1;h<c;h++)e.push(arguments[h]);d.each(e,function(c){d.each(c,function(d,e){c.hasOwnProperty(e)&&(a[e]=d)})});return a};d.configMerge=function(a){var c=
|
||||
d.clone(a);d.each(Array.prototype.slice.call(arguments,1),function(a){d.each(a,function(k,h){if(a.hasOwnProperty(h))if("scales"===h)c[h]=d.scaleMerge(c.hasOwnProperty(h)?c[h]:{},k);else if("scale"===h)c[h]=d.configMerge(c.hasOwnProperty(h)?c[h]:{},e.scaleService.getScaleDefaults(k.type),k);else if(c.hasOwnProperty(h)&&d.isArray(c[h])&&d.isArray(k)){var f=c[h];d.each(k,function(a,c){c<f.length?f[c]="object"===typeof f[c]&&null!==f[c]&&"object"===typeof a&&null!==a?d.configMerge(f[c],a):a:f.push(a)})}else c.hasOwnProperty(h)&&
|
||||
"object"===typeof c[h]&&null!==c[h]&&"object"===typeof k?c[h]=d.configMerge(c[h],k):c[h]=k})});return c};d.extendDeep=function(a){function c(a){d.each(arguments,function(k){k!==a&&d.each(k,function(d,k){a[k]&&a[k].constructor&&a[k].constructor===Object?c(a[k],d):a[k]=d})});return a}return c.apply(this,arguments)};d.scaleMerge=function(a,c){var h=d.clone(a);d.each(c,function(a,k){c.hasOwnProperty(k)&&("xAxes"===k||"yAxes"===k?h.hasOwnProperty(k)?d.each(a,function(a,c){var l=d.getValueOrDefault(a.type,
|
||||
"xAxes"===k?"category":"linear"),l=e.scaleService.getScaleDefaults(l);c>=h[k].length||!h[k][c].type?h[k].push(d.configMerge(l,a)):h[k][c]=a.type&&a.type!==h[k][c].type?d.configMerge(h[k][c],l,a):d.configMerge(h[k][c],a)}):(h[k]=[],d.each(a,function(a){var c=d.getValueOrDefault(a.type,"xAxes"===k?"category":"linear");h[k].push(d.configMerge(e.scaleService.getScaleDefaults(c),a))})):h.hasOwnProperty(k)&&"object"===typeof h[k]&&null!==h[k]&&"object"===typeof a?h[k]=d.configMerge(h[k],a):h[k]=a)});return h};
|
||||
d.getValueAtIndexOrDefault=function(a,c,e){return void 0===a||null===a?e:d.isArray(a)?c<a.length?a[c]:e:a};d.getValueOrDefault=function(a,c){return void 0===a?c:a};d.indexOf=function(a,c){if(Array.prototype.indexOf)return a.indexOf(c);for(var d=0;d<a.length;d++)if(a[d]===c)return d;return-1};d.where=function(a,c){var e=[];d.each(a,function(a){c(a)&&e.push(a)});return e};d.findIndex=function(a,c,d){var e=-1;if(Array.prototype.findIndex)e=a.findIndex(c,d);else for(var h=0;h<a.length;++h)if(d=void 0!==
|
||||
d?d:a,c.call(d,a[h],h,a)){e=h;break}return e};d.findNextWhere=function(a,c,d){if(void 0===d||null===d)d=-1;for(d+=1;d<a.length;d++){var e=a[d];if(c(e))return e}};d.findPreviousWhere=function(a,c,d){if(void 0===d||null===d)d=a.length;for(--d;0<=d;d--){var e=a[d];if(c(e))return e}};d.inherits=function(a){var c=this,e=a&&a.hasOwnProperty("constructor")?a.constructor:function(){return c.apply(this,arguments)},h=function(){this.constructor=e};h.prototype=c.prototype;e.prototype=new h;e.extend=d.inherits;
|
||||
a&&d.extend(e.prototype,a);e.__super__=c.prototype;return e};d.noop=function(){};d.uid=function(){var a=0;return function(){return"chart-"+a++}}();d.warn=function(a){console&&"function"===typeof console.warn&&console.warn(a)};d.isNumber=function(a){return!isNaN(parseFloat(a))&&isFinite(a)};d.almostEquals=function(a,c,d){return Math.abs(a-c)<d};d.max=function(a){return a.reduce(function(a,c){return isNaN(c)?a:Math.max(a,c)},Number.NEGATIVE_INFINITY)};d.min=function(a){return a.reduce(function(a,c){return isNaN(c)?
|
||||
a:Math.min(a,c)},Number.POSITIVE_INFINITY)};d.sign=function(a){if(Math.sign)return Math.sign(a);a=+a;return 0===a||isNaN(a)?a:0<a?1:-1};d.log10=function(a){return Math.log10?Math.log10(a):Math.log(a)/Math.LN10};d.toRadians=function(a){return Math.PI/180*a};d.toDegrees=function(a){return 180/Math.PI*a};d.getAngleFromPoint=function(a,c){var d=c.x-a.x,e=c.y-a.y,h=Math.sqrt(d*d+e*e),d=Math.atan2(e,d);d<-.5*Math.PI&&(d+=2*Math.PI);return{angle:d,distance:h}};d.aliasPixel=function(a){return 0===a%2?0:.5};
|
||||
d.splineCurve=function(a,c,d,e){a=a.skip?c:a;d=d.skip?c:d;var h=Math.sqrt(Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2)),f=Math.sqrt(Math.pow(d.x-c.x,2)+Math.pow(d.y-c.y,2)),m=h/(h+f),h=f/(h+f),m=isNaN(m)?0:m,h=isNaN(h)?0:h,m=e*m;e*=h;return{previous:{x:c.x-m*(d.x-a.x),y:c.y-m*(d.y-a.y)},next:{x:c.x+e*(d.x-a.x),y:c.y+e*(d.y-a.y)}}};d.nextItem=function(a,c,d){return d?c>=a.length-1?a[0]:a[c+1]:c>=a.length-1?a[a.length-1]:a[c+1]};d.previousItem=function(a,c,d){return d?0>=c?a[a.length-1]:a[c-1]:0>=c?a[0]:
|
||||
a[c-1]};d.niceNum=function(a,c){var e=Math.floor(d.log10(a)),h=a/Math.pow(10,e);return(c?1.5>h?1:3>h?2:7>h?5:10:1>=h?1:2>=h?2:5>=h?5:10)*Math.pow(10,e)};var h=d.easingEffects={linear:function(a){return a},easeInQuad:function(a){return a*a},easeOutQuad:function(a){return-1*a*(a-2)},easeInOutQuad:function(a){return 1>(a/=.5)?.5*a*a:-.5*(--a*(a-2)-1)},easeInCubic:function(a){return a*a*a},easeOutCubic:function(a){return 1*((a=a/1-1)*a*a+1)},easeInOutCubic:function(a){return 1>(a/=.5)?.5*a*a*a:.5*((a-=
|
||||
2)*a*a+2)},easeInQuart:function(a){return a*a*a*a},easeOutQuart:function(a){return-1*((a=a/1-1)*a*a*a-1)},easeInOutQuart:function(a){return 1>(a/=.5)?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)},easeInQuint:function(a){return 1*(a/=1)*a*a*a*a},easeOutQuint:function(a){return 1*((a=a/1-1)*a*a*a*a+1)},easeInOutQuint:function(a){return 1>(a/=.5)?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)},easeInSine:function(a){return-1*Math.cos(a/1*(Math.PI/2))+1},easeOutSine:function(a){return 1*Math.sin(a/1*(Math.PI/2))},easeInOutSine:function(a){return-.5*
|
||||
(Math.cos(Math.PI*a/1)-1)},easeInExpo:function(a){return 0===a?1:1*Math.pow(2,10*(a/1-1))},easeOutExpo:function(a){return 1===a?1:1*(-Math.pow(2,-10*a/1)+1)},easeInOutExpo:function(a){return 0===a?0:1===a?1:1>(a/=.5)?.5*Math.pow(2,10*(a-1)):.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return 1<=a?a:-1*(Math.sqrt(1-(a/=1)*a)-1)},easeOutCirc:function(a){return 1*Math.sqrt(1-(a=a/1-1)*a)},easeInOutCirc:function(a){return 1>(a/=.5)?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)},easeInElastic:function(a){var c=
|
||||
1.70158,d=0,e=1;if(0===a)return 0;if(1===(a/=1))return 1;d||(d=.3);e<Math.abs(1)?(e=1,c=d/4):c=d/(2*Math.PI)*Math.asin(1/e);return-(e*Math.pow(2,10*--a)*Math.sin(2*(1*a-c)*Math.PI/d))},easeOutElastic:function(a){var c=1.70158,d=0,e=1;if(0===a)return 0;if(1===(a/=1))return 1;d||(d=.3);e<Math.abs(1)?(e=1,c=d/4):c=d/(2*Math.PI)*Math.asin(1/e);return e*Math.pow(2,-10*a)*Math.sin(2*(1*a-c)*Math.PI/d)+1},easeInOutElastic:function(a){var c=1.70158,d=0,e=1;if(0===a)return 0;if(2===(a/=.5))return 1;d||(d=
|
||||
.3*1.5);e<Math.abs(1)?(e=1,c=d/4):c=d/(2*Math.PI)*Math.asin(1/e);return 1>a?-.5*e*Math.pow(2,10*--a)*Math.sin(2*(1*a-c)*Math.PI/d):e*Math.pow(2,-10*--a)*Math.sin(2*(1*a-c)*Math.PI/d)*.5+1},easeInBack:function(a){return 1*(a/=1)*a*(2.70158*a-1.70158)},easeOutBack:function(a){return 1*((a=a/1-1)*a*(2.70158*a+1.70158)+1)},easeInOutBack:function(a){var c=1.70158;return 1>(a/=.5)?.5*a*a*(((c*=1.525)+1)*a-c):.5*((a-=2)*a*(((c*=1.525)+1)*a+c)+2)},easeInBounce:function(a){return 1-h.easeOutBounce(1-a)},easeOutBounce:function(a){return(a/=
|
||||
1)<1/2.75?7.5625*a*a:a<2/2.75?1*(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?1*(7.5625*(a-=2.25/2.75)*a+.9375):1*(7.5625*(a-=2.625/2.75)*a+.984375)},easeInOutBounce:function(a){return.5>a?.5*h.easeInBounce(2*a):.5*h.easeOutBounce(2*a-1)+.5}};d.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){return window.setTimeout(a,1E3/60)}}();d.cancelAnimFrame=
|
||||
function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(a){return window.clearTimeout(a,1E3/60)}}();d.getRelativePosition=function(a,c){var e,h;h=a.originalEvent||a;var f=a.currentTarget||a.srcElement,m=f.getBoundingClientRect();h.touches&&0<h.touches.length?(e=h.touches[0].clientX,h=h.touches[0].clientY):(e=h.clientX,h=h.clientY);var n=parseFloat(d.getStyle(f,"padding-left")),
|
||||
p=parseFloat(d.getStyle(f,"padding-top")),v=parseFloat(d.getStyle(f,"padding-right")),A=parseFloat(d.getStyle(f,"padding-bottom")),A=m.bottom-m.top-p-A;e=Math.round((e-m.left-n)/(m.right-m.left-n-v)*f.width/c.currentDevicePixelRatio);h=Math.round((h-m.top-p)/A*f.height/c.currentDevicePixelRatio);return{x:e,y:h}};d.addEvent=function(a,c,d){a.addEventListener?a.addEventListener(c,d):a.attachEvent?a.attachEvent("on"+c,d):a["on"+c]=d};d.removeEvent=function(a,c,e){a.removeEventListener?a.removeEventListener(c,
|
||||
e,!1):a.detachEvent?a.detachEvent("on"+c,e):a["on"+c]=d.noop};d.bindEvents=function(a,c,e){a.events||(a.events={});d.each(c,function(c){a.events[c]=function(){e.apply(a,arguments)};d.addEvent(a.chart.canvas,c,a.events[c])})};d.unbindEvents=function(a,c){d.each(c,function(c,e){d.removeEvent(a.chart.canvas,e,c)})};d.getConstraintWidth=function(c){return a(c,"max-width","clientWidth")};d.getConstraintHeight=function(c){return a(c,"max-height","clientHeight")};d.getMaximumWidth=function(a){var c=a.parentNode,
|
||||
e=parseInt(d.getStyle(c,"padding-left"))+parseInt(d.getStyle(c,"padding-right")),c=c.clientWidth-e;a=d.getConstraintWidth(a);void 0!==a&&(c=Math.min(c,a));return c};d.getMaximumHeight=function(a){var c=a.parentNode,e=parseInt(d.getStyle(c,"padding-top"))+parseInt(d.getStyle(c,"padding-bottom")),c=c.clientHeight-e;a=d.getConstraintHeight(a);void 0!==a&&(c=Math.min(c,a));return c};d.getStyle=function(a,c){return a.currentStyle?a.currentStyle[c]:document.defaultView.getComputedStyle(a,null).getPropertyValue(c)};
|
||||
d.retinaScale=function(a){var c=a.ctx,d=a.canvas.width,e=a.canvas.height,h=a.currentDevicePixelRatio=window.devicePixelRatio||1;1!==h&&(c.canvas.height=e*h,c.canvas.width=d*h,c.scale(h,h),a.originalDevicePixelRatio=a.originalDevicePixelRatio||h);c.canvas.style.width=d+"px";c.canvas.style.height=e+"px"};d.clear=function(a){a.ctx.clearRect(0,0,a.width,a.height)};d.fontString=function(a,c,d){return c+" "+a+"px "+d};d.longestText=function(a,c,e,h){h=h||{};h.data=h.data||{};h.garbageCollect=h.garbageCollect||
|
||||
[];h.font!==c&&(h.data={},h.garbageCollect=[],h.font=c);a.font=c;var f=0;d.each(e,function(c){if(void 0!==c&&null!==c){var d=h.data[c];d||(d=h.data[c]=a.measureText(c).width,h.garbageCollect.push(c));d>f&&(f=d)}});c=h.garbageCollect.length/2;if(c>e.length){for(e=0;e<c;e++)delete h.data[h.garbageCollect[e]];h.garbageCollect.splice(0,c)}return f};d.drawRoundedRectangle=function(a,c,d,e,h,f){a.beginPath();a.moveTo(c+f,d);a.lineTo(c+e-f,d);a.quadraticCurveTo(c+e,d,c+e,d+f);a.lineTo(c+e,d+h-f);a.quadraticCurveTo(c+
|
||||
e,d+h,c+e-f,d+h);a.lineTo(c+f,d+h);a.quadraticCurveTo(c,d+h,c,d+h-f);a.lineTo(c,d+f);a.quadraticCurveTo(c,d,c+f,d);a.closePath()};d.color=function(a){return f?a instanceof CanvasGradient?f(e.defaults.global.defaultColor):f(a):(console.log("Color.js not found!"),a)};d.addResizeListener=function(a,c){var d=document.createElement("iframe");d.classlist?d.classlist.add("chartjs-hidden-iframe"):d.setAttribute("class","chartjs-hidden-iframe");d.style.width="100%";d.style.display="block";d.style.border=0;
|
||||
d.style.height=0;d.style.margin=0;d.style.position="absolute";d.style.left=0;d.style.right=0;d.style.top=0;d.style.bottom=0;a.insertBefore(d,a.firstChild);(d.contentWindow||d).onresize=function(){c&&c()}};d.removeResizeListener=function(a){(a=a.querySelector(".chartjs-hidden-iframe"))&&a.parentNode.removeChild(a)};d.isArray=function(a){return Array.isArray?Array.isArray(a):"[object Array]"===Object.prototype.toString.call(a)};d.pushAllIfDefined=function(a,c){"undefined"!==typeof a&&(d.isArray(a)?
|
||||
c.push.apply(c,a):c.push(a))};d.isDatasetVisible=function(a){return!a.hidden};d.callCallback=function(a,c,d){a&&"function"===typeof a.call&&a.apply(d,c)}}},{"chartjs-color":6}],26:[function(p,m,n){m.exports=function(){var f=function(e,c){this.config=c;e.length&&e[0].getContext&&(e=e[0]);e.getContext&&(e=e.getContext("2d"));this.ctx=e;this.canvas=e.canvas;this.width=e.canvas.width||parseInt(f.helpers.getStyle(e.canvas,"width"))||f.helpers.getMaximumWidth(e.canvas);this.height=e.canvas.height||parseInt(f.helpers.getStyle(e.canvas,
|
||||
"height"))||f.helpers.getMaximumHeight(e.canvas);this.aspectRatio=this.width/this.height;if(isNaN(this.aspectRatio)||!1===isFinite(this.aspectRatio))this.aspectRatio=void 0!==c.aspectRatio?c.aspectRatio:2;this.originalCanvasStyleWidth=e.canvas.style.width;this.originalCanvasStyleHeight=e.canvas.style.height;f.helpers.retinaScale(this);c&&(this.controller=new f.Controller(this));var a=this;f.helpers.addResizeListener(e.canvas.parentNode,function(){a.controller&&a.controller.config.options.responsive&&
|
||||
a.controller.resize()});return this.controller?this.controller:this};f.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"single",animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},legendCallback:function(e){var c=
|
||||
[];c.push('<ul class="'+e.id+'-legend">');for(var a=0;a<e.data.datasets.length;a++)c.push('<li><span style="background-color:'+e.data.datasets[a].backgroundColor+'"></span>'),e.data.datasets[a].label&&c.push(e.data.datasets[a].label),c.push("</li>");c.push("</ul>");return c.join("")}}};return f}},{}],27:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.layoutService={defaults:{},addBox:function(c,a){c.boxes||(c.boxes=[]);c.boxes.push(a)},removeBox:function(c,a){c.boxes&&c.boxes.splice(c.boxes.indexOf(a),
|
||||
1)},update:function(c,a,d){function h(a){var c,d=a.isHorizontal();d?(c=a.update(a.options.fullWidth?v:y,I),D-=c.height):(c=a.update(z,F),y-=c.width);N.push({horizontal:d,minSize:c,box:a})}function k(a){var c=e.findNextWhere(N,function(c){return c.box===a});c&&(a.isHorizontal()?a.update(a.options.fullWidth?v:y,A/2,{left:B,right:G,top:0,bottom:0}):a.update(c.minSize.width,D))}function f(a){var c=e.findNextWhere(N,function(c){return c.box===a}),d={left:0,right:0,top:C,bottom:H};c&&a.update(c.minSize.width,
|
||||
D,d)}function q(c){c.isHorizontal()?(c.left=c.options.fullWidth?0:B,c.right=c.options.fullWidth?a-0:B+y,c.top=J,c.bottom=J+c.height,J=c.bottom):(c.left=K,c.right=K+c.width,c.top=C,c.bottom=C+D,K=c.right)}if(c){var t=e.where(c.boxes,function(a){return"left"===a.options.position}),m=e.where(c.boxes,function(a){return"right"===a.options.position}),n=e.where(c.boxes,function(a){return"top"===a.options.position}),p=e.where(c.boxes,function(a){return"bottom"===a.options.position}),E=e.where(c.boxes,function(a){return"chartArea"===
|
||||
a.options.position});n.sort(function(a,c){return(c.options.fullWidth?1:0)-(a.options.fullWidth?1:0)});p.sort(function(a,c){return(a.options.fullWidth?1:0)-(c.options.fullWidth?1:0)});var v=a-0,A=d-0,F=A/2,z=(a-v/2)/(t.length+m.length),I=(d-F)/(n.length+p.length),y=v,D=A,N=[];e.each(t.concat(m,n,p),h);var B=0,G=0,C=0,H=0;e.each(t.concat(m),k);e.each(t,function(a){B+=a.width});e.each(m,function(a){G+=a.width});e.each(n.concat(p),k);e.each(n,function(a){C+=a.height});e.each(p,function(a){H+=a.height});
|
||||
e.each(t.concat(m),f);H=C=G=B=0;e.each(t,function(a){B+=a.width});e.each(m,function(a){G+=a.width});e.each(n,function(a){C+=a.height});e.each(p,function(a){H+=a.height});var L=d-C-H,M=a-B-G;if(M!==y||L!==D)e.each(t,function(a){a.height=L}),e.each(m,function(a){a.height=L}),e.each(n,function(a){a.width=M}),e.each(p,function(a){a.width=M}),D=L,y=M;var K=0,J=0;e.each(t.concat(n),q);K+=y;J+=D;e.each(m,q);e.each(p,q);c.chartArea={left:B,top:C,right:B+y,bottom:C+D};e.each(E,function(a){a.left=c.chartArea.left;
|
||||
a.top=c.chartArea.top;a.right=c.chartArea.right;a.bottom=c.chartArea.bottom;a.update(y,D)})}}}}},{}],28:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(c,a){var d=this.chart.data.datasets[a.datasetIndex];d.hidden=!d.hidden;this.chart.update()},labels:{boxWidth:40,padding:10,generateLabels:function(c){return e.isArray(c.datasets)?c.datasets.map(function(a,c){return{text:a.label,fillStyle:a.backgroundColor,
|
||||
hidden:a.hidden,lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,datasetIndex:c}},this):[]}}};f.Legend=f.Element.extend({initialize:function(c){e.extend(this,c);this.legendHitBoxes=[];this.doughnutMode=!1},beforeUpdate:e.noop,update:function(c,a,d){this.beforeUpdate();this.maxWidth=c;this.maxHeight=a;this.margins=d;this.beforeSetDimensions();this.setDimensions();this.afterSetDimensions();this.beforeBuildLabels();
|
||||
this.buildLabels();this.afterBuildLabels();this.beforeFit();this.fit();this.afterFit();this.afterUpdate();return this.minSize},afterUpdate:e.noop,beforeSetDimensions:e.noop,setDimensions:function(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height);this.paddingBottom=this.paddingRight=this.paddingTop=this.paddingLeft=0;this.minSize={width:0,height:0}},afterSetDimensions:e.noop,beforeBuildLabels:e.noop,buildLabels:function(){this.legendItems=
|
||||
this.options.labels.generateLabels.call(this,this.chart.data);this.options.reverse&&this.legendItems.reverse()},afterBuildLabels:e.noop,beforeFit:e.noop,fit:function(){var c=this.ctx,a=e.getValueOrDefault(this.options.labels.fontSize,f.defaults.global.defaultFontSize),d=e.getValueOrDefault(this.options.labels.fontStyle,f.defaults.global.defaultFontStyle),h=e.getValueOrDefault(this.options.labels.fontFamily,f.defaults.global.defaultFontFamily),d=e.fontString(a,d,h);this.legendHitBoxes=[];this.isHorizontal()?
|
||||
this.minSize.width=this.maxWidth:this.minSize.width=this.options.display?10:0;this.isHorizontal()?this.minSize.height=this.options.display?10:0:this.minSize.height=this.maxHeight;if(this.options.display&&this.isHorizontal()){this.lineWidths=[0];var k=this.legendItems.length?a+this.options.labels.padding:0;c.textAlign="left";c.textBaseline="top";c.font=d;e.each(this.legendItems,function(d,e){var h=this.options.labels.boxWidth+a/2+c.measureText(d.text).width;this.lineWidths[this.lineWidths.length-1]+
|
||||
h+this.options.labels.padding>=this.width&&(k+=a+this.options.labels.padding,this.lineWidths[this.lineWidths.length]=this.left);this.legendHitBoxes[e]={left:0,top:0,width:h,height:a};this.lineWidths[this.lineWidths.length-1]+=h+this.options.labels.padding},this);this.minSize.height+=k}this.width=this.minSize.width;this.height=this.minSize.height},afterFit:e.noop,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){if(this.options.display){var c=
|
||||
this.ctx,a=this.left+(this.width-this.lineWidths[0])/2,d=this.top+this.options.labels.padding,h=0,k=e.getValueOrDefault(this.options.labels.fontColor,f.defaults.global.defaultFontColor),l=e.getValueOrDefault(this.options.labels.fontSize,f.defaults.global.defaultFontSize),q=e.getValueOrDefault(this.options.labels.fontStyle,f.defaults.global.defaultFontStyle),t=e.getValueOrDefault(this.options.labels.fontFamily,f.defaults.global.defaultFontFamily),q=e.fontString(l,q,t);this.isHorizontal()&&(c.textAlign=
|
||||
"left",c.textBaseline="top",c.lineWidth=.5,c.strokeStyle=k,c.fillStyle=k,c.font=q,e.each(this.legendItems,function(e,k){var q=c.measureText(e.text).width,t=this.options.labels.boxWidth+l/2+q;a+t>=this.width&&(d+=l+this.options.labels.padding,h++,a=this.left+(this.width-this.lineWidths[h])/2);c.save();var m=function(a,c){return void 0!==a?a:c};c.fillStyle=m(e.fillStyle,f.defaults.global.defaultColor);c.lineCap=m(e.lineCap,f.defaults.global.elements.line.borderCapStyle);c.lineDashOffset=m(e.lineDashOffset,
|
||||
f.defaults.global.elements.line.borderDashOffset);c.lineJoin=m(e.lineJoin,f.defaults.global.elements.line.borderJoinStyle);c.lineWidth=m(e.lineWidth,f.defaults.global.elements.line.borderWidth);c.strokeStyle=m(e.strokeStyle,f.defaults.global.defaultColor);c.setLineDash&&c.setLineDash(m(e.lineDash,f.defaults.global.elements.line.borderDash));c.strokeRect(a,d,this.options.labels.boxWidth,l);c.fillRect(a,d,this.options.labels.boxWidth,l);c.restore();this.legendHitBoxes[k].left=a;this.legendHitBoxes[k].top=
|
||||
d;c.fillText(e.text,this.options.labels.boxWidth+l/2+a,d);e.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(this.options.labels.boxWidth+l/2+a,d+l/2),c.lineTo(this.options.labels.boxWidth+l/2+a+q,d+l/2),c.stroke());a+=t+this.options.labels.padding},this))}},handleEvent:function(c){var a=e.getRelativePosition(c,this.chart.chart);if(a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom)for(var d=0;d<this.legendHitBoxes.length;++d){var h=this.legendHitBoxes[d];if(a.x>=h.left&&a.x<=h.left+h.width&&
|
||||
a.y>=h.top&&a.y<=h.top+h.height){this.options.onClick&&this.options.onClick.call(this,c,this.legendItems[d]);break}}}})}},{}],29:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.scale={display:!0,gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawOnChartArea:!0,drawTicks:!0,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",offsetGridLines:!1},scaleLabel:{labelString:"",display:!1},ticks:{beginAtZero:!1,maxRotation:50,mirror:!1,padding:10,reverse:!1,display:!0,autoSkip:!0,
|
||||
autoSkipPadding:0,callback:function(c){return""+c}}};f.Scale=f.Element.extend({beforeUpdate:function(){e.callCallback(this.options.beforeUpdate,[this])},update:function(c,a,d){this.beforeUpdate();this.maxWidth=c;this.maxHeight=a;this.margins=e.extend({left:0,right:0,top:0,bottom:0},d);this.beforeSetDimensions();this.setDimensions();this.afterSetDimensions();this.beforeDataLimits();this.determineDataLimits();this.afterDataLimits();this.beforeBuildTicks();this.buildTicks();this.afterBuildTicks();this.beforeTickToLabelConversion();
|
||||
this.convertTicksToLabels();this.afterTickToLabelConversion();this.beforeCalculateTickRotation();this.calculateTickRotation();this.afterCalculateTickRotation();this.beforeFit();this.fit();this.afterFit();this.afterUpdate();return this.minSize},afterUpdate:function(){e.callCallback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){e.callCallback(this.options.beforeSetDimensions,[this])},setDimensions:function(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):
|
||||
(this.height=this.maxHeight,this.top=0,this.bottom=this.height);this.paddingBottom=this.paddingRight=this.paddingTop=this.paddingLeft=0},afterSetDimensions:function(){e.callCallback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){e.callCallback(this.options.beforeDataLimits,[this])},determineDataLimits:e.noop,afterDataLimits:function(){e.callCallback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){e.callCallback(this.options.beforeBuildTicks,[this])},buildTicks:e.noop,
|
||||
afterBuildTicks:function(){e.callCallback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){e.callCallback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){this.ticks=this.ticks.map(function(c,a,d){return this.options.ticks.userCallback?this.options.ticks.userCallback(c,a,d):this.options.ticks.callback(c,a,d)},this)},afterTickToLabelConversion:function(){e.callCallback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){e.callCallback(this.options.beforeCalculateTickRotation,
|
||||
[this])},calculateTickRotation:function(){var c=e.getValueOrDefault(this.options.ticks.fontSize,f.defaults.global.defaultFontSize),a=e.getValueOrDefault(this.options.ticks.fontStyle,f.defaults.global.defaultFontStyle),d=e.getValueOrDefault(this.options.ticks.fontFamily,f.defaults.global.defaultFontFamily),d=e.fontString(c,a,d);this.ctx.font=d;var a=this.ctx.measureText(this.ticks[0]).width,h=this.ctx.measureText(this.ticks[this.ticks.length-1]).width,k;this.paddingLeft=this.paddingRight=this.labelRotation=
|
||||
0;if(this.options.display&&this.isHorizontal()){this.paddingRight=h/2+3;this.paddingLeft=a/2+3;this.longestTextCache||(this.longestTextCache={});k=d=e.longestText(this.ctx,d,this.ticks,this.longestTextCache);for(var l,q,h=this.getPixelForTick(1)-this.getPixelForTick(0)-6;k>h&&this.labelRotation<this.options.ticks.maxRotation;){l=Math.cos(e.toRadians(this.labelRotation));q=Math.sin(e.toRadians(this.labelRotation));k=l*a;k+c/2>this.yLabelWidth&&(this.paddingLeft=k+c/2);this.paddingRight=c/2;if(q*d>
|
||||
this.maxHeight){this.labelRotation--;break}this.labelRotation++;k=l*d}}this.margins&&(this.paddingLeft=Math.max(this.paddingLeft-this.margins.left,0),this.paddingRight=Math.max(this.paddingRight-this.margins.right,0))},afterCalculateTickRotation:function(){e.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){e.callCallback(this.options.beforeFit,[this])},fit:function(){this.minSize={width:0,height:0};var c=e.getValueOrDefault(this.options.ticks.fontSize,f.defaults.global.defaultFontSize),
|
||||
a=e.getValueOrDefault(this.options.ticks.fontStyle,f.defaults.global.defaultFontStyle),d=e.getValueOrDefault(this.options.ticks.fontFamily,f.defaults.global.defaultFontFamily),a=e.fontString(c,a,d),d=e.getValueOrDefault(this.options.scaleLabel.fontSize,f.defaults.global.defaultFontSize),h=e.getValueOrDefault(this.options.scaleLabel.fontStyle,f.defaults.global.defaultFontStyle),k=e.getValueOrDefault(this.options.scaleLabel.fontFamily,f.defaults.global.defaultFontFamily);e.fontString(d,h,k);this.isHorizontal()?
|
||||
this.minSize.width=this.isFullWidth()?this.maxWidth-this.margins.left-this.margins.right:this.maxWidth:this.minSize.width=this.options.gridLines.display&&this.options.display?10:0;this.isHorizontal()?this.minSize.height=this.options.gridLines.display&&this.options.display?10:0:this.minSize.height=this.maxHeight;this.options.scaleLabel.display&&(this.isHorizontal()?this.minSize.height+=1.5*d:this.minSize.width+=1.5*d);this.options.ticks.display&&this.options.display&&(this.longestTextCache||(this.longestTextCache=
|
||||
{}),d=e.longestText(this.ctx,a,this.ticks,this.longestTextCache),this.isHorizontal()?(this.longestLabelWidth=d,d=Math.sin(e.toRadians(this.labelRotation))*this.longestLabelWidth+1.5*c,this.minSize.height=Math.min(this.maxHeight,this.minSize.height+d),this.ctx.font=a,a=this.ctx.measureText(this.ticks[0]).width,d=this.ctx.measureText(this.ticks[this.ticks.length-1]).width,h=Math.cos(e.toRadians(this.labelRotation)),k=Math.sin(e.toRadians(this.labelRotation)),this.paddingLeft=0!==this.labelRotation?
|
||||
h*a+3:a/2+3,this.paddingRight=0!==this.labelRotation?c/2*k+3:d/2+3):(a=this.maxWidth-this.minSize.width,this.options.ticks.mirror||(d+=this.options.ticks.padding),this.minSize.width=d<a?this.minSize.width+d:this.maxWidth,this.paddingTop=c/2,this.paddingBottom=c/2));this.margins&&(this.paddingLeft=Math.max(this.paddingLeft-this.margins.left,0),this.paddingTop=Math.max(this.paddingTop-this.margins.top,0),this.paddingRight=Math.max(this.paddingRight-this.margins.right,0),this.paddingBottom=Math.max(this.paddingBottom-
|
||||
this.margins.bottom,0));this.width=this.minSize.width;this.height=this.minSize.height},afterFit:function(){e.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function a(d){return null===d||"undefined"===typeof d||"number"===typeof d&&isNaN(d)?NaN:"object"!==typeof d||d instanceof Date?d:a(this.isHorizontal()?d.x:d.y)},getLabelForIndex:e.noop,
|
||||
getPixelForValue:e.noop,getPixelForTick:function(a,d){if(this.isHorizontal()){var e=(this.width-(this.paddingLeft+this.paddingRight))/Math.max(this.ticks.length-(this.options.gridLines.offsetGridLines?0:1),1),k=e*a+this.paddingLeft;d&&(k+=e/2);e=this.left+Math.round(k);return e+=this.isFullWidth()?this.margins.left:0}return this.top+(this.height-(this.paddingTop+this.paddingBottom))/(this.ticks.length-1)*a},getPixelForDecimal:function(a){return this.isHorizontal()?(a=this.left+Math.round((this.width-
|
||||
(this.paddingLeft+this.paddingRight))*a+this.paddingLeft),a+=this.isFullWidth()?this.margins.left:0):this.top+a*this.height},draw:function(a){if(this.options.display){var d,h=0!==this.labelRotation,k,l,q;l=this.options.ticks.autoSkip;this.options.ticks.maxTicksLimit&&(q=this.options.ticks.maxTicksLimit);var m=e.getValueOrDefault(this.options.ticks.fontColor,f.defaults.global.defaultFontColor),n=e.getValueOrDefault(this.options.ticks.fontSize,f.defaults.global.defaultFontSize),p=e.getValueOrDefault(this.options.ticks.fontStyle,
|
||||
f.defaults.global.defaultFontStyle),u=e.getValueOrDefault(this.options.ticks.fontFamily,f.defaults.global.defaultFontFamily),E=e.fontString(n,p,u),n=e.getValueOrDefault(this.options.scaleLabel.fontColor,f.defaults.global.defaultFontColor),p=e.getValueOrDefault(this.options.scaleLabel.fontSize,f.defaults.global.defaultFontSize),u=e.getValueOrDefault(this.options.scaleLabel.fontStyle,f.defaults.global.defaultFontStyle),v=e.getValueOrDefault(this.options.scaleLabel.fontFamily,f.defaults.global.defaultFontFamily),
|
||||
u=e.fontString(p,u,v),v=Math.cos(e.toRadians(this.labelRotation));e.toRadians(this.labelRotation);v*=this.longestLabelWidth;this.ctx.fillStyle=m;if(this.isHorizontal()){d=!0;var A="bottom"===this.options.position?this.top:this.bottom-10,F="bottom"===this.options.position?this.top+10:this.bottom;k=!1;(v/2+this.options.ticks.autoSkipPadding)*this.ticks.length>this.width-(this.paddingLeft+this.paddingRight)&&(k=1+Math.floor((v/2+this.options.ticks.autoSkipPadding)*this.ticks.length/(this.width-(this.paddingLeft+
|
||||
this.paddingRight))));if(q&&this.ticks.length>q)for(;!k||this.ticks.length/(k||1)>q;)k||(k=1),k+=1;l||(k=!1);e.each(this.ticks,function(f,l){var q=this.ticks.length===l+1;if((!(1<k&&0<l%k||0===l%k&&l+k>this.ticks.length)||q)&&void 0!==f&&null!==f){var q=this.getPixelForTick(l),m=this.getPixelForTick(l,this.options.gridLines.offsetGridLines);this.options.gridLines.display&&(l===("undefined"!==typeof this.zeroLineIndex?this.zeroLineIndex:0)?(this.ctx.lineWidth=this.options.gridLines.zeroLineWidth,this.ctx.strokeStyle=
|
||||
this.options.gridLines.zeroLineColor,d=!0):d&&(this.ctx.lineWidth=this.options.gridLines.lineWidth,this.ctx.strokeStyle=this.options.gridLines.color,d=!1),q+=e.aliasPixel(this.ctx.lineWidth),this.ctx.beginPath(),this.options.gridLines.drawTicks&&(this.ctx.moveTo(q,A),this.ctx.lineTo(q,F)),this.options.gridLines.drawOnChartArea&&(this.ctx.moveTo(q,a.top),this.ctx.lineTo(q,a.bottom)),this.ctx.stroke());this.options.ticks.display&&(this.ctx.save(),this.ctx.translate(m,h?this.top+12:"top"===this.options.position?
|
||||
this.bottom-10:this.top+10),this.ctx.rotate(-1*e.toRadians(this.labelRotation)),this.ctx.font=E,this.ctx.textAlign=h?"right":"center",this.ctx.textBaseline=h?"middle":"top"===this.options.position?"bottom":"top",this.ctx.fillText(f,0,0),this.ctx.restore())}},this);this.options.scaleLabel.display&&(this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillStyle=n,this.ctx.font=u,l=this.left+(this.right-this.left)/2,q="bottom"===this.options.position?this.bottom-p/2:this.top+p/2,this.ctx.fillText(this.options.scaleLabel.labelString,
|
||||
l,q))}else{d=!0;var z="right"===this.options.position?this.left:this.right-5,I="right"===this.options.position?this.left+5:this.right;e.each(this.ticks,function(h,k){if(void 0!==h&&null!==h){var f=this.getPixelForTick(k);this.options.gridLines.display&&(k===("undefined"!==typeof this.zeroLineIndex?this.zeroLineIndex:0)?(this.ctx.lineWidth=this.options.gridLines.zeroLineWidth,this.ctx.strokeStyle=this.options.gridLines.zeroLineColor,d=!0):d&&(this.ctx.lineWidth=this.options.gridLines.lineWidth,this.ctx.strokeStyle=
|
||||
this.options.gridLines.color,d=!1),f+=e.aliasPixel(this.ctx.lineWidth),this.ctx.beginPath(),this.options.gridLines.drawTicks&&(this.ctx.moveTo(z,f),this.ctx.lineTo(I,f)),this.options.gridLines.drawOnChartArea&&(this.ctx.moveTo(a.left,f),this.ctx.lineTo(a.right,f)),this.ctx.stroke());if(this.options.ticks.display){var l=this.getPixelForTick(k,this.options.gridLines.offsetGridLines);this.ctx.save();"left"===this.options.position?this.options.ticks.mirror?(f=this.right+this.options.ticks.padding,this.ctx.textAlign=
|
||||
"left"):(f=this.right-this.options.ticks.padding,this.ctx.textAlign="right"):this.options.ticks.mirror?(f=this.left-this.options.ticks.padding,this.ctx.textAlign="right"):(f=this.left+this.options.ticks.padding,this.ctx.textAlign="left");this.ctx.translate(f,l);this.ctx.rotate(-1*e.toRadians(this.labelRotation));this.ctx.font=E;this.ctx.textBaseline="middle";this.ctx.fillText(h,0,0);this.ctx.restore()}}},this);this.options.scaleLabel.display&&(l="left"===this.options.position?this.left+p/2:this.right-
|
||||
p/2,q=this.top+(this.bottom-this.top)/2,m="left"===this.options.position?-.5*Math.PI:.5*Math.PI,this.ctx.save(),this.ctx.translate(l,q),this.ctx.rotate(m),this.ctx.textAlign="center",this.ctx.fillStyle=n,this.ctx.font=u,this.ctx.textBaseline="middle",this.ctx.fillText(this.options.scaleLabel.labelString,0,0),this.ctx.restore())}this.ctx.lineWidth=this.options.gridLines.lineWidth;this.ctx.strokeStyle=this.options.gridLines.color;l=this.left;q=this.right;m=this.top;n=this.bottom;this.isHorizontal()?
|
||||
(m=n="top"===this.options.position?this.bottom:this.top,m+=e.aliasPixel(this.ctx.lineWidth),n+=e.aliasPixel(this.ctx.lineWidth)):(l=q="left"===this.options.position?this.right:this.left,l+=e.aliasPixel(this.ctx.lineWidth),q+=e.aliasPixel(this.ctx.lineWidth));this.ctx.beginPath();this.ctx.moveTo(l,m);this.ctx.lineTo(q,n);this.ctx.stroke()}}})}},{}],30:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.scaleService={constructors:{},defaults:{},registerScaleType:function(c,a,d){this.constructors[c]=
|
||||
a;this.defaults[c]=e.clone(d)},getScaleConstructor:function(c){return this.constructors.hasOwnProperty(c)?this.constructors[c]:void 0},getScaleDefaults:function(c){return this.defaults.hasOwnProperty(c)?e.scaleMerge(f.defaults.scale,this.defaults[c]):{}},addScalesToLayout:function(c){e.each(c.scales,function(a){f.layoutService.addBox(c,a)})}}}},{}],31:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.global.title={display:!1,position:"top",fullWidth:!0,fontStyle:"bold",padding:10,
|
||||
text:""};f.Title=f.Element.extend({initialize:function(c){e.extend(this,c);this.options=e.configMerge(f.defaults.global.title,c.options);this.legendHitBoxes=[]},beforeUpdate:e.noop,update:function(c,a,d){this.beforeUpdate();this.maxWidth=c;this.maxHeight=a;this.margins=d;this.beforeSetDimensions();this.setDimensions();this.afterSetDimensions();this.beforeBuildLabels();this.buildLabels();this.afterBuildLabels();this.beforeFit();this.fit();this.afterFit();this.afterUpdate();return this.minSize},afterUpdate:e.noop,
|
||||
beforeSetDimensions:e.noop,setDimensions:function(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height);this.paddingBottom=this.paddingRight=this.paddingTop=this.paddingLeft=0;this.minSize={width:0,height:0}},afterSetDimensions:e.noop,beforeBuildLabels:e.noop,buildLabels:e.noop,afterBuildLabels:e.noop,beforeFit:e.noop,fit:function(){var c=e.getValueOrDefault(this.options.fontSize,f.defaults.global.defaultFontSize),
|
||||
a=e.getValueOrDefault(this.options.fontStyle,f.defaults.global.defaultFontStyle),d=e.getValueOrDefault(this.options.fontFamily,f.defaults.global.defaultFontFamily);e.fontString(c,a,d);this.isHorizontal()?this.minSize.width=this.maxWidth:this.minSize.width=0;this.isHorizontal()?this.minSize.height=0:this.minSize.height=this.maxHeight;this.isHorizontal()?this.options.display&&(this.minSize.height+=c+2*this.options.padding):this.options.display&&(this.minSize.width+=c+2*this.options.padding);this.width=
|
||||
this.minSize.width;this.height=this.minSize.height},afterFit:e.noop,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){if(this.options.display){var c=this.ctx,a,d;a=e.getValueOrDefault(this.options.fontColor,f.defaults.global.defaultFontColor);d=e.getValueOrDefault(this.options.fontSize,f.defaults.global.defaultFontSize);var h=e.getValueOrDefault(this.options.fontStyle,f.defaults.global.defaultFontStyle),k=e.getValueOrDefault(this.options.fontFamily,
|
||||
f.defaults.global.defaultFontFamily),h=e.fontString(d,h,k);c.fillStyle=a;c.font=h;this.isHorizontal()?(c.textAlign="center",c.textBaseline="middle",a=this.left+(this.right-this.left)/2,d=this.top+(this.bottom-this.top)/2,c.fillText(this.options.text,a,d)):(a="left"===this.options.position?this.left+d/2:this.right-d/2,d=this.top+(this.bottom-this.top)/2,h="left"===this.options.position?-.5*Math.PI:.5*Math.PI,c.save(),c.translate(a,d),c.rotate(h),c.textAlign="center",c.textBaseline="middle",c.fillText(this.options.text,
|
||||
0,0),c.restore())}}})}},{}],32:[function(p,m,n){m.exports=function(f){function e(a,d){d&&(c.isArray(d)?a=a.concat(d):a.push(d));return a}var c=f.helpers;f.defaults.global.tooltips={enabled:!0,custom:null,mode:"single",backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleColor:"#fff",titleAlign:"left",bodySpacing:2,bodyColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,
|
||||
yAlign:"center",xAlign:"center",caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",callbacks:{beforeTitle:c.noop,title:function(a,c){var e="";0<a.length&&(a[0].xLabel?e=a[0].xLabel:0<c.labels.length&&a[0].index<c.labels.length&&(e=c.labels[a[0].index]));return e},afterTitle:c.noop,beforeBody:c.noop,beforeLabel:c.noop,label:function(a,c){return(c.datasets[a.datasetIndex].label||"")+": "+a.yLabel},afterLabel:c.noop,afterBody:c.noop,beforeFooter:c.noop,footer:c.noop,afterFooter:c.noop}};f.Tooltip=
|
||||
f.Element.extend({initialize:function(){var a=this._options;c.extend(this,{_model:{xPadding:a.tooltips.xPadding,yPadding:a.tooltips.yPadding,xAlign:a.tooltips.yAlign,yAlign:a.tooltips.xAlign,bodyColor:a.tooltips.bodyColor,_bodyFontFamily:c.getValueOrDefault(a.tooltips.bodyFontFamily,f.defaults.global.defaultFontFamily),_bodyFontStyle:c.getValueOrDefault(a.tooltips.bodyFontStyle,f.defaults.global.defaultFontStyle),_bodyAlign:a.tooltips.bodyAlign,bodyFontSize:c.getValueOrDefault(a.tooltips.bodyFontSize,
|
||||
f.defaults.global.defaultFontSize),bodySpacing:a.tooltips.bodySpacing,titleColor:a.tooltips.titleColor,_titleFontFamily:c.getValueOrDefault(a.tooltips.titleFontFamily,f.defaults.global.defaultFontFamily),_titleFontStyle:c.getValueOrDefault(a.tooltips.titleFontStyle,f.defaults.global.defaultFontStyle),titleFontSize:c.getValueOrDefault(a.tooltips.titleFontSize,f.defaults.global.defaultFontSize),_titleAlign:a.tooltips.titleAlign,titleSpacing:a.tooltips.titleSpacing,titleMarginBottom:a.tooltips.titleMarginBottom,
|
||||
footerColor:a.tooltips.footerColor,_footerFontFamily:c.getValueOrDefault(a.tooltips.footerFontFamily,f.defaults.global.defaultFontFamily),_footerFontStyle:c.getValueOrDefault(a.tooltips.footerFontStyle,f.defaults.global.defaultFontStyle),footerFontSize:c.getValueOrDefault(a.tooltips.footerFontSize,f.defaults.global.defaultFontSize),_footerAlign:a.tooltips.footerAlign,footerSpacing:a.tooltips.footerSpacing,footerMarginTop:a.tooltips.footerMarginTop,caretSize:a.tooltips.caretSize,cornerRadius:a.tooltips.cornerRadius,
|
||||
backgroundColor:a.tooltips.backgroundColor,opacity:0,legendColorBackground:a.tooltips.multiKeyBackground}})},getTitle:function(){var a=this._options.tooltips.callbacks.beforeTitle.apply(this,arguments),c=this._options.tooltips.callbacks.title.apply(this,arguments),h=this._options.tooltips.callbacks.afterTitle.apply(this,arguments),k=[],k=e(k,a),k=e(k,c);return k=e(k,h)},getBeforeBody:function(){var a=this._options.tooltips.callbacks.beforeBody.apply(this,arguments);return c.isArray(a)?a:void 0!==
|
||||
a?[a]:[]},getBody:function(a,d){var e=[];c.each(a,function(a){c.pushAllIfDefined(this._options.tooltips.callbacks.beforeLabel.call(this,a,d),e);c.pushAllIfDefined(this._options.tooltips.callbacks.label.call(this,a,d),e);c.pushAllIfDefined(this._options.tooltips.callbacks.afterLabel.call(this,a,d),e)},this);return e},getAfterBody:function(){var a=this._options.tooltips.callbacks.afterBody.apply(this,arguments);return c.isArray(a)?a:void 0!==a?[a]:[]},getFooter:function(){var a=this._options.tooltips.callbacks.beforeFooter.apply(this,
|
||||
arguments),c=this._options.tooltips.callbacks.footer.apply(this,arguments),h=this._options.tooltips.callbacks.afterFooter.apply(this,arguments),k=[],k=e(k,a),k=e(k,c);return k=e(k,h)},getAveragePosition:function(a){if(!a.length)return!1;var d=[],e=[];c.each(a,function(a){a&&(a=a.tooltipPosition(),d.push(a.x),e.push(a.y))});for(var k=a=0,f=0;f<d.length;f++)a+=d[f],k+=e[f];return{x:Math.round(a/d.length),y:Math.round(k/d.length)}},update:function(a){if(this._active.length){this._model.opacity=1;var d=
|
||||
this._active[0],e=[],k,f=[];"single"===this._options.tooltips.mode?(k=d._yScale||d._scale,f.push({xLabel:d._xScale?d._xScale.getLabelForIndex(d._index,d._datasetIndex):"",yLabel:k?k.getLabelForIndex(d._index,d._datasetIndex):"",index:d._index,datasetIndex:d._datasetIndex}),k=this.getAveragePosition(this._active)):(c.each(this._data.datasets,function(a,e){if(c.isDatasetVisible(a)){var h=a.metaData[d._index];if(h){var k=d._yScale||d._scale;f.push({xLabel:h._xScale?h._xScale.getLabelForIndex(h._index,
|
||||
h._datasetIndex):"",yLabel:k?k.getLabelForIndex(h._index,h._datasetIndex):"",index:d._index,datasetIndex:e})}}},null,d._yScale.options.stacked),c.each(this._active,function(a){a&&e.push({borderColor:a._view.borderColor,backgroundColor:a._view.backgroundColor})},null,d._yScale.options.stacked),k=this.getAveragePosition(this._active),k.y=this._active[0]._yScale.getPixelForDecimal(.5));c.extend(this._model,{title:this.getTitle(f,this._data),beforeBody:this.getBeforeBody(f,this._data),body:this.getBody(f,
|
||||
this._data),afterBody:this.getAfterBody(f,this._data),footer:this.getFooter(f,this._data)});c.extend(this._model,{x:Math.round(k.x),y:Math.round(k.y),caretPadding:c.getValueOrDefault(k.padding,2),labelColors:e});k=this.getTooltipSize(this._model);this.determineAlignment(k);c.extend(this._model,this.getBackgroundPoint(this._model,k))}else this._model.opacity=0;a&&this._options.tooltips.custom&&this._options.tooltips.custom.call(this,this._model);return this},getTooltipSize:function(a){var d=this._chart.ctx,
|
||||
e={height:2*a.yPadding,width:0},k=a.body.length+a.beforeBody.length+a.afterBody.length;e.height+=a.title.length*a.titleFontSize;e.height+=(a.title.length-1)*a.titleSpacing;e.height+=a.title.length?a.titleMarginBottom:0;e.height+=k*a.bodyFontSize;e.height+=k?(k-1)*a.bodySpacing:0;e.height+=a.footer.length?a.footerMarginTop:0;e.height+=a.footer.length*a.footerFontSize;e.height+=a.footer.length?(a.footer.length-1)*a.footerSpacing:0;d.font=c.fontString(a.titleFontSize,a._titleFontStyle,a._titleFontFamily);
|
||||
c.each(a.title,function(a){e.width=Math.max(e.width,d.measureText(a).width)});d.font=c.fontString(a.bodyFontSize,a._bodyFontStyle,a._bodyFontFamily);c.each(a.beforeBody.concat(a.afterBody),function(a){e.width=Math.max(e.width,d.measureText(a).width)});c.each(a.body,function(c){e.width=Math.max(e.width,d.measureText(c).width+("single"!==this._options.tooltips.mode?a.bodyFontSize+2:0))},this);d.font=c.fontString(a.footerFontSize,a._footerFontStyle,a._footerFontFamily);c.each(a.footer,function(a){e.width=
|
||||
Math.max(e.width,d.measureText(a).width)});e.width+=2*a.xPadding;return e},determineAlignment:function(a){this._model.y<a.height?this._model.yAlign="top":this._model.y>this._chart.height-a.height&&(this._model.yAlign="bottom");var c,e,k,f,q,m=this,n=(this._chartInstance.chartArea.left+this._chartInstance.chartArea.right)/2,p=(this._chartInstance.chartArea.top+this._chartInstance.chartArea.bottom)/2;"center"===this._model.yAlign?(c=function(a){return a<=n},e=function(a){return a>n}):(c=function(c){return c<=
|
||||
a.width/2},e=function(c){return c>=m._chart.width-a.width/2});k=function(c){return c+a.width>m._chart.width};f=function(c){return 0>c-a.width};q=function(a){return a<=p?"top":"bottom"};c(this._model.x)?(this._model.xAlign="left",k(this._model.x)&&(this._model.xAlign="center",this._model.yAlign=q(this._model.y))):e(this._model.x)&&(this._model.xAlign="right",f(this._model.x)&&(this._model.xAlign="center",this._model.yAlign=q(this._model.y)))},getBackgroundPoint:function(a,c){var e={x:a.x,y:a.y};"right"===
|
||||
a.xAlign?e.x-=c.width:"center"===a.xAlign&&(e.x-=c.width/2);e.y="top"===a.yAlign?e.y+(a.caretPadding+a.caretSize):"bottom"===a.yAlign?e.y-(c.height+a.caretPadding+a.caretSize):e.y-c.height/2;"center"===a.yAlign?"left"===a.xAlign?e.x+=a.caretPadding+a.caretSize:"right"===a.xAlign&&(e.x-=a.caretPadding+a.caretSize):"left"===a.xAlign?e.x-=a.cornerRadius+a.caretPadding:"right"===a.xAlign&&(e.x+=a.cornerRadius+a.caretPadding);return e},drawCaret:function(a,d,e,k){var f=this._view;k=this._chart.ctx;var q,
|
||||
m,n,p;"center"===f.yAlign?("left"===f.xAlign?(q=a.x,m=q-f.caretSize):(q=a.x+d.width,m=q+f.caretSize),n=q,d=a.y+d.height/2,a=d-f.caretSize,p=d+f.caretSize):("left"===f.xAlign?(q=a.x+f.cornerRadius,m=q+f.caretSize,n=m+f.caretSize):"right"===f.xAlign?(q=a.x+d.width-f.cornerRadius,m=q-f.caretSize,n=m-f.caretSize):(m=a.x+d.width/2,q=m-f.caretSize,n=m+f.caretSize),"top"===f.yAlign?(a=a.y,d=a-f.caretSize):(a=a.y+d.height,d=a+f.caretSize),p=a);f=c.color(f.backgroundColor);k.fillStyle=f.alpha(e*f.alpha()).rgbString();
|
||||
k.beginPath();k.moveTo(q,a);k.lineTo(m,d);k.lineTo(n,p);k.closePath();k.fill()},drawTitle:function(a,d,e,k){if(d.title.length){e.textAlign=d._titleAlign;e.textBaseline="top";var f=c.color(d.titleColor);e.fillStyle=f.alpha(k*f.alpha()).rgbString();e.font=c.fontString(d.titleFontSize,d._titleFontStyle,d._titleFontFamily);c.each(d.title,function(c,k){e.fillText(c,a.x,a.y);a.y+=d.titleFontSize+d.titleSpacing;k+1===d.title.length&&(a.y+=d.titleMarginBottom-d.titleSpacing)})}},drawBody:function(a,d,e,k){e.textAlign=
|
||||
d._bodyAlign;e.textBaseline="top";var f=c.color(d.bodyColor);e.fillStyle=f.alpha(k*f.alpha()).rgbString();e.font=c.fontString(d.bodyFontSize,d._bodyFontStyle,d._bodyFontFamily);c.each(d.beforeBody,function(c){e.fillText(c,a.x,a.y);a.y+=d.bodyFontSize+d.bodySpacing});c.each(d.body,function(f,l){"single"!==this._options.tooltips.mode&&(e.fillStyle=c.color(d.legendColorBackground).alpha(k).rgbaString(),e.fillRect(a.x,a.y,d.bodyFontSize,d.bodyFontSize),e.strokeStyle=c.color(d.labelColors[l].borderColor).alpha(k).rgbaString(),
|
||||
e.strokeRect(a.x,a.y,d.bodyFontSize,d.bodyFontSize),e.fillStyle=c.color(d.labelColors[l].backgroundColor).alpha(k).rgbaString(),e.fillRect(a.x+1,a.y+1,d.bodyFontSize-2,d.bodyFontSize-2),e.fillStyle=c.color(d.bodyColor).alpha(k).rgbaString());e.fillText(f,a.x+("single"!==this._options.tooltips.mode?d.bodyFontSize+2:0),a.y);a.y+=d.bodyFontSize+d.bodySpacing},this);c.each(d.afterBody,function(c){e.fillText(c,a.x,a.y);a.y+=d.bodyFontSize});a.y-=d.bodySpacing},drawFooter:function(a,d,e,k){if(d.footer.length){a.y+=
|
||||
d.footerMarginTop;e.textAlign=d._footerAlign;e.textBaseline="top";var f=c.color(d.footerColor);e.fillStyle=f.alpha(k*f.alpha()).rgbString();e.font=c.fontString(d.footerFontSize,d._footerFontStyle,d._footerFontFamily);c.each(d.footer,function(c){e.fillText(c,a.x,a.y);a.y+=d.footerFontSize+d.footerSpacing})}},draw:function(){var a=this._chart.ctx,d=this._view;if(0!==d.opacity){var e=d.caretPadding,k=this.getTooltipSize(d),f={x:d.x,y:d.y},q=Math.abs(.001>d.opacity)?0:d.opacity;if(this._options.tooltips.enabled){var m=
|
||||
c.color(d.backgroundColor);a.fillStyle=m.alpha(q*m.alpha()).rgbString();c.drawRoundedRectangle(a,f.x,f.y,k.width,k.height,d.cornerRadius);a.fill();this.drawCaret(f,k,q,e);f.x+=d.xPadding;f.y+=d.yPadding;this.drawTitle(f,d,a,q);this.drawBody(f,d,a,q);this.drawFooter(f,d,a,q)}}}})}},{}],33:[function(p,m,n){m.exports=function(f,e){var c=f.helpers;f.defaults.global.elements.arc={backgroundColor:f.defaults.global.defaultColor,borderColor:"#fff",borderWidth:2};f.elements.Arc=f.Element.extend({inLabelRange:function(a){var c=
|
||||
this._view;return c?Math.pow(a-c.x,2)<Math.pow(c.radius+c.hoverRadius,2):!1},inRange:function(a,d){var e=this._view;if(e){for(var f=c.getAngleFromPoint(e,{x:a,y:d}),l=e.startAngle,q=e.endAngle;q<l;)q+=2*Math.PI;for(;f.angle>q;)f.angle-=2*Math.PI;for(;f.angle<l;)f.angle+=2*Math.PI;e=f.distance>=e.innerRadius&&f.distance<=e.outerRadius;return f.angle>=l&&f.angle<=q&&e}return!1},tooltipPosition:function(){var a=this._view,c=a.startAngle+(a.endAngle-a.startAngle)/2,e=(a.outerRadius-a.innerRadius)/2+a.innerRadius;
|
||||
return{x:a.x+Math.cos(c)*e,y:a.y+Math.sin(c)*e}},draw:function(){var a=this._chart.ctx,c=this._view;a.beginPath();a.arc(c.x,c.y,c.outerRadius,c.startAngle,c.endAngle);a.arc(c.x,c.y,c.innerRadius,c.endAngle,c.startAngle,!0);a.closePath();a.strokeStyle=c.borderColor;a.lineWidth=c.borderWidth;a.fillStyle=c.backgroundColor;a.fill();a.lineJoin="bevel";c.borderWidth&&a.stroke()}})}},{}],34:[function(p,m,n){m.exports=function(f){var e=f.helpers;f.defaults.global.elements.line={tension:.4,backgroundColor:f.defaults.global.defaultColor,
|
||||
borderWidth:3,borderColor:f.defaults.global.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",fill:!0};f.elements.Line=f.Element.extend({lineToNextPoint:function(c,a,d,e,f){var l=this._chart.ctx;a._view.skip?e.call(this,c,a,d):c._view.skip?f.call(this,c,a,d):0===a._view.tension?l.lineTo(a._view.x,a._view.y):l.bezierCurveTo(c._view.controlPointNextX,c._view.controlPointNextY,a._view.controlPointPreviousX,a._view.controlPointPreviousY,a._view.x,a._view.y)},
|
||||
draw:function(){function c(c){k._view.skip||l._view.skip?c&&h.lineTo(a._view.scaleZero.x,a._view.scaleZero.y):h.bezierCurveTo(l._view.controlPointNextX,l._view.controlPointNextY,k._view.controlPointPreviousX,k._view.controlPointPreviousY,k._view.x,k._view.y)}var a=this,d=this._view,h=this._chart.ctx,k=this._children[0],l=this._children[this._children.length-1];h.save();0<this._children.length&&d.fill&&(h.beginPath(),e.each(this._children,function(a,c){var f=e.previousItem(this._children,c),k=e.nextItem(this._children,
|
||||
c);0===c?(this._loop?h.moveTo(d.scaleZero.x,d.scaleZero.y):h.moveTo(a._view.x,d.scaleZero),a._view.skip?this._loop||h.moveTo(k._view.x,this._view.scaleZero):h.lineTo(a._view.x,a._view.y)):this.lineToNextPoint(f,a,k,function(a,c,d){this._loop?h.lineTo(this._view.scaleZero.x,this._view.scaleZero.y):(h.lineTo(a._view.x,this._view.scaleZero),h.moveTo(d._view.x,this._view.scaleZero))},function(a,c){h.lineTo(c._view.x,c._view.y)})},this),this._loop?c(!0):(h.lineTo(this._children[this._children.length-1]._view.x,
|
||||
d.scaleZero),h.lineTo(this._children[0]._view.x,d.scaleZero)),h.fillStyle=d.backgroundColor||f.defaults.global.defaultColor,h.closePath(),h.fill());h.lineCap=d.borderCapStyle||f.defaults.global.elements.line.borderCapStyle;h.setLineDash&&h.setLineDash(d.borderDash||f.defaults.global.elements.line.borderDash);h.lineDashOffset=d.borderDashOffset||f.defaults.global.elements.line.borderDashOffset;h.lineJoin=d.borderJoinStyle||f.defaults.global.elements.line.borderJoinStyle;h.lineWidth=d.borderWidth||
|
||||
f.defaults.global.elements.line.borderWidth;h.strokeStyle=d.borderColor||f.defaults.global.defaultColor;h.beginPath();e.each(this._children,function(a,c){var d=e.previousItem(this._children,c),f=e.nextItem(this._children,c);0===c?h.moveTo(a._view.x,a._view.y):this.lineToNextPoint(d,a,f,function(a,c,d){h.moveTo(d._view.x,d._view.y)},function(a,c){h.moveTo(c._view.x,c._view.y)})},this);this._loop&&0<this._children.length&&c();h.stroke();h.restore()}})}},{}],35:[function(p,m,n){m.exports=function(f){var e=
|
||||
f.helpers;f.defaults.global.elements.point={radius:3,pointStyle:"circle",backgroundColor:f.defaults.global.defaultColor,borderWidth:1,borderColor:f.defaults.global.defaultColor,hitRadius:1,hoverRadius:4,hoverBorderWidth:1};f.elements.Point=f.Element.extend({inRange:function(c,a){var d=this._view;return d?Math.pow(c-d.x,2)+Math.pow(a-d.y,2)<Math.pow(d.hitRadius+d.radius,2):!1},inLabelRange:function(c){var a=this._view;return a?Math.pow(c-a.x,2)<Math.pow(a.radius+a.hitRadius,2):!1},tooltipPosition:function(){var c=
|
||||
this._view;return{x:c.x,y:c.y,padding:c.radius+c.borderWidth}},draw:function(){var c=this._view,a=this._chart.ctx;if(!c.skip)if("object"===typeof c.pointStyle&&("[object HTMLImageElement]"===c.pointStyle.toString()||"[object HTMLCanvasElement]"===c.pointStyle.toString()))a.drawImage(c.pointStyle,c.x-c.pointStyle.width/2,c.y-c.pointStyle.height/2);else if(!isNaN(c.radius)&&0<c.radius){a.strokeStyle=c.borderColor||f.defaults.global.defaultColor;a.lineWidth=e.getValueOrDefault(c.borderWidth,f.defaults.global.elements.point.borderWidth);
|
||||
a.fillStyle=c.backgroundColor||f.defaults.global.defaultColor;var d=c.radius,h;switch(c.pointStyle){default:a.beginPath();a.arc(c.x,c.y,d,0,2*Math.PI);a.closePath();a.fill();break;case "triangle":a.beginPath();h=3*d/Math.sqrt(3);d=h*Math.sqrt(3)/2;a.moveTo(c.x-h/2,c.y+d/3);a.lineTo(c.x+h/2,c.y+d/3);a.lineTo(c.x,c.y-2*d/3);a.closePath();a.fill();break;case "rect":a.fillRect(c.x-1/Math.SQRT2*d,c.y-1/Math.SQRT2*d,2/Math.SQRT2*d,2/Math.SQRT2*d);a.strokeRect(c.x-1/Math.SQRT2*d,c.y-1/Math.SQRT2*d,2/Math.SQRT2*
|
||||
d,2/Math.SQRT2*d);break;case "rectRot":a.translate(c.x,c.y);a.rotate(Math.PI/4);a.fillRect(-1/Math.SQRT2*d,-1/Math.SQRT2*d,2/Math.SQRT2*d,2/Math.SQRT2*d);a.strokeRect(-1/Math.SQRT2*d,-1/Math.SQRT2*d,2/Math.SQRT2*d,2/Math.SQRT2*d);a.setTransform(1,0,0,1,0,0);break;case "cross":a.beginPath();a.moveTo(c.x,c.y+d);a.lineTo(c.x,c.y-d);a.moveTo(c.x-d,c.y);a.lineTo(c.x+d,c.y);a.closePath();break;case "crossRot":a.beginPath();h=Math.cos(Math.PI/4)*d;d*=Math.sin(Math.PI/4);a.moveTo(c.x-h,c.y-d);a.lineTo(c.x+
|
||||
h,c.y+d);a.moveTo(c.x-h,c.y+d);a.lineTo(c.x+h,c.y-d);a.closePath();break;case "star":a.beginPath();a.moveTo(c.x,c.y+d);a.lineTo(c.x,c.y-d);a.moveTo(c.x-d,c.y);a.lineTo(c.x+d,c.y);h=Math.cos(Math.PI/4)*d;d*=Math.sin(Math.PI/4);a.moveTo(c.x-h,c.y-d);a.lineTo(c.x+h,c.y+d);a.moveTo(c.x-h,c.y+d);a.lineTo(c.x+h,c.y-d);a.closePath();break;case "line":a.beginPath();a.moveTo(c.x-d,c.y);a.lineTo(c.x+d,c.y);a.closePath();break;case "dash":a.beginPath(),a.moveTo(c.x,c.y),a.lineTo(c.x+d,c.y),a.closePath()}a.stroke()}}})}},
|
||||
{}],36:[function(p,m,n){m.exports=function(f){f.defaults.global.elements.rectangle={backgroundColor:f.defaults.global.defaultColor,borderWidth:0,borderColor:f.defaults.global.defaultColor,borderSkipped:"bottom"};f.elements.Rectangle=f.Element.extend({draw:function(){var e=this._chart.ctx,c=this._view,a=c.width/2,d=c.x-a,a=c.x+a,h=c.base-(c.base-c.y),f=c.borderWidth/2;c.borderWidth&&(d+=f,a-=f,h+=f);e.beginPath();e.fillStyle=c.backgroundColor;e.strokeStyle=c.borderColor;e.lineWidth=c.borderWidth;d=
|
||||
[[d,c.base],[d,h],[a,h],[a,c.base]];a=["bottom","left","top","right"].indexOf(c.borderSkipped,0);-1===a&&(a=0);e.moveTo.apply(e,d[(a+0)%4]);for(h=1;4>h;h++)e.lineTo.apply(e,d[(a+h)%4]);e.fill();c.borderWidth&&e.stroke()},height:function(){var e=this._view;return e.base-e.y},inRange:function(e,c){var a=this._view,d=!1;a&&(d=a.y<a.base?e>=a.x-a.width/2&&e<=a.x+a.width/2&&c>=a.y&&c<=a.base:e>=a.x-a.width/2&&e<=a.x+a.width/2&&c>=a.base&&c<=a.y);return d},inLabelRange:function(e){var c=this._view;return c?
|
||||
e>=c.x-c.width/2&&e<=c.x+c.width/2:!1},tooltipPosition:function(){var e=this._view;return{x:e.x,y:e.y}}})}},{}],37:[function(p,m,n){m.exports=function(f){var e=f.helpers,c=f.Scale.extend({buildTicks:function(a){this.startIndex=0;this.endIndex=this.chart.data.labels.length;void 0!==this.options.ticks.min&&(a=e.indexOf(this.chart.data.labels,this.options.ticks.min),this.startIndex=-1!==a?a:this.startIndex);void 0!==this.options.ticks.max&&(a=e.indexOf(this.chart.data.labels,this.options.ticks.max),
|
||||
this.endIndex=-1!==a?a:this.endIndex);this.ticks=0===this.startIndex&&this.endIndex===this.chart.data.labels.length?this.chart.data.labels:this.chart.data.labels.slice(this.startIndex,this.endIndex+1)},getLabelForIndex:function(a,c){return this.ticks[a]},getPixelForValue:function(a,c,e,f){a=Math.max(this.ticks.length-(this.options.gridLines.offsetGridLines?0:1),1);if(this.isHorizontal())return a=(this.width-(this.paddingLeft+this.paddingRight))/a,c=a*(c-this.startIndex)+this.paddingLeft,this.options.gridLines.offsetGridLines&&
|
||||
f&&(c+=a/2),this.left+Math.round(c);a=(this.height-(this.paddingTop+this.paddingBottom))/a;c=a*(c-this.startIndex)+this.paddingTop;this.options.gridLines.offsetGridLines&&f&&(c+=a/2);return this.top+Math.round(c)},getPixelForTick:function(a,c){return this.getPixelForValue(this.ticks[a],a+this.startIndex,null,c)}});f.scaleService.registerScaleType("category",c,{position:"bottom"})}},{}],38:[function(p,m,n){m.exports=function(f){var e=f.helpers,c=f.Scale.extend({determineDataLimits:function(){this.max=
|
||||
this.min=null;if(this.options.stacked){var a={};e.each(this.chart.data.datasets,function(c){void 0===a[c.type]&&(a[c.type]={positiveValues:[],negativeValues:[]});var d=a[c.type].positiveValues,h=a[c.type].negativeValues;e.isDatasetVisible(c)&&(this.isHorizontal()?c.xAxisID===this.id:c.yAxisID===this.id)&&e.each(c.data,function(a,c){var e=+this.getRightValue(a);isNaN(e)||(d[c]=d[c]||0,h[c]=h[c]||0,this.options.relativePoints?d[c]=100:0>e?h[c]+=e:d[c]+=e)},this)},this);e.each(a,function(a){var c=a.positiveValues.concat(a.negativeValues);
|
||||
a=e.min(c);c=e.max(c);this.min=null===this.min?a:Math.min(this.min,a);this.max=null===this.max?c:Math.max(this.max,c)},this)}else e.each(this.chart.data.datasets,function(a){e.isDatasetVisible(a)&&(this.isHorizontal()?a.xAxisID===this.id:a.yAxisID===this.id)&&e.each(a.data,function(a,c){var d=+this.getRightValue(a);isNaN(d)||(null===this.min?this.min=d:d<this.min&&(this.min=d),null===this.max?this.max=d:d>this.max&&(this.max=d))},this)},this);if(this.options.ticks.beginAtZero){var c=e.sign(this.min),
|
||||
h=e.sign(this.max);0>c&&0>h?this.max=0:0<c&&0<h&&(this.min=0)}void 0!==this.options.ticks.min?this.min=this.options.ticks.min:void 0!==this.options.ticks.suggestedMin&&(this.min=Math.min(this.min,this.options.ticks.suggestedMin));void 0!==this.options.ticks.max?this.max=this.options.ticks.max:void 0!==this.options.ticks.suggestedMax&&(this.max=Math.max(this.max,this.options.ticks.suggestedMax));this.min===this.max&&(this.min--,this.max++)},buildTicks:function(){this.ticks=[];var a;this.isHorizontal()?
|
||||
a=Math.min(this.options.ticks.maxTicksLimit?this.options.ticks.maxTicksLimit:11,Math.ceil(this.width/50)):(a=e.getValueOrDefault(this.options.ticks.fontSize,f.defaults.global.defaultFontSize),a=Math.min(this.options.ticks.maxTicksLimit?this.options.ticks.maxTicksLimit:11,Math.ceil(this.height/(2*a))));a=Math.max(2,a);if(this.options.ticks.fixedStepSize&&0<this.options.ticks.fixedStepSize||this.options.ticks.stepSize&&0<this.options.ticks.stepSize)a=e.getValueOrDefault(this.options.ticks.fixedStepSize,
|
||||
this.options.ticks.stepSize);else{var c=e.niceNum(this.max-this.min,!1);a=e.niceNum(c/(a-1),!0)}var c=Math.floor(this.min/a)*a,h=Math.ceil(this.max/a)*a,k=(h-c)/a,k=e.almostEquals(k,Math.round(k),a/1E3)?Math.round(k):Math.ceil(k);this.ticks.push(void 0!==this.options.ticks.min?this.options.ticks.min:c);for(var l=1;l<k;++l)this.ticks.push(c+l*a);this.ticks.push(void 0!==this.options.ticks.max?this.options.ticks.max:h);"left"!==this.options.position&&"right"!==this.options.position||this.ticks.reverse();
|
||||
this.max=e.max(this.ticks);this.min=e.min(this.ticks);this.options.ticks.reverse?(this.ticks.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max)},getLabelForIndex:function(a,c){return+this.getRightValue(this.chart.data.datasets[c].data[a])},convertTicksToLabels:function(){this.ticksAsNumbers=this.ticks.slice();this.zeroLineIndex=this.ticks.indexOf(0);f.Scale.prototype.convertTicksToLabels.call(this)},getPixelForValue:function(a,c,e,f){a=+this.getRightValue(a);
|
||||
c=this.end-this.start;if(this.isHorizontal())return a=this.left+(this.width-(this.paddingLeft+this.paddingRight))/c*(a-this.start),Math.round(a+this.paddingLeft);a=this.bottom-this.paddingBottom-(this.height-(this.paddingTop+this.paddingBottom))/c*(a-this.start);return Math.round(a)},getPixelForTick:function(a,c){return this.getPixelForValue(this.ticksAsNumbers[a],null,null,c)}});f.scaleService.registerScaleType("linear",c,{position:"left",ticks:{callback:function(a,c,h){c=h[1]-h[0];1<Math.abs(c)&&
|
||||
a!==Math.floor(a)&&(c=a-Math.floor(a));c=e.log10(Math.abs(c));h="";0!==a?(c=-1*Math.floor(c),c=Math.max(Math.min(c,20),0),h=a.toFixed(c)):h="0";return h}}})}},{}],39:[function(p,m,n){m.exports=function(f){var e=f.helpers,c=f.Scale.extend({determineDataLimits:function(){this.max=this.min=null;if(this.options.stacked){var a={};e.each(this.chart.data.datasets,function(c){e.isDatasetVisible(c)&&(this.isHorizontal()?c.xAxisID===this.id:c.yAxisID===this.id)&&(void 0===a[c.type]&&(a[c.type]=[]),e.each(c.data,
|
||||
function(e,f){var l=a[c.type],q=+this.getRightValue(e);isNaN(q)||(l[f]=l[f]||0,l[f]=this.options.relativePoints?100:l[f]+q)},this))},this);e.each(a,function(a){var c=e.min(a);a=e.max(a);this.min=null===this.min?c:Math.min(this.min,c);this.max=null===this.max?a:Math.max(this.max,a)},this)}else e.each(this.chart.data.datasets,function(a){e.isDatasetVisible(a)&&(this.isHorizontal()?a.xAxisID===this.id:a.yAxisID===this.id)&&e.each(a.data,function(a,c){var d=+this.getRightValue(a);isNaN(d)||(null===this.min?
|
||||
this.min=d:d<this.min&&(this.min=d),null===this.max?this.max=d:d>this.max&&(this.max=d))},this)},this);this.min=void 0!==this.options.ticks.min?this.options.ticks.min:this.min;this.max=void 0!==this.options.ticks.max?this.options.ticks.max:this.max;this.min===this.max&&(0!==this.min&&null!==this.min?(this.min=Math.pow(10,Math.floor(e.log10(this.min))-1),this.max=Math.pow(10,Math.floor(e.log10(this.max))+1)):(this.min=1,this.max=10))},buildTicks:function(){this.ticks=[];for(var a=void 0!==this.options.ticks.min?
|
||||
this.options.ticks.min:Math.pow(10,Math.floor(e.log10(this.min)));a<this.max;){this.ticks.push(a);var c=Math.floor(e.log10(a)),a=Math.floor(a/Math.pow(10,c))+1;10===a&&(a=1,++c);a*=Math.pow(10,c)}this.ticks.push(void 0!==this.options.ticks.max?this.options.ticks.max:a);"left"!==this.options.position&&"right"!==this.options.position||this.ticks.reverse();this.max=e.max(this.ticks);this.min=e.min(this.ticks);this.options.ticks.reverse?(this.ticks.reverse(),this.start=this.max,this.end=this.min):(this.start=
|
||||
this.min,this.end=this.max)},convertTicksToLabels:function(){this.tickValues=this.ticks.slice();f.Scale.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(a,c){return+this.getRightValue(this.chart.data.datasets[c].data[a])},getPixelForTick:function(a,c){return this.getPixelForValue(this.tickValues[a],null,null,c)},getPixelForValue:function(a,c,h,f){a=+this.getRightValue(a);c=e.log10(this.end)-e.log10(this.start);this.isHorizontal()?0===a?a=this.left+this.paddingLeft:(a=this.left+
|
||||
(this.width-(this.paddingLeft+this.paddingRight))/c*(e.log10(a)-e.log10(this.start)),a+=this.paddingLeft):a=0===a?this.top+this.paddingTop:this.bottom-this.paddingBottom-(this.height-(this.paddingTop+this.paddingBottom))/c*(e.log10(a)-e.log10(this.start));return a}});f.scaleService.registerScaleType("logarithmic",c,{position:"left",ticks:{callback:function(a,c,e){var k=a/Math.pow(10,Math.floor(f.helpers.log10(a)));return 1===k||2===k||5===k||0===c||c===e.length-1?a.toExponential():""}}})}},{}],40:[function(p,
|
||||
m,n){m.exports=function(f){var e=f.helpers,c=f.Scale.extend({getValueCount:function(){return this.chart.data.labels.length},setDimensions:function(){this.width=this.maxWidth;this.height=this.maxHeight;this.xCenter=Math.round(this.width/2);this.yCenter=Math.round(this.height/2);var a=e.min([this.height,this.width]),c=e.getValueOrDefault(this.options.ticks.fontSize,f.defaults.global.defaultFontSize);this.drawingArea=this.options.display?a/2-(c/2+this.options.ticks.backdropPaddingY):a/2},determineDataLimits:function(){this.max=
|
||||
this.min=null;e.each(this.chart.data.datasets,function(a){e.isDatasetVisible(a)&&e.each(a.data,function(a,c){var d=+this.getRightValue(a);isNaN(d)||(null===this.min?this.min=d:d<this.min&&(this.min=d),null===this.max?this.max=d:d>this.max&&(this.max=d))},this)},this);if(this.options.ticks.beginAtZero){var a=e.sign(this.min),c=e.sign(this.max);0>a&&0>c?this.max=0:0<a&&0<c&&(this.min=0)}void 0!==this.options.ticks.min?this.min=this.options.ticks.min:void 0!==this.options.ticks.suggestedMin&&(this.min=
|
||||
Math.min(this.min,this.options.ticks.suggestedMin));void 0!==this.options.ticks.max?this.max=this.options.ticks.max:void 0!==this.options.ticks.suggestedMax&&(this.max=Math.max(this.max,this.options.ticks.suggestedMax));this.min===this.max&&(this.min--,this.max++)},buildTicks:function(){this.ticks=[];var a=e.getValueOrDefault(this.options.ticks.fontSize,f.defaults.global.defaultFontSize),a=Math.min(this.options.ticks.maxTicksLimit?this.options.ticks.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*
|
||||
a))),a=Math.max(2,a),c=e.niceNum(this.max-this.min,!1),a=e.niceNum(c/(a-1),!0),c=Math.floor(this.min/a)*a,h=Math.ceil(this.max/a)*a,k=Math.ceil((h-c)/a);this.ticks.push(void 0!==this.options.ticks.min?this.options.ticks.min:c);for(var l=1;l<k;++l)this.ticks.push(c+l*a);this.ticks.push(void 0!==this.options.ticks.max?this.options.ticks.max:h);this.max=e.max(this.ticks);this.min=e.min(this.ticks);this.options.ticks.reverse?(this.ticks.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,
|
||||
this.end=this.max);this.zeroLineIndex=this.ticks.indexOf(0)},convertTicksToLabels:function(){f.Scale.prototype.convertTicksToLabels.call(this);this.pointLabels=this.chart.data.labels.map(this.options.pointLabels.callback,this)},getLabelForIndex:function(a,c){return+this.getRightValue(this.chart.data.datasets[c].data[a])},fit:function(){var a=e.getValueOrDefault(this.options.pointLabels.fontSize,f.defaults.global.defaultFontSize),c=e.getValueOrDefault(this.options.pointLabels.fontStyle,f.defaults.global.defaultFontStyle),
|
||||
h=e.getValueOrDefault(this.options.pointLabels.fontFamily,f.defaults.global.defaultFontFamily),k=e.fontString(a,c,h),a=e.min([this.height/2-a-5,this.width/2]),l,m,c=this.width,n,h=0,p;this.ctx.font=k;for(l=0;l<this.getValueCount();l++)k=this.getPointPosition(l,a),m=this.ctx.measureText(this.pointLabels[l]?this.pointLabels[l]:"").width+5,0===l||l===this.getValueCount()/2?(m/=2,k.x+m>c&&(c=k.x+m,n=l),k.x-m<h&&(h=k.x-m,p=l)):l<this.getValueCount()/2?k.x+m>c&&(c=k.x+m,n=l):l>this.getValueCount()/2&&k.x-
|
||||
m<h&&(h=k.x-m,p=l);c=Math.ceil(c-this.width);n=this.getIndexAngle(n);p=this.getIndexAngle(p);n=c/Math.sin(n+Math.PI/2);p=h/Math.sin(p+Math.PI/2);n=e.isNumber(n)?n:0;p=e.isNumber(p)?p:0;this.drawingArea=Math.round(a-(p+n)/2);this.setCenterPoint(p,n)},setCenterPoint:function(a,c){this.xCenter=Math.round((a+this.drawingArea+(this.width-c-this.drawingArea))/2+this.left);this.yCenter=Math.round(this.height/2+this.top)},getIndexAngle:function(a){var c=2*Math.PI/this.getValueCount();return a*c-Math.PI/2},
|
||||
getDistanceFromCenterForValue:function(a){if(null===a)return 0;var c=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-a)*c:(a-this.min)*c},getPointPosition:function(a,c){var e=this.getIndexAngle(a);return{x:Math.round(Math.cos(e)*c)+this.xCenter,y:Math.round(Math.sin(e)*c)+this.yCenter}},getPointPositionForValue:function(a,c){return this.getPointPosition(a,this.getDistanceFromCenterForValue(c))},draw:function(){if(this.options.display){var a=this.ctx;e.each(this.ticks,function(c,
|
||||
d){if(0<d||this.options.reverse){var h=this.getDistanceFromCenterForValue(this.ticks[d]),k=this.yCenter-h;if(this.options.gridLines.display){a.strokeStyle=this.options.gridLines.color;a.lineWidth=this.options.gridLines.lineWidth;if(this.options.lineArc)a.beginPath(),a.arc(this.xCenter,this.yCenter,h,0,2*Math.PI);else for(a.beginPath(),h=0;h<this.getValueCount();h++){var l=this.getPointPosition(h,this.getDistanceFromCenterForValue(this.ticks[d]));0===h?a.moveTo(l.x,l.y):a.lineTo(l.x,l.y)}a.closePath();
|
||||
a.stroke()}if(this.options.ticks.display){var h=e.getValueOrDefault(this.options.ticks.fontColor,f.defaults.global.defaultFontColor),l=e.getValueOrDefault(this.options.ticks.fontSize,f.defaults.global.defaultFontSize),m=e.getValueOrDefault(this.options.ticks.fontStyle,f.defaults.global.defaultFontStyle),n=e.getValueOrDefault(this.options.ticks.fontFamily,f.defaults.global.defaultFontFamily),m=e.fontString(l,m,n);a.font=m;this.options.ticks.showLabelBackdrop&&(m=a.measureText(c).width,a.fillStyle=
|
||||
this.options.ticks.backdropColor,a.fillRect(this.xCenter-m/2-this.options.ticks.backdropPaddingX,k-l/2-this.options.ticks.backdropPaddingY,m+2*this.options.ticks.backdropPaddingX,l+2*this.options.ticks.backdropPaddingY));a.textAlign="center";a.textBaseline="middle";a.fillStyle=h;a.fillText(c,this.xCenter,k)}}},this);if(!this.options.lineArc){a.lineWidth=this.options.angleLines.lineWidth;a.strokeStyle=this.options.angleLines.color;for(var c=this.getValueCount()-1;0<=c;c--){if(this.options.angleLines.display){var h=
|
||||
this.getPointPosition(c,this.getDistanceFromCenterForValue(this.options.reverse?this.min:this.max));a.beginPath();a.moveTo(this.xCenter,this.yCenter);a.lineTo(h.x,h.y);a.stroke();a.closePath()}var h=this.getPointPosition(c,this.getDistanceFromCenterForValue(this.options.reverse?this.min:this.max)+5),k=e.getValueOrDefault(this.options.pointLabels.fontColor,f.defaults.global.defaultFontColor),l=e.getValueOrDefault(this.options.pointLabels.fontSize,f.defaults.global.defaultFontSize),m=e.getValueOrDefault(this.options.pointLabels.fontStyle,
|
||||
f.defaults.global.defaultFontStyle),n=e.getValueOrDefault(this.options.pointLabels.fontFamily,f.defaults.global.defaultFontFamily),l=e.fontString(l,m,n);a.font=l;a.fillStyle=k;m=this.pointLabels.length;k=this.pointLabels.length/2;n=k/2;l=c<n||c>m-n;m=c===n||c===m-n;a.textAlign=0===c?"center":c===k?"center":c<k?"left":"right";a.textBaseline=m?"middle":l?"bottom":"top";a.fillText(this.pointLabels[c]?this.pointLabels[c]:"",h.x,h.y)}}}}});f.scaleService.registerScaleType("radialLinear",c,{display:!0,
|
||||
animate:!0,lineArc:!1,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2},pointLabels:{fontSize:10,callback:function(a){return a}}})}},{}],41:[function(p,m,n){var f=p("moment"),f="function"===typeof f?f:window.moment;m.exports=function(e){var c=e.helpers,a=[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",
|
||||
steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}],d=e.Scale.extend({initialize:function(){if(!f)throw Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");e.Scale.prototype.initialize.call(this)},getLabelMoment:function(a,c){return this.labelMoments[a][c]},determineDataLimits:function(){this.labelMoments=
|
||||
[];var a=[];this.chart.data.labels&&0<this.chart.data.labels.length?(c.each(this.chart.data.labels,function(c,d){var e=this.parseTime(c);this.options.time.round&&e.startOf(this.options.time.round);a.push(e)},this),this.firstTick=f.min.call(this,a),this.lastTick=f.max.call(this,a)):this.lastTick=this.firstTick=null;c.each(this.chart.data.datasets,function(d,e){var m=[];"object"===typeof d.data[0]?c.each(d.data,function(a,c){var d=this.parseTime(this.getRightValue(a));this.options.time.round&&d.startOf(this.options.time.round);
|
||||
m.push(d);this.firstTick=null!==this.firstTick?f.min(this.firstTick,d):d;this.lastTick=null!==this.lastTick?f.max(this.lastTick,d):d},this):m=a;this.labelMoments.push(m)},this);this.options.time.min&&(this.firstTick=this.parseTime(this.options.time.min));this.options.time.max&&(this.lastTick=this.parseTime(this.options.time.max));this.firstTick=(this.firstTick||f()).clone();this.lastTick=(this.lastTick||f()).clone()},buildTicks:function(d){this.ctx.save();d=c.getValueOrDefault(this.options.ticks.fontSize,
|
||||
e.defaults.global.defaultFontSize);var f=c.getValueOrDefault(this.options.ticks.fontStyle,e.defaults.global.defaultFontStyle),l=c.getValueOrDefault(this.options.ticks.fontFamily,e.defaults.global.defaultFontFamily),f=c.fontString(d,f,l);this.ctx.font=f;this.ticks=[];this.unitScale=1;this.scaleSizeInUnits=0;if(this.options.time.unit)this.tickUnit=this.options.time.unit||"day",this.displayFormat=this.options.time.displayFormats[this.tickUnit],this.scaleSizeInUnits=this.lastTick.diff(this.firstTick,
|
||||
this.tickUnit,!0),this.unitScale=c.getValueOrDefault(this.options.time.unitStepSize,1);else{var f=this.isHorizontal()?this.width-(this.paddingLeft+this.paddingRight):this.height-(this.paddingTop+this.paddingBottom),l=this.tickFormatFunction(this.firstTick,0,[]),l=this.ctx.measureText(l).width,m=Math.cos(c.toRadians(this.options.ticks.maxRotation)),n=Math.sin(c.toRadians(this.options.ticks.maxRotation));d=f/(l*m+d*n);this.tickUnit="millisecond";this.scaleSizeInUnits=this.lastTick.diff(this.firstTick,
|
||||
this.tickUnit,!0);this.displayFormat=this.options.time.displayFormats[this.tickUnit];l=0;for(f=a[l];l<a.length;)if(this.unitScale=1,c.isArray(f.steps)&&Math.ceil(this.scaleSizeInUnits/d)<c.max(f.steps)){for(l=0;l<f.steps.length;++l)if(f.steps[l]>=Math.ceil(this.scaleSizeInUnits/d)){this.unitScale=c.getValueOrDefault(this.options.time.unitStepSize,f.steps[l]);break}break}else if(!1===f.maxStep||Math.ceil(this.scaleSizeInUnits/d)<f.maxStep){this.unitScale=c.getValueOrDefault(this.options.time.unitStepSize,
|
||||
Math.ceil(this.scaleSizeInUnits/d));break}else++l,f=a[l],this.tickUnit=f.name,this.scaleSizeInUnits=this.lastTick.diff(this.firstTick,this.tickUnit,!0),this.displayFormat=this.options.time.displayFormats[f.name]}this.options.time.min?d=this.firstTick.clone().startOf(this.tickUnit):(this.firstTick.startOf(this.tickUnit),d=this.firstTick);this.options.time.max||this.lastTick.endOf(this.tickUnit);this.smallestLabelSeparation=this.width;c.each(this.chart.data.datasets,function(a,c){for(var d=1;d<this.labelMoments[c].length;d++)this.smallestLabelSeparation=
|
||||
Math.min(this.smallestLabelSeparation,this.labelMoments[c][d].diff(this.labelMoments[c][d-1],this.tickUnit,!0))},this);this.options.time.displayFormat&&(this.displayFormat=this.options.time.displayFormat);this.ticks.push(this.firstTick.clone());for(f=1;f<this.scaleSizeInUnits;++f){l=d.clone().add(f,this.tickUnit);if(this.options.time.max&&0<=l.diff(this.lastTick,this.tickUnit,!0))break;0===f%this.unitScale&&this.ticks.push(l)}if(0!==this.ticks[this.ticks.length-1].diff(this.lastTick,this.tickUnit)||
|
||||
0===this.scaleSizeInUnits)this.options.time.max?(this.ticks.push(this.lastTick.clone()),this.scaleSizeInUnits=this.lastTick.diff(this.ticks[0],this.tickUnit,!0)):(this.scaleSizeInUnits=Math.ceil(this.scaleSizeInUnits/this.unitScale)*this.unitScale,this.ticks.push(this.firstTick.clone().add(this.scaleSizeInUnits,this.tickUnit)),this.lastTick=this.ticks[this.ticks.length-1].clone());this.ctx.restore()},getLabelForIndex:function(a,c){var d=this.chart.data.labels&&a<this.chart.data.labels.length?this.chart.data.labels[a]:
|
||||
"";"object"===typeof this.chart.data.datasets[c].data[0]&&(d=this.getRightValue(this.chart.data.datasets[c].data[a]));this.options.time.tooltipFormat&&(d=this.parseTime(d).format(this.options.time.tooltipFormat));return d},tickFormatFunction:function(a,c,d){a=a.format(this.displayFormat);return this.options.ticks.userCallback?this.options.ticks.userCallback(a,c,d):a},convertTicksToLabels:function(){this.ticks=this.ticks.map(this.tickFormatFunction,this)},getPixelForValue:function(a,c,d,e){if(a=this.getLabelMoment(d,
|
||||
c))return a=a.diff(this.firstTick,this.tickUnit,!0)/this.scaleSizeInUnits,this.isHorizontal()?this.left+Math.round((this.width-(this.paddingLeft+this.paddingRight))*a+this.paddingLeft):this.top+Math.round((this.height-(this.paddingTop+this.paddingBottom))*a+this.paddingTop)},parseTime:function(a){return"string"===typeof this.options.time.parser?f(a,this.options.time.parser):"function"===typeof this.options.time.parser?this.options.time.parser(a):"function"===typeof a.getMonth||"number"===typeof a?
|
||||
f(a):a.isValid&&a.isValid()?a:"string"!==typeof this.options.time.format&&this.options.time.format.call?(console.warn("options.time.format is deprecated and replaced by options.time.parser. See http://nnnick.github.io/Chart.js/docs-v2/#scales-time-scale"),this.options.time.format(a)):f(a,this.options.time.format)}});e.scaleService.registerScaleType("time",d,{position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",
|
||||
minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}})}},{moment:1}]},{},[7]);
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,4 @@
|
|||
function APIClass(b){this.target=b}
|
||||
APIClass.prototype={xhr:[],buffer:null,send:function(b,e,g){b.hasOwnProperty("path")||e({ModuleError:4});for(var a=0;a<this.xhr.length;a++)4==this.xhr[a].readyState&&(this.xhr=this.xhr.slice(0,a-1).concat(this.xhr.slice(a,this.xhr.length-1)));this.xhr.push(null);a=this.xhr.length-1;this.xhr[a]=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest");console.log(b);var d=this;this.xhr[a].onreadystatechange=function(){if(4==d.xhr[a].readyState)if(d.buffer=d.xhr[a].responseText,
|
||||
-1<[0,200].indexOf(d.xhr[a].status))try{e(JSON.parse(d.xhr[a].responseText))}catch(b){e({ModuleError:-1,ErrorDescription:"Erreur au niveau de api.js"}),console.warn(b)}else e({ModuleError:3})};var f=new FormData,c;for(c in b)"path"==c?f.append(c,b[c]):b[c]instanceof File?f.append(c,b[c]):f.append(c,JSON.stringify(b[c]));this.xhr[a].open("POST",this.target,!0);null!=g&&this.xhr[a].setRequestHeader("Authorization","Digest "+g);this.xhr[a].setRequestHeader("X-Requested-With","XMLHttpRequest");this.xhr[a].send(f)}};
|
||||
function APIClass(c){this.target=c}
|
||||
APIClass.prototype={xhr:[],buffer:null,optionalParams:[],send:function(c,f,g){c.hasOwnProperty("path")||f({ModuleError:4});for(var a=0;a<this.xhr.length;a++)4==this.xhr[a].readyState&&this.xhr.splice(a,1);this.xhr.push(null);a=this.xhr.length-1;this.optionalParams[a]=[];if(3<arguments.length)for(var d=3;d<arguments.length;d++)this.optionalParams[a].push(arguments[d]);this.xhr[a]=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest");var e=this;this.xhr[a].onreadystatechange=
|
||||
function(){if(4==e.xhr[a].readyState)if(e.buffer=e.xhr[a].responseText,console.log("api request",c),-1<[0,200].indexOf(e.xhr[a].status))try{f(JSON.parse(e.xhr[a].responseText),e.optionalParams[a])}catch(b){f({ModuleError:-1,ErrorDescription:"Erreur au niveau de api.js"},e.optionalParams[a]),console.warn(b)}else f({ModuleError:3})};var d=new FormData,b;for(b in c)"path"==b?d.append(b,c[b]):c[b]instanceof File?d.append(b,c[b]):d.append(b,JSON.stringify(c[b]));this.xhr[a].open("POST",this.target,!0);
|
||||
null!=g&&this.xhr[a].setRequestHeader("Authorization","Digest "+g);this.xhr[a].setRequestHeader("X-Requested-With","XMLHttpRequest");this.xhr[a].send(d)}};
|
||||
|
|
|
@ -3,14 +3,15 @@ function APIClass(target){ this.target = target; }
|
|||
|
||||
APIClass.prototype = {
|
||||
xhr: [], // tableau d'objets pour les requêtes ajax
|
||||
|
||||
buffer: null,
|
||||
buffer: null, // Contiendra le buffer pour debugger si erreur de parsage
|
||||
optionalParams: [], // Contiendra les paramètres que l'on veut passer au scope de @pHandler
|
||||
|
||||
/* transaction avec le serveur (http://host/api/)
|
||||
*
|
||||
* @param pRequest<Object> l'objet passé en POST (attribut->postfield) à http://host/api/
|
||||
* @param pHandler<Function> fonction qui s'éxécutera lors de la réponse (1 argument -> réponse<Object>)
|
||||
* @param pToken<String> si donne, token d'auth pour l'api
|
||||
* @param pToken<String> Optionnel, token d'auth pour l'api
|
||||
* @param pParams<Mixed> Optionnels, liste d'arguments à passer au scope de @pHandler
|
||||
*
|
||||
* @return answer<Object> l'objet retourné par http://host/api/ via pHandler (1er argument)
|
||||
*
|
||||
|
@ -34,23 +35,29 @@ APIClass.prototype = {
|
|||
pHandler({ModuleError:4});
|
||||
|
||||
// on efface les requêtes qui sont terminées (toutes celles de this.xhr)
|
||||
for( var i = 0 ; i < this.xhr.length ; i++ ){
|
||||
for( var i = 0 ; i < this.xhr.length ; i++ )
|
||||
if( this.xhr[i].readyState == 4 ) // si terminée
|
||||
this.xhr = this.xhr.slice(0,i-1).concat(this.xhr.slice(i,this.xhr.length-1)); // suppression entrée
|
||||
}
|
||||
this.xhr.splice(i, 1);
|
||||
|
||||
|
||||
// on créé une nouvelle entrée
|
||||
this.xhr.push(null);
|
||||
i = this.xhr.length-1;
|
||||
|
||||
|
||||
// Gestion des paramètres optionnels à passer au scope de @pHandler
|
||||
this.optionalParams[i] = [];
|
||||
if( arguments.length > 3 )
|
||||
for( var arg = 3 ; arg < arguments.length ; arg++ )
|
||||
this.optionalParams[i].push( arguments[arg] );
|
||||
|
||||
|
||||
// création de l'objet AJAX
|
||||
if(window.XMLHttpRequest) // IE7+, Firefox, Chrome, Opera, Safari
|
||||
this.xhr[i] = new XMLHttpRequest();
|
||||
else // IE5, IE6
|
||||
this.xhr[i] = new ActiveXObject('Microsoft.XMLHttpRequest');
|
||||
|
||||
console.log(pRequest);
|
||||
|
||||
var ptrAPI = this;
|
||||
this.xhr[i].onreadystatechange = function(){
|
||||
if( ptrAPI.xhr[i].readyState == 4 ){ // si la requête est terminée
|
||||
|
@ -60,10 +67,12 @@ APIClass.prototype = {
|
|||
// console.log('http://host/api/ => '+ptrAPI.xhr[i].responseText);
|
||||
// console.log( JSON.parse(ptrAPI.xhr[i].responseText) );
|
||||
|
||||
console.log('api request', pRequest);
|
||||
|
||||
/* si success de requête */
|
||||
if( [0,200].indexOf(ptrAPI.xhr[i].status) > -1 ){ // si fichier existe et reçu
|
||||
try{ pHandler( JSON.parse(ptrAPI.xhr[i].responseText) ); } // si on peut parser, on envoie
|
||||
catch(e){ pHandler({ModuleError:-1, ErrorDescription:'Erreur au niveau de api.js'}); console.warn(e); } // sinon on envoie obj.request = 'corrupted'
|
||||
try{ pHandler( JSON.parse(ptrAPI.xhr[i].responseText), ptrAPI.optionalParams[i]); } // si on peut parser, on envoie
|
||||
catch(e){ pHandler({ModuleError:-1, ErrorDescription:'Erreur au niveau de api.js'}, ptrAPI.optionalParams[i]); console.warn(e); } // sinon on envoie obj.request = 'corrupted'
|
||||
}
|
||||
/* sinon retourne obj.request = 'unreachable' */
|
||||
else
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
[![Build Status](https://travis-ci.org/jacomyal/sigma.js.svg)](https://travis-ci.org/jacomyal/sigma.js)
|
||||
|
||||
sigma.js - v1.1.0
|
||||
=================
|
||||
|
||||
Sigma is a JavaScript library dedicated to graph drawing, mainly developed by [@jacomyal](https://github.com/jacomyal) and [@Yomguithereal](https://github.com/Yomguithereal).
|
||||
|
||||
### Resources
|
||||
|
||||
[The website](http://sigmajs.org) provides a global overview of the project, and the documentation is available in the [Github Wiki](https://github.com/jacomyal/sigma.js/wiki).
|
||||
|
||||
Also, the `plugins` and `examples` directories contain various use-cases that might help you understand how to use sigma.
|
||||
|
||||
### How to use it
|
||||
|
||||
To use it, clone the repository:
|
||||
|
||||
```
|
||||
git clone git@github.com:jacomyal/sigma.js.git
|
||||
```
|
||||
|
||||
To build the code:
|
||||
|
||||
- Install [Node.js](http://nodejs.org/).
|
||||
- Install [gjslint](https://developers.google.com/closure/utilities/docs/linter_howto?hl=en).
|
||||
- Use `npm install` to install sigma development dependencies.
|
||||
- Use `npm run build` to minify the code with [Uglify](https://github.com/mishoo/UglifyJS). The minified file `sigma.min.js` will then be accessible in the `build/` folder.
|
||||
|
||||
Also, you can customize the build by adding or removing files from the `coreJsFiles` array in `Gruntfile.js` before applying the grunt task.
|
||||
|
||||
### Contributing
|
||||
|
||||
You can contribute by submitting [issues tickets](http://github.com/jacomyal/sigma.js/issues) and proposing [pull requests](http://github.com/jacomyal/sigma.js/pulls). Make sure that tests and linting pass before submitting any pull request by running the command `grunt`.
|
||||
|
||||
The whole source code is validated by the [Google Closure Linter](https://developers.google.com/closure/utilities/) and [JSHint](http://www.jshint.com/), and the comments are written in [JSDoc](http://en.wikipedia.org/wiki/JSDoc) (tags description is available [here](https://developers.google.com/closure/compiler/docs/js-for-compiler)).
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.parsers"),sigma.utils.pkg("sigma.utils"),sigma.utils.xhr=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;var a,b;if(window.ActiveXObject){a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(b in a)try{return new ActiveXObject(a[b])}catch(c){}}return null},sigma.parsers.json=function(a,b,c){var d,e=sigma.utils.xhr();if(!e)throw"XMLHttpRequest not supported, cannot load the file.";e.open("GET",a,!0),e.onreadystatechange=function(){4===e.readyState&&(d=JSON.parse(e.responseText),b instanceof sigma?(b.graph.clear(),b.graph.read(d)):"object"==typeof b?(b.graph=d,b=new sigma(b)):"function"==typeof b&&(c=b,b=null),c&&c(b||d))},e.send()}}).call(this);
|
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";function a(a){if(d[a])return d[a];var b=[0,0,0];return a.match(/^#/)?(a=(a||"").replace(/^#/,""),b=3===a.length?[parseInt(a.charAt(0)+a.charAt(0),16),parseInt(a.charAt(1)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(2),16)]:[parseInt(a.charAt(0)+a.charAt(1),16),parseInt(a.charAt(2)+a.charAt(3),16),parseInt(a.charAt(4)+a.charAt(5),16)]):a.match(/^ *rgba? *\(/)&&(a=a.match(/^ *rgba? *\( *([0-9]*) *, *([0-9]*) *, *([0-9]*) *(,.*)?\) *$/),b=[+a[1],+a[2],+a[3]]),d[a]={r:b[0],g:b[1],b:b[2]},d[a]}function b(b,c,d){b=a(b),c=a(c);var e={r:b.r*(1-d)+c.r*d,g:b.g*(1-d)+c.g*d,b:b.b*(1-d)+c.b*d};return"rgb("+[0|e.r,0|e.g,0|e.b].join(",")+")"}if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins");var c=0,d={};sigma.plugins.animate=function(a,d,e){function f(){var c=(sigma.utils.dateNow()-m)/k;if(c>=1){g.forEach(function(a){for(var b in d)b in d&&(a[b]=a[d[b]])});var e,n;for(e in a.cameras)n=a.cameras[e],n.edgequadtree._enabled=!0;a.refresh(),"function"==typeof i.onComplete&&i.onComplete()}else c=l(c),g.forEach(function(a){for(var e in d)e in d&&(a[e]=e.match(/color$/)?b(h[a.id][e],a[d[e]],c):a[d[e]]*c+h[a.id][e]*(1-c))}),a.refresh(),a.animations[j]=requestAnimationFrame(f)}var g,h,i=e||{},j=++c,k=i.duration||a.settings("animationsTime"),l="string"==typeof i.easing?sigma.utils.easings[i.easing]:"function"==typeof i.easing?i.easing:sigma.utils.easings.quadraticInOut,m=sigma.utils.dateNow();g=i.nodes&&i.nodes.length?"object"==typeof i.nodes[0]?i.nodes:a.graph.nodes(i.nodes):a.graph.nodes(),h=g.reduce(function(a,b){var c;a[b.id]={};for(c in d)c in b&&(a[b.id][c]=b[c]);return a},{}),a.animations=a.animations||Object.create({}),sigma.plugins.kill(a);var n,o;for(n in a.cameras)o=a.cameras[n],o.edgequadtree._enabled=!1;f()},sigma.plugins.kill=function(a){for(var b in a.animations||{})cancelAnimationFrame(a.animations[b]);var b,c;for(b in a.cameras)c=a.cameras[b],c.edgequadtree._enabled=!0}}).call(window);
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";function a(a){return new Blob([a],{type:"image/svg+xml;charset=utf-8"})}function b(b,c){var e=a(b),f={};f.anchor=document.createElement("a"),f.anchor.setAttribute("href",d.createObjectURL(e)),f.anchor.setAttribute("download",c);var g=document.createEvent("MouseEvent");g.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),d.revokeObjectURL(e),f.anchor.dispatchEvent(g),delete f.anchor}function c(a,b,c){var d,e,g,h,i,j={},k={},l=0,m="";c.classes&&(e=document.createElementNS(f,"style"),a.insertBefore(e,a.firstChild));var n=a.querySelectorAll('[id="'+b+'-group-nodes"] > [class="'+b+'-node"]');for(h=0,i=n.length,g=!0;i>h;h++)d=n[h].getAttribute("fill"),c.data||n[h].removeAttribute("data-node-id"),c.classes&&(d in j||(j[d]=g?b+"-node":"c-"+l++,m+="."+j[d]+"{fill: "+d+"}"),j[d]!==b+"-node"&&n[h].setAttribute("class",n[h].getAttribute("class")+" "+j[d]),n[h].removeAttribute("fill")),g=!1;var o=a.querySelectorAll('[id="'+b+'-group-edges"] > [class="'+b+'-edge"]');for(h=0,i=o.length,g=!0;i>h;h++)d=o[h].getAttribute("stroke"),c.data||o[h].removeAttribute("data-edge-id"),c.classes&&(d in k||(k[d]=g?b+"-edge":"c-"+l++,m+="."+k[d]+"{stroke: "+d+"}"),k[d]!==b+"-edge"&&o[h].setAttribute("class",o[h].getAttribute("class")+" "+k[d]),o[h].removeAttribute("stroke")),g=!1;c.classes&&e.appendChild(document.createTextNode(m))}if("undefined"==typeof sigma)throw"sigma.renderers.snapshot: sigma not in scope.";var d=this.URL||this.webkitURL||this,e={size:"1000",width:"1000",height:"1000",classes:!0,labels:!0,data:!1,download:!1,filename:"graph.svg"},f="http://www.w3.org/2000/svg";sigma.prototype.toSVG=function(a){a=a||{};var d=this.settings("classPrefix"),f=a.size||a.width||e.size,g=a.size||a.height||e.size,h=document.createElement("div");h.setAttribute("width",f),h.setAttribute("height",g),h.setAttribute("style","position:absolute; top: 0px; left:0px; width: "+f+"px; height: "+g+"px;");var i=this.addCamera(),j=this.addRenderer({camera:i,container:h,type:"svg",forceLabels:!!a.labels});j.resize(f,g),this.refresh(),this.killRenderer(j),this.killCamera(i);var k=h.querySelector("svg");if(k.removeAttribute("style"),k.setAttribute("width",f+"px"),k.setAttribute("height",g+"px"),k.setAttribute("x","0px"),k.setAttribute("y","0px"),!a.labels){var l=k.querySelector('[id="'+d+'-group-labels"]');k.removeChild(l)}var m=k.querySelector('[id="'+d+'-group-hovers"]');k.removeChild(m),a.classes=a.classes!==!1,(!a.data||a.classes)&&c(k,d,a);var n=k.outerHTML;h=null;var o='<?xml version="1.0" encoding="utf-8"?>\n';return o+='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n',o+=n,a.download&&b(o,a.filename||e.filename),o}}).call(this);
|
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.neo4j"),sigma.utils.pkg("sigma.utils"),sigma.neo4j.send=function(a,b,c,d,e){var f,g,h,i=sigma.utils.xhr();if(f=a,"object"==typeof a&&(f=a.url,g=a.user,h=a.password),!i)throw"XMLHttpRequest not supported, cannot load the file.";f+=b,i.open(c,f,!0),g&&h&&i.setRequestHeader("Authorization","Basic "+btoa(g+":"+h)),i.setRequestHeader("Accept","application/json"),i.setRequestHeader("Content-type","application/json; charset=utf-8"),i.onreadystatechange=function(){4===i.readyState&&e(JSON.parse(i.responseText))},i.send(d)},sigma.neo4j.cypher_parse=function(a){var b,c={nodes:[],edges:[]},d={},e={};a.results[0].data.forEach(function(a){a.graph.nodes.forEach(function(a){var b={id:a.id,label:a.id,x:Math.random(),y:Math.random(),size:1,color:"#000000",neo4j_labels:a.labels,neo4j_data:a.properties};b.id in d||(d[b.id]=b)}),a.graph.relationships.forEach(function(a){var b={id:a.id,label:a.type,source:a.startNode,target:a.endNode,color:"#7D7C8E",neo4j_type:a.type,neo4j_data:a.properties};b.id in e||(e[b.id]=b)})});for(b in d)c.nodes.push(d[b]);for(b in e)c.edges.push(e[b]);return c},sigma.neo4j.cypher=function(a,b,c,d){var e,f,g="/db/data/transaction/commit";e=JSON.stringify({statements:[{statement:b,resultDataContents:["graph"],includeStats:!1}]}),f=function(a){return function(b){var d={nodes:[],edges:[]};d=sigma.neo4j.cypher_parse(b),c instanceof sigma?(c.graph.clear(),c.graph.read(d)):"object"==typeof c?(c=new sigma(c),c.graph.read(d),c.refresh()):"function"==typeof c&&(a=c,c=null),a&&a(c||d)}},sigma.neo4j.send(a,g,"POST",e,f(d))},sigma.neo4j.getLabels=function(a,b){sigma.neo4j.send(a,"/db/data/labels","GET",null,b)},sigma.neo4j.getTypes=function(a,b){sigma.neo4j.send(a,"/db/data/relationship/types","GET",null,b)}}).call(this);
|
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.neo4j"),sigma.utils.pkg("sigma.utils"),sigma.utils.pkg("sigma.parsers"),sigma.neo4j.send=function(a,b,c,d,e){var f,g,h,i=sigma.utils.xhr();if(f=a,"object"==typeof a&&(f=a.url,g=a.user,h=a.password),!i)throw"XMLHttpRequest not supported, cannot load the file.";f+=b,i.open(c,f,!0),g&&h&&i.setRequestHeader("Authorization","Basic "+btoa(g+":"+h)),i.setRequestHeader("Accept","application/json"),i.setRequestHeader("Content-type","application/json; charset=utf-8"),i.onreadystatechange=function(){4===i.readyState&&e(JSON.parse(i.responseText))},i.send(d)},sigma.neo4j.cypher_parse=function(a){var b,c={nodes:[],edges:[]},d={},e={};a.results[0].data.forEach(function(a){a.graph.nodes.forEach(function(a){var b={id:a.id,label:a.id,x:Math.random(),y:Math.random(),size:1,color:"#000000",neo4j_labels:a.labels,neo4j_data:a.properties};b.id in d||(d[b.id]=b)}),a.graph.relationships.forEach(function(a){var b={id:a.id,label:a.type,source:a.startNode,target:a.endNode,color:"#7D7C8E",neo4j_type:a.type,neo4j_data:a.properties};b.id in e||(e[b.id]=b)})});for(b in d)c.nodes.push(d[b]);for(b in e)c.edges.push(e[b]);return c},sigma.neo4j.cypher=function(a,b,c,d){var e,f,g="/db/data/transaction/commit";e=JSON.stringify({statements:[{statement:b,resultDataContents:["graph"],includeStats:!1}]}),f=function(a){return function(b){var d={nodes:[],edges:[]};d=sigma.neo4j.cypher_parse(b),c instanceof sigma?(c.graph.clear(),c.graph.read(d)):"object"==typeof c?(c=new sigma(c),c.graph.read(d),c.refresh()):"function"==typeof c&&(a=c,c=null),a&&a(c||d)}},sigma.neo4j.send(a,g,"POST",e,f(d))},sigma.neo4j.getLabels=function(a,b){sigma.neo4j.send(a,"/db/data/labels","GET",null,b)},sigma.neo4j.getTypes=function(a,b){sigma.neo4j.send(a,"/db/data/relationship/types","GET",null,b)}}).call(this);
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";var a=function(a,b,c){var d=void 0!=a&&void 0!=b&&void 0!=a.x&&void 0!=a.y&&void 0!=b.x&&void 0!=b.y;return d?(c||0)+Math.sqrt(Math.pow(b.y-a.y,2)+Math.pow(b.x-a.x,2)):void 0};sigma.classes.graph.addMethod("astar",function(b,c,d){var e=new sigma.classes.configurable({undirected:!1,pathLengthFunction:a,heuristicLengthFunction:void 0},d||{}),f=e("pathLengthFunction"),g=e("heuristicLengthFunction")||f,h=this.nodes(b),i=this.nodes(c),j={},k=[],l=function(a,b,c,d){var e=a.id,f={pathLength:c,heuristicLength:d,node:a,nodeId:e,previousNode:b};if(void 0==j[e]||j[e].pathLenth>c){j[e]=f;var g,h;for(h=0;h<k.length&&(g=k[h],!(g.heuristicLength>d));h++);k.splice(h,0,f)}};l(h,null,0,0);var m,n=!1;m=e("undirected")?this.allNeighborsIndex:this.outNeighborsIndex;for(var o,p,q,r,s,t;k.length>0;){if(o=k.shift(),o.nodeId==c){n=!0;break}for(p=Object.keys(m[o.nodeId]),t=0;t<p.length;t++)q=this.nodes(p[t]),r=f(o.node,q,o.pathLength),s=g(q,i),l(q,o.node,r,s)}if(n){for(var u=[],v=i;v;)u.unshift(v),v=j[v.id].previousNode;return u}return void 0})}).call(window);
|
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";function a(a,b){function c(a){var b=window.getComputedStyle(a),c=function(a){return parseInt(b.getPropertyValue(a).replace("px",""))||0};return{left:a.getBoundingClientRect().left+c("padding-left"),top:a.getBoundingClientRect().top+c("padding-top")}}function d(){t=!1,l.removeEventListener("mousemove",i),l.removeEventListener("mouseup",h),r.length||(p=null)}function e(a){s[a.data.node.id]||(r.push(a.data.node),s[a.data.node.id]=!0,r.length&&!t&&(p=r[r.length-1],n.addEventListener("mousedown",g)))}function f(a){var b=r.map(function(a){return a}).indexOf(a.data.node);r.splice(b,1),delete s[a.data.node.id],r.length&&!t?p=r[r.length-1]:n.removeEventListener("mousedown",g)}function g(a){t=!0;var b=k.graph.nodes().length;if(p&&b>1){n.removeEventListener("mousedown",g),l.addEventListener("mousemove",i),l.addEventListener("mouseup",h);var c,d;for(c in k.cameras)d=k.cameras[c],void 0!==d.edgequadtree&&(d.edgequadtree._enabled=!1);m.settings({mouseEnabled:!1,enableHovering:!1}),k.refresh(),j.dispatchEvent("startdrag",{node:p,captor:a,renderer:m})}}function h(a){t=!1,n.addEventListener("mousedown",g),l.removeEventListener("mousemove",i),l.removeEventListener("mouseup",h);var b,c;for(b in k.cameras)c=k.cameras[b],void 0!==c.edgequadtree&&(c.edgequadtree._enabled=!0);m.settings({mouseEnabled:!0,enableHovering:!0}),k.refresh(),u&&j.dispatchEvent("drop",{node:p,captor:a,renderer:m}),j.dispatchEvent("dragend",{node:p,captor:a,renderer:m}),u=!1,p=null}function i(a){function b(){for(var b=c(m.container),d=a.clientX-b.left,e=a.clientY-b.top,f=Math.cos(o.angle),g=Math.sin(o.angle),h=k.graph.nodes(),i=[],l=0;2>l;l++){var n=h[l],r={x:n.x*f+n.y*g,y:n.y*f-n.x*g,renX:n[q+"x"],renY:n[q+"y"]};i.push(r)}if(i[0].x===i[1].x&&i[0].y===i[1].y){var s=0===i[0].renX?1:i[0].renX,t=0===i[0].renY?1:i[0].renY;d=i[0].x/s*(d-i[0].renX)+i[0].x,e=i[0].y/t*(e-i[0].renY)+i[0].y}else{var s=(i[1].renX-i[0].renX)/(i[1].x-i[0].x),t=(i[1].renY-i[0].renY)/(i[1].y-i[0].y);i[1].x===i[0].x&&(s=t),i[1].y===i[0].y&&(t=s),d=(d-i[0].renX)/s+i[0].x,e=(e-i[0].renY)/t+i[0].y}p.x=d*f-e*g,p.y=e*f+d*g,k.refresh(),u=!0,j.dispatchEvent("drag",{node:p,captor:a,renderer:m})}if(navigator.userAgent.toLowerCase().indexOf("firefox")>-1){clearTimeout(d);var d=setTimeout(b,0)}else b()}sigma.classes.dispatcher.extend(this);var j=this,k=a,l=document.body,m=b,n=b.container.lastChild,o=b.camera,p=null,q="",r=[],s={},t=!1,u=!1;b instanceof sigma.renderers.svg&&(n=b.container.firstChild),q=b instanceof sigma.renderers.webgl?b.options.prefix.substr(5):b.options.prefix,b.bind("overNode",e),b.bind("outNode",f),b.bind("click",d),k.bind("kill",function(){j.unbindAll()}),this.unbindAll=function(){n.removeEventListener("mousedown",g),l.removeEventListener("mousemove",i),l.removeEventListener("mouseup",h),m.unbind("overNode",e),m.unbind("outNode",f)}}if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins");var b={};sigma.plugins.dragNodes=function(c,d){return b[c.id]||(b[c.id]=new a(c,d)),c.bind("kill",function(){sigma.plugins.killDragNodes(c)}),b[c.id]},sigma.plugins.killDragNodes=function(c){b[c.id]instanceof a&&(b[c.id].unbindAll(),delete b[c.id])}}).call(window);
|
|
@ -1 +0,0 @@
|
|||
(function(undefined){"use strict";function register(a,b,c){if(c!=undefined&&"string"!=typeof c)throw'The filter key "'+c.toString()+'" must be a string.';if(c!=undefined&&!c.length)throw"The filter key must be a non-empty string.";if("function"!=typeof a)throw'The predicate of key "'+c+'" must be a function.';if("undo"===c)throw'"undo" is a reserved key.';if(_keysIndex[c])throw'The filter "'+c+'" already exists.';c&&(_keysIndex[c]=!0),_chain.push({key:c,processor:a,predicate:b})}function unregister(a){_chain=_chain.filter(function(b){return!(b.key in a)});for(var b in a)delete _keysIndex[b]}function Filter(a){_s=a,_g=a.graph}function deepCopy(o){var copy=Object.create(null);for(var i in o)"object"==typeof o[i]&&null!==o[i]?copy[i]=deepCopy(o[i]):"function"==typeof o[i]&&null!==o[i]?eval(" copy[i] = "+o[i].toString()):copy[i]=o[i];return copy}function cloneChain(a){for(var b=a.slice(0),c=0,d=b.length;d>c;c++)b[c]=deepCopy(b[c]),"function"==typeof b[c].processor&&(b[c].processor="filter.processors."+b[c].processor.name);return b}if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins"),sigma.classes.graph.hasMethod("adjacentNodes")||sigma.classes.graph.addMethod("adjacentNodes",function(a){if("string"!=typeof a)throw"adjacentNodes: the node id must be a string.";var b,c=[];for(b in this.allNeighborsIndex[a])c.push(this.nodesIndex[b]);return c}),sigma.classes.graph.hasMethod("adjacentEdges")||sigma.classes.graph.addMethod("adjacentEdges",function(a){if("string"!=typeof a)throw"adjacentEdges: the node id must be a string.";var b,c,d=this.allNeighborsIndex[a],e=[];for(c in d)for(b in d[c])e.push(d[c][b]);return e});var _g=undefined,_s=undefined,_chain=[],_keysIndex=Object.create(null),Processors={};Processors.nodes=function(a){for(var b=_g.nodes(),c=b.length,d=_g.edges(),e=d.length;c--;)b[c].hidden=!a.call(_g,b[c])||b[c].hidden;for(;e--;)(_g.nodes(d[e].source).hidden||_g.nodes(d[e].target).hidden)&&(d[e].hidden=!0)},Processors.edges=function(a){for(var b=_g.edges(),c=b.length;c--;)b[c].hidden=!a.call(_g,b[c])||b[c].hidden},Processors.neighbors=function a(b){for(var c=_g.nodes(),d=c.length,e=_g.edges(),f=e.length,a=_g.adjacentNodes(b),g=a.length,h={};g--;)h[a[g].id]=!0;for(;d--;)c[d].id===b||c[d].id in h||(c[d].hidden=!0);for(;f--;)(_g.nodes(e[f].source).hidden||_g.nodes(e[f].target).hidden)&&(e[f].hidden=!0)},Filter.prototype.nodesBy=function(a,b){return register(Processors.nodes,a,b),this},Filter.prototype.edgesBy=function(a,b){return register(Processors.edges,a,b),this},Filter.prototype.neighborsOf=function(a,b){if("string"!=typeof a)throw'The node id "'+a.toString()+'" must be a string.';if(!a.length)throw"The node id must be a non-empty string.";return register(Processors.neighbors,a,b),this},Filter.prototype.apply=function(){for(var a=0,b=_chain.length;b>a;++a)_chain[a].processor(_chain[a].predicate);return _chain[0]&&"undo"===_chain[0].key&&_chain.shift(),_s.refresh(),this},Filter.prototype.undo=function(a){function b(){for(var a=_g.nodes(),b=a.length,c=_g.edges(),d=c.length;b--;)a[b].hidden=!1;for(;d--;)c[d].hidden=!1}var c=Object.create(null),d=arguments.length;if(1===d)if("[object Array]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)c[a[e]]=!0;else c[a]=!0;else if(d>1)for(var e=0;d>e;e++)c[arguments[e]]=!0;else this.clear();return unregister(c),_chain.unshift({key:"undo",processor:b}),this},Filter.prototype.clear=function(){return _chain.length=0,_keysIndex=Object.create(null),this},Filter.prototype.export=function(){var a=cloneChain(_chain);return a},Filter.prototype.import=function(a){if(a===undefined)throw"Wrong arguments.";if("[object Array]"!==Object.prototype.toString.call(a))throw'The chain" must be an array.';for(var b=cloneChain(a),c=0,d=b.length;d>c;c++){if(b[c].predicate===undefined||b[c].processor===undefined)throw"Wrong arguments.";if(b[c].key!=undefined&&"string"!=typeof b[c].key)throw'The filter key "'+b[c].key.toString()+'" must be a string.';if("function"!=typeof b[c].predicate)throw'The predicate of key "'+b[c].key+'" must be a function.';if("string"!=typeof b[c].processor)throw'The processor of key "'+b[c].key+'" must be a string.';switch(b[c].processor){case"filter.processors.nodes":b[c].processor=Processors.nodes;break;case"filter.processors.edges":b[c].processor=Processors.edges;break;case"filter.processors.neighbors":b[c].processor=Processors.neighbors;break;default:throw"Unknown processor "+b[c].processor}}return _chain=b,this};var filter=null;sigma.plugins.filter=function(a){return filter||(filter=new Filter(a)),filter}}).call(this);
|
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.classes.graph.addMethod("neighborhood",function(a){var b,c,d,e,f,g={},h={},i={nodes:[],edges:[]};if(!this.nodes(a))return i;e=this.nodes(a),f={},f.center=!0;for(b in e)f[b]=e[b];g[a]=!0,i.nodes.push(f);for(b in this.allNeighborsIndex[a]){g[b]||(g[b]=!0,i.nodes.push(this.nodesIndex[b]));for(c in this.allNeighborsIndex[a][b])h[c]||(h[c]=!0,i.edges.push(this.edgesIndex[c]))}for(b in g)if(b!==a)for(c in g)if(c!==a&&b!==c&&this.allNeighborsIndex[b][c])for(d in this.allNeighborsIndex[b][c])h[d]||(h[d]=!0,i.edges.push(this.edgesIndex[d]));return i}),sigma.utils.pkg("sigma.plugins"),sigma.plugins.neighborhoods=function(){var a=new sigma.classes.graph;this.neighborhood=function(b){return a.neighborhood(b)},this.load=function(b,c){var d=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;var a,b;if(window.ActiveXObject){a=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP"];for(b in a)try{return new ActiveXObject(a[b])}catch(c){}}return null}();if(!d)throw"XMLHttpRequest not supported, cannot load the data.";return d.open("GET",b,!0),d.onreadystatechange=function(){4===d.readyState&&(a.clear().read(JSON.parse(d.responseText)),c&&c())},d.send(),this},this.read=function(b){a.clear().read(b)}}}).call(window);
|
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.plugins");sigma.plugins.relativeSize=function(a,b){for(var c=a.graph.nodes(),d=0;d<c.length;d++){var e=a.graph.degree(c[d].id);c[d].size=b*Math.sqrt(e)}a.refresh()}}).call(window);
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.settings");var a={defaultEdgeLabelColor:"#000",defaultEdgeLabelActiveColor:"#000",defaultEdgeLabelSize:10,edgeLabelSize:"fixed",edgeLabelSizePowRatio:1,edgeLabelThreshold:1};sigma.settings=sigma.utils.extend(sigma.settings||{},a),sigma.settings.drawEdgeLabels=!0}).call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.canvas.edges.labels"),sigma.canvas.edges.labels.curve=function(a,b,c,d,e){if("string"==typeof a.label){var f=e("prefix")||"",g=a[f+"size"]||1;if(!(g<e("edgeLabelThreshold"))){var h,i,j,k=b[f+"size"],l=b[f+"x"],m=b[f+"y"],n=c[f+"x"],o=c[f+"y"],p=n-l,q=o-m,r=n>l?1:-1,s={},t=.5;b.id===c.id?(s=sigma.utils.getSelfLoopControlPoints(l,m,k),i=sigma.utils.getPointOnBezierCurve(t,l,m,n,o,s.x1,s.y1,s.x2,s.y2),j=Math.atan2(1,1)):(s=sigma.utils.getQuadraticControlPoint(l,m,n,o),i=sigma.utils.getPointOnQuadraticCurve(t,l,m,n,o,s.x,s.y),j=Math.atan2(q*r,p*r)),h="fixed"===e("edgeLabelSize")?e("defaultEdgeLabelSize"):e("defaultEdgeLabelSize")*g*Math.pow(g,-1/e("edgeLabelSizePowRatio")),d.save(),a.active?(d.font=[e("activeFontStyle"),h+"px",e("activeFont")||e("font")].join(" "),d.fillStyle="edge"===e("edgeActiveColor")?a.active_color||e("defaultEdgeActiveColor"):e("defaultEdgeLabelActiveColor")):(d.font=[e("fontStyle"),h+"px",e("font")].join(" "),d.fillStyle="edge"===e("edgeLabelColor")?a.color||e("defaultEdgeColor"):e("defaultEdgeLabelColor")),d.textAlign="center",d.textBaseline="alphabetic",d.translate(i.x,i.y),d.rotate(j),d.fillText(a.label,0,-g/2-3),d.restore()}}}}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.canvas.edges.labels"),sigma.canvas.edges.labels.curvedArrow=function(a,b,c,d,e){sigma.canvas.edges.labels.curve(a,b,c,d,e)}}.call(this),function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.utils.pkg("sigma.canvas.edges.labels"),sigma.canvas.edges.labels.def=function(a,b,c,d,e){if("string"==typeof a.label&&b!=c){var f=e("prefix")||"",g=a[f+"size"]||1;if(!(g<e("edgeLabelThreshold"))){if(0===e("edgeLabelSizePowRatio"))throw'"edgeLabelSizePowRatio" must not be 0.';var h,i=(b[f+"x"]+c[f+"x"])/2,j=(b[f+"y"]+c[f+"y"])/2,k=c[f+"x"]-b[f+"x"],l=c[f+"y"]-b[f+"y"],m=b[f+"x"]<c[f+"x"]?1:-1,n=Math.atan2(l*m,k*m);h="fixed"===e("edgeLabelSize")?e("defaultEdgeLabelSize"):e("defaultEdgeLabelSize")*g*Math.pow(g,-1/e("edgeLabelSizePowRatio")),d.save(),a.active?(d.font=[e("activeFontStyle"),h+"px",e("activeFont")||e("font")].join(" "),d.fillStyle="edge"===e("edgeActiveColor")?a.active_color||e("defaultEdgeActiveColor"):e("defaultEdgeLabelActiveColor")):(d.font=[e("fontStyle"),h+"px",e("font")].join(" "),d.fillStyle="edge"===e("edgeLabelColor")?a.color||e("defaultEdgeColor"):e("defaultEdgeLabelColor")),d.textAlign="center",d.textBaseline="alphabetic",d.translate(i,j),d.rotate(n),d.fillText(a.label,0,-g/2-3),d.restore()}}}}.call(this);
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
(function(){function a(a,b,c){var d=document.createElement("a");d.setAttribute("href",a),d.setAttribute("download",c||"graph."+b);var e=document.createEvent("MouseEvent");e.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),d.dispatchEvent(e),delete d}function b(b){if(b=b||{},b.format&&!(b.format in d))throw Error('sigma.renderers.snaphot: unsupported format "'+b.format+'".');var e=this,f=this instanceof sigma.renderers.webgl,g=[],h=document.createElement("canvas"),i=h.getContext("2d"),j=!1;c.forEach(function(a){if(e.contexts[a]&&(b.labels!==!1||"labels"!==a)){var c=e.domElements[a]||e.domElements.scene,d=e.contexts[a];~g.indexOf(d)||(j||(h.width=f&&d instanceof WebGLRenderingContext?c.width/2:c.width,h.height=f&&d instanceof WebGLRenderingContext?c.height/2:c.height,j=!0,b.background&&(i.rect(0,0,h.width,h.height),i.fillStyle=b.background,i.fill())),d instanceof WebGLRenderingContext?i.drawImage(c,0,0,c.width/2,c.height/2):i.drawImage(c,0,0),g.push(d))}});var k=h.toDataURL(d[b.format||"png"]);return b.download&&a(k,b.format||"png",b.filename),delete i,delete h,delete g,k}if("undefined"==typeof sigma)throw"sigma.renderers.snapshot: sigma not in scope.";var c=["scene","edges","nodes","labels"],d={png:"image/png",jpg:"image/jpeg",gif:"image/gif",tiff:"image/tiff"};sigma.renderers.canvas.prototype.snapshot=b,sigma.renderers.webgl.prototype.snapshot=b}).call(this);
|
|
@ -1 +0,0 @@
|
|||
(function(){"use strict";if("undefined"==typeof sigma)throw"sigma is not declared";sigma.classes.graph.addMethod("HITS",function(a){var b={},c=1e-4,d=[],e=[],f=this.nodes(),g=(f.length,{});a||(a=!1);for(var h in f)a?(d.push(f[h]),e.push(f[h])):(this.degree(f[h].id,"out")>0&&d.push(f[h]),this.degree(f[h].id,"in")>0&&e.push(f[h])),b[f[h].id]={authority:1,hub:1};for(var i;;){i=!0;var j=0,k=0;for(var h in e){g[e[h].id]={authority:1,hub:0};var l=[];l=a?this.allNeighborsIndex[e[h].id]:this.inNeighborsIndex[e[h].id];for(var m in l)m!=e[h].id&&(g[e[h].id].authority+=b[m].hub);j+=g[e[h].id].authority}for(var h in d){g[d[h].id]?g[d[h].id].hub=1:g[d[h].id]={authority:0,hub:1};var l=[];l=a?this.allNeighborsIndex[d[h].id]:this.outNeighborsIndex[d[h].id];for(var m in l)m!=d[h].id&&(g[d[h].id].hub+=b[m].authority);k+=g[d[h].id].hub}for(var h in e)g[e[h].id].authority/=j,Math.abs((g[e[h].id].authority-b[e[h].id].authority)/b[e[h].id].authority)>=c&&(i=!1);for(var h in d)g[d[h].id].hub/=k,Math.abs((g[d[h].id].hub-b[d[h].id].hub)/b[d[h].id].hub)>=c&&(i=!1);if(b=g,g={},i)break}return b})}).call(window);
|
File diff suppressed because one or more lines are too long
12097
js/lib/sigma/sigma.js
12097
js/lib/sigma/sigma.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -3,10 +3,8 @@
|
|||
namespace manager\module;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ManagerError;
|
||||
|
||||
// On inclut les graphiques
|
||||
use \manager\module\chart\networkChart;
|
||||
|
||||
use \manager\ResourceDispatcher;
|
||||
use \manager\lightdb;
|
||||
|
||||
|
||||
|
||||
|
@ -14,24 +12,354 @@
|
|||
class chart{
|
||||
|
||||
|
||||
/* RETOURNE UN JEU DE DONNEES POUR GRAPHIQUE #NETWORK
|
||||
/* CHARGE LE CONTENU DU DICTIONNAIRE
|
||||
*
|
||||
* @return dictionary<Array> Contenu du dictionnaire, ou FALSE si erreur
|
||||
*
|
||||
*/
|
||||
public static function network_data(){
|
||||
return networkChart::data();
|
||||
private static function loadDictionary(){
|
||||
$dict = ResourceDispatcher::getResource('f/json/dictionary/dy/phone');
|
||||
|
||||
$dict = json_decode( $dict, true );
|
||||
|
||||
// Si erreur, on retourne false
|
||||
if( is_null($dict) )
|
||||
return false;
|
||||
|
||||
return $dict;
|
||||
}
|
||||
|
||||
/* RETOURNE UN SVG CORRESPONDANT AU GRAPHIQUE #NETWORK
|
||||
|
||||
/* MODIFIE LES COULEURS DONNEES
|
||||
*
|
||||
* @data<Array> Jeu de donnees
|
||||
* @colors<Array> Tableau de couleurs au format hsla
|
||||
* @tint<int> Valeur a ajouter à tint
|
||||
* @constract<int> Valeur a ajouter à constract
|
||||
* @lightness<int> Valeur a ajouter à lightness
|
||||
* @opacity<int> Valeur a ajouter à opacity
|
||||
*
|
||||
* @return render<String> Contenu du svg representation graphique des donnees
|
||||
* @return darken<Array> Copie du tableau d'entrée, mais en plus foncé
|
||||
*
|
||||
*/
|
||||
public static function network_render($params){
|
||||
private static function cFilter($colors, $tint=0, $contrast=0, $lightness=0, $opacity=0){
|
||||
$darken = $colors;
|
||||
|
||||
/* [1] Pour chaque couleur
|
||||
=========================================================*/
|
||||
foreach($colors as $i=>$color){
|
||||
|
||||
/* (1) On vérifie que c'est bien au format hsl(tint, saturation%, lightness%, ) */
|
||||
if( !preg_match('/^hsl\((\d+) ?, ?(\d+)% ?, ?(\d+)%\ ?, ?(\d+?.\d*)\)$/i', $color, $matches) )
|
||||
continue;
|
||||
|
||||
$newTint = intval($matches[1]) + $tint;
|
||||
$newContrast = intval($matches[2]) + $contrast;
|
||||
$newLightness = intval($matches[3]) + $lightness;
|
||||
$newOpacity = floatval($matches[4]) + $opacity;
|
||||
|
||||
$darken[$i] = "hsl($newTint,$newContrast%, $newLightness%, $newOpacity)";
|
||||
}
|
||||
|
||||
return $darken;
|
||||
}
|
||||
|
||||
|
||||
/* RETOURNE UN JEU DE DONNEES POUR LE SENS DE COMMUNICATION (MANQUE/ENTRANT/SORTANT)
|
||||
*
|
||||
*/
|
||||
public static function direction($params){
|
||||
extract($params);
|
||||
|
||||
return networkChart::render($data);
|
||||
$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] On initialise les compteurs
|
||||
=========================================================*/
|
||||
$labels = array('ENTRANT', 'SORTANT', 'MANQUÉ');
|
||||
|
||||
$MISSED = 0;
|
||||
$OUTGOING = 0;
|
||||
$INCOMING = 0;
|
||||
|
||||
/* [3] S'il a un journal d'appel, on renvoie les données
|
||||
=========================================================*/
|
||||
if( isset($data['logs']) && is_array($data['logs']) ){
|
||||
|
||||
/* (1) On incrémente les compteurs */
|
||||
foreach($data['logs'] as $log){
|
||||
|
||||
/* (2) Si ce n'est pas un appel, on passe au suivant */
|
||||
if( $log['type'] != 0 )
|
||||
continue;
|
||||
|
||||
/* (3) On incrémente les types */
|
||||
$MISSED += ($log['direction']==2) ? 1 : 0;
|
||||
$OUTGOING += ($log['direction']==1) ? 1 : 0;
|
||||
$INCOMING += ($log['direction']==0) ? 1 : 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [4] Gestion des couleurs
|
||||
=========================================================*/
|
||||
$colors = array();
|
||||
|
||||
$colors['default'] = array( 'hsla(347,100%,69%,1)', 'hsla(204,82%,57%,1)', 'hsla(43,100%,67%,1)' );
|
||||
$colors['hover'] = self::cFilter($colors['default'], 0, 0, -2);
|
||||
|
||||
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'labels' => $labels,
|
||||
'datasets' => array(array(
|
||||
'data' => array($INCOMING, $OUTGOING, $MISSED),
|
||||
'backgroundColor' => $colors['default'],
|
||||
'hoverBackgroundColor' => $colors['hover']
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE UN JEU DE DONNEES POUR LE TYPE DE COMMUNICATION (APPEL/SMS)
|
||||
*
|
||||
*/
|
||||
public static function type($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] On initialise les compteurs
|
||||
=========================================================*/
|
||||
$PHONE = 0;
|
||||
$SMS = 0;
|
||||
|
||||
|
||||
/* [2] S'il a un journal d'appel, on renvoie les données
|
||||
=========================================================*/
|
||||
if( isset($data['logs']) && is_array($data['logs']) ){
|
||||
|
||||
/* (1) On incrémente les compteurs */
|
||||
foreach($data['logs'] as $log){
|
||||
|
||||
/* (2) On incrémente les compteurs */
|
||||
$PHONE += ($log['type']==0) ? 1 : 0;
|
||||
$SMS += ($log['type']==1) ? 1 : 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [4] Gestion des couleurs
|
||||
=========================================================*/
|
||||
$colors = array();
|
||||
|
||||
$colors['default'] = array( 'hsla(347,100%,69%,1)', 'hsla(204,82%,57%,1)' );
|
||||
$colors['hover'] = self::cFilter($colors['default'], 0, 0, -2);
|
||||
|
||||
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'labels' => array('APPELS', 'SMS'),
|
||||
'datasets' => array(array(
|
||||
'data' => array($PHONE, $SMS),
|
||||
'backgroundColor' => $colors['default'],
|
||||
'hoverBackgroundColor' => $colors['hover']
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE UN JEU DE DONNEES POUR LE SEXE DES COMMUNICATIONS (HOMME/FEMME)
|
||||
*
|
||||
*/
|
||||
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] On initialise les compteurs
|
||||
=========================================================*/
|
||||
$H = 0;
|
||||
$F = 0;
|
||||
|
||||
/* [3] S'il a un journal d'appel, on renvoie les données
|
||||
=========================================================*/
|
||||
if( isset($data['logs']) && is_array($data['logs']) ){
|
||||
|
||||
/* (1) On incrémente les compteurs */
|
||||
foreach($data['logs'] as $log){
|
||||
|
||||
/* (2) 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;
|
||||
|
||||
/* (3) On incrémente les compteurs */
|
||||
$H += ($associatedContact['sexe']==0) ? 1 : 0;
|
||||
$F += ($associatedContact['sexe']==1) ? 1 : 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [4] Gestion des couleurs
|
||||
=========================================================*/
|
||||
$colors = array();
|
||||
|
||||
$colors['default'] = array( 'hsla(347,100%,69%,1)', 'hsla(204,82%,57%,1)' );
|
||||
$colors['hover'] = self::cFilter($colors['default'], 0, 0, -2);
|
||||
|
||||
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'labels' => array('HOMME', 'FEMME'),
|
||||
'datasets' => array(array(
|
||||
'data' => array($H, $F),
|
||||
'backgroundColor' => $colors['default'],
|
||||
'hoverBackgroundColor' => $colors['hover']
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE UN JEU DE DONNEES POUR LES AGES DES COMMUNICATIONS
|
||||
*
|
||||
*/
|
||||
public static function ages($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] On initialise les valeurs
|
||||
=========================================================*/
|
||||
/* (1) On charge le dictionnaire */
|
||||
$dict = self::loadDictionary();
|
||||
if( $dict === false )
|
||||
return array( 'ModuleError' => ManagerError::ParsingFailed );
|
||||
|
||||
/* (2) On initialise les compteurs et les labels */
|
||||
$age_classes = array();
|
||||
$labels = array();
|
||||
foreach($dict['contacts']['age'] as $i=>$label){
|
||||
array_push($labels, $label);
|
||||
$age_classes[$i] = 0;
|
||||
}
|
||||
|
||||
|
||||
/* [3] S'il a un journal d'appel, on renvoie les données
|
||||
=========================================================*/
|
||||
if( isset($data['logs']) && is_array($data['logs']) ){
|
||||
|
||||
|
||||
/* (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 le compteur de la classe d'age en question */
|
||||
if( isset($age_classes[ $associatedContact['age'] ]) )
|
||||
$age_classes[ $associatedContact['age'] ]++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [4] Gestion des couleurs
|
||||
=========================================================*/
|
||||
$colors = array();
|
||||
|
||||
$colors['default'] = array();
|
||||
|
||||
$step = (int) (50/count($age_classes));
|
||||
|
||||
// Pour chaque classe, on ajoute une couleur
|
||||
for( $i = 0 ; $i < count($age_classes) ; $i++ )
|
||||
array_push($colors['default'], 'hsl(216,100%,'.(25+(50-$step*$i)).'%)');
|
||||
|
||||
$colors['hover'] = self::cFilter($colors['default'], 0, 0, -2);
|
||||
|
||||
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'labels' => $labels,
|
||||
'datasets' => array(array(
|
||||
'data' => $age_classes,
|
||||
'backgroundColor' => $colors['default'],
|
||||
'hoverBackgroundColor' => $colors['hover']
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,10 +367,142 @@
|
|||
|
||||
|
||||
|
||||
/* RETOURNE UN JEU DE DONNEES POUR LES TYPES DE RELATION DES COMMUNICATIONS
|
||||
*
|
||||
*/
|
||||
public static function relations($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] On initialise les valeurs
|
||||
=========================================================*/
|
||||
/* (1) On charge le dictionnaire */
|
||||
$dict = self::loadDictionary();
|
||||
if( $dict === false )
|
||||
return array( 'ModuleError' => ManagerError::ParsingFailed );
|
||||
|
||||
/* (2) On initialise les compteurs et labels */
|
||||
$relations = array(); // relations en fonction du log
|
||||
$relationsByContact = array(); // relations en fonction de la répartition des contacts
|
||||
$labels = array();
|
||||
|
||||
foreach($dict['contacts']['reltype'] as $i=>$label){
|
||||
array_push($labels, $label);
|
||||
$relations[$i] = 0;
|
||||
$relationsByContact[$i] = 0;
|
||||
}
|
||||
|
||||
|
||||
/* [3] S'il a un journal d'appel, on renvoie les données
|
||||
=========================================================*/
|
||||
if( isset($data['logs']) && is_array($data['logs']) ){
|
||||
|
||||
|
||||
/* (2) On incrémente les compteurs */
|
||||
$tot = 0;
|
||||
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 le compteur de la classe d'age en question */
|
||||
if( isset($relations[ $associatedContact['reltype'] ]) ){
|
||||
$relations[ $associatedContact['reltype'] ]++;
|
||||
$tot++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach($relations as $r=>$rel)
|
||||
$relations[$r] = 100 * $relations[$r] / $tot;
|
||||
|
||||
}
|
||||
|
||||
/* [4] On récupère les données par CONTACT
|
||||
=========================================================*/
|
||||
/* (1) On incrémente les compteurs */
|
||||
$tot = 0;
|
||||
foreach($data['contacts'] as $contact){
|
||||
|
||||
/* (2) On incrémente le compteur de la classe d'age en question */
|
||||
if( isset($relationsByContact[ $contact['reltype'] ]) ){
|
||||
$relationsByContact[ $contact['reltype'] ]++;
|
||||
$tot++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach($relationsByContact as $r=>$rel)
|
||||
$relationsByContact[$r] = 100 * $relationsByContact[$r] / $tot;
|
||||
|
||||
|
||||
|
||||
/* [5] Gestion des couleurs
|
||||
=========================================================*/
|
||||
$colors = array();
|
||||
|
||||
$colors['default'] = array();
|
||||
$colors['defaultContact'] = array();
|
||||
|
||||
$step = (int) (50/count($relations));
|
||||
|
||||
// Pour chaque classe, on ajoute une couleur
|
||||
for( $i = 0 ; $i < count($relations) ; $i++ )
|
||||
array_push($colors['default'], 'hsla(216,100%,'.(25+(50-$step*$i)).'%,.5)');
|
||||
|
||||
$colors['hover'] = self::cFilter($colors['default'], 0, 0, -2);
|
||||
|
||||
// Pour chaque classe PAR CONTACT, on ajoute une couleur
|
||||
for( $i = 0 ; $i < count($relationsByContact) ; $i++ )
|
||||
array_push($colors['defaultContact'], 'hsla(20,100%,'.(25+(50-$step*$i)).'%,.5)');
|
||||
|
||||
$colors['hoverContact'] = self::cFilter($colors['defaultContact'], 0, 0, -2);
|
||||
|
||||
|
||||
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'labels' => $labels,
|
||||
'datasets' => array(
|
||||
array( // En fonction du log
|
||||
'label' => 'Répartition des communications',
|
||||
'data' => $relations,
|
||||
'backgroundColor' => $colors['default'],
|
||||
'hoverBackgroundColor' => $colors['hover'],
|
||||
'borderWidth' => 1,
|
||||
'borderColor' => 'hsla(216,100%,80%,1)'
|
||||
),
|
||||
array( // Répartition dans les contacts
|
||||
'label' => 'Répartition des contacts',
|
||||
'data' => $relationsByContact,
|
||||
'backgroundColor' => $colors['defaultContact'],
|
||||
'hoverBackgroundColor' => $colors['hoverContact'],
|
||||
'borderWidth' => 1,
|
||||
'borderColor' => 'hsla(20,100%,80%,1)'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,229 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace manager\module\chart;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ManagerError;
|
||||
|
||||
class networkChart{
|
||||
|
||||
|
||||
/* RETOURNE UN JEU DE DONNEES POUR GRAPHIQUE #FIELD
|
||||
*
|
||||
*/
|
||||
public static function data(){
|
||||
/* [1] On cree de fausses donnees
|
||||
=========================================================*/
|
||||
$data = array(
|
||||
/* (1) ID_EGO */
|
||||
'ego' => 17,
|
||||
|
||||
/* (2) Liste des alters */
|
||||
'alter' => array(
|
||||
// Pour chaque alter, on a ID_ALTER, NOM_ALTER, AFFINITE_ALTER
|
||||
array( 653, "Norris", 2*5/100 ),
|
||||
array( 1743, "Melissa", 79*5/100 ),
|
||||
array( 3739, "Sue", 38*5/100 ),
|
||||
array( 36, "Rasmussen", 34*5/100 ),
|
||||
array( 1372, "Brown", 35*5/100 ),
|
||||
array( 3030, "Brock", 84*5/100 ),
|
||||
array( 3821, "Savage", 21*5/100 ),
|
||||
array( 1288, "Black", 17*5/100 ),
|
||||
array( 1443, "Susie", 69*5/100 ),
|
||||
array( 4129, "Rowe", 66*5/100 ),
|
||||
array( 71, "Dillard", 87*5/100 ),
|
||||
array( 1002, "Richmond", 5*5/100 ),
|
||||
array( 640, "Morris", 24*5/100 ),
|
||||
array( 2335, "Daugherty", 53*5/100 ),
|
||||
array( 2541, "Hughes", 74*5/100 ),
|
||||
array( 3963, "Roach", 13*5/100 ),
|
||||
array( 4550, "Hazel", 30*5/100 ),
|
||||
array( 3120, "Eugenia", 97*5/100 ),
|
||||
array( 4302, "Nicholson", 25*5/100 ),
|
||||
array( 859, "Marguerite", 70*5/100 ),
|
||||
array( 2551, "Aurora", 36*5/100 ),
|
||||
array( 3612, "Tracie", 55*5/100 ),
|
||||
array( 3040, "Fulton", 62*5/100 ),
|
||||
array( 1895, "Stuart", 37*5/100 ),
|
||||
array( 4342, "Latasha", 21*5/100 ),
|
||||
array( 2957, "Coleen", 1*5/100 ),
|
||||
array( 2493, "Contreras", 100*5/100 ),
|
||||
array( 4776, "Holmes", 97*5/100 ),
|
||||
array( 3623, "Hallie", 88*5/100 ),
|
||||
array( 3660, "Ginger", 26*5/100 ),
|
||||
array( 471, "Slater", 23*5/100 ),
|
||||
array( 4581, "Elnora", 23*5/100 ),
|
||||
array( 286, "Patton", 71*5/100 ),
|
||||
array( 3210, "Autumn", 23*5/100 ),
|
||||
array( 1896, "Benton", 99*5/100 ),
|
||||
array( 4875, "Fern", 17*5/100 ),
|
||||
array( 2156, "Bond", 99*5/100 ),
|
||||
array( 1556, "Ingrid", 34*5/100 ),
|
||||
array( 2097, "Case", 23*5/100 ),
|
||||
array( 3024, "Pat", 57*5/100 ),
|
||||
array( 1121, "Reeves", 41*5/100 ),
|
||||
array( 1832, "Francis", 75*5/100 ),
|
||||
array( 3733, "Moore", 77*5/100 ),
|
||||
array( 737, "Elva", 49*5/100 ),
|
||||
array( 1137, "Stevenson", 10*5/100 ),
|
||||
array( 988, "Lauri", 44*5/100 ),
|
||||
array( 1182, "Boone", 19*5/100 ),
|
||||
array( 909, "Morin", 68*5/100 )
|
||||
),
|
||||
|
||||
/* (1) Liste des relations */
|
||||
'inter' => array(
|
||||
array( 471, 3821 ),
|
||||
array( 4129, 1137 ),
|
||||
array( 4302, 2957 ),
|
||||
array( 859, 3660 ),
|
||||
array( 640, 71 ),
|
||||
array( 4129, 1372 ),
|
||||
array( 909, 4550 ),
|
||||
array( 2156, 3210 ),
|
||||
array( 2493, 3660 ),
|
||||
array( 2541, 4550 ),
|
||||
array( 1372, 3660 ),
|
||||
array( 1896, 4875 ),
|
||||
array( 988, 3120 ),
|
||||
array( 1121, 1372 ),
|
||||
array( 4550, 909 ),
|
||||
array( 988, 3739 ),
|
||||
array( 2156, 3030 ),
|
||||
array( 4342, 4302 ),
|
||||
array( 71, 286 ),
|
||||
array( 3120, 1182 ),
|
||||
array( 3821, 3660 ),
|
||||
array( 2541, 1743 ),
|
||||
array( 1895, 1182 ),
|
||||
array( 3030, 1372 ),
|
||||
array( 3040, 1556 ),
|
||||
array( 2541, 1832 ),
|
||||
array( 3660, 3210 ),
|
||||
array( 1895, 3821 )
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
/* [5] Gestion du retour
|
||||
=========================================================*/
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'data' => $data
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* RETOURNE UN SVG CORRESPONDANT AU GRAPHIQUE #FIELD
|
||||
*
|
||||
* @data<Array> Jeu de donnees
|
||||
*
|
||||
* @return render<String> Contenu du svg representation graphique des donnees
|
||||
*
|
||||
*/
|
||||
public static function render($data){
|
||||
$render = "";
|
||||
$nb_circles = 4;
|
||||
|
||||
|
||||
// Couleur Facebook
|
||||
$facebook = 0x3b5998;
|
||||
|
||||
/* [1] On genere le debut du svg
|
||||
=========================================================*/
|
||||
$render .= '<?xml version="1.0" encoding="UTF-8" standalone="no"?>';
|
||||
$render .= '<svg height="500" viewBox="0 0 1000 1000" width="500" xmlns="http://www.w3.org/2000/svg">';
|
||||
|
||||
/* [2] On cree le contexte (cercles dont ego)
|
||||
=========================================================*/
|
||||
$circles = array();
|
||||
|
||||
// Difference de rayon (40 = taille ego + espace)
|
||||
$raddiff = (500-50) / ($nb_circles);
|
||||
|
||||
// Pour chaque cercle dont ego
|
||||
for( $i = 0 ; $i < $nb_circles ; $i++ ){
|
||||
|
||||
$circles[$i] = "<circle cx='500' cy='500' r='".(500-50-$i*$raddiff)."' fill='#".(($i%2==0)?'ddd':'fff')."' />";
|
||||
|
||||
}
|
||||
|
||||
$circles[ $nb_circles ] = "<circle cx='500' cy='500' r='20' fill='#ff5629' />";
|
||||
|
||||
|
||||
/* [3] On cree les elements dynamiques
|
||||
=========================================================*/
|
||||
/* (1) On calcule l'angle de diff entre chaque ALTER */
|
||||
$ang = 2*pi() / count($data['alter']);
|
||||
|
||||
/* (2) On ajoute tous les alters */
|
||||
$alters = array();
|
||||
$origins = array();
|
||||
foreach($data['alter'] as $i=>$alter){
|
||||
// On calcule l'origine (centre du cercle)
|
||||
$origins[$alter[0]] = array(
|
||||
'x' => 500 + (5-$alter[2])*(400/5) * cos($ang*$i),
|
||||
'y' => 500 + (5-$alter[2])*(400/5) * sin($ang*$i)
|
||||
);
|
||||
|
||||
// On ajoute le cercle associe a l'alter courant
|
||||
$alters[$i] = "<circle cx='".$origins[$alter[0]]['x']."' cy='".$origins[$alter[0]]['y']."' r='20' fill='#53d192' title='".$alter[1]."' />";
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [4] On relie toutes les relations
|
||||
=========================================================*/
|
||||
$inter = array();
|
||||
foreach($data['inter'] as $rel){
|
||||
$lefthand = isset($origins[$rel[0]]) && is_array($origins[$rel[0]]);
|
||||
$righthand = isset($origins[$rel[1]]) && is_array($origins[$rel[1]]);
|
||||
|
||||
// Si les deux existent, on les relie
|
||||
if( $lefthand && $righthand )
|
||||
array_push($inter,
|
||||
"<line x1='".$origins[$rel[0]]['x']."' y1='".$origins[$rel[0]]['y']."' x2='".$origins[$rel[1]]['x']."' y2='".$origins[$rel[1]]['y']."' stroke-width='5' stroke='#888' />"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [5] On ajoute les elements et on ferme le svg
|
||||
=========================================================*/
|
||||
foreach($circles as $circle) $render .= $circle; // les cercles (dont ego)
|
||||
foreach($inter as $rel) $render .= $rel; // les relations
|
||||
foreach($alters as $alter) $render .= $alter; // les alters
|
||||
|
||||
$render .= "</svg>";
|
||||
|
||||
|
||||
/* [6] Gestion du retour
|
||||
=========================================================*/
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'render' => $render
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -364,6 +364,127 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONVERTISSEUR .txt de iExplorer vers .xml de Call Log
|
||||
*
|
||||
* @file<FILE> Pointeur vers $_FILES['']
|
||||
*
|
||||
*/
|
||||
public static function iexplorer_convert($params){
|
||||
extract($params);
|
||||
|
||||
/* [1] Gestion de l'upload du fichier et de la vérification du format
|
||||
=========================================================*/
|
||||
$uploadError = self::simpleFile(
|
||||
'convert_iexplorer',// nom du dossier d'upload
|
||||
'txt', // format du fichier
|
||||
$file, // Fichier lui-même
|
||||
function($content){
|
||||
$lines = explode("\n", $content);
|
||||
|
||||
foreach($lines as $l=>$line)
|
||||
if( strlen($line) > 0 && !preg_match('/^([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) *$/u', $line) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
/* (1) Si erreur d'upload, on la renvoie */
|
||||
if( $uploadError != ManagerError::Success )
|
||||
return array( 'ModuleError' => $uploadError );
|
||||
|
||||
|
||||
|
||||
/* [2] On récupère les colonnes avec la premiére ligne
|
||||
=========================================================*/
|
||||
/* (1) On met un handler sur le fichier pour le lire */
|
||||
$path = __ROOT__."/src/upload/convert_iexplorer/".$_SESSION['username'].".txt";
|
||||
|
||||
$handler = new \SplFileObject($path, 'r');
|
||||
|
||||
/* (2) On récupère pour chaque colonne, la position dans le chaine, et la valeur */
|
||||
$data = array();
|
||||
$lineCount = 0;
|
||||
while( !$handler->eof() ){
|
||||
$line = $handler->fgets();
|
||||
|
||||
/* (1) Si première ligne, c'est les intitulés */
|
||||
if( $lineCount == 0 ){
|
||||
// Si erreur dans les intitulés, on retourne une erreur
|
||||
if( !preg_match('/^([\w\(\):\.@-]+(?: [\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: [\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: [\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: [\w\(\):\.@-]+)*) *$/u', $line, $matches) )
|
||||
return array( 'ModuleError' => ManagerError::FormatError );
|
||||
|
||||
// On récupère les colonnes
|
||||
$columns = array_slice($matches, 1);
|
||||
|
||||
// On récupére les positions des colonnes
|
||||
$colpos = array();
|
||||
foreach($columns as $column)
|
||||
array_push($colpos, strpos($line, $column));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (2) S'il reconnait pas la ligne, on passe à la suivante */
|
||||
if( !preg_match('/^([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) +([\w\(\):\.@-]+(?: {1,3}[\w\(\):\.@-]+)*) *$/u', $line, $matches) )
|
||||
continue;
|
||||
|
||||
/* (3) On enregistre les données sinon */
|
||||
$cur = array();
|
||||
foreach($columns as $c=>$column)
|
||||
$cur[$column] = $matches[$c+1];
|
||||
|
||||
array_push($data, $cur);
|
||||
|
||||
|
||||
$lineCount++;
|
||||
}
|
||||
|
||||
|
||||
$handler = null;
|
||||
|
||||
/* (3) Restitution du retour de `unserialize` */
|
||||
return array(
|
||||
'ModuleError' => ManagerError::Success,
|
||||
'data' => $data
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,219 @@
|
|||
<!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" style='margin: 2em;'></canvas>
|
||||
<canvas id="type" width="400" height="400" style='margin: 2em;'></canvas>
|
||||
<canvas id="sexe" width="400" height="400" style='margin: 2em;'></canvas>
|
||||
<canvas id="age" width="400" height="400" style='margin: 2em;'></canvas>
|
||||
<canvas id="relation" width="400" height="400" style='margin: 2em;'></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');
|
||||
var age = document.getElementById('age');
|
||||
var relation = document.getElementById('relation');
|
||||
|
||||
/* [0] Paramètres globaux
|
||||
=========================================================*/
|
||||
Chart.defaults.global.responsive = false;
|
||||
Chart.defaults.global.onClick = function(e, c){
|
||||
console.log(e); // MouseEvent
|
||||
console.log(c[0]._datasetIndex, c[0]._index); // Chart data
|
||||
|
||||
// _datasetIndex, quel dataset (s'il y en a plusieurs)
|
||||
// _index, indice de la valeur dans le dataset
|
||||
}
|
||||
|
||||
subject = 273;
|
||||
|
||||
|
||||
var charts = ['sexe', 'direction', 'type', 'ages', 'relation'];
|
||||
|
||||
|
||||
/* [1] On crée les conteneurs
|
||||
=========================================================*/
|
||||
for( var c in charts ){
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [1] On récupére les données SEXE
|
||||
=========================================================*/
|
||||
/* (1) On rédige la requête */
|
||||
var request = {
|
||||
path: 'chart/sexe',
|
||||
subject: subject
|
||||
}
|
||||
|
||||
/* (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: response.datasets
|
||||
}
|
||||
|
||||
/* [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/direction',
|
||||
subject: subject
|
||||
}
|
||||
|
||||
/* (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: response.datasets
|
||||
}
|
||||
|
||||
/* [3] On construit notre graphique
|
||||
=========================================================*/
|
||||
var myDoughnutChart = new Chart(direction, {
|
||||
type: 'doughnut',
|
||||
animation: { animateScale: true },
|
||||
data: data
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
/* [3] On récupére les données TYPE
|
||||
=========================================================*/
|
||||
/* (1) On rédige la requête */
|
||||
var request = {
|
||||
path: 'chart/type',
|
||||
subject: subject
|
||||
}
|
||||
|
||||
/* (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: response.datasets
|
||||
}
|
||||
|
||||
/* [3] On construit notre graphique
|
||||
=========================================================*/
|
||||
var myDoughnutChart = new Chart(type, {
|
||||
type: 'doughnut',
|
||||
animation: { animateScale: true },
|
||||
data: data
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/* [4] On récupére les données AGES
|
||||
=========================================================*/
|
||||
/* (1) On rédige la requête */
|
||||
var request = {
|
||||
path: 'chart/ages',
|
||||
subject: subject
|
||||
}
|
||||
|
||||
/* (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: response.datasets
|
||||
}
|
||||
|
||||
/* [3] On construit notre graphique
|
||||
=========================================================*/
|
||||
var myDoughnutChart = new Chart(age, {
|
||||
type: 'doughnut',
|
||||
animation: { animateScale: true },
|
||||
data: data
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/* [5] On récupére les données RELATIONS (types)
|
||||
=========================================================*/
|
||||
/* (1) On rédige la requête */
|
||||
var request = {
|
||||
path: 'chart/relations',
|
||||
subject: subject
|
||||
}
|
||||
|
||||
/* (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: response.datasets
|
||||
}
|
||||
|
||||
/* [3] On construit notre graphique
|
||||
=========================================================*/
|
||||
var myBarChart = new Chart(relation, {
|
||||
type: 'bar',
|
||||
animation: { animateScale: true },
|
||||
data: data
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
4
view.php
4
view.php
|
@ -41,8 +41,8 @@
|
|||
<script type='text/javascript' src='/f/js/input-html-facebook-data-min/js/includes' ></script> <!-- Gestion du constructeur HTML pour la page d'acquisition -->
|
||||
|
||||
<!-- Librairies Externes Javascript -->
|
||||
<script type='text/javascript' src='/f/js/sigma-min/sigma' ></script> <!-- Gestion du graphique de type réseau -->
|
||||
<!-- <script type='text/javascript' src='/f/js/sigma-plugins-animate-min/sigma/plugins' ></script> for animations -->
|
||||
<script type='text/javascript' src='/f/js/_charts-min/js/lib' ></script> <!-- Librairie pour les graphiques -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
|
@ -10,57 +10,11 @@
|
|||
|
||||
|
||||
|
||||
/* [1] Gestion du cercle des relations
|
||||
=======================================*/
|
||||
/* (1) On recupere les donnees */
|
||||
$getData = new ModuleRequest('chart/network_data');
|
||||
$answer = $getData->dispatch();
|
||||
|
||||
// Si pas d'erreur
|
||||
if( $answer->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($answer->error) );
|
||||
|
||||
// On enregistre les donnees
|
||||
$data = $answer->get('data');
|
||||
|
||||
|
||||
/* (2) On recupere le rendu */
|
||||
$getRender = new ModuleRequest('chart/network_render', array('dataset' => $data));
|
||||
$answer = $getRender->dispatch();
|
||||
|
||||
// Si pas d'erreur
|
||||
if( $answer->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($answer->error) );
|
||||
|
||||
// On enregistre les donnees
|
||||
$render = $answer->get('render');
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<section data-sublink='phone' class='charts'>
|
||||
<section data-sublink='phone'>
|
||||
|
||||
<!-- SECTION 1 - SOCIOGRAMME SPATIAL -->
|
||||
<section>
|
||||
<center><h6>SOCIOGRAMME SPATIAL</h6></center>
|
||||
<div id='sociogram' style='border-radius:3px;border: 1px solid #ddd;margin: 2em;width:30em;height: 30em;'></div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!-- SECTION 1 BIS - SOCIOGRAMME SPATIAL -->
|
||||
<section>
|
||||
<center><h6>SOCIOGRAMME EGOCENTRE</h6></center>
|
||||
<div id='graph-container' style='border-radius:3px;border: 1px solid #ddd;margin: 2em;width:30em;height: 30em;'></div>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<!-- SECTION 2 - SOCIOGRAMME EGOCENTRE -->
|
||||
<section>
|
||||
<center><h6>SOCIOGRAMME EGOCENTRE</h6></center>
|
||||
<?php echo $render; ?>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
||||
require_once __ROOT__.'/manager/autoloader.php';
|
||||
|
||||
use \manager\ModuleRequest;
|
||||
use \manager\ResourceDispatcher;
|
||||
use \manager\sessionManager;
|
||||
use \manager\ManagerError;
|
||||
|
||||
debug();
|
||||
|
||||
|
||||
|
||||
// Fonction pour corriger les dates
|
||||
function correctDates($date){
|
||||
$date = str_replace('janv.', 'jan.', $date);
|
||||
$date = str_replace('févr.', 'feb.', $date);
|
||||
$date = str_replace('mars', 'march', $date);
|
||||
$date = str_replace('avr.', 'apr.', $date);
|
||||
$date = str_replace('mai', 'may', $date);
|
||||
$date = str_replace('juin', 'june', $date);
|
||||
$date = str_replace('juil.', 'july', $date);
|
||||
$date = str_replace('août', 'aug.', $date);
|
||||
|
||||
return strtotime($date);
|
||||
}
|
||||
|
||||
/* [0] Upload du fichier
|
||||
=========================================================*/
|
||||
if( isset($_FILES) && isset($_FILES['file']) ){
|
||||
|
||||
$request = new ModuleRequest('upload/iexplorer_convert');
|
||||
$response = $request->dispatch();
|
||||
|
||||
// Si erreur, on l'affiche
|
||||
if( $response->error != ManagerError::Success )
|
||||
var_dump( ManagerError::explicit($response->error) );
|
||||
|
||||
// On récupère les données
|
||||
$logs = $response->get('data');
|
||||
|
||||
/* [1] On associe un faux numéro à chaque utilisateur
|
||||
=========================================================*/
|
||||
$falseNumbers = array(0); // Contiendra les numéros attribués
|
||||
$alreadyNumbered = array(); // Contiendra aux mêmes indices que les numéros, les noms des personnes les ayant utilisé
|
||||
|
||||
// Pour chaque utilisateur
|
||||
foreach($logs as $i=>$log){
|
||||
|
||||
// On évite la première ligne
|
||||
if( $i == 0 ){
|
||||
unset($logs[$i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$numberIndex = array_search($log['Number'], $alreadyNumbered);
|
||||
|
||||
/* (1) Si pas encore de numéro, on en attribue un */
|
||||
if( $numberIndex === false ){
|
||||
$lastnumIndex = count($falseNumbers) - 1;
|
||||
$newNumber = ++$falseNumbers[$lastnumIndex];
|
||||
$numberIndex = array_push($falseNumbers, $newNumber ) - 1;
|
||||
$alreadyNumbered[$numberIndex] = $log['Number'];
|
||||
}
|
||||
|
||||
$logs[$i]['Name'] = $logs[$i]['Number'];
|
||||
$logs[$i]['Number'] = $falseNumbers[$numberIndex];
|
||||
}
|
||||
|
||||
/* (2) On convertit les numéros en string */
|
||||
foreach($falseNumbers as $n=>$number){
|
||||
$stringNumber = "0600000000"; $snlen = strlen($stringNumber);
|
||||
$stringValue = strval($number); $svlen = strlen($stringValue);
|
||||
|
||||
$stringNumber = substr($stringNumber, 0, $snlen-$svlen);
|
||||
$stringNumber .= $stringValue;
|
||||
|
||||
$falseNumbers[$n] = $stringNumber;
|
||||
$logs[$i]['Number'] = $falseNumbers[$numberIndex];
|
||||
}
|
||||
|
||||
foreach($logs as $i=>$log){
|
||||
$numberIndex = array_search($log['Name'], $alreadyNumbered);
|
||||
$logs[$i]['Number'] = $falseNumbers[$numberIndex];
|
||||
}
|
||||
|
||||
/* [2] On rédige les headers
|
||||
=========================================================*/
|
||||
header('Content-type: text/xml');
|
||||
header('Content-Disposition: attachment; filename=call-log.xml');
|
||||
|
||||
|
||||
/* [3] On rédige le contenu du fichier XML
|
||||
=========================================================*/
|
||||
echo "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\n";
|
||||
echo "<Logs>\n";
|
||||
|
||||
// Pour chaque utilisateur
|
||||
foreach($logs as $i=>$log)
|
||||
echo "<Item Number='${log['Number']}' Name='${log['Name']}' Date='".correctDates($log['Date'])."' Duration='".strtotime("1970-01-01 ${log['Duration']} UTC")."' Direction='".strtoupper($log['Call Type'])."' Type='PHONE' />\n";
|
||||
|
||||
echo "</Logs>\n";
|
||||
|
||||
// Si aucun fichier
|
||||
}else{ ?>
|
||||
<form action='' method='POST' enctype='multipart/form-data'>
|
||||
<input type='file' name='file'>
|
||||
<input type='submit' value='Convertir en call-log'>
|
||||
</form>
|
||||
<?php }
|
||||
|
||||
?>
|
|
@ -1 +1,3 @@
|
|||
var chartManagers={sociogram:{link:"/js/includes/charts-sociogram-min.js",loaded:!1}},sociogram;chartManagers.sociogram.loaded=include(chartManagers.sociogram.link,null,!0);include(chartManagers.sociogram.link,function(){chartManagers.sociogram.loaded||sociogramClass.prototype.overloadGraph();sociogram=new sociogramClass($("#sociogram"));sociogram.load()});
|
||||
var subPhone=$('section[data-sublink="phone"]');subPhone.style.display="flex";subPhone.style.flexWrap="wrap";subPhone.style.justifyContent="space-around";Chart.defaults.global.responsive=!1;Chart.defaults.global.title.display=!0;Chart.defaults.global.onClick=function(a,b){console.log(a);null!=b[0]&&console.log(b[0]._datasetIndex,b[0]._index)};subject=273;var charts=["sexe","direction","type","ages","relations"],types=["doughnut","doughnut","doughnut","bar","bar"],canvas=[],instances=[],c;
|
||||
for(c in charts)canvas[c]=document.createElement("canvas"),canvas[c].id=charts[c],canvas[c].width=400,canvas[c].height=400,subPhone.appendChild(canvas[c]);
|
||||
for(c=0;c<charts.length;c++){var request={path:"chart/"+charts[c],subject:subject};api.send(request,function(a,b){console.log(api.buffer);var d=b[0];if(0!=a.ModuleError)return!1;var e={labels:a.labels,datasets:a.datasets};Chart.defaults.global.title.text=charts[d].charAt(0).toUpperCase()+charts[d].slice(1).toLowerCase();instances[d]=new Chart(canvas[d],{type:types[d],animation:{animateScale:!0},data:e,options:{scaleShowLabels:!1}})},null,c)};
|
||||
|
|
|
@ -1,26 +1,85 @@
|
|||
/* [0] Chemins des fichiers de gestion des graphiques
|
||||
var subPhone = $('section[data-sublink="phone"]');
|
||||
subPhone.style.display = 'flex';
|
||||
subPhone.style.flexWrap = 'wrap';
|
||||
subPhone.style.justifyContent = 'space-around';
|
||||
|
||||
/* [0] Paramètres globaux
|
||||
=========================================================*/
|
||||
var chartManagers = {
|
||||
sociogram: { link: '/js/includes/charts-sociogram-min.js', loaded: false }
|
||||
Chart.defaults.global.responsive = false;
|
||||
Chart.defaults.global.title.display = true;
|
||||
|
||||
|
||||
Chart.defaults.global.onClick = function(e, c){
|
||||
console.log(e); // MouseEvent
|
||||
if( c[0] != null )
|
||||
console.log(c[0]._datasetIndex, c[0]._index); // Chart data
|
||||
|
||||
// _datasetIndex, quel dataset (s'il y en a plusieurs)
|
||||
// _index, indice de la valeur dans le dataset
|
||||
};
|
||||
|
||||
subject = 273;
|
||||
|
||||
|
||||
/* [1] Gestion du sociogramme
|
||||
var charts = ['sexe', 'direction', 'type', 'ages', 'relations'];
|
||||
var types = ['doughnut', 'doughnut', 'doughnut', 'bar', 'bar'];
|
||||
var canvas = []; // Contiendra les canvas
|
||||
var instances = []; // Contiendra les charts
|
||||
|
||||
/* [1] On crée les conteneurs
|
||||
=========================================================*/
|
||||
var sociogram;
|
||||
for( var c in charts ){
|
||||
canvas[c] = document.createElement('canvas');
|
||||
canvas[c].id = charts[c];
|
||||
canvas[c].width = 400;
|
||||
canvas[c].height = 400;
|
||||
subPhone.appendChild( canvas[c] );
|
||||
}
|
||||
|
||||
/* (1) On essaie de charger la classe du sociogramme */
|
||||
chartManagers.sociogram.loaded = include(chartManagers.sociogram.link, null, true);
|
||||
|
||||
/* (2) Si il est pas déja chargé, on initialise le sociogramme */
|
||||
/* [2] Pour chaque graphique, on récupère les données et on les affiche
|
||||
=========================================================*/
|
||||
for( var c = 0 ; c < charts.length ; c++ ){
|
||||
|
||||
include(chartManagers.sociogram.link, function(){
|
||||
// On ajoute les méthodes si c'est la première fois qu'on charge
|
||||
if( !chartManagers.sociogram.loaded ) sociogramClass.prototype.overloadGraph();
|
||||
|
||||
// On charge le graphique
|
||||
sociogram = new sociogramClass( $('#sociogram') );
|
||||
sociogram.load();
|
||||
/* (1) On rédige la requête */
|
||||
var request = {
|
||||
path: 'chart/'+charts[c],
|
||||
subject: subject
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
/* (2) On lance la requête */
|
||||
api.send(request, function(response, args){
|
||||
console.log(api.buffer);
|
||||
// On récupère @c dans le scope du handler
|
||||
var c = args[0];
|
||||
|
||||
/* (3) Si erreur, on quitte */
|
||||
if( response.ModuleError != 0 )
|
||||
return false;
|
||||
|
||||
/* [2] On construit les données
|
||||
=========================================================*/
|
||||
var data = {
|
||||
labels: response.labels,
|
||||
datasets: response.datasets
|
||||
};
|
||||
|
||||
Chart.defaults.global.title.text = charts[c].charAt(0).toUpperCase()+charts[c].slice(1).toLowerCase();
|
||||
/* [3] On construit notre graphique
|
||||
=========================================================*/
|
||||
instances[c] = new Chart(canvas[c], {
|
||||
type: types[c],
|
||||
animation: { animateScale: true },
|
||||
data: data,
|
||||
options: {
|
||||
scaleShowLabels: false
|
||||
}
|
||||
});
|
||||
|
||||
}, null, c);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
var cSubjectManager,cContactManager,cMiniManager,cFicheManager,cMatriceManager;
|
||||
function cDynamicUpdate(b){var a=b instanceof Element,d=a&&"INPUT"==b.tagName&&"submit"==b.type,e=a&&"SPAN"==b.tagName&&("p_nav-mini"==b.parentNode.id||"p_nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!d&&!e&&!a&&!0!==b)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();pMiniManager.storageToFields();
|
||||
pFicheManager.storageToFields();pMatriceManager.storageToFields();(d||a)&&pContactManager.storageToFields()}
|
||||
include("/js/includes/input-phone-subject.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche.js",function(){include("/js/includes/input-phone-matrice.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="number"]'),$('[data-sublink="phone"] article.subject-panel [data-name="username"]'),
|
||||
function cDynamicUpdate(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,e=b&&"SPAN"==a.tagName&&("p_nav-mini"==a.parentNode.id||"p_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"p_nav-contact"==a.parentNode.id;if(!c&&!e&&!b&&!0!==a)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();pMiniManager.storageToFields();
|
||||
pFicheManager.storageToFields();pMatriceManager.storageToFields();(c||b)&&pContactManager.storageToFields()}
|
||||
include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact-min.js",function(){include("/js/includes/input-phone-mini-min.js",function(){include("/js/includes/input-phone-fiche-min.js",function(){include("/js/includes/input-phone-matrice-min.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="number"]'),$('[data-sublink="phone"] article.subject-panel [data-name="username"]'),
|
||||
$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));pSubjectManager.attach();pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(cDynamicUpdate);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(cDynamicUpdate);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),
|
||||
$('[data-sublink="phone"] #p_nav-fiche'));pFicheManager.attach(cDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(cDynamicUpdate);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("click",function(b){b.target.value=null},!1);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("change",function(b){b={path:"upload/call_log",phone_number:$('[data-sublink="phone"] #p_subject_phone_number').value,
|
||||
file:b.target.files[0]};api.send(b,function(a){console.log(a);var b=null;if(0!=a.ModuleError)9==a.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=a.tmp_id;pSubjectManager.fieldsToStorage();pSubjectManager.storageToFields();for(var e=0;e<a.call.length;e++){var c=a.directory[a.call[e]];
|
||||
lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:e,sms:-1})}for(e=0;e<a.sms.length;e++)if(c=a.directory[a.sms[e]],-1<a.call.indexOf(a.sms[e])){var g=lsi.get("p_contacts",c.id);g.sms=e;lsi.set("p_contacts",c.id,g)}else lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:e});for(var f in a.directory)f=parseInt(f),-1<a.call.indexOf(f)||-1<a.sms.indexOf(f)||(c=a.directory[f],lsi.set("p_contacts",
|
||||
c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:-1}));pContactManager.storageToFields();cDynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(b){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();
|
||||
pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(b){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");b={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};
|
||||
var a=$('[data-sublink="phone"] #p_download-target');a.download="local-phone-data.json";a.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));a.click()},!1);$('[data-sublink="phone"] #p_import-all').addEventListener("click",function(b){$('[data-sublink="phone"] #p_local-upload').click()},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(b){b.target.value=null},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("change",function(b){b=
|
||||
{path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(b,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();
|
||||
cDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(b){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();cFicheManager.fieldsToStorage();if(!cSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;b=lsi["export"]("p_mini-fiches");var a=0,d;for(d in b)if(!isNaN(d)&&(a++,!b[d].valid))return Notification.warning("Attention",
|
||||
"La <i>fiche rapide</i> <b>"+a+"</b> est incompl\u00e8te et/ou incorrecte"),!1;d={path:"input/phone",subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(d,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",
|
||||
1E4);console.log(a)},!1)},!1)})})})})});var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
|
||||
function fDynamicUpdate(b){var a=b instanceof Element,d=a&&"INPUT"==b.tagName&&"submit"==b.type,e=a&&"SPAN"==b.tagName&&("f_nav-mini"==b.parentNode.id||"f_nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"f_nav-contact"==b.parentNode.id;if(!d&&!e&&!a&&!0!==b)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
|
||||
fFicheManager.storageToFields();fMatriceManager.storageToFields();(d||a)&&fContactManager.storageToFields()}
|
||||
include("/js/includes/input-facebook-subject.js",function(){include("/js/includes/input-facebook-contact.js",function(){include("/js/includes/input-facebook-mini.js",function(){include("/js/includes/input-facebook-fiche.js",function(){include("/js/includes/input-facebook-matrice.js",function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="username"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));fSubjectManager.attach();
|
||||
fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),$('[data-sublink="facebook"] #f_nav-contact'));fContactManager.attach(fDynamicUpdate);fMiniManager=new inputFacebookMini($('[data-sublink="facebook"] article.mini-relation-panel'),$('[data-sublink="facebook"] #f_nav-mini'));fMiniManager.attach(fDynamicUpdate);fFicheManager=new inputFacebookFiche($('[data-sublink="facebook"] article.relation-panel'),$('[data-sublink="facebook"] #f_nav-fiche'));fFicheManager.attach(fDynamicUpdate);
|
||||
fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel'));fMatriceManager.attach(fDynamicUpdate);$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(b){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();Notification.success("OK",
|
||||
"Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="facebook"] #f_export-all').addEventListener("click",function(b){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");b={subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};var a=$('[data-sublink="facebook"] #f_download-target');a.download="local-facebook-data.json";
|
||||
a.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));a.click()},!1);$('[data-sublink="facebook"] #f_import-all').addEventListener("click",function(b){$('[data-sublink="facebook"] #f_local-upload').click()},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("click",function(b){b.target.value=null},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("change",function(b){b={path:"upload/local_data",file:$('[data-sublink="facebook"] #f_local-upload').files[0]};
|
||||
api.send(b,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("f_subject",0,a.local_data.subject);lsi["import"]("f_contacts",a.local_data.contacts);lsi["import"]("f_mini-fiches",a.local_data.mini);lsi["import"]("f_fiches",a.local_data.fiches);lsi.set("f_matrice",0,a.local_data.matrice);fSubjectManager.storageToFields();fContactManager.storageToFields();fMatriceManager.storageToFields();fDynamicUpdate(!0)})},!1);$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",
|
||||
function(b){console.log("> GATHERING ALL DATA");fSubjectManager.fieldsToStorage();fContactManager.fieldsToStorage();fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();if(!fSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;b=lsi["export"]("f_mini-fiches");var a=0,d;for(d in b)if(!isNaN(d)&&(a++,!b[d].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+a+"</b> est incompl\u00e8te et/ou incorrecte"),
|
||||
!1;d={path:"input/facebook",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(d,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})});
|
||||
$('[data-sublink="phone"] #p_nav-fiche'));pFicheManager.attach(cDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(cDynamicUpdate);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$('[data-sublink="phone"] #p_subject_phone_number').value,
|
||||
file:a.target.files[0]};api.send(a,function(b){console.log(b);var a=null;if(0!=b.ModuleError)9==b.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",b.ModuleError);else{a=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=b.tmp_id;pSubjectManager.fieldsToStorage();pSubjectManager.storageToFields();for(var e=0;e<b.call.length;e++){var d=b.directory[b.call[e]];
|
||||
lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:e,sms:-1})}for(e=0;e<b.sms.length;e++)if(d=b.directory[b.sms[e]],-1<b.call.indexOf(b.sms[e])){var g=lsi.get("p_contacts",d.id);g.sms=e;lsi.set("p_contacts",d.id,g)}else lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:e});for(var f in b.directory)f=parseInt(f),-1<b.call.indexOf(f)||-1<b.sms.indexOf(f)||(d=b.directory[f],lsi.set("p_contacts",
|
||||
d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:-1}));pContactManager.storageToFields();cDynamicUpdate(!0);null!=a&&a.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();
|
||||
pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};
|
||||
var b=$('[data-sublink="phone"] #p_download-target');b.download="local-phone-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="phone"] #p_import-all').addEventListener("click",function(a){$('[data-sublink="phone"] #p_local-upload').click()},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("change",function(a){a=
|
||||
{path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();
|
||||
cDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();cFicheManager.fieldsToStorage();if(!cSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("p_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention",
|
||||
"La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("p_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/phone",subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(c,function(a){console.log(a);
|
||||
if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",1E4);console.log(a)},!1)},!1)})})})})});var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
|
||||
function fDynamicUpdate(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,e=b&&"SPAN"==a.tagName&&("f_nav-mini"==a.parentNode.id||"f_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"f_nav-contact"==a.parentNode.id;if(!c&&!e&&!b&&!0!==a)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
|
||||
fFicheManager.storageToFields();fMatriceManager.storageToFields();(c||b)&&fContactManager.storageToFields()}
|
||||
include("/js/includes/input-facebook-subject-min.js",function(){include("/js/includes/input-facebook-contact-min.js",function(){include("/js/includes/input-facebook-mini-min.js",function(){include("/js/includes/input-facebook-fiche-min.js",function(){include("/js/includes/input-facebook-matrice-min.js",function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="username"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));
|
||||
fSubjectManager.attach();fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),$('[data-sublink="facebook"] #f_nav-contact'));fContactManager.attach(fDynamicUpdate);fMiniManager=new inputFacebookMini($('[data-sublink="facebook"] article.mini-relation-panel'),$('[data-sublink="facebook"] #f_nav-mini'));fMiniManager.attach(fDynamicUpdate);fFicheManager=new inputFacebookFiche($('[data-sublink="facebook"] article.relation-panel'),$('[data-sublink="facebook"] #f_nav-fiche'));
|
||||
fFicheManager.attach(fDynamicUpdate);fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel'));fMatriceManager.attach(fDynamicUpdate);$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(a){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();
|
||||
fMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="facebook"] #f_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};var b=$('[data-sublink="facebook"] #f_download-target');
|
||||
b.download="local-facebook-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="facebook"] #f_import-all').addEventListener("click",function(a){$('[data-sublink="facebook"] #f_local-upload').click()},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("change",function(a){a={path:"upload/local_data",file:$('[data-sublink="facebook"] #f_local-upload').files[0]};
|
||||
api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("f_subject",0,a.local_data.subject);lsi["import"]("f_contacts",a.local_data.contacts);lsi["import"]("f_mini-fiches",a.local_data.mini);lsi["import"]("f_fiches",a.local_data.fiches);lsi.set("f_matrice",0,a.local_data.matrice);fSubjectManager.storageToFields();fContactManager.storageToFields();fMatriceManager.storageToFields();fDynamicUpdate(!0)})},!1);$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",
|
||||
function(a){console.log("> GATHERING ALL DATA");fSubjectManager.fieldsToStorage();fContactManager.fieldsToStorage();fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();if(!fSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("f_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),
|
||||
!1;a=lsi["export"]("f_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/facebook",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),
|
||||
!1;console.log(a)},!1)},!1)})})})})});
|
||||
|
|
|
@ -74,12 +74,11 @@ function cDynamicUpdate(target){
|
|||
|
||||
/* [2] Inclusion des scripts externes et lancement
|
||||
=========================================================*/
|
||||
// TODO: Mettre les versions minifiées
|
||||
include('/js/includes/input-phone-subject.js', function(){
|
||||
include('/js/includes/input-phone-contact.js', function(){
|
||||
include('/js/includes/input-phone-mini.js', function(){
|
||||
include('/js/includes/input-phone-fiche.js', function(){
|
||||
include('/js/includes/input-phone-matrice.js', function(){
|
||||
include('/js/includes/input-phone-subject-min.js', function(){
|
||||
include('/js/includes/input-phone-contact-min.js', function(){
|
||||
include('/js/includes/input-phone-mini-min.js', function(){
|
||||
include('/js/includes/input-phone-fiche-min.js', function(){
|
||||
include('/js/includes/input-phone-matrice-min.js', function(){
|
||||
|
||||
|
||||
/* (1) Gestion du formulaire du sujet
|
||||
|
@ -423,13 +422,12 @@ include('/js/includes/input-phone-matrice.js', function(){
|
|||
|
||||
}}
|
||||
// {3} Vérification des fiches //
|
||||
//TODO: Remettre la vérification des fiches
|
||||
// var fiches = lsi.export('p_fiches');
|
||||
// for( var id in fiches )
|
||||
// if( !fiches[id].valid ){
|
||||
// Notification.warning('Attention', 'La <i>fiche complète</i> <b>'+(parseInt(id)+1)+'</b> est incomplète et/ou incorrecte');
|
||||
// return false;
|
||||
// }
|
||||
var fiches = lsi.export('p_fiches');
|
||||
for( var id in fiches )
|
||||
if( !fiches[id].valid ){
|
||||
Notification.warning('Attention', 'La <i>fiche complète</i> <b>'+(parseInt(id)+1)+'</b> est incomplète et/ou incorrecte');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -623,12 +621,11 @@ function fDynamicUpdate(target){
|
|||
|
||||
/* [2] Inclusion des scripts externes et lancement
|
||||
=========================================================*/
|
||||
// TODO: Mettre les versions minifiées
|
||||
include('/js/includes/input-facebook-subject.js', function(){
|
||||
include('/js/includes/input-facebook-contact.js', function(){
|
||||
include('/js/includes/input-facebook-mini.js', function(){
|
||||
include('/js/includes/input-facebook-fiche.js', function(){
|
||||
include('/js/includes/input-facebook-matrice.js', function(){
|
||||
include('/js/includes/input-facebook-subject-min.js', function(){
|
||||
include('/js/includes/input-facebook-contact-min.js', function(){
|
||||
include('/js/includes/input-facebook-mini-min.js', function(){
|
||||
include('/js/includes/input-facebook-fiche-min.js', function(){
|
||||
include('/js/includes/input-facebook-matrice-min.js', function(){
|
||||
|
||||
|
||||
/* (1) Gestion du formulaire du sujet
|
||||
|
@ -829,13 +826,12 @@ include('/js/includes/input-facebook-matrice.js', function(){
|
|||
|
||||
}}
|
||||
// {3} Vérification des fiches //
|
||||
//TODO: Remettre la vérification des fiches
|
||||
// var fiches = lsi.export('f_fiches');
|
||||
// for( var id in fiches )
|
||||
// if( !fiches[id].valid ){
|
||||
// Notification.warning('Attention', 'La <i>fiche complète</i> <b>'+(parseInt(id)+1)+'</b> est incomplète et/ou incorrecte');
|
||||
// return false;
|
||||
// }
|
||||
var fiches = lsi.export('f_fiches');
|
||||
for( var id in fiches )
|
||||
if( !fiches[id].valid ){
|
||||
Notification.warning('Attention', 'La <i>fiche complète</i> <b>'+(parseInt(id)+1)+'</b> est incomplète et/ou incorrecte');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue