diff --git a/js/sql.js b/js/sql.js index 444a813149..f58a172db2 100644 --- a/js/sql.js +++ b/js/sql.js @@ -1161,42 +1161,43 @@ $(document).ready(function() { * Profiling Chart */ $(document).ready(function() { - if($('#profilingchart').length==0) return; - - var cdata = new Array(); - - $.each(jQuery.parseJSON($('#profilingchart').html()),function(key,value) { - cdata.push([key,parseFloat(value)]); - }); + if($('#profilingchart').length==0) return; + + var cdata = new Array(); + var i=1; + $.each(jQuery.parseJSON($('#profilingchart').html()),function(key,value) { + cdata.push([key,parseFloat(value)]); + i++; + }); - PMA_createChart({ - chart: { - renderTo: 'profilingchart', - backgroundColor: $('#sqlqueryresults fieldset').css('background-color') - }, - title: { text:'', margin:0 }, - series: [{ - type:'pie', - name: 'Query execution time', - data: cdata - }], - plotOptions: { - pie: { - allowPointSelect: true, - cursor: 'pointer', - dataLabels: { - enabled: true, - distance: 35, - formatter: function() { - return ''+ this.point.name +'
'+ Highcharts.numberFormat(this.percentage, 2) +' %'; - } - } - } - }, - tooltip: { - formatter: function() { return ''+ this.point.name +'
'+this.y+'s
('+Highcharts.numberFormat(this.percentage, 2) +' %)'; } - } - }); + PMA_createChart({ + chart: { + renderTo: 'profilingchart', + backgroundColor: $('#sqlqueryresults fieldset').css('background-color') + }, + title: { text:'', margin:0 }, + series: [{ + type:'pie', + name: 'Query execution time', + data: cdata + }], + plotOptions: { + pie: { + allowPointSelect: true, + cursor: 'pointer', + dataLabels: { + enabled: true, + distance: 35, + formatter: function() { + return ''+ this.point.name +'
'+ Highcharts.numberFormat(this.percentage, 2) +' %'; + } + } + } + }, + tooltip: { + formatter: function() { return ''+ this.point.name +'
'+this.y+'s
('+Highcharts.numberFormat(this.percentage, 2) +' %)'; } + } + }); }); /**#@- */ diff --git a/sql.php b/sql.php index 9d01a7b822..1d7933c6b1 100644 --- a/sql.php +++ b/sql.php @@ -17,11 +17,11 @@ require_once './libraries/bookmark.lib.php'; $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js'; if(isset($_SESSION['profiling'])) { - $GLOBALS['js_include'][] = 'highcharts/highcharts.js'; - /* Files required for chart exporting */ - $GLOBALS['js_include'][] = 'highcharts/exporting.js'; - $GLOBALS['js_include'][] = 'canvg/canvg.js'; - $GLOBALS['js_include'][] = 'canvg/rgbcolor.js'; + $GLOBALS['js_include'][] = 'highcharts/highcharts.js'; + /* Files required for chart exporting */ + $GLOBALS['js_include'][] = 'highcharts/exporting.js'; + $GLOBALS['js_include'][] = 'canvg/canvg.js'; + $GLOBALS['js_include'][] = 'canvg/rgbcolor.js'; } /** @@ -897,30 +897,30 @@ else { } if (isset($profiling_results)) { - echo '
' . __('Profiling') . '' . "\n"; - echo '
'; - echo '' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; + echo '
' . __('Profiling') . '' . "\n"; + echo '
'; + echo '
' . __('Status') . '' . __('Time') . '
' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; - $chart_json = Array(); - foreach($profiling_results as $one_result) { - echo ' ' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - $chart_json[ucwords($one_result['Status'])] = $one_result['Duration']; - } + $chart_json = Array(); + foreach($profiling_results as $one_result) { + echo ' ' . "\n"; + echo '' . "\n"; + echo '' . "\n"; + $chart_json[ucwords($one_result['Status'])] = $one_result['Duration']; + } - echo '
' . __('Status') . '' . __('Time') . '
' . ucwords($one_result['Status']) . '' . (PMA_formatNumber($one_result['Duration'],3,1)) . 's
' . ucwords($one_result['Status']) . '' . (PMA_formatNumber($one_result['Duration'],3,1)) . 's
' . "\n"; - echo '
'; - //require_once './libraries/chart.lib.php'; - echo '
'; - //PMA_chart_profiling($profiling_results); - echo json_encode($chart_json); - echo '
'; - echo '
' . "\n"; + echo '' . "\n"; + echo ''; + //require_once './libraries/chart.lib.php'; + echo '
'; + //PMA_chart_profiling($profiling_results); + echo json_encode($chart_json); + echo '
'; + echo '' . "\n"; } // Displays the results in a table