text: var chart_xaxis_idx=-1,chart_series,chart_series_index=-1,temp_chart_title;
  $(document).ready(function(){function c(e){a.chart.width=$("#resizer").width()-20;a.chart.height=$("#resizer").height()-20;f!=null&&f.destroy();if(e)a.plotOptions.series.animation=false;f=PMA_queryChart(b,a);if(e)a.plotOptions.series.animation=true}var f=null,b=jQuery.parseJSON($("#querychart").html());chart_series="columns";chart_xaxis_idx=$('select[name="chartXAxis"]').attr("value");$("#resizer").resizable({minHeight:240,minWidth:300,resize:function(){f.setSize(this.offsetWidth-20,this.offsetHeight-
  20,false)}});var a={chart:{type:"line",width:$("#resizer").width()-20,height:$("#resizer").height()-20},xAxis:{title:{text:$('input[name="xaxis_label"]').attr("value")}},yAxis:{title:{text:$('input[name="yaxis_label"]').attr("value")}},title:{text:$('input[name="chartTitle"]').attr("value"),margin:20},plotOptions:{series:{}}};$("#querychart").html("");$('input[name="chartType"]').click(function(){a.chart.type=$(this).attr("value");c();$(this).attr("value")=="bar"||$(this).attr("value")=="column"?
  $("span.barStacked").show():$("span.barStacked").hide()});$('input[name="barStacked"]').click(function(){this.checked?$.extend(true,a,{plotOptions:{series:{stacking:"normal"}}}):$.extend(true,a,{plotOptions:{series:{stacking:null}}});c()});$('input[name="chartTitle"]').focus(function(){temp_chart_title=$(this).val()});$('input[name="chartTitle"]').keyup(function(){var e=$(this).attr("value");if(e.length==0)e=" ";f.setTitle({text:e})});$('input[name="chartTitle"]').blur(function(){$(this).val()!=temp_chart_title&&
  c(true)});$('select[name="chartXAxis"]').change(function(){chart_xaxis_idx=this.value;c()});$('select[name="chartSeries"]').change(function(){chart_series=this.value;chart_series_index=this.selectedIndex;c()});$('input[name="xaxis_label"]').keyup(function(){a.xAxis.title.text=$(this).attr("value");c(true)});$('input[name="yaxis_label"]').keyup(function(){a.yAxis.title.text=$(this).attr("value");c(true)});c();$("#querychart").show()});
  function in_array(c,f){for(var b=0;b<f.length;b++)if(f[b]==c)return true;return false}
  function PMA_queryChart(c,f){if($("#querychart").length!=0){var b=[],a=[],e={type:"linear"},h={};$.each(c[0],function(i){b.push(i)});switch(f.chart.type){case "column":case "spline":case "line":case "bar":e.categories=[];if(chart_series=="columns")for(var g=0,j=0;j<b.length;j++){if(j!=chart_xaxis_idx){a[g]={};a[g].data=[];a[g].name=b[j];$.each(c,function(i,d){a[g].data.push(parseFloat(d[b[j]]));g==0&&chart_xaxis_idx!=-1&&!e.categories[d[b[chart_xaxis_idx]]]&&e.categories.push(d[b[chart_xaxis_idx]])});
  g++}}else{g=0;var l={};$.each(c,function(i,d){for(var m=false,k=0;k<a.length;k++)if(a[k].name==d[chart_series])m=true;if(!m){l[d[chart_series]]=g;a[g]={};a[g].data=[];a[g].name=d[chart_series];g++}});var n;$.each(c,function(i,d){n=d[chart_series];a[l[n]].data.push(parseFloat(d[b[0]]));in_array(d[b[chart_xaxis_idx]],e.categories)||e.categories.push(d[b[chart_xaxis_idx]])})}if(b.length==2)h.title={text:b[0]};break;case "pie":a[0]={};a[0].data=[];$.each(c,function(i,d){a[0].data.push({name:d[b[chart_xaxis_idx]],
  y:parseFloat(d[b[0]])})})}$("div#profilingchart").html("").show();h={chart:{renderTo:"querychart"},title:{text:"",margin:0},series:a,xAxis:e,yAxis:h,plotOptions:{pie:{allowPointSelect:true,cursor:"pointer",dataLabels:{enabled:true,distance:35,formatter:function(){return"<b>"+this.point.name+"</b><br/>"+Highcharts.numberFormat(this.percentage,2)+" %"}}}},tooltip:{formatter:function(){if(this.point.name)return"<b>"+this.series.name+"</b><br/>"+this.point.name+"<br/>"+this.y;return"<b>"+this.series.name+
  "</b><br/>"+this.y}}};if(f.chart.type=="pie")h.tooltip.formatter=function(){return"<b>"+b[0]+"</b><br/>"+this.y};$.extend(true,h,f);return PMA_createChart(h)}};
  