This commit is contained in:
xdrm-brackets 2016-05-25 12:39:46 +02:00
parent d14b0495f6
commit 47b75ab5ab
3 changed files with 5 additions and 3 deletions

View File

@ -324,6 +324,7 @@
'ModuleError' => ManagerError::Success, 'ModuleError' => ManagerError::Success,
'xlabels' => $labels, 'xlabels' => $labels,
'title' => 'Répartition des ages', 'title' => 'Répartition des ages',
'zoom' => 'x',
'pointFormat' => '{series.name}: <b>{point.y:.1f}%</b>', 'pointFormat' => '{series.name}: <b>{point.y:.1f}%</b>',
'series' => array( 'series' => array(
array( array(

View File

@ -1,5 +1,5 @@
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,d){console.log(a);null!=d[0]&&console.log(d[0]._datasetIndex,d[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,d){console.log(a);null!=d[0]&&console.log(d[0]._datasetIndex,d[0]._index)};subject=273;
var charts="sexe direction type ages relations weekdays timeofday".split(" "),types="pie pie pie column bar column column".split(" "),canvas=[],instances=[],plotOptions=[{pie:{innerSize:"50%",allowPointSelect:!0,cursor:"pointer",startAngle:-90,endAngle:90,dataLabels:{enabled:!0,distance:10,format:"<b>{point.name}</b>: {point.percentage:.1f} %",style:{color:"black",textShadow:"0 0 2px white"}}}}];plotOptions[1]=plotOptions[0];plotOptions[2]=plotOptions[0];plotOptions[3]={column:{shadow:!1,borderWidth:0}}; var charts="sexe direction type ages relations weekdays timeofday".split(" "),types="pie pie pie column bar column column".split(" "),canvas=[],instances=[],plotOptions=[{pie:{showInLegend:!0,innerSize:"50%",allowPointSelect:!0,cursor:"pointer",startAngle:-90,endAngle:90,dataLabels:{enabled:!1,distance:10,format:"<b>{point.name}</b>: {point.percentage:.1f} %",style:{color:"black",textShadow:"0 0 2px white"}}}}];plotOptions[1]=plotOptions[0];plotOptions[2]=plotOptions[0];
plotOptions[5]={column:{shadow:!1,borderWidth:0}};plotOptions[5].column.stacking="normal";plotOptions[4]={bar:{allowPointSelect:!0,cursor:"pointer"}};plotOptions[6]={};for(var 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]); plotOptions[3]={column:{shadow:!1,borderWidth:0}};plotOptions[5]={column:{shadow:!1,borderWidth:0}};plotOptions[5].column.stacking="normal";plotOptions[4]={bar:{allowPointSelect:!0,cursor:"pointer"}};plotOptions[6]={};for(var 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,d){console.log(api.buffer);var e=d[0];if(0!=a.ModuleError)return!1;var b={chart:{renderTo:canvas[e],type:types[e]},series:a.series,plotOptions:plotOptions[e],xAxis:{},yAxis:{}};null!=a.xaxis&&(b.xAxis=a.xaxis);null!=a.yaxis&&(b.yAxis=a.yaxis);null!=a.xlabels&&(b.xAxis.categories=a.xlabels);null!=a.ylabels&&(b.yAxis.categories=a.ylabels);null!=a.zoom&&(b.chart.zoomType=a.zoom);null!=a.title&& for(c=0;c<charts.length;c++){var request={path:"chart/"+charts[c],subject:subject};api.send(request,function(a,d){console.log(api.buffer);var e=d[0];if(0!=a.ModuleError)return!1;var b={chart:{renderTo:canvas[e],type:types[e]},series:a.series,plotOptions:plotOptions[e],xAxis:{},yAxis:{}};null!=a.xaxis&&(b.xAxis=a.xaxis);null!=a.yaxis&&(b.yAxis=a.yaxis);null!=a.xlabels&&(b.xAxis.categories=a.xlabels);null!=a.ylabels&&(b.yAxis.categories=a.ylabels);null!=a.zoom&&(b.chart.zoomType=a.zoom);null!=a.title&&
(b.title={text:a.title});null!=a.pointFormat&&(b.tooltip={pointFormat:a.pointFormat});console.log(b);instances[e]=new Highcharts.Chart(b)},null,c)}; (b.title={text:a.title});null!=a.pointFormat&&(b.tooltip={pointFormat:a.pointFormat});console.log(b);instances[e]=new Highcharts.Chart(b)},null,c)};

View File

@ -28,13 +28,14 @@ var canvas = []; // Contiendra les canvas
var instances = []; // Contiendra les charts var instances = []; // Contiendra les charts
var plotOptions = [ { pie: { // pie var plotOptions = [ { pie: { // pie
showInLegend: true,
innerSize: '50%', innerSize: '50%',
allowPointSelect: true, allowPointSelect: true,
cursor: 'pointer', cursor: 'pointer',
startAngle: -90, startAngle: -90,
endAngle: 90, endAngle: 90,
dataLabels: { dataLabels: {
enabled: true, enabled: false,
distance: 10, distance: 10,
format: '<b>{point.name}</b>: {point.percentage:.1f} %', format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: { color: 'black', textShadow: '0 0 2px white' } style: { color: 'black', textShadow: '0 0 2px white' }