NxTIC/view/js/charts-min.js

3 lines
837 B
JavaScript

var subPhone=$('section[data-sublink="phone"]');Chart.defaults.global.responsive=!1;Chart.defaults.global.onClick=function(a,b){console.log(a);console.log(b[0]._datasetIndex,b[0]._index)};subject=273;var charts=["sexe","direction","type","ages","relation"],types=["doughnut","doughnut","doughnut","doughnut","bar"],canvas=[],instances=[],c;for(c in charts)canvas[c]=document.createElement("canvas"),canvas[c].id=charts[c],canvas[c].width=300,canvas[c].height=300,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){var d=b[0];console.log(b);if(0!=a.ModuleError)return!1;var e={labels:a.labels,datasets:a.datasets};console.log(canvas[d],types[d]);instances[d]=new Chart(canvas[d],{type:types[d],animation:{animateScale:!0},data:e})},null,c)};