#14; Portage de tous les graphiques anciennement implémentés
This commit is contained in:
parent
f612a94c15
commit
f8b8d0aded
|
@ -118,11 +118,16 @@
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'ModuleError' => ManagerError::Success,
|
'ModuleError' => ManagerError::Success,
|
||||||
'xlabels' => $labels,
|
'title' => 'Répartition des appels',
|
||||||
|
'pointFormat' => '{series.name}: <b>{point.percentage:.1f}%</b>',
|
||||||
'series' => array(array(
|
'series' => array(array(
|
||||||
array( 'name' => $labels[0], 'y' => $INCOMING ),
|
'colorByPoint' => true,
|
||||||
array( 'name' => $labels[1], 'y' => $OUTGOING ),
|
'data' => array(
|
||||||
array( 'name' => $labels[2], 'y' => $MISSED ) ))
|
array( 'name' => 'Entrant', 'y' => $INCOMING ),
|
||||||
|
array( 'name' => 'Sortant', 'y' => $OUTGOING ),
|
||||||
|
array( 'name' => 'Manqué', 'y' => $MISSED ),
|
||||||
|
)
|
||||||
|
))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,11 +187,14 @@
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'ModuleError' => ManagerError::Success,
|
'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(
|
'series' => array(array(
|
||||||
'data' => array($PHONE, $SMS),
|
'colorByPoint' => true,
|
||||||
'backgroundColor' => $colors['default'],
|
'data' => array(
|
||||||
'hoverBackgroundColor' => $colors['hover']
|
array( 'name' => 'Appels', 'y' => $PHONE ),
|
||||||
|
array( 'name' => 'SMS', 'y' => $SMS )
|
||||||
|
)
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +258,6 @@
|
||||||
'pointFormat' => '{series.name}: <b>{point.percentage:.1f}%</b>',
|
'pointFormat' => '{series.name}: <b>{point.percentage:.1f}%</b>',
|
||||||
'series' => array(array(
|
'series' => array(array(
|
||||||
'colorByPoint' => true,
|
'colorByPoint' => true,
|
||||||
'name' => 'Répartition des genres',
|
|
||||||
'data' => array(
|
'data' => array(
|
||||||
array( 'name' => 'Homme', 'y' => $H ),
|
array( 'name' => 'Homme', 'y' => $H ),
|
||||||
array( 'name' => 'Femme', 'y' => $F )
|
array( 'name' => 'Femme', 'y' => $F )
|
||||||
|
|
|
@ -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 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"}}};
|
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)};
|
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)};
|
||||||
|
|
|
@ -33,7 +33,7 @@ for( var c in charts ){
|
||||||
canvas[c] = document.createElement('div');
|
canvas[c] = document.createElement('div');
|
||||||
canvas[c].id = charts[c];
|
canvas[c].id = charts[c];
|
||||||
// canvas[c].width = canvas[c].height = ( types[c] == 'bar' ) ? 500 : 300;
|
// 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';
|
canvas[c].style.margin = '2em';
|
||||||
subPhone.appendChild( canvas[c] );
|
subPhone.appendChild( canvas[c] );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue