NxTIC/public_html/view/js/charts-min.js

6 lines
2.3 KiB
JavaScript
Executable File

var subPhone=$('section[data-sublink="phone"] section#phone-charts-container');subPhone.style.display="flex";subPhone.style.flexWrap="wrap";subPhone.style.justifyContent="space-around";subject=1;var charts="sexe direction type ages relations weekdays duration timeofday".split(" "),canvas=[],instances=[];Highcharts.dateFormats={X:function(e){return(new Date(1E3*e)).toLocaleTimeString()}};
var plotOptions={pie:{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"}}}},column:{column:{shadow:!1,borderWidth:0,stacking:null}},weekdays:{column:{shadow:!1,borderWidth:0,stacking:"normal",dataLabels:{enabled:!0}}},bar:{bar:{allowPointSelect:!0,cursor:"pointer"}},spline:{spline:{pointInterval:1E3}}};
function loadCharts(e){subPhone.innerHTML="";canvas=[];for(var b in charts)canvas[b]=document.createElement("div"),canvas[b].id=charts[b],canvas[b].style.width=canvas[b].style.height="30em",canvas[b].style.margin="2em",subPhone.appendChild(canvas[b]);for(b=0;b<charts.length;b++)api.send({path:"chart/"+charts[b],subject:e},function(a,b){var d=b[0];if(0!=a.ModuleError)return!1;var c={chart:{renderTo:canvas[d],type:a.type},series:a.series,xAxis:{},yAxis:{},tooltip:{}};"pie"==a.type?canvas[d].style.width=
canvas[d].style.height="20em":c.tooltip.headerFormat="<b>{point.x}</b><br>";null!=plotOptions[charts[d]]?c.plotOptions=plotOptions[charts[d]]:null!=plotOptions[a.type]&&(c.plotOptions=plotOptions[a.type]);null!=a.xaxis&&(c.xAxis=a.xaxis);null!=a.yaxis&&(c.yAxis=a.yaxis);null!=a.xlabels&&(c.xAxis.categories=a.xlabels);null!=a.ylabels&&(c.yAxis.categories=a.ylabels);null!=a.zoom&&(c.chart.zoomType=a.zoom);null!=a.title&&(c.title={text:a.title});null!=a.xtitle&&(c.xAxis.title={text:a.xtitle});null!=
a.ytitle&&(c.yAxis.title={text:a.ytitle});null!=a.pointFormat&&(c.tooltip.pointFormat=a.pointFormat);null!=a.headerFormat&&(c.tooltip.headerFormat=a.headerFormat);instances[d]=new Highcharts.Chart(c)},null,b)}var phoneChartsSubject=$("#phone-charts-subject"),phoneChartsSubmit=$("#phone-charts-submit");phoneChartsSubmit.addEventListener("click",function(e){isNaN(phoneChartsSubject.value)||loadCharts(phoneChartsSubject.value)},!1);