var CHARTS={};CHARTS.toCreate=[];$(document).ready(function(){for(var b=CHARTS.toCreate.length,c=0;c<b;c++){var a=CHARTS.toCreate[c];if(a.chartType==undefined)typeof console!="undefined"&&console.error("No chart type (chartType) defined.");else a.url!=undefined&&a.url!=""?CHARTS.loadData(a,c):CHARTS.createChart(c)}});CHARTS.createChart=function(b){CHARTS.createBarChart(b)}; CHARTS.createBarChart=function(b){chartInfo=CHARTS.toCreate[b];if(typeof chartInfo.data=="function")chartInfo.data=chartInfo.data();eval("new google.visualization."+chartInfo.chartType+'(document.getElementById("'+chartInfo.div+'"))').draw(chartInfo.data,chartInfo);chartInfo.callback!=undefined&&typeof chartInfo.callback=="function"&&chartInfo.callback(chartInfo,b)}; CHARTS.loadData=function(b,c){if(b.ajaxData==undefined)b.ajaxData={};b.index=c;jQuery.get(b.url,b.ajaxData,function(a){var e=new google.visualization.DataTable;a.labels!=undefined&&e.addColumn("string","Labels");var d=false;for(i=0;i<a.data.length;i++){e.addColumn("number",a.dataNames[i]);if(!d){e.addRows(a.data[i].length);for(d=0;d<a.labels.length;d++)e.setValue(d,0,a.labels[d]);d=true}for(var f=0;f<a.data[i].length;f++)e.setValue(f,i+1,a.data[i][f])}delete a.data;delete a.labels;delete a.dataNames; CHARTS.toCreate[c].data=e;for(attrname in a)CHARTS.toCreate[c][attrname]=a[attrname];CHARTS.createChart(c)},"json")};
