#14; Portage de tous les graphiques anciennement implémentés

This commit is contained in:
xdrm-brackets 2016-05-24 20:32:43 +02:00
parent f612a94c15
commit f8b8d0aded
3 changed files with 18 additions and 11 deletions

View File

@ -118,11 +118,16 @@
return array(
'ModuleError' => ManagerError::Success,
'xlabels' => $labels,
'title' => 'Répartition des appels',
'pointFormat' => '{series.name}: <b>{point.percentage:.1f}%</b>',
'series' => array(array(
array( 'name' => $labels[0], 'y' => $INCOMING ),
array( 'name' => $labels[1], 'y' => $OUTGOING ),
array( 'name' => $labels[2], 'y' => $MISSED ) ))
'colorByPoint' => true,
'data' => array(
array( 'name' => 'Entrant', 'y' => $INCOMING ),
array( 'name' => 'Sortant', 'y' => $OUTGOING ),
array( 'name' => 'Manqué', 'y' => $MISSED ),
)
))
);
}
@ -182,11 +187,14 @@
return array(
'ModuleError' => ManagerError::Success,
'xlabels' => array('APPELS', 'SMS'),
'title' => 'Répartition des types de communication',
'pointFormat' => '{series.name}: <b>{point.percentage:.1f}%</b>',
'series' => array(array(
'data' => array($PHONE, $SMS),
'backgroundColor' => $colors['default'],
'hoverBackgroundColor' => $colors['hover']
'colorByPoint' => true,
'data' => array(
array( 'name' => 'Appels', 'y' => $PHONE ),
array( 'name' => 'SMS', 'y' => $SMS )
)
))
);
}
@ -250,7 +258,6 @@
'pointFormat' => '{series.name}: <b>{point.percentage:.1f}%</b>',
'series' => array(array(
'colorByPoint' => true,
'name' => 'Répartition des genres',
'data' => array(
array( 'name' => 'Homme', 'y' => $H ),
array( 'name' => 'Femme', 'y' => $F )

View File

@ -1,4 +1,4 @@
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=!1;Chart.defaults.global.tooltips.footerFontSize=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=["pie","pie","pie","column","bar"],canvas=[],instances=[],c;for(c in charts)canvas[c]=document.createElement("div"),canvas[c].id=charts[c],canvas[c].style.width=canvas[c].style.height="column"==types[c]?"40em":"30em",canvas[c].style.margin="2em",subPhone.appendChild(canvas[c]);
var charts=["sexe","direction","type","ages","relations"],types=["pie","pie","pie","column","bar"],canvas=[],instances=[],c;for(c in charts)canvas[c]=document.createElement("div"),canvas[c].id=charts[c],canvas[c].style.width=canvas[c].style.height="pie"!=types[c]?"40em":"30em",canvas[c].style.margin="2em",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 e=b[0];if(0!=a.ModuleError)return!1;var d={chart:{renderTo:canvas[e],defaultSeriesType:types[e]},series:a.series,plotOptions:{pie:{allowPointSelect:!0,cursor:"pointer",dataLabels:{enabled:!0,format:"<b>{point.name}</b>: {point.percentage:.1f} %",style:{color:Highcharts.theme&&Highcharts.theme.contrastTextColor||"black"}}},bar:{allowPointSelect:!0,cursor:"pointer"}}};
null!=a.xlabels&&(d.xAxis={categories:a.xlabels});null!=a.ylabels&&(d.yAxis={categories:a.ylabels});null!=a.title&&(d.title={text:a.title});null!=a.pointFormat&&(d.tooltip={pointFormat:a.pointFormat});instances[e]=new Highcharts.Chart(d)},null,c)};

View File

@ -33,7 +33,7 @@ for( var c in charts ){
canvas[c] = document.createElement('div');
canvas[c].id = charts[c];
// canvas[c].width = canvas[c].height = ( types[c] == 'bar' ) ? 500 : 300;
canvas[c].style.width = canvas[c].style.height = ( types[c] == 'column' ) ? '40em' : '30em';
canvas[c].style.width = canvas[c].style.height = ( types[c] != 'pie' ) ? '40em' : '30em';
canvas[c].style.margin = '2em';
subPhone.appendChild( canvas[c] );
}